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
0b6aa523
Commit
0b6aa523
authored
Aug 30, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
同步评论转发,评论点赞消息通知
parent
427a25a5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
4 deletions
+24
-4
CommentManager.java
...main/java/com/tanpu/community/manager/CommentManager.java
+4
-0
NotificationManager.java
...java/com/tanpu/community/manager/NotificationManager.java
+10
-0
ThemeManager.java
...c/main/java/com/tanpu/community/manager/ThemeManager.java
+10
-4
No files found.
community-service/src/main/java/com/tanpu/community/manager/CommentManager.java
View file @
0b6aa523
...
...
@@ -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
);
...
...
community-service/src/main/java/com/tanpu/community/manager/NotificationManager.java
View file @
0b6aa523
...
...
@@ -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
());
...
...
community-service/src/main/java/com/tanpu/community/manager/ThemeManager.java
View file @
0b6aa523
...
...
@@ -410,8 +410,11 @@ public class ThemeManager {
themeService
.
insertTheme
(
themeEntity
);
// 消息通知
ThemeEntity
formerTheme
=
themeService
.
queryByThemeId
(
req
.
getFormerThemeId
());
notificationService
.
insertForward
(
userId
,
formerTheme
.
getAuthorId
(),
formerTheme
.
getThemeId
(),
req
.
getTopicId
(),
req
.
getContent
().
get
(
0
).
getValue
(),
themeEntity
.
getThemeId
());
notificationService
.
putNotifyCache
(
formerTheme
.
getAuthorId
(),
userId
,
NotificationTypeEnum
.
FORWARD
);
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,8 +426,11 @@ public class ThemeManager {
if
(
req
.
getSyncComment
()
==
BizConstant
.
SyncCommentType
.
SYNC_COMMENT
)
{
String
commentId
=
commentService
.
forwardSyncComment
(
req
,
userId
);
ThemeEntity
formerTheme
=
themeService
.
queryByThemeId
(
req
.
getFormerThemeId
());
notificationService
.
insert
(
userId
,
formerTheme
.
getAuthorId
(),
NotificationTypeEnum
.
COMMENT
,
commentId
,
req
.
getContent
().
get
(
0
).
getValue
());
notificationService
.
putNotifyCache
(
formerTheme
.
getAuthorId
(),
userId
,
NotificationTypeEnum
.
COMMENT
);
if
(
formerTheme
!=
null
){
notificationService
.
insert
(
userId
,
formerTheme
.
getAuthorId
(),
NotificationTypeEnum
.
COMMENT
,
commentId
,
req
.
getContent
().
get
(
0
).
getValue
());
notificationService
.
putNotifyCache
(
formerTheme
.
getAuthorId
(),
userId
,
NotificationTypeEnum
.
COMMENT
);
}
}
...
...
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