Jelajahi Sumber

收藏 life_message

qinxuyang 8 jam lalu
induk
melakukan
4779d5fd71
17 mengubah file dengan 246 tambahan dan 68 penghapusan
  1. 7 4
      alien-entity/src/main/java/shop/alien/mapper/LifeCollectMapper.java
  2. 4 4
      alien-entity/src/main/java/shop/alien/mapper/second/SecondRecommendMapper.java
  3. 133 0
      alien-entity/src/main/java/shop/alien/util/type/LifeCollectIdentityQuery.java
  4. 4 4
      alien-entity/src/main/resources/mapper/second/SecondGoodsInfoMapper.xml
  5. 7 4
      alien-second/src/main/java/shop/alien/second/service/impl/SecondGoodsServiceImpl.java
  6. 23 5
      alien-second/src/main/java/shop/alien/second/service/impl/SecondRecommendServiceImpl.java
  7. 8 1
      alien-store-platform/src/main/java/shop/alien/storeplatform/service/impl/LifeGroupBuyPlatformServiceImpl.java
  8. 6 1
      alien-store-platform/src/main/java/shop/alien/storeplatform/service/impl/StoreBusinessServiceImpl.java
  9. 7 27
      alien-store/src/main/java/shop/alien/store/controller/LifeCollectController.java
  10. 2 1
      alien-store/src/main/java/shop/alien/store/service/LifeStoreService.java
  11. 6 2
      alien-store/src/main/java/shop/alien/store/service/LifeUserStoreService.java
  12. 3 1
      alien-store/src/main/java/shop/alien/store/service/impl/CommonRatingServiceImpl.java
  13. 5 7
      alien-store/src/main/java/shop/alien/store/service/impl/LifeDiscountCouponUserServiceImpl.java
  14. 8 1
      alien-store/src/main/java/shop/alien/store/service/impl/LifeGroupBuyServiceImpl.java
  15. 12 2
      alien-store/src/main/java/shop/alien/store/service/impl/LifeGroupPackageServiceImpl.java
  16. 3 2
      alien-store/src/main/java/shop/alien/store/service/impl/StoreClockInServiceImpl.java
  17. 8 2
      alien-store/src/main/java/shop/alien/store/service/impl/StoreInfoServiceImpl.java

+ 7 - 4
alien-entity/src/main/java/shop/alien/mapper/LifeCollectMapper.java

@@ -3,6 +3,7 @@ package shop.alien.mapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import shop.alien.entity.second.vo.SecondGoodsRecommendVo;
 import shop.alien.entity.store.LifeCollect;
@@ -19,8 +20,9 @@ public interface LifeCollectMapper extends BaseMapper<LifeCollect> {
      * 获取收藏的二级商品
      * @param page
      * @param userId
-     * @param s
-     * @param s1
+     * @param collectUserType 收藏人 user_id_user_type
+     * @param collectRefId 收藏人 user_id_ref_id
+     * @param position 经纬度
      * @return
      */
     @Select("<script>" +
@@ -42,7 +44,8 @@ public interface LifeCollectMapper extends BaseMapper<LifeCollect> {
             "  ON lc.business_id = sg.id " +
             "  AND lc.business_type = 1 " +
             "  AND lc.delete_flag = 0 " +
-            "  AND lc.user_id = #{s} " +
+            "  AND lc.user_id_user_type = #{collectUserType} " +
+            "  AND lc.user_id_ref_id = #{collectRefId} " +
             "WHERE sg.delete_flag = 0 " +
             // 动态排除屏蔽商品(空集合不拼接,避免SQL报错)
             "<if test=\"shieldedGoodsIds != null and !shieldedGoodsIds.isEmpty()\">" +
@@ -55,5 +58,5 @@ public interface LifeCollectMapper extends BaseMapper<LifeCollect> {
             // 按收藏时间倒序排序
             "ORDER BY lc.created_time DESC" +
             "</script>")
-    IPage<SecondGoodsRecommendVo> collectSecondGoodsByPage(IPage<SecondGoodsRecommendVo> page, Integer userId, String s, String position, List<Integer> shieldedGoodsIds);
+    IPage<SecondGoodsRecommendVo> collectSecondGoodsByPage(IPage<SecondGoodsRecommendVo> page, @Param("userId") Integer userId, @Param("collectUserType") Integer collectUserType, @Param("collectRefId") Integer collectRefId, @Param("position") String position, @Param("shieldedGoodsIds") List<Integer> shieldedGoodsIds);
 }

+ 4 - 4
alien-entity/src/main/java/shop/alien/mapper/second/SecondRecommendMapper.java

@@ -19,13 +19,13 @@ public interface SecondRecommendMapper extends BaseMapper<SecondGoodsRecommendVo
      */
     IPage<SecondGoodsRecommendVo> getSecondRecommendByPage(IPage<SecondGoodsRecommendVo> page, @Param("userId") Integer userId, @Param("position") String position, @Param("typeId") Integer typeId, @Param("phoneId") String phoneId, @Param("radiusKm") String radiusKm);
 
-    IPage<SecondGoodsRecommendVo> querySecondConcernByPage(IPage<SecondGoodsRecommendVo> page, @Param("userId") Integer userId, @Param("phoneId") String phoneId, @Param("position") String position);
+    IPage<SecondGoodsRecommendVo> querySecondConcernByPage(IPage<SecondGoodsRecommendVo> page, @Param("userId") Integer userId, @Param("phoneId") String phoneId, @Param("position") String position, @Param("collectUserType") Integer collectUserType, @Param("collectRefId") Integer collectRefId);
 
-    IPage<SecondGoodsRecommendVo> querySecondNewGoodsByPage(IPage<SecondGoodsRecommendVo> page,@Param("userId") String userId, @Param("phoneId") String phoneId, @Param("position") String position, @Param("radiusKm") String radiusKm, @Param("timeRange") Integer timeRange);
+    IPage<SecondGoodsRecommendVo> querySecondNewGoodsByPage(IPage<SecondGoodsRecommendVo> page,@Param("userId") String userId, @Param("phoneId") String phoneId, @Param("position") String position, @Param("radiusKm") String radiusKm, @Param("timeRange") Integer timeRange, @Param("collectUserType") Integer collectUserType, @Param("collectRefId") Integer collectRefId);
 
     List<SecondCommentVo> querySecondCommentInfo(@Param("ids") List<Integer> ids);
 
-    SecondGoodsRecommendVo querySecondGoodsDetail(@Param("goodsId") Integer goodsId, @Param("phoneId") String phoneId, @Param("position") String position);
+    SecondGoodsRecommendVo querySecondGoodsDetail(@Param("goodsId") Integer goodsId, @Param("phoneId") String phoneId, @Param("position") String position, @Param("collectUserType") Integer collectUserType, @Param("collectRefId") Integer collectRefId);
 
-    SecondGoodsRecommendVo querySecondGoodsDetailWithoutPosition(@Param("goodsId") Integer goodsId, @Param("phoneId") String phoneId);
+    SecondGoodsRecommendVo querySecondGoodsDetailWithoutPosition(@Param("goodsId") Integer goodsId, @Param("phoneId") String phoneId, @Param("collectUserType") Integer collectUserType, @Param("collectRefId") Integer collectRefId);
 }

+ 133 - 0
alien-entity/src/main/java/shop/alien/util/type/LifeCollectIdentityQuery.java

@@ -0,0 +1,133 @@
+package shop.alien.util.type;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import org.springframework.util.StringUtils;
+import shop.alien.entity.store.LifeCollect;
+import shop.alien.entity.store.LifeUser;
+import shop.alien.mapper.LifeUserMapper;
+
+/**
+ * life_collect 查询条件:将前端 user_{phone}/store_{phone}/lawyer_{phone} 或数字用户 id 解析为 type + refId 后查询。
+ */
+public final class LifeCollectIdentityQuery {
+
+    private static final int TYPE_USER = 1;
+
+    private LifeCollectIdentityQuery() {
+    }
+
+    public static final class Scope {
+        private final String legacyUserId;
+        private final Integer userType;
+        private final Integer refId;
+
+        public Scope(String legacyUserId, Integer userType, Integer refId) {
+            this.legacyUserId = legacyUserId;
+            this.userType = userType;
+            this.refId = refId;
+        }
+
+        public String getLegacyUserId() {
+            return legacyUserId;
+        }
+
+        public Integer getUserType() {
+            return userType;
+        }
+
+        public Integer getRefId() {
+            return refId;
+        }
+
+        public boolean hasTypeRef() {
+            return userType != null && refId != null;
+        }
+    }
+
+    /**
+     * 解析收藏人标识:支持 user_/store_/lawyer_ 前缀、裸手机号、life_user 数字主键。
+     */
+    public static Scope resolve(String userIdKey, TypeUtil typeUtil) {
+        if (!StringUtils.hasText(userIdKey)) {
+            return new Scope(userIdKey, null, null);
+        }
+        String key = userIdKey.trim();
+        if (typeUtil != null && !typeUtil.containsUnderscore(key)) {
+            try {
+                int refId = Integer.parseInt(key);
+                return new Scope(key, TYPE_USER, refId);
+            } catch (NumberFormatException ignored) {
+                key = "user_" + key;
+            }
+        }
+        if (typeUtil != null && typeUtil.containsUnderscore(key)) {
+            PhoneTypeIdResult resolved = typeUtil.resolveTypeAndId(key);
+            if (resolved != null) {
+                return new Scope(key, resolved.getType(), resolved.getId());
+            }
+        }
+        return new Scope(key, null, null);
+    }
+
+    /**
+     * 已知 life_user 主键时直接构造收藏人 scope(type=1)。
+     */
+    public static Scope fromLifeUserId(Integer lifeUserId) {
+        if (lifeUserId == null) {
+            return new Scope(null, null, null);
+        }
+        return new Scope(String.valueOf(lifeUserId), TYPE_USER, lifeUserId);
+    }
+
+    public static void applyUserSide(LambdaQueryWrapper<LifeCollect> wrapper, Scope scope) {
+        if (scope == null || !scope.hasTypeRef()) {
+            return;
+        }
+        wrapper.eq(LifeCollect::getUserIdUserType, scope.getUserType())
+                .eq(LifeCollect::getUserIdRefId, scope.getRefId());
+    }
+
+    public static void applyUserSide(LambdaUpdateWrapper<LifeCollect> wrapper, Scope scope) {
+        if (scope == null || !scope.hasTypeRef()) {
+            return;
+        }
+        wrapper.eq(LifeCollect::getUserIdUserType, scope.getUserType())
+                .eq(LifeCollect::getUserIdRefId, scope.getRefId());
+    }
+
+    public static void applyUserSide(QueryWrapper<LifeCollect> wrapper, Scope scope) {
+        if (scope == null || !scope.hasTypeRef()) {
+            return;
+        }
+        wrapper.eq("user_id_user_type", scope.getUserType())
+                .eq("user_id_ref_id", scope.getRefId());
+    }
+
+    /**
+     * 写入收藏记录时解析 user_id 并填充 user_id_user_type、user_id_ref_id(不改变前端入参 user_id 字符串)。
+     */
+    public static void fillIdentityOnCollect(LifeCollect lifeCollect, TypeUtil typeUtil, LifeUserMapper lifeUserMapper) {
+        if (lifeCollect == null || !StringUtils.hasText(lifeCollect.getUserId())) {
+            return;
+        }
+        String userId = lifeCollect.getUserId().trim();
+        if (typeUtil != null && !typeUtil.containsUnderscore(userId)) {
+            try {
+                LifeUser lifeUser = lifeUserMapper.selectById(Integer.parseInt(userId));
+                if (lifeUser != null && StringUtils.hasText(lifeUser.getUserPhone())) {
+                    userId = "user_" + lifeUser.getUserPhone();
+                    lifeCollect.setUserId(userId);
+                }
+            } catch (NumberFormatException ignored) {
+                // 裸手机号,保持原样由 resolve 处理
+            }
+        }
+        Scope scope = resolve(userId, typeUtil);
+        if (scope.hasTypeRef()) {
+            lifeCollect.setUserIdUserType(scope.getUserType());
+            lifeCollect.setUserIdRefId(scope.getRefId());
+        }
+    }
+}

+ 4 - 4
alien-entity/src/main/resources/mapper/second/SecondGoodsInfoMapper.xml

@@ -132,7 +132,7 @@
                 and g.goods_status = 3
                 and g.delete_flag = 0
             left join life_like_record llr on llr.dianzan_id = #{phoneId} and llr.huifu_id = g.id and llr.type = 6 and llr.delete_flag = 0
-            left join life_collect lc on lc.business_id = g.id and lc.user_id = #{phoneId} and lc.delete_flag = 0 and lc.business_type = 1
+            left join life_collect lc on lc.business_id = g.id and lc.user_id_user_type = #{collectUserType} and lc.user_id_ref_id = #{collectRefId} and lc.delete_flag = 0 and lc.business_type = 1
         where
             f.fans_id = #{phoneId} and f.delete_flag = 0
             and not exists (select 1 from shieldUser s where s.id = g.id)
@@ -212,7 +212,7 @@
             FROM
                 second_goods g inner join life_user u on u.id = g.user_id
                 left join life_like_record llr on llr.dianzan_id = #{phoneId} and llr.huifu_id = g.id and llr.type = 6 and llr.delete_flag = 0
-                left join life_collect lc on lc.business_id = g.id and lc.user_id = #{phoneId} and lc.delete_flag = 0 and lc.business_type = 1
+                left join life_collect lc on lc.business_id = g.id and lc.user_id_user_type = #{collectUserType} and lc.user_id_ref_id = #{collectRefId} and lc.delete_flag = 0 and lc.business_type = 1
             where g.delete_flag = 0
                 and not exists (select 1 from shieldUser s where s.id = g.id)
                 and not exists (select 1 from second_shield s where s.user_id = #{userId} and s.shield_type = 1 and s.shield_id = g.id and s.delete_flag = 0)
@@ -262,7 +262,7 @@
             case when lc.id is null then '0' else '1' end collectStatus
         from second_goods g inner join life_user lu on g.user_id = lu.id and lu.delete_flag = 0
             left join life_like_record llr on llr.dianzan_id = #{phoneId} and llr.huifu_id = g.id and llr.type = 6 and llr.delete_flag = 0
-            left join life_collect lc on lc.business_id = g.id and lc.user_id = #{phoneId} and lc.delete_flag = 0 and lc.business_type = 1
+            left join life_collect lc on lc.business_id = g.id and lc.user_id_user_type = #{collectUserType} and lc.user_id_ref_id = #{collectRefId} and lc.delete_flag = 0 and lc.business_type = 1
         where g.id = #{goodsId} and g.delete_flag = 0
             and g.position != '' and g.position is not null
     </select>
@@ -293,7 +293,7 @@
             case when lc.id is null then '0' else '1' end collectStatus
         from second_goods g inner join life_user lu on g.user_id = lu.id and lu.delete_flag = 0
             left join life_like_record llr on llr.dianzan_id = #{phoneId} and llr.huifu_id = g.id and llr.type = 6 and llr.delete_flag = 0
-            left join life_collect lc on lc.business_id = g.id and lc.user_id = #{phoneId} and lc.delete_flag = 0 and lc.business_type = 1
+            left join life_collect lc on lc.business_id = g.id and lc.user_id_user_type = #{collectUserType} and lc.user_id_ref_id = #{collectRefId} and lc.delete_flag = 0 and lc.business_type = 1
         where g.id = #{goodsId} and g.delete_flag = 0
             and g.position != '' and g.position is not null
     </select>

+ 7 - 4
alien-second/src/main/java/shop/alien/second/service/impl/SecondGoodsServiceImpl.java

@@ -36,6 +36,7 @@ import shop.alien.second.util.SecondHandSearchAiUtils;
 import shop.alien.util.common.Constants;
 import shop.alien.util.common.VideoUtils;
 import shop.alien.util.common.safe.*;
+import shop.alien.util.type.LifeCollectIdentityQuery;
 import shop.alien.util.type.LifeNoticeUtil;
 
 import java.math.BigDecimal;
@@ -1589,9 +1590,10 @@ public class SecondGoodsServiceImpl extends ServiceImpl<SecondGoodsMapper, Secon
         // 批量设置收藏状态
         searchGoodsList.getRecords().forEach(goods -> {
             if (userId != null) {
+                LifeCollectIdentityQuery.Scope collectScope = LifeCollectIdentityQuery.fromLifeUserId(userId);
                 LambdaUpdateWrapper<LifeCollect> updateWrapper = new LambdaUpdateWrapper<>();
-                updateWrapper.eq(LifeCollect::getUserId, "user_"+phone)
-                        .eq(LifeCollect::getBusinessType, Constants.CollectBusinessType.DEFAULT)
+                LifeCollectIdentityQuery.applyUserSide(updateWrapper, collectScope);
+                updateWrapper.eq(LifeCollect::getBusinessType, Constants.CollectBusinessType.DEFAULT)
                         .eq(LifeCollect::getDeleteFlag, Constants.DeleteFlag.NOT_DELETED)
                         .eq(LifeCollect::getBusinessId, goods.getId());
                 if (lifeCollectMapper.selectCount(updateWrapper) > 0) {
@@ -1664,7 +1666,7 @@ public class SecondGoodsServiceImpl extends ServiceImpl<SecondGoodsMapper, Secon
      */
     @Override
     public IPage<SecondGoodsVo> getCollectGoodsPage(IPage<SecondGoodsVo> page, int userId) {
-        LifeUser lifeUser = lifeUserMapper.selectById(userId);
+        LifeCollectIdentityQuery.Scope collectScope = LifeCollectIdentityQuery.fromLifeUserId(userId);
         // 获取商品屏蔽列表
         List<SecondGoods> shieldedGoodsList = getShieldedGoodsList(userId);
         // 提取屏蔽商品ID
@@ -1678,7 +1680,8 @@ public class SecondGoodsServiceImpl extends ServiceImpl<SecondGoodsMapper, Secon
                 .eq("sg.delete_flag", Constants.DeleteFlag.NOT_DELETED)
                 .eq("lc.delete_flag", Constants.DeleteFlag.NOT_DELETED)
                 .notIn(CollectionUtil.isNotEmpty(shieldedGoodsIds), "sg.id", shieldedGoodsIds)
-                .eq("lc.user_id", "user_"+lifeUser.getUserPhone())
+                .eq("lc.user_id_user_type", collectScope.getUserType())
+                .eq("lc.user_id_ref_id", collectScope.getRefId())
                 .orderByDesc("lc.created_time");
         return secondGoodsMapper.getCollectGoodsPage(page, queryWrapper);
     }

+ 23 - 5
alien-second/src/main/java/shop/alien/second/service/impl/SecondRecommendServiceImpl.java

@@ -19,6 +19,8 @@ import shop.alien.mapper.StoreImgMapper;
 import shop.alien.mapper.second.SecondRecommendMapper;
 import shop.alien.second.service.SecondRecommendService;
 import shop.alien.util.common.JwtUtil;
+import shop.alien.util.type.LifeCollectIdentityQuery;
+import shop.alien.util.type.TypeUtil;
 
 import java.math.BigDecimal;
 import java.util.ArrayList;
@@ -40,6 +42,9 @@ public class SecondRecommendServiceImpl extends ServiceImpl<SecondRecommendMappe
 
     @Autowired
     private LifeFansMapper lifeFansMapper;
+
+    @Autowired
+    private TypeUtil typeUtil;
     /**
      * 获取二手商品推荐列表
      * @param page 分页信息
@@ -94,7 +99,8 @@ public class SecondRecommendServiceImpl extends ServiceImpl<SecondRecommendMappe
             if (StringUtil.isBlank(phoneId)) {
                 return null;
             }
-            IPage<SecondGoodsRecommendVo> list = mapper.querySecondConcernByPage(page, userId, "user_" + phoneId, position);
+            LifeCollectIdentityQuery.Scope collectScope = resolveCollectScope(phoneId, userId);
+            IPage<SecondGoodsRecommendVo> list = mapper.querySecondConcernByPage(page, userId, "user_" + phoneId, position, collectScope.getUserType(), collectScope.getRefId());
             List<Integer> idList = list.getRecords().stream() // 创建流
                     .map(obj -> obj.getId())   // 提取每个元素的 ID
                     .collect(Collectors.toList());
@@ -140,14 +146,17 @@ public class SecondRecommendServiceImpl extends ServiceImpl<SecondRecommendMappe
             JSONObject data = JwtUtil.getCurrentUserInfo();
             String phoneId = null;
             String userId = null;
+            Integer lifeUserId = null;
             if (data != null) {
                 phoneId = data.getString("phone");
                 userId = data.getString("userId");
+                lifeUserId = data.getInteger("userId");
             }
             if (StringUtil.isBlank(phoneId)) {
                 return null;
             }
-            IPage<SecondGoodsRecommendVo> list = mapper.querySecondNewGoodsByPage(page, userId,"user_" + phoneId, position, radiusKm, timeRange);
+            LifeCollectIdentityQuery.Scope collectScope = resolveCollectScope(phoneId, lifeUserId);
+            IPage<SecondGoodsRecommendVo> list = mapper.querySecondNewGoodsByPage(page, userId,"user_" + phoneId, position, radiusKm, timeRange, collectScope.getUserType(), collectScope.getRefId());
             List<Integer> idList = list.getRecords().stream() // 创建流
                     .map(obj -> obj.getId())   // 提取每个元素的 ID
                     .collect(Collectors.toList());
@@ -192,9 +201,10 @@ public class SecondRecommendServiceImpl extends ServiceImpl<SecondRecommendMappe
                 return null;
             }
             String collectUserId = toLifeCollectUserId(phoneId);
+            LifeCollectIdentityQuery.Scope collectScope = LifeCollectIdentityQuery.resolve(collectUserId, typeUtil);
             SecondGoodsRecommendVo item = StringUtil.isBlank(position)
-                    ? mapper.querySecondGoodsDetailWithoutPosition(goodsId, collectUserId)
-                    : mapper.querySecondGoodsDetail(goodsId, collectUserId, position);
+                    ? mapper.querySecondGoodsDetailWithoutPosition(goodsId, collectUserId, collectScope.getUserType(), collectScope.getRefId())
+                    : mapper.querySecondGoodsDetail(goodsId, collectUserId, position, collectScope.getUserType(), collectScope.getRefId());
             applySecondGoodsDetailEnrichment(item, phoneId, goodsId);
             return item;
         } catch (Exception e) {
@@ -210,7 +220,8 @@ public class SecondRecommendServiceImpl extends ServiceImpl<SecondRecommendMappe
                 return null;
             }
             String collectUserId = toLifeCollectUserId(phoneId);
-            SecondGoodsRecommendVo item = mapper.querySecondGoodsDetail(goodsId, collectUserId, position);
+            LifeCollectIdentityQuery.Scope collectScope = LifeCollectIdentityQuery.resolve(collectUserId, typeUtil);
+            SecondGoodsRecommendVo item = mapper.querySecondGoodsDetail(goodsId, collectUserId, position, collectScope.getUserType(), collectScope.getRefId());
             applySecondGoodsDetailEnrichment(item, phoneId, goodsId);
             return item;
         } catch (Exception e) {
@@ -232,6 +243,13 @@ public class SecondRecommendServiceImpl extends ServiceImpl<SecondRecommendMappe
         return t.startsWith("user_") ? t : "user_" + t;
     }
 
+    private LifeCollectIdentityQuery.Scope resolveCollectScope(String phoneId, Integer lifeUserId) {
+        if (lifeUserId != null) {
+            return LifeCollectIdentityQuery.fromLifeUserId(lifeUserId);
+        }
+        return LifeCollectIdentityQuery.resolve(toLifeCollectUserId(phoneId), typeUtil);
+    }
+
     /**
      * 二手商品详情公共填充:图片列表(含视频排序)、关注状态、距离文案、价格展示;收藏状态由 SQL 已带出,此处补默认「未收藏」。
      */

+ 8 - 1
alien-store-platform/src/main/java/shop/alien/storeplatform/service/impl/LifeGroupBuyPlatformServiceImpl.java

@@ -25,6 +25,8 @@ import shop.alien.mapper.*;
 import shop.alien.mapper.storePlantform.LifeGroupBuyMainPlantformMapper;
 import shop.alien.storeplatform.service.LifeGroupBuyPlatformService;
 import shop.alien.util.common.JwtUtil;
+import shop.alien.util.type.LifeCollectIdentityQuery;
+import shop.alien.util.type.TypeUtil;
 
 import java.math.BigDecimal;
 import java.util.*;
@@ -68,6 +70,8 @@ public class LifeGroupBuyPlatformServiceImpl extends ServiceImpl<LifeGroupBuyMai
      */
     private final LifeCollectMapper lifeCollectMapper;
 
+    private final TypeUtil typeUtil;
+
     /**
      * 审核记录 Mapper
      */
@@ -338,7 +342,10 @@ public class LifeGroupBuyPlatformServiceImpl extends ServiceImpl<LifeGroupBuyMai
         BeanUtils.copyProperties(lifeGroupBuyMain, platform);
 
         // 是否收藏了该团购
-        LifeCollect lifeCollect = lifeCollectMapper.selectOne(new QueryWrapper<LifeCollect>().eq("user_id", userId).eq("coupon_id", id));
+        LambdaQueryWrapper<LifeCollect> collectQuery = new LambdaQueryWrapper<>();
+        LifeCollectIdentityQuery.applyUserSide(collectQuery, LifeCollectIdentityQuery.resolve(userId, typeUtil));
+        collectQuery.eq(LifeCollect::getCouponId, id);
+        LifeCollect lifeCollect = lifeCollectMapper.selectOne(collectQuery);
         dto.setIsCollect("0");
         if (!Objects.isNull(lifeCollect)) {
             dto.setIsCollect("1");

+ 6 - 1
alien-store-platform/src/main/java/shop/alien/storeplatform/service/impl/StoreBusinessServiceImpl.java

@@ -44,7 +44,9 @@ import shop.alien.util.common.DistanceUtil;
 import shop.alien.util.common.constant.CouponStatusEnum;
 import shop.alien.util.common.constant.CouponTypeEnum;
 import shop.alien.util.common.constant.OrderStatusEnum;
+import shop.alien.util.type.LifeCollectIdentityQuery;
 import shop.alien.util.type.LifeNoticeUtil;
+import shop.alien.util.type.TypeUtil;
 
 import javax.annotation.Resource;
 import java.io.File;
@@ -111,6 +113,8 @@ public class StoreBusinessServiceImpl extends ServiceImpl<StoreInfoMapper, Store
 
     private final LifeCollectMapper lifeCollectMapper;
 
+    private final TypeUtil typeUtil;
+
     private final StoreStaffConfigMapper storeStaffConfigMapper;
 
     private final StoreClockInMapper storeClockInMapper;
@@ -1141,7 +1145,8 @@ public class StoreBusinessServiceImpl extends ServiceImpl<StoreInfoMapper, Store
         }
         // 当前登录用户是否收藏
         LambdaUpdateWrapper<LifeCollect> shouCangWrapper = new LambdaUpdateWrapper<>();
-        shouCangWrapper.eq(LifeCollect::getUserId, userId).eq(LifeCollect::getStoreId, storeId);
+        LifeCollectIdentityQuery.applyUserSide(shouCangWrapper, LifeCollectIdentityQuery.resolve(userId, typeUtil));
+        shouCangWrapper.eq(LifeCollect::getStoreId, storeId);
         List<LifeCollect> shouCangList = lifeCollectMapper.selectList(shouCangWrapper);
         if (null == shouCangList || shouCangList.isEmpty()) {
             result.setCollection(0);

+ 7 - 27
alien-store/src/main/java/shop/alien/store/controller/LifeCollectController.java

@@ -26,7 +26,7 @@ import shop.alien.store.annotation.TrackEvent;
 import shop.alien.store.config.GaoDeMapUtil;
 import shop.alien.util.common.JwtUtil;
 import shop.alien.util.common.ListToPage;
-import shop.alien.util.type.PhoneTypeIdResult;
+import shop.alien.util.type.LifeCollectIdentityQuery;
 import shop.alien.util.type.TypeUtil;
 
 import java.math.BigDecimal;
@@ -94,7 +94,7 @@ public class LifeCollectController {
     ) {
         log.info("LifeCollectController.selectCollectList?userId={},page={},size={},jingdu={},weidu={},businessSection={},keyword={}", userId, page, size, jingdu, weidu,businessSection,keyword);
         LambdaUpdateWrapper<LifeCollect> wrapper = new LambdaUpdateWrapper<>();
-        wrapper.eq(LifeCollect::getUserId, userId);
+        LifeCollectIdentityQuery.applyUserSide(wrapper, LifeCollectIdentityQuery.resolve(userId, typeUtil));
         wrapper.eq(LifeCollect::getDeleteFlag, 0).isNotNull(LifeCollect::getStoreId).orderByDesc(LifeCollect::getCreatedTime);
         List<LifeCollect> lifeCollectList = lifeCollectMapper.selectList(wrapper);
         List<StoreInfoVo> storeVoList = new ArrayList<>();
@@ -186,7 +186,7 @@ public class LifeCollectController {
                                                               @RequestParam String keyword){
         log.info("LifeCollectController.selectCouponCollectList?userId={},page={},size={},businessSection={},keyword={}", userId, page, size,businessSection,keyword);
         LambdaUpdateWrapper<LifeCollect> wrapper = new LambdaUpdateWrapper<>();
-        wrapper.eq(LifeCollect::getUserId, userId);
+        LifeCollectIdentityQuery.applyUserSide(wrapper, LifeCollectIdentityQuery.resolve(userId, typeUtil));
         wrapper.eq(LifeCollect::getDeleteFlag, 0).isNotNull(LifeCollect::getCouponId).orderByDesc(LifeCollect::getCreatedTime);
         List<LifeCollect> lifeCollectList = lifeCollectMapper.selectList(wrapper);
         List<LifeGroupBuyMain> lifeCoupons = new ArrayList<>();
@@ -263,27 +263,7 @@ public class LifeCollectController {
      * 解析 user_{phone}/store_{phone}/lawyer_{phone},写入 user_id_user_type、user_id_ref_id
      */
     private void fillCollectUserIdentity(LifeCollect lifeCollect) {
-        if (lifeCollect == null || org.springframework.util.StringUtils.isEmpty(lifeCollect.getUserId())) {
-            return;
-        }
-        String userId = lifeCollect.getUserId().trim();
-        if ( typeUtil.containsUnderscore(userId) ) {
-            try {
-                LifeUser lifeUser = lifeUserMapper.selectById(Integer.parseInt(userId));
-                if (lifeUser == null || org.springframework.util.StringUtils.isEmpty(lifeUser.getUserPhone())) {
-                    return;
-                }
-                userId = "user_" + lifeUser.getUserPhone();
-                lifeCollect.setUserId(userId);
-            } catch (NumberFormatException e) {
-                return;
-            }
-        }
-        PhoneTypeIdResult result = typeUtil.resolveTypeAndId(userId);
-        if (result != null) {
-            lifeCollect.setUserIdUserType(result.getType());
-            lifeCollect.setUserIdRefId(result.getId());
-        }
+        LifeCollectIdentityQuery.fillIdentityOnCollect(lifeCollect, typeUtil, lifeUserMapper);
     }
 
     @ApiOperation("取消收藏")
@@ -301,7 +281,7 @@ public class LifeCollectController {
             @RequestParam(value = "couponId", required = false) String couponId) {
         log.info("LifeCollectController.cancelCollect?userId={},storeId={},businessId={},businessType={}", userId, storeId, businessId, businessType);
         LambdaUpdateWrapper<LifeCollect> wrapper = new LambdaUpdateWrapper<>();
-        wrapper.eq(LifeCollect::getUserId, userId);
+        LifeCollectIdentityQuery.applyUserSide(wrapper, LifeCollectIdentityQuery.resolve(userId, typeUtil));
         if(!StringUtils.isEmpty(storeId)) {
             wrapper.eq(LifeCollect::getStoreId, storeId);
         } else if (!StringUtils.isEmpty(couponId)){
@@ -358,7 +338,6 @@ public class LifeCollectController {
             if (StringUtil.isBlank(phoneId)) {
                 return null;
             }
-            LifeUser lifeUser = lifeUserMapper.selectById(userId);
             // 获取商品屏蔽列表
             List<SecondGoods> shieldedGoodsList = getShieldedGoodsList(userId);
             // 提取屏蔽商品ID
@@ -375,7 +354,8 @@ public class LifeCollectController {
 //                    .eq("lc.user_id", "user_"+lifeUser.getUserPhone())
 //                    .orderByDesc("lc.created_time");
 
-            IPage<SecondGoodsRecommendVo> list = lifeCollectMapper.collectSecondGoodsByPage(page, userId, "user_" + phoneId, longitude + "," + latitude, shieldedGoodsIds);
+            LifeCollectIdentityQuery.Scope collectScope = LifeCollectIdentityQuery.fromLifeUserId(userId);
+            IPage<SecondGoodsRecommendVo> list = lifeCollectMapper.collectSecondGoodsByPage(page, userId, collectScope.getUserType(), collectScope.getRefId(), longitude + "," + latitude, shieldedGoodsIds);
             List<Integer> idList = list.getRecords().stream() // 创建流
                     .map(obj -> obj.getId())   // 提取每个元素的 ID
                     .collect(Collectors.toList());

+ 2 - 1
alien-store/src/main/java/shop/alien/store/service/LifeStoreService.java

@@ -20,6 +20,7 @@ import shop.alien.mapper.*;
 import shop.alien.store.config.BaseRedisService;
 import shop.alien.store.util.LifeFansIdentityQuery;
 import shop.alien.util.common.ListToPage;
+import shop.alien.util.type.LifeCollectIdentityQuery;
 import shop.alien.util.type.TypeUtil;
 
 import java.time.LocalDateTime;
@@ -366,7 +367,7 @@ public class LifeStoreService {
                 BeanUtils.copyProperties(store, vo);
                 LambdaUpdateWrapper<LifeCollect> wrapper = new LambdaUpdateWrapper<>();
                 wrapper.eq(LifeCollect::getStoreId, store.getId());
-                wrapper.eq(LifeCollect::getUserId, userId);
+                LifeCollectIdentityQuery.applyUserSide(wrapper, LifeCollectIdentityQuery.resolve(userId, typeUtil));
                 List<LifeCollect> storeShoucangs = lifeCollectMapper.selectList(wrapper);
                 if (!CollectionUtils.isEmpty(storeShoucangs)) {
                     vo.setIsShoucang("1");

+ 6 - 2
alien-store/src/main/java/shop/alien/store/service/LifeUserStoreService.java

@@ -17,6 +17,8 @@ import shop.alien.util.common.DistanceUtil;
 import shop.alien.util.common.ListToPage;
 import shop.alien.util.common.UniqueRandomNumGenerator;
 import shop.alien.util.common.constant.DiscountCouponEnum;
+import shop.alien.util.type.LifeCollectIdentityQuery;
+import shop.alien.util.type.TypeUtil;
 
 import java.time.LocalDate;
 import java.time.ZoneId;
@@ -49,6 +51,8 @@ public class LifeUserStoreService {
 
     private final GaoDeMapUtil gaoDeMapUtil;
 
+    private final TypeUtil typeUtil;
+
     private final StoreClockInService storeClockInService;
 
     private final StoreBusinessInfoMapper storeBusinessInfoMapper;
@@ -351,8 +355,8 @@ public class LifeUserStoreService {
         }
 
         LambdaUpdateWrapper<LifeCollect> shouCangWrapper = new LambdaUpdateWrapper<>();
-        shouCangWrapper.eq(LifeCollect::getUserId, userId)
-                .eq(LifeCollect::getStoreId, storeId);
+        LifeCollectIdentityQuery.applyUserSide(shouCangWrapper, LifeCollectIdentityQuery.resolve(userId, typeUtil));
+        shouCangWrapper.eq(LifeCollect::getStoreId, storeId);
         LifeCollect shouCang = lifeCollectMapper.selectOne(shouCangWrapper);
         if (shouCang == null) {
             storeMap.put("collection", 0);

+ 3 - 1
alien-store/src/main/java/shop/alien/store/service/impl/CommonRatingServiceImpl.java

@@ -44,6 +44,7 @@ import shop.alien.util.common.constant.CommentSourceTypeEnum;
 import shop.alien.util.common.constant.RatingBusinessTypeEnum;
 import shop.alien.util.common.safe.TextModerationUtil;
 import shop.alien.util.common.safe.TextReviewServiceEnum;
+import shop.alien.util.type.LifeCollectIdentityQuery;
 import shop.alien.util.type.LifeNoticeUtil;
 
 import java.math.BigDecimal;
@@ -906,9 +907,10 @@ public class CommonRatingServiceImpl extends ServiceImpl<CommonRatingMapper, Com
             }
             // 1.1 查询是否收藏该店铺
             LambdaQueryWrapper<LifeCollect> collectWrapper = new LambdaQueryWrapper<LifeCollect>()
-                    .eq(LifeCollect::getUserId, userId)
                     .eq(LifeCollect::getStoreId, storeInfo.getId())
                     .eq(LifeCollect::getDeleteFlag, 0);
+            LifeCollectIdentityQuery.applyUserSide(collectWrapper,
+                    LifeCollectIdentityQuery.fromLifeUserId(userId != null ? userId.intValue() : null));
             LifeCollect lifeCollect = lifeCollectMapper.selectOne(collectWrapper);
             if(lifeCollect != null){
                 commonRatingVo.setIsCollect(1);

+ 5 - 7
alien-store/src/main/java/shop/alien/store/service/impl/LifeDiscountCouponUserServiceImpl.java

@@ -25,7 +25,7 @@ import shop.alien.store.service.LifeDiscountCouponUserService;
 import shop.alien.util.common.constant.DiscountCouponEnum;
 import shop.alien.util.coupon.DiscountCouponExpirationUtil;
 import shop.alien.util.coupon.LifeDiscountCouponStock;
-import shop.alien.util.type.PhoneTypeIdResult;
+import shop.alien.util.type.LifeCollectIdentityQuery;
 import shop.alien.util.type.TypeUtil;
 
 import java.time.LocalDate;
@@ -140,20 +140,18 @@ public class LifeDiscountCouponUserServiceImpl extends ServiceImpl<LifeDiscountC
                         ? "user_" + lifeUser.getUserPhone()
                         : lifeDiscountCouponUserDto.getUserId().toString();
 
+                LifeCollectIdentityQuery.Scope collectScope = LifeCollectIdentityQuery.resolve(collectUserId, typeUtil);
+
                 LambdaQueryWrapper<LifeCollect> lifeCollectLambdaQueryWrapper = new LambdaQueryWrapper<>();
                 lifeCollectLambdaQueryWrapper.eq(LifeCollect::getStoreId, lifeDiscountCoupon.getStoreId());
-                lifeCollectLambdaQueryWrapper.eq(LifeCollect::getUserId, collectUserId);
+                LifeCollectIdentityQuery.applyUserSide(lifeCollectLambdaQueryWrapper, collectScope);
                 lifeCollectLambdaQueryWrapper.eq(LifeCollect::getDeleteFlag, 0);
                 int lifeCollectCount = lifeCollectMapper.selectCount(lifeCollectLambdaQueryWrapper);
                 if(lifeCollectCount == 0){
                     LifeCollect lifeCollect = new LifeCollect();
                     lifeCollect.setStoreId(lifeDiscountCoupon.getStoreId());
                     lifeCollect.setUserId(collectUserId);
-                    PhoneTypeIdResult typeId = typeUtil.resolveTypeAndId(collectUserId);
-                    if (typeId != null) {
-                        lifeCollect.setUserIdUserType(typeId.getType());
-                        lifeCollect.setUserIdRefId(typeId.getId());
-                    }
+                    LifeCollectIdentityQuery.fillIdentityOnCollect(lifeCollect, typeUtil, lifeUserMapper);
                     lifeCollectMapper.insert(lifeCollect);
                     //同步店铺收藏数量
                     if (!StringUtils.isEmpty(lifeCollect.getStoreId())) {

+ 8 - 1
alien-store/src/main/java/shop/alien/store/service/impl/LifeGroupBuyServiceImpl.java

@@ -21,6 +21,8 @@ import shop.alien.entity.store.vo.StoreMenuVo;
 import shop.alien.mapper.*;
 import shop.alien.store.service.LifeGroupBuyService;
 import shop.alien.util.common.JwtUtil;
+import shop.alien.util.type.LifeCollectIdentityQuery;
+import shop.alien.util.type.TypeUtil;
 
 import java.util.*;
 import java.util.stream.Collectors;
@@ -44,6 +46,8 @@ public class LifeGroupBuyServiceImpl extends ServiceImpl<LifeGroupBuyMainMapper,
 
     private final LifeCollectMapper lifeCollectMapper;
 
+    private final TypeUtil typeUtil;
+
     private final WebAuditMapper webAuditMapper;
 
     private final LifeUserOrderMapper lifeUserOrderMapper;
@@ -161,7 +165,10 @@ public class LifeGroupBuyServiceImpl extends ServiceImpl<LifeGroupBuyMainMapper,
         List<LifeGroupBuyThali> lifeGroupBuyThalis = lifeGroupBuyThaliMapper.selectList(new LambdaQueryWrapper<LifeGroupBuyThali>().eq(LifeGroupBuyThali::getParentId, id).eq(LifeGroupBuyThali::getDeleteFlag, 0));
 
         // 是否收藏了该团购
-        LifeCollect lifeCollect = lifeCollectMapper.selectOne(new QueryWrapper<LifeCollect>().eq("user_id", userId).eq("coupon_id", id));
+        LambdaQueryWrapper<LifeCollect> collectQuery = new LambdaQueryWrapper<>();
+        LifeCollectIdentityQuery.applyUserSide(collectQuery, LifeCollectIdentityQuery.resolve(userId, typeUtil));
+        collectQuery.eq(LifeCollect::getCouponId, id);
+        LifeCollect lifeCollect = lifeCollectMapper.selectOne(collectQuery);
         lifeGroupBuyThaliVo.setIsCollect("0");
         if (!Objects.isNull(lifeCollect)) {
             lifeGroupBuyThaliVo.setIsCollect("1");

+ 12 - 2
alien-store/src/main/java/shop/alien/store/service/impl/LifeGroupPackageServiceImpl.java

@@ -19,7 +19,9 @@ import shop.alien.store.util.GroupConstant;
 import shop.alien.util.common.UniqueRandomNumGenerator;
 import shop.alien.util.common.constant.DiscountCouponEnum;
 import shop.alien.util.coupon.DiscountCouponExpirationUtil;
+import shop.alien.util.type.LifeCollectIdentityQuery;
 import shop.alien.util.type.LifeNoticeUtil;
+import shop.alien.util.type.TypeUtil;
 
 import java.math.BigDecimal;
 import java.time.LocalDate;
@@ -54,6 +56,8 @@ public class LifeGroupPackageServiceImpl extends ServiceImpl<LifeGroupPackageMap
     private final StoreHotelGroupRoomInfoMapper storeHotelGroupRoomInfoMapper;
     private final LifeCollectMapper lifeCollectMapper;
 
+    private final TypeUtil typeUtil;
+
 
     @Override
     public int addOrUpdateGroupPackage(LifeTuanGouParamVo lifeTuanGouParamVo) {
@@ -433,7 +437,10 @@ public class LifeGroupPackageServiceImpl extends ServiceImpl<LifeGroupPackageMap
         Map<String, List<LifeGroupPackage>> groupedPackages = tuangouPackageList.stream().collect(Collectors.groupingBy(LifeGroupPackage::getGroupName));
         List<Map<String, Object>> resultList = new ArrayList<>();
         // 是否收藏了该团购
-        LifeCollect lifeCollect = lifeCollectMapper.selectOne(new QueryWrapper<LifeCollect>().eq("user_id", userId).eq("coupon_id", id));
+        LambdaQueryWrapper<LifeCollect> collectQuery = new LambdaQueryWrapper<>();
+        LifeCollectIdentityQuery.applyUserSide(collectQuery, LifeCollectIdentityQuery.resolve(userId, typeUtil));
+        collectQuery.eq(LifeCollect::getCouponId, id);
+        LifeCollect lifeCollect = lifeCollectMapper.selectOne(collectQuery);
         for (Map.Entry<String, List<LifeGroupPackage>> entry : groupedPackages.entrySet()) {
             String groupName = entry.getKey();
             List<LifeGroupPackage> packageList = entry.getValue();
@@ -497,7 +504,10 @@ public class LifeGroupPackageServiceImpl extends ServiceImpl<LifeGroupPackageMap
         updateWrapper.eq(StoreHotelGroupRoomInfo::getGroupId, tuangou.getId());
         List<StoreHotelGroupRoomInfo> storeHotelGroupRoomInfoList = storeHotelGroupRoomInfoMapper.selectList(updateWrapper);
         // 是否收藏了该团购
-        LifeCollect lifeCollect = lifeCollectMapper.selectOne(new QueryWrapper<LifeCollect>().eq("user_id", userId).eq("coupon_id", id));
+        LambdaQueryWrapper<LifeCollect> collectQuery = new LambdaQueryWrapper<>();
+        LifeCollectIdentityQuery.applyUserSide(collectQuery, LifeCollectIdentityQuery.resolve(userId, typeUtil));
+        collectQuery.eq(LifeCollect::getCouponId, id);
+        LifeCollect lifeCollect = lifeCollectMapper.selectOne(collectQuery);
 
         // 添加商户信息
         StoreInfo storeUser = storeInfoMapper.selectById(tuangou.getStoreId());

+ 3 - 2
alien-store/src/main/java/shop/alien/store/service/impl/StoreClockInServiceImpl.java

@@ -29,6 +29,7 @@ import shop.alien.util.type.LifeNoticeUtil;
 import shop.alien.store.util.ai.AiContentModerationUtil;
 import shop.alien.util.common.constant.CommentSourceTypeEnum;
 import shop.alien.util.type.PhoneTypeIdResult;
+import shop.alien.util.type.LifeCollectIdentityQuery;
 import shop.alien.util.type.TypeUtil;
 
 import javax.annotation.PostConstruct;
@@ -245,7 +246,7 @@ public class StoreClockInServiceImpl extends ServiceImpl<StoreClockInMapper, Sto
 
         // 查询我的收藏 - 使用Set提高查找效率
         LambdaQueryWrapper<LifeCollect> collectWrapper = new LambdaQueryWrapper<>();
-        collectWrapper.eq(LifeCollect::getUserId, String.valueOf(userId));
+        LifeCollectIdentityQuery.applyUserSide(collectWrapper, LifeCollectIdentityQuery.fromLifeUserId(userId));
         List<LifeCollect> lifeCollectList = lifeCollectMapper.selectList(collectWrapper);
         Set<String> collectSet = lifeCollectList.stream()
                 .map(LifeCollect::getStoreId)
@@ -536,7 +537,7 @@ public class StoreClockInServiceImpl extends ServiceImpl<StoreClockInMapper, Sto
         storeClockInVo.setIsCollect("0");
         if (userId != null) {
             LambdaQueryWrapper<LifeCollect> collectWrapper = new LambdaQueryWrapper<>();
-            collectWrapper.eq(LifeCollect::getUserId, String.valueOf(userId));
+            LifeCollectIdentityQuery.applyUserSide(collectWrapper, LifeCollectIdentityQuery.fromLifeUserId(userId));
             List<LifeCollect> lifeCollectList = lifeCollectMapper.selectList(collectWrapper);
             List<String> collectList = lifeCollectList.stream().map(LifeCollect::getStoreId).collect(Collectors.toList());
             if (collectList.contains(storeClockInVo.getStoreId().toString())){

+ 8 - 2
alien-store/src/main/java/shop/alien/store/service/impl/StoreInfoServiceImpl.java

@@ -52,7 +52,9 @@ import shop.alien.util.common.constant.CouponStatusEnum;
 import shop.alien.util.common.constant.CouponTypeEnum;
 import shop.alien.util.common.constant.OcrTypeEnum;
 import shop.alien.util.common.constant.OrderStatusEnum;
+import shop.alien.util.type.LifeCollectIdentityQuery;
 import shop.alien.util.type.LifeNoticeUtil;
+import shop.alien.util.type.TypeUtil;
 
 import javax.annotation.Resource;
 import java.io.File;
@@ -123,6 +125,8 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
 
     private final LifeCollectMapper lifeCollectMapper;
 
+    private final TypeUtil typeUtil;
+
     private final StoreStaffConfigMapper storeStaffConfigMapper;
 
     private final StoreClockInMapper storeClockInMapper;
@@ -1972,7 +1976,8 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
         }
         // 当前登录用户是否收藏
         LambdaUpdateWrapper<LifeCollect> shouCangWrapper = new LambdaUpdateWrapper<>();
-        shouCangWrapper.eq(LifeCollect::getUserId, userId).eq(LifeCollect::getStoreId, storeId);
+        LifeCollectIdentityQuery.applyUserSide(shouCangWrapper, LifeCollectIdentityQuery.resolve(userId, typeUtil));
+        shouCangWrapper.eq(LifeCollect::getStoreId, storeId);
         List<LifeCollect> shouCangList = lifeCollectMapper.selectList(shouCangWrapper);
         if (null == shouCangList || shouCangList.isEmpty()) {
             result.setCollection(0);
@@ -6056,7 +6061,8 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
         }
         // 当前登录用户是否收藏
         LambdaUpdateWrapper<LifeCollect> shouCangWrapper = new LambdaUpdateWrapper<>();
-        shouCangWrapper.eq(LifeCollect::getUserId, userId).eq(LifeCollect::getStoreId, storeId);
+        LifeCollectIdentityQuery.applyUserSide(shouCangWrapper, LifeCollectIdentityQuery.resolve(userId, typeUtil));
+        shouCangWrapper.eq(LifeCollect::getStoreId, storeId);
         List<LifeCollect> shouCangList = lifeCollectMapper.selectList(shouCangWrapper);
         if (null == shouCangList || shouCangList.isEmpty()) {
             result.setCollection(0);