Commit 1b40a40d authored by 刘基明's avatar 刘基明

加入话题站内信

parent 7756d0d9
......@@ -14,6 +14,8 @@ public enum NotificationTypeEnum {
FOLLOW(4,"关注"),
COMMENT_LIKE(5,"点赞评论"),
COMMENT_REPLY(6,"回复评论"),
TOPIC_IN(6,"加入话题"),
TOPIC_OUT(7,"退出话题"),
ALL(0,"全部");
private Integer code;
......
......@@ -36,6 +36,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.text.MessageFormat;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Set;
......@@ -96,7 +97,7 @@ public class NotificationManager {
// 评论根据commentEntity找到ThemeId
if (NotificationTypeEnum.COMMENT.getCode().equals(themeNotifyQo.getMessageType()) ||
NotificationTypeEnum.COMMENT_LIKE.getCode().equals(themeNotifyQo.getMessageType())||
NotificationTypeEnum.COMMENT_LIKE.getCode().equals(themeNotifyQo.getMessageType()) ||
NotificationTypeEnum.COMMENT_REPLY.getCode().equals(themeNotifyQo.getMessageType())) {
// 评论类型将commentId替换为themeId
CommentEntity commentEntity = commentService.queryByCommentId(themeNotifyQo.getCommentId());
......@@ -107,7 +108,6 @@ public class NotificationManager {
themeNotifyQo.setContent(commentEntity.getContent());
}
}
}
// 封装引用对象
......@@ -136,8 +136,14 @@ public class NotificationManager {
if (StringUtils.isNotBlank(themeNotifyQo.getTopicId())) {
themeNotifyQo.setTopicTitle(topicService.queryTitleById(themeNotifyQo.getTopicId()));
}
// 加入退出话题
if (NotificationTypeEnum.TOPIC_IN.getCode().equals(themeNotifyQo.getMessageType()) ||
NotificationTypeEnum.TOPIC_OUT.getCode().equals(themeNotifyQo.getMessageType())) {
themeNotifyQo.setContent(MessageFormat.format(themeNotifyQo.getContent(), themeNotifyQo.getTopicTitle()));
}
// 评论的评论
if (NotificationTypeEnum.COMMENT_REPLY.getCode().equals(themeNotifyQo.getMessageType())){
if (NotificationTypeEnum.COMMENT_REPLY.getCode().equals(themeNotifyQo.getMessageType())) {
CommentEntity commentEntity = commentService.queryByCommentId(themeNotifyQo.getReplyCommentId());
if (commentEntity != null) {
themeNotifyQo.setFormerContent(commentEntity.getContent());
......
......@@ -306,6 +306,11 @@ public class ConvertUtil {
) {
themeNotifyQo.setCommentId(entity.getTargetId());
}
// 主题加入退出
if (NotificationTypeEnum.TOPIC_IN.getCode().equals(entity.getMessageType()) ||
NotificationTypeEnum.TOPIC_OUT.getCode().equals(entity.getMessageType())) {
themeNotifyQo.setTopicId(entity.getTargetId());
}
// 转发有话题信息
if (entity.getMessageType().equals(NotificationTypeEnum.FORWARD.getCode())) {
themeNotifyQo.setFormerThemeId(entity.getTargetId());
......
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