Merge branch 'dev'

# Conflicts:
#	renren-admin/src/main/java/io/renren/modules/resource/controller/ResourceController.java
This commit is contained in:
wangliwen 2022-10-09 10:45:40 +08:00
commit 06b3086ae3
1 changed files with 7 additions and 6 deletions

View File

@ -321,14 +321,15 @@ public class ResourceController {
String newName = UUID.randomUUID() + oldName.substring(oldName.lastIndexOf(".")); String newName = UUID.randomUUID() + oldName.substring(oldName.lastIndexOf("."));
try { try {
// 文件保存 // 文件保存
File file = new File(folder, newName); final File file = new File(folder, newName);
logger.info(file.getPath());
uploadFile.transferTo(file); uploadFile.transferTo(file);
Optional<SysDeptDTO> deptDTO = Optional.ofNullable(sysDeptService.getByName(bigDateDeptName)); Optional<SysDeptDTO> deptDTO = Optional.ofNullable(sysDeptService.getByName(bigDateDeptName));
CompletableFuture.runAsync(() -> EasyExcel.read(file, new ResourceExcelImportListener(0, dept, resourceService, deptDTO.get().getId())).sheet(0).headRowNumber(1).doReadSync(), executor); deptDTO.ifPresent(index -> {
CompletableFuture.runAsync(() -> EasyExcel.read(file, new ResourceExcelImportListener(1, dept, resourceService, deptDTO.get().getId())).sheet(1).headRowNumber(1).doReadSync(), executor); CompletableFuture.runAsync(() -> EasyExcel.read(file, new ResourceExcelImportListener(0, dept, resourceService, index.getId())).sheet(0).headRowNumber(1).doReadSync(), executor);
CompletableFuture.runAsync(() -> EasyExcel.read(file, new ResourceExcelImportListener(2, dept, resourceService, deptDTO.get().getId())).sheet(2).headRowNumber(1).doReadSync(), executor); CompletableFuture.runAsync(() -> EasyExcel.read(file, new ResourceExcelImportListener(1, dept, resourceService, index.getId())).sheet(1).headRowNumber(1).doReadSync(), executor);
CompletableFuture.runAsync(() -> EasyExcel.read(file, new ResourceExcelImportListener(3, dept, resourceService, deptDTO.get().getId())).sheet(3).headRowNumber(1).doReadSync(), executor); CompletableFuture.runAsync(() -> EasyExcel.read(file, new ResourceExcelImportListener(2, dept, resourceService, index.getId())).sheet(2).headRowNumber(1).doReadSync(), executor);
CompletableFuture.runAsync(() -> EasyExcel.read(file, new ResourceExcelImportListener(3, dept, resourceService, index.getId())).sheet(3).headRowNumber(1).doReadSync(), executor);
});
} catch (IOException e) { } catch (IOException e) {
return new Result<String>().error(e.getMessage()); return new Result<String>().error(e.getMessage());
} }