Browse Source

新八大类用户筛选 增加新团购套餐列表回显

qxy 3 months ago
parent
commit
b6af6fec8c

+ 1 - 1
alien-entity/src/main/java/shop/alien/entity/store/vo/StoreInfoVo.java

@@ -142,7 +142,7 @@ public class StoreInfoVo extends StoreInfo {
     @ApiModelProperty(value = "优惠券列表")
     private List<LifeCouponVo> couponList;
 
-    @ApiModelProperty(value = "优惠券列表")
+    @ApiModelProperty(value = "团购套餐列表")
     private List<LifeGroupBuyMainVo> tuangouList;
 
     @ApiModelProperty(value = "员工列表")

+ 27 - 1
alien-store/src/main/java/shop/alien/store/service/impl/StoreInfoServiceImpl.java

@@ -1397,6 +1397,15 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
                 .orderByDesc(LifeCoupon::getCreatedTime);
         // 查询符合条件的优惠券列表
         List<LifeCoupon> quanList = lifeCouponMapper.selectList(quanWrapper);
+        // 构建查询团购套餐条件对象
+        LambdaUpdateWrapper<LifeGroupBuyMain> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
+        // 添加门店ID筛选条件
+        lambdaUpdateWrapper.in(LifeGroupBuyMain::getStoreId, storeIds)
+                // 添加团购套餐状态筛选条件
+                .eq(LifeGroupBuyMain::getStatus, 5)
+                .orderByDesc(LifeGroupBuyMain::getCreatedTime);
+        // 查询符合条件的团购套餐列表
+        List<LifeGroupBuyMain> lifeGroupBuyMainList = lifeGroupBuyMainMapper.selectList(lambdaUpdateWrapper);
         // 获取全部店铺的评分与平均花销
         Map<Object, List<Map<String, Object>>> avgScoreMap = storeEvaluationMapper.allStoreAvgScore().stream().collect(Collectors.groupingBy(o -> o.get("store_id")));
         // 获取用户订单信息,用于计算平均消费
@@ -1464,6 +1473,23 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
                 storeMap.put("quanList", quanMapList);
                 store.setQuanList(quanMapList);
             }
+
+            // 构造该门店的团购套餐列表
+            List<LifeGroupBuyMainVo> lifeGroupBuyMains = new ArrayList<>();
+            if (!lifeGroupBuyMainList.isEmpty()) {
+                for (LifeGroupBuyMain quan : lifeGroupBuyMainList) {
+                    // 如果团购套餐的门店ID与当前门店ID匹配,则添加到团购列表中
+                    if (store.getId().toString().equals(quan.getStoreId())) {
+                        LifeGroupBuyMainVo lifeGroupBuyMainVo = new LifeGroupBuyMainVo();
+                        BeanUtils.copyProperties(quan, lifeGroupBuyMainVo);
+                        lifeGroupBuyMains.add(lifeGroupBuyMainVo);
+                    }
+                }
+                // 将团购套餐列表添加到门店信息中
+                storeMap.put("tuangouList", lifeGroupBuyMains);
+                // 将团购套餐列表添加到门店信息中
+                store.setTuangouList(lifeGroupBuyMains);
+            }
             // 添加门店类型的描述
             storeMap.put("storeTypeStr", store.getStoreTypeStr());
             // 遍历打卡次数列表,找到当前门店的打卡次数并添加到门店信息中
@@ -1480,7 +1506,7 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
                 store.setStoreClockInCount("0");
             }
             // 将当前门店的信息添加到返回结果列表中
-            //returnMaps.add(storeMap);
+//            returnMaps.add(storeMap);
         }
 
         return storeInfoIPage;