临时提交

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

@@ -99,7 +99,7 @@ public class MobilePositionController {
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@GetMapping("/realtime/{deviceId}")
public DeferredResult<MobilePosition> realTimePosition(@PathVariable String deviceId) {
Device device = storager.queryVideoDevice(deviceId);
Device device = deviceService.getDevice(deviceId);
String uuid = UUID.randomUUID().toString();
String key = DeferredResultHolder.CALLBACK_CMD_MOBILE_POSITION + deviceId;
try {
@@ -147,7 +147,7 @@ public class MobilePositionController {
if (StringUtil.isEmpty(interval)) {
interval = "5";
}
Device device = storager.queryVideoDevice(deviceId);
Device device = deviceService.getDevice(deviceId);
device.setSubscribeCycleForMobilePosition(Integer.parseInt(expires));
device.setMobilePositionSubmissionInterval(Integer.parseInt(interval));
deviceService.updateCustomDevice(device);

View File

@@ -8,6 +8,7 @@ import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander;
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
import com.genersoft.iot.vmp.service.IDeviceAlarmService;
import com.genersoft.iot.vmp.service.IDeviceService;
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
import com.genersoft.iot.vmp.utils.DateUtil;
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
@@ -45,6 +46,9 @@ public class AlarmController {
@Autowired
private IVideoManagerStorage storage;
@Autowired
private IDeviceService deviceService;
/**
* 删除报警
@@ -95,7 +99,7 @@ public class AlarmController {
@Operation(summary = "测试向上级/设备发送模拟报警通知", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "deviceId", description = "设备国标编号")
public void delete(@RequestParam String deviceId) {
Device device = storage.queryVideoDevice(deviceId);
Device device = deviceService.getDevice(deviceId);
ParentPlatform platform = storage.queryParentPlatByServerGBId(deviceId);
DeviceAlarm deviceAlarm = new DeviceAlarm();
deviceAlarm.setChannelId(deviceId);

View File

@@ -14,6 +14,7 @@ import com.genersoft.iot.vmp.gb28181.bean.Device;
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.IDeviceService;
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
import io.swagger.v3.oas.annotations.Operation;
@@ -40,6 +41,9 @@ public class DeviceConfig {
@Autowired
private IVideoManagerStorage storager;
@Autowired
private IDeviceService deviceService;
@Autowired
private SIPCommander cmder;
@@ -73,7 +77,7 @@ public class DeviceConfig {
if (log.isDebugEnabled()) {
log.debug("报警复位API调用");
}
Device device = storager.queryVideoDevice(deviceId);
Device device = deviceService.getDevice(deviceId);
String uuid = UUID.randomUUID().toString();
String key = DeferredResultHolder.CALLBACK_CMD_DEVICECONFIG + deviceId + channelId;
try {
@@ -126,7 +130,7 @@ public class DeviceConfig {
}
String key = DeferredResultHolder.CALLBACK_CMD_CONFIGDOWNLOAD + (ObjectUtils.isEmpty(channelId) ? deviceId : channelId);
String uuid = UUID.randomUUID().toString();
Device device = storager.queryVideoDevice(deviceId);
Device device = deviceService.getDevice(deviceId);
try {
cmder.deviceConfigQuery(device, channelId, configType, event -> {
RequestMessage msg = new RequestMessage();

View File

@@ -14,7 +14,7 @@ import com.genersoft.iot.vmp.gb28181.bean.Device;
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.ISIPCommander;
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
import com.genersoft.iot.vmp.service.IDeviceService;
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
@@ -39,7 +39,7 @@ import java.util.UUID;
public class DeviceControl {
@Autowired
private IVideoManagerStorage storager;
private IDeviceService deviceService;
@Autowired
private ISIPCommander cmder;
@@ -59,7 +59,7 @@ public class DeviceControl {
if (log.isDebugEnabled()) {
log.debug("设备远程启动API调用");
}
Device device = storager.queryVideoDevice(deviceId);
Device device = deviceService.getDevice(deviceId);
try {
cmder.teleBootCmd(device);
} catch (InvalidArgumentException | SipException | ParseException e) {
@@ -85,7 +85,7 @@ public class DeviceControl {
if (log.isDebugEnabled()) {
log.debug("开始/停止录像API调用");
}
Device device = storager.queryVideoDevice(deviceId);
Device device = deviceService.getDevice(deviceId);
String uuid = UUID.randomUUID().toString();
String key = DeferredResultHolder.CALLBACK_CMD_DEVICECONTROL + deviceId + channelId;
DeferredResult<ResponseEntity<String>> result = new DeferredResult<ResponseEntity<String>>(3 * 1000L);
@@ -132,7 +132,7 @@ public class DeviceControl {
if (log.isDebugEnabled()) {
log.debug("布防/撤防API调用");
}
Device device = storager.queryVideoDevice(deviceId);
Device device = deviceService.getDevice(deviceId);
String key = DeferredResultHolder.CALLBACK_CMD_DEVICECONTROL + deviceId + deviceId;
String uuid =UUID.randomUUID().toString();
try {
@@ -181,7 +181,7 @@ public class DeviceControl {
if (log.isDebugEnabled()) {
log.debug("报警复位API调用");
}
Device device = storager.queryVideoDevice(deviceId);
Device device = deviceService.getDevice(deviceId);
String uuid = UUID.randomUUID().toString();
String key = DeferredResultHolder.CALLBACK_CMD_DEVICECONTROL + deviceId + channelId;
try {
@@ -225,7 +225,7 @@ public class DeviceControl {
if (log.isDebugEnabled()) {
log.debug("强制关键帧API调用");
}
Device device = storager.queryVideoDevice(deviceId);
Device device = deviceService.getDevice(deviceId);
try {
cmder.iFrameCmd(device, channelId);
} catch (InvalidArgumentException | SipException | ParseException e) {
@@ -263,7 +263,7 @@ public class DeviceControl {
}
String key = DeferredResultHolder.CALLBACK_CMD_DEVICECONTROL + (ObjectUtils.isEmpty(channelId) ? deviceId : channelId);
String uuid = UUID.randomUUID().toString();
Device device = storager.queryVideoDevice(deviceId);
Device device = deviceService.getDevice(deviceId);
try {
cmder.homePositionCmd(device, channelId, enabled, resetTime, presetIndex, event -> {
RequestMessage msg = new RequestMessage();
@@ -326,7 +326,7 @@ public class DeviceControl {
if (log.isDebugEnabled()) {
log.debug(String.format("设备拉框放大 API调用deviceId%s channelId%s length%d width%d midpointx%d midpointy%d lengthx%d lengthy%d",deviceId, channelId, length, width, midpointx, midpointy,lengthx, lengthy));
}
Device device = storager.queryVideoDevice(deviceId);
Device device = deviceService.getDevice(deviceId);
StringBuffer cmdXml = new StringBuffer(200);
cmdXml.append("<DragZoomIn>\r\n");
cmdXml.append("<Length>" + length+ "</Length>\r\n");
@@ -378,7 +378,7 @@ public class DeviceControl {
if (log.isDebugEnabled()) {
log.debug(String.format("设备拉框缩小 API调用deviceId%s channelId%s length%d width%d midpointx%d midpointy%d lengthx%d lengthy%d",deviceId, channelId, length, width, midpointx, midpointy,lengthx, lengthy));
}
Device device = storager.queryVideoDevice(deviceId);
Device device = deviceService.getDevice(deviceId);
StringBuffer cmdXml = new StringBuffer(200);
cmdXml.append("<DragZoomOut>\r\n");
cmdXml.append("<Length>" + length+ "</Length>\r\n");

View File

@@ -91,7 +91,7 @@ public class DeviceQuery {
@GetMapping("/devices/{deviceId}")
public Device devices(@PathVariable String deviceId){
return storager.queryVideoDevice(deviceId);
return deviceService.getDevice(deviceId);
}
/**
@@ -103,12 +103,14 @@ public class DeviceQuery {
@Operation(summary = "分页查询国标设备", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "page", description = "当前页", required = true)
@Parameter(name = "count", description = "每页查询数量", required = true)
@Parameter(name = "query", description = "搜索", required = false)
@Parameter(name = "status", description = "状态", required = false)
@GetMapping("/devices")
@Options()
public PageInfo<Device> devices(int page, int count){
public PageInfo<Device> devices(int page, int count, String query, Boolean status){
// if (page == null) page = 0;
// if (count == null) count = 20;
return storager.queryVideoDeviceList(page, count,null);
return deviceService.getAll(page, count,query, status);
}
/**
@@ -131,18 +133,16 @@ public class DeviceQuery {
@Parameter(name = "query", description = "查询内容")
@Parameter(name = "online", description = "是否在线")
@Parameter(name = "channelType", description = "设备/子目录-> false/true")
@Parameter(name = "catalogUnderDevice", description = "是否直属与设备的目录")
public PageInfo<DeviceChannel> channels(@PathVariable String deviceId,
int page, int count,
@RequestParam(required = false) String query,
@RequestParam(required = false) Boolean online,
@RequestParam(required = false) Boolean channelType,
@RequestParam(required = false) Boolean catalogUnderDevice) {
@RequestParam(required = false) Boolean channelType) {
if (ObjectUtils.isEmpty(query)) {
query = null;
}
return storager.queryChannelsByDeviceId(deviceId, query, channelType, online, catalogUnderDevice, page, count);
return deviceChannelService.queryChannelsByDeviceId(deviceId, query, channelType, online, page, count);
}
/**
@@ -154,11 +154,11 @@ public class DeviceQuery {
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@GetMapping("/devices/{deviceId}/sync")
public WVPResult<SyncStatus> devicesSync(@PathVariable String deviceId){
if (log.isDebugEnabled()) {
log.debug("设备通道信息同步API调用deviceId" + deviceId);
}
Device device = storager.queryVideoDevice(deviceId);
Device device = deviceService.getDevice(deviceId);
boolean status = deviceService.isSyncRunning(deviceId);
// 已存在则返回进度
if (status) {
@@ -182,7 +182,7 @@ public class DeviceQuery {
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@DeleteMapping("/devices/{deviceId}/delete")
public String delete(@PathVariable String deviceId){
if (log.isDebugEnabled()) {
log.debug("设备信息删除API调用deviceId" + deviceId);
}
@@ -240,13 +240,13 @@ public class DeviceQuery {
@RequestParam(required = false) Boolean online,
@RequestParam(required = false) Boolean channelType){
DeviceChannel deviceChannel = storager.queryChannel(deviceId,channelId);
DeviceChannel deviceChannel = deviceChannelService.getOne(deviceId,channelId);
if (deviceChannel == null) {
PageInfo<DeviceChannel> deviceChannelPageResult = new PageInfo<>();
return deviceChannelPageResult;
}
return storager.querySubChannels(deviceId, channelId, query, channelType, online, page, count);
return deviceChannelService.getSubChannels(deviceChannel.getDeviceDbId(), channelId, query, channelType, online, page, count);
}
/**
@@ -330,7 +330,7 @@ public class DeviceQuery {
/**
* 设备状态查询请求API接口
*
*
* @param deviceId 设备id
*/
@Operation(summary = "设备状态查询", security = @SecurityRequirement(name = JwtUtils.HEADER))
@@ -340,7 +340,7 @@ public class DeviceQuery {
if (log.isDebugEnabled()) {
log.debug("设备状态查询API调用");
}
Device device = storager.queryVideoDevice(deviceId);
Device device = deviceService.getDevice(deviceId);
String uuid = UUID.randomUUID().toString();
String key = DeferredResultHolder.CALLBACK_CMD_DEVICESTATUS + deviceId;
DeferredResult<ResponseEntity<String>> result = new DeferredResult<ResponseEntity<String>>(2*1000L);
@@ -394,8 +394,8 @@ public class DeviceQuery {
@Parameter(name = "endTime", description = "报警发生终止时间")
@GetMapping("/alarm/{deviceId}")
public DeferredResult<ResponseEntity<String>> alarmApi(@PathVariable String deviceId,
@RequestParam(required = false) String startPriority,
@RequestParam(required = false) String endPriority,
@RequestParam(required = false) String startPriority,
@RequestParam(required = false) String endPriority,
@RequestParam(required = false) String alarmMethod,
@RequestParam(required = false) String alarmType,
@RequestParam(required = false) String startTime,
@@ -403,7 +403,7 @@ public class DeviceQuery {
if (log.isDebugEnabled()) {
log.debug("设备报警查询API调用");
}
Device device = storager.queryVideoDevice(deviceId);
Device device = deviceService.getDevice(deviceId);
String key = DeferredResultHolder.CALLBACK_CMD_ALARM + deviceId;
String uuid = UUID.randomUUID().toString();
try {

View File

@@ -320,7 +320,7 @@ public class PlatformController {
if (ObjectUtils.isEmpty(platformId) || ObjectUtils.isEmpty(catalogId)) {
catalogId = null;
}
PageInfo<ChannelReduce> channelReduces = storager.queryAllChannelList(page, count, query, online, channelType, platformId, catalogId);
PageInfo<ChannelReduce> channelReduces = deviceChannelService.queryAllChannelList(page, count, query, online, channelType, platformId, catalogId);
return channelReduces;
}

View File

@@ -16,6 +16,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
import com.genersoft.iot.vmp.media.bean.MediaServer;
import com.genersoft.iot.vmp.media.service.IMediaServerService;
import com.genersoft.iot.vmp.service.IDeviceChannelService;
import com.genersoft.iot.vmp.service.IDeviceService;
import com.genersoft.iot.vmp.service.IInviteStreamService;
import com.genersoft.iot.vmp.service.IPlayService;
import com.genersoft.iot.vmp.service.bean.InviteErrorCode;
@@ -75,6 +76,8 @@ public class PlayController {
@Autowired
private UserSetting userSetting;
@Autowired
private IDeviceService deviceService;
@Autowired
private IDeviceChannelService deviceChannelService;
@@ -87,8 +90,11 @@ public class PlayController {
@PathVariable String channelId) {
log.info("[开始点播] deviceId{}, channelId{}, ", deviceId, channelId);
if (ObjectUtils.isEmpty(deviceId) || ObjectUtils.isEmpty(channelId)) {
throw new ControllerException(ErrorCode.ERROR400);
}
// 获取可用的zlm
Device device = storager.queryVideoDevice(deviceId);
Device device = deviceService.getDevice(deviceId);
MediaServer newMediaServerItem = playService.getNewMediaServerItem(device);
RequestMessage requestMessage = new RequestMessage();
@@ -163,7 +169,7 @@ public class PlayController {
throw new ControllerException(ErrorCode.ERROR400);
}
Device device = storager.queryVideoDevice(deviceId);
Device device = deviceService.getDevice(deviceId);
if (device == null) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "设备[" + deviceId + "]不存在");
}
@@ -206,7 +212,7 @@ public class PlayController {
if (log.isDebugEnabled()) {
log.debug("语音广播API调用");
}
Device device = storager.queryVideoDevice(deviceId);
Device device = deviceService.getDevice(deviceId);
if (device == null) {
throw new ControllerException(ErrorCode.ERROR400.getCode(), "未找到设备: " + deviceId);
}

View File

@@ -12,6 +12,7 @@ import com.genersoft.iot.vmp.gb28181.bean.Device;
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.IDeviceService;
import com.genersoft.iot.vmp.service.IInviteStreamService;
import com.genersoft.iot.vmp.service.IPlayService;
import com.genersoft.iot.vmp.service.bean.InviteErrorCode;
@@ -67,6 +68,9 @@ public class PlaybackController {
@Autowired
private UserSetting userSetting;
@Autowired
private IDeviceService deviceService;
@Operation(summary = "开始视频回放", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
@Parameter(name = "channelId", description = "通道国标编号", required = true)
@@ -136,7 +140,7 @@ public class PlaybackController {
if (ObjectUtils.isEmpty(deviceId) || ObjectUtils.isEmpty(channelId) || ObjectUtils.isEmpty(stream)) {
throw new ControllerException(ErrorCode.ERROR400);
}
Device device = storager.queryVideoDevice(deviceId);
Device device = deviceService.getDevice(deviceId);
if (device == null) {
throw new ControllerException(ErrorCode.ERROR400.getCode(), "设备:" + deviceId + " 未找到");
}
@@ -191,7 +195,7 @@ public class PlaybackController {
log.warn("streamId不存在!");
throw new ControllerException(ErrorCode.ERROR400.getCode(), "streamId不存在");
}
Device device = storager.queryVideoDevice(inviteInfo.getDeviceId());
Device device = deviceService.getDevice(inviteInfo.getDeviceId());
try {
cmder.playSeekCmd(device, inviteInfo.getStreamInfo(), seekTime);
} catch (InvalidArgumentException | ParseException | SipException e) {
@@ -215,7 +219,7 @@ public class PlaybackController {
log.warn("不支持的speed " + speed);
throw new ControllerException(ErrorCode.ERROR100.getCode(), "不支持的speed0.25 0.5 1、2、4");
}
Device device = storager.queryVideoDevice(inviteInfo.getDeviceId());
Device device = deviceService.getDevice(inviteInfo.getDeviceId());
try {
cmder.playSpeedCmd(device, inviteInfo.getStreamInfo(), speed);
} catch (InvalidArgumentException | ParseException | SipException e) {

View File

@@ -7,6 +7,7 @@ import com.genersoft.iot.vmp.gb28181.bean.Device;
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.IDeviceService;
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
import io.swagger.v3.oas.annotations.Operation;
@@ -36,6 +37,9 @@ public class PtzController {
@Autowired
private IVideoManagerStorage storager;
@Autowired
private IDeviceService deviceService;
@Autowired
private DeferredResultHolder resultHolder;
@@ -62,7 +66,7 @@ public class PtzController {
if (log.isDebugEnabled()) {
log.debug(String.format("设备云台控制 API调用deviceId%s channelId%s command%s horizonSpeed%d verticalSpeed%d zoomSpeed%d",deviceId, channelId, command, horizonSpeed, verticalSpeed, zoomSpeed));
}
Device device = storager.queryVideoDevice(deviceId);
Device device = deviceService.getDevice(deviceId);
int cmdCode = 0;
switch (command){
case "left":
@@ -125,7 +129,7 @@ public class PtzController {
if (log.isDebugEnabled()) {
log.debug(String.format("设备云台控制 API调用deviceId%s channelId%s cmdCode%d parameter1%d parameter2%d",deviceId, channelId, cmdCode, parameter1, parameter2));
}
Device device = storager.queryVideoDevice(deviceId);
Device device = deviceService.getDevice(deviceId);
try {
cmder.frontEndCmd(device, channelId, cmdCode, parameter1, parameter2, combindCode2);
@@ -144,7 +148,7 @@ public class PtzController {
if (log.isDebugEnabled()) {
log.debug("设备预置位查询API调用");
}
Device device = storager.queryVideoDevice(deviceId);
Device device = deviceService.getDevice(deviceId);
String uuid = UUID.randomUUID().toString();
String key = DeferredResultHolder.CALLBACK_CMD_PRESETQUERY + (ObjectUtils.isEmpty(channelId) ? deviceId : channelId);
DeferredResult<String> result = new DeferredResult<String> (3 * 1000L);

View File

@@ -83,7 +83,7 @@ public class GBRecordController {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "endTime格式为" + DateUtil.PATTERN);
}
Device device = storager.queryVideoDevice(deviceId);
Device device = deviceService.getDevice(deviceId);
// 指定超时时间 1分钟30秒
String uuid = UUID.randomUUID().toString();
int sn = (int)((Math.random()*9+1)*100000);