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);