|
@@ -13,6 +13,7 @@ import com.persagy.cache.CreatedAlarmIdsCache;
|
|
|
import com.persagy.client.GroupNettyClient;
|
|
|
import com.persagy.entity.*;
|
|
|
import com.persagy.entity.v2.AlarmCondition;
|
|
|
+import com.persagy.entity.v2.DmpMessage;
|
|
|
import com.persagy.entity.v2.ItemCodeCondition;
|
|
|
import com.persagy.entity.v2.ObjConditionInfo;
|
|
|
import com.persagy.enumeration.NettyMsgTypeEnum;
|
|
@@ -212,7 +213,6 @@ public class AlarmHandleServiceImpl implements AlarmHandleService {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
synchronized (alarmDefine.getId().intern()) {
|
|
|
|
|
|
|
|
@@ -469,9 +469,8 @@ public class AlarmHandleServiceImpl implements AlarmHandleService {
|
|
|
* @since: 2021/2/7 10:03 上午
|
|
|
* @version: V1.0
|
|
|
*/
|
|
|
- private NettyMessage<AlarmRecord> sendAlarmRecoverMessage(
|
|
|
- String projectId, String recoverTime, HashMap<String, Object> paramMap, String alarmId)
|
|
|
- throws InterruptedException {
|
|
|
+ private void sendAlarmRecoverMessage(
|
|
|
+ String projectId, String recoverTime, HashMap<String, Object> paramMap, String alarmId) {
|
|
|
|
|
|
AlarmRecord alarmRecoverRecord = AlarmRecord.builder()
|
|
|
.state(2)
|
|
@@ -481,11 +480,14 @@ public class AlarmHandleServiceImpl implements AlarmHandleService {
|
|
|
.endInfo(JSONObject.toJSONString(paramMap))
|
|
|
.build();
|
|
|
alarmRecoverRecord.setId(alarmId);
|
|
|
- NettyMessage<AlarmRecord> nettyMessage = new NettyMessage<>(
|
|
|
- NettyMsgTypeEnum.UPDATE_RECORD_STATE, projectId);
|
|
|
- nettyMessage.setContent(Collections.singletonList(alarmRecoverRecord));
|
|
|
- groupNettyClient.sendMessage(nettyMessage.toString());
|
|
|
- return nettyMessage;
|
|
|
+
|
|
|
+ DmpMessage dmpMessage = new DmpMessage();
|
|
|
+ dmpMessage.setDefaultValue();
|
|
|
+ dmpMessage.setMid(alarmId);
|
|
|
+ dmpMessage.setProjectId(projectId);
|
|
|
+ dmpMessage.setGroupCode(groupCode);
|
|
|
+ dmpMessage.setExts(JSONObject.parseObject(JSONObject.toJSONString(alarmRecoverRecord)));
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
@@ -603,6 +605,7 @@ public class AlarmHandleServiceImpl implements AlarmHandleService {
|
|
|
long lastTime = DateUtils.betweenTwoTimeSecond(alarmStartTime, dataTime);
|
|
|
String alarmId = alarmRecordRepository.findById(defineId).orElse(new ZktAlarmRecordDO()).getAlarmId();
|
|
|
if (StringUtils.isNotBlank(alarmId)) {
|
|
|
+
|
|
|
alarmLastTimeCache.put(alarmId, Integer.valueOf(String.valueOf(lastTime)));
|
|
|
log.debug("开始拼装报警持续消息");
|
|
|
initAlarmContinueMsg(alarmId, lastTime, paramMap, alarmDefine.getProjectId());
|
|
@@ -807,10 +810,12 @@ public class AlarmHandleServiceImpl implements AlarmHandleService {
|
|
|
.createUser(systemId)
|
|
|
.treatState(1)
|
|
|
.build();
|
|
|
- NettyMessage<AlarmRecord> nettyMessage = new NettyMessage<>(
|
|
|
- NettyMsgTypeEnum.CREATE_RECORD, alarmDefine.getProjectId());
|
|
|
- nettyMessage.setContent(Collections.singletonList(alarmRecord));
|
|
|
-
|
|
|
- groupNettyClient.sendMessage(nettyMessage.toString());
|
|
|
+ DmpMessage dmpMessage = new DmpMessage();
|
|
|
+ dmpMessage.setDefaultValue();
|
|
|
+ dmpMessage.setMid(alarmId);
|
|
|
+ dmpMessage.setProjectId(alarmDefine.getProjectId());
|
|
|
+ dmpMessage.setGroupCode(groupCode);
|
|
|
+ dmpMessage.setExts(JSONObject.parseObject(JSONObject.toJSONString(alarmRecord)));
|
|
|
+
|
|
|
}
|
|
|
}
|