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

pull/741/head
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;
}

View File

@ -67,9 +67,9 @@ public class RedisAlarmMsgListener implements MessageListener {
deviceAlarm.setChannelId(gbId);
deviceAlarm.setAlarmDescription(alarmChannelMessage.getAlarmDescription());
deviceAlarm.setAlarmMethod("" + alarmChannelMessage.getAlarmSn());
deviceAlarm.setAlarmType("" + alarmChannelMessage.getAlarmType());
deviceAlarm.setAlarmPriority("1");
deviceAlarm.setAlarmTime(DateUtil.getNowForISO8601());
deviceAlarm.setAlarmType("1");
deviceAlarm.setLongitude(0);
deviceAlarm.setLatitude(0);

View File

@ -827,7 +827,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
@Override
public void sendAlarmMsg(AlarmChannelMessage msg) {
String key = VideoManagerConstants.VM_MSG_SUBSCRIBE_ALARM;
String key = VideoManagerConstants.VM_MSG_SUBSCRIBE_ALARM_RECEIVE;
logger.info("[redis发送通知] 报警{}: {}", key, JSON.toJSON(msg));
RedisUtil.convertAndSend(key, (JSONObject)JSON.toJSON(msg));
}