Commit f1a6fd55 authored by 刘基明's avatar 刘基明

消息通知异常捕获

parent dea3a638
package com.tanpu.community.manager;
import com.fasterxml.jackson.core.type.TypeReference;
import com.tanpu.common.api.CommonResp;
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.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.req.notification.NotifyQueryReq;
......@@ -12,6 +15,7 @@ import com.tanpu.community.api.constants.RedisKeyConstant;
import com.tanpu.community.api.enums.ThemeTypeEnum;
import com.tanpu.community.cache.RedisCache;
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.feign.fatools.FeignClientForFatools;
import com.tanpu.community.service.BatchFeignCallService;
......@@ -27,7 +31,6 @@ import javax.annotation.Resource;
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_FORWARD_THEME_ID;
@Service
public class NotificationManager {
......@@ -68,12 +71,12 @@ public class NotificationManager {
themeNotifyQo.setBelongUserOrgName(userInfo.getBelongUserOrgName());
// 封装转发对象
if (StringUtils.isNotEmpty(themeNotifyQo.getFormerThemeId())){
FormerThemeQo former = redisCache.getObject(StringUtils.joinWith("_", CACHE_FORWARD_THEME_ID, themeNotifyQo.getFormerThemeId()), 60,
() -> this.getFormerTheme(themeNotifyQo.getFormerThemeId()), FormerThemeQo.class);
ThemeEntity former = themeService.queryByThemeId(themeNotifyQo.getFormerThemeId());
if (former!=null){
themeNotifyQo.setFormerUserName(former.getNickName());
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())){
themeNotifyQo.setContent(former.getTitle());
......
......@@ -252,6 +252,7 @@ public class ConvertUtil {
// 转发有话题信息
if (entity.getMessageType().equals(NotificationTypeEnum.FORWARD.getCode())) {
themeNotifyQo.setFormerThemeId(entity.getTargetId());
themeNotifyQo.setFormerUserName(entity.getNotifiedUserId());
if (!StringUtils.isEmpty(entity.getContent())) {
try{
NotificationForwardDO forwardDO = JsonUtil.toBean(entity.getContent(), NotificationForwardDO.class);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment