From c25a99d60bef3d3bbd59fee895bd658928fd00db Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期三, 10 一月 2024 16:17:29 +0800
Subject: [PATCH] 修复空指针异常

---
 src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 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
old mode 100644
new mode 100755
index e233d1b..870dee0
--- 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
@@ -7,6 +7,7 @@
 import com.genersoft.iot.vmp.conf.UserSetting;
 import com.genersoft.iot.vmp.conf.exception.ControllerException;
 import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
+import com.genersoft.iot.vmp.gb28181.bean.ParentPlatformCatch;
 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;
@@ -229,12 +230,16 @@
             throw new ControllerException(ErrorCode.ERROR400);
         }
         ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(serverGBId);
+        ParentPlatformCatch parentPlatformCatch = redisCatchStorage.queryPlatformCatchInfo(serverGBId);
         if (parentPlatform == null) {
+            throw new ControllerException(ErrorCode.ERROR100.getCode(), "骞冲彴涓嶅瓨鍦�");
+        }
+        if (parentPlatformCatch == null) {
             throw new ControllerException(ErrorCode.ERROR100.getCode(), "骞冲彴涓嶅瓨鍦�");
         }
         // 鍙戦�佺绾挎秷鎭�,鏃犺鏄惁鎴愬姛閮藉垹闄ょ紦瀛�
         try {
-            commanderForPlatform.unregister(parentPlatform, (event -> {
+            commanderForPlatform.unregister(parentPlatform, parentPlatformCatch.getSipTransactionInfo(), (event -> {
                 // 娓呯┖redis缂撳瓨
                 redisCatchStorage.delPlatformCatchInfo(parentPlatform.getServerGBId());
                 redisCatchStorage.delPlatformKeepalive(parentPlatform.getServerGBId());
@@ -398,8 +403,12 @@
         if (platform == null) {
             throw new ControllerException(ErrorCode.ERROR100.getCode(), "骞冲彴鏈壘鍒�");
         }
-        if (platformId.equals(parentId)) {
-            parentId = platform.getDeviceGBId();
+//        if (platformId.equals(parentId)) {
+//            parentId = platform.getDeviceGBId();
+//        }
+
+        if (platformId.equals(platform.getDeviceGBId())) {
+            parentId = null;
         }
 
         return storager.getChildrenCatalogByPlatform(platformId, parentId);
@@ -419,7 +428,7 @@
         if (logger.isDebugEnabled()) {
             logger.debug("娣诲姞鐩綍,{}", JSON.toJSONString(platformCatalog));
         }
-        PlatformCatalog platformCatalogInStore = storager.getCatalog(platformCatalog.getId());
+        PlatformCatalog platformCatalogInStore = storager.getCatalog(platformCatalog.getPlatformId(), platformCatalog.getId());
 
         if (platformCatalogInStore != null) {
             throw new ControllerException(ErrorCode.ERROR100.getCode(), platformCatalog.getId() + " already exists");
@@ -444,7 +453,7 @@
         if (logger.isDebugEnabled()) {
             logger.debug("缂栬緫鐩綍,{}", JSON.toJSONString(platformCatalog));
         }
-        PlatformCatalog platformCatalogInStore = storager.getCatalog(platformCatalog.getId());
+        PlatformCatalog platformCatalogInStore = storager.getCatalog(platformCatalog.getPlatformId(), platformCatalog.getId());
 
         if (platformCatalogInStore == null) {
             throw new ControllerException(ErrorCode.ERROR100.getCode(), platformCatalog.getId() + " not exists");
@@ -477,7 +486,7 @@
             throw new ControllerException(ErrorCode.ERROR400);
         }
 
-        int delResult = storager.delCatalog(id);
+        int delResult = storager.delCatalog(platformId, id);
         // 濡傛灉鍒犻櫎鐨勬槸榛樿鐩綍鍒欐牴鐩綍璁剧疆涓洪粯璁ょ洰褰�
         PlatformCatalog parentPlatform = storager.queryDefaultCatalogInPlatform(platformId);
 

--
Gitblit v1.8.0