648540858
2020-11-13 33b51c40ddd9750a19b2c6a6618fb22386f87cd7
src/main/java/com/genersoft/iot/vmp/vmanager/device/DeviceController.java
@@ -66,7 +66,7 @@
    * @param count 每页条数
    * @return 通道列表
    */
   @GetMapping("devices/{deviceId}/channels")
   @GetMapping("/devices/{deviceId}/channels")
   public ResponseEntity<PageResult> channels(@PathVariable String deviceId,
                                    int page, int count,
                                    @RequestParam(required = false) String query,
@@ -123,7 +123,7 @@
    * @param count 每页条数
    * @return 子通道列表
    */
   @GetMapping("subChannels/{deviceId}/{channelId}/channels")
   @GetMapping("/subChannels/{deviceId}/{channelId}/channels")
   public ResponseEntity<PageResult> subChannels(@PathVariable String deviceId,
                                      @PathVariable String channelId,
                                      int page,
@@ -138,16 +138,25 @@
      DeviceChannel deviceChannel = storager.queryChannel(deviceId,channelId);
      if (deviceChannel == null) {
         PageResult<DeviceChannel> deviceChannelPageResult = new PageResult<>();
         new ResponseEntity<>(deviceChannelPageResult,HttpStatus.OK);
         return new ResponseEntity<>(deviceChannelPageResult,HttpStatus.OK);
      }
      PageResult pageResult = storager.querySubChannels(deviceId, channelId, query, channelType, online, page, count);
      return new ResponseEntity<>(pageResult,HttpStatus.OK);
   }
   @PostMapping("channel/update/{deviceId}")
   @PostMapping("/channel/update/{deviceId}")
   public ResponseEntity<PageResult> updateChannel(@PathVariable String deviceId,DeviceChannel channel){
      storager.updateChannel(deviceId, channel);
      return new ResponseEntity<>(null,HttpStatus.OK);
   }
   @GetMapping("/devices/{deviceId}/transport/{streamMode}")
   @PostMapping("/devices/{deviceId}/transport/{streamMode}")
   public ResponseEntity<PageResult> updateTransport(@PathVariable String deviceId, @PathVariable String streamMode){
      Device device = storager.queryVideoDevice(deviceId);
      device.setStreamMode(streamMode);
      storager.updateDevice(device);
      return new ResponseEntity<>(null,HttpStatus.OK);
   }
}