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

回复姓名修复

parent db65dc1e
......@@ -21,6 +21,7 @@ import com.tanpu.community.dao.entity.community.ThemeEntity;
import com.tanpu.community.feign.fatools.FeignClientForFatools;
import com.tanpu.community.service.CollectionService;
import com.tanpu.community.service.CommentService;
import com.tanpu.community.service.FeignService;
import com.tanpu.community.service.NotificationService;
import com.tanpu.community.service.ReportLogService;
import com.tanpu.community.service.ThemeService;
......@@ -65,6 +66,8 @@ public class CommentManager {
private ThemeService themeService;
@Resource
private TopicService topicService;
@Resource
private FeignService feignService;
// 评论(对主题)
// 发表评论(对主题)
......@@ -136,9 +139,9 @@ public class CommentManager {
buildUserInfo(commentQo);
// 是否点赞及点赞数
String commentId = commentQo.getCommentId();
Integer likeCount = collectionService.getCountByTypeAndId(commentId, CollectionTypeEnum.LIKE_COMMENT);
commentQo.setLikeCount(likeCount);
commentQo.setHasLiked(likeCommentList.contains(commentId));
Integer countByTypeAndId = collectionService.getCountByTypeAndId(commentId, CollectionTypeEnum.LIKE_COMMENT);
commentQo.setLikeCount(countByTypeAndId);
// 是否管理员
if (managerId.contains(commentQo.getAuthorId())) {
commentQo.setManager(true);
......@@ -170,10 +173,9 @@ public class CommentManager {
}
// 回复用户名
if (StringUtils.isNotBlank(commentQo.getReplyUserId())) {
UserInfoResp replyUser = redisCache.getObject(StringUtils.joinWith("_", CACHE_FEIGN_USER_INFO, authorId),
60, () -> this.getUserInfo(commentQo.getReplyUserId()), UserInfoResp.class);
if (replyUser != null) {
commentQo.setReplyUserName(replyUser.getNickName());
UserInfoResp userResp = feignService.getUserInfoById(commentQo.getReplyUserId());
if (userResp != null) {
commentQo.setReplyUserName(userResp.getNickName());
}
}
......
......@@ -20,6 +20,7 @@ import com.tanpu.community.feign.product.FeignForPublicFund;
import com.tanpu.community.feign.tanpuroom.FeignClientForTanpuroom;
import com.tanpu.community.feign.zhibo.FeignClientForZhibo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
......@@ -63,11 +64,12 @@ public class FeignService {
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("内部接口调用失败");
}
return userInfoNewCommonResp.getData();
return userList.get(0);
}
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