From 12fa3b4c8da2af13a710400d64c9fe6d5d6b1e5e Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期三, 23 十一月 2022 09:57:17 +0800
Subject: [PATCH] Merge branch 'wvp-28181-2.0'

---
 src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java |   31 ++++++++++++++++++++++++++-----
 1 files changed, 26 insertions(+), 5 deletions(-)

diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java
index 3bd8aec..40b65c3 100644
--- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java
+++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java
@@ -10,8 +10,7 @@
 import com.genersoft.iot.vmp.gb28181.bean.PlatformCatalog;
 import com.genersoft.iot.vmp.gb28181.bean.SubscribeHolder;
 import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
-import com.genersoft.iot.vmp.service.IPlatformChannelService;
-import com.genersoft.iot.vmp.service.IPlatformService;
+import com.genersoft.iot.vmp.service.*;
 import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
 import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
 import com.genersoft.iot.vmp.utils.DateUtil;
@@ -71,6 +70,12 @@
 
 	@Autowired
 	private IPlatformService platformService;
+
+	@Autowired
+	private IDeviceChannelService deviceChannelService;
+
+	@Autowired
+	private IGbStreamService gbStreamService;
 
     /**
      * 鑾峰彇鍥芥爣鏈嶅姟鐨勯厤缃�
@@ -379,7 +384,16 @@
         if (logger.isDebugEnabled()) {
             logger.debug("缁欎笂绾у钩鍙版坊鍔犲浗鏍囬�氶亾API璋冪敤");
         }
-        int result = platformChannelService.updateChannelForGB(param.getPlatformId(), param.getChannelReduces(), param.getCatalogId());
+        int result = 0;
+        if (param.getChannelReduces() == null || param.getChannelReduces().size() == 0) {
+            if (param.isAll()) {
+                logger.info("[鍥芥爣绾ц仈]娣诲姞鎵�鏈夐�氶亾鍒颁笂绾у钩鍙帮紝 {}", param.getPlatformId());
+                List<ChannelReduce> allChannelForDevice = deviceChannelService.queryAllChannelList(param.getPlatformId());
+                result = platformChannelService.updateChannelForGB(param.getPlatformId(), allChannelForDevice, param.getCatalogId());
+            }
+        }else {
+            result = platformChannelService.updateChannelForGB(param.getPlatformId(), param.getChannelReduces(), param.getCatalogId());
+        }
         if (result <= 0) {
             throw new ControllerException(ErrorCode.ERROR100);
         }
@@ -399,8 +413,15 @@
         if (logger.isDebugEnabled()) {
             logger.debug("缁欎笂绾у钩鍙板垹闄ゅ浗鏍囬�氶亾API璋冪敤");
         }
-        int result = storager.delChannelForGB(param.getPlatformId(), param.getChannelReduces());
-
+        int result = 0;
+        if (param.getChannelReduces() == null || param.getChannelReduces().size() == 0) {
+            if (param.isAll()) {
+                logger.info("[鍥芥爣绾ц仈]绉婚櫎鎵�鏈夐�氶亾锛屼笂绾у钩鍙帮紝 {}", param.getPlatformId());
+                result = platformChannelService.delAllChannelForGB(param.getPlatformId(), param.getCatalogId());
+            }
+        }else {
+            result = storager.delChannelForGB(param.getPlatformId(), param.getChannelReduces());
+        }
         if (result <= 0) {
             throw new ControllerException(ErrorCode.ERROR100);
         }

--
Gitblit v1.8.0