|
@ -1,16 +1,16 @@ |
|
|
package com.genersoft.iot.vmp.storager.impl; |
|
|
package com.genersoft.iot.vmp.storager.impl; |
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.genersoft.iot.vmp.common.StreamInfo; |
|
|
import com.genersoft.iot.vmp.common.StreamInfo; |
|
|
import com.genersoft.iot.vmp.common.SystemInfoDto; |
|
|
import com.genersoft.iot.vmp.common.SystemInfoDto; |
|
|
import com.genersoft.iot.vmp.common.VideoManagerConstants; |
|
|
import com.genersoft.iot.vmp.common.VideoManagerConstants; |
|
|
import com.genersoft.iot.vmp.conf.UserSetup; |
|
|
import com.genersoft.iot.vmp.conf.UserSetting; |
|
|
import com.genersoft.iot.vmp.gb28181.bean.*; |
|
|
import com.genersoft.iot.vmp.gb28181.bean.*; |
|
|
import com.genersoft.iot.vmp.media.zlm.dto.MediaItem; |
|
|
import com.genersoft.iot.vmp.media.zlm.dto.MediaItem; |
|
|
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
|
|
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
|
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; |
|
|
|
|
|
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; |
|
|
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; |
|
|
import com.genersoft.iot.vmp.service.bean.SSRCInfo; |
|
|
import com.genersoft.iot.vmp.service.bean.MessageForPushChannel; |
|
|
import com.genersoft.iot.vmp.service.bean.ThirdPartyGB; |
|
|
import com.genersoft.iot.vmp.service.bean.ThirdPartyGB; |
|
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
|
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
|
|
import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper; |
|
|
import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper; |
|
@ -18,9 +18,7 @@ import com.genersoft.iot.vmp.utils.redis.RedisUtil; |
|
|
import org.slf4j.Logger; |
|
|
import org.slf4j.Logger; |
|
|
import org.slf4j.LoggerFactory; |
|
|
import org.slf4j.LoggerFactory; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.security.core.parameters.P; |
|
|
|
|
|
import org.springframework.stereotype.Component; |
|
|
import org.springframework.stereotype.Component; |
|
|
import org.springframework.util.StringUtils; |
|
|
|
|
|
|
|
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
import java.text.SimpleDateFormat; |
|
|
import java.util.*; |
|
|
import java.util.*; |
|
@ -29,7 +27,7 @@ import java.util.*; |
|
|
@Component |
|
|
@Component |
|
|
public class RedisCatchStorageImpl implements IRedisCatchStorage { |
|
|
public class RedisCatchStorageImpl implements IRedisCatchStorage { |
|
|
|
|
|
|
|
|
private Logger logger = LoggerFactory.getLogger(RedisCatchStorageImpl.class); |
|
|
private final Logger logger = LoggerFactory.getLogger(RedisCatchStorageImpl.class); |
|
|
|
|
|
|
|
|
@Autowired |
|
|
@Autowired |
|
|
private RedisUtil redis; |
|
|
private RedisUtil redis; |
|
@ -38,13 +36,13 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
|
|
private DeviceChannelMapper deviceChannelMapper; |
|
|
private DeviceChannelMapper deviceChannelMapper; |
|
|
|
|
|
|
|
|
@Autowired |
|
|
@Autowired |
|
|
private UserSetup userSetup; |
|
|
private UserSetting userSetting; |
|
|
|
|
|
|
|
|
private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
private final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public Long getCSEQ(String method) { |
|
|
public Long getCSEQ(String method) { |
|
|
String key = VideoManagerConstants.SIP_CSEQ_PREFIX + userSetup.getServerId() + "_" + method; |
|
|
String key = VideoManagerConstants.SIP_CSEQ_PREFIX + userSetting.getServerId() + "_" + method; |
|
|
|
|
|
|
|
|
long result = redis.incr(key, 1L); |
|
|
long result = redis.incr(key, 1L); |
|
|
if (result > Integer.MAX_VALUE) { |
|
|
if (result > Integer.MAX_VALUE) { |
|
@ -56,7 +54,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public Long getSN(String method) { |
|
|
public Long getSN(String method) { |
|
|
String key = VideoManagerConstants.SIP_SN_PREFIX + userSetup.getServerId() + "_" + method; |
|
|
String key = VideoManagerConstants.SIP_SN_PREFIX + userSetting.getServerId() + "_" + method; |
|
|
|
|
|
|
|
|
long result = redis.incr(key, 1L); |
|
|
long result = redis.incr(key, 1L); |
|
|
if (result > Integer.MAX_VALUE) { |
|
|
if (result > Integer.MAX_VALUE) { |
|
@ -68,20 +66,20 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void resetAllCSEQ() { |
|
|
public void resetAllCSEQ() { |
|
|
String scanKey = VideoManagerConstants.SIP_CSEQ_PREFIX + userSetup.getServerId() + "_*"; |
|
|
String scanKey = VideoManagerConstants.SIP_CSEQ_PREFIX + userSetting.getServerId() + "_*"; |
|
|
List<Object> keys = redis.scan(scanKey); |
|
|
List<Object> keys = redis.scan(scanKey); |
|
|
for (int i = 0; i < keys.size(); i++) { |
|
|
for (Object o : keys) { |
|
|
String key = (String) keys.get(i); |
|
|
String key = (String) o; |
|
|
redis.set(key, 1); |
|
|
redis.set(key, 1); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void resetAllSN() { |
|
|
public void resetAllSN() { |
|
|
String scanKey = VideoManagerConstants.SIP_SN_PREFIX + userSetup.getServerId() + "_*"; |
|
|
String scanKey = VideoManagerConstants.SIP_SN_PREFIX + userSetting.getServerId() + "_*"; |
|
|
List<Object> keys = redis.scan(scanKey); |
|
|
List<Object> keys = redis.scan(scanKey); |
|
|
for (int i = 0; i < keys.size(); i++) { |
|
|
for (Object o : keys) { |
|
|
String key = (String) keys.get(i); |
|
|
String key = (String) o; |
|
|
redis.set(key, 1); |
|
|
redis.set(key, 1); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -93,7 +91,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
public boolean startPlay(StreamInfo stream) { |
|
|
public boolean startPlay(StreamInfo stream) { |
|
|
return redis.set(String.format("%S_%S_%s_%s_%s", VideoManagerConstants.PLAYER_PREFIX, userSetup.getServerId(), |
|
|
return redis.set(String.format("%S_%S_%s_%s_%s", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(), |
|
|
stream.getStream(), stream.getDeviceID(), stream.getChannelId()), |
|
|
stream.getStream(), stream.getDeviceID(), stream.getChannelId()), |
|
|
stream); |
|
|
stream); |
|
|
} |
|
|
} |
|
@ -107,7 +105,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
|
|
public boolean stopPlay(StreamInfo streamInfo) { |
|
|
public boolean stopPlay(StreamInfo streamInfo) { |
|
|
if (streamInfo == null) return false; |
|
|
if (streamInfo == null) return false; |
|
|
return redis.del(String.format("%S_%s_%s_%s_%s", VideoManagerConstants.PLAYER_PREFIX, |
|
|
return redis.del(String.format("%S_%s_%s_%s_%s", VideoManagerConstants.PLAYER_PREFIX, |
|
|
userSetup.getServerId(), |
|
|
userSetting.getServerId(), |
|
|
streamInfo.getStream(), |
|
|
streamInfo.getStream(), |
|
|
streamInfo.getDeviceID(), |
|
|
streamInfo.getDeviceID(), |
|
|
streamInfo.getChannelId())); |
|
|
streamInfo.getChannelId())); |
|
@ -121,14 +119,14 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
|
|
public StreamInfo queryPlay(StreamInfo streamInfo) { |
|
|
public StreamInfo queryPlay(StreamInfo streamInfo) { |
|
|
return (StreamInfo)redis.get(String.format("%S_%s_%s_%s_%s", |
|
|
return (StreamInfo)redis.get(String.format("%S_%s_%s_%s_%s", |
|
|
VideoManagerConstants.PLAYER_PREFIX, |
|
|
VideoManagerConstants.PLAYER_PREFIX, |
|
|
userSetup.getServerId(), |
|
|
userSetting.getServerId(), |
|
|
streamInfo.getStream(), |
|
|
streamInfo.getStream(), |
|
|
streamInfo.getDeviceID(), |
|
|
streamInfo.getDeviceID(), |
|
|
streamInfo.getChannelId())); |
|
|
streamInfo.getChannelId())); |
|
|
} |
|
|
} |
|
|
@Override |
|
|
@Override |
|
|
public StreamInfo queryPlayByStreamId(String streamId) { |
|
|
public StreamInfo queryPlayByStreamId(String streamId) { |
|
|
List<Object> playLeys = redis.scan(String.format("%S_%s_%s_*", VideoManagerConstants.PLAYER_PREFIX, userSetup.getServerId(), streamId)); |
|
|
List<Object> playLeys = redis.scan(String.format("%S_%s_%s_*", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(), streamId)); |
|
|
if (playLeys == null || playLeys.size() == 0) return null; |
|
|
if (playLeys == null || playLeys.size() == 0) return null; |
|
|
return (StreamInfo)redis.get(playLeys.get(0).toString()); |
|
|
return (StreamInfo)redis.get(playLeys.get(0).toString()); |
|
|
} |
|
|
} |
|
@ -136,7 +134,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
|
|
@Override |
|
|
@Override |
|
|
public StreamInfo queryPlayByDevice(String deviceId, String channelId) { |
|
|
public StreamInfo queryPlayByDevice(String deviceId, String channelId) { |
|
|
List<Object> playLeys = redis.scan(String.format("%S_%s_*_%s_%s", VideoManagerConstants.PLAYER_PREFIX, |
|
|
List<Object> playLeys = redis.scan(String.format("%S_%s_*_%s_%s", VideoManagerConstants.PLAYER_PREFIX, |
|
|
userSetup.getServerId(), |
|
|
userSetting.getServerId(), |
|
|
deviceId, |
|
|
deviceId, |
|
|
channelId)); |
|
|
channelId)); |
|
|
if (playLeys == null || playLeys.size() == 0) return null; |
|
|
if (playLeys == null || playLeys.size() == 0) return null; |
|
@ -147,11 +145,11 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
|
|
public Map<String, StreamInfo> queryPlayByDeviceId(String deviceId) { |
|
|
public Map<String, StreamInfo> queryPlayByDeviceId(String deviceId) { |
|
|
Map<String, StreamInfo> streamInfos = new HashMap<>(); |
|
|
Map<String, StreamInfo> streamInfos = new HashMap<>(); |
|
|
// List<Object> playLeys = redis.keys(String.format("%S_*_%S_*", VideoManagerConstants.PLAYER_PREFIX, deviceId));
|
|
|
// List<Object> playLeys = redis.keys(String.format("%S_*_%S_*", VideoManagerConstants.PLAYER_PREFIX, deviceId));
|
|
|
List<Object> players = redis.scan(String.format("%S_%s_*_%S_*", VideoManagerConstants.PLAYER_PREFIX, userSetup.getServerId(),deviceId)); |
|
|
List<Object> players = redis.scan(String.format("%S_%s_*_%S_*", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(),deviceId)); |
|
|
if (players.size() == 0) return streamInfos; |
|
|
if (players.size() == 0) return streamInfos; |
|
|
for (int i = 0; i < players.size(); i++) { |
|
|
for (Object player : players) { |
|
|
String key = (String) players.get(i); |
|
|
String key = (String) player; |
|
|
StreamInfo streamInfo = (StreamInfo)redis.get(key); |
|
|
StreamInfo streamInfo = (StreamInfo) redis.get(key); |
|
|
streamInfos.put(streamInfo.getDeviceID() + "_" + streamInfo.getChannelId(), streamInfo); |
|
|
streamInfos.put(streamInfo.getDeviceID() + "_" + streamInfo.getChannelId(), streamInfo); |
|
|
} |
|
|
} |
|
|
return streamInfos; |
|
|
return streamInfos; |
|
@ -161,7 +159,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
|
|
@Override |
|
|
@Override |
|
|
public boolean startPlayback(StreamInfo stream, String callId) { |
|
|
public boolean startPlayback(StreamInfo stream, String callId) { |
|
|
return redis.set(String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX, |
|
|
return redis.set(String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX, |
|
|
userSetup.getServerId(), stream.getDeviceID(), stream.getChannelId(), stream.getStream(), callId), stream); |
|
|
userSetting.getServerId(), stream.getDeviceID(), stream.getChannelId(), stream.getStream(), callId), stream); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
@ -169,10 +167,10 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
|
|
boolean result; |
|
|
boolean result; |
|
|
if (stream.getProgress() == 1) { |
|
|
if (stream.getProgress() == 1) { |
|
|
result = redis.set(String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX, |
|
|
result = redis.set(String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX, |
|
|
userSetup.getServerId(), stream.getDeviceID(), stream.getChannelId(), stream.getStream(), callId), stream); |
|
|
userSetting.getServerId(), stream.getDeviceID(), stream.getChannelId(), stream.getStream(), callId), stream); |
|
|
}else { |
|
|
}else { |
|
|
result = redis.set(String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX, |
|
|
result = redis.set(String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX, |
|
|
userSetup.getServerId(), stream.getDeviceID(), stream.getChannelId(), stream.getStream(), callId), stream, 60*60); |
|
|
userSetting.getServerId(), stream.getDeviceID(), stream.getChannelId(), stream.getStream(), callId), stream, 60*60); |
|
|
} |
|
|
} |
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
@ -189,7 +187,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
|
|
if (stream == null) stream = "*"; |
|
|
if (stream == null) stream = "*"; |
|
|
if (callId == null) callId = "*"; |
|
|
if (callId == null) callId = "*"; |
|
|
String key = String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX, |
|
|
String key = String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX, |
|
|
userSetup.getServerId(), |
|
|
userSetting.getServerId(), |
|
|
deviceId, |
|
|
deviceId, |
|
|
channelId, |
|
|
channelId, |
|
|
stream, |
|
|
stream, |
|
@ -217,7 +215,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
|
|
if (stream == null) stream = "*"; |
|
|
if (stream == null) stream = "*"; |
|
|
if (callId == null) callId = "*"; |
|
|
if (callId == null) callId = "*"; |
|
|
String key = String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX, |
|
|
String key = String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX, |
|
|
userSetup.getServerId(), |
|
|
userSetting.getServerId(), |
|
|
deviceId, |
|
|
deviceId, |
|
|
channelId, |
|
|
channelId, |
|
|
stream, |
|
|
stream, |
|
@ -242,7 +240,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
|
|
if (stream == null) stream = "*"; |
|
|
if (stream == null) stream = "*"; |
|
|
if (callId == null) callId = "*"; |
|
|
if (callId == null) callId = "*"; |
|
|
String key = String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX, |
|
|
String key = String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX, |
|
|
userSetup.getServerId(), |
|
|
userSetting.getServerId(), |
|
|
deviceId, |
|
|
deviceId, |
|
|
channelId, |
|
|
channelId, |
|
|
stream, |
|
|
stream, |
|
@ -258,63 +256,63 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void updatePlatformCatchInfo(ParentPlatformCatch parentPlatformCatch) { |
|
|
public void updatePlatformCatchInfo(ParentPlatformCatch parentPlatformCatch) { |
|
|
String key = VideoManagerConstants.PLATFORM_CATCH_PREFIX + userSetup.getServerId() + "_" + parentPlatformCatch.getId(); |
|
|
String key = VideoManagerConstants.PLATFORM_CATCH_PREFIX + userSetting.getServerId() + "_" + parentPlatformCatch.getId(); |
|
|
redis.set(key, parentPlatformCatch); |
|
|
redis.set(key, parentPlatformCatch); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void updatePlatformKeepalive(ParentPlatform parentPlatform) { |
|
|
public void updatePlatformKeepalive(ParentPlatform parentPlatform) { |
|
|
String key = VideoManagerConstants.PLATFORM_KEEPALIVE_PREFIX + userSetup.getServerId() + "_" + parentPlatform.getServerGBId(); |
|
|
String key = VideoManagerConstants.PLATFORM_KEEPALIVE_PREFIX + userSetting.getServerId() + "_" + parentPlatform.getServerGBId(); |
|
|
redis.set(key, "", Integer.parseInt(parentPlatform.getKeepTimeout())); |
|
|
redis.set(key, "", Integer.parseInt(parentPlatform.getKeepTimeout())); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void updatePlatformRegister(ParentPlatform parentPlatform) { |
|
|
public void updatePlatformRegister(ParentPlatform parentPlatform) { |
|
|
String key = VideoManagerConstants.PLATFORM_REGISTER_PREFIX + userSetup.getServerId() + "_" + parentPlatform.getServerGBId(); |
|
|
String key = VideoManagerConstants.PLATFORM_REGISTER_PREFIX + userSetting.getServerId() + "_" + parentPlatform.getServerGBId(); |
|
|
redis.set(key, "", Integer.parseInt(parentPlatform.getExpires())); |
|
|
redis.set(key, "", Integer.parseInt(parentPlatform.getExpires())); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public ParentPlatformCatch queryPlatformCatchInfo(String platformGbId) { |
|
|
public ParentPlatformCatch queryPlatformCatchInfo(String platformGbId) { |
|
|
return (ParentPlatformCatch)redis.get(VideoManagerConstants.PLATFORM_CATCH_PREFIX + userSetup.getServerId() + "_" + platformGbId); |
|
|
return (ParentPlatformCatch)redis.get(VideoManagerConstants.PLATFORM_CATCH_PREFIX + userSetting.getServerId() + "_" + platformGbId); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void delPlatformCatchInfo(String platformGbId) { |
|
|
public void delPlatformCatchInfo(String platformGbId) { |
|
|
redis.del(VideoManagerConstants.PLATFORM_CATCH_PREFIX + userSetup.getServerId() + "_" + platformGbId); |
|
|
redis.del(VideoManagerConstants.PLATFORM_CATCH_PREFIX + userSetting.getServerId() + "_" + platformGbId); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void delPlatformKeepalive(String platformGbId) { |
|
|
public void delPlatformKeepalive(String platformGbId) { |
|
|
redis.del(VideoManagerConstants.PLATFORM_KEEPALIVE_PREFIX + userSetup.getServerId() + "_" + platformGbId); |
|
|
redis.del(VideoManagerConstants.PLATFORM_KEEPALIVE_PREFIX + userSetting.getServerId() + "_" + platformGbId); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void delPlatformRegister(String platformGbId) { |
|
|
public void delPlatformRegister(String platformGbId) { |
|
|
redis.del(VideoManagerConstants.PLATFORM_REGISTER_PREFIX + userSetup.getServerId() + "_" + platformGbId); |
|
|
redis.del(VideoManagerConstants.PLATFORM_REGISTER_PREFIX + userSetting.getServerId() + "_" + platformGbId); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void updatePlatformRegisterInfo(String callId, String platformGbId) { |
|
|
public void updatePlatformRegisterInfo(String callId, String platformGbId) { |
|
|
String key = VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetup.getServerId() + "_" + callId; |
|
|
String key = VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetting.getServerId() + "_" + callId; |
|
|
redis.set(key, platformGbId, 30); |
|
|
redis.set(key, platformGbId, 30); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public String queryPlatformRegisterInfo(String callId) { |
|
|
public String queryPlatformRegisterInfo(String callId) { |
|
|
return (String)redis.get(VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetup.getServerId() + "_" + callId); |
|
|
return (String)redis.get(VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetting.getServerId() + "_" + callId); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void delPlatformRegisterInfo(String callId) { |
|
|
public void delPlatformRegisterInfo(String callId) { |
|
|
redis.del(VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetup.getServerId() + "_" + callId); |
|
|
redis.del(VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetting.getServerId() + "_" + callId); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void cleanPlatformRegisterInfos() { |
|
|
public void cleanPlatformRegisterInfos() { |
|
|
List regInfos = redis.scan(VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetup.getServerId() + "_" + "*"); |
|
|
List regInfos = redis.scan(VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetting.getServerId() + "_" + "*"); |
|
|
for (Object key : regInfos) { |
|
|
for (Object key : regInfos) { |
|
|
redis.del(key.toString()); |
|
|
redis.del(key.toString()); |
|
|
} |
|
|
} |
|
@ -322,7 +320,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void updateSendRTPSever(SendRtpItem sendRtpItem) { |
|
|
public void updateSendRTPSever(SendRtpItem sendRtpItem) { |
|
|
String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetup.getServerId() + "_" |
|
|
String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" |
|
|
+ sendRtpItem.getPlatformId() + "_" + sendRtpItem.getChannelId() + "_" |
|
|
+ sendRtpItem.getPlatformId() + "_" + sendRtpItem.getChannelId() + "_" |
|
|
+ sendRtpItem.getStreamId() + "_" + sendRtpItem.getCallId(); |
|
|
+ sendRtpItem.getStreamId() + "_" + sendRtpItem.getCallId(); |
|
|
redis.set(key, sendRtpItem); |
|
|
redis.set(key, sendRtpItem); |
|
@ -334,7 +332,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
|
|
if (channelId == null) channelId = "*"; |
|
|
if (channelId == null) channelId = "*"; |
|
|
if (streamId == null) streamId = "*"; |
|
|
if (streamId == null) streamId = "*"; |
|
|
if (callId == null) callId = "*"; |
|
|
if (callId == null) callId = "*"; |
|
|
String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetup.getServerId() + "_" + platformGbId |
|
|
String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" + platformGbId |
|
|
+ "_" + channelId + "_" + streamId + "_" + callId; |
|
|
+ "_" + channelId + "_" + streamId + "_" + callId; |
|
|
List<Object> scan = redis.scan(key); |
|
|
List<Object> scan = redis.scan(key); |
|
|
if (scan.size() > 0) { |
|
|
if (scan.size() > 0) { |
|
@ -347,13 +345,13 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
|
|
@Override |
|
|
@Override |
|
|
public List<SendRtpItem> querySendRTPServer(String platformGbId) { |
|
|
public List<SendRtpItem> querySendRTPServer(String platformGbId) { |
|
|
if (platformGbId == null) platformGbId = "*"; |
|
|
if (platformGbId == null) platformGbId = "*"; |
|
|
String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetup.getServerId() + "_" + platformGbId + "_*" + "_*" + "_*"; |
|
|
String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" + platformGbId + "_*" + "_*" + "_*"; |
|
|
List<Object> queryResult = redis.scan(key); |
|
|
List<Object> queryResult = redis.scan(key); |
|
|
List<SendRtpItem> result= new ArrayList<>(); |
|
|
List<SendRtpItem> result= new ArrayList<>(); |
|
|
|
|
|
|
|
|
for (int i = 0; i < queryResult.size(); i++) { |
|
|
for (Object o : queryResult) { |
|
|
String keyItem = (String) queryResult.get(i); |
|
|
String keyItem = (String) o; |
|
|
result.add((SendRtpItem)redis.get(keyItem)); |
|
|
result.add((SendRtpItem) redis.get(keyItem)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return result; |
|
|
return result; |
|
@ -368,7 +366,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
|
|
public void deleteSendRTPServer(String platformGbId, String channelId, String callId, String streamId) { |
|
|
public void deleteSendRTPServer(String platformGbId, String channelId, String callId, String streamId) { |
|
|
if (streamId == null) streamId = "*"; |
|
|
if (streamId == null) streamId = "*"; |
|
|
if (callId == null) callId = "*"; |
|
|
if (callId == null) callId = "*"; |
|
|
String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetup.getServerId() + "_" + platformGbId |
|
|
String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" + platformGbId |
|
|
+ "_" + channelId + "_" + streamId + "_" + callId; |
|
|
+ "_" + channelId + "_" + streamId + "_" + callId; |
|
|
List<Object> scan = redis.scan(key); |
|
|
List<Object> scan = redis.scan(key); |
|
|
if (scan.size() > 0) { |
|
|
if (scan.size() > 0) { |
|
@ -386,7 +384,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
public boolean isChannelSendingRTP(String channelId) { |
|
|
public boolean isChannelSendingRTP(String channelId) { |
|
|
String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetup.getServerId() + "_" + "*_" + channelId + "*_" + "*_"; |
|
|
String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" + "*_" + channelId + "*_" + "*_"; |
|
|
List<Object> RtpStreams = redis.scan(key); |
|
|
List<Object> RtpStreams = redis.scan(key); |
|
|
if (RtpStreams.size() > 0) { |
|
|
if (RtpStreams.size() > 0) { |
|
|
return true; |
|
|
return true; |
|
@ -398,7 +396,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
|
|
@Override |
|
|
@Override |
|
|
public void clearCatchByDeviceId(String deviceId) { |
|
|
public void clearCatchByDeviceId(String deviceId) { |
|
|
List<Object> playLeys = redis.scan(String.format("%S_%s_*_%s_*", VideoManagerConstants.PLAYER_PREFIX, |
|
|
List<Object> playLeys = redis.scan(String.format("%S_%s_*_%s_*", VideoManagerConstants.PLAYER_PREFIX, |
|
|
userSetup.getServerId(), |
|
|
userSetting.getServerId(), |
|
|
deviceId)); |
|
|
deviceId)); |
|
|
if (playLeys.size() > 0) { |
|
|
if (playLeys.size() > 0) { |
|
|
for (Object key : playLeys) { |
|
|
for (Object key : playLeys) { |
|
@ -407,7 +405,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
List<Object> playBackers = redis.scan(String.format("%S_%s_%s_*_*_*", VideoManagerConstants.PLAY_BLACK_PREFIX, |
|
|
List<Object> playBackers = redis.scan(String.format("%S_%s_%s_*_*_*", VideoManagerConstants.PLAY_BLACK_PREFIX, |
|
|
userSetup.getServerId(), |
|
|
userSetting.getServerId(), |
|
|
deviceId)); |
|
|
deviceId)); |
|
|
if (playBackers.size() > 0) { |
|
|
if (playBackers.size() > 0) { |
|
|
for (Object key : playBackers) { |
|
|
for (Object key : playBackers) { |
|
@ -416,7 +414,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
List<Object> deviceCache = redis.scan(String.format("%S%s_%s", VideoManagerConstants.DEVICE_PREFIX, |
|
|
List<Object> deviceCache = redis.scan(String.format("%S%s_%s", VideoManagerConstants.DEVICE_PREFIX, |
|
|
userSetup.getServerId(), |
|
|
userSetting.getServerId(), |
|
|
deviceId)); |
|
|
deviceId)); |
|
|
if (deviceCache.size() > 0) { |
|
|
if (deviceCache.size() > 0) { |
|
|
for (Object key : deviceCache) { |
|
|
for (Object key : deviceCache) { |
|
@ -427,7 +425,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void outlineForAll() { |
|
|
public void outlineForAll() { |
|
|
List<Object> onlineDevices = redis.scan(VideoManagerConstants.KEEPLIVEKEY_PREFIX + userSetup.getServerId() + "_" + "*" ); |
|
|
List<Object> onlineDevices = redis.scan(VideoManagerConstants.KEEPLIVEKEY_PREFIX + userSetting.getServerId() + "_" + "*" ); |
|
|
for (int i = 0; i < onlineDevices.size(); i++) { |
|
|
for (int i = 0; i < onlineDevices.size(); i++) { |
|
|
String key = (String) onlineDevices.get(i); |
|
|
String key = (String) onlineDevices.get(i); |
|
|
redis.del(key); |
|
|
redis.del(key); |
|
@ -437,7 +435,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
|
|
@Override |
|
|
@Override |
|
|
public List<String> getOnlineForAll() { |
|
|
public List<String> getOnlineForAll() { |
|
|
List<String> result = new ArrayList<>(); |
|
|
List<String> result = new ArrayList<>(); |
|
|
List<Object> onlineDevices = redis.scan(VideoManagerConstants.KEEPLIVEKEY_PREFIX + userSetup.getServerId() + "_" + "*" ); |
|
|
List<Object> onlineDevices = redis.scan(VideoManagerConstants.KEEPLIVEKEY_PREFIX + userSetting.getServerId() + "_" + "*" ); |
|
|
for (int i = 0; i < onlineDevices.size(); i++) { |
|
|
for (int i = 0; i < onlineDevices.size(); i++) { |
|
|
String key = (String) onlineDevices.get(i); |
|
|
String key = (String) onlineDevices.get(i); |
|
|
result.add((String) redis.get(key)); |
|
|
result.add((String) redis.get(key)); |
|
@ -447,7 +445,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void updateWVPInfo(JSONObject jsonObject, int time) { |
|
|
public void updateWVPInfo(JSONObject jsonObject, int time) { |
|
|
String key = VideoManagerConstants.WVP_SERVER_PREFIX + userSetup.getServerId(); |
|
|
String key = VideoManagerConstants.WVP_SERVER_PREFIX + userSetting.getServerId(); |
|
|
redis.set(key, jsonObject, time); |
|
|
redis.set(key, jsonObject, time); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -460,13 +458,13 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void addStream(MediaServerItem mediaServerItem, String type, String app, String streamId, MediaItem mediaItem) { |
|
|
public void addStream(MediaServerItem mediaServerItem, String type, String app, String streamId, MediaItem mediaItem) { |
|
|
String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetup.getServerId() + "_" + type + "_" + app + "_" + streamId + "_" + mediaServerItem.getId(); |
|
|
String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetting.getServerId() + "_" + type + "_" + app + "_" + streamId + "_" + mediaServerItem.getId(); |
|
|
redis.set(key, mediaItem); |
|
|
redis.set(key, mediaItem); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void removeStream(String mediaServerId, String type, String app, String streamId) { |
|
|
public void removeStream(String mediaServerId, String type, String app, String streamId) { |
|
|
String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetup.getServerId() + "_" + type + "_" + app + "_" + streamId + "_" + mediaServerId; |
|
|
String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetting.getServerId() + "_" + type + "_" + app + "_" + streamId + "_" + mediaServerId; |
|
|
redis.del(key); |
|
|
redis.del(key); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -480,7 +478,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
|
|
if (stream == null) stream = "*"; |
|
|
if (stream == null) stream = "*"; |
|
|
if (callId == null) callId = "*"; |
|
|
if (callId == null) callId = "*"; |
|
|
String key = String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX, |
|
|
String key = String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX, |
|
|
userSetup.getServerId(), |
|
|
userSetting.getServerId(), |
|
|
deviceId, |
|
|
deviceId, |
|
|
channelId, |
|
|
channelId, |
|
|
stream, |
|
|
stream, |
|
@ -503,7 +501,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void removeStream(String mediaServerId, String type) { |
|
|
public void removeStream(String mediaServerId, String type) { |
|
|
String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetup.getServerId() + "_" + type + "_*_*_" + mediaServerId; |
|
|
String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetting.getServerId() + "_" + type + "_*_*_" + mediaServerId; |
|
|
List<Object> streams = redis.scan(key); |
|
|
List<Object> streams = redis.scan(key); |
|
|
for (Object stream : streams) { |
|
|
for (Object stream : streams) { |
|
|
redis.del((String) stream); |
|
|
redis.del((String) stream); |
|
@ -513,7 +511,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
|
|
@Override |
|
|
@Override |
|
|
public List<MediaItem> getStreams(String mediaServerId, String type) { |
|
|
public List<MediaItem> getStreams(String mediaServerId, String type) { |
|
|
List<MediaItem> result = new ArrayList<>(); |
|
|
List<MediaItem> result = new ArrayList<>(); |
|
|
String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetup.getServerId() + "_" + type + "_*_*_" + mediaServerId; |
|
|
String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetting.getServerId() + "_" + type + "_*_*_" + mediaServerId; |
|
|
List<Object> streams = redis.scan(key); |
|
|
List<Object> streams = redis.scan(key); |
|
|
for (Object stream : streams) { |
|
|
for (Object stream : streams) { |
|
|
MediaItem mediaItem = (MediaItem)redis.get((String) stream); |
|
|
MediaItem mediaItem = (MediaItem)redis.get((String) stream); |
|
@ -524,37 +522,37 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void updateDevice(Device device) { |
|
|
public void updateDevice(Device device) { |
|
|
String key = VideoManagerConstants.DEVICE_PREFIX + userSetup.getServerId() + "_" + device.getDeviceId(); |
|
|
String key = VideoManagerConstants.DEVICE_PREFIX + userSetting.getServerId() + "_" + device.getDeviceId(); |
|
|
redis.set(key, device); |
|
|
redis.set(key, device); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void removeDevice(String deviceId) { |
|
|
public void removeDevice(String deviceId) { |
|
|
String key = VideoManagerConstants.DEVICE_PREFIX + userSetup.getServerId() + "_" + deviceId; |
|
|
String key = VideoManagerConstants.DEVICE_PREFIX + userSetting.getServerId() + "_" + deviceId; |
|
|
redis.del(key); |
|
|
redis.del(key); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public Device getDevice(String deviceId) { |
|
|
public Device getDevice(String deviceId) { |
|
|
String key = VideoManagerConstants.DEVICE_PREFIX + userSetup.getServerId() + "_" + deviceId; |
|
|
String key = VideoManagerConstants.DEVICE_PREFIX + userSetting.getServerId() + "_" + deviceId; |
|
|
return (Device)redis.get(key); |
|
|
return (Device)redis.get(key); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void updateGpsMsgInfo(GPSMsgInfo gpsMsgInfo) { |
|
|
public void updateGpsMsgInfo(GPSMsgInfo gpsMsgInfo) { |
|
|
String key = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetup.getServerId() + "_" + gpsMsgInfo.getId(); |
|
|
String key = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetting.getServerId() + "_" + gpsMsgInfo.getId(); |
|
|
redis.set(key, gpsMsgInfo, 60); // 默认GPS消息保存1分钟
|
|
|
redis.set(key, gpsMsgInfo, 60); // 默认GPS消息保存1分钟
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public GPSMsgInfo getGpsMsgInfo(String gbId) { |
|
|
public GPSMsgInfo getGpsMsgInfo(String gbId) { |
|
|
String key = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetup.getServerId() + "_" + gbId; |
|
|
String key = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetting.getServerId() + "_" + gbId; |
|
|
return (GPSMsgInfo)redis.get(key); |
|
|
return (GPSMsgInfo)redis.get(key); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public List<GPSMsgInfo> getAllGpsMsgInfo() { |
|
|
public List<GPSMsgInfo> getAllGpsMsgInfo() { |
|
|
String scanKey = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetup.getServerId() + "_*"; |
|
|
String scanKey = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetting.getServerId() + "_*"; |
|
|
List<GPSMsgInfo> result = new ArrayList<>(); |
|
|
List<GPSMsgInfo> result = new ArrayList<>(); |
|
|
List<Object> keys = redis.scan(scanKey); |
|
|
List<Object> keys = redis.scan(scanKey); |
|
|
for (int i = 0; i < keys.size(); i++) { |
|
|
for (int i = 0; i < keys.size(); i++) { |
|
@ -570,7 +568,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public MediaItem getStreamInfo(String app, String streamId, String mediaServerId) { |
|
|
public MediaItem getStreamInfo(String app, String streamId, String mediaServerId) { |
|
|
String scanKey = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetup.getServerId() + "_*_" + app + "_" + streamId + "_" + mediaServerId; |
|
|
String scanKey = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetting.getServerId() + "_*_" + app + "_" + streamId + "_" + mediaServerId; |
|
|
|
|
|
|
|
|
MediaItem result = null; |
|
|
MediaItem result = null; |
|
|
List<Object> keys = redis.scan(scanKey); |
|
|
List<Object> keys = redis.scan(scanKey); |
|
@ -584,7 +582,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void addCpuInfo(double cpuInfo) { |
|
|
public void addCpuInfo(double cpuInfo) { |
|
|
String key = VideoManagerConstants.SYSTEM_INFO_CPU_PREFIX + userSetup.getServerId(); |
|
|
String key = VideoManagerConstants.SYSTEM_INFO_CPU_PREFIX + userSetting.getServerId(); |
|
|
SystemInfoDto<Double> systemInfoDto = new SystemInfoDto<>(); |
|
|
SystemInfoDto<Double> systemInfoDto = new SystemInfoDto<>(); |
|
|
systemInfoDto.setTime(format.format(System.currentTimeMillis())); |
|
|
systemInfoDto.setTime(format.format(System.currentTimeMillis())); |
|
|
systemInfoDto.setData(cpuInfo); |
|
|
systemInfoDto.setData(cpuInfo); |
|
@ -599,7 +597,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void addMemInfo(double memInfo) { |
|
|
public void addMemInfo(double memInfo) { |
|
|
String key = VideoManagerConstants.SYSTEM_INFO_MEM_PREFIX + userSetup.getServerId(); |
|
|
String key = VideoManagerConstants.SYSTEM_INFO_MEM_PREFIX + userSetting.getServerId(); |
|
|
SystemInfoDto<Double> systemInfoDto = new SystemInfoDto<>(); |
|
|
SystemInfoDto<Double> systemInfoDto = new SystemInfoDto<>(); |
|
|
systemInfoDto.setTime(format.format(System.currentTimeMillis())); |
|
|
systemInfoDto.setTime(format.format(System.currentTimeMillis())); |
|
|
systemInfoDto.setData(memInfo); |
|
|
systemInfoDto.setData(memInfo); |
|
@ -614,7 +612,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void addNetInfo(Map<String, String> networkInterfaces) { |
|
|
public void addNetInfo(Map<String, String> networkInterfaces) { |
|
|
String key = VideoManagerConstants.SYSTEM_INFO_NET_PREFIX + userSetup.getServerId(); |
|
|
String key = VideoManagerConstants.SYSTEM_INFO_NET_PREFIX + userSetting.getServerId(); |
|
|
SystemInfoDto<Map<String, String>> systemInfoDto = new SystemInfoDto<>(); |
|
|
SystemInfoDto<Map<String, String>> systemInfoDto = new SystemInfoDto<>(); |
|
|
systemInfoDto.setTime(format.format(System.currentTimeMillis())); |
|
|
systemInfoDto.setTime(format.format(System.currentTimeMillis())); |
|
|
systemInfoDto.setData(networkInterfaces); |
|
|
systemInfoDto.setData(networkInterfaces); |
|
@ -626,4 +624,18 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void sendMobilePositionMsg(JSONObject jsonObject) { |
|
|
|
|
|
String key = VideoManagerConstants.VM_MSG_SUBSCRIBE_MOBILE_POSITION; |
|
|
|
|
|
logger.debug("[redis 移动位置订阅通知] {}: {}", key, jsonObject.toString()); |
|
|
|
|
|
redis.convertAndSend(key, jsonObject); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void sendStreamPushRequestedMsg(MessageForPushChannel msg) { |
|
|
|
|
|
String key = VideoManagerConstants.VM_MSG_STREAM_PUSH_REQUESTED; |
|
|
|
|
|
logger.debug("[redis 推流被请求通知] {}: {}-{}", key, msg.getApp(), msg.getStream()); |
|
|
|
|
|
redis.convertAndSend(key, (JSONObject)JSON.toJSON(msg)); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|