|
@@ -363,6 +363,9 @@ public class CommonRatingServiceImpl extends ServiceImpl<CommonRatingMapper, Com
|
|
|
wrapper.eq(CommonRating::getIsShow, 1);
|
|
wrapper.eq(CommonRating::getIsShow, 1);
|
|
|
List<CommonRating> commonRatings = commonRatingMapper.selectList(wrapper);
|
|
List<CommonRating> commonRatings = commonRatingMapper.selectList(wrapper);
|
|
|
List<Long> collect = commonRatings.stream().map(x -> x.getId()).collect(Collectors.toList());
|
|
List<Long> collect = commonRatings.stream().map(x -> x.getId()).collect(Collectors.toList());
|
|
|
|
|
+ // 查询没有回复的评价数量
|
|
|
|
|
+ Integer noReplyCount = commonRatingMapper.getRatingWithNoReply(wrapper);
|
|
|
|
|
+
|
|
|
// 如果为空直接返回
|
|
// 如果为空直接返回
|
|
|
Map<String, Object> ratingCount = new HashMap<>();
|
|
Map<String, Object> ratingCount = new HashMap<>();
|
|
|
if(commonRatings.isEmpty()){
|
|
if(commonRatings.isEmpty()){
|
|
@@ -370,7 +373,7 @@ public class CommonRatingServiceImpl extends ServiceImpl<CommonRatingMapper, Com
|
|
|
}
|
|
}
|
|
|
// 获取评价统计信息(总评论数、有图评论数、好评数、中评数、差评数)
|
|
// 获取评价统计信息(总评论数、有图评论数、好评数、中评数、差评数)
|
|
|
ratingCount = commonRatingMapper.getRatingCount(new QueryWrapper<CommonRating>().in("id", collect));
|
|
ratingCount = commonRatingMapper.getRatingCount(new QueryWrapper<CommonRating>().in("id", collect));
|
|
|
-
|
|
|
|
|
|
|
+ ratingCount.put("noReplyCount", noReplyCount);
|
|
|
// 计算好评、中评、差评占比
|
|
// 计算好评、中评、差评占比
|
|
|
// 注意:数据库返回的 count 可能是 BigDecimal、Long 或 Integer 类型,需要安全转换
|
|
// 注意:数据库返回的 count 可能是 BigDecimal、Long 或 Integer 类型,需要安全转换
|
|
|
int goodCount = getIntValue(ratingCount.get("goodCount"));
|
|
int goodCount = getIntValue(ratingCount.get("goodCount"));
|