From a42dda2bd3cc1cf8c20cc61e7ad9211eadecbaf3 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期四, 24 二月 2022 16:55:06 +0800 Subject: [PATCH] 规范数据库,添加必要约束,优化通道批量导入功能 --- src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/catalog/CatalogEventLister.java | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/catalog/CatalogEventLister.java b/src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/catalog/CatalogEventLister.java index 9c3f694..997031b 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/catalog/CatalogEventLister.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/catalog/CatalogEventLister.java @@ -18,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationListener; import org.springframework.stereotype.Component; +import org.springframework.util.StringUtils; import java.util.*; @@ -62,6 +63,7 @@ if (!parentPlatform.isStatus())return; String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetup.getServerId() + "_Catalog_" + event.getPlatformId(); subscribe = redisCatchStorage.getSubscribe(key); + if (subscribe == null) return; }else { // 鑾峰彇鎵�鐢ㄨ闃� List<String> platforms = redisCatchStorage.getAllSubscribePlatform(); @@ -75,12 +77,12 @@ }else if (event.getGbStreams() != null) { if (platforms.size() > 0) { for (GbStream gbStream : event.getGbStreams()) { + if (gbStream == null || StringUtils.isEmpty(gbStream.getGbId())) continue; List<ParentPlatform> parentPlatformsForGB = storager.queryPlatFormListForStreamWithGBId(gbStream.getApp(),gbStream.getStream(), platforms); parentPlatformMap.put(gbStream.getGbId(), parentPlatformsForGB); } } } - } switch (event.getType()) { case CatalogEvent.ON: @@ -92,7 +94,7 @@ if (event.getDeviceChannels() != null) { deviceChannelList.addAll(event.getDeviceChannels()); } - if (event.getGbStreams() != null && event.getGbStreams().size() > 0){ + if (event.getGbStreams() != null && event.getGbStreams().length > 0){ for (GbStream gbStream : event.getGbStreams()) { DeviceChannel deviceChannelByStream = gbStreamService.getDeviceChannelListByStream(gbStream, gbStream.getCatalogId(), parentPlatform.getDeviceGBId()); deviceChannelList.add(deviceChannelByStream); @@ -107,9 +109,10 @@ List<ParentPlatform> parentPlatforms = parentPlatformMap.get(gbId); if (parentPlatforms != null && parentPlatforms.size() > 0) { for (ParentPlatform platform : parentPlatforms) { - logger.info("[Catalog浜嬩欢: {}]骞冲彴锛歿}锛屽奖鍝嶉�氶亾{}", event.getType(), platform.getServerGBId(), gbId); String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetup.getServerId() + "_Catalog_" + platform.getServerGBId(); SubscribeInfo subscribeInfo = redisCatchStorage.getSubscribe(key); + if (subscribeInfo == null) continue; + logger.info("[Catalog浜嬩欢: {}]骞冲彴锛歿}锛屽奖鍝嶉�氶亾{}", event.getType(), platform.getServerGBId(), gbId); List<DeviceChannel> deviceChannelList = new ArrayList<>(); DeviceChannel deviceChannel = new DeviceChannel(); deviceChannel.setChannelId(gbId); @@ -131,7 +134,7 @@ if (event.getDeviceChannels() != null) { deviceChannelList.addAll(event.getDeviceChannels()); } - if (event.getGbStreams() != null && event.getGbStreams().size() > 0){ + if (event.getGbStreams() != null && event.getGbStreams().length > 0){ for (GbStream gbStream : event.getGbStreams()) { DeviceChannel deviceChannelByStream = gbStreamService.getDeviceChannelListByStream(gbStream, gbStream.getCatalogId(), parentPlatform.getDeviceGBId()); deviceChannelList.add(deviceChannelByStream); @@ -146,9 +149,10 @@ List<ParentPlatform> parentPlatforms = parentPlatformMap.get(gbId); if (parentPlatforms != null && parentPlatforms.size() > 0) { for (ParentPlatform platform : parentPlatforms) { - logger.info("[Catalog浜嬩欢: {}]骞冲彴锛歿}锛屽奖鍝嶉�氶亾{}", event.getType(), platform.getServerGBId(), gbId); String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetup.getServerId() + "_Catalog_" + platform.getServerGBId(); SubscribeInfo subscribeInfo = redisCatchStorage.getSubscribe(key); + if (subscribeInfo == null) continue; + logger.info("[Catalog浜嬩欢: {}]骞冲彴锛歿}锛屽奖鍝嶉�氶亾{}", event.getType(), platform.getServerGBId(), gbId); List<DeviceChannel> deviceChannelList = new ArrayList<>(); DeviceChannel deviceChannel = storager.queryChannelInParentPlatform(platform.getServerGBId(), gbId); deviceChannelList.add(deviceChannel); -- Gitblit v1.8.0