From 41616f726dafafe7c015bf4f3e02a7aa9488a3a2 Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期一, 07 三月 2022 10:47:06 +0800
Subject: [PATCH] 修复导入通道时无平台关联时的bug

---
 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/response/impl/RegisterResponseProcessor.java |   23 +++++++++++------------
 1 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/response/impl/RegisterResponseProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/response/impl/RegisterResponseProcessor.java
index a5dced3..ffac1d0 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/response/impl/RegisterResponseProcessor.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/response/impl/RegisterResponseProcessor.java
@@ -78,26 +78,25 @@
 
 		if (response.getStatusCode() == 401) {
 			WWWAuthenticateHeader www = (WWWAuthenticateHeader)response.getHeader(WWWAuthenticateHeader.NAME);
-			sipCommanderForPlatform.register(parentPlatform, callId, www, null, null);
+			sipCommanderForPlatform.register(parentPlatform, callId, www, null, null, true);
 		}else if (response.getStatusCode() == 200){
 			// 娉ㄥ唽/娉ㄩ攢鎴愬姛
 			logger.info(String.format("%s %s鎴愬姛", platformGBId, action));
 			redisCatchStorage.delPlatformRegisterInfo(callId);
 			parentPlatform.setStatus("娉ㄥ唽".equals(action));
 			// 鍙栧洖Expires璁剧疆锛岄伩鍏嶆敞閿�杩囩▼涓缃负0
-			ParentPlatform parentPlatformTmp = storager.queryParentPlatByServerGBId(platformGBId);
-			String expires = parentPlatformTmp.getExpires();
-			parentPlatform.setExpires(expires);
-			parentPlatform.setId(parentPlatformTmp.getId());
+			if (!parentPlatformCatch.getParentPlatform().getExpires().equals("0")) {
+				ParentPlatform parentPlatformTmp = storager.queryParentPlatByServerGBId(platformGBId);
+				String expires = parentPlatformTmp.getExpires();
+				parentPlatform.setExpires(expires);
+				parentPlatform.setId(parentPlatformTmp.getId());
+				redisCatchStorage.updatePlatformRegister(parentPlatform);
+				redisCatchStorage.updatePlatformKeepalive(parentPlatform);
+				parentPlatformCatch.setParentPlatform(parentPlatform);
+				redisCatchStorage.updatePlatformCatchInfo(parentPlatformCatch);
+			}
 			storager.updateParentPlatformStatus(platformGBId, "娉ㄥ唽".equals(action));
 
-			redisCatchStorage.updatePlatformRegister(parentPlatform);
-
-			redisCatchStorage.updatePlatformKeepalive(parentPlatform);
-
-			parentPlatformCatch.setParentPlatform(parentPlatform);
-
-			redisCatchStorage.updatePlatformCatchInfo(parentPlatformCatch);
 		}
 	}
 

--
Gitblit v1.8.0