|
|
@ -74,7 +74,6 @@ public class GetInformationForExcelServiceImpl extends ServiceImpl<GetInformatio |
|
|
private void saveInformation(EquipmentFolderLocation excel) throws Exception { |
|
|
private void saveInformation(EquipmentFolderLocation excel) throws Exception { |
|
|
String folderFiler = excel.getFolderPath(); |
|
|
String folderFiler = excel.getFolderPath(); |
|
|
//获取文件夹下所有文件 |
|
|
//获取文件夹下所有文件 |
|
|
// List<File> files = getExcelFiles(folderFiler); |
|
|
|
|
|
//创建本地文件夹路径 |
|
|
//创建本地文件夹路径 |
|
|
File fileInfo = new File(folderFiler); |
|
|
File fileInfo = new File(folderFiler); |
|
|
//获取本地文件夹下所有文件 |
|
|
//获取本地文件夹下所有文件 |
|
|
@ -114,7 +113,7 @@ public class GetInformationForExcelServiceImpl extends ServiceImpl<GetInformatio |
|
|
imageFiles.add(file.getFileName().toString()); |
|
|
imageFiles.add(file.getFileName().toString()); |
|
|
|
|
|
|
|
|
} else { |
|
|
} else { |
|
|
String timestamp = String.valueOf(System.currentTimeMillis()); |
|
|
|
|
|
|
|
|
// String timestamp = String.valueOf(System.currentTimeMillis()); |
|
|
// 指定新的文件名(这里示例加上前缀) |
|
|
// 指定新的文件名(这里示例加上前缀) |
|
|
// Path newFilePath = folderPath.resolve(timestamp + "$" + file.getFileName()); |
|
|
// Path newFilePath = folderPath.resolve(timestamp + "$" + file.getFileName()); |
|
|
// // 重命名文件 |
|
|
// // 重命名文件 |
|
|
@ -474,15 +473,20 @@ public class GetInformationForExcelServiceImpl extends ServiceImpl<GetInformatio |
|
|
endList = equipmentDataDetails.size(); |
|
|
endList = equipmentDataDetails.size(); |
|
|
} |
|
|
} |
|
|
List<EquipmentDataDetail> details = equipmentDataDetails.subList(startList, endList); |
|
|
List<EquipmentDataDetail> details = equipmentDataDetails.subList(startList, endList); |
|
|
startList = startList + endList; |
|
|
|
|
|
endList = endList + endList; |
|
|
|
|
|
executor.execute(() -> { |
|
|
executor.execute(() -> { |
|
|
//批量新增 |
|
|
//批量新增 |
|
|
getInformationForExcelMapper.saveByExcels(details); |
|
|
getInformationForExcelMapper.saveByExcels(details); |
|
|
}); |
|
|
}); |
|
|
|
|
|
startList = startList + 100; |
|
|
|
|
|
endList = endList + 100; |
|
|
} |
|
|
} |
|
|
// 关闭线程池 |
|
|
|
|
|
executor.shutdown(); |
|
|
executor.shutdown(); |
|
|
|
|
|
try { |
|
|
|
|
|
executor.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS); // 等待所有任务完成 |
|
|
|
|
|
} catch (InterruptedException e) { |
|
|
|
|
|
Thread.currentThread().interrupt(); |
|
|
|
|
|
// 处理中断异常 |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|