[集群-自动切换过国标级联] 启动时自动注册上级只注册本平台的上级

dev/数据库统合
648540858 2025-01-02 16:30:02 +08:00
parent d022eb72d6
commit 91b0ba4d5e
5 changed files with 10 additions and 7 deletions

View File

@ -31,10 +31,13 @@ public class SipPlatformRunner implements CommandLineRunner {
@Autowired
private ISIPCommanderForPlatform sipCommanderForPlatform;
@Autowired
private UserSetting userSetting;
@Override
public void run(String... args) throws Exception {
// 获取所有启用的平台
List<Platform> parentPlatforms = platformService.queryEnablePlatformList();
List<Platform> parentPlatforms = platformService.queryEnablePlatformList(userSetting.getServerId());
for (Platform platform : parentPlatforms) {

View File

@ -77,8 +77,8 @@ public interface PlatformMapper {
" </script>")
List<Platform> queryList(@Param("query") String query);
@Select("SELECT * FROM wvp_platform WHERE enable=#{enable} ")
List<Platform> queryEnableParentPlatformList(boolean enable);
@Select("SELECT * FROM wvp_platform WHERE serverId=#{serverId} and enable=#{enable} ")
List<Platform> queryEnableParentPlatformList(@Param("serverId") String serverId, @Param("enable") boolean enable);
@Select("SELECT * FROM wvp_platform WHERE enable=true and as_message_channel=true")
List<Platform> queryEnablePlatformListWithAsMessageChannel();

View File

@ -82,7 +82,7 @@ public interface IPlatformService {
Platform queryOne(Integer platformId);
List<Platform> queryEnablePlatformList();
List<Platform> queryEnablePlatformList(String serverId);
void delete(Integer platformId, CommonCallback<Object> callback);
}

View File

@ -857,8 +857,8 @@ public class PlatformServiceImpl implements IPlatformService {
}
@Override
public List<Platform> queryEnablePlatformList() {
return platformMapper.queryEnableParentPlatformList(true);
public List<Platform> queryEnablePlatformList(String serverId) {
return platformMapper.queryEnableParentPlatformList(serverId,true);
}
@Override

View File

@ -105,7 +105,7 @@ public class RedisAlarmMsgListener implements MessageListener {
if (ObjectUtils.isEmpty(gbId)) {
if (userSetting.getSendToPlatformsWhenIdLost()) {
// 发送给所有的上级
List<Platform> parentPlatforms = platformService.queryEnablePlatformList();
List<Platform> parentPlatforms = platformService.queryEnablePlatformList(userSetting.getServerId());
if (!parentPlatforms.isEmpty()) {
for (Platform parentPlatform : parentPlatforms) {
try {