From c8bdf6d520b27531ca8e2bc90caa7292b4d25ab2 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期三, 13 十一月 2024 17:07:37 +0800
Subject: [PATCH] 打印日志

---
 ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/sync/VideoPulSync.java |   25 ++++++++++++++-----------
 1 files changed, 14 insertions(+), 11 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..c5a32aa 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,6 +2,8 @@
 
 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;
@@ -30,6 +32,7 @@
 import java.util.HashMap;
 import java.util.List;
 
+@Slf4j
 @Component
 public class VideoPulSync {
 
@@ -43,28 +46,28 @@
         this.baseMapper = baseMapper;
     }
 
-//    @Scheduled(cron = "0 0/1 * * * ?")
+    @Scheduled(cron = "0 0/1 * * * ?")
     public void get() throws IOException {
         System.out.println("鍚屾涓婁紶......");
-
+        log.info("鍚屾涓婁紶");
         List<String> list = FtpApche.downloadList(ftpConfig);
+
         if(list.size() == 0){
+            log.error("no files in ftp");
+            System.out.println("ftp get 0 fileinfo");
             return;
         }
+        System.out.println("ftp get all fileinfo锛�" + list.get(0));
         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);
         }
 
     }

--
Gitblit v1.8.0