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
f1a6fd55
Commit
f1a6fd55
authored
Aug 14, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
消息通知异常捕获
parent
dea3a638
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
+9
-5
NotificationManager.java
...java/com/tanpu/community/manager/NotificationManager.java
+8
-5
ConvertUtil.java
...e/src/main/java/com/tanpu/community/util/ConvertUtil.java
+1
-0
No files found.
community-service/src/main/java/com/tanpu/community/manager/NotificationManager.java
View file @
f1a6fd55
package
com
.
tanpu
.
community
.
manager
;
package
com
.
tanpu
.
community
.
manager
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.tanpu.common.api.CommonResp
;
import
com.tanpu.common.api.CommonResp
;
import
com.tanpu.common.exception.BizException
;
import
com.tanpu.common.exception.BizException
;
import
com.tanpu.common.util.JsonUtil
;
import
com.tanpu.community.api.beans.qo.FormerThemeQo
;
import
com.tanpu.community.api.beans.qo.FormerThemeQo
;
import
com.tanpu.community.api.beans.qo.NotificationQo
;
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.ThemeNotifyQo
;
import
com.tanpu.community.api.beans.qo.ThemeQo
;
import
com.tanpu.community.api.beans.qo.ThemeQo
;
import
com.tanpu.community.api.beans.req.notification.NotifyQueryReq
;
import
com.tanpu.community.api.beans.req.notification.NotifyQueryReq
;
...
@@ -12,6 +15,7 @@ import com.tanpu.community.api.constants.RedisKeyConstant;
...
@@ -12,6 +15,7 @@ import com.tanpu.community.api.constants.RedisKeyConstant;
import
com.tanpu.community.api.enums.ThemeTypeEnum
;
import
com.tanpu.community.api.enums.ThemeTypeEnum
;
import
com.tanpu.community.cache.RedisCache
;
import
com.tanpu.community.cache.RedisCache
;
import
com.tanpu.community.dao.entity.community.NotificationEntity
;
import
com.tanpu.community.dao.entity.community.NotificationEntity
;
import
com.tanpu.community.dao.entity.community.ThemeEntity
;
import
com.tanpu.community.dao.entity.community.TopicEntity
;
import
com.tanpu.community.dao.entity.community.TopicEntity
;
import
com.tanpu.community.feign.fatools.FeignClientForFatools
;
import
com.tanpu.community.feign.fatools.FeignClientForFatools
;
import
com.tanpu.community.service.BatchFeignCallService
;
import
com.tanpu.community.service.BatchFeignCallService
;
...
@@ -27,7 +31,6 @@ import javax.annotation.Resource;
...
@@ -27,7 +31,6 @@ import javax.annotation.Resource;
import
java.util.List
;
import
java.util.List
;
import
static
com
.
tanpu
.
community
.
api
.
constants
.
RedisKeyConstant
.
CACHE_FEIGN_USER_INFO
;
import
static
com
.
tanpu
.
community
.
api
.
constants
.
RedisKeyConstant
.
CACHE_FEIGN_USER_INFO
;
import
static
com
.
tanpu
.
community
.
api
.
constants
.
RedisKeyConstant
.
CACHE_FORWARD_THEME_ID
;
@Service
@Service
public
class
NotificationManager
{
public
class
NotificationManager
{
...
@@ -68,12 +71,12 @@ public class NotificationManager {
...
@@ -68,12 +71,12 @@ public class NotificationManager {
themeNotifyQo
.
setBelongUserOrgName
(
userInfo
.
getBelongUserOrgName
());
themeNotifyQo
.
setBelongUserOrgName
(
userInfo
.
getBelongUserOrgName
());
// 封装转发对象
// 封装转发对象
if
(
StringUtils
.
isNotEmpty
(
themeNotifyQo
.
getFormerThemeId
())){
if
(
StringUtils
.
isNotEmpty
(
themeNotifyQo
.
getFormerThemeId
())){
FormerThemeQo
former
=
redisCache
.
getObject
(
StringUtils
.
joinWith
(
"_"
,
CACHE_FORWARD_THEME_ID
,
themeNotifyQo
.
getFormerThemeId
()),
60
,
ThemeEntity
former
=
themeService
.
queryByThemeId
(
themeNotifyQo
.
getFormerThemeId
());
()
->
this
.
getFormerTheme
(
themeNotifyQo
.
getFormerThemeId
()),
FormerThemeQo
.
class
);
if
(
former
!=
null
){
if
(
former
!=
null
){
themeNotifyQo
.
setFormerUserName
(
former
.
getNickName
());
if
(
ThemeTypeEnum
.
DISCUSSION
.
getCode
().
equals
(
former
.
getThemeType
())){
if
(
ThemeTypeEnum
.
DISCUSSION
.
getCode
().
equals
(
former
.
getThemeType
())){
themeNotifyQo
.
setContent
(
former
.
getContent
().
get
(
0
).
getValue
());
List
<
ThemeContentQo
>
themeContentQos
=
JsonUtil
.
toBean
(
former
.
getContent
(),
new
TypeReference
<
List
<
ThemeContentQo
>>()
{
});
themeNotifyQo
.
setContent
(
themeContentQos
.
get
(
0
).
getValue
());
}
}
if
(
ThemeTypeEnum
.
LONG_TEXT
.
getCode
().
equals
(
former
.
getThemeType
())){
if
(
ThemeTypeEnum
.
LONG_TEXT
.
getCode
().
equals
(
former
.
getThemeType
())){
themeNotifyQo
.
setContent
(
former
.
getTitle
());
themeNotifyQo
.
setContent
(
former
.
getTitle
());
...
...
community-service/src/main/java/com/tanpu/community/util/ConvertUtil.java
View file @
f1a6fd55
...
@@ -252,6 +252,7 @@ public class ConvertUtil {
...
@@ -252,6 +252,7 @@ public class ConvertUtil {
// 转发有话题信息
// 转发有话题信息
if
(
entity
.
getMessageType
().
equals
(
NotificationTypeEnum
.
FORWARD
.
getCode
()))
{
if
(
entity
.
getMessageType
().
equals
(
NotificationTypeEnum
.
FORWARD
.
getCode
()))
{
themeNotifyQo
.
setFormerThemeId
(
entity
.
getTargetId
());
themeNotifyQo
.
setFormerThemeId
(
entity
.
getTargetId
());
themeNotifyQo
.
setFormerUserName
(
entity
.
getNotifiedUserId
());
if
(!
StringUtils
.
isEmpty
(
entity
.
getContent
()))
{
if
(!
StringUtils
.
isEmpty
(
entity
.
getContent
()))
{
try
{
try
{
NotificationForwardDO
forwardDO
=
JsonUtil
.
toBean
(
entity
.
getContent
(),
NotificationForwardDO
.
class
);
NotificationForwardDO
forwardDO
=
JsonUtil
.
toBean
(
entity
.
getContent
(),
NotificationForwardDO
.
class
);
...
...
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