From a42dda2bd3cc1cf8c20cc61e7ad9211eadecbaf3 Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期四, 24 二月 2022 16:55:06 +0800
Subject: [PATCH] 规范数据库,添加必要约束,优化通道批量导入功能

---
 src/main/java/com/genersoft/iot/vmp/gb28181/event/platformKeepaliveExpire/PlatformKeepaliveExpireEventLister.java |   20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/event/platformKeepaliveExpire/PlatformKeepaliveExpireEventLister.java b/src/main/java/com/genersoft/iot/vmp/gb28181/event/platformKeepaliveExpire/PlatformKeepaliveExpireEventLister.java
index a7c786e..0092657 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/event/platformKeepaliveExpire/PlatformKeepaliveExpireEventLister.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/event/platformKeepaliveExpire/PlatformKeepaliveExpireEventLister.java
@@ -2,7 +2,6 @@
 
 import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
 import com.genersoft.iot.vmp.gb28181.bean.ParentPlatformCatch;
-import com.genersoft.iot.vmp.gb28181.bean.PlatformRegister;
 import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
 import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
 import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
@@ -19,7 +18,7 @@
 import javax.sip.message.Response;
 
 /**
- * @Description: 骞冲彴蹇冭烦瓒呮椂浜嬩欢
+ * @description: 骞冲彴蹇冭烦瓒呮椂浜嬩欢
  * @author: panll
  * @date: 2020骞�11鏈�5鏃� 10:00
  */
@@ -50,21 +49,24 @@
         if (logger.isDebugEnabled()) {
             logger.debug("骞冲彴蹇冭烦鍒版湡浜嬩欢浜嬩欢瑙﹀彂锛屽钩鍙板浗鏍嘔D锛�" + event.getPlatformGbID());
         }
-        ParentPlatform parentPlatform = storager.queryParentPlatById(event.getPlatformGbID());
+        ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(event.getPlatformGbID());
         ParentPlatformCatch parentPlatformCatch = redisCatchStorage.queryPlatformCatchInfo(event.getPlatformGbID());
-        parentPlatformCatch.setParentPlatform(parentPlatform);
+        if (parentPlatformCatch == null) {
+            return;
+        }
         if (parentPlatform == null) {
             logger.debug("骞冲彴蹇冭烦鍒版湡浜嬩欢浜嬩欢瑙﹀彂锛屼絾骞冲彴宸茬粡鍒犻櫎!!! 骞冲彴鍥芥爣ID锛�" + event.getPlatformGbID());
             return;
         }
-        if (parentPlatformCatch == null) {
-            return;
-        }
+        parentPlatformCatch.setParentPlatform(parentPlatform);
         // 鍙戦�佸績璺�
         if (parentPlatformCatch.getKeepAliveReply() >= 3) {
             // 鏈�3娆℃湭鏀跺埌蹇冭烦鍥炲, 璁剧疆骞冲彴鐘舵�佷负绂荤嚎, 寮�濮嬮噸鏂版敞鍐�
             logger.warn("鏈�3娆℃湭鏀跺埌蹇冭烦鍥炲,鏍囪璁剧疆骞冲彴鐘舵�佷负绂荤嚎, 骞堕噸鏂版敞鍐� 骞冲彴鍥芥爣ID锛�" + event.getPlatformGbID());
+            storager.updateParentPlatformStatus(event.getPlatformGbID(), false);
             publisher.platformNotRegisterEventPublish(event.getPlatformGbID());
+            parentPlatformCatch.setKeepAliveReply(0);
+            redisCatchStorage.updatePlatformCatchInfo(parentPlatformCatch);
         }else {
             // 鍐嶆鍙戦�佸績璺�
             String callId = sipCommanderForPlatform.keepalive(parentPlatform);
@@ -74,8 +76,8 @@
             redisCatchStorage.updatePlatformKeepalive(parentPlatform);
             redisCatchStorage.updatePlatformCatchInfo(parentPlatformCatch);
 
-            sipSubscribe.addOkSubscribe(callId, (ResponseEvent responseEvent) ->{
-                if (responseEvent.getResponse().getStatusCode() == Response.OK) {
+            sipSubscribe.addOkSubscribe(callId, (SipSubscribe.EventResult eventResult) ->{
+                if (eventResult.statusCode == Response.OK) {
                     // 鏀跺埌蹇冭烦鍝嶅簲淇℃伅,
                     parentPlatformCatch.setKeepAliveReply(0);
                     redisCatchStorage.updatePlatformCatchInfo(parentPlatformCatch);

--
Gitblit v1.8.0