Compare commits

...

2 Commits

Author SHA1 Message Date
wangliwen 3f5c12bc2c Merge branch 'dev' 2022-12-16 10:02:29 +08:00
wangliwen 0aede1e910 能力申请市局使用缓存线程池 2022-12-16 10:02:21 +08:00
1 changed files with 11 additions and 4 deletions

View File

@ -64,6 +64,8 @@ public class AbilityCenterControllerV3 {
private static final ExecutorService executor = Executors.newWorkStealingPool(CPUNUM * 2); private static final ExecutorService executor = Executors.newWorkStealingPool(CPUNUM * 2);
private static final ExecutorService executorMain = Executors.newCachedThreadPool();
private static final ObjectMapper oMapper = new ObjectMapper(); private static final ObjectMapper oMapper = new ObjectMapper();
@Value("${project.place}") @Value("${project.place}")
@ -129,8 +131,10 @@ public class AbilityCenterControllerV3 {
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();
switch (Constant.ProjectPlace.getByFlag(projectPlace)) { switch (Constant.ProjectPlace.getByFlag(projectPlace)) {
case TSINGTAO: { // 青岛市局 异步会死锁 case TSINGTAO: { // 青岛市局 异步会死锁 使用缓存线程池
executorMain.execute(() -> {
deal(abilityBatchApplicationDTO, deptDTO, applyFlag, user); deal(abilityBatchApplicationDTO, deptDTO, applyFlag, user);
});
} }
break; break;
default: { default: {
@ -165,7 +169,9 @@ public class AbilityCenterControllerV3 {
final UserDetail user = SecurityUser.getUser(); final UserDetail user = SecurityUser.getUser();
switch (Constant.ProjectPlace.getByFlag(projectPlace)) { switch (Constant.ProjectPlace.getByFlag(projectPlace)) {
case TSINGTAO: { // 青岛市局 异步会死锁 case TSINGTAO: { // 青岛市局 异步会死锁
executorMain.execute(() -> {
deal(abilityBatchApplicationDTO, deptDTO, applyFlag, user); deal(abilityBatchApplicationDTO, deptDTO, applyFlag, user);
});
} }
break; break;
default: { default: {
@ -187,7 +193,8 @@ public class AbilityCenterControllerV3 {
// TODO 拆单进行审核 abilityprocess_v3 // TODO 拆单进行审核 abilityprocess_v3
private void deal(TAbilityBatchApplicationDTO abilityBatchApplicationDTO, Optional<SysDeptDTO> deptDTO, String applyFlag, UserDetail user) { private void deal(TAbilityBatchApplicationDTO abilityBatchApplicationDTO, Optional<SysDeptDTO> deptDTO, String applyFlag, UserDetail user) {
SysUserDTO sysUserDTO = sysUserService.get(user.getId()); SysUserDTO sysUserDTO = sysUserService.get(user.getId());
List<String> resourceName = abilityBatchApplicationDTO.getSystem().stream().filter(index -> tAbilityApplicationService.countUserResourceApply(SecurityUser.getUserId(), Long.valueOf(index.get("resourceId"))) > 0) List<String> resourceName = abilityBatchApplicationDTO.getSystem().stream()
.filter(index -> tAbilityApplicationService.countUserResourceApply(SecurityUser.getUserId(), Long.valueOf(index.get("resourceId"))) > 0)
.map(index -> index.get("resourceName")) .map(index -> index.get("resourceName"))
.collect(Collectors.toList()); // 获取已申请的资源名称 .collect(Collectors.toList()); // 获取已申请的资源名称
if (!resourceName.isEmpty()) { if (!resourceName.isEmpty()) {