完成下载文件的前后调试

This commit is contained in:
648540858
2023-12-06 15:11:21 +08:00
parent ad36354ef4
commit 7e136c9ac7
7 changed files with 77 additions and 182 deletions

View File

@@ -1,6 +1,7 @@
package com.genersoft.iot.vmp.vmanager.bean;
import com.genersoft.iot.vmp.common.StreamInfo;
import com.genersoft.iot.vmp.service.bean.DownloadFileInfo;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(description = "流信息")
@@ -93,6 +94,9 @@ public class StreamContent {
@Schema(description = "结束时间")
private String endTime;
@Schema(description = "文件下载地址(录像下载使用)")
private DownloadFileInfo downLoadFilePath;
private double progress;
public StreamContent(StreamInfo streamInfo) {
@@ -170,6 +174,10 @@ public class StreamContent {
this.startTime = streamInfo.getStartTime();
this.endTime = streamInfo.getEndTime();
this.progress = streamInfo.getProgress();
if (streamInfo.getDownLoadFilePath() != null) {
this.downLoadFilePath = streamInfo.getDownLoadFilePath();
}
}
public String getApp() {
@@ -411,4 +419,12 @@ public class StreamContent {
public void setProgress(double progress) {
this.progress = progress;
}
public DownloadFileInfo getDownLoadFilePath() {
return downLoadFilePath;
}
public void setDownLoadFilePath(DownloadFileInfo downLoadFilePath) {
this.downLoadFilePath = downLoadFilePath;
}
}

View File

@@ -212,32 +212,4 @@ public class GBRecordController {
}
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;
}
}