支持移动位置订阅通知的数据存储

pull/1489/head
648540858 2024-05-11 17:48:47 +08:00
parent 622d72b3f0
commit e6a850891e
5 changed files with 43 additions and 5 deletions

View File

@ -111,7 +111,7 @@ public class NotifyRequestForMobilePositionProcessor extends SIPRequestProcessor
if (!ObjectUtils.isEmpty(device.getName())) { if (!ObjectUtils.isEmpty(device.getName())) {
mobilePosition.setDeviceName(device.getName()); mobilePosition.setDeviceName(device.getName());
} }
mobilePosition.setDeviceName(device.getName());
mobilePosition.setDeviceId(device.getDeviceId()); mobilePosition.setDeviceId(device.getDeviceId());
mobilePosition.setChannelId(channelId); mobilePosition.setChannelId(channelId);
String time = XmlUtil.getText(rootElement, "Time"); String time = XmlUtil.getText(rootElement, "Time");

View File

@ -103,7 +103,6 @@ public class SendRtpPortManager {
return port; return port;
} }
} }
} }
interface CheckPortCallback{ interface CheckPortCallback{

View File

@ -356,11 +356,14 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
@Override @Override
public void batchUpdateChannelGPS(List<DeviceChannel> channelList) { public void batchUpdateChannelGPS(List<DeviceChannel> channelList) {
channelMapper.batchUpdatePosition(channelList);
} }
@Override @Override
public void batchAddMobilePosition(List<MobilePosition> mobilePositions) { public void batchAddMobilePosition(List<MobilePosition> mobilePositions) {
deviceMobilePositionMapper.batchInsert(mobilePositions);
}
} }
}

View File

@ -554,4 +554,24 @@ public interface DeviceChannelMapper {
" <if test='channelId != null'> and channel_id = #{channelId} </if>" + " <if test='channelId != null'> and channel_id = #{channelId} </if>" +
"</script>") "</script>")
void updateChannelStreamIdentification(DeviceChannel channel); void updateChannelStreamIdentification(DeviceChannel channel);
@Update({"<script>" +
"<foreach collection='channelList' item='item' separator=';'>" +
" UPDATE" +
" wvp_device_channel" +
" SET update_time=#{item.updateTime}" +
"<if test='item.longitude != null'>, longitude=#{item.longitude}</if>" +
"<if test='item.latitude != null'>, latitude=#{item.latitude}</if>" +
"<if test='item.longitudeGcj02 != null'>, longitude_gcj02=#{item.longitudeGcj02}</if>" +
"<if test='item.latitudeGcj02 != null'>, latitude_gcj02=#{item.latitudeGcj02}</if>" +
"<if test='item.longitudeWgs84 != null'>, longitude_wgs84=#{item.longitudeWgs84}</if>" +
"<if test='item.latitudeWgs84 != null'>, latitude_wgs84=#{item.latitudeWgs84}</if>" +
"<if test='item.gpsTime != null'>, gps_time=#{item.gpsTime}</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>" +
"</foreach>" +
"</script>"})
void batchUpdatePosition(List<DeviceChannel> channelList);
} }

View File

@ -13,7 +13,8 @@ import java.util.List;
public interface DeviceMobilePositionMapper { public interface DeviceMobilePositionMapper {
@Insert("INSERT INTO wvp_device_mobile_position (device_id,channel_id, device_name,time,longitude,latitude,altitude,speed,direction,report_source,longitude_gcj02,latitude_gcj02,longitude_wgs84,latitude_wgs84,create_time)"+ @Insert("INSERT INTO wvp_device_mobile_position (device_id,channel_id, device_name,time,longitude,latitude,altitude,speed,direction,report_source,longitude_gcj02,latitude_gcj02,longitude_wgs84,latitude_wgs84,create_time)"+
"VALUES (#{deviceId}, #{channelId}, #{deviceName}, #{time}, #{longitude}, #{latitude}, #{altitude}, #{speed}, #{direction}, #{reportSource}, #{longitudeGcj02}, #{latitudeGcj02}, #{longitudeWgs84}, #{latitudeWgs84}, #{createTime})") "VALUES (#{deviceId}, #{channelId}, #{deviceName}, #{time}, #{longitude}, #{latitude}, #{altitude}, " +
"#{speed}, #{direction}, #{reportSource}, #{longitudeGcj02}, #{latitudeGcj02}, #{longitudeWgs84}, #{latitudeWgs84}, #{createTime})")
int insertNewPosition(MobilePosition mobilePosition); int insertNewPosition(MobilePosition mobilePosition);
@Select(value = {" <script>" + @Select(value = {" <script>" +
@ -33,4 +34,19 @@ public interface DeviceMobilePositionMapper {
@Delete("DELETE FROM wvp_device_mobile_position WHERE device_id = #{deviceId}") @Delete("DELETE FROM wvp_device_mobile_position WHERE device_id = #{deviceId}")
int clearMobilePositionsByDeviceId(String deviceId); int clearMobilePositionsByDeviceId(String deviceId);
@Insert("<script> " +
"insert into wvp_device_mobile_position " +
"(device_id,channel_id, device_name,time,longitude," +
"latitude,altitude,speed,direction," +
"report_source,longitude_gcj02,latitude_gcj02," +
"longitude_wgs84,latitude_wgs84,create_time)"+
"values " +
"<foreach collection='mobilePositions' index='index' item='item' separator=','> " +
"(#{item.deviceId}, #{item.channelId}, #{item.deviceName}, #{item.time}, #{item.longitude}, " +
"#{item.latitude}, #{item.altitude}, #{item.speed},#{item.direction}," +
"#{item.reportSource}, #{item.longitudeGcj02}, #{item.latitudeGcj02}, " +
"#{item.longitudeWgs84}, #{item.latitudeWgs84}, #{item.createTime}) " +
"</foreach> " +
"</script>")
void batchInsert(List<MobilePosition> mobilePositions);
} }