Commit cb8011909063b330f5da6cdb03c2e329b97b18a2

Authored by 朱俊杰
1 parent b0e494b8

订阅查询错误和空指针

src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/catalog/CatalogEventLister.java
@@ -156,15 +156,17 @@ public class CatalogEventLister implements ApplicationListener<CatalogEvent> { @@ -156,15 +156,17 @@ public class CatalogEventLister implements ApplicationListener<CatalogEvent> {
156 List<ParentPlatform> parentPlatforms = parentPlatformMap.get(gbId); 156 List<ParentPlatform> parentPlatforms = parentPlatformMap.get(gbId);
157 if (parentPlatforms != null && parentPlatforms.size() > 0) { 157 if (parentPlatforms != null && parentPlatforms.size() > 0) {
158 for (ParentPlatform platform : parentPlatforms) { 158 for (ParentPlatform platform : parentPlatforms) {
159 - SubscribeInfo subscribeInfo = subscribeHolder.getCatalogSubscribe(event.getPlatformId()); 159 + SubscribeInfo subscribeInfo = subscribeHolder.getCatalogSubscribe(platform.getServerGBId());
160 if (subscribeInfo == null) continue; 160 if (subscribeInfo == null) continue;
161 logger.info("[Catalog事件: {}]平台:{},影响通道{}", event.getType(), platform.getServerGBId(), gbId); 161 logger.info("[Catalog事件: {}]平台:{},影响通道{}", event.getType(), platform.getServerGBId(), gbId);
162 List<DeviceChannel> deviceChannelList = new ArrayList<>(); 162 List<DeviceChannel> deviceChannelList = new ArrayList<>();
163 DeviceChannel deviceChannel = storager.queryChannelInParentPlatform(platform.getServerGBId(), gbId); 163 DeviceChannel deviceChannel = storager.queryChannelInParentPlatform(platform.getServerGBId(), gbId);
164 deviceChannelList.add(deviceChannel); 164 deviceChannelList.add(deviceChannel);
165 GbStream gbStream = storager.queryStreamInParentPlatform(platform.getServerGBId(), gbId); 165 GbStream gbStream = storager.queryStreamInParentPlatform(platform.getServerGBId(), gbId);
166 - DeviceChannel deviceChannelByStream = gbStreamService.getDeviceChannelListByStream(gbStream, gbStream.getCatalogId(), platform.getDeviceGBId());  
167 - deviceChannelList.add(deviceChannelByStream); 166 + if(gbStream != null){
  167 + DeviceChannel deviceChannelByStream = gbStreamService.getDeviceChannelListByStream(gbStream, gbStream.getCatalogId(), platform.getDeviceGBId());
  168 + deviceChannelList.add(deviceChannelByStream);
  169 + }
168 sipCommanderFroPlatform.sendNotifyForCatalogAddOrUpdate(event.getType(), platform, deviceChannelList, subscribeInfo, null); 170 sipCommanderFroPlatform.sendNotifyForCatalogAddOrUpdate(event.getType(), platform, deviceChannelList, subscribeInfo, null);
169 } 171 }
170 } 172 }