Commit 782300452cdc5ff9a8d02f0488fbb76d9d3fc92c

Authored by 648540858
1 parent d3027b06

优化对海康平台的兼容性

src/main/java/com/genersoft/iot/vmp/conf/UserSetting.java
@@ -50,6 +50,8 @@ public class UserSetting { @@ -50,6 +50,8 @@ public class UserSetting {
50 private Boolean sipLog = Boolean.FALSE; 50 private Boolean sipLog = Boolean.FALSE;
51 private Boolean sendToPlatformsWhenIdLost = Boolean.FALSE; 51 private Boolean sendToPlatformsWhenIdLost = Boolean.FALSE;
52 52
  53 + private Boolean refuseChannelStatusChannelFormNotify = Boolean.FALSE;
  54 +
53 private String serverId = "000000"; 55 private String serverId = "000000";
54 56
55 private String thirdPartyGBIdReg = "[\\s\\S]*"; 57 private String thirdPartyGBIdReg = "[\\s\\S]*";
@@ -237,4 +239,14 @@ public class UserSetting { @@ -237,4 +239,14 @@ public class UserSetting {
237 public void setSendToPlatformsWhenIdLost(Boolean sendToPlatformsWhenIdLost) { 239 public void setSendToPlatformsWhenIdLost(Boolean sendToPlatformsWhenIdLost) {
238 this.sendToPlatformsWhenIdLost = sendToPlatformsWhenIdLost; 240 this.sendToPlatformsWhenIdLost = sendToPlatformsWhenIdLost;
239 } 241 }
  242 +
  243 + public Boolean getRefuseChannelStatusChannelFormNotify() {
  244 + return refuseChannelStatusChannelFormNotify;
  245 + }
  246 +
  247 + public void setRefuseChannelStatusChannelFormNotify(Boolean refuseChannelStatusChannelFormNotify) {
  248 + this.refuseChannelStatusChannelFormNotify = refuseChannelStatusChannelFormNotify;
  249 + }
  250 +
  251 +
240 } 252 }
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java
@@ -393,12 +393,20 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements @@ -393,12 +393,20 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements
393 case CatalogEvent.OFF : 393 case CatalogEvent.OFF :
394 // 离线 394 // 离线
395 logger.info("[收到通道离线通知] 来自设备: {}, 通道 {}", device.getDeviceId(), channel.getChannelId()); 395 logger.info("[收到通道离线通知] 来自设备: {}, 通道 {}", device.getDeviceId(), channel.getChannelId());
396 - storager.deviceChannelOffline(deviceId, channel.getChannelId()); 396 + if (userSetting.getRefuseChannelStatusChannelFormNotify()) {
  397 + storager.deviceChannelOffline(deviceId, channel.getChannelId());
  398 + }else {
  399 + logger.info("[收到通道离线通知] 但是平台已配置拒绝此消息,来自设备: {}, 通道 {}", device.getDeviceId(), channel.getChannelId());
  400 + }
397 break; 401 break;
398 case CatalogEvent.VLOST: 402 case CatalogEvent.VLOST:
399 // 视频丢失 403 // 视频丢失
400 logger.info("[收到通道视频丢失通知] 来自设备: {}, 通道 {}", device.getDeviceId(), channel.getChannelId()); 404 logger.info("[收到通道视频丢失通知] 来自设备: {}, 通道 {}", device.getDeviceId(), channel.getChannelId());
401 - storager.deviceChannelOffline(deviceId, channel.getChannelId()); 405 + if (userSetting.getRefuseChannelStatusChannelFormNotify()) {
  406 + storager.deviceChannelOffline(deviceId, channel.getChannelId());
  407 + }else {
  408 + logger.info("[收到通道视频丢失通知] 但是平台已配置拒绝此消息,来自设备: {}, 通道 {}", device.getDeviceId(), channel.getChannelId());
  409 + }
402 break; 410 break;
403 case CatalogEvent.DEFECT: 411 case CatalogEvent.DEFECT:
404 // 故障 412 // 故障
src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
@@ -857,6 +857,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { @@ -857,6 +857,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
857 857
858 @Override 858 @Override
859 public void sendAlarmMsg(AlarmChannelMessage msg) { 859 public void sendAlarmMsg(AlarmChannelMessage msg) {
  860 + // 此消息用于对接第三方服务下级来的消息内容
860 String key = VideoManagerConstants.VM_MSG_SUBSCRIBE_ALARM; 861 String key = VideoManagerConstants.VM_MSG_SUBSCRIBE_ALARM;
861 logger.info("[redis发送通知] 报警{}: {}", key, JSON.toJSON(msg)); 862 logger.info("[redis发送通知] 报警{}: {}", key, JSON.toJSON(msg));
862 RedisUtil.convertAndSend(key, (JSONObject)JSON.toJSON(msg)); 863 RedisUtil.convertAndSend(key, (JSONObject)JSON.toJSON(msg));
src/main/resources/all-application.yml
@@ -201,6 +201,8 @@ user-settings: @@ -201,6 +201,8 @@ user-settings:
201 sip-log: true 201 sip-log: true
202 # 消息通道功能-缺少国标ID是否给所有上级发送消息 202 # 消息通道功能-缺少国标ID是否给所有上级发送消息
203 send-to-platforms-when-id-lost: true 203 send-to-platforms-when-id-lost: true
  204 + # 保持通道状态,不接受notify通道状态变化, 兼容海康平台发送错误消息
  205 + refuse-channel-status-channel-form-notify: false
204 # 跨域配置,配置你访问前端页面的地址即可, 可以配置多个 206 # 跨域配置,配置你访问前端页面的地址即可, 可以配置多个
205 allowed-origins: 207 allowed-origins:
206 - http://localhost:8008 208 - http://localhost:8008