From e8090bc84c04d929c750338df26aa2bf86e1efc8 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Wed, 19 Jan 2022 10:23:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug=E4=B8=8E=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E8=AE=A2=E9=98=85=E6=B7=BB=E5=8A=A0=E6=9C=80=E5=B0=8F?= =?UTF-8?q?=E5=80=BC60?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../subscribe/catalog/CatalogEventLister.java | 7 +++++-- .../gb28181/transmit/cmd/impl/SIPCommander.java | 5 ++++- .../cmd/impl/SIPCommanderFroPlatform.java | 13 +++++-------- .../vmp/service/bean/CatalogSubscribeTask.java | 16 ++-------------- .../impl/StreamPushUploadFileHandler.java | 17 +++++++++++++++++ .../vmanager/gb28181/device/DeviceQuery.java | 3 ++- web_src/src/components/dialog/deviceEdit.vue | 6 +++--- 7 files changed, 38 insertions(+), 29 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 9c3f6946..a3523fd6 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 @@ -62,6 +62,7 @@ public class CatalogEventLister implements ApplicationListener { 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 platforms = redisCatchStorage.getAllSubscribePlatform(); @@ -107,9 +108,10 @@ public class CatalogEventLister implements ApplicationListener { List 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 deviceChannelList = new ArrayList<>(); DeviceChannel deviceChannel = new DeviceChannel(); deviceChannel.setChannelId(gbId); @@ -146,9 +148,10 @@ public class CatalogEventLister implements ApplicationListener { List 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 deviceChannelList = new ArrayList<>(); DeviceChannel deviceChannel = storager.queryChannelInParentPlatform(platform.getServerGBId(), gbId); deviceChannelList.add(deviceChannel); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java index 285a8175..cb4cbd74 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java @@ -1498,7 +1498,10 @@ public class SIPCommander implements ISIPCommander { CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId() : udpSipProvider.getNewCallId(); - Request request = headerProvider.createSubscribeRequest(device, cmdXml.toString(), "z9hG4bK-viaPos-" + tm, "fromTagPos" + tm, null, device.getSubscribeCycleForCatalog(), "Catalog" , callIdHeader); + // 有效时间默认为60秒以上 + Request request = headerProvider.createSubscribeRequest(device, cmdXml.toString(), "z9hG4bK-viaPos-" + tm, + "fromTagPos" + tm, null, device.getSubscribeCycleForCatalog() + 60, "Catalog" , + callIdHeader); transmitRequest(device, request, errorEvent, okEvent); return true; diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java index 4216bb88..e15853db 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java @@ -370,10 +370,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { @Override public boolean sendNotifyForCatalogAddOrUpdate(String type, ParentPlatform parentPlatform, List deviceChannels, SubscribeInfo subscribeInfo) { - if (parentPlatform == null) { - return false; - } - if (deviceChannels == null || deviceChannels.size() == 0) { + if (parentPlatform == null || deviceChannels == null || deviceChannels.size() == 0 || subscribeInfo == null) { return false; } for (DeviceChannel channel : deviceChannels) { @@ -431,10 +428,10 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { @Override public boolean sendNotifyForCatalogOther(String type, ParentPlatform parentPlatform, List deviceChannels, SubscribeInfo subscribeInfo) { - if (parentPlatform == null) { - return false; - } - if (deviceChannels == null || deviceChannels.size() == 0) { + if (parentPlatform == null + || deviceChannels == null + || deviceChannels.size() == 0 + || subscribeInfo == null) { return false; } diff --git a/src/main/java/com/genersoft/iot/vmp/service/bean/CatalogSubscribeTask.java b/src/main/java/com/genersoft/iot/vmp/service/bean/CatalogSubscribeTask.java index cfaef712..cb027c82 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/bean/CatalogSubscribeTask.java +++ b/src/main/java/com/genersoft/iot/vmp/service/bean/CatalogSubscribeTask.java @@ -26,20 +26,8 @@ public class CatalogSubscribeTask implements Runnable{ ResponseEvent event = (ResponseEvent) eventResult.event; Element rootElement = null; if (event.getResponse().getRawContent() != null) { - try { - rootElement = XmlUtil.getRootElement(event.getResponse().getRawContent(), "gb2312"); - } catch (DocumentException e) { - e.printStackTrace(); - } - Element resultElement = rootElement.element("Result"); - String result = resultElement.getText(); - if (result.toUpperCase().equals("OK")){ - // 成功 - logger.info("[目录订阅]成功: {}", device.getDeviceId()); - }else { - // 失败 - logger.info("[目录订阅]失败: {}-{}", device.getDeviceId(), result); - } + // 成功 + logger.info("[目录订阅]成功: {}", device.getDeviceId()); }else { // 成功 logger.info("[目录订阅]成功: {}", device.getDeviceId()); diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushUploadFileHandler.java b/src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushUploadFileHandler.java index d440e4dd..a68f5e9b 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushUploadFileHandler.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushUploadFileHandler.java @@ -5,15 +5,20 @@ import com.alibaba.excel.event.AnalysisEventListener; import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; import com.genersoft.iot.vmp.service.IStreamPushService; import com.genersoft.iot.vmp.vmanager.bean.StreamPushExcelDto; +import org.springframework.util.StringUtils; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; +import java.util.Set; public class StreamPushUploadFileHandler extends AnalysisEventListener { private IStreamPushService pushService; private String defaultMediaServerId; private List streamPushItems = new ArrayList<>(); + private Set streamPushStreamSet = new HashSet<>(); + private Set streamPushGBSet = new HashSet<>(); public StreamPushUploadFileHandler(IStreamPushService pushService, String defaultMediaServerId) { this.pushService = pushService; @@ -22,6 +27,14 @@ public class StreamPushUploadFileHandler extends AnalysisEventListener 300) { pushService.batchAdd(streamPushItems); // 存储完成清理 list @@ -46,5 +61,7 @@ public class StreamPushUploadFileHandler extends AnalysisEventListener 0) { + if ((deviceInStore.getSubscribeCycleForCatalog() <=0 && device.getSubscribeCycleForCatalog() > 0) + || deviceInStore.getSubscribeCycleForCatalog() != device.getSubscribeCycleForCatalog()) { deviceInStore.setSubscribeCycleForCatalog(device.getSubscribeCycleForCatalog()); // 开启订阅 deviceService.addCatalogSubscribe(deviceInStore); diff --git a/web_src/src/components/dialog/deviceEdit.vue b/web_src/src/components/dialog/deviceEdit.vue index 7b8e58cf..4f868511 100644 --- a/web_src/src/components/dialog/deviceEdit.vue +++ b/web_src/src/components/dialog/deviceEdit.vue @@ -10,7 +10,7 @@ @close="close()" >
- + @@ -36,8 +36,8 @@ - - + +