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

点赞评论消息通知 fix

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