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
dea3a638
Commit
dea3a638
authored
Aug 14, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
消息通知异常捕获
parent
5b1c203d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
6 deletions
+28
-6
RedisCache.java
...e/src/main/java/com/tanpu/community/cache/RedisCache.java
+9
-0
ConvertUtil.java
...e/src/main/java/com/tanpu/community/util/ConvertUtil.java
+19
-6
No files found.
community-service/src/main/java/com/tanpu/community/cache/RedisCache.java
View file @
dea3a638
...
...
@@ -66,6 +66,15 @@ public class RedisCache {
}
}
public
void
set
(
String
key
,
String
value
,
Integer
expireSeconds
)
{
key
=
cacheName
+
":"
+
key
;
if
(
expireSeconds
==
0
)
{
redisHelper
.
set
(
key
,
value
);
}
else
{
redisHelper
.
set
(
key
,
value
,
Duration
.
ofSeconds
(
expireSeconds
));
}
}
private
void
delete
(
String
key
)
{
redisHelper
.
delete
(
key
);
}
...
...
community-service/src/main/java/com/tanpu/community/util/ConvertUtil.java
View file @
dea3a638
...
...
@@ -3,6 +3,7 @@ package com.tanpu.community.util;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.tanpu.biz.common.enums.RelTypeEnum
;
import
com.tanpu.biz.common.enums.community.TopicStatusEnum
;
import
com.tanpu.common.exception.BizException
;
import
com.tanpu.common.util.JsonUtil
;
import
com.tanpu.community.api.beans.qo.*
;
import
com.tanpu.community.api.beans.req.theme.CreateThemeReq
;
...
...
@@ -252,18 +253,30 @@ public class ConvertUtil {
if
(
entity
.
getMessageType
().
equals
(
NotificationTypeEnum
.
FORWARD
.
getCode
()))
{
themeNotifyQo
.
setFormerThemeId
(
entity
.
getTargetId
());
if
(!
StringUtils
.
isEmpty
(
entity
.
getContent
()))
{
NotificationForwardDO
forwardDO
=
JsonUtil
.
toBean
(
entity
.
getContent
(),
NotificationForwardDO
.
class
);
themeNotifyQo
.
setContent
(
forwardDO
.
getContent
());
themeNotifyQo
.
setTopicId
(
forwardDO
.
getTopicId
());
try
{
NotificationForwardDO
forwardDO
=
JsonUtil
.
toBean
(
entity
.
getContent
(),
NotificationForwardDO
.
class
);
themeNotifyQo
.
setContent
(
forwardDO
.
getContent
());
themeNotifyQo
.
setTopicId
(
forwardDO
.
getTopicId
());
}
catch
(
Exception
e
){
throw
new
BizException
(
"消息通知-转发类型-反序列化异常:"
+
entity
.
getContent
());
}
}
}
// 点赞需要聚合头像和人数
if
(
entity
.
getMessageType
().
equals
(
NotificationTypeEnum
.
LIKE
.
getCode
()))
{
if
(!
StringUtils
.
isEmpty
(
entity
.
getContent
()))
{
NotificationLikeDO
notificationLikeDO
=
JsonUtil
.
toBean
(
entity
.
getContent
(),
NotificationLikeDO
.
class
);
themeNotifyQo
.
setLikeUserCount
(
notificationLikeDO
.
getCount
());
themeNotifyQo
.
setLikeUserIds
(
new
ArrayList
<>(
notificationLikeDO
.
getSet
()));
try
{
NotificationLikeDO
notificationLikeDO
=
JsonUtil
.
toBean
(
entity
.
getContent
(),
NotificationLikeDO
.
class
);
themeNotifyQo
.
setLikeUserCount
(
notificationLikeDO
.
getCount
());
themeNotifyQo
.
setLikeUserIds
(
new
ArrayList
<>(
notificationLikeDO
.
getSet
()));
}
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