From 2bf8bb4df5f0a602031579cda0d54ed7b7e78b28 Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Fri, 9 May 2025 10:30:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=EF=BC=8CsourceId=E4=BC=A0?= =?UTF-8?q?=E5=85=A5=E6=97=A0=E9=9C=80=E4=BC=A0url?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ycwl/basic/task/VideoPieceGetter.java | 4 ++-- .../java/com/ycwl/basic/utils/VideoReUploader.java | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/ycwl/basic/task/VideoPieceGetter.java b/src/main/java/com/ycwl/basic/task/VideoPieceGetter.java index 08dad9d..cb637a6 100644 --- a/src/main/java/com/ycwl/basic/task/VideoPieceGetter.java +++ b/src/main/java/com/ycwl/basic/task/VideoPieceGetter.java @@ -311,11 +311,11 @@ public class VideoPieceGetter { sourceMapper.addRelation(videoSource); } sourceMapper.add(sourceEntity); - videoReUploader.addTask(url, sourceEntity.getId()); + videoReUploader.addTask(sourceEntity.getId()); } else { source.setVideoUrl(url); sourceMapper.update(source); - videoReUploader.addTask(url, source.getId()); + videoReUploader.addTask(source.getId()); } } else { // 有原视频 diff --git a/src/main/java/com/ycwl/basic/utils/VideoReUploader.java b/src/main/java/com/ycwl/basic/utils/VideoReUploader.java index 1723a53..e1be1a5 100644 --- a/src/main/java/com/ycwl/basic/utils/VideoReUploader.java +++ b/src/main/java/com/ycwl/basic/utils/VideoReUploader.java @@ -48,7 +48,7 @@ public class VideoReUploader { @Autowired private ScenicRepository scenicRepository; - public void addTask(String url, Long sourceId) { + public void addTask(Long sourceId) { SourceEntity entity = sourceMapper.getEntity(sourceId); if (entity == null) { return; @@ -65,16 +65,16 @@ public class VideoReUploader { } final String dstFilePath = StorageUtil.joinPath(StorageConstant.VIDEO_PIECE_PATH, entity.getId().toString() + ".mp4"); final IStorageAdapter adapter = scenicService.getScenicStorageAdapter(entity.getScenicId()); - if (StringUtils.equals(url, adapter.getUrl(dstFilePath))) { + if (StringUtils.equals(entity.getVideoUrl(), adapter.getUrl(dstFilePath))) { return; } String tmpFilePath = UUID.randomUUID().toString(); executor.execute(() -> { // 先下载,后上传 File dstFile = new File(tmpFilePath); - log.info("下载视频:{};sourceId:{}", url, sourceId); - long size = HttpUtil.downloadFile(url, dstFile); - log.info("下载视频完成:{};大小:{};sourceId:{}", url, size, sourceId); + log.info("下载视频:{};sourceId:{}", entity.getVideoUrl(), sourceId); + long size = HttpUtil.downloadFile(entity.getVideoUrl(), dstFile); + log.info("下载视频完成:{};大小:{};sourceId:{}", entity.getVideoUrl(), size, sourceId); try { log.info("开始上传:{};sourceId:{}", dstFilePath, sourceId); String newUrl = adapter.uploadFile("video/mp4", dstFile, dstFilePath);