异步处理 能力申请
This commit is contained in:
parent
1047569a77
commit
16df18cddf
|
@ -3,6 +3,7 @@ package io.renren.common.controller;
|
|||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import io.renren.common.annotation.LogOperation;
|
||||
import io.renren.common.constant.Constant;
|
||||
import io.renren.common.dto.AuditingBaseDTO;
|
||||
import io.renren.common.page.PageData;
|
||||
import io.renren.common.utils.CodeGenerationUtils;
|
||||
|
@ -53,7 +54,7 @@ import java.util.stream.Collectors;
|
|||
@RestController
|
||||
@RequestMapping("/ability/center/v2")
|
||||
public class AbilityCenterControllerV2 {
|
||||
private static final ExecutorService executor = Executors.newWorkStealingPool();
|
||||
private static final ExecutorService executor = Executors.newCachedThreadPool();
|
||||
private static final Logger logger = LoggerFactory.getLogger(AbilityCenterControllerV2.class);
|
||||
private static final ObjectMapper oMapper = new ObjectMapper();
|
||||
@Autowired
|
||||
|
@ -70,6 +71,9 @@ public class AbilityCenterControllerV2 {
|
|||
@Autowired
|
||||
private SysDeptService sysDeptService;
|
||||
|
||||
@Value("${project.place}")
|
||||
private Integer projectPlace;
|
||||
|
||||
private final CodeGenerationUtils codeGenerationUtils = CodeGenerationUtils.getInstance();
|
||||
|
||||
|
||||
|
@ -108,9 +112,17 @@ public class AbilityCenterControllerV2 {
|
|||
abilityBatchApplicationDTO.setApplyFlag(applyFlag); // 同一次的申请标识
|
||||
final Optional<SysDeptDTO> deptDTO = Optional.ofNullable(sysDeptService.getByName(bigDateDeptName));
|
||||
final UserDetail user = SecurityUser.getUser();
|
||||
executor.execute(() -> {
|
||||
deal(abilityBatchApplicationDTO, deptDTO, applyFlag, user);
|
||||
});
|
||||
switch (Constant.ProjectPlace.getByFlag(projectPlace)) {
|
||||
case TSINGTAO: { // 青岛市局 异步会死锁
|
||||
deal(abilityBatchApplicationDTO, deptDTO, applyFlag, user);
|
||||
}
|
||||
break;
|
||||
default: {
|
||||
executor.execute(() -> {
|
||||
deal(abilityBatchApplicationDTO, deptDTO, applyFlag, user);
|
||||
});
|
||||
}
|
||||
}
|
||||
return new Result().ok(LocalDateTime.now().toString());
|
||||
}
|
||||
|
||||
|
@ -131,7 +143,17 @@ public class AbilityCenterControllerV2 {
|
|||
logger.info("申请入参{}", JSON.toJSONString(abilityBatchApplicationDTO));
|
||||
final Optional<SysDeptDTO> deptDTO = Optional.ofNullable(sysDeptService.getByName(bigDateDeptName));
|
||||
final UserDetail user = SecurityUser.getUser();
|
||||
deal(abilityBatchApplicationDTO, deptDTO, applyFlag, user);
|
||||
switch (Constant.ProjectPlace.getByFlag(projectPlace)) {
|
||||
case TSINGTAO: { // 青岛市局 异步会死锁
|
||||
deal(abilityBatchApplicationDTO, deptDTO, applyFlag, user);
|
||||
}
|
||||
break;
|
||||
default: {
|
||||
executor.execute(() -> {
|
||||
deal(abilityBatchApplicationDTO, deptDTO, applyFlag, user);
|
||||
});
|
||||
}
|
||||
}
|
||||
return new Result().ok(LocalDateTime.now().toString());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue