|
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.dragon.tj.portal.common.base.R;
|
|
|
+import com.dragon.tj.portal.common.constants.BusinessConstants;
|
|
|
import com.dragon.tj.portal.common.convert.notice.NoticeInfoVOConvert;
|
|
|
import com.dragon.tj.portal.common.convert.notice.NoticeReqConvert;
|
|
|
import com.dragon.tj.portal.common.dto.notice.NoticeInfoReq;
|
|
@@ -24,10 +25,10 @@ import com.dragon.tj.portal.entity.MsgRecord;
|
|
|
import com.dragon.tj.portal.entity.NoticeInfo;
|
|
|
import com.dragon.tj.portal.entity.NoticeInfoScope;
|
|
|
import com.dragon.tj.portal.mapper.NoticeInfoMapper;
|
|
|
-import com.dragon.tj.portal.service.InstallInfoService;
|
|
|
import com.dragon.tj.portal.service.MsgRecordService;
|
|
|
import com.dragon.tj.portal.service.NoticeInfoScopeService;
|
|
|
import com.dragon.tj.portal.service.NoticeInfoService;
|
|
|
+import com.dragon.tj.portal.service.SysUserMenuService;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.google.common.collect.Sets;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -61,7 +62,7 @@ public class NoticeInfoServiceImpl extends ServiceImpl<NoticeInfoMapper, NoticeI
|
|
|
private MsgRecordService msgRecordService;
|
|
|
|
|
|
@Autowired
|
|
|
- private InstallInfoService installInfoService;
|
|
|
+ private SysUserMenuService sysUserMenuService;
|
|
|
|
|
|
@Autowired
|
|
|
private NoticeInfoScopeService noticeInfoScopeService;
|
|
@@ -83,7 +84,7 @@ public class NoticeInfoServiceImpl extends ServiceImpl<NoticeInfoMapper, NoticeI
|
|
|
}
|
|
|
//封装消息
|
|
|
//保存及推送mq
|
|
|
- return R.failed(false);
|
|
|
+ return R.failed("发送消息验证失败");
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -137,10 +138,10 @@ public class NoticeInfoServiceImpl extends ServiceImpl<NoticeInfoMapper, NoticeI
|
|
|
log.info("transferIds-scopeId-{}-{}", scopeId, messageClientIds);
|
|
|
if (CollUtil.isNotEmpty(messageClientIds)) {
|
|
|
NoticeInfoSend noticeInfoSend = this.doSaveNoticeInfo(noticeInfoReq, messageClientIds);
|
|
|
- isSend = producer.send("sseTopic-a1", JSON.toJSONString(noticeInfoSend));
|
|
|
+ isSend = producer.send(BusinessConstants.TOPIC_PRE + noticeInfoReq.getScopeId(), JSON.toJSONString(noticeInfoSend));
|
|
|
if (isSend) {
|
|
|
MsgRecord msgRecord = new MsgRecord();
|
|
|
- msgRecord.setCreateBy("admin");
|
|
|
+ msgRecord.setCreateBy(BusinessConstants.DEFAULT_ADMIN);
|
|
|
msgRecord.setCreateTime(LocalDateTime.now());
|
|
|
msgRecord.setReqContent(JSON.toJSONString(noticeInfoSend));
|
|
|
msgRecord.setType(MsgRecordTypeEnum.MESSAGE.value());
|
|
@@ -163,7 +164,7 @@ public class NoticeInfoServiceImpl extends ServiceImpl<NoticeInfoMapper, NoticeI
|
|
|
throw new MessageInfoException(MessageInfoErrorEnums.Code.NOTICE_LIMIT_EMPTY);
|
|
|
}
|
|
|
//查询有当前应用的人
|
|
|
- Set<String> allUserIds = installInfoService.findUsersByAppId(scopeId);
|
|
|
+ Set<String> allUserIds = sysUserMenuService.findUsersByAppId(scopeId);
|
|
|
if (CollUtil.isNotEmpty(allUserIds)) {
|
|
|
messageClientIds.addAll(allUserIds);
|
|
|
}
|
|
@@ -173,10 +174,10 @@ public class NoticeInfoServiceImpl extends ServiceImpl<NoticeInfoMapper, NoticeI
|
|
|
|
|
|
private boolean validate(NoticeInfoReq noticeInfoReq) {
|
|
|
|
|
|
- String id = noticeInfoReq.getId();
|
|
|
+ String id = noticeInfoReq.getClientId();
|
|
|
Long t = noticeInfoReq.getT();
|
|
|
String scopeId = noticeInfoReq.getScopeId();
|
|
|
- log.info("noticeInfoReq-validate-start-{}", noticeInfoReq.getId());
|
|
|
+ log.info("noticeInfoReq-validate-start-{}", noticeInfoReq.getClientId());
|
|
|
if (noticeSecret) {
|
|
|
String correctHash = DigestUtils.md5Hex(id + t);
|
|
|
if (!correctHash.equalsIgnoreCase(noticeInfoReq.getK())) {
|
|
@@ -190,7 +191,7 @@ public class NoticeInfoServiceImpl extends ServiceImpl<NoticeInfoMapper, NoticeI
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public NoticeInfoSend doSaveNoticeInfo(NoticeInfoReq noticeInfoReq, Set<String> messageClientIds) {
|
|
|
- log.info("doSaveNoticeInfo-start-{}-{}", noticeInfoReq.getId(), messageClientIds);
|
|
|
+ log.info("doSaveNoticeInfo-start-{}-{}", noticeInfoReq.getClientId(), messageClientIds);
|
|
|
Integer messageType = noticeInfoReq.getMessageType();
|
|
|
ScopeEnums scopeEnums = ScopeEnums.ofMessageType(messageType);
|
|
|
List<NoticeInfoScope> insertList = Lists.newArrayList();
|
|
@@ -199,7 +200,9 @@ public class NoticeInfoServiceImpl extends ServiceImpl<NoticeInfoMapper, NoticeI
|
|
|
noticeInfoSend.setClientIds(messageClientIds);
|
|
|
|
|
|
NoticeInfo noticeInfo = noticeReqConvert.reqToInfo(noticeInfoReq);
|
|
|
- noticeInfo.setCreateBy(noticeInfoReq.getId());
|
|
|
+ noticeInfo.setCreateBy(noticeInfoReq.getClientId());
|
|
|
+ noticeInfo.setCreateOrgCode(noticeInfoReq.getClientOrgCode());
|
|
|
+ noticeInfo.setCreateOrgName(noticeInfoReq.getClientOrgName());
|
|
|
// 存储
|
|
|
boolean isSaveBatchSuccess = false;
|
|
|
try {
|
|
@@ -226,10 +229,10 @@ public class NoticeInfoServiceImpl extends ServiceImpl<NoticeInfoMapper, NoticeI
|
|
|
noticeInfoScopeService.save(e);
|
|
|
});
|
|
|
} catch (Exception e) {
|
|
|
- log.warn("消息中心 存储失败 {}");
|
|
|
+ log.warn("消息中心 存储失败 {}",e);
|
|
|
}
|
|
|
}
|
|
|
- log.info("doSaveNoticeInfo-end-{}-{}", noticeInfoReq.getId(), messageClientIds);
|
|
|
+ log.info("doSaveNoticeInfo-end-{}-{}", noticeInfoReq.getClientId(), messageClientIds);
|
|
|
return noticeInfoSend;
|
|
|
}
|
|
|
|