fix commentList avatar errors

main
wangqing 8 months ago
parent 942f2a3296
commit 89a53aa006

@ -194,21 +194,27 @@ public class CommentController extends BaseController {
comment.setHaveThumbup(isExists); //
UserInfo commentUserInfo = userInfoService.findById(comment.getUserId());
comment.setNickName(commentUserInfo.getNickName());
comment.setAvatar(getAvatar(commentUserInfo));
if(StringUtils.isNotEmpty(comment.getReplyToUserId())){
UserInfo replyToUserInfo = userInfoService.findById(comment.getReplyToUserId());
comment.setReplyToNickname(replyToUserInfo.getNickName());
if(null != commentUserInfo) {
comment.setNickName(commentUserInfo.getNickName());
comment.setAvatar(getAvatar(commentUserInfo));
if(StringUtils.isNotEmpty(comment.getReplyToUserId())){
UserInfo replyToUserInfo = userInfoService.findById(comment.getReplyToUserId());
comment.setReplyToNickname(replyToUserInfo.getNickName());
}
}
CommentResp commentResp = new CommentResp();
if (StringUtils.isNotEmpty(commentUserInfo.getBadges())){
Set<Integer> badgeSet = new HashSet<>();
Arrays.stream(commentUserInfo.getBadges().split(",")).forEach(b->{
int code=Integer.valueOf(b.substring(0, 1));
badgeSet.add(code);
});
commentResp.setBadgeList(new ArrayList<>(badgeSet));
if (null!= commentUserInfo) {
if (StringUtils.isNotEmpty(commentUserInfo.getBadges())){
Set<Integer> badgeSet = new HashSet<>();
Arrays.stream(commentUserInfo.getBadges().split(",")).forEach(b->{
int code=Integer.valueOf(b.substring(0, 1));
badgeSet.add(code);
});
commentResp.setBadgeList(new ArrayList<>(badgeSet));
}
}
BeanUtils.copyProperties(comment,commentResp);
if(comment.getCommentCount()>0){
@ -254,8 +260,8 @@ public class CommentController extends BaseController {
CommentResp commentResp = new CommentResp();
BeanUtils.copyProperties(comment,commentResp);
if (null != commentUserInfo) {
comment.setNickName(commentUserInfo.getNickName());
comment.setAvatar(getAvatar(commentUserInfo));
commentResp.setNickName(commentUserInfo.getNickName());
commentResp.setAvatar(getAvatar(commentUserInfo));
if (StringUtils.isNotEmpty(commentUserInfo.getBadges())){
Set<Integer> badgeSet = new HashSet<>();
Arrays.stream(commentUserInfo.getBadges().split(",")).forEach(b->{

Loading…
Cancel
Save