648540858
2022-07-03 72c1b36d6d2ece497e032c8434641d6576590f9d
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java
@@ -206,6 +206,11 @@
         Set<String> allKeys = dynamicTask.getAllKeys();
         for (String key : allKeys) {
            if (key.startsWith(deviceId)) {
               Runnable runnable = dynamicTask.get(key);
               if (runnable instanceof ISubscribeTask) {
                  ISubscribeTask subscribeTask = (ISubscribeTask) runnable;
                  subscribeTask.stop();
               }
               dynamicTask.stop(key);
            }
         }
@@ -312,12 +317,7 @@
   public ResponseEntity<WVPResult<String>> updateDevice(Device device){
      if (device != null && device.getDeviceId() != null) {
         // TODO 报警订阅相关的信息
         deviceService.updateDevice(device);
//         cmder.deviceInfoQuery(device);
      }
      WVPResult<String> result = new WVPResult<>();
      result.setCode(0);
@@ -342,6 +342,11 @@
      Device device = storager.queryVideoDevice(deviceId);
      String uuid = UUID.randomUUID().toString();
      String key = DeferredResultHolder.CALLBACK_CMD_DEVICESTATUS + deviceId;
      DeferredResult<ResponseEntity<String>> result = new DeferredResult<ResponseEntity<String>>(2*1000L);
      if(device == null) {
         result.setResult(new ResponseEntity(String.format("设备%s不存在", deviceId),HttpStatus.OK));
         return result;
      }
      cmder.deviceStatusQuery(device, event -> {
         RequestMessage msg = new RequestMessage();
         msg.setId(uuid);
@@ -349,7 +354,6 @@
         msg.setData(String.format("获取设备状态失败,错误码: %s, %s", event.statusCode, event.msg));
         resultHolder.invokeResult(msg);
      });
        DeferredResult<ResponseEntity<String>> result = new DeferredResult<ResponseEntity<String>>(2*1000L);
      result.onTimeout(()->{
         logger.warn(String.format("获取设备状态超时"));
         // 释放rtpserver