去除对redis key过期事件的使用;重构国标级联的注册保活

This commit is contained in:
648540858
2022-08-31 11:29:13 +08:00
parent d47902bdca
commit 2de4c322f6
45 changed files with 513 additions and 693 deletions

View File

@@ -8,6 +8,7 @@ import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
import com.genersoft.iot.vmp.service.bean.MessageForPushChannel;
import com.genersoft.iot.vmp.service.bean.SSRCInfo;
import com.genersoft.iot.vmp.service.bean.ThirdPartyGB;
import com.genersoft.iot.vmp.storager.dao.dto.PlatformRegisterInfo;
import java.util.List;
import java.util.Map;
@@ -61,17 +62,13 @@ public interface IRedisCatchStorage {
void delPlatformCatchInfo(String platformGbId);
void updatePlatformKeepalive(ParentPlatform parentPlatform);
void delPlatformKeepalive(String platformGbId);
void updatePlatformRegister(ParentPlatform parentPlatform);
void delPlatformRegister(String platformGbId);
void updatePlatformRegisterInfo(String callId, String platformGbId);
void updatePlatformRegisterInfo(String callId, PlatformRegisterInfo platformRegisterInfo);
String queryPlatformRegisterInfo(String callId);
PlatformRegisterInfo queryPlatformRegisterInfo(String callId);
void delPlatformRegisterInfo(String callId);

View File

@@ -170,15 +170,6 @@ public interface IVideoManagerStorage {
*/
boolean deleteParentPlatform(ParentPlatform parentPlatform);
/**
* 分页获取上级平台
* @param page
* @param count
* @return
*/
PageInfo<ParentPlatform> queryParentPlatformList(int page, int count);
/**
* 获取所有已启用的平台
* @return

View File

@@ -0,0 +1,41 @@
package com.genersoft.iot.vmp.storager.dao.dto;
/**
* 平台发送注册/注销消息时缓存此消息
* @author lin
*/
public class PlatformRegisterInfo {
/**
* 平台Id
*/
private String platformId;
/**
* 是否时注册false为注销
*/
private boolean register;
public static PlatformRegisterInfo getInstance(String platformId, boolean register) {
PlatformRegisterInfo platformRegisterInfo = new PlatformRegisterInfo();
platformRegisterInfo.setPlatformId(platformId);
platformRegisterInfo.setRegister(register);
return platformRegisterInfo;
}
public String getPlatformId() {
return platformId;
}
public void setPlatformId(String platformId) {
this.platformId = platformId;
}
public boolean isRegister() {
return register;
}
public void setRegister(boolean register) {
this.register = register;
}
}

View File

@@ -16,6 +16,7 @@ import com.genersoft.iot.vmp.service.bean.MessageForPushChannel;
import com.genersoft.iot.vmp.service.bean.ThirdPartyGB;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper;
import com.genersoft.iot.vmp.storager.dao.dto.PlatformRegisterInfo;
import com.genersoft.iot.vmp.utils.DateUtil;
import com.genersoft.iot.vmp.utils.redis.RedisUtil;
import org.slf4j.Logger;
@@ -290,18 +291,6 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
RedisUtil.set(key, parentPlatformCatch);
}
@Override
public void updatePlatformKeepalive(ParentPlatform parentPlatform) {
String key = VideoManagerConstants.PLATFORM_KEEPALIVE_PREFIX + userSetting.getServerId() + "_" + parentPlatform.getServerGBId();
RedisUtil.set(key, "", Integer.parseInt(parentPlatform.getKeepTimeout()));
}
@Override
public void updatePlatformRegister(ParentPlatform parentPlatform) {
String key = VideoManagerConstants.PLATFORM_REGISTER_PREFIX + userSetting.getServerId() + "_" + parentPlatform.getServerGBId();
RedisUtil.set(key, "", Integer.parseInt(parentPlatform.getExpires()));
}
@Override
public ParentPlatformCatch queryPlatformCatchInfo(String platformGbId) {
return (ParentPlatformCatch)RedisUtil.get(VideoManagerConstants.PLATFORM_CATCH_PREFIX + userSetting.getServerId() + "_" + platformGbId);
@@ -324,15 +313,15 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
@Override
public void updatePlatformRegisterInfo(String callId, String platformGbId) {
public void updatePlatformRegisterInfo(String callId, PlatformRegisterInfo platformRegisterInfo) {
String key = VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetting.getServerId() + "_" + callId;
RedisUtil.set(key, platformGbId, 30);
RedisUtil.set(key, platformRegisterInfo, 30);
}
@Override
public String queryPlatformRegisterInfo(String callId) {
return (String)RedisUtil.get(VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetting.getServerId() + "_" + callId);
public PlatformRegisterInfo queryPlatformRegisterInfo(String callId) {
return (PlatformRegisterInfo)RedisUtil.get(VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetting.getServerId() + "_" + callId);
}
@Override

View File

@@ -457,13 +457,6 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
return result > 0;
}
@Override
public PageInfo<ParentPlatform> queryParentPlatformList(int page, int count) {
PageHelper.startPage(page, count);
List<ParentPlatform> all = platformMapper.getParentPlatformList();
return new PageInfo<>(all);
}
@Override
public ParentPlatform queryParentPlatByServerGBId(String platformGbId) {
return platformMapper.getParentPlatByServerGBId(platformGbId);