浏览代码

根据分类分组外卖商品列表

gqx 2 年之前
父节点
当前提交
97739658e7

+ 49 - 4
jeecg-mall-api/src/main/java/org/jeecg/modules/bus/controller/HotelController.java

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -30,6 +31,8 @@ import org.jeecg.common.util.TokenUtils;
 import org.jeecg.config.ApiVersion;
 import org.jeecg.config.ApiVersionConstant;
 import org.jeecg.config.WebConfig;
+import org.jeecg.modules.bus.vo.BusServiceRepairCategoryVo;
+import org.jeecg.modules.bus.vo.CesStockTypeVo;
 import org.jeecg.modules.business.dto.BookingLayoutRoomsDto;
 import org.jeecg.modules.business.dto.BookingOrderSaveDto;
 import org.jeecg.modules.business.entity.*;
@@ -41,12 +44,10 @@ import org.jeecg.modules.mall.entity.MallHotelOrder;
 import org.jeecg.modules.mall.service.IMallHotelOrderService;
 import org.jeecg.modules.order.entity.CesOrderComment;
 import org.jeecg.modules.order.service.impl.CesOrderCommentServiceImpl;
+import org.jeecg.modules.pos.entity.PosSellClearGoods;
 import org.jeecg.modules.rooms.DTO.CanUseRequestParamDto;
 import org.jeecg.modules.rooms.Vo.CanUseResultVo;
-import org.jeecg.modules.rooms.entity.CesHourRoomRule;
-import org.jeecg.modules.rooms.entity.CesRoomLayout;
-import org.jeecg.modules.rooms.entity.CesRoomLayoutPrice;
-import org.jeecg.modules.rooms.entity.CesRooms;
+import org.jeecg.modules.rooms.entity.*;
 import org.jeecg.modules.rooms.service.*;
 import org.jeecg.modules.system.entity.SysTenant;
 import org.jeecg.modules.system.service.ISysTenantService;
@@ -69,6 +70,7 @@ import java.time.LocalDate;
 import java.time.temporal.ChronoUnit;
 import java.time.temporal.Temporal;
 import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * 酒店列表
@@ -109,6 +111,10 @@ public class HotelController extends WebConfig {
     private IBusDictItemService busDictItemService;
     @Resource
     private CesHourRoomRuleServiceImpl cesHourRoomRuleService;
+    @Resource
+    private CesGoodsServiceImpl cesGoodsService;
+    @Resource
+    private CesStockTypeServiceImpl cesStockTypeService;
     /**
      * 酒店列表查询
      *
@@ -641,4 +647,43 @@ public class HotelController extends WebConfig {
         }
         return Result.OK(mallHotelOrder);
     }
+
+    /**
+     * 根据类型分组外卖商品列表
+     * @param cesGoods
+     * @return
+     */
+    @ApiOperation(value="根据类型分组外卖商品列表", notes="根据类型分组外卖商品列表")
+    @GetMapping(value = "/type_group_goods_list")
+    @ApiVersion(group = ApiVersionConstant.FAP_MALLAPI101)
+    @ApiLogin
+    public Result<List<CesStockTypeVo>> queryPageList(CesGoods cesGoods) {
+        List<CesStockType> list = cesStockTypeService.list(Wrappers.<CesStockType>lambdaQuery()
+                .eq(CesStockType::getHotelId, cesGoods.getHotelId())
+                .eq(CesStockType::getInvalid, false)
+                .like(CesStockType::getApplyScope, "1"));
+        List<CesStockTypeVo> voList = new ArrayList<>();
+        List<CesStockType> pList = list.stream().filter(t -> StringUtils.isNotBlank(t.getParentId()) && !t.getParentId().equals("0")).collect(Collectors.toList());
+        list.forEach(t -> {
+            CesStockTypeVo vo = new CesStockTypeVo();
+            vo.setName(t.getName());
+            LambdaQueryWrapper<CesGoods> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.eq(CesGoods::getInvalid, false);
+            queryWrapper.eq(CesGoods::getIsTemp, false);
+
+            queryWrapper.and(j -> {
+                List<CesStockType> stockTypeList = list.stream().filter(t2 -> t2.getParentId().equals(t.getId())).collect(Collectors.toList());
+                if (ObjectUtils.isNotEmpty(stockTypeList)) {
+                    for (int z = 0; z < stockTypeList.size(); z++) {
+                        j = j.or().eq(CesGoods::getGoodType, stockTypeList.get(z).getId());
+                    }
+                }
+                j = j.or().eq(CesGoods::getGoodType, t.getId());
+            });
+            List<CesGoods> cesGoodsList = cesGoodsService.list(queryWrapper);
+            vo.setList(cesGoodsList);
+            voList.add(vo);
+        });
+        return Result.OK(voList);
+    }
 }

+ 14 - 0
jeecg-mall-api/src/main/java/org/jeecg/modules/bus/vo/CesStockTypeVo.java

@@ -0,0 +1,14 @@
+package org.jeecg.modules.bus.vo;
+
+import lombok.Data;
+import org.jeecg.modules.business.entity.BusServiceRepair;
+import org.jeecg.modules.business.entity.BusServiceRepairCategory;
+import org.jeecg.modules.rooms.entity.CesGoods;
+import org.jeecg.modules.rooms.entity.CesStockType;
+
+import java.util.List;
+
+@Data
+public class CesStockTypeVo extends CesStockType {
+    private List<CesGoods> list;
+}