From 1b200bcc904d088b31ceaf1e9261b5433d9322a6 Mon Sep 17 00:00:00 2001 From: Lawrence <1934378145@qq.com> Date: 星期五, 15 一月 2021 00:00:45 +0800 Subject: [PATCH] 将上级平台标识改为serverGBId --- src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java | 61 ++++++++++++++++++++++++------ 1 files changed, 48 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java b/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java index cebb30b..63abc80 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java @@ -4,6 +4,9 @@ import com.genersoft.iot.vmp.common.VideoManagerConstants; import com.genersoft.iot.vmp.conf.MediaServerConfig; import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; +import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; +import com.genersoft.iot.vmp.gb28181.bean.ParentPlatformCatch; +import com.genersoft.iot.vmp.gb28181.bean.PlatformRegister; import com.genersoft.iot.vmp.storager.IRedisCatchStorage; import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper; import com.genersoft.iot.vmp.utils.redis.RedisUtil; @@ -32,7 +35,7 @@ */ @Override public boolean startPlay(StreamInfo stream) { - return redis.set(String.format("%S_%s_%s_%s", VideoManagerConstants.PLAYER_PREFIX, stream.getStreamId(),stream.getDeviceID(), stream.getCahnnelId()), + return redis.set(String.format("%S_%s_%s_%s", VideoManagerConstants.PLAYER_PREFIX, stream.getStreamId(),stream.getDeviceID(), stream.getChannelId()), stream); } @@ -44,16 +47,10 @@ @Override public boolean stopPlay(StreamInfo streamInfo) { if (streamInfo == null) return false; - DeviceChannel deviceChannel = deviceChannelMapper.queryChannel(streamInfo.getDeviceID(), streamInfo.getCahnnelId()); - if (deviceChannel != null) { - deviceChannel.setStreamId(null); - deviceChannel.setDeviceId(streamInfo.getDeviceID()); - deviceChannelMapper.update(deviceChannel); - } return redis.del(String.format("%S_%s_%s_%s", VideoManagerConstants.PLAYER_PREFIX, streamInfo.getStreamId(), streamInfo.getDeviceID(), - streamInfo.getCahnnelId())); + streamInfo.getChannelId())); } /** @@ -66,7 +63,7 @@ VideoManagerConstants.PLAYER_PREFIX, streamInfo.getStreamId(), streamInfo.getDeviceID(), - streamInfo.getCahnnelId())); + streamInfo.getChannelId())); } @Override public StreamInfo queryPlayByStreamId(String steamId) { @@ -120,7 +117,7 @@ for (int i = 0; i < players.size(); i++) { String key = (String) players.get(i); StreamInfo streamInfo = (StreamInfo)redis.get(key); - streamInfos.put(streamInfo.getDeviceID() + "_" + streamInfo.getCahnnelId(), streamInfo); + streamInfos.put(streamInfo.getDeviceID() + "_" + streamInfo.getChannelId(), streamInfo); } return streamInfos; } @@ -128,7 +125,7 @@ @Override public boolean startPlayback(StreamInfo stream) { - return redis.set(String.format("%S_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX, stream.getStreamId(),stream.getDeviceID(), stream.getCahnnelId()), + return redis.set(String.format("%S_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX, stream.getStreamId(),stream.getDeviceID(), stream.getChannelId()), stream); } @@ -136,7 +133,7 @@ @Override public boolean stopPlayback(StreamInfo streamInfo) { if (streamInfo == null) return false; - DeviceChannel deviceChannel = deviceChannelMapper.queryChannel(streamInfo.getDeviceID(), streamInfo.getCahnnelId()); + DeviceChannel deviceChannel = deviceChannelMapper.queryChannel(streamInfo.getDeviceID(), streamInfo.getChannelId()); if (deviceChannel != null) { deviceChannel.setStreamId(null); deviceChannel.setDeviceId(streamInfo.getDeviceID()); @@ -145,7 +142,7 @@ return redis.del(String.format("%S_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX, streamInfo.getStreamId(), streamInfo.getDeviceID(), - streamInfo.getCahnnelId())); + streamInfo.getChannelId())); } @Override @@ -163,4 +160,42 @@ if (playLeys == null || playLeys.size() == 0) return null; return (StreamInfo)redis.get(playLeys.get(0).toString()); } + + @Override + public void updatePlatformCatchInfo(ParentPlatformCatch parentPlatformCatch) { + String key = VideoManagerConstants.PLATFORM_CATCH_PREFIX + parentPlatformCatch.getId(); + redis.set(key, parentPlatformCatch); + } + + @Override + public void updatePlatformKeepalive(ParentPlatform parentPlatform) { + String key = VideoManagerConstants.PLATFORM_KEEPLIVEKEY_PREFIX + parentPlatform.getDeviceGBId(); + redis.set(key, "", Integer.parseInt(parentPlatform.getKeepTimeout())); + } + + @Override + public void updatePlatformRegister(ParentPlatform parentPlatform) { + String key = VideoManagerConstants.PLATFORM_REGISTER_PREFIX + parentPlatform.getDeviceGBId(); + redis.set(key, "", Integer.parseInt(parentPlatform.getExpires())); + } + + @Override + public ParentPlatformCatch queryPlatformCatchInfo(String platformGbId) { + return (ParentPlatformCatch)redis.get(VideoManagerConstants.PLATFORM_CATCH_PREFIX + platformGbId); + } + + @Override + public void delPlatformCatchInfo(String platformGbId) { + redis.del(VideoManagerConstants.PLATFORM_CATCH_PREFIX + platformGbId); + } + + @Override + public void delPlatformKeepalive(String platformGbId) { + redis.del(VideoManagerConstants.PLATFORM_KEEPLIVEKEY_PREFIX + platformGbId); + } + + @Override + public void delPlatformRegister(String platformGbId) { + redis.del(VideoManagerConstants.PLATFORM_REGISTER_PREFIX + platformGbId); + } } -- Gitblit v1.8.0