|
@@ -68,8 +68,11 @@ public class PatrolInspectionDeviceServiceImpl extends AbstractCrudService<Patro
|
|
|
if (file.isEmpty()) {
|
|
|
System.out.println("文件为空空");
|
|
|
}
|
|
|
+ String fileName = file.getOriginalFilename(); // 文件名
|
|
|
+ String suffixName = fileName.substring(fileName.lastIndexOf(".")); // 后缀名
|
|
|
+ fileName = UUID.randomUUID() + suffixName; // 新文件名
|
|
|
|
|
|
- File file1 = FileUtils.getFile(GlobalUtils.getTempBaseDir(), file.getOriginalFilename());
|
|
|
+ File file1 = FileUtils.getFile(GlobalUtils.getTempBaseDir(), fileName);
|
|
|
try {
|
|
|
file.transferTo(file1);
|
|
|
} catch (Exception e) {
|
|
@@ -93,7 +96,7 @@ public class PatrolInspectionDeviceServiceImpl extends AbstractCrudService<Patro
|
|
|
// e.printStackTrace();
|
|
|
// }
|
|
|
// String filename = "/uploaded/" + fileName;
|
|
|
- return file.getOriginalFilename();
|
|
|
+ return fileName;
|
|
|
}
|
|
|
|
|
|
}
|