| | |
| | | import com.genersoft.iot.vmp.conf.UserSetting; |
| | | import com.genersoft.iot.vmp.conf.exception.ControllerException; |
| | | import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException; |
| | | import com.genersoft.iot.vmp.conf.security.JwtUtils; |
| | | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| | | import com.genersoft.iot.vmp.gb28181.bean.RecordInfo; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; |
| | |
| | | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.security.SecurityRequirement; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | |
| | | @Autowired |
| | | private UserSetting userSetting; |
| | | |
| | | @Operation(summary = "录像查询") |
| | | @Operation(summary = "录像查询", security = @SecurityRequirement(name = JwtUtils.HEADER)) |
| | | @Parameter(name = "deviceId", description = "设备国标编号", required = true) |
| | | @Parameter(name = "channelId", description = "通道国标编号", required = true) |
| | | @Parameter(name = "startTime", description = "开始时间", required = true) |
| | |
| | | } |
| | | |
| | | |
| | | @Operation(summary = "开始历史媒体下载") |
| | | @Operation(summary = "开始历史媒体下载", security = @SecurityRequirement(name = JwtUtils.HEADER)) |
| | | @Parameter(name = "deviceId", description = "设备国标编号", required = true) |
| | | @Parameter(name = "channelId", description = "通道国标编号", required = true) |
| | | @Parameter(name = "startTime", description = "开始时间", required = true) |
| | |
| | | return result; |
| | | } |
| | | |
| | | @Operation(summary = "停止历史媒体下载") |
| | | @Operation(summary = "停止历史媒体下载", security = @SecurityRequirement(name = JwtUtils.HEADER)) |
| | | @Parameter(name = "deviceId", description = "设备国标编号", required = true) |
| | | @Parameter(name = "channelId", description = "通道国标编号", required = true) |
| | | @Parameter(name = "stream", description = "流ID", required = true) |
| | |
| | | } |
| | | } |
| | | |
| | | @Operation(summary = "获取历史媒体下载进度") |
| | | @Operation(summary = "获取历史媒体下载进度", security = @SecurityRequirement(name = JwtUtils.HEADER)) |
| | | @Parameter(name = "deviceId", description = "设备国标编号", required = true) |
| | | @Parameter(name = "channelId", description = "通道国标编号", required = true) |
| | | @Parameter(name = "stream", description = "流ID", required = true) |
| | |
| | | throw new ControllerException(ErrorCode.ERROR404); |
| | | } |
| | | return new StreamContent(downLoadInfo); |
| | | } |
| | | |
| | | @Operation(summary = "获取历史媒体下载文件地址") |
| | | @Parameter(name = "deviceId", description = "设备国标编号", required = true) |
| | | @Parameter(name = "channelId", description = "通道国标编号", required = true) |
| | | @Parameter(name = "stream", description = "流ID", required = true) |
| | | @GetMapping("/download/file/path/{deviceId}/{channelId}/{stream}") |
| | | public DeferredResult<WVPResult<DownloadFileInfo>> getDownloadFilePath(@PathVariable String deviceId, @PathVariable String channelId, @PathVariable String stream) { |
| | | |
| | | DeferredResult<WVPResult<DownloadFileInfo>> result = new DeferredResult<>(); |
| | | |
| | | result.onTimeout(()->{ |
| | | WVPResult<DownloadFileInfo> wvpResult = new WVPResult<>(); |
| | | wvpResult.setCode(ErrorCode.ERROR100.getCode()); |
| | | wvpResult.setMsg("timeout"); |
| | | result.setResult(wvpResult); |
| | | }); |
| | | |
| | | playService.getFilePath(deviceId, channelId, stream, (code, msg, data)->{ |
| | | WVPResult<DownloadFileInfo> wvpResult = new WVPResult<>(); |
| | | wvpResult.setCode(code); |
| | | wvpResult.setMsg(msg); |
| | | wvpResult.setData(data); |
| | | result.setResult(wvpResult); |
| | | }); |
| | | |
| | | |
| | | return result; |
| | | } |
| | | } |