|
|
|
@ -60,13 +60,14 @@ public class MessageServiceImpl implements MessageService {
|
|
|
|
|
@Override |
|
|
|
|
public void shortMessage(AlarmEntity entity) { |
|
|
|
|
R<StationEntity> station = stationClient.getStationByCode(entity.getStationId()); |
|
|
|
|
if (!station.isSuccess() && ObjectUtils.isEmpty(station.getData())) { |
|
|
|
|
if (!station.isSuccess() || ObjectUtils.isEmpty(station.getData())) { |
|
|
|
|
log.error("消息发送失败:站点code获取失败 : {}",entity); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
//通知站点项目经理这个角色
|
|
|
|
|
List<User> users = userClient.relationUserListByRoleAlias(station.getData().getTenantId(), station.getData().getRefDept(), PROJECT_MANAGER).getData(); |
|
|
|
|
if(CollectionUtil.isEmpty(users)){ |
|
|
|
|
log.error("消息发送失败:获取站点项目经理用户失败 : {}",entity); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
SmsImmediatelyPushDTO push = SmsImmediatelyPushDTO.builder() |
|
|
|
@ -98,14 +99,14 @@ public class MessageServiceImpl implements MessageService {
|
|
|
|
|
public void webAppMessage(AlarmEntity entity) { |
|
|
|
|
R<StationEntity> stationByCode = stationClient.getStationByCode(entity.getStationId()); |
|
|
|
|
if (!stationByCode.isSuccess() && ObjectUtils.isEmpty(stationByCode.getData())) { |
|
|
|
|
log.error("消息发送失败:站点code获取失败 : {}",entity); |
|
|
|
|
log.error("WEB/APP消息发送失败:站点code获取失败 : {}",entity); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
Long dept = stationByCode.getData().getCreateDept(); |
|
|
|
|
Long dept = stationByCode.getData().getRefDept(); |
|
|
|
|
// 获取站点用户
|
|
|
|
|
R<List<User>> result = userClient.userListByDeptId(dept); |
|
|
|
|
R<List<User>> result = userClient.userList(stationByCode.getData().getTenantId(),dept); |
|
|
|
|
if (!result.isSuccess() || CollectionUtil.isEmpty(result.getData())) { |
|
|
|
|
log.error("消息发送失败:用户获取失败 : {}",entity); |
|
|
|
|
log.error("WEB/APP消息发送失败:用户获取失败 : {}",entity); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
BusinessMessageDTO message = new BusinessMessageDTO(); |
|
|
|
@ -113,7 +114,7 @@ public class MessageServiceImpl implements MessageService {
|
|
|
|
|
message.setBusinessKey(MessageConstants.BusinessClassifyEnum.WARNING.getKey()); |
|
|
|
|
message.setSubject(MessageConstants.BusinessClassifyEnum.WARNING.getDescription()); |
|
|
|
|
message.setTaskId(entity.getId()); |
|
|
|
|
message.setTenantId("200000"); |
|
|
|
|
message.setTenantId(stationByCode.getData().getTenantId()); |
|
|
|
|
message.setContent(entity.getAlarmContext()); |
|
|
|
|
message.setDeptId(dept); |
|
|
|
|
R<String> deptName = sysClient.getDeptName(dept); |
|
|
|
@ -133,14 +134,14 @@ public class MessageServiceImpl implements MessageService {
|
|
|
|
|
public void weChatMessage(AlarmEntity entity) { |
|
|
|
|
R<StationEntity> station = stationClient.getStationByCode(entity.getStationId()); |
|
|
|
|
if (!station.isSuccess() && ObjectUtils.isEmpty(station.getData())) { |
|
|
|
|
log.error("消息发送失败:站点code获取失败 : {}",entity); |
|
|
|
|
log.error("微信消息发送失败:站点code获取失败 : {}",entity); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
Long dept = station.getData().getCreateDept(); |
|
|
|
|
// 获取站点用户
|
|
|
|
|
R<List<User>> result = userClient.userListByDeptId(dept); |
|
|
|
|
R<List<User>> result = userClient.userList(station.getData().getTenantId(),dept); |
|
|
|
|
if (!result.isSuccess() || CollectionUtil.isEmpty(result.getData())) { |
|
|
|
|
log.error("消息发送失败:用户获取失败 : {}",entity); |
|
|
|
|
log.error("微信消息发送失败:用户获取失败 : {}",entity); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
WxMessageDTO message = new WxMessageDTO(); |
|
|
|
@ -155,7 +156,7 @@ public class MessageServiceImpl implements MessageService {
|
|
|
|
|
// 业务分类关键字
|
|
|
|
|
message.setBusinessClassify(MessageConstants.BusinessClassifyEnum.WARNING.getKey()); |
|
|
|
|
// 任务Id
|
|
|
|
|
message.setTaskId(Long.valueOf(entity.getAlarmId())); |
|
|
|
|
message.setTaskId(entity.getId()); |
|
|
|
|
// 微信参数键值对
|
|
|
|
|
HashMap<String,Object> map = new HashMap<>(); |
|
|
|
|
map.put("thing18",entity.getStationName()); |
|
|
|
|