Commit b8030743 authored by 刘基明's avatar 刘基明

点赞评论消息通知 fix

parent 7015eb81
...@@ -126,20 +126,25 @@ public class NotificationManager { ...@@ -126,20 +126,25 @@ public class NotificationManager {
if (NotificationTypeEnum.COMMENT_LIKE.getCode().equals(themeNotifyQo.getMessageType())) { if (NotificationTypeEnum.COMMENT_LIKE.getCode().equals(themeNotifyQo.getMessageType())) {
CommentEntity commentEntity = commentService.queryByCommentId(themeNotifyQo.getCommentId()); CommentEntity commentEntity = commentService.queryByCommentId(themeNotifyQo.getCommentId());
themeNotifyQo.setFormerThemeId(commentEntity.getThemeId()); if (commentEntity!=null){
themeNotifyQo.setContent(commentEntity.getContent()); themeNotifyQo.setContent(null);
ThemeEntity themeEntity = themeService.queryByThemeId(commentEntity.getThemeId()); }else {
if (themeEntity != null) { themeNotifyQo.setFormerThemeId(commentEntity.getThemeId());
themeNotifyQo.setFormerUserName(getUserInfo(themeEntity.getAuthorId()).getNickName()); themeNotifyQo.setContent(commentEntity.getContent());
themeNotifyQo.setFormerTopicId(themeEntity.getTopicId()); ThemeEntity themeEntity = themeService.queryByThemeId(commentEntity.getThemeId());
if (ThemeTypeEnum.DISCUSSION.getCode().equals(themeEntity.getThemeType()) || ThemeTypeEnum.FORWARD.getCode().equals(themeEntity.getThemeType())) { if (themeEntity != null) {
List<ThemeContentQo> themeContentQos = JsonUtil.toBean(themeEntity.getContent(), new TypeReference<List<ThemeContentQo>>() { themeNotifyQo.setFormerUserName(getUserInfo(themeEntity.getAuthorId()).getNickName());
}); themeNotifyQo.setFormerTopicId(themeEntity.getTopicId());
themeNotifyQo.setFormerContent(themeContentQos.get(0).getValue()); if (ThemeTypeEnum.DISCUSSION.getCode().equals(themeEntity.getThemeType()) || ThemeTypeEnum.FORWARD.getCode().equals(themeEntity.getThemeType())) {
} else if (ThemeTypeEnum.LONG_TEXT.getCode().equals(themeEntity.getThemeType())) { List<ThemeContentQo> themeContentQos = JsonUtil.toBean(themeEntity.getContent(), new TypeReference<List<ThemeContentQo>>() {
themeNotifyQo.setFormerContent(themeEntity.getTitle()); });
themeNotifyQo.setFormerContent(themeContentQos.get(0).getValue());
} else if (ThemeTypeEnum.LONG_TEXT.getCode().equals(themeEntity.getThemeType())) {
themeNotifyQo.setFormerContent(themeEntity.getTitle());
}
} }
} }
} }
// 外部话题 // 外部话题
if (StringUtils.isNotBlank(themeNotifyQo.getTopicId())) { if (StringUtils.isNotBlank(themeNotifyQo.getTopicId())) {
......
...@@ -226,10 +226,12 @@ public class NotificationService { ...@@ -226,10 +226,12 @@ public class NotificationService {
} }
// 删除评论及缓存 // 删除评论及缓存,并更新
public void deleteCommentNotify(String notifyUserId, String operatorId, String commentId, LocalDateTime commentTime) { public void deleteCommentNotify(String notifyUserId, String operatorId, String commentId, LocalDateTime commentTime) {
// 物理删除 // 物理删除
NotificationEntity commentNotify = notificationMapper.selectOne(new LambdaQueryWrapper<NotificationEntity>().eq(NotificationEntity::getTargetId, commentId)); NotificationEntity commentNotify = notificationMapper.selectOne(new LambdaQueryWrapper<NotificationEntity>()
.eq(NotificationEntity::getTargetId, commentId)
.eq(NotificationEntity::getMessageType, NotificationTypeEnum.COMMENT.getType()));
NotificationEntity last = notificationMapper.selectOne(new LambdaQueryWrapper<NotificationEntity>().eq(NotificationEntity::getNotifiedUserId, notifyUserId) NotificationEntity last = notificationMapper.selectOne(new LambdaQueryWrapper<NotificationEntity>().eq(NotificationEntity::getNotifiedUserId, notifyUserId)
.orderByDesc(NotificationEntity::getUpdateTime) .orderByDesc(NotificationEntity::getUpdateTime)
.last("limit 1")); .last("limit 1"));
......
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