Explorar o código

修复兼容接口云台控制

648540858 %!s(int64=3) %!d(string=hai) anos
pai
achega
b4e7ed0bf7

+ 7 - 2
src/main/java/com/genersoft/iot/vmp/web/gb28181/ApiControlController.java

@@ -41,10 +41,15 @@ public class ApiControlController {
                             @RequestParam(required = false)Integer speed){
 
         if (logger.isDebugEnabled()) {
-            logger.debug(String.format("模拟接口> 设备云台控制 API调用,deviceId:%s ,channelId:%s ,command:%d ,speed:%d ",
-                    serial, code, command, speed));
+            logger.debug("模拟接口> 设备云台控制 API调用,deviceId:{} ,channelId:{} ,command:{} ,speed:{} ",
+                    serial, code, command, speed);
         }
         Device device = storager.queryVideoDevice(serial);
+        if (device == null) {
+            JSONObject result = new JSONObject();
+            result.put("error","device[ " + serial + " ]未找到");
+            return result;
+        }
         int cmdCode = 0;
         switch (command){
             case "left":