重构以适配postgresql

This commit is contained in:
648540858
2023-05-12 10:37:03 +08:00
parent ccecda7859
commit d849352441
34 changed files with 1265 additions and 844 deletions

View File

@@ -1,8 +0,0 @@
package com.genersoft.iot.vmp.service;
import com.genersoft.iot.vmp.storager.dao.dto.RecordInfo;
import com.github.pagehelper.PageInfo;
public interface IRecordInfoServer {
PageInfo<RecordInfo> getRecordList(int page, int count);
}

View File

@@ -118,7 +118,7 @@ public class DeviceServiceImpl implements IDeviceService {
// 第一次上线 或则设备之前是离线状态--进行通道同步和设备信息查询
if (device.getCreateTime() == null) {
device.setOnline(1);
device.setOnline(true);
device.setCreateTime(now);
logger.info("[设备上线,首次注册]: {},查询设备信息以及通道信息", device.getDeviceId());
deviceMapper.add(device);
@@ -130,8 +130,8 @@ public class DeviceServiceImpl implements IDeviceService {
}
sync(device);
}else {
if(device.getOnline() == 0){
device.setOnline(1);
if(!device.isOnline()){
device.setOnline(true);
device.setCreateTime(now);
deviceMapper.update(device);
redisCatchStorage.updateDevice(device);
@@ -185,7 +185,7 @@ public class DeviceServiceImpl implements IDeviceService {
}
String registerExpireTaskKey = VideoManagerConstants.REGISTER_EXPIRE_TASK_KEY_PREFIX + deviceId;
dynamicTask.stop(registerExpireTaskKey);
device.setOnline(0);
device.setOnline(false);
redisCatchStorage.updateDevice(device);
deviceMapper.update(device);
//进行通道离线
@@ -231,7 +231,7 @@ public class DeviceServiceImpl implements IDeviceService {
}
logger.info("[移除目录订阅]: {}", device.getDeviceId());
String taskKey = device.getDeviceId() + "catalog";
if (device.getOnline() == 1) {
if (device.isOnline()) {
Runnable runnable = dynamicTask.get(taskKey);
if (runnable instanceof ISubscribeTask) {
ISubscribeTask subscribeTask = (ISubscribeTask) runnable;
@@ -264,7 +264,7 @@ public class DeviceServiceImpl implements IDeviceService {
}
logger.info("[移除移动位置订阅]: {}", device.getDeviceId());
String taskKey = device.getDeviceId() + "mobile_position";
if (device.getOnline() == 1) {
if (device.isOnline()) {
Runnable runnable = dynamicTask.get(taskKey);
if (runnable instanceof ISubscribeTask) {
ISubscribeTask subscribeTask = (ISubscribeTask) runnable;
@@ -331,7 +331,7 @@ public class DeviceServiceImpl implements IDeviceService {
@Override
public void checkDeviceStatus(Device device) {
if (device == null || device.getOnline() == 0) {
if (device == null || !device.isOnline()) {
return;
}
try {
@@ -535,7 +535,7 @@ public class DeviceServiceImpl implements IDeviceService {
if (haveChannel) {
// 查询那些civilCode不在通道中的不规范通道放置在根目录
List<DeviceChannel> nonstandardNode = deviceChannelMapper.getChannelWithoutCiviCode(deviceId);
List<DeviceChannel> nonstandardNode = deviceChannelMapper.getChannelWithoutCivilCode(deviceId);
if (nonstandardNode != null && nonstandardNode.size() > 0) {
result.addAll(nonstandardNode);
}
@@ -568,7 +568,7 @@ public class DeviceServiceImpl implements IDeviceService {
@Override
public void addDevice(Device device) {
device.setOnline(0);
device.setOnline(false);
device.setCreateTime(DateUtil.getNow());
device.setUpdateTime(DateUtil.getNow());
deviceMapper.addCustomDevice(device);

View File

@@ -1,25 +0,0 @@
package com.genersoft.iot.vmp.service.impl;
import com.genersoft.iot.vmp.service.IRecordInfoServer;
import com.genersoft.iot.vmp.storager.dao.RecordInfoDao;
import com.genersoft.iot.vmp.storager.dao.dto.RecordInfo;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class RecordInfoServerImpl implements IRecordInfoServer {
@Autowired
private RecordInfoDao recordInfoDao;
@Override
public PageInfo<RecordInfo> getRecordList(int page, int count) {
PageHelper.startPage(page, count);
List<RecordInfo> all = recordInfoDao.selectAll();
return new PageInfo<>(all);
}
}

View File

@@ -332,7 +332,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
@Override
public void zlmServerOnline(String mediaServerId) {
// 移除开启了无人观看自动移除的流
List<StreamProxyItem> streamProxyItemList = streamProxyMapper.selecAutoRemoveItemByMediaServerId(mediaServerId);
List<StreamProxyItem> streamProxyItemList = streamProxyMapper.selectAutoRemoveItemByMediaServerId(mediaServerId);
if (streamProxyItemList.size() > 0) {
gbStreamMapper.batchDel(streamProxyItemList);
}
@@ -360,7 +360,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
@Override
public void zlmServerOffline(String mediaServerId) {
// 移除开启了无人观看自动移除的流
List<StreamProxyItem> streamProxyItemList = streamProxyMapper.selecAutoRemoveItemByMediaServerId(mediaServerId);
List<StreamProxyItem> streamProxyItemList = streamProxyMapper.selectAutoRemoveItemByMediaServerId(mediaServerId);
if (streamProxyItemList.size() > 0) {
gbStreamMapper.batchDel(streamProxyItemList);
}