This commit is contained in:
wangliwen 2022-07-21 10:02:03 +08:00
parent 162b016d36
commit 76255c5ff3
1 changed files with 3 additions and 5 deletions

View File

@ -53,7 +53,7 @@ import java.util.stream.Collectors;
@RestController @RestController
@RequestMapping("/ability/center/v2") @RequestMapping("/ability/center/v2")
public class AbilityCenterControllerV2 { public class AbilityCenterControllerV2 {
private static final ExecutorService executor = Executors.newCachedThreadPool(); private static final ExecutorService executor = Executors.newWorkStealingPool();
private static final Logger logger = LoggerFactory.getLogger(AbilityCenterController.class); private static final Logger logger = LoggerFactory.getLogger(AbilityCenterController.class);
private static final ObjectMapper oMapper = new ObjectMapper(); private static final ObjectMapper oMapper = new ObjectMapper();
@Autowired @Autowired
@ -108,10 +108,9 @@ public class AbilityCenterControllerV2 {
abilityBatchApplicationDTO.setApplyFlag(applyFlag); // 同一次的申请标识 abilityBatchApplicationDTO.setApplyFlag(applyFlag); // 同一次的申请标识
final Optional<SysDeptDTO> deptDTO = Optional.ofNullable(sysDeptService.getByName(bigDateDeptName)); final Optional<SysDeptDTO> deptDTO = Optional.ofNullable(sysDeptService.getByName(bigDateDeptName));
final UserDetail user = SecurityUser.getUser(); final UserDetail user = SecurityUser.getUser();
CompletableFuture.runAsync(() -> { executor.execute(() -> {
logger.info("处理能力申请!");
deal(abilityBatchApplicationDTO, deptDTO, applyFlag, user); deal(abilityBatchApplicationDTO, deptDTO, applyFlag, user);
}, executor); });
return new Result().ok(LocalDateTime.now().toString()); return new Result().ok(LocalDateTime.now().toString());
} }
@ -132,7 +131,6 @@ public class AbilityCenterControllerV2 {
logger.info("申请入参{}", JSON.toJSONString(abilityBatchApplicationDTO)); logger.info("申请入参{}", JSON.toJSONString(abilityBatchApplicationDTO));
final Optional<SysDeptDTO> deptDTO = Optional.ofNullable(sysDeptService.getByName(bigDateDeptName)); final Optional<SysDeptDTO> deptDTO = Optional.ofNullable(sysDeptService.getByName(bigDateDeptName));
final UserDetail user = SecurityUser.getUser(); final UserDetail user = SecurityUser.getUser();
deal(abilityBatchApplicationDTO, deptDTO, applyFlag, user); deal(abilityBatchApplicationDTO, deptDTO, applyFlag, user);
return new Result().ok(LocalDateTime.now().toString()); return new Result().ok(LocalDateTime.now().toString());
} }