From 0aede1e9107d2e9c26909665a97bc69430828479 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Fri, 16 Dec 2022 10:02:21 +0800 Subject: [PATCH] =?UTF-8?q?=E8=83=BD=E5=8A=9B=E7=94=B3=E8=AF=B7=E5=B8=82?= =?UTF-8?q?=E5=B1=80=E4=BD=BF=E7=94=A8=E7=BC=93=E5=AD=98=E7=BA=BF=E7=A8=8B?= =?UTF-8?q?=E6=B1=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/AbilityCenterControllerV3.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterControllerV3.java b/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterControllerV3.java index 84fbdac2..37954778 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterControllerV3.java +++ b/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterControllerV3.java @@ -64,6 +64,8 @@ public class AbilityCenterControllerV3 { private static final ExecutorService executor = Executors.newWorkStealingPool(CPUNUM * 2); + private static final ExecutorService executorMain = Executors.newCachedThreadPool(); + private static final ObjectMapper oMapper = new ObjectMapper(); @Value("${project.place}") @@ -129,8 +131,10 @@ public class AbilityCenterControllerV3 { final Optional deptDTO = Optional.ofNullable(sysDeptService.getByName(bigDateDeptName)); final UserDetail user = SecurityUser.getUser(); switch (Constant.ProjectPlace.getByFlag(projectPlace)) { - case TSINGTAO: { // 青岛市局 异步会死锁 - deal(abilityBatchApplicationDTO, deptDTO, applyFlag, user); + case TSINGTAO: { // 青岛市局 异步会死锁 使用缓存线程池 + executorMain.execute(() -> { + deal(abilityBatchApplicationDTO, deptDTO, applyFlag, user); + }); } break; default: { @@ -165,7 +169,9 @@ public class AbilityCenterControllerV3 { final UserDetail user = SecurityUser.getUser(); switch (Constant.ProjectPlace.getByFlag(projectPlace)) { case TSINGTAO: { // 青岛市局 异步会死锁 - deal(abilityBatchApplicationDTO, deptDTO, applyFlag, user); + executorMain.execute(() -> { + deal(abilityBatchApplicationDTO, deptDTO, applyFlag, user); + }); } break; default: { @@ -187,7 +193,8 @@ public class AbilityCenterControllerV3 { // TODO 拆单进行审核 abilityprocess_v3 private void deal(TAbilityBatchApplicationDTO abilityBatchApplicationDTO, Optional deptDTO, String applyFlag, UserDetail user) { SysUserDTO sysUserDTO = sysUserService.get(user.getId()); - List resourceName = abilityBatchApplicationDTO.getSystem().stream().filter(index -> tAbilityApplicationService.countUserResourceApply(SecurityUser.getUserId(), Long.valueOf(index.get("resourceId"))) > 0) + List resourceName = abilityBatchApplicationDTO.getSystem().stream() + .filter(index -> tAbilityApplicationService.countUserResourceApply(SecurityUser.getUserId(), Long.valueOf(index.get("resourceId"))) > 0) .map(index -> index.get("resourceName")) .collect(Collectors.toList()); // 获取已申请的资源名称 if (!resourceName.isEmpty()) {