修复轨迹的储存与查询展示

This commit is contained in:
648540858
2022-07-04 01:08:26 +08:00
parent 5d673fb033
commit 10cb58391a
16 changed files with 510 additions and 408 deletions

View File

@@ -463,5 +463,5 @@ public interface IVideoManagerStorage {
List<ChannelSourceInfo> getChannelSource(String platformId, String gbId);
void updateChannelPotion(String deviceId, String channelId, double longitude, double latitude);
void updateChannelPosition(DeviceChannel deviceChannel);
}

View File

@@ -276,8 +276,19 @@ public interface DeviceChannelMapper {
" and channelId = #{channelId}")
int updateChannelSubCount(String deviceId, String channelId);
@Update(value = {"UPDATE device_channel SET latitude=${latitude}, longitude=${longitude} WHERE deviceId=#{deviceId} AND channelId=#{channelId}"})
void updatePotion(String deviceId, String channelId, double longitude, double latitude);
@Update(value = {" <script>" +
"UPDATE device_channel " +
"SET " +
"latitude=${latitude}, " +
"longitude=${longitude}, " +
"longitudeGcj02=${longitudeGcj02}," +
"latitudeGcj02=${latitudeGcj02}," +
"longitudeWgs84=${longitudeWgs84}," +
"latitudeWgs84=${latitudeWgs84} " +
"WHERE deviceId=#{deviceId} " +
" <if test='channelId != null' > AND channelId=#{channelId}</if>" +
" </script>"})
void updatePosition(DeviceChannel deviceChannel);
@Select("SELECT * FROM device_channel WHERE length(trim(streamId)) > 0")
List<DeviceChannel> getAllChannelInPlay();
@@ -313,4 +324,6 @@ public interface DeviceChannelMapper {
@Select("select * from device_channel where deviceId=#{deviceId} and SUBSTRING(channelId, 11, 3)=#{typeCode}")
List<DeviceChannel> getBusinessGroups(String deviceId, String typeCode);
}

View File

@@ -4,19 +4,18 @@ import java.util.List;
import com.genersoft.iot.vmp.gb28181.bean.MobilePosition;
import org.apache.ibatis.annotations.*;
//import org.springframework.stereotype.Repository;
@Mapper
//@Repository
public interface DeviceMobilePositionMapper {
@Insert("INSERT INTO device_mobile_position (deviceId,channelId, deviceName, time, longitude, latitude, altitude, speed, direction, reportSource, geodeticSystem, cnLng, cnLat) " +
"VALUES ('${deviceId}','${channelId}', '${deviceName}', '${time}', ${longitude}, ${latitude}, ${altitude}, ${speed}, ${direction}, '${reportSource}', '${geodeticSystem}', '${cnLng}', '${cnLat}')")
@Insert("INSERT INTO device_mobile_position (deviceId,channelId, deviceName, time, longitude, latitude, altitude, speed, direction, reportSource, longitudeGcj02, latitudeGcj02, longitudeWgs84, latitudeWgs84) " +
"VALUES ('${deviceId}','${channelId}', '${deviceName}', '${time}', ${longitude}, ${latitude}, ${altitude}, ${speed}, ${direction}, '${reportSource}', ${longitudeGcj02}, ${latitudeGcj02}, ${longitudeWgs84}, ${latitudeWgs84})")
int insertNewPosition(MobilePosition mobilePosition);
@Select(value = {" <script>" +
"SELECT * FROM device_mobile_position" +
" WHERE deviceId = #{deviceId} and channelId = #{channelId} " +
" WHERE deviceId = #{deviceId}" +
"<if test=\"channelId != null\"> and channelId = #{channelId}</if>" +
"<if test=\"startTime != null\"> AND time&gt;=#{startTime}</if>" +
"<if test=\"endTime != null\"> AND time&lt;=#{endTime}</if>" +
" ORDER BY time ASC" +

View File

@@ -472,6 +472,9 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
*/
@Override
public synchronized boolean insertMobilePosition(MobilePosition mobilePosition) {
if (mobilePosition.getDeviceId().equals(mobilePosition.getChannelId())) {
mobilePosition.setChannelId(null);
}
return deviceMobilePositionMapper.insertNewPosition(mobilePosition) > 0;
}
@@ -1119,7 +1122,10 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
}
@Override
public void updateChannelPotion(String deviceId, String channelId, double longitude, double latitude) {
deviceChannelMapper.updatePotion(deviceId, channelId, longitude, latitude);
public void updateChannelPosition(DeviceChannel deviceChannel) {
if (deviceChannel.getChannelId().equals(deviceChannel.getDeviceId())) {
deviceChannel.setChannelId(null);
}
deviceChannelMapper.updatePosition(deviceChannel);
}
}