Commit 988f0de7 authored by 刘基明's avatar 刘基明

回复姓名修复

parent db65dc1e
...@@ -21,6 +21,7 @@ import com.tanpu.community.dao.entity.community.ThemeEntity; ...@@ -21,6 +21,7 @@ import com.tanpu.community.dao.entity.community.ThemeEntity;
import com.tanpu.community.feign.fatools.FeignClientForFatools; import com.tanpu.community.feign.fatools.FeignClientForFatools;
import com.tanpu.community.service.CollectionService; import com.tanpu.community.service.CollectionService;
import com.tanpu.community.service.CommentService; import com.tanpu.community.service.CommentService;
import com.tanpu.community.service.FeignService;
import com.tanpu.community.service.NotificationService; import com.tanpu.community.service.NotificationService;
import com.tanpu.community.service.ReportLogService; import com.tanpu.community.service.ReportLogService;
import com.tanpu.community.service.ThemeService; import com.tanpu.community.service.ThemeService;
...@@ -65,6 +66,8 @@ public class CommentManager { ...@@ -65,6 +66,8 @@ public class CommentManager {
private ThemeService themeService; private ThemeService themeService;
@Resource @Resource
private TopicService topicService; private TopicService topicService;
@Resource
private FeignService feignService;
// 评论(对主题) // 评论(对主题)
// 发表评论(对主题) // 发表评论(对主题)
...@@ -136,9 +139,9 @@ public class CommentManager { ...@@ -136,9 +139,9 @@ public class CommentManager {
buildUserInfo(commentQo); buildUserInfo(commentQo);
// 是否点赞及点赞数 // 是否点赞及点赞数
String commentId = commentQo.getCommentId(); String commentId = commentQo.getCommentId();
Integer likeCount = collectionService.getCountByTypeAndId(commentId, CollectionTypeEnum.LIKE_COMMENT);
commentQo.setLikeCount(likeCount);
commentQo.setHasLiked(likeCommentList.contains(commentId)); commentQo.setHasLiked(likeCommentList.contains(commentId));
Integer countByTypeAndId = collectionService.getCountByTypeAndId(commentId, CollectionTypeEnum.LIKE_COMMENT);
commentQo.setLikeCount(countByTypeAndId);
// 是否管理员 // 是否管理员
if (managerId.contains(commentQo.getAuthorId())) { if (managerId.contains(commentQo.getAuthorId())) {
commentQo.setManager(true); commentQo.setManager(true);
...@@ -170,10 +173,9 @@ public class CommentManager { ...@@ -170,10 +173,9 @@ public class CommentManager {
} }
// 回复用户名 // 回复用户名
if (StringUtils.isNotBlank(commentQo.getReplyUserId())) { if (StringUtils.isNotBlank(commentQo.getReplyUserId())) {
UserInfoResp replyUser = redisCache.getObject(StringUtils.joinWith("_", CACHE_FEIGN_USER_INFO, authorId), UserInfoResp userResp = feignService.getUserInfoById(commentQo.getReplyUserId());
60, () -> this.getUserInfo(commentQo.getReplyUserId()), UserInfoResp.class); if (userResp != null) {
if (replyUser != null) { commentQo.setReplyUserName(userResp.getNickName());
commentQo.setReplyUserName(replyUser.getNickName());
} }
} }
......
...@@ -20,6 +20,7 @@ import com.tanpu.community.feign.product.FeignForPublicFund; ...@@ -20,6 +20,7 @@ import com.tanpu.community.feign.product.FeignForPublicFund;
import com.tanpu.community.feign.tanpuroom.FeignClientForTanpuroom; import com.tanpu.community.feign.tanpuroom.FeignClientForTanpuroom;
import com.tanpu.community.feign.zhibo.FeignClientForZhibo; import com.tanpu.community.feign.zhibo.FeignClientForZhibo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -63,11 +64,12 @@ public class FeignService { ...@@ -63,11 +64,12 @@ public class FeignService {
public UserInfoResp getUserInfoById(String userId) { public UserInfoResp getUserInfoById(String userId) {
CommonResp<UserInfoResp> userInfoNewCommonResp = feignClientForFatools.queryUserInfoNew(userId);
if (userInfoNewCommonResp.isNotSuccess()) { List<UserInfoResp> userList = getUserList(Arrays.asList(userId));
if (CollectionUtils.isEmpty(userList)) {
throw new BizException("内部接口调用失败"); throw new BizException("内部接口调用失败");
} }
return userInfoNewCommonResp.getData(); return userList.get(0);
} }
public List<ShortVideoBaseInfoResp> batchGetShortVideoBaseInfo(List<String> sourceIds) { public List<ShortVideoBaseInfoResp> batchGetShortVideoBaseInfo(List<String> sourceIds) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment