修复国标级联注册失败
This commit is contained in:
@@ -34,5 +34,5 @@ public class SipConfig {
|
|||||||
|
|
||||||
private boolean alarm = false;
|
private boolean alarm = false;
|
||||||
|
|
||||||
private long timeout = 150;
|
private long timeout = 500;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -190,5 +190,11 @@ public class UserSetting {
|
|||||||
*/
|
*/
|
||||||
private boolean autoRegisterPlatform = false;
|
private boolean autoRegisterPlatform = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按需发送推流设备位置, 默认发送移动位置订阅时如果位置不变则不发送, 设置为false按照国标间隔持续发送
|
||||||
|
*/
|
||||||
|
private boolean sendPositionOnDemand = true;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,6 +86,18 @@ public class CommonGBChannel {
|
|||||||
@Schema(description = "国标-纬度 WGS-84坐标系")
|
@Schema(description = "国标-纬度 WGS-84坐标系")
|
||||||
private Double gbLatitude;
|
private Double gbLatitude;
|
||||||
|
|
||||||
|
@Schema(description = "")
|
||||||
|
private Double gpsAltitude;
|
||||||
|
|
||||||
|
@Schema(description = "")
|
||||||
|
private Double gpsSpeed;
|
||||||
|
|
||||||
|
@Schema(description = "")
|
||||||
|
private Double gpsDirection;
|
||||||
|
|
||||||
|
@Schema(description = "")
|
||||||
|
private String gbGpsTime;
|
||||||
|
|
||||||
@Schema(description = "国标-虚拟组织所属的业务分组ID")
|
@Schema(description = "国标-虚拟组织所属的业务分组ID")
|
||||||
private String gbBusinessGroupId;
|
private String gbBusinessGroupId;
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.gb28181.dao;
|
|||||||
|
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||||
import com.genersoft.iot.vmp.gb28181.dao.provider.ChannelProvider;
|
import com.genersoft.iot.vmp.gb28181.dao.provider.ChannelProvider;
|
||||||
|
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
||||||
import com.genersoft.iot.vmp.streamPush.bean.StreamPush;
|
import com.genersoft.iot.vmp.streamPush.bean.StreamPush;
|
||||||
import org.apache.ibatis.annotations.*;
|
import org.apache.ibatis.annotations.*;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
@@ -451,13 +452,18 @@ public interface CommonGBChannelMapper {
|
|||||||
List<CommonGBChannel> queryListByStreamPushList(@Param("dataType") Integer dataType, List<StreamPush> streamPushList);
|
List<CommonGBChannel> queryListByStreamPushList(@Param("dataType") Integer dataType, List<StreamPush> streamPushList);
|
||||||
|
|
||||||
@Update(value = {" <script>" +
|
@Update(value = {" <script>" +
|
||||||
" <foreach collection='channels' item='item' separator=';' >" +
|
" <foreach collection='gpsMsgInfoList' item='item' separator=';' >" +
|
||||||
" UPDATE wvp_device_channel " +
|
" UPDATE wvp_device_channel " +
|
||||||
" SET gb_longitude=#{item.gbLongitude}, gb_latitude=#{item.gbLatitude} " +
|
" SET gb_longitude=#{item.lng}" +
|
||||||
" WHERE data_type = #{dataType} AND gb_device_id=#{item.gbDeviceId} "+
|
", gb_latitude=#{item.lat} " +
|
||||||
|
", gps_speed=#{item.speed} " +
|
||||||
|
", gps_altitude=#{item.altitude} " +
|
||||||
|
", gps_direction=#{item.direction} " +
|
||||||
|
", gps_time=#{item.time} " +
|
||||||
|
" WHERE gb_device_id=#{item.id} "+
|
||||||
"</foreach>"+
|
"</foreach>"+
|
||||||
" </script>"})
|
" </script>"})
|
||||||
void updateGpsByDeviceIdForStreamPush(@Param("dataType") Integer dataType, List<CommonGBChannel> channels);
|
void updateGpsByDeviceId(List<GPSMsgInfo> gpsMsgInfoList);
|
||||||
|
|
||||||
@SelectProvider(type = ChannelProvider.class, method = "queryList")
|
@SelectProvider(type = ChannelProvider.class, method = "queryList")
|
||||||
List<CommonGBChannel> queryList(@Param("query") String query, @Param("online") Boolean online,
|
List<CommonGBChannel> queryList(@Param("query") String query, @Param("online") Boolean online,
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.gb28181.service;
|
|||||||
|
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||||
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
|
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
|
||||||
|
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
||||||
import com.genersoft.iot.vmp.streamPush.bean.StreamPush;
|
import com.genersoft.iot.vmp.streamPush.bean.StreamPush;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
|
|
||||||
@@ -84,8 +85,6 @@ public interface IGbChannelService {
|
|||||||
|
|
||||||
List<CommonGBChannel> queryListByStreamPushList(List<StreamPush> streamPushList);
|
List<CommonGBChannel> queryListByStreamPushList(List<StreamPush> streamPushList);
|
||||||
|
|
||||||
void updateGpsByDeviceIdForStreamPush(List<CommonGBChannel> channels);
|
|
||||||
|
|
||||||
PageInfo<CommonGBChannel> queryList(int page, int count, String query, Boolean online, Boolean hasRecordPlan, Integer channelType);
|
PageInfo<CommonGBChannel> queryList(int page, int count, String query, Boolean online, Boolean hasRecordPlan, Integer channelType);
|
||||||
|
|
||||||
void queryRecordInfo(CommonGBChannel channel, String startTime, String endTime, ErrorCallback<RecordInfo> callback);
|
void queryRecordInfo(CommonGBChannel channel, String startTime, String endTime, ErrorCallback<RecordInfo> callback);
|
||||||
@@ -97,4 +96,7 @@ public interface IGbChannelService {
|
|||||||
PageInfo<CommonGBChannel> queryListByParentForUnusual(int page, int count, String query, Boolean online, Integer channelType);
|
PageInfo<CommonGBChannel> queryListByParentForUnusual(int page, int count, String query, Boolean online, Integer channelType);
|
||||||
|
|
||||||
void clearChannelParent(Boolean all, List<Integer> channelIds);
|
void clearChannelParent(Boolean all, List<Integer> channelIds);
|
||||||
|
|
||||||
|
void updateGPSFromGPSMsgInfo(List<GPSMsgInfo> gpsMsgInfoList);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import com.genersoft.iot.vmp.gb28181.service.IDeviceChannelService;
|
|||||||
import com.genersoft.iot.vmp.gb28181.service.IGbChannelService;
|
import com.genersoft.iot.vmp.gb28181.service.IGbChannelService;
|
||||||
import com.genersoft.iot.vmp.gb28181.service.IPlatformChannelService;
|
import com.genersoft.iot.vmp.gb28181.service.IPlatformChannelService;
|
||||||
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
|
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
|
||||||
|
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
||||||
import com.genersoft.iot.vmp.streamPush.bean.StreamPush;
|
import com.genersoft.iot.vmp.streamPush.bean.StreamPush;
|
||||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||||
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
||||||
@@ -715,11 +716,6 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
|||||||
return commonGBChannelMapper.queryListByStreamPushList(ChannelDataType.STREAM_PUSH.value, streamPushList);
|
return commonGBChannelMapper.queryListByStreamPushList(ChannelDataType.STREAM_PUSH.value, streamPushList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateGpsByDeviceIdForStreamPush(List<CommonGBChannel> channels) {
|
|
||||||
commonGBChannelMapper.updateGpsByDeviceIdForStreamPush(ChannelDataType.STREAM_PUSH.value, channels);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageInfo<CommonGBChannel> queryList(int page, int count, String query, Boolean online, Boolean hasRecordPlan, Integer channelType) {
|
public PageInfo<CommonGBChannel> queryList(int page, int count, String query, Boolean online, Boolean hasRecordPlan, Integer channelType) {
|
||||||
PageHelper.startPage(page, count);
|
PageHelper.startPage(page, count);
|
||||||
@@ -797,4 +793,12 @@ public class GbChannelServiceImpl implements IGbChannelService {
|
|||||||
}
|
}
|
||||||
commonGBChannelMapper.removeParentIdByChannelIds(channelIdsForClear);
|
commonGBChannelMapper.removeParentIdByChannelIds(channelIdsForClear);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateGPSFromGPSMsgInfo(List<GPSMsgInfo> gpsMsgInfoList) {
|
||||||
|
if (gpsMsgInfoList == null || gpsMsgInfoList.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
commonGBChannelMapper.updateGpsByDeviceId(gpsMsgInfoList);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -559,12 +559,25 @@ public class PlatformServiceImpl implements IPlatformService {
|
|||||||
}
|
}
|
||||||
for (CommonGBChannel channel : channelList) {
|
for (CommonGBChannel channel : channelList) {
|
||||||
GPSMsgInfo gpsMsgInfo = redisCatchStorage.getGpsMsgInfo(channel.getGbDeviceId());
|
GPSMsgInfo gpsMsgInfo = redisCatchStorage.getGpsMsgInfo(channel.getGbDeviceId());
|
||||||
|
|
||||||
|
// 无最新位置则发送当前位置
|
||||||
|
if (gpsMsgInfo != null && (gpsMsgInfo.getLng() == 0 && gpsMsgInfo.getLat() == 0)) {
|
||||||
|
gpsMsgInfo = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gpsMsgInfo == null && !userSetting.isSendPositionOnDemand()){
|
||||||
|
gpsMsgInfo = new GPSMsgInfo();
|
||||||
|
gpsMsgInfo.setId(channel.getGbDeviceId());
|
||||||
|
gpsMsgInfo.setLng(channel.getGbLongitude());
|
||||||
|
gpsMsgInfo.setLat(channel.getGbLatitude());
|
||||||
|
gpsMsgInfo.setAltitude(channel.getGpsAltitude());
|
||||||
|
gpsMsgInfo.setSpeed(channel.getGpsSpeed());
|
||||||
|
gpsMsgInfo.setDirection(channel.getGpsDirection());
|
||||||
|
gpsMsgInfo.setTime(channel.getGbGpsTime());
|
||||||
|
}
|
||||||
|
|
||||||
// 无最新位置不发送
|
// 无最新位置不发送
|
||||||
if (gpsMsgInfo != null) {
|
if (gpsMsgInfo != null) {
|
||||||
// 经纬度都为0不发送
|
|
||||||
if (gpsMsgInfo.getLng() == 0 && gpsMsgInfo.getLat() == 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// 发送GPS消息
|
// 发送GPS消息
|
||||||
try {
|
try {
|
||||||
commanderForPlatform.sendNotifyMobilePosition(platform, gpsMsgInfo, channel, subscribe);
|
commanderForPlatform.sendNotifyMobilePosition(platform, gpsMsgInfo, channel, subscribe);
|
||||||
|
|||||||
@@ -84,18 +84,16 @@ public class SIPProcessorObserver implements ISIPProcessorObserver {
|
|||||||
|
|
||||||
// Success
|
// Success
|
||||||
if (((status >= Response.OK) && (status < Response.MULTIPLE_CHOICES)) || status == Response.UNAUTHORIZED) {
|
if (((status >= Response.OK) && (status < Response.MULTIPLE_CHOICES)) || status == Response.UNAUTHORIZED) {
|
||||||
if (status != Response.UNAUTHORIZED && responseEvent.getResponse() != null && !sipSubscribe.isEmpty() ) {
|
CallIdHeader callIdHeader = response.getCallIdHeader();
|
||||||
CallIdHeader callIdHeader = response.getCallIdHeader();
|
CSeqHeader cSeqHeader = response.getCSeqHeader();
|
||||||
CSeqHeader cSeqHeader = response.getCSeqHeader();
|
if (callIdHeader != null) {
|
||||||
if (callIdHeader != null) {
|
SipEvent sipEvent = sipSubscribe.getSubscribe(callIdHeader.getCallId() + cSeqHeader.getSeqNumber());
|
||||||
SipEvent sipEvent = sipSubscribe.getSubscribe(callIdHeader.getCallId() + cSeqHeader.getSeqNumber());
|
if (sipEvent != null) {
|
||||||
if (sipEvent != null) {
|
if (sipEvent.getOkEvent() != null) {
|
||||||
if (sipEvent.getOkEvent() != null) {
|
SipSubscribe.EventResult<ResponseEvent> eventResult = new SipSubscribe.EventResult<>(responseEvent);
|
||||||
SipSubscribe.EventResult<ResponseEvent> eventResult = new SipSubscribe.EventResult<>(responseEvent);
|
sipEvent.getOkEvent().response(eventResult);
|
||||||
sipEvent.getOkEvent().response(eventResult);
|
|
||||||
}
|
|
||||||
sipSubscribe.removeSubscribe(callIdHeader.getCallId() + cSeqHeader.getSeqNumber());
|
|
||||||
}
|
}
|
||||||
|
sipSubscribe.removeSubscribe(callIdHeader.getCallId() + cSeqHeader.getSeqNumber());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ISIPResponseProcessor sipRequestProcessor = responseProcessorMap.get(response.getCSeqHeader().getMethod());
|
ISIPResponseProcessor sipRequestProcessor = responseProcessorMap.get(response.getCSeqHeader().getMethod());
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ public class SIPCommanderForPlatform implements ISIPCommanderForPlatform {
|
|||||||
if (errorEvent != null ) {
|
if (errorEvent != null ) {
|
||||||
errorEvent.response(event);
|
errorEvent.response(event);
|
||||||
}
|
}
|
||||||
}, okEvent, 5L);
|
}, okEvent, 2000L);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -369,7 +369,7 @@ public class SIPCommanderForPlatform implements ISIPCommanderForPlatform {
|
|||||||
.append("<CmdType>MobilePosition</CmdType>\r\n")
|
.append("<CmdType>MobilePosition</CmdType>\r\n")
|
||||||
.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n")
|
.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n")
|
||||||
.append("<DeviceID>" + channel.getGbDeviceId() + "</DeviceID>\r\n")
|
.append("<DeviceID>" + channel.getGbDeviceId() + "</DeviceID>\r\n")
|
||||||
.append("<Time>" + gpsMsgInfo.getTime() + "</Time>\r\n")
|
.append("<Time>" + DateUtil.yyyy_MM_dd_HH_mm_ssToISO8601(gpsMsgInfo.getTime()) + "</Time>\r\n")
|
||||||
.append("<Longitude>" + gpsMsgInfo.getLng() + "</Longitude>\r\n")
|
.append("<Longitude>" + gpsMsgInfo.getLng() + "</Longitude>\r\n")
|
||||||
.append("<Latitude>" + gpsMsgInfo.getLat() + "</Latitude>\r\n")
|
.append("<Latitude>" + gpsMsgInfo.getLat() + "</Latitude>\r\n")
|
||||||
.append("<Speed>" + gpsMsgInfo.getSpeed() + "</Speed>\r\n")
|
.append("<Speed>" + gpsMsgInfo.getSpeed() + "</Speed>\r\n")
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class GPSMsgInfo {
|
|||||||
/**
|
/**
|
||||||
* 速度,单位:km/h (可选)
|
* 速度,单位:km/h (可选)
|
||||||
*/
|
*/
|
||||||
private double speed;
|
private Double speed;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 产生通知时间, 时间格式: 2020-01-14T14:32:12
|
* 产生通知时间, 时间格式: 2020-01-14T14:32:12
|
||||||
@@ -40,23 +40,23 @@ public class GPSMsgInfo {
|
|||||||
/**
|
/**
|
||||||
* 方向,取值为当前摄像头方向与正北方的顺时针夹角,取值范围0°~360°,单位:(°)(可选)
|
* 方向,取值为当前摄像头方向与正北方的顺时针夹角,取值范围0°~360°,单位:(°)(可选)
|
||||||
*/
|
*/
|
||||||
private String direction;
|
private Double direction;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 海拔高度,单位:m(可选)
|
* 海拔高度,单位:m(可选)
|
||||||
*/
|
*/
|
||||||
private String altitude;
|
private Double altitude;
|
||||||
|
|
||||||
private boolean stored;
|
private boolean stored;
|
||||||
|
|
||||||
public static GPSMsgInfo getInstance(MobilePosition mobilePosition) {
|
public static GPSMsgInfo getInstance(MobilePosition mobilePosition) {
|
||||||
GPSMsgInfo gpsMsgInfo = new GPSMsgInfo();
|
GPSMsgInfo gpsMsgInfo = new GPSMsgInfo();
|
||||||
gpsMsgInfo.setChannelId(mobilePosition.getChannelId());
|
gpsMsgInfo.setChannelId(mobilePosition.getChannelId());
|
||||||
gpsMsgInfo.setAltitude(mobilePosition.getAltitude() + "");
|
gpsMsgInfo.setAltitude(mobilePosition.getAltitude());
|
||||||
gpsMsgInfo.setLng(mobilePosition.getLongitude());
|
gpsMsgInfo.setLng(mobilePosition.getLongitude());
|
||||||
gpsMsgInfo.setLat(mobilePosition.getLatitude());
|
gpsMsgInfo.setLat(mobilePosition.getLatitude());
|
||||||
gpsMsgInfo.setSpeed(mobilePosition.getSpeed());
|
gpsMsgInfo.setSpeed(mobilePosition.getSpeed());
|
||||||
gpsMsgInfo.setDirection(mobilePosition.getDirection() + "");
|
gpsMsgInfo.setDirection(mobilePosition.getDirection());
|
||||||
gpsMsgInfo.setTime(DateUtil.yyyy_MM_dd_HH_mm_ssToISO8601(mobilePosition.getTime()));
|
gpsMsgInfo.setTime(DateUtil.yyyy_MM_dd_HH_mm_ssToISO8601(mobilePosition.getTime()));
|
||||||
return gpsMsgInfo;
|
return gpsMsgInfo;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
package com.genersoft.iot.vmp.service.redisMsg;
|
package com.genersoft.iot.vmp.service.redisMsg;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
import com.genersoft.iot.vmp.gb28181.service.IGbChannelService;
|
||||||
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
import com.genersoft.iot.vmp.streamPush.service.IStreamPushService;
|
import com.genersoft.iot.vmp.streamPush.service.IStreamPushService;
|
||||||
|
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -15,9 +17,11 @@ import org.springframework.stereotype.Component;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 接收来自redis的GPS更新通知, 此处只针对推流设备
|
* 接收来自redis的GPS更新通知
|
||||||
*
|
*
|
||||||
* @author lin
|
* @author lin
|
||||||
* 监听: SUBSCRIBE VM_MSG_GPS
|
* 监听: SUBSCRIBE VM_MSG_GPS
|
||||||
@@ -33,6 +37,9 @@ public class RedisGpsMsgListener implements MessageListener {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IStreamPushService streamPushService;
|
private IStreamPushService streamPushService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IGbChannelService channelService;
|
||||||
|
|
||||||
private final ConcurrentLinkedQueue<Message> taskQueue = new ConcurrentLinkedQueue<>();
|
private final ConcurrentLinkedQueue<Message> taskQueue = new ConcurrentLinkedQueue<>();
|
||||||
|
|
||||||
|
|
||||||
@@ -42,7 +49,7 @@ public class RedisGpsMsgListener implements MessageListener {
|
|||||||
taskQueue.offer(message);
|
taskQueue.offer(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Scheduled(fixedDelay = 200) //每400毫秒执行一次
|
@Scheduled(fixedDelay = 200, timeUnit = TimeUnit.MILLISECONDS) //每400毫秒执行一次
|
||||||
public void executeTaskQueue() {
|
public void executeTaskQueue() {
|
||||||
if (taskQueue.isEmpty()) {
|
if (taskQueue.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
@@ -61,6 +68,7 @@ public class RedisGpsMsgListener implements MessageListener {
|
|||||||
for (Message msg : messageDataList) {
|
for (Message msg : messageDataList) {
|
||||||
try {
|
try {
|
||||||
GPSMsgInfo gpsMsgInfo = JSON.parseObject(msg.getBody(), GPSMsgInfo.class);
|
GPSMsgInfo gpsMsgInfo = JSON.parseObject(msg.getBody(), GPSMsgInfo.class);
|
||||||
|
gpsMsgInfo.setTime(DateUtil.ISO8601Toyyyy_MM_dd_HH_mm_ss(gpsMsgInfo.getTime()));
|
||||||
log.info("[REDIS的位置变化通知], {}", JSON.toJSONString(gpsMsgInfo));
|
log.info("[REDIS的位置变化通知], {}", JSON.toJSONString(gpsMsgInfo));
|
||||||
// 只是放入redis缓存起来
|
// 只是放入redis缓存起来
|
||||||
redisCatchStorage.updateGpsMsgInfo(gpsMsgInfo);
|
redisCatchStorage.updateGpsMsgInfo(gpsMsgInfo);
|
||||||
@@ -74,15 +82,18 @@ public class RedisGpsMsgListener implements MessageListener {
|
|||||||
/**
|
/**
|
||||||
* 定时将经纬度更新到数据库
|
* 定时将经纬度更新到数据库
|
||||||
*/
|
*/
|
||||||
@Scheduled(fixedDelay = 2 * 1000) //每2秒执行一次
|
@Scheduled(fixedDelay = 2, timeUnit = TimeUnit.SECONDS) //每2秒执行一次
|
||||||
public void execute() {
|
public void execute() {
|
||||||
// 需要查询到
|
// 需要查询到
|
||||||
List<GPSMsgInfo> gpsMsgInfoList = redisCatchStorage.getAllGpsMsgInfo();
|
List<GPSMsgInfo> gpsMsgInfoList = redisCatchStorage.getAllGpsMsgInfo();
|
||||||
if (!gpsMsgInfoList.isEmpty()) {
|
if (!gpsMsgInfoList.isEmpty()) {
|
||||||
streamPushService.updateGPSFromGPSMsgInfo(gpsMsgInfoList);
|
gpsMsgInfoList = gpsMsgInfoList.stream().filter(gpsMsgInfo -> !gpsMsgInfo.isStored()).collect(Collectors.toList());;
|
||||||
for (GPSMsgInfo msgInfo : gpsMsgInfoList) {
|
if (!gpsMsgInfoList.isEmpty()) {
|
||||||
msgInfo.setStored(true);
|
channelService.updateGPSFromGPSMsgInfo(gpsMsgInfoList);
|
||||||
redisCatchStorage.updateGpsMsgInfo(msgInfo);
|
for (GPSMsgInfo msgInfo : gpsMsgInfoList) {
|
||||||
|
msgInfo.setStored(true);
|
||||||
|
redisCatchStorage.updateGpsMsgInfo(msgInfo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,6 +77,30 @@ public class StreamPush extends CommonGBChannel implements Comparable<StreamPush
|
|||||||
@Schema(description = "拉起离线推流")
|
@Schema(description = "拉起离线推流")
|
||||||
private boolean startOfflinePush;
|
private boolean startOfflinePush;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 速度,单位:km/h (可选)
|
||||||
|
*/
|
||||||
|
@Schema(description = "GPS的速度")
|
||||||
|
private Double gpsSpeed;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 方向,取值为当前摄像头方向与正北方的顺时针夹角,取值范围0°~360°,单位:(°)(可选)
|
||||||
|
*/
|
||||||
|
@Schema(description = "GPS的方向")
|
||||||
|
private Double gpsDirection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 海拔高度,单位:m(可选)
|
||||||
|
*/
|
||||||
|
@Schema(description = "GPS的海拔高度")
|
||||||
|
private Double gpsAltitude;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GPS的更新时间
|
||||||
|
*/
|
||||||
|
@Schema(description = "GPS的更新时间")
|
||||||
|
private String gpsTime;
|
||||||
|
|
||||||
private String uniqueKey;
|
private String uniqueKey;
|
||||||
|
|
||||||
private Integer dataType = ChannelDataType.STREAM_PUSH.value;
|
private Integer dataType = ChannelDataType.STREAM_PUSH.value;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.genersoft.iot.vmp.streamPush.service;
|
package com.genersoft.iot.vmp.streamPush.service;
|
||||||
|
|
||||||
import com.genersoft.iot.vmp.media.bean.MediaServer;
|
import com.genersoft.iot.vmp.media.bean.MediaServer;
|
||||||
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
|
||||||
import com.genersoft.iot.vmp.service.bean.StreamPushItemFromRedis;
|
import com.genersoft.iot.vmp.service.bean.StreamPushItemFromRedis;
|
||||||
import com.genersoft.iot.vmp.streamPush.bean.StreamPush;
|
import com.genersoft.iot.vmp.streamPush.bean.StreamPush;
|
||||||
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo;
|
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo;
|
||||||
@@ -98,5 +97,4 @@ public interface IStreamPushService {
|
|||||||
|
|
||||||
void batchRemove(Set<Integer> ids);
|
void batchRemove(Set<Integer> ids);
|
||||||
|
|
||||||
void updateGPSFromGPSMsgInfo(List<GPSMsgInfo> gpsMsgInfoList);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import com.genersoft.iot.vmp.media.service.IMediaServerService;
|
|||||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo;
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.hook.OriginType;
|
import com.genersoft.iot.vmp.media.zlm.dto.hook.OriginType;
|
||||||
import com.genersoft.iot.vmp.service.ISendRtpServerService;
|
import com.genersoft.iot.vmp.service.ISendRtpServerService;
|
||||||
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
|
||||||
import com.genersoft.iot.vmp.service.bean.StreamPushItemFromRedis;
|
import com.genersoft.iot.vmp.service.bean.StreamPushItemFromRedis;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
import com.genersoft.iot.vmp.streamPush.bean.StreamPush;
|
import com.genersoft.iot.vmp.streamPush.bean.StreamPush;
|
||||||
@@ -586,17 +585,4 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
|||||||
streamPushMapper.batchDel(streamPushList);
|
streamPushMapper.batchDel(streamPushList);
|
||||||
gbChannelService.delete(ids);
|
gbChannelService.delete(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateGPSFromGPSMsgInfo(List<GPSMsgInfo> gpsMsgInfoList) {
|
|
||||||
List<CommonGBChannel> channels = new ArrayList<>();
|
|
||||||
for (GPSMsgInfo gpsMsgInfo : gpsMsgInfoList) {
|
|
||||||
CommonGBChannel channel = new CommonGBChannel();
|
|
||||||
channel.setGbDeviceId(gpsMsgInfo.getId());
|
|
||||||
channel.setGbLongitude(gpsMsgInfo.getLng());
|
|
||||||
channel.setGbLatitude(gpsMsgInfo.getLat());
|
|
||||||
channels.add(channel);
|
|
||||||
}
|
|
||||||
gbChannelService.updateGpsByDeviceIdForStreamPush(channels);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -249,6 +249,8 @@ user-settings:
|
|||||||
jwk-file: classpath:jwk.json
|
jwk-file: classpath:jwk.json
|
||||||
# wvp集群模式下如果注册向上级的wvp奔溃,则自动选择一个其他wvp继续注册到上级
|
# wvp集群模式下如果注册向上级的wvp奔溃,则自动选择一个其他wvp继续注册到上级
|
||||||
auto-register-platform: true
|
auto-register-platform: true
|
||||||
|
# 按需发送位置, 默认发送移动位置订阅时如果位置不变则不发送, 设置为false按照国标间隔持续发送
|
||||||
|
send-position-on-demand: true
|
||||||
|
|
||||||
# 关闭在线文档(生产环境建议关闭)
|
# 关闭在线文档(生产环境建议关闭)
|
||||||
springdoc:
|
springdoc:
|
||||||
|
|||||||
@@ -156,6 +156,9 @@ create table IF NOT EXISTS wvp_device_channel
|
|||||||
record_plan_id integer,
|
record_plan_id integer,
|
||||||
data_type integer not null,
|
data_type integer not null,
|
||||||
data_device_id integer not null,
|
data_device_id integer not null,
|
||||||
|
gps_speed double precision,
|
||||||
|
gps_altitude double precision,
|
||||||
|
gps_direction double precision,
|
||||||
constraint uk_wvp_unique_channel unique (gb_device_id)
|
constraint uk_wvp_unique_channel unique (gb_device_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -156,6 +156,9 @@ create table IF NOT EXISTS wvp_device_channel
|
|||||||
record_plan_id integer,
|
record_plan_id integer,
|
||||||
data_type integer not null,
|
data_type integer not null,
|
||||||
data_device_id integer not null,
|
data_device_id integer not null,
|
||||||
|
gps_speed double precision,
|
||||||
|
gps_altitude double precision,
|
||||||
|
gps_direction double precision,
|
||||||
constraint uk_wvp_unique_channel unique (gb_device_id)
|
constraint uk_wvp_unique_channel unique (gb_device_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -167,6 +167,9 @@ create table IF NOT EXISTS wvp_device_channel
|
|||||||
record_plan_id integer,
|
record_plan_id integer,
|
||||||
data_type integer not null,
|
data_type integer not null,
|
||||||
data_device_id integer not null,
|
data_device_id integer not null,
|
||||||
|
gps_speed double precision,
|
||||||
|
gps_altitude double precision,
|
||||||
|
gps_direction double precision,
|
||||||
constraint uk_wvp_unique_channel unique (gb_device_id)
|
constraint uk_wvp_unique_channel unique (gb_device_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -233,3 +233,32 @@ call wvp_20250312();
|
|||||||
DROP PROCEDURE wvp_20250312;
|
DROP PROCEDURE wvp_20250312;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 20250319
|
||||||
|
*/
|
||||||
|
CREATE PROCEDURE `wvp_20250319`()
|
||||||
|
BEGIN
|
||||||
|
IF NOT EXISTS (SELECT column_name FROM information_schema.STATISTICS
|
||||||
|
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device_channel' and column_name = 'gps_speed')
|
||||||
|
THEN
|
||||||
|
alter table wvp_device_channel add gps_speed double precision;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
IF NOT EXISTS (SELECT column_name FROM information_schema.STATISTICS
|
||||||
|
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device_channel' and column_name = 'gps_altitude')
|
||||||
|
THEN
|
||||||
|
alter table wvp_device_channel add gps_altitude double precision;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
IF NOT EXISTS (SELECT column_name FROM information_schema.STATISTICS
|
||||||
|
WHERE TABLE_SCHEMA = (SELECT DATABASE()) and table_name = 'wvp_device_channel' and column_name = 'gps_direction')
|
||||||
|
THEN
|
||||||
|
alter table wvp_device_channel add gps_direction double precision;
|
||||||
|
END IF;
|
||||||
|
END;
|
||||||
|
call wvp_20250319();
|
||||||
|
DROP PROCEDURE wvp_20250319;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -134,6 +134,9 @@ create table IF NOT EXISTS wvp_device_channel
|
|||||||
record_plan_id integer,
|
record_plan_id integer,
|
||||||
data_type integer not null,
|
data_type integer not null,
|
||||||
data_device_id integer not null,
|
data_device_id integer not null,
|
||||||
|
gps_speed double precision,
|
||||||
|
gps_altitude double precision,
|
||||||
|
gps_direction double precision,
|
||||||
constraint uk_wvp_unique_channel unique (gb_device_id)
|
constraint uk_wvp_unique_channel unique (gb_device_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -95,5 +95,11 @@ update wvp_media_server set server_id = '你的服务ID';
|
|||||||
update wvp_stream_proxy set server_id = '你的服务ID';
|
update wvp_stream_proxy set server_id = '你的服务ID';
|
||||||
update wvp_cloud_record set server_id = '你的服务ID';
|
update wvp_cloud_record set server_id = '你的服务ID';
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 20250319
|
||||||
|
*/
|
||||||
|
alter table wvp_device_channel add column if not exists gps_speed double precision;
|
||||||
|
alter table wvp_device_channel add column if not exists gps_altitude double precision;
|
||||||
|
alter table wvp_device_channel add column if not exists gps_direction double precision;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user