648540858
2020-11-13 33b51c40ddd9750a19b2c6a6618fb22386f87cd7
src/main/java/com/genersoft/iot/vmp/vmanager/record/RecordController.java
@@ -4,6 +4,7 @@
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -16,6 +17,7 @@
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
@CrossOrigin
@RestController
@RequestMapping("/api")
public class RecordController {
@@ -31,17 +33,18 @@
   @Autowired
   private DeferredResultHolder resultHolder;
   
   @GetMapping("/recordinfo/{deviceId}")
   public DeferredResult<ResponseEntity<RecordInfo>> recordinfo(@PathVariable String deviceId, String startTime,  String endTime){
   @GetMapping("/record/{deviceId}/{channelId}")
   public DeferredResult<ResponseEntity<RecordInfo>> recordinfo(@PathVariable String deviceId,@PathVariable String channelId, String startTime,  String endTime){
      
      if (logger.isDebugEnabled()) {
         logger.debug(String.format("录像信息 API调用,deviceId:%s ,startTime:%s, startTime:%s",deviceId, startTime, endTime));
         logger.debug(String.format("录像信息查询 API调用,deviceId:%s ,startTime:%s, startTime:%s",deviceId, startTime, endTime));
      }
      
      Device device = storager.queryVideoDevice(deviceId);
      cmder.recordInfoQuery(device, startTime, endTime);
      cmder.recordInfoQuery(device, channelId, startTime, endTime);
      DeferredResult<ResponseEntity<RecordInfo>> result = new DeferredResult<ResponseEntity<RecordInfo>>();
      resultHolder.put(DeferredResultHolder.CALLBACK_CMD_CATALOG+deviceId, result);
      // 录像查询以channelId作为deviceId查询
      resultHolder.put(DeferredResultHolder.CALLBACK_CMD_RECORDINFO+channelId, result);
        return result;
   }
}