Browse Source

消息中心-短信多人推送-增加param字数限制

zhongwei
ty 9 months ago
parent
commit
55dbe6569b
  1. 10
      hzims-service/message/src/main/java/com/hnac/hzims/message/fegin/MessageClient.java

10
hzims-service/message/src/main/java/com/hnac/hzims/message/fegin/MessageClient.java

@ -184,6 +184,9 @@ public class MessageClient extends BladeController implements IMessageClient{
record.setMessageId(IdWorker.getId()); record.setMessageId(IdWorker.getId());
for (Long pushId : Func.toLongList(",", smsImmediatelyPushDTO.getPusher())) { for (Long pushId : Func.toLongList(",", smsImmediatelyPushDTO.getPusher())) {
User user = UserCache.getUser(pushId); User user = UserCache.getUser(pushId);
if (ObjectUtil.isEmpty(user)||ObjectUtil.isEmpty(user.getPhone())){
continue;
}
record.setPusherName(user.getName()); record.setPusherName(user.getName());
record.setPusher(pushId.toString()); record.setPusher(pushId.toString());
record.setPushType(MessageConstants.IMMEDIATELY); record.setPushType(MessageConstants.IMMEDIATELY);
@ -195,14 +198,13 @@ public class MessageClient extends BladeController implements IMessageClient{
record.setStatus(MessageConstants.NOT_PUSH); record.setStatus(MessageConstants.NOT_PUSH);
Map<String, String> params = smsImmediatelyPushDTO.getParams(); Map<String, String> params = smsImmediatelyPushDTO.getParams();
int maxSize=35; int maxSize=35;
params.put("ruleDefName",getTruncateString(params.get("ruleDefName"), maxSize)); for (Map.Entry<String, String> stringStringEntry : params.entrySet()) {
params.put("projectName",getTruncateString(params.get("projectName"), maxSize)); params.put(stringStringEntry.getKey(),getTruncateString(stringStringEntry.getValue(), maxSize));
params.put("deviceName",getTruncateString(params.get("deviceName"), maxSize)); }
record.setSmsParam(JSON.toJSONString(params)); record.setSmsParam(JSON.toJSONString(params));
Boolean flag = recordService.sendSmsImmediatelyMsg(record); Boolean flag = recordService.sendSmsImmediatelyMsg(record);
if (!flag) { if (!flag) {
log.error("短信推送失败,参数:" + record.toString()); log.error("短信推送失败,参数:" + record.toString());
return R.data(false);
} }
} }
return R.data(true); return R.data(true);

Loading…
Cancel
Save