From 8b6449ce3ac8eb4a0f59f3a6e3974d9190dcd133 Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期一, 29 八月 2022 09:55:09 +0800
Subject: [PATCH] 升级版本号
---
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/ptz/PtzController.java | 79 +++++++++++++++++----------------------
1 files changed, 34 insertions(+), 45 deletions(-)
diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/ptz/PtzController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/ptz/PtzController.java
index 255329b..6903e4d 100644
--- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/ptz/PtzController.java
+++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/ptz/PtzController.java
@@ -1,29 +1,26 @@
package com.genersoft.iot.vmp.vmanager.gb28181.ptz;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiImplicitParams;
-import io.swagger.annotations.ApiOperation;
+
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.tags.Tag;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
+import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.async.DeferredResult;
-
-import javax.sip.message.Response;
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.storager.IVideoManagerStorager;
+import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
import java.util.UUID;
-@Api(tags = "浜戝彴鎺у埗")
+@Tag(name = "浜戝彴鎺у埗")
@CrossOrigin
@RestController
@RequestMapping("/api/ptz")
@@ -35,7 +32,7 @@
private SIPCommander cmder;
@Autowired
- private IVideoManagerStorager storager;
+ private IVideoManagerStorage storager;
@Autowired
private DeferredResultHolder resultHolder;
@@ -48,19 +45,17 @@
* @param horizonSpeed 姘村钩绉诲姩閫熷害
* @param verticalSpeed 鍨傜洿绉诲姩閫熷害
* @param zoomSpeed 缂╂斁閫熷害
- * @return String 鎺у埗缁撴灉
*/
- @ApiOperation("浜戝彴鎺у埗")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "deviceId", value = "璁惧ID", dataTypeClass = String.class),
- @ApiImplicitParam(name = "channelId", value = "閫氶亾ID", dataTypeClass = String.class),
- @ApiImplicitParam(name = "command", value = "鎺у埗鎸囦护,鍏佽鍊�: left, right, up, down, upleft, upright, downleft, downright, zoomin, zoomout, stop", dataTypeClass = Integer.class),
- @ApiImplicitParam(name = "horizonSpeed", value = "姘村钩閫熷害", dataTypeClass = Integer.class),
- @ApiImplicitParam(name = "verticalSpeed", value = "鍨傜洿閫熷害", dataTypeClass = Integer.class),
- @ApiImplicitParam(name = "zoomSpeed", value = "缂╂斁閫熷害", dataTypeClass = Integer.class),
- })
+
+ @Operation(summary = "浜戝彴鎺у埗")
+ @Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿", required = true)
+ @Parameter(name = "channelId", description = "閫氶亾鍥芥爣缂栧彿", required = true)
+ @Parameter(name = "command", description = "鎺у埗鎸囦护,鍏佽鍊�: left, right, up, down, upleft, upright, downleft, downright, zoomin, zoomout, stop", required = true)
+ @Parameter(name = "horizonSpeed", description = "姘村钩閫熷害", required = true)
+ @Parameter(name = "verticalSpeed", description = "鍨傜洿閫熷害", required = true)
+ @Parameter(name = "zoomSpeed", description = "缂╂斁閫熷害", required = true)
@PostMapping("/control/{deviceId}/{channelId}")
- public ResponseEntity<String> ptz(@PathVariable String deviceId,@PathVariable String channelId, String command, int horizonSpeed, int verticalSpeed, int zoomSpeed){
+ public void ptz(@PathVariable String deviceId,@PathVariable String channelId, String command, int horizonSpeed, int verticalSpeed, int zoomSpeed){
if (logger.isDebugEnabled()) {
logger.debug(String.format("璁惧浜戝彴鎺у埗 API璋冪敤锛宒eviceId锛�%s 锛宑hannelId锛�%s 锛宑ommand锛�%s 锛宧orizonSpeed锛�%d 锛寁erticalSpeed锛�%d 锛寊oomSpeed锛�%d",deviceId, channelId, command, horizonSpeed, verticalSpeed, zoomSpeed));
@@ -99,26 +94,23 @@
cmdCode = 32;
break;
case "stop":
- cmdCode = 0;
break;
default:
break;
}
cmder.frontEndCmd(device, channelId, cmdCode, horizonSpeed, verticalSpeed, zoomSpeed);
- return new ResponseEntity<String>("success",HttpStatus.OK);
}
- @ApiOperation("閫氱敤鍓嶇鎺у埗鍛戒护")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "deviceId", value = "璁惧ID", dataTypeClass = String.class),
- @ApiImplicitParam(name = "channelId", value = "閫氶亾ID", dataTypeClass = String.class),
- @ApiImplicitParam(name = "cmdCode", value = "鎸囦护鐮�", dataTypeClass = Integer.class),
- @ApiImplicitParam(name = "parameter1", value = "鏁版嵁涓�", dataTypeClass = Integer.class),
- @ApiImplicitParam(name = "parameter2", value = "鏁版嵁浜�", dataTypeClass = Integer.class),
- @ApiImplicitParam(name = "combindCode2", value = "缁勫悎鐮佷簩", dataTypeClass = Integer.class),
- })
+
+ @Operation(summary = "閫氱敤鍓嶇鎺у埗鍛戒护")
+ @Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿", required = true)
+ @Parameter(name = "channelId", description = "閫氶亾鍥芥爣缂栧彿", required = true)
+ @Parameter(name = "cmdCode", description = "鎸囦护鐮�", required = true)
+ @Parameter(name = "parameter1", description = "鏁版嵁涓�", required = true)
+ @Parameter(name = "parameter2", description = "鏁版嵁浜�", required = true)
+ @Parameter(name = "combindCode2", description = "缁勫悎鐮佷簩", required = true)
@PostMapping("/front_end_command/{deviceId}/{channelId}")
- public ResponseEntity<String> frontEndCommand(@PathVariable String deviceId,@PathVariable String channelId,int cmdCode, int parameter1, int parameter2, int combindCode2){
+ public void frontEndCommand(@PathVariable String deviceId,@PathVariable String channelId,int cmdCode, int parameter1, int parameter2, int combindCode2){
if (logger.isDebugEnabled()) {
logger.debug(String.format("璁惧浜戝彴鎺у埗 API璋冪敤锛宒eviceId锛�%s 锛宑hannelId锛�%s 锛宑mdCode锛�%d parameter1锛�%d parameter2锛�%d",deviceId, channelId, cmdCode, parameter1, parameter2));
@@ -126,23 +118,21 @@
Device device = storager.queryVideoDevice(deviceId);
cmder.frontEndCmd(device, channelId, cmdCode, parameter1, parameter2, combindCode2);
- return new ResponseEntity<String>("success",HttpStatus.OK);
}
- @ApiOperation("棰勭疆浣嶆煡璇�")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "deviceId", value = "璁惧ID", dataTypeClass = String.class),
- @ApiImplicitParam(name = "channelId", value = "閫氶亾ID", dataTypeClass = String.class),
- })
+
+ @Operation(summary = "棰勭疆浣嶆煡璇�")
+ @Parameter(name = "deviceId", description = "璁惧鍥芥爣缂栧彿", required = true)
+ @Parameter(name = "channelId", description = "閫氶亾鍥芥爣缂栧彿", required = true)
@GetMapping("/preset/query/{deviceId}/{channelId}")
- public DeferredResult<ResponseEntity<String>> presetQueryApi(@PathVariable String deviceId, @PathVariable String channelId) {
+ public DeferredResult<String> presetQueryApi(@PathVariable String deviceId, @PathVariable String channelId) {
if (logger.isDebugEnabled()) {
logger.debug("璁惧棰勭疆浣嶆煡璇PI璋冪敤");
}
Device device = storager.queryVideoDevice(deviceId);
String uuid = UUID.randomUUID().toString();
- String key = DeferredResultHolder.CALLBACK_CMD_PRESETQUERY + (StringUtils.isEmpty(channelId) ? deviceId : channelId);
- DeferredResult<ResponseEntity<String>> result = new DeferredResult<ResponseEntity<String >> (3 * 1000L);
+ String key = DeferredResultHolder.CALLBACK_CMD_PRESETQUERY + (ObjectUtils.isEmpty(channelId) ? deviceId : channelId);
+ DeferredResult<String> result = new DeferredResult<String> (3 * 1000L);
result.onTimeout(()->{
logger.warn(String.format("鑾峰彇璁惧棰勭疆浣嶈秴鏃�"));
// 閲婃斁rtpserver
@@ -152,10 +142,10 @@
msg.setData("鑾峰彇璁惧棰勭疆浣嶈秴鏃�");
resultHolder.invokeResult(msg);
});
- resultHolder.put(key, uuid, result);
if (resultHolder.exist(key, null)) {
return result;
}
+ resultHolder.put(key, uuid, result);
cmder.presetQuery(device, channelId, event -> {
RequestMessage msg = new RequestMessage();
msg.setId(uuid);
@@ -163,7 +153,6 @@
msg.setData(String.format("鑾峰彇璁惧棰勭疆浣嶅け璐ワ紝閿欒鐮侊細 %s, %s", event.statusCode, event.msg));
resultHolder.invokeResult(msg);
});
-
return result;
}
}
--
Gitblit v1.8.0