From 782300452cdc5ff9a8d02f0488fbb76d9d3fc92c Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Fri, 17 Mar 2023 17:08:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=AF=B9=E6=B5=B7=E5=BA=B7?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E7=9A=84=E5=85=BC=E5=AE=B9=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/genersoft/iot/vmp/conf/UserSetting.java | 12 ++++++++++++ .../event/request/impl/NotifyRequestProcessor.java | 12 ++++++++++-- .../iot/vmp/storager/impl/RedisCatchStorageImpl.java | 1 + src/main/resources/all-application.yml | 2 ++ 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/conf/UserSetting.java b/src/main/java/com/genersoft/iot/vmp/conf/UserSetting.java index 130d147d..d72d255b 100644 --- a/src/main/java/com/genersoft/iot/vmp/conf/UserSetting.java +++ b/src/main/java/com/genersoft/iot/vmp/conf/UserSetting.java @@ -50,6 +50,8 @@ public class UserSetting { private Boolean sipLog = Boolean.FALSE; private Boolean sendToPlatformsWhenIdLost = Boolean.FALSE; + private Boolean refuseChannelStatusChannelFormNotify = Boolean.FALSE; + private String serverId = "000000"; private String thirdPartyGBIdReg = "[\\s\\S]*"; @@ -237,4 +239,14 @@ public class UserSetting { public void setSendToPlatformsWhenIdLost(Boolean sendToPlatformsWhenIdLost) { this.sendToPlatformsWhenIdLost = sendToPlatformsWhenIdLost; } + + public Boolean getRefuseChannelStatusChannelFormNotify() { + return refuseChannelStatusChannelFormNotify; + } + + public void setRefuseChannelStatusChannelFormNotify(Boolean refuseChannelStatusChannelFormNotify) { + this.refuseChannelStatusChannelFormNotify = refuseChannelStatusChannelFormNotify; + } + + } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java index 7366f300..990da3a0 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java @@ -393,12 +393,20 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements case CatalogEvent.OFF : // 离线 logger.info("[收到通道离线通知] 来自设备: {}, 通道 {}", device.getDeviceId(), channel.getChannelId()); - storager.deviceChannelOffline(deviceId, channel.getChannelId()); + if (userSetting.getRefuseChannelStatusChannelFormNotify()) { + storager.deviceChannelOffline(deviceId, channel.getChannelId()); + }else { + logger.info("[收到通道离线通知] 但是平台已配置拒绝此消息,来自设备: {}, 通道 {}", device.getDeviceId(), channel.getChannelId()); + } break; case CatalogEvent.VLOST: // 视频丢失 logger.info("[收到通道视频丢失通知] 来自设备: {}, 通道 {}", device.getDeviceId(), channel.getChannelId()); - storager.deviceChannelOffline(deviceId, channel.getChannelId()); + if (userSetting.getRefuseChannelStatusChannelFormNotify()) { + storager.deviceChannelOffline(deviceId, channel.getChannelId()); + }else { + logger.info("[收到通道视频丢失通知] 但是平台已配置拒绝此消息,来自设备: {}, 通道 {}", device.getDeviceId(), channel.getChannelId()); + } break; case CatalogEvent.DEFECT: // 故障 diff --git a/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java b/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java index f9e0c068..8902641c 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java @@ -857,6 +857,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { @Override public void sendAlarmMsg(AlarmChannelMessage msg) { + // 此消息用于对接第三方服务下级来的消息内容 String key = VideoManagerConstants.VM_MSG_SUBSCRIBE_ALARM; logger.info("[redis发送通知] 报警{}: {}", key, JSON.toJSON(msg)); RedisUtil.convertAndSend(key, (JSONObject)JSON.toJSON(msg)); diff --git a/src/main/resources/all-application.yml b/src/main/resources/all-application.yml index 8b9b7b03..8bc4d957 100644 --- a/src/main/resources/all-application.yml +++ b/src/main/resources/all-application.yml @@ -201,6 +201,8 @@ user-settings: sip-log: true # 消息通道功能-缺少国标ID是否给所有上级发送消息 send-to-platforms-when-id-lost: true + # 保持通道状态,不接受notify通道状态变化, 兼容海康平台发送错误消息 + refuse-channel-status-channel-form-notify: false # 跨域配置,配置你访问前端页面的地址即可, 可以配置多个 allowed-origins: - http://localhost:8008