Commit 0b6aa523 authored by 刘基明's avatar 刘基明

同步评论转发,评论点赞消息通知

parent 427a25a5
......@@ -4,6 +4,7 @@ import com.tanpu.biz.common.enums.community.CollectionTypeEnum;
import com.tanpu.biz.common.enums.community.CommentTypeEnum;
import com.tanpu.biz.common.enums.community.ReportTypeEnum;
import com.tanpu.common.api.CommonResp;
import com.tanpu.common.constant.ErrorCodeConstant;
import com.tanpu.common.exception.BizException;
import com.tanpu.community.api.beans.qo.CommentQo;
import com.tanpu.community.api.beans.req.comment.CreateCommentReq;
......@@ -89,6 +90,9 @@ public class CommentManager {
buildUserInfo(commentQo);
// 消息通知
ThemeEntity themeEntity = themeService.queryByThemeId(req.getThemeId());
if (themeEntity==null){
throw new BizException(ErrorCodeConstant.UNREACHABLE);
}
notificationService.insert(userId,themeEntity.getAuthorId(), NotificationTypeEnum.COMMENT,commentEntity.getCommentId(),req.getComment());
notificationService.putNotifyCache(themeEntity.getAuthorId(),userId,NotificationTypeEnum.COMMENT);
......
......@@ -105,6 +105,16 @@ public class NotificationManager {
CommentEntity commentEntity = commentService.queryByCommentId(themeNotifyQo.getFormerThemeId());
themeNotifyQo.setFormerThemeId(commentEntity.getThemeId());
// todo 评论原贴
themeNotifyQo.setContent(commentEntity.getContent());
ThemeEntity themeEntity = themeService.queryByThemeId(commentEntity.getThemeId());
themeNotifyQo.setFormerTopicId(themeEntity.getTopicId());
// themeNotifyQo.setFormerUserName(themeEntity.getAuthorId());
themeNotifyQo.setFormerTopicTitle("");
themeNotifyQo.setFormerUserName(currentUser.getNickName());
List<ThemeContentQo> themeContentQos = JsonUtil.toBean(themeEntity.getContent(), new TypeReference<List<ThemeContentQo>>() {
});
themeNotifyQo.setFormerContent(themeContentQos.get(0).getValue());
}
ThemeEntity former = themeService.queryByThemeId(themeNotifyQo.getFormerThemeId());
......
......@@ -410,8 +410,11 @@ public class ThemeManager {
themeService.insertTheme(themeEntity);
// 消息通知
ThemeEntity formerTheme = themeService.queryByThemeId(req.getFormerThemeId());
if (formerTheme!=null){
notificationService.insertForward(userId, formerTheme.getAuthorId(), formerTheme.getThemeId(), req.getTopicId(), req.getContent().get(0).getValue(), themeEntity.getThemeId());
notificationService.putNotifyCache(formerTheme.getAuthorId(), userId, NotificationTypeEnum.FORWARD);
}
} else {
// 修改
......@@ -423,10 +426,13 @@ public class ThemeManager {
if (req.getSyncComment() == BizConstant.SyncCommentType.SYNC_COMMENT) {
String commentId = commentService.forwardSyncComment(req, userId);
ThemeEntity formerTheme = themeService.queryByThemeId(req.getFormerThemeId());
if (formerTheme!=null){
notificationService.insert(userId, formerTheme.getAuthorId(), NotificationTypeEnum.COMMENT, commentId, req.getContent().get(0).getValue());
notificationService.putNotifyCache(formerTheme.getAuthorId(), userId, NotificationTypeEnum.COMMENT);
}
}
try {
esService.insertOrUpdateTheme(ConvertUtil.convert(themeEntity));
......
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