فهرست منبع

人员接口修改

zhangchen 3 ماه پیش
والد
کامیت
7daf7dce20
1فایلهای تغییر یافته به همراه17 افزوده شده و 17 حذف شده
  1. 17 17
      alien-store/src/main/java/shop/alien/store/service/impl/StoreStaffConfigServiceImpl.java

+ 17 - 17
alien-store/src/main/java/shop/alien/store/service/impl/StoreStaffConfigServiceImpl.java

@@ -25,6 +25,7 @@ import shop.alien.entity.store.StoreStaffFitnessCourse;
 import shop.alien.entity.store.StoreStaffFitnessExperience;
 import shop.alien.entity.store.vo.PerformanceScheduleVo;
 import shop.alien.entity.store.StoreComment;
+import shop.alien.entity.store.StoreStaffReview;
 import shop.alien.entity.store.StoreStaffTitle;
 import shop.alien.entity.store.vo.StaffTitleGroupVo;
 import shop.alien.entity.store.vo.StoreStaffDetailVo;
@@ -87,6 +88,8 @@ public class StoreStaffConfigServiceImpl implements StoreStaffConfigService {
 
     private final StoreCommentMapper storeCommentMapper;
 
+    private final StoreStaffReviewMapper storeStaffReviewMapper;
+
     private final StoreStaffFitnessExperienceService storeStaffFitnessExperienceService;
 
     /**
@@ -1655,11 +1658,11 @@ public class StoreStaffConfigServiceImpl implements StoreStaffConfigService {
     /**
      * 批量查询员工好评数
      * <p>
-     * 查询每个员工的好评数量(business_type=5, score>=4.5, business_id=员工ID)
+     * 从store_staff_review表中查询好评数(overall_rating>4.5, staff_user_id=员工ID)
      * </p>
      *
      * @param staffIds 员工ID列表
-     * @param storeId  店铺ID
+     * @param storeId  店铺ID(此参数保留以兼容现有调用,但store_staff_review表中可能不需要此字段)
      * @return 员工ID到好评数的映射
      */
     private Map<Integer, Integer> queryPositiveCommentsCountMap(List<Integer> staffIds, Integer storeId) {
@@ -1670,21 +1673,18 @@ public class StoreStaffConfigServiceImpl implements StoreStaffConfigService {
         }
 
         try {
-            // 查询好评(business_type=5, score>=4.5, business_id in staffIds)
-            LambdaQueryWrapper<StoreComment> queryWrapper = new LambdaQueryWrapper<>();
-            queryWrapper.eq(StoreComment::getStoreId, storeId)
-                    .eq(StoreComment::getBusinessType, 5)
-                    .eq(StoreComment::getDeleteFlag, CommonConstant.DELETE_FLAG_UNDELETE)
-                    .isNull(StoreComment::getReplyId)
-                    .ge(StoreComment::getScore, 4.5)
-                    .in(StoreComment::getBusinessId, staffIds);
-
-            List<StoreComment> positiveComments = storeCommentMapper.selectList(queryWrapper);
-
-            if (positiveComments != null && !positiveComments.isEmpty()) {
-                // 按business_id分组统计
-                Map<Integer, Long> countMapLong = positiveComments.stream()
-                        .collect(Collectors.groupingBy(StoreComment::getBusinessId, Collectors.counting()));
+            // 查询好评(overall_rating>4.5, staff_user_id in staffIds)
+            LambdaQueryWrapper<StoreStaffReview> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.eq(StoreStaffReview::getDeleteFlag, CommonConstant.DELETE_FLAG_UNDELETE)
+                    .gt(StoreStaffReview::getOverallRating, new java.math.BigDecimal("4.5"))
+                    .in(StoreStaffReview::getStaffUserId, staffIds);
+
+            List<StoreStaffReview> positiveReviews = storeStaffReviewMapper.selectList(queryWrapper);
+
+            if (positiveReviews != null && !positiveReviews.isEmpty()) {
+                // 按staff_user_id分组统计
+                Map<Integer, Long> countMapLong = positiveReviews.stream()
+                        .collect(Collectors.groupingBy(StoreStaffReview::getStaffUserId, Collectors.counting()));
 
                 // 转换为Integer
                 for (Map.Entry<Integer, Long> entry : countMapLong.entrySet()) {