修复国标级联注册失败

This commit is contained in:
lin
2025-03-20 09:21:01 +08:00
parent ccafa0ea01
commit ec74488b4a
21 changed files with 166 additions and 57 deletions

View File

@@ -86,6 +86,18 @@ public class CommonGBChannel {
@Schema(description = "国标-纬度 WGS-84坐标系")
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")
private String gbBusinessGroupId;

View File

@@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.gb28181.dao;
import com.genersoft.iot.vmp.gb28181.bean.*;
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 org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;
@@ -451,13 +452,18 @@ public interface CommonGBChannelMapper {
List<CommonGBChannel> queryListByStreamPushList(@Param("dataType") Integer dataType, List<StreamPush> streamPushList);
@Update(value = {" <script>" +
" <foreach collection='channels' item='item' separator=';' >" +
" <foreach collection='gpsMsgInfoList' item='item' separator=';' >" +
" UPDATE wvp_device_channel " +
" SET gb_longitude=#{item.gbLongitude}, gb_latitude=#{item.gbLatitude} " +
" WHERE data_type = #{dataType} AND gb_device_id=#{item.gbDeviceId} "+
" SET gb_longitude=#{item.lng}" +
", 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>"+
" </script>"})
void updateGpsByDeviceIdForStreamPush(@Param("dataType") Integer dataType, List<CommonGBChannel> channels);
void updateGpsByDeviceId(List<GPSMsgInfo> gpsMsgInfoList);
@SelectProvider(type = ChannelProvider.class, method = "queryList")
List<CommonGBChannel> queryList(@Param("query") String query, @Param("online") Boolean online,

View File

@@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.gb28181.service;
import com.genersoft.iot.vmp.gb28181.bean.*;
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.github.pagehelper.PageInfo;
@@ -84,8 +85,6 @@ public interface IGbChannelService {
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);
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);
void clearChannelParent(Boolean all, List<Integer> channelIds);
void updateGPSFromGPSMsgInfo(List<GPSMsgInfo> gpsMsgInfoList);
}

View File

@@ -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.IPlatformChannelService;
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.utils.DateUtil;
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);
}
@Override
public void updateGpsByDeviceIdForStreamPush(List<CommonGBChannel> channels) {
commonGBChannelMapper.updateGpsByDeviceIdForStreamPush(ChannelDataType.STREAM_PUSH.value, channels);
}
@Override
public PageInfo<CommonGBChannel> queryList(int page, int count, String query, Boolean online, Boolean hasRecordPlan, Integer channelType) {
PageHelper.startPage(page, count);
@@ -797,4 +793,12 @@ public class GbChannelServiceImpl implements IGbChannelService {
}
commonGBChannelMapper.removeParentIdByChannelIds(channelIdsForClear);
}
@Override
public void updateGPSFromGPSMsgInfo(List<GPSMsgInfo> gpsMsgInfoList) {
if (gpsMsgInfoList == null || gpsMsgInfoList.isEmpty()) {
return;
}
commonGBChannelMapper.updateGpsByDeviceId(gpsMsgInfoList);
}
}

View File

@@ -559,12 +559,25 @@ public class PlatformServiceImpl implements IPlatformService {
}
for (CommonGBChannel channel : channelList) {
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) {
// 经纬度都为0不发送
if (gpsMsgInfo.getLng() == 0 && gpsMsgInfo.getLat() == 0) {
continue;
}
// 发送GPS消息
try {
commanderForPlatform.sendNotifyMobilePosition(platform, gpsMsgInfo, channel, subscribe);

View File

@@ -84,18 +84,16 @@ public class SIPProcessorObserver implements ISIPProcessorObserver {
// Success
if (((status >= Response.OK) && (status < Response.MULTIPLE_CHOICES)) || status == Response.UNAUTHORIZED) {
if (status != Response.UNAUTHORIZED && responseEvent.getResponse() != null && !sipSubscribe.isEmpty() ) {
CallIdHeader callIdHeader = response.getCallIdHeader();
CSeqHeader cSeqHeader = response.getCSeqHeader();
if (callIdHeader != null) {
SipEvent sipEvent = sipSubscribe.getSubscribe(callIdHeader.getCallId() + cSeqHeader.getSeqNumber());
if (sipEvent != null) {
if (sipEvent.getOkEvent() != null) {
SipSubscribe.EventResult<ResponseEvent> eventResult = new SipSubscribe.EventResult<>(responseEvent);
sipEvent.getOkEvent().response(eventResult);
}
sipSubscribe.removeSubscribe(callIdHeader.getCallId() + cSeqHeader.getSeqNumber());
CallIdHeader callIdHeader = response.getCallIdHeader();
CSeqHeader cSeqHeader = response.getCSeqHeader();
if (callIdHeader != null) {
SipEvent sipEvent = sipSubscribe.getSubscribe(callIdHeader.getCallId() + cSeqHeader.getSeqNumber());
if (sipEvent != null) {
if (sipEvent.getOkEvent() != null) {
SipSubscribe.EventResult<ResponseEvent> eventResult = new SipSubscribe.EventResult<>(responseEvent);
sipEvent.getOkEvent().response(eventResult);
}
sipSubscribe.removeSubscribe(callIdHeader.getCallId() + cSeqHeader.getSeqNumber());
}
}
ISIPResponseProcessor sipRequestProcessor = responseProcessorMap.get(response.getCSeqHeader().getMethod());

View File

@@ -136,7 +136,7 @@ public class SIPCommanderForPlatform implements ISIPCommanderForPlatform {
if (errorEvent != null ) {
errorEvent.response(event);
}
}, okEvent, 5L);
}, okEvent, 2000L);
}
@Override
@@ -369,7 +369,7 @@ public class SIPCommanderForPlatform implements ISIPCommanderForPlatform {
.append("<CmdType>MobilePosition</CmdType>\r\n")
.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\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("<Latitude>" + gpsMsgInfo.getLat() + "</Latitude>\r\n")
.append("<Speed>" + gpsMsgInfo.getSpeed() + "</Speed>\r\n")