Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in
Toggle navigation
T
tanpu-community
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
探普后端
tanpu-community
Commits
1b40a40d
Commit
1b40a40d
authored
Feb 24, 2022
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
加入话题站内信
parent
7756d0d9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
3 deletions
+16
-3
NotificationTypeEnum.java
...a/com/tanpu/community/api/enums/NotificationTypeEnum.java
+2
-0
NotificationManager.java
...java/com/tanpu/community/manager/NotificationManager.java
+9
-3
ConvertUtil.java
...e/src/main/java/com/tanpu/community/util/ConvertUtil.java
+5
-0
No files found.
community-api/src/main/java/com/tanpu/community/api/enums/NotificationTypeEnum.java
View file @
1b40a40d
...
...
@@ -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
;
...
...
community-service/src/main/java/com/tanpu/community/manager/NotificationManager.java
View file @
1b40a40d
...
...
@@ -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
());
...
...
community-service/src/main/java/com/tanpu/community/util/ConvertUtil.java
View file @
1b40a40d
...
...
@@ -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
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment