Commit f98791b9 authored by maoying's avatar maoying

修改告警消息推送逻辑

parent 0246d8e9
...@@ -282,7 +282,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -282,7 +282,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
} }
static void upAlarmLogStatus(String iotCode, String equipmentSpecificIndexKey, IEquipmentSpecificAlarmLogService equipmentSpecificAlarmLogService) { public List<EquipmentSpecificAlarmLog> upAlarmLogStatus(String iotCode, String equipmentSpecificIndexKey, IEquipmentSpecificAlarmLogService equipmentSpecificAlarmLogService) {
LambdaQueryWrapper<EquipmentSpecificAlarmLog> queryWrapper = new LambdaQueryWrapper(); LambdaQueryWrapper<EquipmentSpecificAlarmLog> queryWrapper = new LambdaQueryWrapper();
queryWrapper.eq(EquipmentSpecificAlarmLog::getIotCode, iotCode); queryWrapper.eq(EquipmentSpecificAlarmLog::getIotCode, iotCode);
queryWrapper.eq(EquipmentSpecificAlarmLog::getEquipmentSpecificIndexKey, equipmentSpecificIndexKey); queryWrapper.eq(EquipmentSpecificAlarmLog::getEquipmentSpecificIndexKey, equipmentSpecificIndexKey);
...@@ -295,6 +295,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -295,6 +295,7 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
if (!logs.isEmpty()) { if (!logs.isEmpty()) {
equipmentSpecificAlarmLogService.updateBatchById(logs); equipmentSpecificAlarmLogService.updateBatchById(logs);
} }
return logs;
} }
public void publishDataToCanvas(List<EquipmentSpecificIndex> indexList) { public void publishDataToCanvas(List<EquipmentSpecificIndex> indexList) {
...@@ -723,16 +724,13 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -723,16 +724,13 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
} }
mqttSendGateway.sendToMqtt(TopicEnum.EQDQR.getTopic(), JSONArray.toJSON(action).toString()); mqttSendGateway.sendToMqtt(TopicEnum.EQDQR.getTopic(), JSONArray.toJSON(action).toString());
} else { } else {
upAlarmLogStatus(action.getIotCode(), action.getEquipmentSpecificIndexKey(), equipmentSpecificAlarmLogService); equipmentAlarmLogs.addAll(upAlarmLogStatus(action.getIotCode(), action.getEquipmentSpecificIndexKey(), equipmentSpecificAlarmLogService));
mqttSendGateway.sendToMqtt(TopicEnum.EQYQR.getTopic(), JSONArray.toJSON(action).toString()); mqttSendGateway.sendToMqtt(TopicEnum.EQYQR.getTopic(), JSONArray.toJSON(action).toString());
bool = Boolean.TRUE; bool = Boolean.TRUE;
} }
}); });
if(ObjectUtils.isEmpty(equipmentAlarmLogs)){
return;
}
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() { TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
@Override @Override
public void afterCommit() { public void afterCommit() {
...@@ -770,7 +768,9 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -770,7 +768,9 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
} }
// 向南瑞平台推送报警消息 // 向南瑞平台推送报警消息
syncDataService.syncCreatedSendAlarm(equipmentAlarmLogs); if(!bool){
syncDataService.syncCreatedSendAlarm(equipmentAlarmLogs);
}
} }
} }
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment