Procházet zdrojové kódy

bugfix:店铺列表打卡新增字段->有图片且所有人可见的数量

lyx před 2 týdny
rodič
revize
2b95d5a09f

+ 7 - 0
alien-entity/src/main/java/shop/alien/mapper/StoreClockInMapper.java

@@ -50,4 +50,11 @@ public interface StoreClockInMapper extends BaseMapper<StoreClockIn> {
      */
     @Select("SELECT store_id as storeId, count(store_id) as count FROM `store_clock_in` where delete_flag = 0 GROUP BY store_id ")
     List<Map<Integer, Integer>> getStoreClockInCount();
+     /**
+      * 获取所有店铺打卡次数(有图片并且设置为可见的)
+      *
+      * @return map
+      */
+    @Select("SELECT store_id as storeId, count(store_id) as count FROM `store_clock_in` where delete_flag = 0 and permission = 1 and img_url is not null GROUP BY store_id ")
+    List<Map<Integer, Integer>> getStoreClockInWithCanLookCount();
 }

+ 14 - 0
alien-store/src/main/java/shop/alien/store/service/LifeUserStoreService.java

@@ -110,6 +110,8 @@ public class LifeUserStoreService {
             Map<String, List<Map<String, Object>>> avgPriceMap = lifeUserOrderMapper.allStoreAvgPrice().stream().collect(Collectors.groupingBy(o -> o.get("store_id").toString()));
             // 获取所有店铺的打卡次数
             List<Map<Integer, Integer>> storeClockInCountList = storeClockInService.getStoreClockInCount();
+            // 获取所有店铺打卡次数(有图片并且设置为可见的)
+            List<Map<Integer, Integer>> storeClockInCountMapList = storeClockInService.getStoreClockInWithCanLookCount();
             // 遍历所有门店信息,构造返回结果
             for (StoreInfoVo store : storeInfoVoList) {
 
@@ -204,10 +206,22 @@ public class LifeUserStoreService {
                         storeMap.put("storeClockInCount", b.get("count"));
                     }
                 });
+
+                storeClockInCountMapList.forEach(b -> {
+                    Integer storeId = b.get("storeId");
+                    if (Objects.equals(storeId, store.getId())) {
+                        storeMap.put("storeClockInCountWithCanLook", b.get("count"));
+                    }
+                });
+
                 // 如果未找到打卡次数,则设置为0
                 if (null == storeMap.get("storeClockInCount")) {
                     storeMap.put("storeClockInCount", 0);
                 }
+                // 如果未找到打卡次数(有图片并且设置为可见的),则设置为0
+                if (null == storeMap.get("storeClockInCountWithCanLook")) {
+                    storeMap.put("storeClockInCountWithCanLook", 0);
+                }
                 // 将当前门店的信息添加到返回结果列表中
                 returnMaps.add(storeMap);
             }

+ 6 - 0
alien-store/src/main/java/shop/alien/store/service/StoreClockInService.java

@@ -29,4 +29,10 @@ public interface StoreClockInService extends IService<StoreClockIn> {
     int setImg(int id, String img);
 
     List<Map<Integer, Integer>> getStoreClockInCount();
+    /**
+     * 获取所有店铺打卡次数(有图片并且设置为可见的)
+     *
+     * @return map
+     */
+    List<Map<Integer, Integer>> getStoreClockInWithCanLookCount();
 }

+ 10 - 0
alien-store/src/main/java/shop/alien/store/service/impl/StoreClockInServiceImpl.java

@@ -214,4 +214,14 @@ public class StoreClockInServiceImpl extends ServiceImpl<StoreClockInMapper, Sto
     public List<Map<Integer, Integer>> getStoreClockInCount() {
         return storeClockInMapper.getStoreClockInCount();
     }
+
+    /**
+     * 获取所有店铺打卡次数(有图片并且设置为可见的)
+     *
+     * @return map
+     */
+    @Override
+    public List<Map<Integer, Integer>> getStoreClockInWithCanLookCount() {
+        return storeClockInMapper.getStoreClockInWithCanLookCount();
+    }
 }