|
@@ -20,6 +20,7 @@ import shop.alien.entity.store.dto.StoreStaffReviewDto;
|
|
|
import shop.alien.entity.store.vo.StoreStaffCommentVo;
|
|
import shop.alien.entity.store.vo.StoreStaffCommentVo;
|
|
|
import shop.alien.entity.store.vo.StoreStaffReviewDetailVo;
|
|
import shop.alien.entity.store.vo.StoreStaffReviewDetailVo;
|
|
|
import shop.alien.entity.store.vo.StoreStaffReviewListWithStaffVo;
|
|
import shop.alien.entity.store.vo.StoreStaffReviewListWithStaffVo;
|
|
|
|
|
+import shop.alien.entity.store.vo.StoreStaffReviewStatisticsVo;
|
|
|
import shop.alien.entity.store.vo.StoreStaffReviewVo;
|
|
import shop.alien.entity.store.vo.StoreStaffReviewVo;
|
|
|
import shop.alien.entity.store.StoreStaffConfig;
|
|
import shop.alien.entity.store.StoreStaffConfig;
|
|
|
import shop.alien.mapper.LifeLikeRecordMapper;
|
|
import shop.alien.mapper.LifeLikeRecordMapper;
|
|
@@ -520,4 +521,79 @@ public class StoreStaffReviewServiceImpl extends ServiceImpl<StoreStaffReviewMap
|
|
|
|
|
|
|
|
return R.data(result);
|
|
return R.data(result);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public R<StoreStaffReviewStatisticsVo> getStaffReviewStatistics(Integer staffUserId) {
|
|
|
|
|
+ log.info("获取员工评价统计数据, staffUserId={}", staffUserId);
|
|
|
|
|
+
|
|
|
|
|
+ if (staffUserId == null) {
|
|
|
|
|
+ return R.fail("员工ID不能为空");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ StoreStaffReviewStatisticsVo statistics = new StoreStaffReviewStatisticsVo();
|
|
|
|
|
+
|
|
|
|
|
+ // 统计全部评价数量
|
|
|
|
|
+ Integer totalCount = storeStaffReviewMapper.getTotalReviewCountByStaffUserId(staffUserId);
|
|
|
|
|
+ statistics.setTotalCount(totalCount != null ? totalCount : 0);
|
|
|
|
|
+
|
|
|
|
|
+ // 统计好评数量
|
|
|
|
|
+ Integer goodCount = storeStaffReviewMapper.getGoodReviewCountByStaffUserId(staffUserId);
|
|
|
|
|
+ statistics.setGoodCount(goodCount != null ? goodCount : 0);
|
|
|
|
|
+
|
|
|
|
|
+ // 统计中评数量
|
|
|
|
|
+ Integer mediumCount = storeStaffReviewMapper.getMediumReviewCountByStaffUserId(staffUserId);
|
|
|
|
|
+ statistics.setMediumCount(mediumCount != null ? mediumCount : 0);
|
|
|
|
|
+
|
|
|
|
|
+ // 统计差评数量
|
|
|
|
|
+ Integer badCount = storeStaffReviewMapper.getBadReviewCountByStaffUserId(staffUserId);
|
|
|
|
|
+ statistics.setBadCount(badCount != null ? badCount : 0);
|
|
|
|
|
+
|
|
|
|
|
+ // 统计有图评价数量
|
|
|
|
|
+ Integer imageCount = storeStaffReviewMapper.getImageReviewCountByStaffUserId(staffUserId);
|
|
|
|
|
+ statistics.setImageCount(imageCount != null ? imageCount : 0);
|
|
|
|
|
+
|
|
|
|
|
+ log.info("获取员工评价统计数据成功,员工ID={}, 全部={}, 好评={}, 中评={}, 差评={}, 有图={}",
|
|
|
|
|
+ staffUserId, statistics.getTotalCount(), statistics.getGoodCount(),
|
|
|
|
|
+ statistics.getMediumCount(), statistics.getBadCount(), statistics.getImageCount());
|
|
|
|
|
+
|
|
|
|
|
+ return R.data(statistics);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("获取员工评价统计数据异常,员工ID={}, 错误信息={}", staffUserId, e.getMessage(), e);
|
|
|
|
|
+ return R.fail("获取统计数据失败");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public R<IPage<StoreStaffReviewVo>> getReviewListByStaffAndType(int pageNum, int pageSize, Integer staffUserId, Integer type, Integer currentUserId) {
|
|
|
|
|
+ log.info("根据员工ID和类型分页查询评价列表, pageNum={}, pageSize={}, staffUserId={}, type={}, currentUserId={}",
|
|
|
|
|
+ pageNum, pageSize, staffUserId, type, currentUserId);
|
|
|
|
|
+
|
|
|
|
|
+ if (staffUserId == null) {
|
|
|
|
|
+ return R.fail("员工ID不能为空");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ Page<StoreStaffReviewVo> page = new Page<>(pageNum, pageSize);
|
|
|
|
|
+ IPage<StoreStaffReviewVo> result = storeStaffReviewMapper.getReviewListByStaffAndType(page, staffUserId, type, currentUserId);
|
|
|
|
|
+
|
|
|
|
|
+ // 处理评价图片JSON字符串转换为列表
|
|
|
|
|
+ if (result.getRecords() != null) {
|
|
|
|
|
+ for (StoreStaffReviewVo vo : result.getRecords()) {
|
|
|
|
|
+ // 处理评价图片:从JSON字符串解析为List
|
|
|
|
|
+ if (vo.getReviewImagesJson() != null && !vo.getReviewImagesJson().trim().isEmpty()) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ List<String> images = JSON.parseArray(vo.getReviewImagesJson(), String.class);
|
|
|
|
|
+ vo.setReviewImages(images != null ? images : new ArrayList<>());
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.warn("解析评价图片失败:{}", e.getMessage());
|
|
|
|
|
+ vo.setReviewImages(new ArrayList<>());
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ vo.setReviewImages(new ArrayList<>());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return R.data(result);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|