17 Commit-ok 1609f808e6 ... fc92194a9d

Szerző SHA1 Üzenet Dátum
  penghao fc92194a9d Merge branch 'sit' into sit-OrderFood 2 hónapja
  fcw 38c295c83a refactor(job): 修改差评申诉任务中的图片处理逻辑 2 hónapja
  刘云鑫 a0104f7f7e bugfix:动态显示商家浮窗字段 2 hónapja
  刘云鑫 ac3994feae bugfix:正常视频审核通过, 2 hónapja
  wuchen 682feafbb1 Merge remote-tracking branch 'origin/sit' into sit 2 hónapja
  wuchen 6640526237 中台页面bug修复 2 hónapja
  lutong 61bca796be Merge branch 'release_buried-point_ph' into sit 2 hónapja
  lutong f8e4c6b454 维护代码 之前未考虑到存在两种价目表 已修正 2 hónapja
  wuchen cb7aa1be90 子账号页面bug修复 2 hónapja
  wuchen c037c91198 Merge remote-tracking branch 'origin/sit' into sit 2 hónapja
  刘云鑫 1ed9d0ab14 bugfix:人员评价,店铺评价, 2 hónapja
  wuchen 87fcce379f Merge remote-tracking branch 'origin/sit' into sit 2 hónapja
  lutong c2fc908fd3 Merge branch 'release_lutong_bug' into sit 2 hónapja
  lutong bd61ce454c 处理BUG 1555 原代码 用打卡记录中的userid判断是否存在收藏 改为 从token中 获取 用户ID 2 hónapja
  wuchen fe020a3f7b 中台权限页面修改 2 hónapja
  liudongzhi 9e58e49814 banner图需求代码提交 2 hónapja
  lutong 0347a60233 开发人员评论时反馈店铺标签 2 hónapja
18 módosított fájl, 485 hozzáadás és 373 törlés
  1. 12 0
      alien-entity/src/main/java/shop/alien/entity/store/vo/LifeUserDynamicsVo.java
  2. 25 0
      alien-entity/src/main/java/shop/alien/entity/store/vo/StoreStaffReviewDetailVo.java
  3. 2 2
      alien-entity/src/main/java/shop/alien/mapper/LifeUserDynamicsMapper.java
  4. 6 0
      alien-entity/src/main/resources/mapper/StoreStaffReviewMapper.xml
  5. 6 9
      alien-job/src/main/java/shop/alien/job/store/BadReviewAppealJob.java
  6. 1 1
      alien-store/src/main/java/shop/alien/store/controller/StoreBannerController.java
  7. 7 3
      alien-store/src/main/java/shop/alien/store/controller/StoreClockInController.java
  8. 8 4
      alien-store/src/main/java/shop/alien/store/controller/StoreStaffReviewController.java
  9. 33 0
      alien-store/src/main/java/shop/alien/store/service/LifeUserDynamicsService.java
  10. 2 1
      alien-store/src/main/java/shop/alien/store/service/StoreClockInService.java
  11. 3 1
      alien-store/src/main/java/shop/alien/store/service/StoreStaffReviewService.java
  12. 7 3
      alien-store/src/main/java/shop/alien/store/service/impl/CommonRatingServiceImpl.java
  13. 28 0
      alien-store/src/main/java/shop/alien/store/service/impl/StoreBannerServiceImpl.java
  14. 10 9
      alien-store/src/main/java/shop/alien/store/service/impl/StoreClockInServiceImpl.java
  15. 85 34
      alien-store/src/main/java/shop/alien/store/service/impl/StoreOperationalStatisticsServiceImpl.java
  16. 175 287
      alien-store/src/main/java/shop/alien/store/service/impl/StorePlatformMenuServiceImpl.java
  17. 72 7
      alien-store/src/main/java/shop/alien/store/service/impl/StoreStaffReviewServiceImpl.java
  18. 3 12
      alien-store/src/main/java/shop/alien/store/service/impl/StoreUserServiceImpl.java

+ 12 - 0
alien-entity/src/main/java/shop/alien/entity/store/vo/LifeUserDynamicsVo.java

@@ -68,4 +68,16 @@ public class LifeUserDynamicsVo extends LifeUserDynamics {
 
     @ApiModelProperty(value = "商家名称")
     private String storeName;
+
+    @ApiModelProperty(value = "评分")
+    private Double scoreAvg;
+
+     @ApiModelProperty(value = "行业")
+    private String businessSection;
+
+    @ApiModelProperty(value = "评价数量")
+    private String ratingCount;
+
+    @ApiModelProperty(value = "评价类型")
+    private String businessTypeName;
 }

+ 25 - 0
alien-entity/src/main/java/shop/alien/entity/store/vo/StoreStaffReviewDetailVo.java

@@ -25,5 +25,30 @@ public class StoreStaffReviewDetailVo {
 
     @ApiModelProperty(value = "人员信息")
     private StoreStaffConfig staffInfo;
+
+    @ApiModelProperty(value = "店铺信息")
+    private StoreInfoForStaffReviewVo storeInfo;
+    
+    /**
+     * 店铺信息VO(用于员工评价详情)
+     */
+    @Data
+    @ApiModel(value = "StoreInfoForStaffReviewVo对象", description = "店铺信息VO(用于员工评价详情)")
+    public static class StoreInfoForStaffReviewVo {
+        @ApiModelProperty(value = "店铺ID")
+        private Integer storeId;
+        
+        @ApiModelProperty(value = "店铺名称")
+        private String storeName;
+        
+        @ApiModelProperty(value = "店铺头像(来自store_user表的head_img字段)")
+        private String headImg;
+        
+        @ApiModelProperty(value = "店铺评分(平均评分)")
+        private Double score;
+        
+        @ApiModelProperty(value = "到商铺的距离(单位:千米,如果未提供用户位置则为null)")
+        private Double distance;
+    }
 }
 

+ 2 - 2
alien-entity/src/main/java/shop/alien/mapper/LifeUserDynamicsMapper.java

@@ -23,7 +23,7 @@ public interface LifeUserDynamicsMapper extends BaseMapper<LifeUserDynamics> {
             "where lud.delete_flag = 0 and lud.enable_status = 0 and lud.draft = 0 and " +
             "not exists (select 1 from life_user_violation luv where luv.delete_flag = 0 and luv.processing_status = 1 " +
             "AND luv.dynamics_id = lud.id) order by lud.created_time desc) " +
-            "select dynamice.*, info.store_name userName, user.head_img userImage, info.id storeUserId, user.id storeOrUserId, 0 isExpert " +
+            "select dynamice.*, info.store_name userName, user.head_img userImage, info.id storeUserId, user.id storeOrUserId, 0 isExpert, info.score_avg scoreAvg, info.business_section businessSection, info.business_type_name businessTypeName " +
             "from dynamice " +
             "join store_user user on dynamice.phone = user.phone and user.delete_flag = 0 " +
             "and user.status = 0 and user.logout_flag = 0 " +
@@ -33,7 +33,7 @@ public interface LifeUserDynamicsMapper extends BaseMapper<LifeUserDynamics> {
             "where dynamice.flag = 'store' " +
             "union " +
             "select dynamice.*, user.user_name userName, user.user_image userImage, user.id storeUserId, user.id storeOrUserId, " +
-            "IF(lue.expert_code IS NOT NULL , 1, 0) AS isExpert " +
+            "IF(lue.expert_code IS NOT NULL , 1, 0) AS isExpert, 0 scoreAvg, 0 businessSection, 0 businessTypeName " +
             "from dynamice " +
             "join life_user user on dynamice.phone = user.user_phone and user.delete_flag = 0 " +
             "and user.logout_flag = 0 " +

+ 6 - 0
alien-entity/src/main/resources/mapper/StoreStaffReviewMapper.xml

@@ -134,6 +134,7 @@
         SELECT COUNT(*)
         FROM store_staff_review
         WHERE staff_user_id = #{staffUserId}
+          AND audit_status = 1
         AND delete_flag = 0
     </select>
 
@@ -143,6 +144,7 @@
         SELECT COUNT(*)
         FROM store_staff_review
         WHERE staff_user_id = #{staffUserId}
+          AND audit_status = 1
         AND delete_flag = 0
         AND overall_rating IS NOT NULL
         AND overall_rating >= 4.5
@@ -156,6 +158,7 @@
         SELECT COUNT(*)
         FROM store_staff_review
         WHERE staff_user_id = #{staffUserId}
+          AND audit_status = 1
         AND delete_flag = 0
         AND overall_rating IS NOT NULL
         AND overall_rating >= 3
@@ -169,6 +172,7 @@
         SELECT COUNT(*)
         FROM store_staff_review
         WHERE staff_user_id = #{staffUserId}
+          AND audit_status = 1
         AND delete_flag = 0
         AND overall_rating IS NOT NULL
         AND overall_rating >= 0
@@ -181,6 +185,7 @@
         SELECT COUNT(*)
         FROM store_staff_review
         WHERE staff_user_id = #{staffUserId}
+          AND audit_status = 1
         AND delete_flag = 0
         AND review_images IS NOT NULL
         AND review_images != ''
@@ -233,6 +238,7 @@
             AND CONVERT(llr.dianzan_id, CHAR) = CONVERT(#{currentUserId}, CHAR)
             AND llr.delete_flag = 0
         WHERE ssr.delete_flag = 0
+        AND ssr.audit_status = 1
         AND ssr.staff_user_id = #{staffUserId}
         <if test="type != null">
             <choose>

+ 6 - 9
alien-job/src/main/java/shop/alien/job/store/BadReviewAppealJob.java

@@ -273,16 +273,13 @@ public class BadReviewAppealJob {
             analyzeRequest.put("user_material",
                     storeCommentAppeal.get("comment_content") == null ? "" : storeCommentAppeal.get("comment_content").toString());
 
-            // 商家图片:支持多张,转成 Base64 数组
+            // 商家图片:支持多张,直接使用图片URL
             List<String> merchantImages = new ArrayList<>();
             String imgUrls = storeCommentAppeal.get("img_url") == null ? "" : storeCommentAppeal.get("img_url").toString();
             if (StringUtils.hasText(imgUrls)) {
                 // 假设 img_url 是多个图片用逗号分隔的字符串
                 for (String imageUrl : imgUrls.split(",")) {
-                    String base64 = convertImageToBase64(imageUrl.trim());
-                    if (StringUtils.hasText(base64)) {
-                        merchantImages.add(base64);
-                    }
+                    merchantImages.add(imageUrl.trim());
                 }
             }
             analyzeRequest.put("merchant_images", merchantImages);
@@ -292,11 +289,11 @@ public class BadReviewAppealJob {
             String userImgUrls = storeCommentAppeal.get("user_img_url") == null ? "" : storeCommentAppeal.get("user_img_url").toString();
             if (StringUtils.hasText(userImgUrls)) {
                 for (String imageUrl : userImgUrls.split(",")) {
-                    String base64 = convertImageToBase64(imageUrl.trim());
-                    if (StringUtils.hasText(base64)) {
-                        userImages.add(base64);
+//                    String base64 = convertImageToBase64(imageUrl.trim());
+//                    if (StringUtils.hasText(base64)) {
+                        userImages.add(imageUrl.trim());
                     }
-                }
+//                }
             }
             analyzeRequest.put("user_images", userImages);
 

+ 1 - 1
alien-store/src/main/java/shop/alien/store/controller/StoreBannerController.java

@@ -39,7 +39,7 @@ public class StoreBannerController {
 
     @ApiOperation("删除Banner")
     @ApiOperationSupport(order = 2)
-    @PostMapping("/delete")
+    @GetMapping("/delete")
     public R<String> delete(@RequestParam("id") Integer id) {
         log.info("StoreBannerController.delete?id={}", id);
         return storeBannerService.removeById(id) ? R.success("删除成功") : R.fail("删除失败");

+ 7 - 3
alien-store/src/main/java/shop/alien/store/controller/StoreClockInController.java

@@ -7,9 +7,12 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.bind.annotation.*;
 import shop.alien.entity.result.R;
 import shop.alien.entity.store.StoreClockIn;
+import shop.alien.entity.store.UserLoginInfo;
 import shop.alien.entity.store.vo.StoreClockInVo;
 import shop.alien.store.annotation.TrackEvent;
 import shop.alien.store.service.StoreClockInService;
+import shop.alien.util.common.TokenInfo;
+import springfox.documentation.annotations.ApiIgnore;
 
 @Slf4j
 @Api(tags = {"店铺打卡"})
@@ -88,9 +91,10 @@ public class StoreClockInController {
     @ApiOperationSupport(order = 6)
     @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "主键id", dataType = "Integer", paramType = "query")})
     @GetMapping("/getStoreClockInById")
-    public R<StoreClockInVo> getStoreClockInById(Integer id) {
-        log.info("StoreClockInController.getStoreClockInById?id={}", id);
-        return R.data(storeClockInService.getStoreClockInById(id));
+    public R<StoreClockInVo> getStoreClockInById(@ApiIgnore @TokenInfo UserLoginInfo userLoginInfo, Integer id) {
+        Integer userId = userLoginInfo != null ? userLoginInfo.getUserId() : null;
+        log.info("StoreClockInController.getStoreClockInById?userId={},id={}", userId, id);
+        return R.data(storeClockInService.getStoreClockInById(id, userId));
     }
 
 }

+ 8 - 4
alien-store/src/main/java/shop/alien/store/controller/StoreStaffReviewController.java

@@ -57,17 +57,21 @@ public class StoreStaffReviewController {
     @ApiOperationSupport(order = 2)
     @ApiImplicitParams({
             @ApiImplicitParam(name = "reviewId", value = "评价ID", dataTypeClass = Integer.class, paramType = "query", required = true),
-            @ApiImplicitParam(name = "currentUserId", value = "当前用户ID(用于判断是否已点赞)", dataTypeClass = Integer.class, paramType = "query", required = false)
+            @ApiImplicitParam(name = "currentUserId", value = "当前用户ID(用于判断是否已点赞)", dataTypeClass = Integer.class, paramType = "query", required = false),
+            @ApiImplicitParam(name = "longitude", value = "用户经度(用于计算距离,可选)", dataTypeClass = Double.class, paramType = "query", required = false),
+            @ApiImplicitParam(name = "latitude", value = "用户纬度(用于计算距离,可选)", dataTypeClass = Double.class, paramType = "query", required = false)
     })
     @GetMapping("/detail/reviewId")
     public R<StoreStaffReviewDetailVo> getReviewDetail(
             @RequestParam Integer reviewId,
-            @RequestParam(required = false) Integer currentUserId) {
-        log.info("获取评价详情, reviewId={}, currentUserId={}", reviewId, currentUserId);
+            @RequestParam(required = false) Integer currentUserId,
+            @RequestParam(required = false) Double longitude,
+            @RequestParam(required = false) Double latitude) {
+        log.info("获取评价详情, reviewId={}, currentUserId={}, longitude={}, latitude={}", reviewId, currentUserId, longitude, latitude);
         if (reviewId == null) {
             return R.fail("评价ID不能为空");
         }
-        return storeStaffReviewService.getReviewDetail(reviewId, currentUserId);
+        return storeStaffReviewService.getReviewDetail(reviewId, currentUserId, longitude, latitude);
     }
 
     @ApiOperation("点赞评价")

+ 33 - 0
alien-store/src/main/java/shop/alien/store/service/LifeUserDynamicsService.java

@@ -54,6 +54,8 @@ public class LifeUserDynamicsService extends ServiceImpl<LifeUserDynamicsMapper,
 
     private final CommonCommentMapper commonCommentMapper;
 
+    private final CommonRatingService commonRatingService;
+
     public int addLiulanCount(String id) {
         LambdaUpdateWrapper<LifeUserDynamics> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
         lambdaUpdateWrapper.eq(LifeUserDynamics::getId, id);
@@ -157,13 +159,38 @@ public class LifeUserDynamicsService extends ServiceImpl<LifeUserDynamicsMapper,
         // 查询动态数据并按类型过滤
         List<LifeUserDynamicsVo> lifeUserDynamicsVoList = lifeUserDynamicsMapper.getLifeUserDynamicsList();
 
+        // 店铺id
+        // TODO 可以优化小驴:优化方案直接sql分组查询评价数量,避免循环查询
+        List<String> storeUserIdList = new ArrayList<>();
+        Map<String, Integer> commitCountMap = new HashMap<>();
         //对lifeUserDynamicsVoList数据进行处理,当type为2的时候,把userName的数值赋值到storeName
         lifeUserDynamicsVoList.forEach(item -> {
             if (item.getType().equals("2")) {
                 item.setStoreName(item.getUserName());
+                storeUserIdList.add(item.getStoreUserId());
             }
         });
 
+        for (String storeId : storeUserIdList) {
+            Integer totalCount = 0;
+            double storeScore;
+            Object ratingObj =  commonRatingService.getRatingCount(Integer.parseInt(storeId), 1);
+            if (ratingObj != null) {
+                Map<String, Object> ratingMap = (Map<String, Object>) ratingObj;
+                Object totalCountObj = ratingMap.get("totalCount");
+                if (totalCountObj != null) {
+                    // 安全转换为整数
+                    try {
+                        totalCount = Integer.parseInt(totalCountObj.toString().trim());
+                    } catch (NumberFormatException e) {
+                        totalCount = 0; // 转换失败时默认值
+                    }
+                } else {
+                    totalCount = 0;
+                }
+            }
+            commitCountMap.put(storeId, totalCount);
+        }
         if (!StringUtils.isEmpty(type)) {
             lifeUserDynamicsVoList = lifeUserDynamicsVoList.stream().filter(item -> type.equals(item.getType())).collect(Collectors.toList());
         }
@@ -207,6 +234,12 @@ public class LifeUserDynamicsService extends ServiceImpl<LifeUserDynamicsMapper,
         // 设置动态对象的状态信息:是否关注对方、是否被关注、是否点赞及评论数量
         // 设置.imagePath。视频为mp4+jpg格式,图片为jpg/png格式。
         for (LifeUserDynamicsVo vo : lifeUserDynamicsVoList) {
+            // 设置评价数量
+            if (commitCountMap.containsKey(vo.getStoreUserId())) {
+                vo.setRatingCount(commitCountMap.get(vo.getStoreUserId()).toString());
+            } else {
+                vo.setRatingCount("0");
+            }
             if (followList.contains(vo.getPhoneId())) {
                 vo.setIsFollowThis("1");
             } else {

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

@@ -40,7 +40,8 @@ public interface StoreClockInService extends IService<StoreClockIn> {
      * 根据id查询打卡记录
      *
      * @param id 主键id
+     * @param userId 当前登录用户ID(用于查询收藏状态)
      * @return 打卡记录
      */
-    StoreClockInVo getStoreClockInById(Integer id);
+    StoreClockInVo getStoreClockInById(Integer id, Integer userId);
 }

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

@@ -31,9 +31,11 @@ public interface StoreStaffReviewService extends IService<StoreStaffReview> {
      *
      * @param reviewId 评价ID
      * @param currentUserId 当前用户ID(用于判断是否已点赞,可为null)
+     * @param longitude 用户经度(用于计算距离,可为null)
+     * @param latitude 用户纬度(用于计算距离,可为null)
      * @return R<StoreStaffReviewDetailVo>
      */
-    R<StoreStaffReviewDetailVo> getReviewDetail(Integer reviewId, Integer currentUserId);
+    R<StoreStaffReviewDetailVo> getReviewDetail(Integer reviewId, Integer currentUserId, Double longitude, Double latitude);
 
     /**
      * 点赞评价

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

@@ -101,7 +101,10 @@ public class CommonRatingServiceImpl extends ServiceImpl<CommonRatingMapper, Com
             int i = this.save(commonRating) ? 0 : 1;
             // 一次遍历完成分类,避免多次流式处理
             Map<String, List<String>> urlCategoryMap = StoreRenovationRequirementServiceImpl.classifyUrls(Arrays.asList(commonRating.getImageUrls().split(",")));
-            AiContentModerationUtil.AuditResult auditResult = aiContentModerationUtil.auditContent(commonRating.getContent(), urlCategoryMap.get("image"));
+            AiContentModerationUtil.AuditResult auditResult = new AiContentModerationUtil.AuditResult(true, "");
+            if( StringUtils.isNotEmpty(commonRating.getContent()) || urlCategoryMap.get("image").size() > 0){
+                auditResult = aiContentModerationUtil.auditContent(commonRating.getContent(), urlCategoryMap.get("image"));
+            }
             if (!auditResult.isPassed()) {
                 // 审核不通过
                 CommonRating rating = this.getById(commonRating.getId());
@@ -339,6 +342,7 @@ public class CommonRatingServiceImpl extends ServiceImpl<CommonRatingMapper, Com
         LambdaQueryWrapper<CommonRating> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(CommonRating::getBusinessId, businessId);
         wrapper.eq(CommonRating::getBusinessType, businessType);
+        wrapper.eq(CommonRating::getAuditStatus, 1);
         wrapper.eq(CommonRating::getIsShow, 1);
         List<CommonRating> commonRatings = commonRatingMapper.selectList(wrapper);
         List<Long> collect = commonRatings.stream().map(x -> x.getId()).collect(Collectors.toList());
@@ -381,7 +385,7 @@ public class CommonRatingServiceImpl extends ServiceImpl<CommonRatingMapper, Com
             AtomicReference<Integer> count = new AtomicReference<>(0);
             count.updateAndGet(v -> v + collect.size());
             // 1.查询评价的评论的记录
-            LambdaQueryWrapper<CommonComment> commentWrapper = new LambdaQueryWrapper<CommonComment>()
+/*            LambdaQueryWrapper<CommonComment> commentWrapper = new LambdaQueryWrapper<CommonComment>()
                     .eq(CommonComment::getSourceType, CommentSourceTypeEnum.STORE_COMMENT.getType())
                     .in(CommonComment::getSourceId, collect);
             List<Long> collect1 = commonCommentMapper.selectList(commentWrapper).stream().map(x -> x.getId()).collect(Collectors.toList());
@@ -390,7 +394,7 @@ public class CommonRatingServiceImpl extends ServiceImpl<CommonRatingMapper, Com
                 // 2.在再评论的表中查询评论的回复(根评论)
                 Integer allCommentsOnCommentsNum = getAllCommentsOnCommentsNum(collect1);
                 count.updateAndGet(v -> v + allCommentsOnCommentsNum);
-            }
+            }*/
             ratingCount.put("totalCount", count.get());
 
             // 3用户图片

+ 28 - 0
alien-store/src/main/java/shop/alien/store/service/impl/StoreBannerServiceImpl.java

@@ -24,9 +24,37 @@ import shop.alien.store.service.StoreBannerService;
 @Service
 public class StoreBannerServiceImpl extends ServiceImpl<StoreBannerMapper, StoreBanner> implements StoreBannerService {
 
+//    @Transactional
+//    @Override
+//    public R<String> saveBanner(StoreBannerDto storeBannerDto) {
+//        StoreBanner storeBanner = new StoreBanner();
+//        BeanUtils.copyProperties(storeBannerDto, storeBanner);
+//        boolean update = storeBanner.getId() != null;
+//        boolean result = this.saveOrUpdate(storeBanner);
+//        if (result) {
+//            return R.success(update ? "修改成功" : "新增成功");
+//        }
+//        return R.fail(update ? "修改失败" : "新增失败");
+//    }
+
+
     @Transactional
     @Override
     public R<String> saveBanner(StoreBannerDto storeBannerDto) {
+        // 先检查 moduleName 是否已存在
+        LambdaQueryWrapper<StoreBanner> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(StoreBanner::getModuleName, storeBannerDto.getModuleName());
+
+        // 如果是更新操作,需要排除当前记录本身
+        if (storeBannerDto.getId() != null) {
+            queryWrapper.ne(StoreBanner::getId, storeBannerDto.getId());
+        }
+
+        long count = this.count(queryWrapper);
+        if (count > 0) {
+            return R.fail("该模块名称已存在,不能重复添加或修改");
+        }
+
         StoreBanner storeBanner = new StoreBanner();
         BeanUtils.copyProperties(storeBannerDto, storeBanner);
         boolean update = storeBanner.getId() != null;

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

@@ -429,7 +429,7 @@ public class StoreClockInServiceImpl extends ServiceImpl<StoreClockInMapper, Sto
     }
 
     @Override
-    public StoreClockInVo getStoreClockInById(Integer id) {
+    public StoreClockInVo getStoreClockInById(Integer id, Integer userId) {
         StoreClockIn storeClockIn = storeClockInMapper.selectById(id);
         StoreClockInVo storeClockInVo = BeanUtil.copyProperties(storeClockIn, StoreClockInVo.class);
         if (null == storeClockIn) {
@@ -458,15 +458,16 @@ public class StoreClockInServiceImpl extends ServiceImpl<StoreClockInMapper, Sto
         storeClockInVo.setBusinessClassifyName(storeInfo.getBusinessClassifyName());
         // 地址
         storeClockInVo.setStoreAddress(storeInfo.getStoreAddress());
-        // 是否收藏
-        // 查询我的收藏
-        LambdaQueryWrapper<LifeCollect> collectWrapper = new LambdaQueryWrapper<>();
-        collectWrapper.eq(LifeCollect::getUserId, String.valueOf(storeClockInVo.getUserId()));
-        List<LifeCollect> lifeCollectList = lifeCollectMapper.selectList(collectWrapper);
-        List<String> collectList = lifeCollectList.stream().map(LifeCollect::getStoreId).collect(Collectors.toList());
+        // 是否收藏 - 使用当前登录用户的ID查询收藏
         storeClockInVo.setIsCollect("0");
-        if (collectList.contains(storeClockInVo.getStoreId().toString())){
-            storeClockInVo.setIsCollect("1");
+        if (userId != null) {
+            LambdaQueryWrapper<LifeCollect> collectWrapper = new LambdaQueryWrapper<>();
+            collectWrapper.eq(LifeCollect::getUserId, String.valueOf(userId));
+            List<LifeCollect> lifeCollectList = lifeCollectMapper.selectList(collectWrapper);
+            List<String> collectList = lifeCollectList.stream().map(LifeCollect::getStoreId).collect(Collectors.toList());
+            if (collectList.contains(storeClockInVo.getStoreId().toString())){
+                storeClockInVo.setIsCollect("1");
+            }
         }
         return storeClockInVo;
     }

+ 85 - 34
alien-store/src/main/java/shop/alien/store/service/impl/StoreOperationalStatisticsServiceImpl.java

@@ -59,6 +59,8 @@ public class StoreOperationalStatisticsServiceImpl implements StoreOperationalSt
     private final StoreEvaluationMapper storeEvaluationMapper;
     private final StoreCommentAppealMapper storeCommentAppealMapper;
     private final StorePriceMapper storePriceMapper;
+    private final StoreCuisineMapper storeCuisineMapper;
+    private final StoreInfoMapper storeInfoMapper;
     private final StoreUserMapper storeUserMapper;
     private final StoreOperationalStatisticsHistoryMapper statisticsHistoryMapper;
     private final StoreTrackStatisticsMapper storeTrackStatisticsMapper;
@@ -115,7 +117,7 @@ public class StoreOperationalStatisticsServiceImpl implements StoreOperationalSt
             }
             
             // 聚合统计数据(优先取结束日期的数据,只累加新增访客数)
-            return aggregateStatistics(statisticsList, endDate);
+            return aggregateStatistics(statisticsList, endDate, storeId);
             
         } catch (ParseException e) {
             log.error("StoreOperationalStatisticsServiceImpl.calculateStatistics - 时间解析错误", e);
@@ -132,8 +134,9 @@ public class StoreOperationalStatisticsServiceImpl implements StoreOperationalSt
      * 
      * @param statisticsList 统计数据列表
      * @param endDate 结束日期(用于优先选择该日期的数据)
+     * @param storeId 店铺ID
      */
-    private StoreOperationalStatisticsVo aggregateStatistics(List<StoreTrackStatistics> statisticsList, Date endDate) {
+    private StoreOperationalStatisticsVo aggregateStatistics(List<StoreTrackStatistics> statisticsList, Date endDate, Integer storeId) {
         StoreOperationalStatisticsVo result = new StoreOperationalStatisticsVo();
         
         // 优先查找结束日期的数据(比较日期部分,忽略时间)
@@ -247,7 +250,7 @@ public class StoreOperationalStatisticsServiceImpl implements StoreOperationalSt
         }
         
         if (latestStat.getPriceRankingData() != null && !latestStat.getPriceRankingData().isEmpty()) {
-            result.setPriceListRanking(convertToPriceListRankingVoFromJson(latestStat.getPriceRankingData()));
+            result.setPriceListRanking(convertToPriceListRankingVoFromJson(latestStat.getPriceRankingData(), storeId));
         }
         
         return result;
@@ -292,7 +295,7 @@ public class StoreOperationalStatisticsServiceImpl implements StoreOperationalSt
         comparison.setCouponData(buildCouponDataComparison(currentStatistics.getCouponData(), previousStatistics.getCouponData()));
         comparison.setVoucherData(buildVoucherDataComparison(currentStatistics.getVoucherData(), previousStatistics.getVoucherData()));
         comparison.setServiceQualityData(buildServiceQualityDataComparison(currentStatistics.getServiceQualityData(), previousStatistics.getServiceQualityData()));
-        comparison.setPriceListRanking(buildPriceListRankingComparison(currentStatistics.getPriceListRanking(), previousStatistics.getPriceListRanking()));
+        comparison.setPriceListRanking(buildPriceListRankingComparison(currentStatistics.getPriceListRanking(), previousStatistics.getPriceListRanking(), storeId));
 
         // 保存历史记录(不包含PDF URL,PDF URL只在 generateStatisticsComparisonPdf 接口中保存)
         Integer historyId = saveStatisticsHistory(storeId, currentStartTime, currentEndTime, 
@@ -889,7 +892,7 @@ public class StoreOperationalStatisticsServiceImpl implements StoreOperationalSt
      * 构建价目表排名数据对比
      */
     private List<StoreOperationalStatisticsComparisonVo.PriceListRankingComparison> buildPriceListRankingComparison(
-            List<StoreOperationalStatisticsVo.PriceListRanking> current, List<StoreOperationalStatisticsVo.PriceListRanking> previous) {
+            List<StoreOperationalStatisticsVo.PriceListRanking> current, List<StoreOperationalStatisticsVo.PriceListRanking> previous, Integer storeId) {
         List<StoreOperationalStatisticsComparisonVo.PriceListRankingComparison> result = new ArrayList<>();
         
         // 如果当期数据为空,返回空列表
@@ -919,16 +922,32 @@ public class StoreOperationalStatisticsServiceImpl implements StoreOperationalSt
             }
         }
         
-        // 批量查询价目表名称
+        // 批量查询价目表名称(根据business_section判断查询美食价目表还是通用价目表)
         Map<Integer, String> priceNameMap = new HashMap<>();
-        if (!needQueryPriceIds.isEmpty()) {
-            LambdaQueryWrapper<StorePrice> priceWrapper = new LambdaQueryWrapper<>();
-            priceWrapper.in(StorePrice::getId, needQueryPriceIds)
-                        .eq(StorePrice::getDeleteFlag, 0);
-            List<StorePrice> prices = storePriceMapper.selectList(priceWrapper);
-            for (StorePrice price : prices) {
-                if (price.getId() != null && price.getName() != null) {
-                    priceNameMap.put(price.getId(), price.getName());
+        if (!needQueryPriceIds.isEmpty() && storeId != null) {
+            // 查询店铺信息,获取business_section
+            StoreInfo storeInfo = storeInfoMapper.selectById(storeId);
+            if (storeInfo != null && storeInfo.getBusinessSection() != null && storeInfo.getBusinessSection() == 1) {
+                // business_section = 1 表示美食,查询美食价目表
+                LambdaQueryWrapper<StoreCuisine> cuisineWrapper = new LambdaQueryWrapper<>();
+                cuisineWrapper.in(StoreCuisine::getId, needQueryPriceIds)
+                            .eq(StoreCuisine::getDeleteFlag, 0);
+                List<StoreCuisine> cuisines = storeCuisineMapper.selectList(cuisineWrapper);
+                for (StoreCuisine cuisine : cuisines) {
+                    if (cuisine.getId() != null && cuisine.getName() != null) {
+                        priceNameMap.put(cuisine.getId(), cuisine.getName());
+                    }
+                }
+            } else {
+                // 其他情况查询通用价目表
+                LambdaQueryWrapper<StorePrice> priceWrapper = new LambdaQueryWrapper<>();
+                priceWrapper.in(StorePrice::getId, needQueryPriceIds)
+                            .eq(StorePrice::getDeleteFlag, 0);
+                List<StorePrice> prices = storePriceMapper.selectList(priceWrapper);
+                for (StorePrice price : prices) {
+                    if (price.getId() != null && price.getName() != null) {
+                        priceNameMap.put(price.getId(), price.getName());
+                    }
                 }
             }
         }
@@ -1668,7 +1687,7 @@ public class StoreOperationalStatisticsServiceImpl implements StoreOperationalSt
     /**
      * 转换为价目表排名数据VO
      */
-    private List<StoreOperationalStatisticsVo.PriceListRanking> convertToPriceListRankingVo(Map<Integer, Map<String, Long>> accumulator) {
+    private List<StoreOperationalStatisticsVo.PriceListRanking> convertToPriceListRankingVo(Map<Integer, Map<String, Long>> accumulator, Integer storeId) {
         List<StoreOperationalStatisticsVo.PriceListRanking> result = new ArrayList<>();
         
         // 如果累加器为空,直接返回
@@ -1676,17 +1695,33 @@ public class StoreOperationalStatisticsServiceImpl implements StoreOperationalSt
             return result;
         }
         
-        // 批量查询价目表名称
+        // 批量查询价目表名称(根据business_section判断查询美食价目表还是通用价目表)
         List<Integer> priceIds = new ArrayList<>(accumulator.keySet());
         Map<Integer, String> priceNameMap = new HashMap<>();
-        if (!priceIds.isEmpty()) {
-            LambdaQueryWrapper<StorePrice> priceWrapper = new LambdaQueryWrapper<>();
-            priceWrapper.in(StorePrice::getId, priceIds)
-                        .eq(StorePrice::getDeleteFlag, 0);
-            List<StorePrice> prices = storePriceMapper.selectList(priceWrapper);
-            for (StorePrice price : prices) {
-                if (price.getId() != null && price.getName() != null) {
-                    priceNameMap.put(price.getId(), price.getName());
+        if (!priceIds.isEmpty() && storeId != null) {
+            // 查询店铺信息,获取business_section
+            StoreInfo storeInfo = storeInfoMapper.selectById(storeId);
+            if (storeInfo != null && storeInfo.getBusinessSection() != null && storeInfo.getBusinessSection() == 1) {
+                // business_section = 1 表示美食,查询美食价目表
+                LambdaQueryWrapper<StoreCuisine> cuisineWrapper = new LambdaQueryWrapper<>();
+                cuisineWrapper.in(StoreCuisine::getId, priceIds)
+                            .eq(StoreCuisine::getDeleteFlag, 0);
+                List<StoreCuisine> cuisines = storeCuisineMapper.selectList(cuisineWrapper);
+                for (StoreCuisine cuisine : cuisines) {
+                    if (cuisine.getId() != null && cuisine.getName() != null) {
+                        priceNameMap.put(cuisine.getId(), cuisine.getName());
+                    }
+                }
+            } else {
+                // 其他情况查询通用价目表
+                LambdaQueryWrapper<StorePrice> priceWrapper = new LambdaQueryWrapper<>();
+                priceWrapper.in(StorePrice::getId, priceIds)
+                            .eq(StorePrice::getDeleteFlag, 0);
+                List<StorePrice> prices = storePriceMapper.selectList(priceWrapper);
+                for (StorePrice price : prices) {
+                    if (price.getId() != null && price.getName() != null) {
+                        priceNameMap.put(price.getId(), price.getName());
+                    }
                 }
             }
         }
@@ -2129,7 +2164,7 @@ public class StoreOperationalStatisticsServiceImpl implements StoreOperationalSt
      * 从JSON字符串转换为价目表排名数据VO
      */
     @SuppressWarnings("unchecked")
-    private List<StoreOperationalStatisticsVo.PriceListRanking> convertToPriceListRankingVoFromJson(String priceRankingDataJson) {
+    private List<StoreOperationalStatisticsVo.PriceListRanking> convertToPriceListRankingVoFromJson(String priceRankingDataJson, Integer storeId) {
         List<StoreOperationalStatisticsVo.PriceListRanking> result = new ArrayList<>();
         
         try {
@@ -2148,14 +2183,30 @@ public class StoreOperationalStatisticsServiceImpl implements StoreOperationalSt
             }
             
             Map<Integer, String> priceNameMap = new HashMap<>();
-            if (!priceIds.isEmpty()) {
-                LambdaQueryWrapper<StorePrice> priceWrapper = new LambdaQueryWrapper<>();
-                priceWrapper.in(StorePrice::getId, priceIds)
-                            .eq(StorePrice::getDeleteFlag, 0);
-                List<StorePrice> prices = storePriceMapper.selectList(priceWrapper);
-                for (StorePrice price : prices) {
-                    if (price.getId() != null && price.getName() != null) {
-                        priceNameMap.put(price.getId(), price.getName());
+            if (!priceIds.isEmpty() && storeId != null) {
+                // 查询店铺信息,获取business_section
+                StoreInfo storeInfo = storeInfoMapper.selectById(storeId);
+                if (storeInfo != null && storeInfo.getBusinessSection() != null && storeInfo.getBusinessSection() == 1) {
+                    // business_section = 1 表示美食,查询美食价目表
+                    LambdaQueryWrapper<StoreCuisine> cuisineWrapper = new LambdaQueryWrapper<>();
+                    cuisineWrapper.in(StoreCuisine::getId, priceIds)
+                                .eq(StoreCuisine::getDeleteFlag, 0);
+                    List<StoreCuisine> cuisines = storeCuisineMapper.selectList(cuisineWrapper);
+                    for (StoreCuisine cuisine : cuisines) {
+                        if (cuisine.getId() != null && cuisine.getName() != null) {
+                            priceNameMap.put(cuisine.getId(), cuisine.getName());
+                        }
+                    }
+                } else {
+                    // 其他情况查询通用价目表
+                    LambdaQueryWrapper<StorePrice> priceWrapper = new LambdaQueryWrapper<>();
+                    priceWrapper.in(StorePrice::getId, priceIds)
+                                .eq(StorePrice::getDeleteFlag, 0);
+                    List<StorePrice> prices = storePriceMapper.selectList(priceWrapper);
+                    for (StorePrice price : prices) {
+                        if (price.getId() != null && price.getName() != null) {
+                            priceNameMap.put(price.getId(), price.getName());
+                        }
                     }
                 }
             }
@@ -2270,7 +2321,7 @@ public class StoreOperationalStatisticsServiceImpl implements StoreOperationalSt
         comparison.setCouponData(buildCouponDataComparison(currentStatistics.getCouponData(), previousStatistics.getCouponData()));
         comparison.setVoucherData(buildVoucherDataComparison(currentStatistics.getVoucherData(), previousStatistics.getVoucherData()));
         comparison.setServiceQualityData(buildServiceQualityDataComparison(currentStatistics.getServiceQualityData(), previousStatistics.getServiceQualityData()));
-        comparison.setPriceListRanking(buildPriceListRankingComparison(currentStatistics.getPriceListRanking(), previousStatistics.getPriceListRanking()));
+        comparison.setPriceListRanking(buildPriceListRankingComparison(currentStatistics.getPriceListRanking(), previousStatistics.getPriceListRanking(), storeId));
 
         // 不保存历史记录,由调用方决定是否保存
 

+ 175 - 287
alien-store/src/main/java/shop/alien/store/service/impl/StorePlatformMenuServiceImpl.java

@@ -254,6 +254,10 @@ public class StorePlatformMenuServiceImpl extends ServiceImpl<StorePlatformMenuM
                     .eq(StorePlatformMenu::getParentId, currentMenu.getParentId())
                     .eq(StorePlatformMenu::getDelFlag, "0");
             StorePlatformMenu duplicateMenu = storePlatformMenuMapper.selectOne(nameCheck);
+            if (duplicateMenu.getMenuId().equals(menuId)){
+                editUpdateMenuStatus(menuId,currentMenu.getStatus(),currentMenu.getLevel());
+                return R.data(currentMenu);
+            }
             if (duplicateMenu != null) {
                 log.warn("更新菜单失败:菜单名称已存在,菜单名称={}, parentId={}",
                         currentMenu.getMenuName(), currentMenu.getParentId());
@@ -339,157 +343,87 @@ public class StorePlatformMenuServiceImpl extends ServiceImpl<StorePlatformMenuM
         
         // 根据层级进行级联删除
         if (level == 1) {
-            // 删除层级1的菜单:同时删除层级2和3的菜单
-            log.info("删除一级菜单,同时删除层级2和3的菜单,菜单ID={}, 层级={}", menuId, level);
-            LambdaQueryWrapper<StorePlatformMenu> level1Query = new LambdaQueryWrapper<>();
-            level1Query
-                    .eq(StorePlatformMenu::getLevel, 1)
-                    .eq(StorePlatformMenu::getDelFlag, "0");
-            List<StorePlatformMenu> levelMenus = storePlatformMenuMapper.selectList(level1Query);
-            List<Long> levelMenuIds = levelMenus.stream()
-                    .map(StorePlatformMenu::getMenuId)
-                    .collect(Collectors.toList());
-            if (!CollectionUtils.isEmpty(levelMenus)){
-                LambdaUpdateWrapper<StorePlatformMenu> wrapper2 = new LambdaUpdateWrapper<>();
-                wrapper2.eq(StorePlatformMenu::getLevel, 1)
-                        .in(StorePlatformMenu::getMenuId, levelMenuIds)
-                        .eq(StorePlatformMenu::getDelFlag, "0")
-                        .set(StorePlatformMenu::getDelFlag, "2");
-                int count = storePlatformMenuMapper.update(null, wrapper2);
-                totalUpdateCount += count;
-                log.info("删除一级菜单本身,菜单ID={}, 更新记录数={}", menuId, count);
-            }
-            // 1. 先查询所有层级2的子菜单
-            LambdaQueryWrapper<StorePlatformMenu> level2Query = new LambdaQueryWrapper<>();
-            level2Query
-                      .eq(StorePlatformMenu::getLevel, 2)
-                      .eq(StorePlatformMenu::getDelFlag, "0");
-            List<StorePlatformMenu> level2Menus = storePlatformMenuMapper.selectList(level2Query);
-            List<Long> level2MenuIds = level2Menus.stream()
-                                                  .map(StorePlatformMenu::getMenuId)
-                                                  .collect(Collectors.toList());
-            log.info("查询到层级2子菜单数量:{}", level2Menus != null ? level2Menus.size() : 0);
-
-
-            // 3. 删除所有层级2子菜单
-            if (!CollectionUtils.isEmpty(level2Menus)) {
-                LambdaUpdateWrapper<StorePlatformMenu> wrapper2 = new LambdaUpdateWrapper<>();
-                wrapper2.eq(StorePlatformMenu::getLevel, 2)
-                        .in(StorePlatformMenu::getMenuId, level2MenuIds)
-                        .eq(StorePlatformMenu::getDelFlag, "0")
-                        .set(StorePlatformMenu::getDelFlag, "2");
-                int count2 = storePlatformMenuMapper.update(null, wrapper2);
-                totalUpdateCount += count2;
-                log.info("删除层级2子菜单,parent_id={}, 更新记录数={}", menuId, count2);
-            } else {
-                log.info("没有层级2子菜单需要删除,菜单ID={}", menuId);
-            }
-            LambdaQueryWrapper<StorePlatformMenu> level3Query = new LambdaQueryWrapper<>();
-            level3Query
-                    .eq(StorePlatformMenu::getLevel, 3)
-                    .eq(StorePlatformMenu::getDelFlag, "0");
-            List<StorePlatformMenu> level3Menus = storePlatformMenuMapper.selectList(level3Query);
-            List<Long> level3MenuIds = level3Menus.stream()
-                    .map(StorePlatformMenu::getMenuId)
-                    .collect(Collectors.toList());
-            // 4. 删除所有层级3子菜单(parent_id在层级2菜单ID列表中)
-            if (!CollectionUtils.isEmpty(level3Menus)) {
-                LambdaUpdateWrapper<StorePlatformMenu> wrapper3 = new LambdaUpdateWrapper<>();
-                wrapper3.eq(StorePlatformMenu::getLevel, 3)
-                        .in(StorePlatformMenu::getMenuId, level3MenuIds)
-                        .eq(StorePlatformMenu::getDelFlag, "0")
-                        .set(StorePlatformMenu::getDelFlag, "2");
-                int count3 = storePlatformMenuMapper.update(null, wrapper3);
-                totalUpdateCount += count3;
-                log.info("删除层级3子菜单, 更新记录数={}", level3MenuIds, count3);
-            } else {
-                log.info("没有层级3子菜单需要删除,菜单ID={}", menuId);
-            }
+            // 删除一级菜单:删除本级和所有子级(二级和三级)
+            log.info("删除一级菜单,同时删除所有子级菜单,菜单ID={}, 层级={}", menuId, level);
             
-            log.info("删除一级菜单成功,菜单ID={}, 层级={}, 总更新记录数={}", menuId, level, totalUpdateCount);
+            // 1. 查找所有子菜单ID(包括二级和三级)
+            List<Long> allChildrenIds = findAllChildrenMenuIds(menuId);
             
-        } else if (level == 2) {
-            // 删除层级2的菜单:同时删除层级3的菜单
-            log.info("删除二级菜单,同时删除层级3的菜单,菜单ID={}, 层级={}", menuId, level);
-            LambdaQueryWrapper<StorePlatformMenu> level2Query = new LambdaQueryWrapper<>();
-            level2Query
-                    .eq(StorePlatformMenu::getLevel, 2)
-                    .eq(StorePlatformMenu::getDelFlag, "0");
-            List<StorePlatformMenu> level2Menus = storePlatformMenuMapper.selectList(level2Query);
-            List<Long> level2MenuIds = level2Menus.stream()
-                    .map(StorePlatformMenu::getMenuId)
-                    .collect(Collectors.toList());
-            // 3. 删除所有层级2子菜单
-            if (!CollectionUtils.isEmpty(level2Menus)) {
-                LambdaUpdateWrapper<StorePlatformMenu> wrapper2 = new LambdaUpdateWrapper<>();
-                wrapper2.eq(StorePlatformMenu::getLevel, 2)
-                        .in(StorePlatformMenu::getMenuId, level2MenuIds)
-                        .eq(StorePlatformMenu::getDelFlag, "0")
-                        .set(StorePlatformMenu::getDelFlag, "2");
-                int count2 = storePlatformMenuMapper.update(null, wrapper2);
-                totalUpdateCount += count2;
-                log.info("删除层级2子菜单,菜单ID={}, 更新记录数={}", menuId, count2);
+            // 2. 构建要删除的菜单ID列表(包括本级和所有子级)
+            List<Long> menuIdsToDelete = new ArrayList<>();
+            menuIdsToDelete.add(menuId);
+            menuIdsToDelete.addAll(allChildrenIds);
+            
+            // 3. 批量删除(逻辑删除)
+            if (!CollectionUtils.isEmpty(menuIdsToDelete)) {
+                LambdaUpdateWrapper<StorePlatformMenu> wrapper = new LambdaUpdateWrapper<>();
+                wrapper.in(StorePlatformMenu::getMenuId, menuIdsToDelete)
+                       .eq(StorePlatformMenu::getDelFlag, "0")
+                       .set(StorePlatformMenu::getDelFlag, "2");
+                int count = storePlatformMenuMapper.update(null, wrapper);
+                totalUpdateCount = count;
+                log.info("删除一级菜单及其所有子菜单成功,菜单ID={}, 子菜单数量={}, 总更新记录数={}", 
+                        menuId, allChildrenIds.size(), totalUpdateCount);
             } else {
-                log.info("没有层级2子菜单需要删除,菜单ID={}", menuId);
+                // 只删除本级菜单
+                LambdaUpdateWrapper<StorePlatformMenu> wrapper = new LambdaUpdateWrapper<>();
+                wrapper.eq(StorePlatformMenu::getMenuId, menuId)
+                       .eq(StorePlatformMenu::getDelFlag, "0")
+                       .set(StorePlatformMenu::getDelFlag, "2");
+                int count = storePlatformMenuMapper.update(null, wrapper);
+                totalUpdateCount = count;
+                log.info("删除一级菜单成功(无子菜单),菜单ID={}, 更新记录数={}", menuId, totalUpdateCount);
             }
-
-            // 1. 先查询所有层级3的子菜单
-            LambdaQueryWrapper<StorePlatformMenu> level3Query = new LambdaQueryWrapper<>();
-            level3Query
-                      .eq(StorePlatformMenu::getLevel, 3)
-                      .eq(StorePlatformMenu::getDelFlag, "0");
-            List<StorePlatformMenu> level3Menus = storePlatformMenuMapper.selectList(level3Query);
-            List<Long> level3MenuIds = level3Menus.stream()
-                    .map(StorePlatformMenu::getMenuId)
-                    .collect(Collectors.toList());
-            log.info("查询到层级3子菜单数量:{}", level3Menus != null ? level3Menus.size() : 0);
             
-            // 3. 删除所有层级3子菜单
-            if (!CollectionUtils.isEmpty(level3Menus)) {
-                LambdaUpdateWrapper<StorePlatformMenu> wrapper2 = new LambdaUpdateWrapper<>();
-                wrapper2.eq(StorePlatformMenu::getLevel, 3)
-                        .in(StorePlatformMenu::getMenuId, level3MenuIds)
-                        .eq(StorePlatformMenu::getDelFlag, "0")
-                        .set(StorePlatformMenu::getDelFlag, "2");
-                int count2 = storePlatformMenuMapper.update(null, wrapper2);
-                totalUpdateCount += count2;
-                log.info("删除层级3子菜单,菜单ID={}, 更新记录数={}", menuId, totalUpdateCount);
+        } else if (level == 2) {
+            // 删除二级菜单:删除本级和所有子级(三级)
+            log.info("删除二级菜单,同时删除所有子级菜单,菜单ID={}, 层级={}", menuId, level);
+            
+            // 1. 查找所有子菜单ID(三级菜单)
+            List<Long> allChildrenIds = findAllChildrenMenuIds(menuId);
+            
+            // 2. 构建要删除的菜单ID列表(包括本级和所有子级)
+            List<Long> menuIdsToDelete = new ArrayList<>();
+            menuIdsToDelete.add(menuId);
+            menuIdsToDelete.addAll(allChildrenIds);
+            
+            // 3. 批量删除(逻辑删除)
+            if (!CollectionUtils.isEmpty(menuIdsToDelete)) {
+                LambdaUpdateWrapper<StorePlatformMenu> wrapper = new LambdaUpdateWrapper<>();
+                wrapper.in(StorePlatformMenu::getMenuId, menuIdsToDelete)
+                       .eq(StorePlatformMenu::getDelFlag, "0")
+                       .set(StorePlatformMenu::getDelFlag, "2");
+                int count = storePlatformMenuMapper.update(null, wrapper);
+                totalUpdateCount = count;
+                log.info("删除二级菜单及其所有子菜单成功,菜单ID={}, 子菜单数量={}, 总更新记录数={}", 
+                        menuId, allChildrenIds.size(), totalUpdateCount);
             } else {
-                log.info("没有层级3子菜单需要删除,菜单ID={}", menuId);
+                // 只删除本级菜单
+                LambdaUpdateWrapper<StorePlatformMenu> wrapper = new LambdaUpdateWrapper<>();
+                wrapper.eq(StorePlatformMenu::getMenuId, menuId)
+                       .eq(StorePlatformMenu::getDelFlag, "0")
+                       .set(StorePlatformMenu::getDelFlag, "2");
+                int count = storePlatformMenuMapper.update(null, wrapper);
+                totalUpdateCount = count;
+                log.info("删除二级菜单成功(无子菜单),菜单ID={}, 更新记录数={}", menuId, totalUpdateCount);
             }
-
             
         } else if (level == 3) {
-            // 删除层级3的菜单:只删除当前菜单
+            // 删除三级菜单:只删除本级
             log.info("删除三级菜单,只删除当前菜单,菜单ID={}, 层级={}", menuId, level);
-            LambdaQueryWrapper<StorePlatformMenu> level3Query = new LambdaQueryWrapper<>();
-            level3Query
-                    .eq(StorePlatformMenu::getLevel, 3)
-                    .eq(StorePlatformMenu::getDelFlag, "0");
-            List<StorePlatformMenu> level3Menus = storePlatformMenuMapper.selectList(level3Query);
-            List<Long> level3MenuIds = level3Menus.stream()
-                    .map(StorePlatformMenu::getMenuId)
-                    .collect(Collectors.toList());
-            log.info("查询到层级3子菜单数量:{}", level3Menus != null ? level3Menus.size() : 0);
-
-            // 3. 删除所有层级3子菜单
-            if (!CollectionUtils.isEmpty(level3Menus)) {
-                LambdaUpdateWrapper<StorePlatformMenu> wrapper2 = new LambdaUpdateWrapper<>();
-                wrapper2.eq(StorePlatformMenu::getLevel, 3)
-                        .in(StorePlatformMenu::getMenuId, level3MenuIds)
-                        .eq(StorePlatformMenu::getDelFlag, "0")
-                        .set(StorePlatformMenu::getDelFlag, "2");
-                int count2 = storePlatformMenuMapper.update(null, wrapper2);
-                totalUpdateCount += count2;
-                log.info("删除层级3子菜单,parent_id={}, 更新记录数={}", menuId, count2);
-            } else {
-                log.info("没有层级3子菜单需要删除,菜单ID={}", menuId);
-            }
+            
+            LambdaUpdateWrapper<StorePlatformMenu> wrapper = new LambdaUpdateWrapper<>();
+            wrapper.eq(StorePlatformMenu::getMenuId, menuId)
+                   .eq(StorePlatformMenu::getDelFlag, "0")
+                   .set(StorePlatformMenu::getDelFlag, "2");
+            int count = storePlatformMenuMapper.update(null, wrapper);
+            totalUpdateCount = count;
             
             if (totalUpdateCount > 0) {
                 log.info("删除三级菜单成功,菜单ID={}, 层级={}, 更新记录数={}", menuId, level, totalUpdateCount);
             } else {
-                log.warn("删除三级菜单未找到记录或已删除,菜单ID={}, 层级={}, del_flag={}", menuId, level, currentMenu.getDelFlag());
+                log.warn("删除三级菜单未找到记录或已删除,菜单ID={}, 层级={}, del_flag={}", 
+                        menuId, level, currentMenu.getDelFlag());
                 return R.fail("删除失败:菜单不存在或已被删除");
             }
             
@@ -537,170 +471,94 @@ public class StorePlatformMenuServiceImpl extends ServiceImpl<StorePlatformMenuM
         }
 
 
-        // 根据层级进行级联删除
+        // 根据层级进行级联更新状态
         if (level == 1) {
-            // 删除层级1的菜单:同时删除层级2和3的菜单
-            log.info("启用禁用一级菜单,同时启用禁用层级2和3的菜单,菜单ID={}, 层级={}", menuId, level);
-            LambdaQueryWrapper<StorePlatformMenu> level1Query = new LambdaQueryWrapper<>();
-            level1Query
-                    .eq(StorePlatformMenu::getLevel, 1)
-                    .eq(StorePlatformMenu::getDelFlag, "0")
-                    .eq(StorePlatformMenu::getStatus, currentStatus);
-            List<StorePlatformMenu> levelMenus = storePlatformMenuMapper.selectList(level1Query);
-            List<Long> levelMenuIds = levelMenus.stream()
-                    .map(StorePlatformMenu::getMenuId)
-                    .collect(Collectors.toList());
-            if (!CollectionUtils.isEmpty(levelMenus)){
-                LambdaUpdateWrapper<StorePlatformMenu> wrapper2 = new LambdaUpdateWrapper<>();
-                wrapper2.eq(StorePlatformMenu::getLevel, 1)
-                        .in(StorePlatformMenu::getMenuId, levelMenuIds)
-                        .eq(StorePlatformMenu::getDelFlag, "0")
-                        .set(StorePlatformMenu::getStatus, newStatus);
-                int count = storePlatformMenuMapper.update(null, wrapper2);
-                totalUpdateCount += count;
-                log.info("启用禁用一级菜单本身,菜单ID={}, 更新记录数={}", menuId, count);
-            }
-            // 1. 先查询所有层级2的子菜单
-            LambdaQueryWrapper<StorePlatformMenu> level2Query = new LambdaQueryWrapper<>();
-            level2Query
-                    .eq(StorePlatformMenu::getLevel, 2)
-                    .eq(StorePlatformMenu::getDelFlag, "0")
-                    .eq(StorePlatformMenu::getStatus, currentStatus);
-            List<StorePlatformMenu> level2Menus = storePlatformMenuMapper.selectList(level2Query);
-            List<Long> level2MenuIds = level2Menus.stream()
-                    .map(StorePlatformMenu::getMenuId)
-                    .collect(Collectors.toList());
-            log.info("查询到层级2子菜单数量:{}", level2Menus != null ? level2Menus.size() : 0);
-
-
-            // 3. 删除所有层级2子菜单
-            if (!CollectionUtils.isEmpty(level2Menus)) {
-                LambdaUpdateWrapper<StorePlatformMenu> wrapper2 = new LambdaUpdateWrapper<>();
-                wrapper2.eq(StorePlatformMenu::getLevel, 2)
-                        .in(StorePlatformMenu::getMenuId, level2MenuIds)
-                        .eq(StorePlatformMenu::getDelFlag, "0")
-                        .set(StorePlatformMenu::getStatus, newStatus);
-                int count2 = storePlatformMenuMapper.update(null, wrapper2);
-                totalUpdateCount += count2;
-                log.info("启用禁用层级2子菜单,菜单Id={}, 更新记录数={}", menuId, totalUpdateCount);
-            } else {
-                log.info("没有层级2子菜单需要启用禁用,菜单ID={}", menuId);
-            }
-            LambdaQueryWrapper<StorePlatformMenu> level3Query = new LambdaQueryWrapper<>();
-            level3Query
-                    .eq(StorePlatformMenu::getLevel, 3)
-                    .eq(StorePlatformMenu::getDelFlag, "0")
-                    .eq(StorePlatformMenu::getStatus, currentStatus);
-            List<StorePlatformMenu> level3Menus = storePlatformMenuMapper.selectList(level3Query);
-            List<Long> level3MenuIds = level3Menus.stream()
-                    .map(StorePlatformMenu::getMenuId)
-                    .collect(Collectors.toList());
-            // 4. 删除所有层级3子菜单(parent_id在层级2菜单ID列表中)
-            if (!CollectionUtils.isEmpty(level3Menus)) {
-                LambdaUpdateWrapper<StorePlatformMenu> wrapper3 = new LambdaUpdateWrapper<>();
-                wrapper3.eq(StorePlatformMenu::getLevel, 3)
-                        .in(StorePlatformMenu::getMenuId, level3MenuIds)
-                        .eq(StorePlatformMenu::getDelFlag, "0")
-                        .set(StorePlatformMenu::getStatus, newStatus);
-                int count3 = storePlatformMenuMapper.update(null, wrapper3);
-                totalUpdateCount += count3;
-                log.info("启用禁用层级3子菜单, 更新记录数={}", level3MenuIds, count3);
+            // 关闭/开启一级菜单:关闭/开启本级和所有子级(二级和三级)
+            log.info("关闭/开启一级菜单,同时关闭/开启所有子级菜单,菜单ID={}, 层级={}, 新状态={}", menuId, level, newStatus);
+            
+            // 1. 查找所有子菜单ID(包括二级和三级)
+            List<Long> allChildrenIds = findAllChildrenMenuIds(menuId);
+            
+            // 2. 构建要更新状态的菜单ID列表(包括本级和所有子级)
+            List<Long> menuIdsToUpdate = new ArrayList<>();
+            menuIdsToUpdate.add(menuId);
+            menuIdsToUpdate.addAll(allChildrenIds);
+            
+            // 3. 批量更新状态
+            if (!CollectionUtils.isEmpty(menuIdsToUpdate)) {
+                LambdaUpdateWrapper<StorePlatformMenu> wrapper = new LambdaUpdateWrapper<>();
+                wrapper.in(StorePlatformMenu::getMenuId, menuIdsToUpdate)
+                       .eq(StorePlatformMenu::getDelFlag, "0")
+                       .set(StorePlatformMenu::getStatus, newStatus);
+                int count = storePlatformMenuMapper.update(null, wrapper);
+                totalUpdateCount = count;
+                log.info("关闭/开启一级菜单及其所有子菜单成功,菜单ID={}, 子菜单数量={}, 总更新记录数={}", 
+                        menuId, allChildrenIds.size(), totalUpdateCount);
             } else {
-                log.info("没有层级3子菜单需要操作,菜单ID={}", menuId);
+                // 只更新本级菜单状态
+                LambdaUpdateWrapper<StorePlatformMenu> wrapper = new LambdaUpdateWrapper<>();
+                wrapper.eq(StorePlatformMenu::getMenuId, menuId)
+                       .eq(StorePlatformMenu::getDelFlag, "0")
+                       .set(StorePlatformMenu::getStatus, newStatus);
+                int count = storePlatformMenuMapper.update(null, wrapper);
+                totalUpdateCount = count;
+                log.info("关闭/开启一级菜单成功(无子菜单),菜单ID={}, 更新记录数={}", menuId, totalUpdateCount);
             }
 
-            log.info("操作一级菜单成功,菜单ID={}, 层级={}, 总更新记录数={}", menuId, level, totalUpdateCount);
-
         } else if (level == 2) {
-            // 删除层级2的菜单:同时删除层级3的菜单
-            log.info("启用禁用二级菜单,同时启用禁用层级3的菜单,菜单ID={}, 层级={}", menuId, level);
-            LambdaQueryWrapper<StorePlatformMenu> level2Query = new LambdaQueryWrapper<>();
-            level2Query
-                    .eq(StorePlatformMenu::getLevel, 2)
-                    .eq(StorePlatformMenu::getDelFlag, "0")
-                    .eq(StorePlatformMenu::getStatus, currentStatus);
-            List<StorePlatformMenu> level2Menus = storePlatformMenuMapper.selectList(level2Query);
-            List<Long> level2MenuIds = level2Menus.stream()
-                    .map(StorePlatformMenu::getMenuId)
-                    .collect(Collectors.toList());
-            // 3. 删除所有层级2子菜单
-            if (!CollectionUtils.isEmpty(level2Menus)) {
-                LambdaUpdateWrapper<StorePlatformMenu> wrapper2 = new LambdaUpdateWrapper<>();
-                wrapper2.eq(StorePlatformMenu::getLevel, 2)
-                        .in(StorePlatformMenu::getMenuId, level2MenuIds)
-                        .eq(StorePlatformMenu::getDelFlag, "0")
-                        .set(StorePlatformMenu::getStatus, newStatus);
-                int count2 = storePlatformMenuMapper.update(null, wrapper2);
-                totalUpdateCount += count2;
-                log.info("启用禁用层级2子菜单,菜单ID={}, 更新记录数={}", menuId, count2);
-            } else {
-                log.info("没有层级2子菜单需要操作,菜单ID={}", menuId);
-            }
-
-            // 1. 先查询所有层级3的子菜单
-            LambdaQueryWrapper<StorePlatformMenu> level3Query = new LambdaQueryWrapper<>();
-            level3Query.eq(StorePlatformMenu::getMenuId, menuId)
-                    .eq(StorePlatformMenu::getLevel, 3)
-                    .eq(StorePlatformMenu::getDelFlag, "0")
-                    .eq(StorePlatformMenu::getStatus, currentStatus);
-            List<StorePlatformMenu> level3Menus = storePlatformMenuMapper.selectList(level3Query);
-            List<Long> level3MenuIds = level3Menus.stream()
-                    .map(StorePlatformMenu::getMenuId)
-                    .collect(Collectors.toList());
-            log.info("查询到层级3子菜单数量:{}", level3Menus != null ? level3Menus.size() : 0);
-
-            // 3. 删除所有层级3子菜单
-            if (!CollectionUtils.isEmpty(level3Menus)) {
-                LambdaUpdateWrapper<StorePlatformMenu> wrapper2 = new LambdaUpdateWrapper<>();
-                wrapper2.eq(StorePlatformMenu::getLevel, 3)
-                        .in(StorePlatformMenu::getMenuId, level3MenuIds)
-                        .eq(StorePlatformMenu::getDelFlag, "0")
-                        .set(StorePlatformMenu::getStatus, newStatus);
-                int count2 = storePlatformMenuMapper.update(null, wrapper2);
-                totalUpdateCount += count2;
-                log.info("启用禁用层级3子菜单,菜单ID={}, 更新记录数={}", menuId, totalUpdateCount);
+            // 关闭/开启二级菜单:关闭/开启本级和所有子级(三级)
+            log.info("关闭/开启二级菜单,同时关闭/开启所有子级菜单,菜单ID={}, 层级={}, 新状态={}", menuId, level, newStatus);
+            
+            // 1. 查找所有子菜单ID(三级菜单)
+            List<Long> allChildrenIds = findAllChildrenMenuIds(menuId);
+            
+            // 2. 构建要更新状态的菜单ID列表(包括本级和所有子级)
+            List<Long> menuIdsToUpdate = new ArrayList<>();
+            menuIdsToUpdate.add(menuId);
+            menuIdsToUpdate.addAll(allChildrenIds);
+            
+            // 3. 批量更新状态
+            if (!CollectionUtils.isEmpty(menuIdsToUpdate)) {
+                LambdaUpdateWrapper<StorePlatformMenu> wrapper = new LambdaUpdateWrapper<>();
+                wrapper.in(StorePlatformMenu::getMenuId, menuIdsToUpdate)
+                       .eq(StorePlatformMenu::getDelFlag, "0")
+                       .set(StorePlatformMenu::getStatus, newStatus);
+                int count = storePlatformMenuMapper.update(null, wrapper);
+                totalUpdateCount = count;
+                log.info("关闭/开启二级菜单及其所有子菜单成功,菜单ID={}, 子菜单数量={}, 总更新记录数={}", 
+                        menuId, allChildrenIds.size(), totalUpdateCount);
             } else {
-                log.info("没有层级3子菜单需要操作,菜单ID={}", menuId);
+                // 只更新本级菜单状态
+                LambdaUpdateWrapper<StorePlatformMenu> wrapper = new LambdaUpdateWrapper<>();
+                wrapper.eq(StorePlatformMenu::getMenuId, menuId)
+                       .eq(StorePlatformMenu::getDelFlag, "0")
+                       .set(StorePlatformMenu::getStatus, newStatus);
+                int count = storePlatformMenuMapper.update(null, wrapper);
+                totalUpdateCount = count;
+                log.info("关闭/开启二级菜单成功(无子菜单),菜单ID={}, 更新记录数={}", menuId, totalUpdateCount);
             }
 
-
         } else if (level == 3) {
-            // 删除层级3的菜单:只删除当前菜单
-            log.info("删除三级菜单,只删除当前菜单,菜单ID={}, 层级={}", menuId, level);
-            LambdaQueryWrapper<StorePlatformMenu> level3Query = new LambdaQueryWrapper<>();
-            level3Query.eq(StorePlatformMenu::getMenuId, menuId)
-                    .eq(StorePlatformMenu::getLevel, 3)
-                    .eq(StorePlatformMenu::getDelFlag, "0")
-                    .eq(StorePlatformMenu::getStatus, currentStatus);
-            List<StorePlatformMenu> level3Menus = storePlatformMenuMapper.selectList(level3Query);
-            List<Long> level3MenuIds = level3Menus.stream()
-                    .map(StorePlatformMenu::getMenuId)
-                    .collect(Collectors.toList());
-            log.info("查询到层级3子菜单数量:{}", level3Menus != null ? level3Menus.size() : 0);
-
-            // 3. 删除所有层级3子菜单
-            if (!CollectionUtils.isEmpty(level3Menus)) {
-                LambdaUpdateWrapper<StorePlatformMenu> wrapper2 = new LambdaUpdateWrapper<>();
-                wrapper2.eq(StorePlatformMenu::getLevel, 3)
-                        .in(StorePlatformMenu::getMenuId, level3MenuIds)
-                        .eq(StorePlatformMenu::getDelFlag, "0")
-                        .set(StorePlatformMenu::getStatus, newStatus);
-                int count2 = storePlatformMenuMapper.update(null, wrapper2);
-                totalUpdateCount += count2;
-                log.info("删除层级3子菜单,parent_id={}, 更新记录数={}", menuId, count2);
-            } else {
-                log.info("没有层级3子菜单需要删除,菜单ID={}", menuId);
-            }
-
+            // 关闭/开启三级菜单:只更新本级
+            log.info("关闭/开启三级菜单,只更新当前菜单,菜单ID={}, 层级={}, 新状态={}", menuId, level, newStatus);
+            
+            LambdaUpdateWrapper<StorePlatformMenu> wrapper = new LambdaUpdateWrapper<>();
+            wrapper.eq(StorePlatformMenu::getMenuId, menuId)
+                   .eq(StorePlatformMenu::getDelFlag, "0")
+                   .set(StorePlatformMenu::getStatus, newStatus);
+            int count = storePlatformMenuMapper.update(null, wrapper);
+            totalUpdateCount = count;
+            
             if (totalUpdateCount > 0) {
-                log.info("删除三级菜单成功,菜单ID={}, 层级={}, 更新记录数={}", menuId, level, totalUpdateCount);
+                log.info("关闭/开启三级菜单成功,菜单ID={}, 层级={}, 更新记录数={}", menuId, level, totalUpdateCount);
             } else {
-                log.warn("删除三级菜单未找到记录或已删除,菜单ID={}, 层级={}, del_flag={}", menuId, level, currentMenu.getDelFlag());
-                return R.fail("删除失败:菜单不存在或已被删除");
+                log.warn("关闭/开启三级菜单未找到记录或已删除,菜单ID={}, 层级={}, del_flag={}", 
+                        menuId, level, currentMenu.getDelFlag());
+                return R.fail("操作失败:菜单不存在或已被删除");
             }
 
         } else {
-            log.warn("删除菜单失败:层级值不正确,菜单ID={}, 层级={}", menuId, level);
+            log.warn("更新菜单状态失败:层级值不正确,菜单ID={}, 层级={}", menuId, level);
             return R.fail("层级值不正确,应为1、2或3");
         }
 
@@ -996,6 +854,36 @@ public class StorePlatformMenuServiceImpl extends ServiceImpl<StorePlatformMenuM
         }
     }
 
+    /**
+     * 递归查找所有子菜单ID(包括直接子菜单和间接子菜单)
+     * 
+     * @param parentId 父菜单ID
+     * @return 所有子菜单ID列表(包括子菜单的子菜单)
+     */
+    private List<Long> findAllChildrenMenuIds(Long parentId) {
+        List<Long> allChildrenIds = new ArrayList<>();
+        if (parentId == null) {
+            return allChildrenIds;
+        }
+        
+        // 查询直接子菜单
+        LambdaQueryWrapper<StorePlatformMenu> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(StorePlatformMenu::getParentId, parentId)
+                   .eq(StorePlatformMenu::getDelFlag, "0");
+        List<StorePlatformMenu> children = storePlatformMenuMapper.selectList(queryWrapper);
+        
+        if (!CollectionUtils.isEmpty(children)) {
+            for (StorePlatformMenu child : children) {
+                Long childId = child.getMenuId();
+                allChildrenIds.add(childId);
+                // 递归查找子菜单的子菜单
+                List<Long> grandChildrenIds = findAllChildrenMenuIds(childId);
+                allChildrenIds.addAll(grandChildrenIds);
+            }
+        }
+        
+        return allChildrenIds;
+    }
 
 }
 

+ 72 - 7
alien-store/src/main/java/shop/alien/store/service/impl/StoreStaffReviewServiceImpl.java

@@ -5,6 +5,7 @@ import com.alibaba.fastjson2.JSONArray;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.RequiredArgsConstructor;
@@ -17,14 +18,12 @@ import shop.alien.entity.result.R;
 import shop.alien.entity.store.*;
 import shop.alien.entity.store.dto.StoreStaffReviewDto;
 import shop.alien.entity.store.vo.*;
-import shop.alien.mapper.LifeLikeRecordMapper;
-import shop.alien.mapper.StoreStaffCommentMapper;
-import shop.alien.mapper.StoreStaffConfigMapper;
-import shop.alien.mapper.StoreStaffReviewMapper;
+import shop.alien.mapper.*;
 import shop.alien.store.service.StoreStaffCommentService;
 import shop.alien.store.service.StoreStaffReviewService;
 import shop.alien.store.util.ai.AiContentModerationUtil;
 import shop.alien.store.util.ai.AiVideoModerationUtil;
+import shop.alien.util.common.DistanceUtil;
 
 import java.math.BigDecimal;
 import java.math.RoundingMode;
@@ -51,6 +50,8 @@ public class StoreStaffReviewServiceImpl extends ServiceImpl<StoreStaffReviewMap
     private final StoreStaffCommentMapper storeStaffCommentMapper;
     private final LifeLikeRecordMapper lifeLikeRecordMapper;
     private final StoreStaffConfigMapper storeStaffConfigMapper;
+    private final StoreInfoMapper storeInfoMapper;
+    private final StoreUserMapper storeUserMapper;
     private final AiContentModerationUtil aiContentModerationUtil;
     @Qualifier("commonVideoTaskExecutor")
     private final ExecutorService commonVideoTaskExecutor;
@@ -72,7 +73,11 @@ public class StoreStaffReviewServiceImpl extends ServiceImpl<StoreStaffReviewMap
         // AI审核
         // 一次遍历完成分类,避免多次流式处理
         Map<String, List<String>> urlCategoryMap = StoreRenovationRequirementServiceImpl.classifyUrls(reviewDto.getReviewImages());
-        AiContentModerationUtil.AuditResult auditResult = aiContentModerationUtil.auditContent(reviewDto.getReviewContent(), urlCategoryMap.get("image"));
+
+        AiContentModerationUtil.AuditResult auditResult = new AiContentModerationUtil.AuditResult(true, "");
+        if( StringUtils.isNotEmpty(reviewDto.getReviewContent()) || urlCategoryMap.get("image").size() > 0){
+            auditResult = aiContentModerationUtil.auditContent(reviewDto.getReviewContent(), urlCategoryMap.get("image"));
+        }
         if (!auditResult.isPassed()) {
             // 审核不通过
             StoreStaffReview staffReview = this.getById(review.getId());
@@ -154,8 +159,8 @@ public class StoreStaffReviewServiceImpl extends ServiceImpl<StoreStaffReviewMap
     }
 
     @Override
-    public R<StoreStaffReviewDetailVo> getReviewDetail(Integer reviewId, Integer currentUserId) {
-        log.info("获取评价详情, reviewId={}, currentUserId={}", reviewId, currentUserId);
+    public R<StoreStaffReviewDetailVo> getReviewDetail(Integer reviewId, Integer currentUserId, Double longitude, Double latitude) {
+        log.info("获取评价详情, reviewId={}, currentUserId={}, longitude={}, latitude={}", reviewId, currentUserId, longitude, latitude);
 
         if (reviewId == null) {
             return R.fail("评价ID不能为空");
@@ -183,19 +188,79 @@ public class StoreStaffReviewServiceImpl extends ServiceImpl<StoreStaffReviewMap
 
         // 查询人员信息
         StoreStaffConfig staffInfo = null;
+        Integer storeId = null;
         if (reviewVo.getStaffUserId() != null) {
             try {
                 staffInfo = storeStaffConfigMapper.selectById(reviewVo.getStaffUserId());
+                if (staffInfo != null) {
+                    storeId = staffInfo.getStoreId();
+                }
             } catch (Exception e) {
                 log.warn("查询人员信息失败, staffUserId={}, error={}", reviewVo.getStaffUserId(), e.getMessage());
             }
         }
 
+        // 查询店铺信息(包括店铺头像、评分和距离)
+        StoreStaffReviewDetailVo.StoreInfoForStaffReviewVo storeInfoVo = null;
+        if (storeId != null) {
+            try {
+                // 查询店铺基本信息
+                StoreInfo storeInfo = storeInfoMapper.selectById(storeId);
+                if (storeInfo != null) {
+                    storeInfoVo = new StoreStaffReviewDetailVo.StoreInfoForStaffReviewVo();
+                    storeInfoVo.setStoreId(storeId);
+                    storeInfoVo.setStoreName(storeInfo.getStoreName());
+                    
+                    // 设置店铺评分(平均评分)
+                    if (storeInfo.getScoreAvg() != null) {
+                        storeInfoVo.setScore(storeInfo.getScoreAvg());
+                    } else {
+                        storeInfoVo.setScore(null);
+                    }
+                    
+                    // 查询店铺头像(来自store_user表的head_img字段)
+                    LambdaQueryWrapper<StoreUser> userWrapper = new LambdaQueryWrapper<>();
+                    userWrapper.eq(StoreUser::getStoreId, storeId)
+                              .eq(StoreUser::getDeleteFlag, 0);
+                    StoreUser storeUser = storeUserMapper.selectOne(userWrapper);
+                    if (storeUser != null && storeUser.getHeadImg() != null && !storeUser.getHeadImg().trim().isEmpty()) {
+                        storeInfoVo.setHeadImg(storeUser.getHeadImg());
+                    } else {
+                        storeInfoVo.setHeadImg(null);
+                    }
+                    
+                    // 计算距离(如果提供了用户经纬度)
+                    if (longitude != null && latitude != null && storeInfo.getStorePosition() != null && !storeInfo.getStorePosition().trim().isEmpty()) {
+                        try {
+                            String[] positionArray = storeInfo.getStorePosition().split(",");
+                            if (positionArray.length >= 2) {
+                                double storeLon = Double.parseDouble(positionArray[0].trim());
+                                double storeLat = Double.parseDouble(positionArray[1].trim());
+                                // 计算距离(单位:公里)
+                                double distanceKm = DistanceUtil.haversineCalculateDistance(longitude, latitude, storeLon, storeLat);
+                                storeInfoVo.setDistance(distanceKm);
+                            } else {
+                                storeInfoVo.setDistance(null);
+                            }
+                        } catch (Exception e) {
+                            log.warn("计算店铺距离失败, storeId={}, error={}", storeId, e.getMessage());
+                            storeInfoVo.setDistance(null);
+                        }
+                    } else {
+                        storeInfoVo.setDistance(null);
+                    }
+                }
+            } catch (Exception e) {
+                log.warn("查询店铺信息失败, storeId={}, error={}", storeId, e.getMessage());
+            }
+        }
+
         // 构建返回结果
         StoreStaffReviewDetailVo detailVo = new StoreStaffReviewDetailVo();
         detailVo.setReview(reviewVo);
         detailVo.setCommentList(comments != null ? comments : new ArrayList<>());
         detailVo.setStaffInfo(staffInfo);
+        detailVo.setStoreInfo(storeInfoVo);
 
         return R.data(detailVo);
     }

+ 3 - 12
alien-store/src/main/java/shop/alien/store/service/impl/StoreUserServiceImpl.java

@@ -425,19 +425,10 @@ public class StoreUserServiceImpl extends ServiceImpl<StoreUserMapper, StoreUser
                         .collect(Collectors.toList());
             }
 
-            // 当id不为空时,通过中间表storePlatformUserRole判断是否为子账号(必须是子账号
+            // 当id不为空时,对ID进行模糊查询(将ID转换为字符串进行模糊匹配
             if (StringUtils.isNotEmpty(id)) {
-                Integer parsedId = safeParseInt(id);
-                if (parsedId != null) {
-                    // 必须通过中间表判断,只有存在中间表中的才是子账号
-                    if (subAccountUserIds != null && subAccountUserIds.contains(parsedId)) {
-                        // 如果在中间表中存在,说明是子账号,添加ID条件
-                        subAccountWrapper.eq(StoreUser::getId, parsedId);
-                    } else {
-                        // 如果不在中间表中,添加一个无法匹配的条件,避免查询到非子账号
-                        subAccountWrapper.eq(StoreUser::getId, -1);
-                    }
-                }
+                // 使用apply方法,将ID转换为字符串进行模糊查询
+                subAccountWrapper.apply("CAST(id AS CHAR) LIKE {0}", "%" + id + "%");
             }
 
             // 当phone不为空时,对子账号和主账号电话进行模糊查询,并关联storePlatformUserRole