|
@@ -156,7 +156,7 @@ public class MqttCallbackHandler extends AbstractHandler {
|
|
|
pushSmsMessage(messageUrl, device, level, thresholdId, messageMap);
|
|
pushSmsMessage(messageUrl, device, level, thresholdId, messageMap);
|
|
|
}
|
|
}
|
|
|
//集成要素阈值告警
|
|
//集成要素阈值告警
|
|
|
- deviceIntegrationsAlarm(device,ts);
|
|
|
|
|
|
|
+ deviceIntegrationsAlarm(device, ts);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
@@ -180,7 +180,7 @@ public class MqttCallbackHandler extends AbstractHandler {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private void deviceIntegrationsAlarm(KwsDevice device,Long ts) {
|
|
|
|
|
|
|
+ private void deviceIntegrationsAlarm(KwsDevice device, Long ts) {
|
|
|
List<KwsDeviceIntegration> deviceIntegrations = deviceIntegrationMapper.selectList(
|
|
List<KwsDeviceIntegration> deviceIntegrations = deviceIntegrationMapper.selectList(
|
|
|
new LambdaQueryWrapper<KwsDeviceIntegration>()
|
|
new LambdaQueryWrapper<KwsDeviceIntegration>()
|
|
|
.eq(KwsDeviceIntegration::getDeviceId, device.getId())
|
|
.eq(KwsDeviceIntegration::getDeviceId, device.getId())
|
|
@@ -195,10 +195,10 @@ public class MqttCallbackHandler extends AbstractHandler {
|
|
|
.in(KwsIntegration::getId, integrationIds)
|
|
.in(KwsIntegration::getId, integrationIds)
|
|
|
.eq(KwsIntegration::getDelFlag, NumberConstant.ZERO)
|
|
.eq(KwsIntegration::getDelFlag, NumberConstant.ZERO)
|
|
|
);
|
|
);
|
|
|
- Map<String, Long> integrationMap = new HashMap<>(NumberConstant.SIXTEEN);
|
|
|
|
|
- if (!org.springframework.util.CollectionUtils.isEmpty(integrations)) {
|
|
|
|
|
- integrationMap = integrations.stream().collect(Collectors.toMap(KwsIntegration::getPartNames, KwsIntegration::getId));
|
|
|
|
|
- }
|
|
|
|
|
|
|
+// Map<String, Long> integrationMap = new HashMap<>(NumberConstant.SIXTEEN);
|
|
|
|
|
+// if (!org.springframework.util.CollectionUtils.isEmpty(integrations)) {
|
|
|
|
|
+// integrationMap = integrations.stream().collect(Collectors.toMap(KwsIntegration::getPartNames, KwsIntegration::getId));
|
|
|
|
|
+// }
|
|
|
//获取集成要素
|
|
//获取集成要素
|
|
|
List<DeviceIntegrationVo> intergData = new ArrayList<>();
|
|
List<DeviceIntegrationVo> intergData = new ArrayList<>();
|
|
|
String snCode = device.getSnCode();
|
|
String snCode = device.getSnCode();
|
|
@@ -207,10 +207,10 @@ public class MqttCallbackHandler extends AbstractHandler {
|
|
|
for (DeviceIntegrationVo deviceIntegration : intergData) {
|
|
for (DeviceIntegrationVo deviceIntegration : intergData) {
|
|
|
//获取到当前测量值--现在只有单一值
|
|
//获取到当前测量值--现在只有单一值
|
|
|
List<SlopeData> slopeData = slopeDataMapper.selectListByTwoLine(snCode, deviceIntegration.getPartNames());
|
|
List<SlopeData> slopeData = slopeDataMapper.selectListByTwoLine(snCode, deviceIntegration.getPartNames());
|
|
|
- if (!Objects.isNull(slopeData)) {
|
|
|
|
|
|
|
+ if (!Objects.isNull(slopeData) && slopeData.size() == 2) {
|
|
|
List<KwsThreshold> thresholdList = thresholdMapper.selectList(new LambdaQueryWrapper<KwsThreshold>()
|
|
List<KwsThreshold> thresholdList = thresholdMapper.selectList(new LambdaQueryWrapper<KwsThreshold>()
|
|
|
.eq(KwsThreshold::getDeviceId, device.getId())
|
|
.eq(KwsThreshold::getDeviceId, device.getId())
|
|
|
- .eq(KwsThreshold::getItemName, deviceIntegration.getPartNames())
|
|
|
|
|
|
|
+ .eq(KwsThreshold::getItemName, deviceIntegration.getIntegrationName())
|
|
|
);
|
|
);
|
|
|
double offset = commonService.returnIntegrationData(snCode, slopeData, deviceIntegration);
|
|
double offset = commonService.returnIntegrationData(snCode, slopeData, deviceIntegration);
|
|
|
Map<String, String> map = newAlarmCompute(new BigDecimal(offset), thresholdList);
|
|
Map<String, String> map = newAlarmCompute(new BigDecimal(offset), thresholdList);
|