From 3436e73e720b5a15cf038369a88f2e99c1ad17f5 Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期二, 30 一月 2024 10:55:41 +0800
Subject: [PATCH] 修复云端录像时间显示错误
---
src/main/java/com/genersoft/iot/vmp/service/impl/PlatformServiceImpl.java | 41 ++++++++++++++++++++++++++---------------
1 files changed, 26 insertions(+), 15 deletions(-)
diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/PlatformServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/PlatformServiceImpl.java
index b67fcc5..26ebd70 100755
--- a/src/main/java/com/genersoft/iot/vmp/service/impl/PlatformServiceImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/service/impl/PlatformServiceImpl.java
@@ -1,5 +1,6 @@
package com.genersoft.iot.vmp.service.impl;
+import com.baomidou.dynamic.datasource.annotation.DS;
import com.genersoft.iot.vmp.conf.DynamicTask;
import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.gb28181.bean.*;
@@ -38,6 +39,7 @@
* @author lin
*/
@Service
+@DS("master")
public class PlatformServiceImpl implements IPlatformService {
private final static String REGISTER_KEY_PREFIX = "platform_register_";
@@ -149,7 +151,7 @@
dynamicTask.stop(registerTaskKey);
// 娉ㄩ攢鏃х殑
try {
- if (parentPlatformOld.isStatus()) {
+ if (parentPlatformOld.isStatus() && parentPlatformCatchOld != null) {
logger.info("淇濆瓨骞冲彴{}鏃跺彂鐜版棫骞冲彴鍦ㄧ嚎锛屽彂閫佹敞閿�鍛戒护", parentPlatformOld.getServerGBId());
commanderForPlatform.unregister(parentPlatformOld, parentPlatformCatchOld.getSipTransactionInfo(), null, eventResult -> {
logger.info("[鍥芥爣绾ц仈] 娉ㄩ攢鎴愬姛锛� 骞冲彴锛歿}", parentPlatformOld.getServerGBId());
@@ -233,18 +235,19 @@
try {
commanderForPlatform.keepalive(parentPlatform, eventResult -> {
// 蹇冭烦澶辫触
- if (eventResult.type == SipSubscribe.EventResultType.timeout) {
- // 蹇冭烦瓒呮椂
- ParentPlatformCatch platformCatch = redisCatchStorage.queryPlatformCatchInfo(parentPlatform.getServerGBId());
- // 姝ゆ椂鏄涓夋蹇冭烦瓒呮椂锛� 骞冲彴绂荤嚎
- if (platformCatch.getKeepAliveReply() == 2) {
- // 璁剧疆骞冲彴绂荤嚎锛屽苟閲嶆柊娉ㄥ唽
- logger.info("[鍥芥爣绾ц仈] 涓夋蹇冭烦瓒呮椂, 骞冲彴{}({})绂荤嚎", parentPlatform.getName(), parentPlatform.getServerGBId());
- offline(parentPlatform, false);
- }
-
- }else {
+ if (eventResult.type != SipSubscribe.EventResultType.timeout) {
logger.warn("[鍥芥爣绾ц仈]鍙戦�佸績璺虫敹鍒伴敊璇紝code锛� {}, msg: {}", eventResult.statusCode, eventResult.msg);
+ }
+ // 蹇冭烦澶辫触
+ ParentPlatformCatch platformCatch = redisCatchStorage.queryPlatformCatchInfo(parentPlatform.getServerGBId());
+ // 姝ゆ椂鏄涓夋蹇冭烦瓒呮椂锛� 骞冲彴绂荤嚎
+ if (platformCatch.getKeepAliveReply() == 2) {
+ // 璁剧疆骞冲彴绂荤嚎锛屽苟閲嶆柊娉ㄥ唽
+ logger.info("[鍥芥爣绾ц仈] 涓夋蹇冭烦澶辫触, 骞冲彴{}({})绂荤嚎", parentPlatform.getName(), parentPlatform.getServerGBId());
+ offline(parentPlatform, false);
+ }else {
+ platformCatch.setKeepAliveReply(platformCatch.getKeepAliveReply() + 1);
+ redisCatchStorage.updatePlatformCatchInfo(platformCatch);
}
}, eventResult -> {
@@ -265,6 +268,7 @@
}
if (parentPlatform.isAutoPushChannel()) {
if (subscribeHolder.getCatalogSubscribe(parentPlatform.getServerGBId()) == null) {
+ logger.info("[鍥芥爣绾ц仈]锛歿}, 娣诲姞鑷姩閫氶亾鎺ㄩ�佹ā鎷熻闃呬俊鎭�", parentPlatform.getServerGBId());
addSimulatedSubscribeInfo(parentPlatform);
}
}else {
@@ -342,9 +346,16 @@
// 娓呴櫎蹇冭烦浠诲姟
dynamicTask.stop(keepaliveTaskKey);
}
- // 鍋滄鐩綍璁㈤槄鍥炲
- logger.info("[骞冲彴绂荤嚎] {}, 鍋滄璁㈤槄鍥炲", parentPlatform.getServerGBId());
- subscribeHolder.removeAllSubscribe(parentPlatform.getServerGBId());
+ // 鍋滄璁㈤槄鍥炲
+ SubscribeInfo catalogSubscribe = subscribeHolder.getCatalogSubscribe(parentPlatform.getServerGBId());
+ if (catalogSubscribe != null) {
+ if (catalogSubscribe.getExpires() > 0) {
+ logger.info("[骞冲彴绂荤嚎] {}, 鍋滄鐩綍璁㈤槄鍥炲", parentPlatform.getServerGBId());
+ subscribeHolder.removeCatalogSubscribe(parentPlatform.getServerGBId());
+ }
+ }
+ logger.info("[骞冲彴绂荤嚎] {}, 鍋滄绉诲姩浣嶇疆璁㈤槄鍥炲", parentPlatform.getServerGBId());
+ subscribeHolder.removeMobilePositionSubscribe(parentPlatform.getServerGBId());
// 鍙戣捣瀹氭椂鑷姩閲嶆柊娉ㄥ唽
if (!stopRegister) {
// 璁剧疆涓�60绉掕嚜鍔ㄥ皾璇曢噸鏂版敞鍐�
--
Gitblit v1.8.0