From 70019451d24925212e46df10a82962fb6b20da7f Mon Sep 17 00:00:00 2001 From: shikong <919411476@qq.com> Date: Tue, 6 Feb 2024 15:56:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=A0=B9=E6=8D=AE=20?= =?UTF-8?q?=E6=8C=87=E5=AE=9A=E6=97=B6=E9=97=B4=E8=8C=83=E5=9B=B4=E7=9A=84?= =?UTF-8?q?=20recordInfo=20=E6=9F=A5=E8=AF=A2,=20=E9=A2=84=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E8=A7=86=E9=A2=91=E6=96=87=E4=BB=B6=E5=88=B0=E6=9C=AC?= =?UTF-8?q?=E5=9C=B0=E6=8C=87=E5=AE=9A=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gb28181/mocking/core/sip/service/VideoCacheManager.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gb28181-mocking-service/src/main/java/cn/skcks/docking/gb28181/mocking/core/sip/service/VideoCacheManager.java b/gb28181-mocking-service/src/main/java/cn/skcks/docking/gb28181/mocking/core/sip/service/VideoCacheManager.java index ddbf7ca..9c16d7b 100644 --- a/gb28181-mocking-service/src/main/java/cn/skcks/docking/gb28181/mocking/core/sip/service/VideoCacheManager.java +++ b/gb28181-mocking-service/src/main/java/cn/skcks/docking/gb28181/mocking/core/sip/service/VideoCacheManager.java @@ -75,6 +75,11 @@ public class VideoCacheManager { @SneakyThrows protected CompletableFuture> downloadVideo(String deviceCode, Date startTime, Date endTime) { return CompletableFuture.supplyAsync(()->{ + File realFile = Paths.get(deviceProxyConfig.getPreDownloadForRecordInfo().getCachePath(),fileName(deviceCode, startTime, endTime) + ".mp4").toFile(); + if(realFile.exists()){ + return JsonResponse.success(realFile.getAbsolutePath()); + } + final String url = UrlBuilder.of(deviceProxyConfig.getUrl()) .addPath("video") .addQuery("device_id", deviceCode) @@ -103,7 +108,6 @@ public class VideoCacheManager { }); log.info("视频下载完成 => {}", file.getAbsolutePath()); log.info("文件 {}, 是否存在: {}", file.getAbsolutePath(), file.exists()); - File realFile = Paths.get(deviceProxyConfig.getPreDownloadForRecordInfo().getCachePath(),fileName(deviceCode, startTime, endTime) + ".mp4").toFile(); file.renameTo(realFile); lock.release(); return JsonResponse.success(realFile.getAbsolutePath());