支持无论位置信息是否变化都按照固定频率发送位置信息

2.7.1
lin 2025-02-07 16:38:20 +08:00
parent b98050e346
commit 5d10e5f3d6
14 changed files with 156 additions and 96 deletions

View File

@ -74,6 +74,8 @@ public class UserSetting {
private boolean registerKeepIntDialog = false; private boolean registerKeepIntDialog = false;
private boolean sendPositionOnDemand = true;
public Boolean getSavePositionHistory() { public Boolean getSavePositionHistory() {
return savePositionHistory; return savePositionHistory;
} }
@ -325,4 +327,13 @@ public class UserSetting {
public void setDocEnable(Boolean docEnable) { public void setDocEnable(Boolean docEnable) {
this.docEnable = docEnable; this.docEnable = docEnable;
} }
public boolean isSendPositionOnDemand() {
return sendPositionOnDemand;
}
public void setSendPositionOnDemand(boolean sendPositionOnDemand) {
this.sendPositionOnDemand = sendPositionOnDemand;
}
} }

View File

@ -258,6 +258,24 @@ public class DeviceChannel {
@Schema(description = "GPS的更新时间") @Schema(description = "GPS的更新时间")
private String gpsTime; private String gpsTime;
/**
* ,:km/h ()
*/
@Schema(description = "GPS的速度")
private Double gpsSpeed;
/**
* ,,0°~360°,:(°)()
*/
@Schema(description = "GPS的方向")
private String gpsDirection;
/**
* ,:m()
*/
@Schema(description = "GPS的海拔高度")
private String gpsAltitude;
@Schema(description = "码流标识,优先级高于设备中码流标识," + @Schema(description = "码流标识,优先级高于设备中码流标识," +
"用于选择码流时组成码流标识。默认为null不设置。可选值: stream/streamnumber/streamprofile/streamMode") "用于选择码流时组成码流标识。默认为null不设置。可选值: stream/streamnumber/streamprofile/streamMode")
private String streamIdentification; private String streamIdentification;
@ -614,4 +632,29 @@ public class DeviceChannel {
public void setCustomLatitude(double customLatitude) { public void setCustomLatitude(double customLatitude) {
this.customLatitude = customLatitude; this.customLatitude = customLatitude;
} }
public Double getGpsSpeed() {
return gpsSpeed;
}
public void setGpsSpeed(Double gpsSpeed) {
this.gpsSpeed = gpsSpeed;
}
public String getGpsDirection() {
return gpsDirection;
}
public void setGpsDirection(String gpsDirection) {
this.gpsDirection = gpsDirection;
}
public String getGpsAltitude() {
return gpsAltitude;
}
public void setGpsAltitude(String gpsAltitude) {
this.gpsAltitude = gpsAltitude;
}
} }

View File

@ -528,9 +528,9 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
.append("<Time>" + gpsMsgInfo.getTime() + "</Time>\r\n") .append("<Time>" + 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() == null?"":gpsMsgInfo.getSpeed()) + "</Speed>\r\n")
.append("<Direction>" + gpsMsgInfo.getDirection() + "</Direction>\r\n") .append("<Direction>" + (gpsMsgInfo.getDirection() == null ? "" : gpsMsgInfo.getDirection()) + "</Direction>\r\n")
.append("<Altitude>" + gpsMsgInfo.getAltitude() + "</Altitude>\r\n") .append("<Altitude>" + (gpsMsgInfo.getAltitude() == null ? "" : gpsMsgInfo.getAltitude()) + "</Altitude>\r\n")
.append("</Notify>\r\n"); .append("</Notify>\r\n");
sendNotify(parentPlatform, deviceStatusXml.toString(), subscribeInfo, eventResult -> { sendNotify(parentPlatform, deviceStatusXml.toString(), subscribeInfo, eventResult -> {

View File

@ -166,6 +166,10 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements
deviceChannel.setLongitude(mobilePosition.getLongitude()); deviceChannel.setLongitude(mobilePosition.getLongitude());
deviceChannel.setLatitude(mobilePosition.getLatitude()); deviceChannel.setLatitude(mobilePosition.getLatitude());
deviceChannel.setGpsTime(mobilePosition.getTime()); deviceChannel.setGpsTime(mobilePosition.getTime());
deviceChannel.setGpsSpeed(mobilePosition.getSpeed());
deviceChannel.setGpsAltitude(mobilePosition.getAltitude() + "");
deviceChannel.setGpsDirection(mobilePosition.getDirection() + "");
deviceChannel = deviceChannelService.updateGps(deviceChannel, device); deviceChannel = deviceChannelService.updateGps(deviceChannel, device);

View File

@ -13,17 +13,17 @@ public class GPSMsgInfo {
/** /**
* () * ()
*/ */
private double lng; private Double lng;
/** /**
* () * ()
*/ */
private double lat; private Double lat;
/** /**
* ,:km/h () * ,:km/h ()
*/ */
private double speed; private Double speed;
/** /**
* , 2020-01-14T14:32:12 * , 2020-01-14T14:32:12
@ -63,27 +63,27 @@ public class GPSMsgInfo {
this.id = id; this.id = id;
} }
public double getLng() { public Double getLng() {
return lng; return lng;
} }
public void setLng(double lng) { public void setLng(Double lng) {
this.lng = lng; this.lng = lng;
} }
public double getLat() { public Double getLat() {
return lat; return lat;
} }
public void setLat(double lat) { public void setLat(Double lat) {
this.lat = lat; this.lat = lat;
} }
public double getSpeed() { public Double getSpeed() {
return speed; return speed;
} }
public void setSpeed(double speed) { public void setSpeed(Double speed) {
this.speed = speed; this.speed = speed;
} }

View File

@ -109,7 +109,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
channel = updateGps(channel, null); channel = updateGps(channel, null);
if (deviceChannel == null) { if (deviceChannel == null) {
channel.setCreateTime(now); channel.setCreateTime(now);
channelMapper.add(channel); addChannel(channel);
}else { }else {
channelMapper.update(channel); channelMapper.update(channel);
} }

View File

@ -1,10 +1,10 @@
package com.genersoft.iot.vmp.service.impl; package com.genersoft.iot.vmp.service.impl;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.genersoft.iot.vmp.common.InviteInfo; import com.genersoft.iot.vmp.common.InviteInfo;
import com.genersoft.iot.vmp.common.InviteSessionStatus; import com.genersoft.iot.vmp.common.InviteSessionStatus;
import com.genersoft.iot.vmp.common.InviteSessionType; import com.genersoft.iot.vmp.common.InviteSessionType;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.genersoft.iot.vmp.conf.DynamicTask; import com.genersoft.iot.vmp.conf.DynamicTask;
import com.genersoft.iot.vmp.conf.UserSetting; import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException; import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException;
@ -13,12 +13,10 @@ import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
import com.genersoft.iot.vmp.gb28181.session.SSRCFactory; import com.genersoft.iot.vmp.gb28181.session.SSRCFactory;
import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager;
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform; import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform;
import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe;
import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeFactory;
import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForStreamChange;
import com.genersoft.iot.vmp.gb28181.utils.SipUtils; import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory; import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory;
import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe;
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.hook.OnStreamChangedHookParam; import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam;
import com.genersoft.iot.vmp.service.IInviteStreamService; import com.genersoft.iot.vmp.service.IInviteStreamService;
@ -27,11 +25,11 @@ import com.genersoft.iot.vmp.service.IPlatformService;
import com.genersoft.iot.vmp.service.IPlayService; import com.genersoft.iot.vmp.service.IPlayService;
import com.genersoft.iot.vmp.service.bean.*; import com.genersoft.iot.vmp.service.bean.*;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage; import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.storager.dao.*; import com.genersoft.iot.vmp.storager.dao.GbStreamMapper;
import com.genersoft.iot.vmp.storager.dao.ParentPlatformMapper;
import com.genersoft.iot.vmp.utils.DateUtil; import com.genersoft.iot.vmp.utils.DateUtil;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import gov.nist.javax.sip.message.SIPRequest;
import gov.nist.javax.sip.message.SIPResponse; import gov.nist.javax.sip.message.SIPResponse;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -41,17 +39,8 @@ import org.springframework.stereotype.Service;
import javax.sdp.*; import javax.sdp.*;
import javax.sip.InvalidArgumentException; import javax.sip.InvalidArgumentException;
import javax.sip.ResponseEvent; import javax.sip.ResponseEvent;
import javax.sip.PeerUnavailableException;
import javax.sip.SipException; import javax.sip.SipException;
import java.text.ParseException; import java.text.ParseException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.*; import java.util.*;
/** /**
@ -437,19 +426,33 @@ public class PlatformServiceImpl implements IPlatformService {
if (subscribe != null) { if (subscribe != null) {
// TODO 暂时只处理视频流的回复,后续增加对国标设备的支持 // TODO 暂时只处理视频流的回复,后续增加对国标设备的支持
List<DeviceChannel> gbStreams = gbStreamMapper.queryGbStreamListInPlatform(platform.getServerGBId(), userSetting.isUsePushingAsStatus()); List<DeviceChannel> deviceChannelList = gbStreamMapper.queryGbStreamListInPlatform(platform.getServerGBId(), userSetting.isUsePushingAsStatus());
if (gbStreams.size() == 0) { if (deviceChannelList.isEmpty()) {
return; return;
} }
for (DeviceChannel deviceChannel : gbStreams) { for (DeviceChannel deviceChannel : deviceChannelList) {
String gbId = deviceChannel.getChannelId(); String gbId = deviceChannel.getChannelId();
GPSMsgInfo gpsMsgInfo = redisCatchStorage.getGpsMsgInfo(gbId); GPSMsgInfo gpsMsgInfo = redisCatchStorage.getGpsMsgInfo(gbId);
// 无最新位置不发送 // 无最新位置则发送当前位置
if (gpsMsgInfo != null) { if (gpsMsgInfo != null) {
// 经纬度都为0不发送 // 经纬度都为0不发送
if (gpsMsgInfo.getLng() == 0 && gpsMsgInfo.getLat() == 0) { if (gpsMsgInfo.getLng() == 0 || gpsMsgInfo.getLat() == 0) {
continue; gpsMsgInfo.setLng(deviceChannel.getLongitude());
gpsMsgInfo.setLat(deviceChannel.getLatitude());
} }
}else {
if (!userSetting.isSendPositionOnDemand()) {
gpsMsgInfo = new GPSMsgInfo();
gpsMsgInfo.setId(deviceChannel.getChannelId());
gpsMsgInfo.setLng(deviceChannel.getLongitude());
gpsMsgInfo.setLat(deviceChannel.getLatitude());
gpsMsgInfo.setAltitude(deviceChannel.getGpsAltitude());
gpsMsgInfo.setSpeed(deviceChannel.getGpsSpeed());
gpsMsgInfo.setDirection(deviceChannel.getGpsDirection());
gpsMsgInfo.setTime(deviceChannel.getGpsTime());
}
}
if (gpsMsgInfo != null) {
// 发送GPS消息 // 发送GPS消息
try { try {
commanderForPlatform.sendNotifyMobilePosition(platform, gpsMsgInfo, subscribe); commanderForPlatform.sendNotifyMobilePosition(platform, gpsMsgInfo, subscribe);

View File

@ -68,7 +68,7 @@ public class RedisGpsMsgListener implements MessageListener {
@Scheduled(fixedRate = 2 * 1000) //每2秒执行一次 @Scheduled(fixedRate = 2 * 1000) //每2秒执行一次
public void execute(){ public void execute(){
List<GPSMsgInfo> gpsMsgInfo = redisCatchStorage.getAllGpsMsgInfo(); List<GPSMsgInfo> gpsMsgInfo = redisCatchStorage.getAllGpsMsgInfo();
if (gpsMsgInfo.size() > 0) { if (!gpsMsgInfo.isEmpty()) {
storager.updateStreamGPS(gpsMsgInfo); storager.updateStreamGPS(gpsMsgInfo);
for (GPSMsgInfo msgInfo : gpsMsgInfo) { for (GPSMsgInfo msgInfo : gpsMsgInfo) {
msgInfo.setStored(true); msgInfo.setStored(true);

View File

@ -22,7 +22,8 @@ public interface DeviceChannelMapper {
"(channel_id, device_id, name, manufacture, model, owner, civil_code, block, sub_count, " + "(channel_id, device_id, name, manufacture, model, owner, civil_code, block, sub_count, " +
" address, parental, parent_id, safety_way, register_way, cert_num, certifiable, err_code, secrecy, " + " address, parental, parent_id, safety_way, register_way, cert_num, certifiable, err_code, secrecy, " +
" ip_address,port,password,ptz_type,status,stream_id,longitude,latitude,longitude_gcj02,latitude_gcj02,"+ " ip_address,port,password,ptz_type,status,stream_id,longitude,latitude,longitude_gcj02,latitude_gcj02,"+
" longitude_wgs84,latitude_wgs84,has_audio,create_time,update_time,business_group_id,gps_time,stream_identification)"+ " longitude_wgs84,latitude_wgs84,has_audio,create_time,update_time,business_group_id," +
" gps_time,gps_speed,gps_direction,gps_altitude,stream_identification)"+
"values " + "values " +
"(#{channelId}, #{deviceId}, #{name}, #{manufacture}, #{model}, " + "(#{channelId}, #{deviceId}, #{name}, #{manufacture}, #{model}, " +
"#{owner}, #{civilCode}, #{block},#{subCount}," + "#{owner}, #{civilCode}, #{block},#{subCount}," +
@ -31,7 +32,7 @@ public interface DeviceChannelMapper {
"#{ipAddress}, #{port}, #{password}, #{ptzType}, #{status}, " + "#{ipAddress}, #{port}, #{password}, #{ptzType}, #{status}, " +
"#{streamId}, #{longitude}, #{latitude},#{longitudeGcj02}, " + "#{streamId}, #{longitude}, #{latitude},#{longitudeGcj02}, " +
"#{latitudeGcj02},#{longitudeWgs84}, #{latitudeWgs84}, #{hasAudio}, now(), now(), " + "#{latitudeGcj02},#{longitudeWgs84}, #{latitudeWgs84}, #{hasAudio}, now(), now(), " +
"#{businessGroupId}, #{gpsTime}, #{streamIdentification}) " + "#{businessGroupId}, #{gpsTime}, #{gpsSpeed}, #{gpsDirection}, #{gpsAltitude}, #{streamIdentification}) " +
"</script>") "</script>")
int add(DeviceChannel channel); int add(DeviceChannel channel);
@ -68,6 +69,9 @@ public interface DeviceChannelMapper {
"<if test='latitudeWgs84 != null'>, latitude_wgs84=#{latitudeWgs84}</if>" + "<if test='latitudeWgs84 != null'>, latitude_wgs84=#{latitudeWgs84}</if>" +
"<if test='businessGroupId != null'>, business_group_id=#{businessGroupId}</if>" + "<if test='businessGroupId != null'>, business_group_id=#{businessGroupId}</if>" +
"<if test='gpsTime != null'>, gps_time=#{gpsTime}</if>" + "<if test='gpsTime != null'>, gps_time=#{gpsTime}</if>" +
"<if test='gpsSpeed != null'>, gps_speed=#{gpsSpeed}</if>" +
"<if test='gpsDirection != null'>, gps_direction=#{gpsDirection}</if>" +
"<if test='gpsAltitude != null'>, gps_altitude=#{gpsAltitude}</if>" +
"<if test='streamIdentification != null'>, stream_identification=#{streamIdentification}</if>" + "<if test='streamIdentification != null'>, stream_identification=#{streamIdentification}</if>" +
"WHERE device_id=#{deviceId} AND channel_id=#{channelId}"+ "WHERE device_id=#{deviceId} AND channel_id=#{channelId}"+
" </script>"}) " </script>"})
@ -107,6 +111,9 @@ public interface DeviceChannelMapper {
"<if test='latitudeWgs84 != null'>, latitude_wgs84=#{latitudeWgs84}</if>" + "<if test='latitudeWgs84 != null'>, latitude_wgs84=#{latitudeWgs84}</if>" +
"<if test='businessGroupId != null'>, business_group_id=#{businessGroupId}</if>" + "<if test='businessGroupId != null'>, business_group_id=#{businessGroupId}</if>" +
"<if test='gpsTime != null'>, gps_time=#{gpsTime}</if>" + "<if test='gpsTime != null'>, gps_time=#{gpsTime}</if>" +
"<if test='gpsSpeed != null'>, gps_speed=#{gpsSpeed}</if>" +
"<if test='gpsDirection != null'>, gps_direction=#{gpsDirection}</if>" +
"<if test='gpsAltitude != null'>, gps_altitude=#{gpsAltitude}</if>" +
"<if test='streamIdentification != null'>, stream_identification=#{streamIdentification}</if>" + "<if test='streamIdentification != null'>, stream_identification=#{streamIdentification}</if>" +
"<if test='id > 0'>WHERE id=#{id}</if>" + "<if test='id > 0'>WHERE id=#{id}</if>" +
"<if test='id == 0'>WHERE device_id=#{deviceId} AND channel_id=#{channelId}</if>" + "<if test='id == 0'>WHERE device_id=#{deviceId} AND channel_id=#{channelId}</if>" +
@ -154,7 +161,10 @@ public interface DeviceChannelMapper {
"dc.latitude_wgs84, " + "dc.latitude_wgs84, " +
"dc.business_group_id, " + "dc.business_group_id, " +
"dc.stream_identification, " + "dc.stream_identification, " +
"dc.gps_time " + "dc.gps_time, " +
"dc.gps_speed, " +
"dc.gps_direction, " +
"dc.gps_altitude " +
"from " + "from " +
"wvp_device_channel dc " + "wvp_device_channel dc " +
"WHERE " + "WHERE " +
@ -293,7 +303,8 @@ public interface DeviceChannelMapper {
"(channel_id, device_id, name, manufacture, model, owner, civil_code, block, sub_count, " + "(channel_id, device_id, name, manufacture, model, owner, civil_code, block, sub_count, " +
" address, parental, parent_id, safety_way, register_way, cert_num, certifiable, err_code, secrecy, " + " address, parental, parent_id, safety_way, register_way, cert_num, certifiable, err_code, secrecy, " +
" ip_address,port,password,ptz_type,status,stream_id,longitude,latitude,longitude_gcj02,latitude_gcj02,"+ " ip_address,port,password,ptz_type,status,stream_id,longitude,latitude,longitude_gcj02,latitude_gcj02,"+
" longitude_wgs84,latitude_wgs84,has_audio,create_time,update_time,business_group_id,gps_time,stream_identification)"+ " longitude_wgs84,latitude_wgs84,has_audio,create_time,update_time,business_group_id," +
" gps_time,gps_speed,gps_direction,gps_altitude,stream_identification)"+
"values " + "values " +
"<foreach collection='addChannels' index='index' item='item' separator=','> " + "<foreach collection='addChannels' index='index' item='item' separator=','> " +
"(#{item.channelId}, #{item.deviceId}, #{item.name}, #{item.manufacture}, #{item.model}, " + "(#{item.channelId}, #{item.deviceId}, #{item.name}, #{item.manufacture}, #{item.model}, " +
@ -303,65 +314,12 @@ public interface DeviceChannelMapper {
"#{item.ipAddress}, #{item.port}, #{item.password}, #{item.ptzType}, #{item.status}, " + "#{item.ipAddress}, #{item.port}, #{item.password}, #{item.ptzType}, #{item.status}, " +
"#{item.streamId}, #{item.longitude}, #{item.latitude},#{item.longitudeGcj02}, " + "#{item.streamId}, #{item.longitude}, #{item.latitude},#{item.longitudeGcj02}, " +
"#{item.latitudeGcj02},#{item.longitudeWgs84}, #{item.latitudeWgs84}, #{item.hasAudio}, now(), now(), " + "#{item.latitudeGcj02},#{item.longitudeWgs84}, #{item.latitudeWgs84}, #{item.hasAudio}, now(), now(), " +
"#{item.businessGroupId}, #{item.gpsTime}, #{item.streamIdentification}) " + "#{item.businessGroupId}, #{item.gpsTime}, #{item.gpsSpeed}, #{item.gpsDirection}, #{item.gpsAltitude}, #{item.streamIdentification}) " +
"</foreach> " + "</foreach> " +
"</script>") "</script>")
int batchAdd(@Param("addChannels") List<DeviceChannel> addChannels); int batchAdd(@Param("addChannels") List<DeviceChannel> addChannels);
@Insert("<script> " +
"insert into wvp_device_channel " +
"(channel_id,device_id,name,manufacture,model,owner,civil_code,block,sub_count,"+
" address,parental,parent_id,safety_way,register_way,cert_num,certifiable,err_code,secrecy,"+
" ip_address,port,password,ptz_type,status,stream_id,longitude,latitude,longitude_gcj02,latitude_gcj02,"+
" longitude_wgs84,latitude_wgs84,has_audio,create_time,update_time,business_group_id,gps_time)"+
"values " +
"<foreach collection='addChannels' index='index' item='item' separator=','> " +
"(#{item.channelId}, #{item.deviceId}, #{item.name}, #{item.manufacture}, #{item.model}, " +
"#{item.owner}, #{item.civilCode}, #{item.block},#{item.subCount}," +
"#{item.address}, #{item.parental}, #{item.parentId}, #{item.safetyWay}, #{item.registerWay}, " +
"#{item.certNum}, #{item.certifiable}, #{item.errCode}, #{item.secrecy}, " +
"#{item.ipAddress}, #{item.port}, #{item.password}, #{item.ptzType}, #{item.status}, " +
"#{item.streamId}, #{item.longitude}, #{item.latitude},#{item.longitudeGcj02}, " +
"#{item.latitudeGcj02},#{item.longitudeWgs84}, #{item.latitudeWgs84}, #{item.hasAudio}, now(), now(), " +
"#{item.businessGroupId}, #{item.gpsTime}) " +
"</foreach> " +
"ON DUPLICATE KEY UPDATE " +
"update_time=VALUES(update_time), " +
"name=VALUES(name), " +
"manufacture=VALUES(manufacture), " +
"model=VALUES(model), " +
"owner=VALUES(owner), " +
"civil_code=VALUES(civil_code), " +
"block=VALUES(block), " +
"sub_count=VALUES(sub_count), " +
"address=VALUES(address), " +
"parental=VALUES(parental), " +
"parent_id=VALUES(parent_id), " +
"safety_way=VALUES(safety_way), " +
"register_way=VALUES(register_way), " +
"cert_num=VALUES(cert_num), " +
"certifiable=VALUES(certifiable), " +
"err_code=VALUES(err_code), " +
"secrecy=VALUES(secrecy), " +
"ip_address=VALUES(ip_address), " +
"port=VALUES(port), " +
"password=VALUES(password), " +
"ptz_type=VALUES(ptz_type), " +
"status=VALUES(status), " +
"stream_id=VALUES(stream_id), " +
"longitude=VALUES(longitude), " +
"latitude=VALUES(latitude), " +
"longitude_gcj02=VALUES(longitude_gcj02), " +
"latitude_gcj02=VALUES(latitude_gcj02), " +
"longitude_wgs84=VALUES(longitude_wgs84), " +
"latitude_wgs84=VALUES(latitude_wgs84), " +
"has_audio=VALUES(has_audio), " +
"business_group_id=VALUES(business_group_id), " +
"gps_time=VALUES(gps_time)" +
"</script>")
int batchAddOrUpdate(List<DeviceChannel> addChannels);
@Update(value = {"UPDATE wvp_device_channel SET status=true WHERE device_id=#{deviceId} AND channel_id=#{channelId}"}) @Update(value = {"UPDATE wvp_device_channel SET status=true WHERE device_id=#{deviceId} AND channel_id=#{channelId}"})
void online(@Param("deviceId") String deviceId, @Param("channelId") String channelId); void online(@Param("deviceId") String deviceId, @Param("channelId") String channelId);
@ -403,6 +361,9 @@ public interface DeviceChannelMapper {
"<if test='item.latitudeWgs84 != null'>, latitude_wgs84=#{item.latitudeWgs84}</if>" + "<if test='item.latitudeWgs84 != null'>, latitude_wgs84=#{item.latitudeWgs84}</if>" +
"<if test='item.businessGroupId != null'>, business_group_id=#{item.businessGroupId}</if>" + "<if test='item.businessGroupId != null'>, business_group_id=#{item.businessGroupId}</if>" +
"<if test='item.gpsTime != null'>, gps_time=#{item.gpsTime}</if>" + "<if test='item.gpsTime != null'>, gps_time=#{item.gpsTime}</if>" +
"<if test='item.gpsSpeed != null'>, gps_speed=#{item.gpsSpeed}</if>" +
"<if test='item.gpsDirection != null'>, gps_direction=#{item.gpsDirection}</if>" +
"<if test='item.gpsAltitude != null'>, gps_altitude=#{item.gpsAltitude}</if>" +
"<if test='item.streamIdentification != null'>, stream_identification=#{item.streamIdentification}</if>" + "<if test='item.streamIdentification != null'>, stream_identification=#{item.streamIdentification}</if>" +
"<if test='item.id > 0'>WHERE id=#{item.id}</if>" + "<if test='item.id > 0'>WHERE id=#{item.id}</if>" +
"<if test='item.id == 0'>WHERE device_id=#{item.deviceId} AND channel_id=#{item.channelId}</if>" + "<if test='item.id == 0'>WHERE device_id=#{item.deviceId} AND channel_id=#{item.channelId}</if>" +
@ -443,6 +404,9 @@ public interface DeviceChannelMapper {
"latitude_gcj02=#{latitudeGcj02}, " + "latitude_gcj02=#{latitudeGcj02}, " +
"longitude_wgs84=#{longitudeWgs84}, " + "longitude_wgs84=#{longitudeWgs84}, " +
"latitude_wgs84=#{latitudeWgs84}, " + "latitude_wgs84=#{latitudeWgs84}, " +
"gps_speed=#{gpsSpeed}," +
"gps_direction=#{gpsDirection}," +
"gps_altitude=#{gpsAltitude}," +
"gps_time=#{gpsTime} " + "gps_time=#{gpsTime} " +
"WHERE device_id=#{deviceId} " + "WHERE device_id=#{deviceId} " +
" <if test='channelId != null' > AND channel_id=#{channelId}</if>" + " <if test='channelId != null' > AND channel_id=#{channelId}</if>" +
@ -508,6 +472,10 @@ public interface DeviceChannelMapper {
",longitude_wgs84"+ ",longitude_wgs84"+
",latitude_gcj02"+ ",latitude_gcj02"+
",longitude_gcj02"+ ",longitude_gcj02"+
",gps_time"+
",gps_speed"+
",gps_direction"+
",gps_altitude"+
"from wvp_device_channel where device_id = #{deviceId} " + "from wvp_device_channel where device_id = #{deviceId} " +
"and latitude != 0 " + "and latitude != 0 " +
"and longitude != 0 " + "and longitude != 0 " +
@ -588,7 +556,10 @@ public interface DeviceChannelMapper {
" longitude_wgs84,\n" + " longitude_wgs84,\n" +
" latitude_wgs84,\n" + " latitude_wgs84,\n" +
" business_group_id,\n" + " business_group_id,\n" +
" gps_time\n" + " gps_time," +
" gps_speed,"+
" gps_direction,"+
" gps_altitude"+
"from wvp_device_channel " + "from wvp_device_channel " +
"where device_id=#{deviceId}" + "where device_id=#{deviceId}" +
" <if test='parentId != null and parentId != deviceId'> and parent_id = #{parentId} </if>" + " <if test='parentId != null and parentId != deviceId'> and parent_id = #{parentId} </if>" +
@ -616,6 +587,9 @@ public interface DeviceChannelMapper {
"<if test='item.longitudeWgs84 != null'>, longitude_wgs84=#{item.longitudeWgs84}</if>" + "<if test='item.longitudeWgs84 != null'>, longitude_wgs84=#{item.longitudeWgs84}</if>" +
"<if test='item.latitudeWgs84 != null'>, latitude_wgs84=#{item.latitudeWgs84}</if>" + "<if test='item.latitudeWgs84 != null'>, latitude_wgs84=#{item.latitudeWgs84}</if>" +
"<if test='item.gpsTime != null'>, gps_time=#{item.gpsTime}</if>" + "<if test='item.gpsTime != null'>, gps_time=#{item.gpsTime}</if>" +
"<if test='item.gpsSpeed != null'>, gps_speed=#{item.gpsSpeed}</if>" +
"<if test='item.gpsDirection != null'>, gps_direction=#{item.gpsDirection}</if>" +
"<if test='item.gpsAltitude != null'>, gps_altitude=#{item.gpsAltitude}</if>" +
"<if test='item.id > 0'>WHERE id=#{item.id}</if>" + "<if test='item.id > 0'>WHERE id=#{item.id}</if>" +
"<if test='item.id == 0'>WHERE device_id=#{item.deviceId} AND channel_id=#{item.channelId}</if>" + "<if test='item.id == 0'>WHERE device_id=#{item.deviceId} AND channel_id=#{item.channelId}</if>" +
"</foreach>" + "</foreach>" +

View File

@ -243,6 +243,8 @@ user-settings:
register-keep-int-dialog: false register-keep-int-dialog: false
# 开启接口文档页面。 默认开启生产环境建议关闭遇到swagger相关的漏洞时也可以关闭 # 开启接口文档页面。 默认开启生产环境建议关闭遇到swagger相关的漏洞时也可以关闭
doc-enable: true doc-enable: true
# 按需发送位置, 默认发送移动位置订阅时如果位置不变则不发送, 设置为false按照国标间隔持续发送
send-position-on-demand: true
# 跨域配置,不配置此项则允许所有跨域请求,配置后则只允许配置的页面的地址请求, 可以配置多个 # 跨域配置,不配置此项则允许所有跨域请求,配置后则只允许配置的页面的地址请求, 可以配置多个
allowed-origins: allowed-origins:
- http://localhost:8008 - http://localhost:8008

View File

@ -1,4 +1,5 @@
/*建表*/ /*建表*/
/*建表*/
create table wvp_device ( create table wvp_device (
id serial primary key , id serial primary key ,
device_id character varying(50) not null , device_id character varying(50) not null ,
@ -91,6 +92,9 @@ create table wvp_device_channel (
latitude_wgs84 double precision, latitude_wgs84 double precision,
business_group_id character varying(50), business_group_id character varying(50),
gps_time character varying(50), gps_time character varying(50),
gps_speed double precision,
gps_direction character varying(255),
gps_altitude character varying(255),
stream_identification character varying(50), stream_identification character varying(50),
constraint uk_wvp_device_channel_unique_device_channel unique (device_id, channel_id) constraint uk_wvp_device_channel_unique_device_channel unique (device_id, channel_id)
); );

View File

@ -91,6 +91,9 @@ create table wvp_device_channel (
latitude_wgs84 double precision, latitude_wgs84 double precision,
business_group_id character varying(50), business_group_id character varying(50),
gps_time character varying(50), gps_time character varying(50),
gps_speed double precision,
gps_direction character varying(255),
gps_altitude character varying(255),
stream_identification character varying(50), stream_identification character varying(50),
constraint uk_wvp_device_channel_unique_device_channel unique (device_id, channel_id) constraint uk_wvp_device_channel_unique_device_channel unique (device_id, channel_id)
); );

View File

@ -3,3 +3,11 @@ alter table wvp_media_server
alter table wvp_platform_catalog alter table wvp_platform_catalog
add civil_code_for_channel character varying(50); add civil_code_for_channel character varying(50);
/* 20250207 */
alter table wvp_device_channel add gps_speed double precision;
alter table wvp_device_channel add gps_direction character varying(255);
alter table wvp_device_channel add gps_altitude character varying(255);

View File

@ -3,3 +3,11 @@ alter table wvp_media_server
alter table wvp_platform_catalog alter table wvp_platform_catalog
add civil_code_for_channel character varying(50); add civil_code_for_channel character varying(50);
/* 20250207 */
alter table wvp_device_channel add gps_speed double precision;
alter table wvp_device_channel add gps_direction character varying(255);
alter table wvp_device_channel add gps_altitude character varying(255);