fix error with user logoff

main
wangqing 5 months ago
parent 0cfe49eb3e
commit 8f953a9b84

@ -194,16 +194,20 @@ public class CommentController extends BaseController {
comment.setHaveThumbup(isExists); // comment.setHaveThumbup(isExists); //
UserInfo commentUserInfo = userInfoService.findById(comment.getUserId()); UserInfo commentUserInfo = userInfoService.findById(comment.getUserId());
CommentResp commentResp = new CommentResp();
BeanUtils.copyProperties(comment,commentResp);
commentResp.setNickName("已注销");
commentResp.setAvatar(Constants.RESOURCE_PREFIX + Constants.DEFAULT_USER_THUMBNAIL);
if(null != commentUserInfo) { if(null != commentUserInfo) {
comment.setNickName(commentUserInfo.getNickName()); commentResp.setNickName(commentUserInfo.getNickName());
comment.setAvatar(getAvatar(commentUserInfo)); commentResp.setAvatar(getAvatar(commentUserInfo));
if(StringUtils.isNotEmpty(comment.getReplyToUserId())){ if(StringUtils.isNotEmpty(comment.getReplyToUserId())){
UserInfo replyToUserInfo = userInfoService.findById(comment.getReplyToUserId()); UserInfo replyToUserInfo = userInfoService.findById(comment.getReplyToUserId());
comment.setReplyToNickname(replyToUserInfo.getNickName()); commentResp.setReplyToNickname(replyToUserInfo.getNickName());
} }
} }
CommentResp commentResp = new CommentResp();
if (null!= commentUserInfo) { if (null!= commentUserInfo) {
if (StringUtils.isNotEmpty(commentUserInfo.getBadges())){ if (StringUtils.isNotEmpty(commentUserInfo.getBadges())){
Set<Integer> badgeSet = new HashSet<>(); Set<Integer> badgeSet = new HashSet<>();
@ -215,13 +219,17 @@ public class CommentController extends BaseController {
} }
} }
BeanUtils.copyProperties(comment,commentResp);
if(comment.getCommentCount()>0){ if(comment.getCommentCount()>0){
Comment topComment = commentService.findByParentId(comment.get_id(),1,1).getContent().get(0); Comment topComment = commentService.findByParentId(comment.get_id(),1,1).getContent().get(0);
UserInfo topCommentUserInfo = userInfoService.findById(topComment.getUserId()); UserInfo topCommentUserInfo = userInfoService.findById(topComment.getUserId());
topComment.setNickName(topCommentUserInfo.getNickName()); topComment.setNickName("已注销");
topComment.setAvatar(getAvatar(topCommentUserInfo)); topComment.setAvatar(Constants.RESOURCE_PREFIX + Constants.DEFAULT_USER_THUMBNAIL);
if(null != topCommentUserInfo) {
topComment.setNickName(topCommentUserInfo.getNickName());
topComment.setAvatar(getAvatar(topCommentUserInfo));
}
if(StringUtils.isNotEmpty(topComment.getReplyToUserId())){ if(StringUtils.isNotEmpty(topComment.getReplyToUserId())){
UserInfo topReplyUserInfo = userInfoService.findById(topComment.getReplyToUserId()); UserInfo topReplyUserInfo = userInfoService.findById(topComment.getReplyToUserId());
topComment.setReplyToNickname(topReplyUserInfo.getNickName()); topComment.setReplyToNickname(topReplyUserInfo.getNickName());
@ -259,6 +267,8 @@ public class CommentController extends BaseController {
} }
CommentResp commentResp = new CommentResp(); CommentResp commentResp = new CommentResp();
BeanUtils.copyProperties(comment,commentResp); BeanUtils.copyProperties(comment,commentResp);
commentResp.setNickName("已注销");
commentResp.setAvatar(Constants.RESOURCE_PREFIX + Constants.DEFAULT_USER_THUMBNAIL);
if (null != commentUserInfo) { if (null != commentUserInfo) {
commentResp.setNickName(commentUserInfo.getNickName()); commentResp.setNickName(commentUserInfo.getNickName());
commentResp.setAvatar(getAvatar(commentUserInfo)); commentResp.setAvatar(getAvatar(commentUserInfo));
@ -276,6 +286,8 @@ public class CommentController extends BaseController {
Comment topComment = commentService.findByParentId(comment.get_id(),1,1).getContent().get(0); Comment topComment = commentService.findByParentId(comment.get_id(),1,1).getContent().get(0);
UserInfo topCommentUserInfo = userInfoService.findById(topComment.getUserId()); UserInfo topCommentUserInfo = userInfoService.findById(topComment.getUserId());
topComment.setNickName("已注销");
topComment.setAvatar(Constants.RESOURCE_PREFIX + Constants.DEFAULT_USER_THUMBNAIL);
if(null != topCommentUserInfo) { if(null != topCommentUserInfo) {
topComment.setNickName(topCommentUserInfo.getNickName()); topComment.setNickName(topCommentUserInfo.getNickName());
topComment.setAvatar(getAvatar(topCommentUserInfo)); topComment.setAvatar(getAvatar(topCommentUserInfo));

@ -27,6 +27,9 @@ public class CommentMapper {
if (null != userInfoDTO) { if (null != userInfoDTO) {
comment.setNickName(userInfoDTO.getNickName()); comment.setNickName(userInfoDTO.getNickName());
comment.setAvatar(Constants.RESOURCE_PREFIX + userInfoDTO.getAvatar()); comment.setAvatar(Constants.RESOURCE_PREFIX + userInfoDTO.getAvatar());
} else {
comment.setNickName("已注销");
comment.setAvatar(Constants.RESOURCE_PREFIX + Constants.DEFAULT_USER_THUMBNAIL);
} }
return comment; return comment;

@ -32,7 +32,7 @@ public class TagS3Service {
public static final String DOT = "."; public static final String DOT = ".";
public static final String TAG_RESOURCE_PREFIX = "http://cdn1.indie.cn:19000/indie/"; public static final String TAG_RESOURCE_PREFIX = "https://cdn2.indie.cn/indie/";
public static final String TAG_KEY_PREFIX = "tag/"; public static final String TAG_KEY_PREFIX = "tag/";
public static final String BUCKET = "indie"; public static final String BUCKET = "indie";
public static final String TEMP_KEY_PREFIX = "temp/"; public static final String TEMP_KEY_PREFIX = "temp/";

Loading…
Cancel
Save