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