|
@@ -65,6 +65,7 @@ public class CommonRatingServiceImpl extends ServiceImpl<CommonRatingMapper, Com
|
|
|
private final CommonCommentMapper commonCommentMapper;
|
|
private final CommonCommentMapper commonCommentMapper;
|
|
|
private final LifeLikeRecordMapper lifeLikeRecordMapper;
|
|
private final LifeLikeRecordMapper lifeLikeRecordMapper;
|
|
|
private final LifeCollectMapper lifeCollectMapper;
|
|
private final LifeCollectMapper lifeCollectMapper;
|
|
|
|
|
+ private final LifeFansMapper lifeFansMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
public static final List<String> SERVICES_LIST = ImmutableList.of(
|
|
public static final List<String> SERVICES_LIST = ImmutableList.of(
|
|
@@ -248,11 +249,40 @@ public class CommonRatingServiceImpl extends ServiceImpl<CommonRatingMapper, Com
|
|
|
}
|
|
}
|
|
|
CommonRatingVo commonRatingVo = new CommonRatingVo();
|
|
CommonRatingVo commonRatingVo = new CommonRatingVo();
|
|
|
BeanUtils.copyProperties(commonRating, commonRatingVo);
|
|
BeanUtils.copyProperties(commonRating, commonRatingVo);
|
|
|
- LifeUser lifeUser = lifeUserMapper.selectById(Integer.parseInt(commonRating.getUserId().toString()));
|
|
|
|
|
- // 设置评论用户信息
|
|
|
|
|
- commonRatingVo.setUserImage(lifeUser.getUserImage());
|
|
|
|
|
- commonRatingVo.setUserName(lifeUser.getUserName());
|
|
|
|
|
|
|
+ LifeUser ratingUser = lifeUserMapper.selectById(Integer.parseInt(commonRating.getUserId().toString()));
|
|
|
|
|
+ if (ratingUser == null){
|
|
|
|
|
+ throw new IllegalArgumentException("评价用户不存在");
|
|
|
|
|
+ }
|
|
|
|
|
+ // 设置评价用户信息
|
|
|
|
|
+ commonRatingVo.setUserImage(ratingUser.getUserImage());
|
|
|
|
|
+ commonRatingVo.setUserName(ratingUser.getUserName());
|
|
|
|
|
+ commonRatingVo.setPhone(ratingUser.getUserPhone());
|
|
|
// 查询当前用户点赞列表(仅评价)
|
|
// 查询当前用户点赞列表(仅评价)
|
|
|
|
|
+ setIsLike(ratingId, userId, commonRatingVo);
|
|
|
|
|
+ LifeUser loginUser = lifeUserMapper.selectById(userId);
|
|
|
|
|
+ if (loginUser == null){
|
|
|
|
|
+ throw new IllegalArgumentException("登录用户不存在");
|
|
|
|
|
+ }
|
|
|
|
|
+ // 查询当前用户关注列表
|
|
|
|
|
+ List<LifeFans> lifeFans = lifeFansMapper.selectList(new QueryWrapper<LifeFans>().lambda()
|
|
|
|
|
+ .eq(LifeFans::getFollowedId, "user_".concat(ratingUser.getUserPhone()))
|
|
|
|
|
+ .eq(LifeFans::getFansId, "user_".concat(loginUser.getUserPhone()))
|
|
|
|
|
+ .eq(LifeFans::getFansType, "1")
|
|
|
|
|
+ .eq(LifeFans::getDeleteFlag, 0));
|
|
|
|
|
+ // 设置是否关注
|
|
|
|
|
+ commonRatingVo.setIsFollow(lifeFans.size() > 0 ? 1 : 0);
|
|
|
|
|
+ // 根据业务类型处理
|
|
|
|
|
+ extractedWithBusinessType(ratingId, userId, commonRatingVo);
|
|
|
|
|
+ return commonRatingVo;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 设置是否点赞
|
|
|
|
|
+ * @param ratingId 评价id
|
|
|
|
|
+ * @param userId 用户id
|
|
|
|
|
+ * @param commonRatingVo 评价vo
|
|
|
|
|
+ */
|
|
|
|
|
+ private void setIsLike(Integer ratingId, Long userId, CommonRatingVo commonRatingVo) {
|
|
|
List<LifeLikeRecord> lifeLikeRecords = lifeLikeRecordMapper.selectList(new QueryWrapper<LifeLikeRecord>().lambda()
|
|
List<LifeLikeRecord> lifeLikeRecords = lifeLikeRecordMapper.selectList(new QueryWrapper<LifeLikeRecord>().lambda()
|
|
|
.eq(LifeLikeRecord::getDianzanId, userId)
|
|
.eq(LifeLikeRecord::getDianzanId, userId)
|
|
|
.eq(LifeLikeRecord::getHuifuId, ratingId)
|
|
.eq(LifeLikeRecord::getHuifuId, ratingId)
|
|
@@ -263,10 +293,21 @@ public class CommonRatingServiceImpl extends ServiceImpl<CommonRatingMapper, Com
|
|
|
} else {
|
|
} else {
|
|
|
commonRatingVo.setIsLike(0);
|
|
commonRatingVo.setIsLike(0);
|
|
|
}
|
|
}
|
|
|
- // 根据业务类型处理
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 根据业务类型处理
|
|
|
|
|
+ * @param ratingId 评价id
|
|
|
|
|
+ * @param userId 用户id
|
|
|
|
|
+ * @param commonRatingVo 评价vo
|
|
|
|
|
+ */
|
|
|
|
|
+ private void extractedWithBusinessType(Integer ratingId, Long userId, CommonRatingVo commonRatingVo) {
|
|
|
if(commonRatingVo.getBusinessType().equals(RatingBusinessTypeEnum.STORE_RATING.getBusinessType())){
|
|
if(commonRatingVo.getBusinessType().equals(RatingBusinessTypeEnum.STORE_RATING.getBusinessType())){
|
|
|
// 1店铺信息
|
|
// 1店铺信息
|
|
|
StoreInfo storeInfo = storeInfoMapper.selectById(commonRatingVo.getBusinessId());
|
|
StoreInfo storeInfo = storeInfoMapper.selectById(commonRatingVo.getBusinessId());
|
|
|
|
|
+ if(storeInfo == null){
|
|
|
|
|
+ throw new IllegalArgumentException("店铺不存在");
|
|
|
|
|
+ }
|
|
|
if( null != storeInfo) {
|
|
if( null != storeInfo) {
|
|
|
commonRatingVo.setStoreName(storeInfo.getStoreName());
|
|
commonRatingVo.setStoreName(storeInfo.getStoreName());
|
|
|
commonRatingVo.setStoreEvaluate(storeInfo.getStoreEvaluate());
|
|
commonRatingVo.setStoreEvaluate(storeInfo.getStoreEvaluate());
|
|
@@ -315,7 +356,6 @@ public class CommonRatingServiceImpl extends ServiceImpl<CommonRatingMapper, Com
|
|
|
commonRatingVo.setCommentCount(count.get());
|
|
commonRatingVo.setCommentCount(count.get());
|
|
|
commonRatingVo.setChildCommonComments(commonCommentVos);
|
|
commonRatingVo.setChildCommonComments(commonCommentVos);
|
|
|
}
|
|
}
|
|
|
- return commonRatingVo;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private List<CommonCommentVo> getChildCommentsRecursively(Long id, Long userId) {
|
|
private List<CommonCommentVo> getChildCommentsRecursively(Long id, Long userId) {
|