From 385fdb95f18c1f0b4e38f8a6e481176ac31ee987 Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期一, 17 一月 2022 15:48:08 +0800
Subject: [PATCH] 优化级联选择通道逻辑

---
 src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java
index 1efc614..1c8f191 100644
--- a/src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java
@@ -2,9 +2,13 @@
 
 import com.alibaba.fastjson.JSONObject;
 import com.genersoft.iot.vmp.common.StreamInfo;
+import com.genersoft.iot.vmp.conf.SipConfig;
 import com.genersoft.iot.vmp.conf.UserSetup;
+import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
 import com.genersoft.iot.vmp.gb28181.bean.GbStream;
 import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
+import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
+import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent;
 import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
 import com.genersoft.iot.vmp.media.zlm.ZLMServerConfig;
 import com.genersoft.iot.vmp.media.zlm.dto.MediaItem;
@@ -58,10 +62,16 @@
     private UserSetup userSetup;
 
     @Autowired
+    private SipConfig sipConfig;
+
+    @Autowired
     private GbStreamMapper gbStreamMapper;
 
     @Autowired
     private PlatformGbStreamMapper platformGbStreamMapper;
+
+    @Autowired
+    private EventPublisher eventPublisher;
 
     @Autowired
     private ParentPlatformMapper parentPlatformMapper;
@@ -146,6 +156,7 @@
                 StreamProxyItem streamProxyItems = platformGbStreamMapper.selectOne(param.getApp(), stream, parentPlatform.getServerGBId());
                 if (streamProxyItems == null) {
                     platformGbStreamMapper.add(param);
+                    eventPublisher.catalogEventPublishForStream(parentPlatform.getServerGBId(), param, CatalogEvent.ADD);
                 }
             }
         }
@@ -194,6 +205,7 @@
     public void del(String app, String stream) {
         StreamProxyItem streamProxyItem = videoManagerStorager.queryStreamProxy(app, stream);
         if (streamProxyItem != null) {
+            gbStreamService.sendCatalogMsg(streamProxyItem, CatalogEvent.DEL);
             videoManagerStorager.deleteStreamProxy(app, stream);
             JSONObject jsonObject = removeStreamProxyFromZlm(streamProxyItem);
             if (jsonObject != null && jsonObject.getInteger("code") == 0) {

--
Gitblit v1.8.0