移除旧的数据库操作类
This commit is contained in:
@@ -1,53 +0,0 @@
|
||||
package com.genersoft.iot.vmp.storager;
|
||||
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.MobilePosition;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Platform;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description:视频设备数据存储接口
|
||||
* @author: swwheihei
|
||||
* @date: 2020年5月6日 下午2:14:31
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public interface IVideoManagerStorage {
|
||||
|
||||
|
||||
|
||||
Device queryVideoDeviceByPlatformIdAndChannelId(String platformId, String channelId);
|
||||
|
||||
/**
|
||||
* 针对deviceinfo指令的查询接口
|
||||
* @param platformId 平台id
|
||||
* @param channelId 通道id
|
||||
* @return 设备信息
|
||||
*/
|
||||
Device queryDeviceInfoByPlatformIdAndChannelId(String platformId, String channelId);
|
||||
|
||||
/**
|
||||
* 查询移动位置轨迹
|
||||
* @param deviceId
|
||||
* @param startTime
|
||||
* @param endTime
|
||||
*/
|
||||
public List<MobilePosition> queryMobilePositions(String deviceId, String channelId, String startTime, String endTime);
|
||||
|
||||
/**
|
||||
* 查询最新移动位置
|
||||
* @param deviceId
|
||||
*/
|
||||
public MobilePosition queryLatestPosition(String deviceId);
|
||||
|
||||
|
||||
/**
|
||||
* 根据通道ID获取其所在设备
|
||||
* @param channelId 通道ID
|
||||
* @return
|
||||
*/
|
||||
Device queryVideoDeviceByChannelId(String channelId);
|
||||
|
||||
List<Platform> queryEnablePlatformListWithAsMessageChannel();
|
||||
|
||||
}
|
||||
@@ -1,112 +0,0 @@
|
||||
package com.genersoft.iot.vmp.storager.impl;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.MobilePosition;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Platform;
|
||||
import com.genersoft.iot.vmp.gb28181.dao.*;
|
||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 视频设备数据存储-jdbc实现
|
||||
* swwheihei
|
||||
* 2020年5月6日 下午2:31:42
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Slf4j
|
||||
@Component
|
||||
@DS("master")
|
||||
public class VideoManagerStorageImpl implements IVideoManagerStorage {
|
||||
|
||||
|
||||
@Autowired
|
||||
private DeviceMapper deviceMapper;
|
||||
|
||||
@Autowired
|
||||
private DeviceChannelMapper deviceChannelMapper;
|
||||
|
||||
@Autowired
|
||||
private DeviceMobilePositionMapper deviceMobilePositionMapper;
|
||||
|
||||
@Autowired
|
||||
private PlatformMapper platformMapper;
|
||||
|
||||
@Autowired
|
||||
private PlatformChannelMapper platformChannelMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 查询移动位置轨迹
|
||||
* @param deviceId
|
||||
* @param startTime
|
||||
* @param endTime
|
||||
*/
|
||||
@Override
|
||||
public synchronized List<MobilePosition> queryMobilePositions(String deviceId, String channelId, String startTime, String endTime) {
|
||||
return deviceMobilePositionMapper.queryPositionByDeviceIdAndTime(deviceId, channelId, startTime, endTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Platform> queryEnablePlatformListWithAsMessageChannel() {
|
||||
return platformMapper.queryEnablePlatformListWithAsMessageChannel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Device queryVideoDeviceByPlatformIdAndChannelId(String platformId, String channelId) {
|
||||
List<Device> devices = platformChannelMapper.queryDeviceByPlatformIdAndChannelId(platformId, channelId);
|
||||
if (devices.size() > 1) {
|
||||
// 出现长度大于0的时候肯定是国标通道的ID重复了
|
||||
log.warn("国标ID存在重复:{}", channelId);
|
||||
}
|
||||
if (devices.size() == 0) {
|
||||
return null;
|
||||
}else {
|
||||
return devices.get(0);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Device queryDeviceInfoByPlatformIdAndChannelId(String platformId, String channelId) {
|
||||
List<Device> devices = platformChannelMapper.queryDeviceInfoByPlatformIdAndChannelId(platformId, channelId);
|
||||
if (devices.size() > 1) {
|
||||
// 出现长度大于0的时候肯定是国标通道的ID重复了
|
||||
log.warn("国标ID存在重复:{}", channelId);
|
||||
}
|
||||
if (devices.size() == 0) {
|
||||
return null;
|
||||
}else {
|
||||
return devices.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询最新移动位置
|
||||
* @param deviceId
|
||||
*/
|
||||
@Override
|
||||
public MobilePosition queryLatestPosition(String deviceId) {
|
||||
return deviceMobilePositionMapper.queryLatestPositionByDevice(deviceId);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Device queryVideoDeviceByChannelId( String channelId) {
|
||||
Device result = null;
|
||||
List<DeviceChannel> channelList = deviceChannelMapper.queryChannelByChannelId(channelId);
|
||||
if (channelList.size() == 1) {
|
||||
result = deviceMapper.getDeviceByDeviceId(channelList.get(0).getDeviceId());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user