From e259be9268db90b4e73a325abea24ad59ff0e4e3 Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期三, 27 十月 2021 16:48:51 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/wvp-28181-2.0' into wvp-28181-2.0

---
 src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java |   35 +++++++++++++++++++++++++++++++----
 1 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java
index 776acbf..cb08ba3 100644
--- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java
+++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java
@@ -3,6 +3,7 @@
 import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
 import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
 import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
+import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
 import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.*;
 import org.slf4j.Logger;
@@ -22,6 +23,7 @@
 import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
 
 import javax.sip.message.Response;
+import java.io.UnsupportedEncodingException;
 
 @Api(tags = "鍥芥爣璁惧鏌ヨ", value = "鍥芥爣璁惧鏌ヨ")
 @SuppressWarnings("rawtypes")
@@ -132,15 +134,14 @@
 	 */
 	@ApiOperation("鍚屾璁惧閫氶亾")
 	@ApiImplicitParams({
-			@ApiImplicitParam(name="deviceId", value = "璁惧id", required = true ,dataTypeClass = String.class),
+			@ApiImplicitParam(name="deviceId", value = "璁惧id", required = true, dataTypeClass = String.class),
 	})
 	@PostMapping("/devices/{deviceId}/sync")
 	public DeferredResult<ResponseEntity<Device>> devicesSync(@PathVariable String deviceId){
 		
 		if (logger.isDebugEnabled()) {
-		}
 			logger.debug("璁惧閫氶亾淇℃伅鍚屾API璋冪敤锛宒eviceId锛�" + deviceId);
-
+		}
 		Device device = storager.queryVideoDevice(deviceId);
         cmder.catalogQuery(device, event -> {
 			Response response = event.getResponse();
@@ -264,7 +265,7 @@
 	@ApiImplicitParams({
 			@ApiImplicitParam(name = "deviceId", value = "璁惧id", required = true, dataTypeClass = String.class),
 			@ApiImplicitParam(name = "streamMode", value = "鏁版嵁娴佷紶杈撴ā寮�, 鍙栧�硷細" +
-					"UDP锛坲dp浼犺緭锛夛紝TCP-ACTIVE锛坱cp涓诲姩妯″紡,鏆備笉鏀寔锛夛紝TCP-PASSIVE锛坱cp琚姩妯″紡锛�"),
+					"UDP锛坲dp浼犺緭锛夛紝TCP-ACTIVE锛坱cp涓诲姩妯″紡,鏆備笉鏀寔锛夛紝TCP-PASSIVE锛坱cp琚姩妯″紡锛�", dataTypeClass = String.class),
 	})
 	@PostMapping("/transport/{deviceId}/{streamMode}")
 	public ResponseEntity<PageInfo> updateTransport(@PathVariable String deviceId, @PathVariable String streamMode){
@@ -275,6 +276,32 @@
 	}
 
 	/**
+	 * 鏇存柊璁惧淇℃伅
+	 * @param device 璁惧淇℃伅
+	 * @return
+	 */
+	@ApiOperation("鏇存柊璁惧淇℃伅")
+	@ApiImplicitParams({
+			@ApiImplicitParam(name = "device", value = "璁惧淇℃伅", required = true, dataTypeClass = Device.class)
+	})
+	@PostMapping("/device/update/")
+	public ResponseEntity<WVPResult<String>> updateDevice(Device device){
+
+		if (device != null && device.getDeviceId() != null) {
+			Device deviceInStore = storager.queryVideoDevice(device.getDeviceId());
+			if (!StringUtils.isEmpty(device.getName())) deviceInStore.setName(device.getName());
+			if (!StringUtils.isEmpty(device.getCharset())) deviceInStore.setCharset(device.getCharset());
+			if (!StringUtils.isEmpty(device.getMediaServerId())) deviceInStore.setMediaServerId(device.getMediaServerId());
+			storager.updateDevice(deviceInStore);
+			cmder.deviceInfoQuery(deviceInStore);
+		}
+		WVPResult<String> result = new WVPResult<>();
+		result.setCode(0);
+		result.setMsg("success");
+		return new ResponseEntity<>(result,HttpStatus.OK);
+	}
+
+	/**
 	 * 璁惧鐘舵�佹煡璇㈣姹侫PI鎺ュ彛
 	 * 
 	 * @param deviceId 璁惧id

--
Gitblit v1.8.0