级联平台添加GPS订阅支持
This commit is contained in:
@@ -2,10 +2,7 @@ package com.genersoft.iot.vmp.storager;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatformCatch;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
||||
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
||||
import com.genersoft.iot.vmp.service.bean.ThirdPartyGB;
|
||||
@@ -196,4 +193,16 @@ public interface IRedisCatchStorage {
|
||||
void resetAllCSEQ();
|
||||
|
||||
void updateGpsMsgInfo(GPSMsgInfo gpsMsgInfo);
|
||||
|
||||
GPSMsgInfo getGpsMsgInfo(String gbId);
|
||||
|
||||
Long getSN(String method);
|
||||
|
||||
void resetAllSN();
|
||||
|
||||
void updateSubscribe(String key, SubscribeInfo subscribeInfo);
|
||||
|
||||
SubscribeInfo getSubscribe(String key);
|
||||
|
||||
void delSubscribe(String key);
|
||||
}
|
||||
|
||||
@@ -54,6 +54,11 @@ public interface GbStreamMapper {
|
||||
"WHERE pgs.platformId = '${platformId}'")
|
||||
List<GbStream> queryGbStreamListInPlatform(String platformId);
|
||||
|
||||
|
||||
@Select("SELECT gs.*, pgs.platformId as platformId, pgs.catalogId as catalogId FROM gb_stream gs LEFT JOIN platform_gb_stream pgs " +
|
||||
"ON gs.app = pgs.app and gs.stream = pgs.stream WHERE pgs.app is NULL and pgs.stream is NULL")
|
||||
List<GbStream> queryStreamNotInPlatform();
|
||||
|
||||
@Update("UPDATE gb_stream " +
|
||||
"SET status=${status} " +
|
||||
"WHERE app=#{app} AND stream=#{stream}")
|
||||
@@ -87,4 +92,6 @@ public interface GbStreamMapper {
|
||||
"</foreach> " +
|
||||
"</script>")
|
||||
void batchAdd(List<StreamPushItem> subList);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -49,6 +49,18 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getSN(String method) {
|
||||
String key = VideoManagerConstants.SIP_SN_PREFIX + userSetup.getServerId() + "_" + method;
|
||||
|
||||
long result = redis.incr(key, 1L);
|
||||
if (result > Integer.MAX_VALUE) {
|
||||
redis.set(key, 1);
|
||||
result = 1;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetAllCSEQ() {
|
||||
String scanKey = VideoManagerConstants.SIP_CSEQ_PREFIX + userSetup.getServerId() + "_*";
|
||||
@@ -59,6 +71,16 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetAllSN() {
|
||||
String scanKey = VideoManagerConstants.SIP_SN_PREFIX + userSetup.getServerId() + "_*";
|
||||
List<Object> keys = redis.scan(scanKey);
|
||||
for (int i = 0; i < keys.size(); i++) {
|
||||
String key = (String) keys.get(i);
|
||||
redis.set(key, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始播放时将流存入redis
|
||||
*
|
||||
@@ -433,4 +455,25 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
String key = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetup.getServerId() + "_" + gpsMsgInfo.getId();
|
||||
redis.set(key, gpsMsgInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GPSMsgInfo getGpsMsgInfo(String gbId) {
|
||||
String key = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetup.getServerId() + "_" + gbId;
|
||||
return (GPSMsgInfo)redis.get(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSubscribe(String key, SubscribeInfo subscribeInfo) {
|
||||
redis.set(key, subscribeInfo, subscribeInfo.getExpires());
|
||||
}
|
||||
|
||||
@Override
|
||||
public SubscribeInfo getSubscribe(String key) {
|
||||
return (SubscribeInfo)redis.get(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delSubscribe(String key) {
|
||||
redis.del(key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -486,18 +486,21 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
|
||||
// 更新缓存
|
||||
parentPlatformCatch.setParentPlatform(parentPlatform);
|
||||
redisCatchStorage.updatePlatformCatchInfo(parentPlatformCatch);
|
||||
// 共享所有视频流,需要将现有视频流添加到此平台
|
||||
List<GbStream> gbStreams = gbStreamMapper.selectAll();
|
||||
if (gbStreams.size() > 0) {
|
||||
for (GbStream gbStream : gbStreams) {
|
||||
gbStream.setCatalogId(parentPlatform.getCatalogId());
|
||||
}
|
||||
if (parentPlatform.isShareAllLiveStream()) {
|
||||
gbStreamService.addPlatformInfo(gbStreams, parentPlatform.getServerGBId(), parentPlatform.getCatalogId());
|
||||
}else {
|
||||
gbStreamService.delPlatformInfo(gbStreams);
|
||||
if (parentPlatform.isEnable()) {
|
||||
// 共享所有视频流,需要将现有视频流添加到此平台
|
||||
List<GbStream> gbStreams = gbStreamMapper.queryStreamNotInPlatform();
|
||||
if (gbStreams.size() > 0) {
|
||||
for (GbStream gbStream : gbStreams) {
|
||||
gbStream.setCatalogId(parentPlatform.getCatalogId());
|
||||
}
|
||||
if (parentPlatform.isShareAllLiveStream()) {
|
||||
gbStreamService.addPlatformInfo(gbStreams, parentPlatform.getServerGBId(), parentPlatform.getCatalogId());
|
||||
}else {
|
||||
gbStreamService.delPlatformInfo(gbStreams);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result > 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user