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
2a4bd0ec
Commit
2a4bd0ec
authored
Aug 16, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
消息通知初始化
parent
0112d403
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
5 deletions
+37
-5
ThemeNotifyQo.java
.../java/com/tanpu/community/api/beans/qo/ThemeNotifyQo.java
+2
-4
UserBriefInfoQO.java
...ava/com/tanpu/community/api/beans/qo/UserBriefInfoQO.java
+22
-0
NotificationManager.java
...java/com/tanpu/community/manager/NotificationManager.java
+10
-0
ConvertUtil.java
...e/src/main/java/com/tanpu/community/util/ConvertUtil.java
+3
-1
No files found.
community-api/src/main/java/com/tanpu/community/api/beans/qo/ThemeNotifyQo.java
View file @
2a4bd0ec
...
...
@@ -58,10 +58,8 @@ public class ThemeNotifyQo {
public
String
formerUserName
;
// 点赞聚合
@ApiModelProperty
(
value
=
"用户头像"
)
public
List
<
String
>
likeUserIds
;
@ApiModelProperty
(
value
=
"用户头像"
)
public
List
<
String
>
likeUserImgs
;
@ApiModelProperty
(
value
=
"用户id"
)
public
List
<
UserBriefInfoQO
>
likeUsers
;
@ApiModelProperty
(
value
=
"点赞人数"
)
public
Integer
likeUserCount
;
...
...
community-api/src/main/java/com/tanpu/community/api/beans/qo/UserBriefInfoQO.java
0 → 100644
View file @
2a4bd0ec
package
com
.
tanpu
.
community
.
api
.
beans
.
qo
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public
class
UserBriefInfoQO
{
@ApiModelProperty
(
"用户id"
)
private
String
userId
;
//用户id
@ApiModelProperty
(
"昵称"
)
private
String
nickName
;
//昵称
@ApiModelProperty
(
"头像"
)
private
String
headImageUrl
;
//头像
}
community-service/src/main/java/com/tanpu/community/manager/NotificationManager.java
View file @
2a4bd0ec
...
...
@@ -9,6 +9,7 @@ import com.tanpu.community.api.beans.qo.NotificationQo;
import
com.tanpu.community.api.beans.qo.ThemeContentQo
;
import
com.tanpu.community.api.beans.qo.ThemeNotifyQo
;
import
com.tanpu.community.api.beans.qo.ThemeQo
;
import
com.tanpu.community.api.beans.qo.UserBriefInfoQO
;
import
com.tanpu.community.api.beans.req.notification.NotifyQueryReq
;
import
com.tanpu.community.api.beans.vo.feign.fatools.UserInfoResp
;
import
com.tanpu.community.api.constants.RedisKeyConstant
;
...
...
@@ -107,6 +108,15 @@ public class NotificationManager {
TopicEntity
topicEntity
=
topicService
.
queryById
(
themeNotifyQo
.
getTopicId
());
themeNotifyQo
.
setTopicTitle
(
topicEntity
.
getTopicTitle
());
}
if
(
themeNotifyQo
.
getLikeUserCount
()!=
null
&&
themeNotifyQo
.
getLikeUserCount
()>
1
)
{
List
<
UserBriefInfoQO
>
likeUsers
=
themeNotifyQo
.
getLikeUsers
();
for
(
UserBriefInfoQO
likeUser
:
likeUsers
)
{
UserInfoResp
luser
=
redisCache
.
getObject
(
StringUtils
.
joinWith
(
"_"
,
CACHE_FEIGN_USER_INFO
,
themeNotifyQo
.
getAuthorId
()),
60
,
()
->
this
.
getUserInfo
(
themeNotifyQo
.
getAuthorId
()),
UserInfoResp
.
class
);
likeUser
.
setHeadImageUrl
(
luser
.
getHeadImageUrl
());
likeUser
.
setNickName
(
luser
.
getNickName
());
}
}
}
redisCache
.
evict
(
RedisKeyConstant
.
MESSAGE_NOTIFY_COUNT
+
userId
);
...
...
community-service/src/main/java/com/tanpu/community/util/ConvertUtil.java
View file @
2a4bd0ec
...
...
@@ -273,7 +273,9 @@ public class ConvertUtil {
try
{
NotificationLikeDO
notificationLikeDO
=
JsonUtil
.
toBean
(
entity
.
getContent
(),
NotificationLikeDO
.
class
);
themeNotifyQo
.
setLikeUserCount
(
notificationLikeDO
.
getCount
());
themeNotifyQo
.
setLikeUserIds
(
new
ArrayList
<>(
notificationLikeDO
.
getSet
()));
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
());
}
...
...
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