From 22b948405d2e7d285a0ed2ad2bd4857383561a6e Mon Sep 17 00:00:00 2001
From: peng <peng.com>
Date: 星期五, 31 十月 2025 16:08:39 +0800
Subject: [PATCH] 调整提示
---
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/sync/VideoPulSync.java | 37 ++++++++++++-------------------------
1 files changed, 12 insertions(+), 25 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 2172790..bf55b2a 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
@@ -3,13 +3,10 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import lombok.extern.slf4j.Slf4j;
-import org.dromara.common.core.exception.ServiceException;
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;
@@ -17,22 +14,17 @@
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;
-import org.springframework.util.CollectionUtils;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.io.InputStream;
import java.text.SimpleDateFormat;
-import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
-import java.util.Objects;
@Slf4j
@Component
@@ -50,28 +42,23 @@
@Scheduled(cron = "0 0/1 * * * ?")
public void get() throws IOException {
- log.error("鍚屾涓婁紶");
- List<String> list = FtpApche.downloadList(ftpConfig);
-
- if(CollectionUtils.isEmpty(list)){
- log.error("no files in ftp");
+ List<String> list = FtpApche.downloadList(this.ftpConfig);
+ if (list.size() == 0)
return;
- }
- log.info("ftp get all fileinfo锛�" + list.get(0));
for (String str : list) {
String password = str.substring(0, 6);
String fileName = str.substring(6, str.length());
- InputStream input = FtpApche.downloadFileFromDailyDir(str);
- if (Objects.nonNull(input)) {
- byte[] fileBytesByName = FtpApche.getFileBytesByName(input);
- OssClient storage = OssFactory.instance();
- 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");
- buildResultEntity(fileName, fileName.substring(14, fileName.length()), "minio", uploadResult, (MultipartFile)mockMultipartFile, password, fileBytesByName);
- FtpApche.deleteFile(str);
- }
+ System.out.println("file name is锛�" + fileName);
+ log.error("file name is锛�" + fileName);
+ InputStream input = FtpApche.downloadFileFromDailyDir(str, this.ftpConfig);
+ byte[] fileBytesByName = FtpApche.getFileBytesByName(input);
+ OssClient storage = OssFactory.instance();
+ String contentType = fileName.length() >= 14 ? fileName.substring(14) : "application/octet-stream";
+ MockMultipartFile mockMultipartFile = new MockMultipartFile(fileName, fileName, contentType, input);
+ UploadResult uploadResult = storage.uploadSuffix2(fileBytesByName, getPath(fileName), "multipart/form-data; charset=ISO-8859-1");
+ FtpApche.deleteFile(str);
+ buildResultEntity(fileName, fileName.substring(14, fileName.length()), "minio", uploadResult, (MultipartFile)mockMultipartFile, password, fileBytesByName);
}
-
}
@NotNull
--
Gitblit v1.8.0