Browse Source

优化了消息发送

dev
vincent 2 hours ago
parent
commit
2048345eaf
  1. 54
      zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/service/impl/EfcodeCpNoticeServiceImpl.java
  2. 18
      zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/service/thirdparty/impl/SIQServiceImpl.java

54
zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/service/impl/EfcodeCpNoticeServiceImpl.java

@ -167,34 +167,34 @@ public class EfcodeCpNoticeServiceImpl implements IEfcodeCpNoticeService {
*/
public void getSendYuGaoMsg(EfcodeCpNotice entity){
return;
// 发送前校验系统参数开关
// if (!isSnsSendEnabled()) {
// log.info("系统参数[sns.send]未开启,跳过预告消息(站内信/短信)发送,预告ID:{}", entity.getId());
// return;
// }
//
// generateSystemMessage(entity);
// try{
// YuGaoMsgParamBo paramBo = new YuGaoMsgParamBo();
// paramBo.setSourceId(entity.getId());
// paramBo.setEnterpriseId(entity.getEnterpriseId());
// paramBo.setEnterpriseName(entity.getEnterpriseName());
// paramBo.setCreateByName(LoginHelper.getUsername());
// paramBo.setDeptName(entity.getDeptName());
// paramBo.setEnforceDate(entity.getEnforceDate());
// siqService.sendYuGaoMsg(paramBo);
//
// }catch (Exception e){
// log.error("发送预告消息异常:{}", e.getMessage());
// }
//
// try {
// // 异步发送预告短信
// sendYuGaoSms(entity);
// }catch (Exception e){
// log.error("发送预告短信异常:{}", e.getMessage());
// }
if (!isSnsSendEnabled()) {
log.info("系统参数[sns.send]未开启,跳过预告消息(站内信/短信)发送,预告ID:{}", entity.getId());
return;
}
generateSystemMessage(entity);
try{
YuGaoMsgParamBo paramBo = new YuGaoMsgParamBo();
paramBo.setSourceId(entity.getId());
paramBo.setEnterpriseId(entity.getEnterpriseId());
paramBo.setEnterpriseName(entity.getEnterpriseName());
paramBo.setCreateByName(LoginHelper.getUsername());
paramBo.setDeptName(entity.getDeptName());
paramBo.setEnforceDate(entity.getEnforceDate());
siqService.sendYuGaoMsg(paramBo);
}catch (Exception e){
log.error("发送预告消息异常:{}", e.getMessage());
}
try {
// 异步发送预告短信
sendYuGaoSms(entity);
}catch (Exception e){
log.error("发送预告短信异常:{}", e.getMessage());
}
}

18
zdxt-modules/zdxt-enforcement-code/src/main/java/com/zdxt/enforcementcode/service/thirdparty/impl/SIQServiceImpl.java

@ -93,15 +93,21 @@ public class SIQServiceImpl implements ISIQService {
}
for (EnterpriseUserRefVo userRef : userRefList) {
// 账号为空则跳过,不发送该用户的消息
if (userRef == null || userRef.getUserId() != null) {
log.warn("企业[{}]关联用户[{}]登录账号为空,跳过预告消息发送", enterpriseId,
userRef == null ? "" : userRef.getUserId());
// 用户为空或 userId 为空则跳过,不发送该用户的消息
if (userRef == null || userRef.getUserId() == null) {
log.warn("企业[{}]关联用户ID为空,跳过预告消息发送", enterpriseId);
continue;
}
// 站内信接收账号使用深i企用户标识 rel_user_cuid
EnterpriseUser entUser = enterpriseUserMapper.selectById(userRef.getUserId());
if (entUser == null || StringUtils.isBlank(entUser.getRelUserCuid())) {
log.warn("企业[{}]关联用户[{}]无深i企用户标识(relUserCuid),跳过预告消息发送",
enterpriseId, userRef.getUserId());
continue;
}
SIQMsgParamBo siqMsgParamBo = new SIQMsgParamBo();
siqMsgParamBo.setCreateBy(paramBo.getCreateByName());
siqMsgParamBo.setReceiveAccount(userRef.getUserId() + "");
siqMsgParamBo.setReceiveAccount(entUser.getRelUserCuid());
Map<String, String> variables = new HashMap<>();
variables.put("enterName", paramBo.getEnterpriseName());
variables.put("dept", paramBo.getDeptName());
@ -110,7 +116,7 @@ public class SIQServiceImpl implements ISIQService {
siqMsgParamBo.setSourceId(paramBo.getSourceId());
sendMsg(siqMsgParamBo);
}
log.info("企业[{}]预告消息发送完成,共发送{}条", enterpriseId, userRefList.size());
log.info("企业[{}]预告消息发送完成,共{}个关联用户", enterpriseId, userRefList.size());
}
@Override

Loading…
Cancel
Save