add(req-2080):创建文件夹---加日志

This commit is contained in:
胡朝飞 2024-01-22 11:42:49 +08:00
parent 4b6e0e8f2a
commit dcf35f711e

View File

@ -643,9 +643,11 @@ public class FileServiceImpl implements FileService {
input = file.getInputStream();
// 指定目标文件路径及文件名
String rootDir = System.getProperty("user.dir");
log.info("rootDir{}", rootDir);
String fileName = file.getOriginalFilename();
String filePath = rootDir + SEPARATOR + "temp_directory" + SEPARATOR;
String absolutePath = filePath + fileName;
String filePath = rootDir + SEPARATOR + "temp_directory";
log.info("filePath{}", filePath);
String absolutePath = filePath + SEPARATOR + fileName;
// 创建临时文件夹
java.io.File tempDirectory = new java.io.File(filePath);
@ -660,6 +662,7 @@ public class FileServiceImpl implements FileService {
absolutePath = rootDir + SEPARATOR + fileName;
}
}
log.info("tempDirectory{}", tempDirectory);
if (!tempDirectory.exists()) {
// 兜底
absolutePath = rootDir + SEPARATOR + fileName;