Commit 18ad50222f2dcc6d3a3dd5ba129724aa18d7bd52

Authored by 648540858
1 parent 2d4bbbea

优化更新通道中父结点的判断

src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestForCatalogProcessor.java
@@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl; @@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl;
2 2
3 import com.genersoft.iot.vmp.conf.CivilCodeFileConf; 3 import com.genersoft.iot.vmp.conf.CivilCodeFileConf;
4 import com.genersoft.iot.vmp.conf.DynamicTask; 4 import com.genersoft.iot.vmp.conf.DynamicTask;
  5 +import com.genersoft.iot.vmp.conf.SipConfig;
5 import com.genersoft.iot.vmp.conf.UserSetting; 6 import com.genersoft.iot.vmp.conf.UserSetting;
6 import com.genersoft.iot.vmp.gb28181.bean.Device; 7 import com.genersoft.iot.vmp.gb28181.bean.Device;
7 import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; 8 import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
@@ -63,6 +64,9 @@ public class NotifyRequestForCatalogProcessor extends SIPRequestProcessorParent @@ -63,6 +64,9 @@ public class NotifyRequestForCatalogProcessor extends SIPRequestProcessorParent
63 @Autowired 64 @Autowired
64 private CivilCodeFileConf civilCodeFileConf; 65 private CivilCodeFileConf civilCodeFileConf;
65 66
  67 + @Autowired
  68 + private SipConfig sipConfig;
  69 +
66 private final static String talkKey = "notify-request-for-catalog-task"; 70 private final static String talkKey = "notify-request-for-catalog-task";
67 71
68 public void process(RequestEvent evt) { 72 public void process(RequestEvent evt) {
@@ -104,7 +108,13 @@ public class NotifyRequestForCatalogProcessor extends SIPRequestProcessorParent @@ -104,7 +108,13 @@ public class NotifyRequestForCatalogProcessor extends SIPRequestProcessorParent
104 event = eventElement.getText().toUpperCase(); 108 event = eventElement.getText().toUpperCase();
105 } 109 }
106 DeviceChannel channel = XmlUtil.channelContentHandler(itemDevice, device, event, civilCodeFileConf); 110 DeviceChannel channel = XmlUtil.channelContentHandler(itemDevice, device, event, civilCodeFileConf);
107 - 111 + if (channel == null) {
  112 + logger.info("[收到目录订阅]:但是解析失败 {}", new String(evt.getRequest().getRawContent()));
  113 + continue;
  114 + }
  115 + if (channel.getParentId().equals(sipConfig.getId())) {
  116 + channel.setParentId(null);
  117 + }
108 channel.setDeviceId(device.getDeviceId()); 118 channel.setDeviceId(device.getDeviceId());
109 logger.info("[收到目录订阅]:{}/{}", device.getDeviceId(), channel.getChannelId()); 119 logger.info("[收到目录订阅]:{}/{}", device.getDeviceId(), channel.getChannelId());
110 switch (event) { 120 switch (event) {
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java
@@ -413,6 +413,13 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements @@ -413,6 +413,13 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements
413 event = eventElement.getText().toUpperCase(); 413 event = eventElement.getText().toUpperCase();
414 } 414 }
415 DeviceChannel channel = XmlUtil.channelContentHandler(itemDevice, device, event, civilCodeFileConf); 415 DeviceChannel channel = XmlUtil.channelContentHandler(itemDevice, device, event, civilCodeFileConf);
  416 + if (channel == null) {
  417 + logger.info("[收到目录订阅]:但是解析失败 {}", new String(evt.getRequest().getRawContent()));
  418 + continue;
  419 + }
  420 + if (channel.getParentId().equals(sipConfig.getId())) {
  421 + channel.setParentId(null);
  422 + }
416 channel.setDeviceId(device.getDeviceId()); 423 channel.setDeviceId(device.getDeviceId());
417 logger.info("[收到目录订阅]:{}/{}", device.getDeviceId(), channel.getChannelId()); 424 logger.info("[收到目录订阅]:{}/{}", device.getDeviceId(), channel.getChannelId());
418 switch (event) { 425 switch (event) {
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/CatalogResponseMessageHandler.java
1 package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd; 1 package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd;
2 2
3 import com.genersoft.iot.vmp.conf.CivilCodeFileConf; 3 import com.genersoft.iot.vmp.conf.CivilCodeFileConf;
  4 +import com.genersoft.iot.vmp.conf.SipConfig;
4 import com.genersoft.iot.vmp.gb28181.bean.*; 5 import com.genersoft.iot.vmp.gb28181.bean.*;
5 import com.genersoft.iot.vmp.gb28181.session.CatalogDataCatch; 6 import com.genersoft.iot.vmp.gb28181.session.CatalogDataCatch;
6 import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; 7 import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
@@ -57,6 +58,9 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp @@ -57,6 +58,9 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp
57 @Autowired 58 @Autowired
58 private CivilCodeFileConf civilCodeFileConf; 59 private CivilCodeFileConf civilCodeFileConf;
59 60
  61 + @Autowired
  62 + private SipConfig sipConfig;
  63 +
60 @Override 64 @Override
61 public void afterPropertiesSet() throws Exception { 65 public void afterPropertiesSet() throws Exception {
62 responseMessageHandler.addHandler(cmdType, this); 66 responseMessageHandler.addHandler(cmdType, this);
@@ -113,7 +117,14 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp @@ -113,7 +117,14 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp
113 continue; 117 continue;
114 } 118 }
115 DeviceChannel deviceChannel = XmlUtil.channelContentHandler(itemDevice, device, null, civilCodeFileConf); 119 DeviceChannel deviceChannel = XmlUtil.channelContentHandler(itemDevice, device, null, civilCodeFileConf);
116 - deviceChannel = SipUtils.updateGps(deviceChannel, device.getGeoCoordSys()); 120 + if (deviceChannel == null) {
  121 + logger.info("[收到目录订阅]:但是解析失败 {}", new String(evt.getRequest().getRawContent()));
  122 + continue;
  123 + }
  124 + if (deviceChannel.getParentId().equals(sipConfig.getId())) {
  125 + deviceChannel.setParentId(null);
  126 + }
  127 + SipUtils.updateGps(deviceChannel, device.getGeoCoordSys());
117 deviceChannel.setDeviceId(take.getDevice().getDeviceId()); 128 deviceChannel.setDeviceId(take.getDevice().getDeviceId());
118 129
119 channelList.add(deviceChannel); 130 channelList.add(deviceChannel);