...
This commit is contained in:
parent
079c3b4eb4
commit
6eb4596a66
|
@ -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());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue