From d739bfa5976e36ced26f906ab16f83c20c8cb27c Mon Sep 17 00:00:00 2001
From: xiaoxie <hotcoffie@163.com>
Date: 星期一, 23 五月 2022 09:44:21 +0800
Subject: [PATCH] 处理冲突

---
 src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java |   34 +++++++++++++++++++++++-----------
 1 files changed, 23 insertions(+), 11 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 4f4d800..a3f1d6a 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
@@ -4,12 +4,13 @@
 import com.alibaba.fastjson.JSONObject;
 import com.genersoft.iot.vmp.common.VideoManagerConstants;
 import com.genersoft.iot.vmp.conf.DynamicTask;
-import com.genersoft.iot.vmp.conf.UserSetup;
+import com.genersoft.iot.vmp.conf.UserSetting;
 import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
 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.storager.IRedisCatchStorage;
-import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
+import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
 import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
 import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
 import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.UpdateChannelParam;
@@ -41,13 +42,16 @@
     private final static Logger logger = LoggerFactory.getLogger(PlatformController.class);
 
     @Autowired
-    private UserSetup userSetup;
+    private UserSetting userSetting;
 
     @Autowired
-    private IVideoManagerStorager storager;
+    private IVideoManagerStorage storager;
 
     @Autowired
     private IRedisCatchStorage redisCatchStorage;
+
+    @Autowired
+    private SubscribeHolder subscribeHolder;
 
     @Autowired
     private ISIPCommanderForPlatform commanderForPlatform;
@@ -110,10 +114,14 @@
     })
     public PageInfo<ParentPlatform> platforms(@PathVariable int page, @PathVariable int count) {
 
-//        if (logger.isDebugEnabled()) {
-//            logger.debug("鏌ヨ鎵�鏈変笂绾ц澶嘇PI璋冪敤");
-//        }
-        return storager.queryParentPlatformList(page, count);
+        PageInfo<ParentPlatform> parentPlatformPageInfo = storager.queryParentPlatformList(page, count);
+        if (parentPlatformPageInfo.getList().size() > 0) {
+            for (ParentPlatform platform : parentPlatformPageInfo.getList()) {
+                platform.setMobilePositionSubscribe(subscribeHolder.getMobilePositionSubscribe(platform.getServerGBId()) != null);
+                platform.setCatalogSubscribe(subscribeHolder.getCatalogSubscribe(platform.getServerGBId()) != null);
+            }
+        }
+        return parentPlatformPageInfo;
     }
 
     /**
@@ -222,6 +230,7 @@
             wvpResult.setMsg("missing parameters");
             return new ResponseEntity<>(wvpResult, HttpStatus.BAD_REQUEST);
         }
+        parentPlatform.setCharacterSet(parentPlatform.getCharacterSet().toUpperCase());
         ParentPlatform parentPlatformOld = storager.queryParentPlatByServerGBId(parentPlatform.getServerGBId());
 
         boolean updateResult = storager.updateParentPlatform(parentPlatform);
@@ -277,7 +286,9 @@
             return new ResponseEntity<>("missing parameters", HttpStatus.BAD_REQUEST);
         }
         ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(serverGBId);
-        if (parentPlatform == null) return new ResponseEntity<>("fail", HttpStatus.OK);
+        if (parentPlatform == null) {
+            return new ResponseEntity<>("fail", HttpStatus.OK);
+        }
         // 鍙戦�佺绾挎秷鎭�,鏃犺鏄惁鎴愬姛閮藉垹闄ょ紦瀛�
         commanderForPlatform.unregister(parentPlatform, (event -> {
             // 娓呯┖redis缂撳瓨
@@ -295,8 +306,10 @@
         storager.delCatalogByPlatformId(parentPlatform.getServerGBId());
         storager.delRelationByPlatformId(parentPlatform.getServerGBId());
         // 鍋滄鍙戦�佷綅缃闃呭畾鏃朵换鍔�
-        String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetup.getServerId() +  "_MobilePosition_" + parentPlatform.getServerGBId();
+        String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetting.getServerId() +  "_MobilePosition_" + parentPlatform.getServerGBId();
         dynamicTask.stop(key);
+        // 鍒犻櫎缂撳瓨鐨勮闃呬俊鎭�
+        subscribeHolder.removeAllSubscribe(parentPlatform.getServerGBId());
         if (deleteResult) {
             return new ResponseEntity<>("success", HttpStatus.OK);
         } else {
@@ -333,7 +346,6 @@
      * @param platformId  涓婄骇骞冲彴ID
      * @param query       鏌ヨ鍐呭
      * @param online      鏄惁鍦ㄧ嚎
-     * @param choosed     鏄惁宸查�変腑
      * @param channelType 閫氶亾绫诲瀷
      * @return
      */

--
Gitblit v1.8.0