Merge branch 'master' into docker_package

This commit is contained in:
wangliwen 2022-07-05 18:23:23 +08:00
commit 8a2fa967e2
1 changed files with 6 additions and 6 deletions

View File

@ -59,7 +59,8 @@ import java.util.stream.Collectors;
@RequestMapping("/resource")
@Api(tags = "资源表")
public class ResourceController {
private Integer cpuNUm = Runtime.getRuntime().availableProcessors();
private static Integer cpuNUm = Runtime.getRuntime().availableProcessors();
private static final ExecutorService executor = Executors.newFixedThreadPool(cpuNUm);
@Value("${big_date.name}")
private String bigDateDeptName; // 大数据局名称
@ -165,7 +166,6 @@ public class ResourceController {
*/
@GetMapping("/updateTest")
public Result<String> updateTest() {
final ExecutorService executor = Executors.newFixedThreadPool(cpuNUm);
CompletableFuture.runAsync(() -> {
List<Long> ids = jdbcTemplate.queryForList("SELECT id FROM tb_data_resource", Long.class);
ids.stream().forEach(id -> {
@ -268,16 +268,16 @@ public class ResourceController {
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);
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(2, dept, resourceService, deptDTO.get().getId())).sheet(2).headRowNumber(1).doReadSync();
});
}, executor);
CompletableFuture.runAsync(() -> {
EasyExcel.read(file, new ResourceExcelImportListener(3, dept, resourceService, deptDTO.get().getId())).sheet(3).headRowNumber(1).doReadSync();
});
}, executor);
} catch (IOException e) {
return new Result<String>().error(e.getMessage());
}