From 3c4ef437774f146102b46e5a94b890d625e5d697 Mon Sep 17 00:00:00 2001 From: xiangpei <xiangpei@timesnew.cn> Date: 星期一, 17 二月 2025 10:42:17 +0800 Subject: [PATCH] 独立删除逻辑 --- ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/sync/VideoPulSync.java | 31 ++++++++++--------------------- 1 files changed, 10 insertions(+), 21 deletions(-) diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/sync/VideoPulSync.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/sync/VideoPulSync.java index 192eda8..00a24a4 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/sync/VideoPulSync.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/sync/VideoPulSync.java @@ -2,12 +2,11 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; +import lombok.extern.slf4j.Slf4j; import org.dromara.common.core.utils.DateUtils; import org.dromara.common.oss.core.OssClient; import org.dromara.common.oss.entity.SynchronousRequest; -import org.dromara.common.oss.entity.SynchronousRequest2; import org.dromara.common.oss.entity.UploadResult; -import org.dromara.common.oss.entity.VideoRequest; import org.dromara.common.oss.factory.OssFactory; import org.dromara.system.domain.SysOss; import org.dromara.system.domain.properties.Boundary; @@ -15,9 +14,7 @@ import org.dromara.system.mapper.SysOssMapper; import org.dromara.system.uitil.FtpApche; import org.dromara.system.uitil.HttpUtils; -import org.dromara.system.uitil.PasswordUtil; import org.jetbrains.annotations.NotNull; -import org.springframework.http.MediaType; import org.springframework.mock.web.MockMultipartFile; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; @@ -26,10 +23,10 @@ import java.io.IOException; import java.io.InputStream; import java.text.SimpleDateFormat; -import java.util.ArrayList; import java.util.HashMap; import java.util.List; +@Slf4j @Component public class VideoPulSync { @@ -43,30 +40,22 @@ this.baseMapper = baseMapper; } -// @Scheduled(cron = "0 0/1 * * * ?") + @Scheduled(cron = "0 0/1 * * * ?") public void get() throws IOException { - System.out.println("鍚屾涓婁紶......"); - - List<String> list = FtpApche.downloadList(ftpConfig); - if(list.size() == 0){ + List<String> list = FtpApche.downloadList(this.ftpConfig); + if (list.size() == 0) return; - } for (String str : list) { - //瀵嗙爜 - String password = str.substring(0,6); - //鏂囦欢鍚嶇О - String fileName = str.substring(6,str.length()); + String password = str.substring(0, 6); + String fileName = str.substring(6, str.length()); InputStream input = FtpApche.downloadFileFromDailyDir(str); byte[] fileBytesByName = FtpApche.getFileBytesByName(input); OssClient storage = OssFactory.instance(); - UploadResult uploadResult = storage.upload(input,getPath(fileName),fileName.substring(14,fileName.length())); + MockMultipartFile mockMultipartFile = new MockMultipartFile(fileName, fileName, fileName.substring(14, fileName.length()), input); + UploadResult uploadResult = storage.uploadSuffix2(fileBytesByName, getPath(fileName), "multipart/form-data; charset=ISO-8859-1"); FtpApche.deleteFile(str); - MultipartFile file = new MockMultipartFile(fileName,fileName, fileName.substring(14,fileName.length()), input); - buildResultEntity(fileName, fileName.substring(14,fileName.length()), "minio", uploadResult, file, - password, fileBytesByName); - + buildResultEntity(fileName, fileName.substring(14, fileName.length()), "minio", uploadResult, (MultipartFile)mockMultipartFile, password, fileBytesByName); } - } @NotNull -- Gitblit v1.8.0