临时提交

This commit is contained in:
648540858
2024-07-10 14:43:22 +08:00
parent bb609b7e09
commit b843958ed7
31 changed files with 361 additions and 302 deletions

View File

@@ -3,7 +3,7 @@ package com.genersoft.iot.vmp.web.gb28181;
import com.genersoft.iot.vmp.conf.exception.ControllerException;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
import com.genersoft.iot.vmp.service.IDeviceService;
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -28,7 +28,7 @@ public class ApiControlController {
private SIPCommander cmder;
@Autowired
private IVideoManagerStorage storager;
private IDeviceService deviceService;
/**
* 设备控制 - 云台控制
@@ -51,7 +51,7 @@ public class ApiControlController {
}
if (channel == null) {channel = 0;}
if (speed == null) {speed = 0;}
Device device = storager.queryVideoDevice(serial);
Device device = deviceService.getDevice(serial);
if (device == null) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "device[ " + serial + " ]未找到");
}
@@ -125,7 +125,7 @@ public class ApiControlController {
}
if (channel == null) {channel = 0;}
Device device = storager.queryVideoDevice(serial);
Device device = deviceService.getDevice(serial);
if (device == null) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "device[ " + serial + " ]未找到");
}

View File

@@ -8,6 +8,7 @@ import com.genersoft.iot.vmp.gb28181.bean.PresetQuerySipReq;
import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
import com.genersoft.iot.vmp.service.IDeviceChannelService;
import com.genersoft.iot.vmp.service.IDeviceService;
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
import com.genersoft.iot.vmp.vmanager.bean.DeferredResultEx;
@@ -43,11 +44,14 @@ public class ApiDeviceController {
@Autowired
private SIPCommander cmder;
@Autowired
private IDeviceService deviceService;
private IDeviceChannelService channelService;
@Autowired
private DeferredResultHolder resultHolder;
@Autowired
private IDeviceService deviceService;
/**
* 分页获取设备列表 现在直接返回,尚未实现分页
@@ -70,10 +74,10 @@ public class ApiDeviceController {
JSONObject result = new JSONObject();
List<Device> devices;
if (start == null || limit ==null) {
devices = storager.queryVideoDeviceList(online);
devices = deviceService.getAllByStatus(online);
result.put("DeviceCount", devices.size());
}else {
PageInfo<Device> deviceList = storager.queryVideoDeviceList(start/limit, limit,online);
PageInfo<Device> deviceList = deviceService.getAll(start/limit, limit,null, online);
result.put("DeviceCount", deviceList.getTotal());
devices = deviceList.getList();
}
@@ -120,7 +124,7 @@ public class ApiDeviceController {
String[] split = code.trim().split(",");
channelIds = Arrays.asList(split);
}
List<DeviceChannelExtend> allDeviceChannelList = storager.queryChannelsByDeviceId(serial,channelIds,online);
List<DeviceChannelExtend> allDeviceChannelList = channelService.queryChannelExtendsByDeviceId(serial,channelIds,online);
if (start == null || limit ==null) {
deviceChannels = allDeviceChannelList;
result.put("ChannelCount", deviceChannels.size());
@@ -196,7 +200,7 @@ public class ApiDeviceController {
serial, channel, code, fill, timeout);
}
Device device = storager.queryVideoDevice(serial);
Device device = deviceService.getDevice(serial);
String uuid = UUID.randomUUID().toString();
String key = DeferredResultHolder.CALLBACK_CMD_PRESETQUERY + (ObjectUtils.isEmpty(code) ? serial : code);
DeferredResult<Object> result = new DeferredResult<> (timeout * 1000L);

View File

@@ -82,7 +82,7 @@ public class ApiStreamController {
){
DeferredResult<JSONObject> result = new DeferredResult<>(userSetting.getPlayTimeout().longValue() + 10);
Device device = storager.queryVideoDevice(serial);
Device device = deviceService.getDevice(serial);
if (device == null ) {
JSONObject resultJSON = new JSONObject();
resultJSON.put("error","device[ " + serial + " ]未找到");
@@ -104,7 +104,7 @@ public class ApiStreamController {
// 清理RTP server
});
DeviceChannel deviceChannel = storager.queryChannel(serial, code);
DeviceChannel deviceChannel = deviceChannelService.getOne(serial, code);
if (deviceChannel == null) {
JSONObject resultJSON = new JSONObject();
resultJSON.put("error","channel[ " + code + " ]未找到");