|
|
@ -84,7 +84,7 @@ public class GetInformationForExcelServiceImpl extends ServiceImpl<GetInformatio |
|
|
//图片 |
|
|
//图片 |
|
|
List<String> imageFiles = new ArrayList<>(); |
|
|
List<String> imageFiles = new ArrayList<>(); |
|
|
|
|
|
|
|
|
// List<String> deleteFile =new ArrayList<>(); |
|
|
|
|
|
|
|
|
List<String> deleteFile =new ArrayList<>(); |
|
|
|
|
|
|
|
|
if (fileInfo != null && files != null) { |
|
|
if (fileInfo != null && files != null) { |
|
|
Path folderPath = Paths.get(folderFiler); |
|
|
Path folderPath = Paths.get(folderFiler); |
|
|
@ -99,7 +99,10 @@ public class GetInformationForExcelServiceImpl extends ServiceImpl<GetInformatio |
|
|
Path newFilePath = folderPath.resolve(timestamp + "$" + file.getFileName()); |
|
|
Path newFilePath = folderPath.resolve(timestamp + "$" + file.getFileName()); |
|
|
// 重命名文件 |
|
|
// 重命名文件 |
|
|
Files.move(file, newFilePath, StandardCopyOption.REPLACE_EXISTING); |
|
|
Files.move(file, newFilePath, StandardCopyOption.REPLACE_EXISTING); |
|
|
imageFiles.add(newFilePath.toString()); |
|
|
|
|
|
|
|
|
//保存的图片路径 |
|
|
|
|
|
String s = file.getFileName().toString(); |
|
|
|
|
|
imageFiles.add(excel.getBackupPhotoPath()+"\\"+timestamp + "$"+s); |
|
|
|
|
|
deleteFile.add(newFilePath.toString()); |
|
|
|
|
|
|
|
|
} else { |
|
|
} else { |
|
|
String timestamp = String.valueOf(System.currentTimeMillis()); |
|
|
String timestamp = String.valueOf(System.currentTimeMillis()); |
|
|
@ -146,7 +149,7 @@ public class GetInformationForExcelServiceImpl extends ServiceImpl<GetInformatio |
|
|
if (CollectionUtils.isNotEmpty(imageFiles)) { |
|
|
if (CollectionUtils.isNotEmpty(imageFiles)) { |
|
|
List<EquipmentDataDetail> equipmentDataDetails = saveImage(imageFiles, excel, batchNo); |
|
|
List<EquipmentDataDetail> equipmentDataDetails = saveImage(imageFiles, excel, batchNo); |
|
|
getInformationForExcelMapper.saveByExcels(equipmentDataDetails); |
|
|
getInformationForExcelMapper.saveByExcels(equipmentDataDetails); |
|
|
for (String s : imageFiles) { |
|
|
|
|
|
|
|
|
for (String s : deleteFile) { |
|
|
// 创建源文件对象和目标文件夹对象 |
|
|
// 创建源文件对象和目标文件夹对象 |
|
|
deleteBypath(s, excel.getBackupPhotoPath()); |
|
|
deleteBypath(s, excel.getBackupPhotoPath()); |
|
|
} |
|
|
} |
|
|
@ -464,7 +467,9 @@ public class GetInformationForExcelServiceImpl extends ServiceImpl<GetInformatio |
|
|
// 重命名文件 |
|
|
// 重命名文件 |
|
|
Files.move(file, newFilePath, StandardCopyOption.REPLACE_EXISTING); |
|
|
Files.move(file, newFilePath, StandardCopyOption.REPLACE_EXISTING); |
|
|
String s = newFilePath.toString(); |
|
|
String s = newFilePath.toString(); |
|
|
System.out.println("图片名: " + s); |
|
|
|
|
|
|
|
|
System.out.println("新图片名: " + s); |
|
|
|
|
|
String s1 = file.getFileName().toString(); |
|
|
|
|
|
System.out.println("旧图片名"+timestamp + "$" +s1); |
|
|
} else { |
|
|
} else { |
|
|
String timestamp = String.valueOf(System.currentTimeMillis()); |
|
|
String timestamp = String.valueOf(System.currentTimeMillis()); |
|
|
// 指定新的文件名(这里示例加上前缀) |
|
|
// 指定新的文件名(这里示例加上前缀) |
|
|
@ -480,3 +485,4 @@ public class GetInformationForExcelServiceImpl extends ServiceImpl<GetInformatio |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|