优化级联平台GPS订阅
This commit is contained in:
@@ -195,6 +195,7 @@ public interface IRedisCatchStorage {
|
||||
void updateGpsMsgInfo(GPSMsgInfo gpsMsgInfo);
|
||||
|
||||
GPSMsgInfo getGpsMsgInfo(String gbId);
|
||||
List<GPSMsgInfo> getAllGpsMsgInfo();
|
||||
|
||||
Long getSN(String method);
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
|
||||
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
||||
import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
|
||||
@@ -456,4 +457,6 @@ public interface IVideoManagerStorager {
|
||||
List<PlatformCatalog> queryCatalogInPlatform(String serverGBId);
|
||||
|
||||
int delRelation(PlatformCatalog platformCatalog);
|
||||
|
||||
int updateStreamGPS(List<GPSMsgInfo> gpsMsgInfo);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.storager.dao;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
|
||||
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@@ -94,4 +95,13 @@ public interface GbStreamMapper {
|
||||
void batchAdd(List<StreamPushItem> subList);
|
||||
|
||||
|
||||
@Update({"<script>" +
|
||||
"<foreach collection='gpsMsgInfos' item='item' separator=';'>" +
|
||||
" UPDATE" +
|
||||
" gb_stream" +
|
||||
" SET longitude=${item.lng}, latitude=${item.lat} " +
|
||||
"WHERE gbId=#{item.id}"+
|
||||
"</foreach>" +
|
||||
"</script>"})
|
||||
int updateStreamGPS(List<GPSMsgInfo> gpsMsgInfos);
|
||||
}
|
||||
|
||||
@@ -453,7 +453,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
@Override
|
||||
public void updateGpsMsgInfo(GPSMsgInfo gpsMsgInfo) {
|
||||
String key = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetup.getServerId() + "_" + gpsMsgInfo.getId();
|
||||
redis.set(key, gpsMsgInfo);
|
||||
redis.set(key, gpsMsgInfo, 60); // 默认GPS消息保存1分钟
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -476,4 +476,20 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
public void delSubscribe(String key) {
|
||||
redis.del(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GPSMsgInfo> getAllGpsMsgInfo() {
|
||||
String scanKey = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetup.getServerId() + "_*";
|
||||
List<GPSMsgInfo> result = new ArrayList<>();
|
||||
List<Object> keys = redis.scan(scanKey);
|
||||
for (int i = 0; i < keys.size(); i++) {
|
||||
String key = (String) keys.get(i);
|
||||
GPSMsgInfo gpsMsgInfo = (GPSMsgInfo) redis.get(key);
|
||||
if (!gpsMsgInfo.isStored()) { // 只取没有存过得
|
||||
result.add((GPSMsgInfo)redis.get(key));
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
|
||||
import com.genersoft.iot.vmp.service.IGbStreamService;
|
||||
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
|
||||
import com.genersoft.iot.vmp.storager.dao.*;
|
||||
@@ -898,4 +899,9 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateStreamGPS(List<GPSMsgInfo> gpsMsgInfos) {
|
||||
return gbStreamMapper.updateStreamGPS(gpsMsgInfos);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user