[集群-自动切换过国标级联] 添加数据库脚本

This commit is contained in:
648540858
2025-01-02 14:29:13 +08:00
parent 3331a7d931
commit 884fcb827f
10 changed files with 78 additions and 17 deletions

View File

@@ -1,6 +1,7 @@
package com.genersoft.iot.vmp.storager;
import com.alibaba.fastjson2.JSONObject;
import com.genersoft.iot.vmp.common.ServerInfo;
import com.genersoft.iot.vmp.common.SystemAllInfo;
import com.genersoft.iot.vmp.gb28181.bean.*;
import com.genersoft.iot.vmp.media.bean.MediaInfo;
@@ -37,7 +38,7 @@ public interface IRedisCatchStorage {
/**
* 在redis添加wvp的信息
*/
void updateWVPInfo(JSONObject jsonObject, int time);
void updateWVPInfo(ServerInfo serverInfo, int time);
/**
* 发送推流生成与推流消失消息
@@ -187,4 +188,6 @@ public interface IRedisCatchStorage {
void sendStartSendRtp(SendRtpInfo sendRtpItem);
void sendPushStreamOnline(SendRtpInfo sendRtpItem);
ServerInfo queryServerInfo(String serverId);
}

View File

@@ -2,9 +2,9 @@ package com.genersoft.iot.vmp.storager.impl;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.genersoft.iot.vmp.common.ServerInfo;
import com.genersoft.iot.vmp.common.SystemAllInfo;
import com.genersoft.iot.vmp.common.VideoManagerConstants;
import com.genersoft.iot.vmp.common.enums.ChannelDataType;
import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.gb28181.bean.*;
import com.genersoft.iot.vmp.gb28181.dao.DeviceChannelMapper;
@@ -110,10 +110,11 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
@Override
public void updateWVPInfo(JSONObject jsonObject, int time) {
public void updateWVPInfo(ServerInfo serverInfo, int time) {
String key = VideoManagerConstants.WVP_SERVER_PREFIX + userSetting.getServerId();
Duration duration = Duration.ofSeconds(time);
redisTemplate.opsForValue().set(key, jsonObject, duration);
redisTemplate.opsForValue().set(key, serverInfo, duration);
//
}
@Override
@@ -533,4 +534,10 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
log.info("[redis发送通知] 流上线 {}: {}/{}->{}", key, sendRtpItem.getApp(), sendRtpItem.getStream(), sendRtpItem.getTargetId());
redisTemplate.convertAndSend(key, JSON.toJSON(sendRtpItem));
}
@Override
public ServerInfo queryServerInfo(String serverId) {
String key = VideoManagerConstants.WVP_SERVER_PREFIX + serverId;
return (ServerInfo)redisTemplate.opsForValue().get(key);
}
}