|
|
@@ -191,7 +191,7 @@ public class MqttCallbackHandler extends AbstractHandler {
|
|
|
, templateParam);
|
|
|
}
|
|
|
ProjectVo vo = projectDeviceMapper.selectProjectByDeviceId(device.getId());
|
|
|
- /**邮寄推送*/
|
|
|
+ /**邮件推送*/
|
|
|
List<KwsAlarmInfo> emailList = alarmInfoRepository.list(new LambdaQueryWrapper<KwsAlarmInfo>()
|
|
|
.eq(KwsAlarmInfo::getMountainId, mountainId)
|
|
|
.eq(KwsAlarmInfo::getLevel, level.intValue())
|
|
|
@@ -200,7 +200,7 @@ public class MqttCallbackHandler extends AbstractHandler {
|
|
|
);
|
|
|
List<String> emailAddress = new ArrayList<>();
|
|
|
if (!CollectionUtils.isEmpty(emailList)) {
|
|
|
- emailAddress = list.stream().map(KwsAlarmInfo::getValueDesc).distinct().collect(Collectors.toList());
|
|
|
+ emailAddress = emailList.stream().map(KwsAlarmInfo::getValueDesc).distinct().collect(Collectors.toList());
|
|
|
}
|
|
|
if (!CollectionUtils.isEmpty(emailAddress)) {
|
|
|
Map<String, Object> templateParam = new HashMap<>();
|
|
|
@@ -219,7 +219,7 @@ public class MqttCallbackHandler extends AbstractHandler {
|
|
|
}
|
|
|
}
|
|
|
//集成要素阈值告警
|
|
|
- deviceIntegrationsAlarm(device, ts);
|
|
|
+ deviceIntegrationsAlarm(device, ts, time);
|
|
|
}
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
@@ -243,7 +243,7 @@ public class MqttCallbackHandler extends AbstractHandler {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void deviceIntegrationsAlarm(KwsDevice device, Long ts) {
|
|
|
+ private void deviceIntegrationsAlarm(KwsDevice device, Long ts, String time) {
|
|
|
// List<KwsDeviceIntegration> deviceIntegrations = deviceIntegrationMapper.selectList(
|
|
|
// new LambdaQueryWrapper<KwsDeviceIntegration>()
|
|
|
// .eq(KwsDeviceIntegration::getDeviceId, device.getId())
|
|
|
@@ -263,6 +263,10 @@ public class MqttCallbackHandler extends AbstractHandler {
|
|
|
// integrationMap = integrations.stream().collect(Collectors.toMap(KwsIntegration::getPartNames, KwsIntegration::getId));
|
|
|
// }
|
|
|
//获取集成要素
|
|
|
+ if (StringUtils.isBlank(time)) {
|
|
|
+ LocalDateTime localDateTime = Instant.ofEpochSecond(ts).atZone(ZoneId.systemDefault()).toLocalDateTime();
|
|
|
+ time = com.sckw.excel.utils.DateUtil.format(localDateTime);
|
|
|
+ }
|
|
|
List<DeviceIntegrationVo> intergData = new ArrayList<>();
|
|
|
String snCode = device.getSnCode();
|
|
|
intergData = deviceIntegrationMapper.selectListParamsAndInterNameByDeviceId(device.getId());
|
|
|
@@ -300,7 +304,7 @@ public class MqttCallbackHandler extends AbstractHandler {
|
|
|
}
|
|
|
if (!CollectionUtils.isEmpty(pushToPhone)) {
|
|
|
LocalDateTime localDateTime = Instant.ofEpochSecond(ts).atZone(ZoneId.systemDefault()).toLocalDateTime();
|
|
|
- String time = DateUtil.format(localDateTime, "yyyy-MM-dd HH:mm:ss");
|
|
|
+ time = DateUtil.format(localDateTime, "yyyy-MM-dd HH:mm:ss");
|
|
|
Map<String, String> templateParam = new HashMap<>();
|
|
|
if (StringUtils.isBlank(time)) {
|
|
|
LocalDateTime localDateTimes = Instant.ofEpochSecond(ts).atZone(ZoneId.systemDefault()).toLocalDateTime();
|
|
|
@@ -315,6 +319,33 @@ public class MqttCallbackHandler extends AbstractHandler {
|
|
|
, smsTemplateConfig.getDataAlarm().getSignName()
|
|
|
, templateParam);
|
|
|
}
|
|
|
+ ProjectVo vo = projectDeviceMapper.selectProjectByDeviceId(device.getId());
|
|
|
+ /**邮件推送*/
|
|
|
+ List<KwsAlarmInfo> emailList = alarmInfoRepository.list(new LambdaQueryWrapper<KwsAlarmInfo>()
|
|
|
+ .eq(KwsAlarmInfo::getMountainId, mountainId)
|
|
|
+ .eq(KwsAlarmInfo::getLevel, level.intValue())
|
|
|
+ .eq(KwsAlarmInfo::getType, NumberConstant.TWO)
|
|
|
+ .eq(KwsAlarmInfo::getDelFlag, NumberConstant.ZERO)
|
|
|
+ );
|
|
|
+ List<String> emailAddress = new ArrayList<>();
|
|
|
+ if (!CollectionUtils.isEmpty(emailList)) {
|
|
|
+ emailAddress = emailList.stream().map(KwsAlarmInfo::getValueDesc).distinct().collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ if (!CollectionUtils.isEmpty(emailAddress)) {
|
|
|
+ Map<String, Object> templateParam = new HashMap<>();
|
|
|
+ if (StringUtils.isBlank(time)) {
|
|
|
+ LocalDateTime localDateTime = Instant.ofEpochSecond(ts).atZone(ZoneId.systemDefault()).toLocalDateTime();
|
|
|
+ time = com.sckw.excel.utils.DateUtil.format(localDateTime);
|
|
|
+ }
|
|
|
+ templateParam.put("company", smsTemplateConfig.getDataAlarm().getSignName());
|
|
|
+ templateParam.put("level", level.toString());
|
|
|
+ templateParam.put("name", device.getName());
|
|
|
+ templateParam.put("time", time);
|
|
|
+ templateParam.put("project", vo == null ? null : vo.getProjectName());
|
|
|
+ templateParam.put("value", itemValueAndUnit);
|
|
|
+ commonService.pushEmailMessage(emailAddress
|
|
|
+ , templateParam);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|