Преглед изворни кода

替换文件日志输出方式

wks пре 2 година
родитељ
комит
c3f470ef79
1 измењених фајлова са 11 додато и 9 уклоњено
  1. 11 9
      src/main/java/com/ydtech/utils/baidu/FileUtil.java

+ 11 - 9
src/main/java/com/ydtech/utils/baidu/FileUtil.java

@@ -2,6 +2,7 @@ package com.ydtech.utils.baidu;
 
 import com.ydtech.modules.ins.utils.CompressUtil;
 import com.ydtech.utils.StringUtils;
+import lombok.extern.slf4j.Slf4j;
 
 import java.io.*;
 import java.net.MalformedURLException;
@@ -13,6 +14,7 @@ import java.util.regex.Pattern;
 /**
  * 文件读取工具类
  */
+@Slf4j
 public class FileUtil {
 
     /**
@@ -102,8 +104,8 @@ public class FileUtil {
             //存在
             File existFile = new File(uploadPath + fileName);
             if (existFile.exists()) {
-                System.err.println("存在的文件:" + existFile.getPath());
-                System.err.println("存在的文件的展示地址:" + showPath);
+                log.error("存在的文件:" + existFile.getPath());
+                log.error("存在的文件的展示地址:" + showPath);
                 return showPath;
             }
 
@@ -118,7 +120,7 @@ public class FileUtil {
             File file = new File(uploadPath + fileName);
             copyInputStreamToFile(inputStream, file);
 
-            System.err.println("文件路径:" + file.getPath());
+            log.error("文件路径:" + file.getPath());
             return showPath;
 
         } catch (MalformedURLException e) {
@@ -147,8 +149,8 @@ public class FileUtil {
         //存在
         File existFile = new File(uploadPath + fileName);
         if (existFile.exists()) {
-            System.err.println("存在的文件:" + existFile.getPath());
-            System.err.println("存在的文件的展示地址:" + showPath);
+            log.error("存在的文件:" + existFile.getPath());
+            log.error("存在的文件的展示地址:" + showPath);
             return showPath;
         }
         return "";
@@ -188,8 +190,8 @@ public class FileUtil {
             //存在
             File existFile = new File(uploadPath + fileName);
             if (existFile.exists()) {
-                System.err.println("存在的文件:" + existFile.getPath());
-                System.err.println("存在的文件的展示地址:" + showPath);
+                log.error("存在的文件:" + existFile.getPath());
+                log.error("存在的文件的展示地址:" + showPath);
                 return showPath;
             }
 
@@ -200,10 +202,10 @@ public class FileUtil {
 
             URI u = URI.create(url);
             InputStream inputStream = u.toURL().openStream();
-            File file = new File(uploadPath + licensePlate+".zip");
+            File file = new File(uploadPath + licensePlate + ".zip");
             copyInputStreamToFile(inputStream, file);
 
-            CompressUtil.unZip(file.getPath(),uploadPath,password,fileName,licensePlate);
+            CompressUtil.unZip(file.getPath(), uploadPath, password, fileName, licensePlate);
             file.delete();
             return showPath;