|
|
@@ -809,6 +809,52 @@ public class StoreCommentServiceImpl extends ServiceImpl<StoreCommentMapper, Sto
|
|
|
record.setGroupBuyImgUrl(imgUrlBuilder.toString());
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ List<LifeUserOrderCommentVo> lifeUserOrderCommentVos = commentOrderPage.getRecords();
|
|
|
+ if(CollectionUtils.isEmpty(lifeUserOrderCommentVos)){
|
|
|
+ return commentOrderPage;
|
|
|
+ }
|
|
|
+ List<String> orderIds = lifeUserOrderCommentVos.stream().map(LifeUserOrderCommentVo::getId).collect(Collectors.toList());
|
|
|
+ List<StoreComment> storeCommentList = storeCommentMapper.selectList(new QueryWrapper<StoreComment>().inSql("business_id", String.join(",", orderIds)).eq("business_type", 5));
|
|
|
+ if(CollectionUtils.isEmpty(storeCommentList)){
|
|
|
+ return commentOrderPage;
|
|
|
+ }
|
|
|
+ Map<Integer, StoreComment> commentIdToMap = storeCommentList.stream()
|
|
|
+ .collect(Collectors.toMap(
|
|
|
+ StoreComment::getBusinessId,
|
|
|
+ Function.identity(),
|
|
|
+ (existing, replacement) -> existing // 若有重复id(理论上不会),保留第一个
|
|
|
+ ));
|
|
|
+ if(CollectionUtils.isEmpty(commentIdToMap)){
|
|
|
+ return commentOrderPage;
|
|
|
+ }
|
|
|
+ for(LifeUserOrderCommentVo lifeUserOrderCommentVo : commentOrderPage.getRecords()){
|
|
|
+ Integer orderId = Integer.parseInt(lifeUserOrderCommentVo.getId());
|
|
|
+
|
|
|
+ if(commentIdToMap.containsKey(orderId)){
|
|
|
+ StoreComment storeComment = commentIdToMap.get(orderId);
|
|
|
+ lifeUserOrderCommentVo.setScore(storeComment.getScore().toString());
|
|
|
+ lifeUserOrderCommentVo.setCommentDate(storeComment.getCreatedTime());
|
|
|
+ String imgIds = storeComment.getImgId();
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(imgIds)){
|
|
|
+ LambdaQueryWrapper<StoreImg> storeImgLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ List<String> imgIdList = Arrays.stream(imgIds.split(","))
|
|
|
+ .map(String::trim)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ storeImgLambdaQueryWrapper.in(StoreImg::getId, imgIdList);
|
|
|
+ List<StoreImg> storeImgList = storeImgMapper.selectList(storeImgLambdaQueryWrapper);
|
|
|
+ if(CollectionUtils.isNotEmpty(storeImgList)){
|
|
|
+ List<String> imgUrlList = storeImgList.stream() // 转换为 Stream
|
|
|
+ .map(StoreImg::getImgUrl) // 映射,提取 name 字段
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ lifeUserOrderCommentVo.setImgUrls(imgUrlList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
return commentOrderPage;
|
|
|
}
|
|
|
}
|