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 2  
3 3 import com.genersoft.iot.vmp.conf.CivilCodeFileConf;
4 4 import com.genersoft.iot.vmp.conf.DynamicTask;
  5 +import com.genersoft.iot.vmp.conf.SipConfig;
5 6 import com.genersoft.iot.vmp.conf.UserSetting;
6 7 import com.genersoft.iot.vmp.gb28181.bean.Device;
7 8 import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
... ... @@ -63,6 +64,9 @@ public class NotifyRequestForCatalogProcessor extends SIPRequestProcessorParent
63 64 @Autowired
64 65 private CivilCodeFileConf civilCodeFileConf;
65 66  
  67 + @Autowired
  68 + private SipConfig sipConfig;
  69 +
66 70 private final static String talkKey = "notify-request-for-catalog-task";
67 71  
68 72 public void process(RequestEvent evt) {
... ... @@ -104,7 +108,13 @@ public class NotifyRequestForCatalogProcessor extends SIPRequestProcessorParent
104 108 event = eventElement.getText().toUpperCase();
105 109 }
106 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 118 channel.setDeviceId(device.getDeviceId());
109 119 logger.info("[收到目录订阅]:{}/{}", device.getDeviceId(), channel.getChannelId());
110 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 413 event = eventElement.getText().toUpperCase();
414 414 }
415 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 423 channel.setDeviceId(device.getDeviceId());
417 424 logger.info("[收到目录订阅]:{}/{}", device.getDeviceId(), channel.getChannelId());
418 425 switch (event) {
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/CatalogResponseMessageHandler.java
1 1 package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd;
2 2  
3 3 import com.genersoft.iot.vmp.conf.CivilCodeFileConf;
  4 +import com.genersoft.iot.vmp.conf.SipConfig;
4 5 import com.genersoft.iot.vmp.gb28181.bean.*;
5 6 import com.genersoft.iot.vmp.gb28181.session.CatalogDataCatch;
6 7 import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
... ... @@ -57,6 +58,9 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp
57 58 @Autowired
58 59 private CivilCodeFileConf civilCodeFileConf;
59 60  
  61 + @Autowired
  62 + private SipConfig sipConfig;
  63 +
60 64 @Override
61 65 public void afterPropertiesSet() throws Exception {
62 66 responseMessageHandler.addHandler(cmdType, this);
... ... @@ -113,7 +117,14 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp
113 117 continue;
114 118 }
115 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 128 deviceChannel.setDeviceId(take.getDevice().getDeviceId());
118 129  
119 130 channelList.add(deviceChannel);
... ...