|
|
|
@ -146,9 +146,8 @@ public class MessageServiceImpl implements MessageService {
|
|
|
|
|
log.error("微信消息发送失败:站点code获取失败 : {}",entity); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
Long dept = station.getData().getCreateDept(); |
|
|
|
|
// 获取站点用户
|
|
|
|
|
R<List<User>> result = userClient.userList("200000",dept); |
|
|
|
|
R<List<User>> result = userClient.userByDeptIdLevel(station.getData().getRefDept(),0); |
|
|
|
|
if (!result.isSuccess() || CollectionUtil.isEmpty(result.getData())) { |
|
|
|
|
log.error("微信消息发送失败:用户获取失败 : {}",entity); |
|
|
|
|
return; |
|
|
|
@ -168,9 +167,9 @@ public class MessageServiceImpl implements MessageService {
|
|
|
|
|
message.setTaskId(entity.getId()); |
|
|
|
|
// 微信参数键值对
|
|
|
|
|
HashMap<String,Object> map = new HashMap<>(); |
|
|
|
|
map.put("thing18",entity.getStationName()); |
|
|
|
|
map.put("thing18",getTruncateString(entity.getStationName(), 29)); |
|
|
|
|
// map.put("thing5",Optional.ofNullable(entity.getDeviceCode()).orElse("未知设备"));
|
|
|
|
|
map.put("thing11",entity.getAlarmContext()); |
|
|
|
|
map.put("thing11",getTruncateString(entity.getAlarmContext(), 29)); |
|
|
|
|
map.put("time2",entity.getAlarmTime()); |
|
|
|
|
map.put("thing14", DictCache.getValue("alarm_source", entity.getAlarmSource())); |
|
|
|
|
message.setMap(map); |
|
|
|
@ -186,4 +185,11 @@ public class MessageServiceImpl implements MessageService {
|
|
|
|
|
message.setTenantId(station.getData().getTenantId()); |
|
|
|
|
messageClient.sendWxMessage(message); |
|
|
|
|
} |
|
|
|
|
private String getTruncateString(String ruleDefName, int maxSize) { |
|
|
|
|
if (ruleDefName.length()<= maxSize){ |
|
|
|
|
return ruleDefName; |
|
|
|
|
}else { |
|
|
|
|
return ruleDefName.substring(0, maxSize - 3) + "..."; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |