From 5cd509b644189bf6cfabbf0717e66998dd5ddcfe Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Thu, 2 Jan 2025 17:19:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=B9=B3=E5=8F=B0=E5=90=8D?= =?UTF-8?q?=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/genersoft/iot/vmp/gb28181/dao/PlatformMapper.java | 2 +- .../iot/vmp/gb28181/service/impl/PlatformServiceImpl.java | 3 ++- src/main/resources/配置详情.yml | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/PlatformMapper.java b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/PlatformMapper.java index cd245aa9..3d026ac2 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/PlatformMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/PlatformMapper.java @@ -93,7 +93,7 @@ public interface PlatformMapper { int updateStatus(@Param("platformGbID") String platformGbID, @Param("online") boolean online); @Select("SELECT server_id FROM wvp_platform WHERE enable=true and server_id != #{serverId} group by server_id") - List queryServerIdsWithEnable(@Param("serverId") String serverId); + List queryServerIdsWithEnableAndNotInServer(@Param("serverId") String serverId); @Select("SELECT * FROM wvp_platform WHERE server_id == #{serverId}") List queryByServerId(@Param("serverId") String serverId); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlatformServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlatformServiceImpl.java index 6542edd1..b8dfbc8d 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlatformServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlatformServiceImpl.java @@ -112,11 +112,12 @@ public class PlatformServiceImpl implements IPlatformService { return; } // 查找非平台的国标级联执行服务Id - List serverIds = platformMapper.queryServerIdsWithEnable(userSetting.getServerId()); + List serverIds = platformMapper.queryServerIdsWithEnableAndNotInServer(userSetting.getServerId()); if (serverIds == null || serverIds.isEmpty()) { return; } serverIds.forEach(serverId -> { + log.info("[集群] 检测到 {} 已离线", serverId); // 检查每个是否存活 ServerInfo serverInfo = redisCatchStorage.queryServerInfo(serverId); if (serverInfo == null && userSetting.getServerId().equals(redisCatchStorage.chooseOneServer())) { diff --git a/src/main/resources/配置详情.yml b/src/main/resources/配置详情.yml index b46b5eb7..c5749d09 100644 --- a/src/main/resources/配置详情.yml +++ b/src/main/resources/配置详情.yml @@ -255,6 +255,8 @@ user-settings: gb-device-online: 0 # 登录超时时间(分钟), login-timeout: 30 + # wvp集群模式下如果注册向上级的wvp奔溃,则自动选择一个其他wvp继续注册到上级 + auto-register-platform: true # 关闭在线文档(生产环境建议关闭) springdoc: