修复WVP作为下级平台接收设备告警消息后上报上级平台的问题

This commit is contained in:
gaofw189
2023-02-03 14:35:44 +08:00
parent e5b1876012
commit 40ece192fe
5 changed files with 27 additions and 28 deletions

View File

@@ -1,46 +1,28 @@
package com.genersoft.iot.vmp.gb28181.bean;
import lombok.Data;
/**
* 通过redis分发报警消息
*/
@Data
public class AlarmChannelMessage {
/**
* 国标编号
*/
private String gbId;
/**
* 报警编号
*/
private int alarmSn;
/**
* 告警类型
*/
private int alarmType;
/**
* 报警描述
*/
private String alarmDescription;
public String getGbId() {
return gbId;
}
public void setGbId(String gbId) {
this.gbId = gbId;
}
public int getAlarmSn() {
return alarmSn;
}
public void setAlarmSn(int alarmSn) {
this.alarmSn = alarmSn;
}
public String getAlarmDescription() {
return alarmDescription;
}
public void setAlarmDescription(String alarmDescription) {
this.alarmDescription = alarmDescription;
}
}

View File

@@ -37,4 +37,18 @@ public enum DeviceAlarmMethod {
public int getVal() {
return val;
}
/**
* 查询是否匹配类型
* @param code
* @return
*/
public static DeviceAlarmMethod typeOf(int code) {
for (DeviceAlarmMethod item : DeviceAlarmMethod.values()) {
if (code==item.getVal()) {
return item;
}
}
return null;
}
}

View File

@@ -181,11 +181,13 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme
}
}
logger.info("[收到报警通知]内容:{}", JSON.toJSONString(deviceAlarm));
if ("7".equals(deviceAlarm.getAlarmMethod()) ) {
if (DeviceAlarmMethod.typeOf(Integer.parseInt(deviceAlarm.getAlarmMethod())) !=null) {
// 发送给平台的报警信息。 发送redis通知
logger.info("[发送给平台的报警信息]内容:{}", JSONObject.toJSONString(deviceAlarm));
AlarmChannelMessage alarmChannelMessage = new AlarmChannelMessage();
alarmChannelMessage.setAlarmSn(Integer.parseInt(deviceAlarm.getAlarmMethod()));
alarmChannelMessage.setAlarmDescription(deviceAlarm.getAlarmDescription());
alarmChannelMessage.setAlarmType(Integer.parseInt(deviceAlarm.getAlarmType()));
alarmChannelMessage.setGbId(channelId);
redisCatchStorage.sendAlarmMsg(alarmChannelMessage);
continue;
@@ -264,6 +266,7 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme
alarmChannelMessage.setAlarmSn(Integer.parseInt(deviceAlarm.getAlarmMethod()));
alarmChannelMessage.setAlarmDescription(deviceAlarm.getAlarmDescription());
alarmChannelMessage.setGbId(channelId);
alarmChannelMessage.setAlarmType(Integer.parseInt(deviceAlarm.getAlarmType()));
redisCatchStorage.sendAlarmMsg(alarmChannelMessage);
return;
}