临时提交

This commit is contained in:
panlinlin
2024-08-11 23:20:42 +08:00
parent 76a0d248ef
commit 0177831e86
36 changed files with 334 additions and 194 deletions

View File

@@ -99,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 = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(deviceId);
Platform platform = storage.queryParentPlatByServerGBId(deviceId);
DeviceAlarm deviceAlarm = new DeviceAlarm();
deviceAlarm.setChannelId(deviceId);

View File

@@ -77,7 +77,7 @@ public class DeviceConfig {
if (log.isDebugEnabled()) {
log.debug("报警复位API调用");
}
Device device = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(deviceId);
String uuid = UUID.randomUUID().toString();
String key = DeferredResultHolder.CALLBACK_CMD_DEVICECONFIG + deviceId + channelId;
try {
@@ -130,7 +130,7 @@ public class DeviceConfig {
}
String key = DeferredResultHolder.CALLBACK_CMD_CONFIGDOWNLOAD + (ObjectUtils.isEmpty(channelId) ? deviceId : channelId);
String uuid = UUID.randomUUID().toString();
Device device = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(deviceId);
try {
cmder.deviceConfigQuery(device, channelId, configType, event -> {
RequestMessage msg = new RequestMessage();

View File

@@ -59,7 +59,7 @@ public class DeviceControl {
if (log.isDebugEnabled()) {
log.debug("设备远程启动API调用");
}
Device device = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(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 = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(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 = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(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 = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(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 = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(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 = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(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 = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(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 = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(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 deviceService.getDevice(deviceId);
return deviceService.getDeviceByDeviceId(deviceId);
}
/**
@@ -148,7 +148,7 @@ public class DeviceQuery {
if (log.isDebugEnabled()) {
log.debug("设备通道信息同步API调用deviceId" + deviceId);
}
Device device = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(deviceId);
boolean status = deviceService.isSyncRunning(deviceId);
// 已存在则返回进度
if (status) {
@@ -273,7 +273,7 @@ public class DeviceQuery {
"UDPudp传输TCP-ACTIVEtcp主动模式,暂不支持TCP-PASSIVEtcp被动模式", required = true)
@PostMapping("/transport/{deviceId}/{streamMode}")
public void updateTransport(@PathVariable String deviceId, @PathVariable String streamMode){
Device device = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(deviceId);
device.setStreamMode(streamMode);
deviceService.updateCustomDevice(device);
}
@@ -330,7 +330,7 @@ public class DeviceQuery {
if (log.isDebugEnabled()) {
log.debug("设备状态查询API调用");
}
Device device = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(deviceId);
String uuid = UUID.randomUUID().toString();
String key = DeferredResultHolder.CALLBACK_CMD_DEVICESTATUS + deviceId;
DeferredResult<ResponseEntity<String>> result = new DeferredResult<ResponseEntity<String>>(2*1000L);
@@ -393,7 +393,7 @@ public class DeviceQuery {
if (log.isDebugEnabled()) {
log.debug("设备报警查询API调用");
}
Device device = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(deviceId);
String key = DeferredResultHolder.CALLBACK_CMD_ALARM + deviceId;
String uuid = UUID.randomUUID().toString();
try {

View File

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

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 = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(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 = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(deviceId);
device.setSubscribeCycleForMobilePosition(Integer.parseInt(expires));
device.setMobilePositionSubmissionInterval(Integer.parseInt(interval));
deviceService.updateCustomDevice(device);

View File

@@ -94,7 +94,7 @@ public class PlayController {
Assert.notNull(deviceId, "设备国标编号不可为NULL");
Assert.notNull(channelId, "通道国标编号不可为NULL");
// 获取可用的zlm
Device device = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(deviceId);
MediaServer newMediaServerItem = playService.getNewMediaServerItem(device);
RequestMessage requestMessage = new RequestMessage();
@@ -169,7 +169,7 @@ public class PlayController {
throw new ControllerException(ErrorCode.ERROR400);
}
Device device = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(deviceId);
if (device == null) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "设备[" + deviceId + "]不存在");
}
@@ -212,7 +212,7 @@ public class PlayController {
if (log.isDebugEnabled()) {
log.debug("语音广播API调用");
}
Device device = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(deviceId);
if (device == null) {
throw new ControllerException(ErrorCode.ERROR400.getCode(), "未找到设备: " + deviceId);
}

View File

@@ -140,7 +140,7 @@ public class PlaybackController {
if (ObjectUtils.isEmpty(deviceId) || ObjectUtils.isEmpty(channelId) || ObjectUtils.isEmpty(stream)) {
throw new ControllerException(ErrorCode.ERROR400);
}
Device device = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(deviceId);
if (device == null) {
throw new ControllerException(ErrorCode.ERROR400.getCode(), "设备:" + deviceId + " 未找到");
}
@@ -195,7 +195,7 @@ public class PlaybackController {
log.warn("streamId不存在!");
throw new ControllerException(ErrorCode.ERROR400.getCode(), "streamId不存在");
}
Device device = deviceService.getDevice(inviteInfo.getDeviceId());
Device device = deviceService.getDeviceByDeviceId(inviteInfo.getDeviceId());
try {
cmder.playSeekCmd(device, inviteInfo.getStreamInfo(), seekTime);
} catch (InvalidArgumentException | ParseException | SipException e) {
@@ -219,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 = deviceService.getDevice(inviteInfo.getDeviceId());
Device device = deviceService.getDeviceByDeviceId(inviteInfo.getDeviceId());
try {
cmder.playSpeedCmd(device, inviteInfo.getStreamInfo(), speed);
} catch (InvalidArgumentException | ParseException | SipException e) {

View File

@@ -66,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 = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(deviceId);
int cmdCode = 0;
switch (command){
case "left":
@@ -129,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 = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(deviceId);
try {
cmder.frontEndCmd(device, channelId, cmdCode, parameter1, parameter2, combindCode2);
@@ -148,7 +148,7 @@ public class PtzController {
if (log.isDebugEnabled()) {
log.debug("设备预置位查询API调用");
}
Device device = deviceService.getDevice(deviceId);
Device device = deviceService.getDeviceByDeviceId(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);