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
813c73e8
Commit
813c73e8
authored
Aug 31, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
点赞评论消息通知 fix
parent
ac15232a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
50 deletions
+17
-50
NotificationManager.java
...java/com/tanpu/community/manager/NotificationManager.java
+9
-31
ConvertUtil.java
...e/src/main/java/com/tanpu/community/util/ConvertUtil.java
+8
-19
No files found.
community-service/src/main/java/com/tanpu/community/manager/NotificationManager.java
View file @
813c73e8
...
...
@@ -93,16 +93,18 @@ public class NotificationManager {
themeNotifyQo
.
setUserInvestorType
(
userInfo
.
getUserInvestorType
());
themeNotifyQo
.
setBelongUserOrgId
(
userInfo
.
getBelongUserOrgId
());
themeNotifyQo
.
setBelongUserOrgName
(
userInfo
.
getBelongUserOrgName
());
// 评论根据commentEntity找到ThemeId
if
(
NotificationTypeEnum
.
COMMENT
.
getCode
().
equals
(
themeNotifyQo
.
getMessageType
())
||
NotificationTypeEnum
.
COMMENT_LIKE
.
getCode
().
equals
(
themeNotifyQo
.
getMessageType
()))
{
// 评论类型将commentId替换为themeId
CommentEntity
commentEntity
=
commentService
.
queryByCommentId
(
themeNotifyQo
.
getCommentId
());
themeNotifyQo
.
setFormerThemeId
(
commentEntity
.
getThemeId
());
}
// 封装引用对象
if
(
StringUtils
.
isNotEmpty
(
themeNotifyQo
.
getFormerThemeId
()))
{
if
(
NotificationTypeEnum
.
COMMENT
.
getCode
().
equals
(
themeNotifyQo
.
getMessageType
()))
{
// 评论类型将commentId替换为themeId
CommentEntity
commentEntity
=
commentService
.
queryByCommentId
(
themeNotifyQo
.
getFormerThemeId
());
themeNotifyQo
.
setFormerThemeId
(
commentEntity
.
getThemeId
());
}
ThemeEntity
former
=
themeService
.
queryByThemeId
(
themeNotifyQo
.
getFormerThemeId
());
if
(
former
!=
null
)
{
themeNotifyQo
.
setFormerUserName
(
currentUser
.
getNickName
());
if
(
StringUtils
.
isNotBlank
(
former
.
getTopicId
()))
{
...
...
@@ -121,30 +123,6 @@ public class NotificationManager {
// 引用主题已被删除
themeNotifyQo
.
setFormerThemeId
(
null
);
}
}
// 评论点赞类型
if
(
NotificationTypeEnum
.
COMMENT_LIKE
.
getCode
().
equals
(
themeNotifyQo
.
getMessageType
()))
{
CommentEntity
commentEntity
=
commentService
.
queryByCommentId
(
themeNotifyQo
.
getCommentId
());
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
()))
{
...
...
community-service/src/main/java/com/tanpu/community/util/ConvertUtil.java
View file @
813c73e8
...
...
@@ -250,6 +250,12 @@ public class ConvertUtil {
)
{
themeNotifyQo
.
setFormerThemeId
(
entity
.
getTargetId
());
}
// 评、点赞评论 评论Id
if
(
entity
.
getMessageType
().
equals
(
NotificationTypeEnum
.
COMMENT_LIKE
.
getCode
())
||
entity
.
getMessageType
().
equals
(
NotificationTypeEnum
.
COMMENT
.
getCode
())
)
{
themeNotifyQo
.
setCommentId
(
entity
.
getTargetId
());
}
// 转发有话题信息
if
(
entity
.
getMessageType
().
equals
(
NotificationTypeEnum
.
FORWARD
.
getCode
()))
{
themeNotifyQo
.
setFormerThemeId
(
entity
.
getTargetId
());
...
...
@@ -266,22 +272,8 @@ public class ConvertUtil {
}
}
// 点赞需要聚合头像和人数
if
(
entity
.
getMessageType
().
equals
(
NotificationTypeEnum
.
LIKE
.
getCode
()))
{
if
(!
StringUtils
.
isEmpty
(
entity
.
getContent
()))
{
try
{
NotificationLikeDO
notificationLikeDO
=
JsonUtil
.
toBean
(
entity
.
getContent
(),
NotificationLikeDO
.
class
);
themeNotifyQo
.
setLikeUserCount
(
notificationLikeDO
.
getCount
());
ArrayList
<
UserBriefInfoQO
>
likeUsers
=
new
ArrayList
<>();
notificationLikeDO
.
getSet
().
stream
().
forEach
(
o
->
likeUsers
.
add
(
UserBriefInfoQO
.
builder
().
userId
(
o
).
build
()));
themeNotifyQo
.
setLikeUsers
(
likeUsers
);
}
catch
(
Exception
e
){
throw
new
BizException
(
"消息通知-点赞类型-反序列化异常:"
+
entity
.
getContent
());
}
}
}
// 点赞评论需要聚合头像和人数,并写入commentId
if
(
entity
.
getMessageType
().
equals
(
NotificationTypeEnum
.
COMMENT_LIKE
.
getCode
()))
{
if
(
entity
.
getMessageType
().
equals
(
NotificationTypeEnum
.
LIKE
.
getCode
())
||
entity
.
getMessageType
().
equals
(
NotificationTypeEnum
.
COMMENT_LIKE
.
getCode
()))
{
if
(!
StringUtils
.
isEmpty
(
entity
.
getContent
()))
{
try
{
...
...
@@ -290,14 +282,11 @@ public class ConvertUtil {
ArrayList
<
UserBriefInfoQO
>
likeUsers
=
new
ArrayList
<>();
notificationLikeDO
.
getSet
().
stream
().
forEach
(
o
->
likeUsers
.
add
(
UserBriefInfoQO
.
builder
().
userId
(
o
).
build
()));
themeNotifyQo
.
setLikeUsers
(
likeUsers
);
themeNotifyQo
.
setCommentId
(
entity
.
getTargetId
());
}
catch
(
Exception
e
){
throw
new
BizException
(
"消息通知-点赞类型-反序列化异常:"
+
entity
.
getContent
());
}
}
}
return
themeNotifyQo
;
}
...
...
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