feat: comment user badges

main
wangqing 11 months ago
parent 9e0ad0f560
commit 5dc30b41cf

@ -197,6 +197,14 @@ public class CommentController extends BaseController {
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));
}
BeanUtils.copyProperties(comment,commentResp);
if(comment.getCommentCount()>0){
@ -227,12 +235,21 @@ public class CommentController extends BaseController {
UserInfo commentUserInfo = userInfoService.findById(comment.getUserId());
comment.setNickName(commentUserInfo.getNickName());
comment.setAvatar(Constants.RESOURCE_PREFIX+commentUserInfo.getAvatar());
if(StringUtils.isNotEmpty(comment.getReplyToUserId())){
UserInfo replyToUserInfo = userInfoService.findById(comment.getReplyToUserId());
comment.setReplyToNickname(replyToUserInfo.getNickName());
}
CommentResp commentResp = new CommentResp();
BeanUtils.copyProperties(comment,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(comment.getCommentCount()>0){
Comment topComment = commentService.findByParentId(comment.get_id(),1,1).getContent().get(0);

@ -2,11 +2,13 @@ package com.luoo.comment.pojo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
@Data
public class CommentResp implements Serializable {
@ -60,4 +62,7 @@ public class CommentResp implements Serializable {
private String replyToNickname;
private Comment topChildrenComment;
@ApiModelProperty(value = "用户标识,贡献者:1 ")
private List<Integer> badgeList;
}

Loading…
Cancel
Save