【代码评审】BPM:优化流程发起预测节点审批人是否配置在后端逻辑中实现
This commit is contained in:
parent
b496ec3fd0
commit
24f1ce16c7
|
@ -6,7 +6,6 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
|
||||
import cn.iocoder.yudao.framework.common.util.number.NumberUtils;
|
||||
import cn.iocoder.yudao.framework.common.util.string.StrUtils;
|
||||
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.*;
|
||||
import cn.iocoder.yudao.module.bpm.convert.task.BpmProcessInstanceConvert;
|
||||
import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmCategoryDO;
|
||||
|
@ -165,6 +164,7 @@ public class BpmProcessInstanceController {
|
|||
@Operation(summary = "获得审批详情")
|
||||
@Parameter(name = "id", description = "流程实例的编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('bpm:process-instance:query')")
|
||||
@SuppressWarnings("unchecked")
|
||||
public CommonResult<BpmApprovalDetailRespVO> getApprovalDetail(@Valid BpmApprovalDetailReqVO reqVO) {
|
||||
if (StrUtil.isNotEmpty(reqVO.getProcessVariablesStr())) {
|
||||
reqVO.setProcessVariables(JsonUtils.parseObject(reqVO.getProcessVariablesStr(), Map.class));
|
||||
|
|
|
@ -857,9 +857,12 @@ public class BpmnModelUtils {
|
|||
if (express == null) {
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
// 如果 variables 为空,则创建一个的原因?可能 expression 的计算,不依赖于 variables
|
||||
if (variables == null) {
|
||||
return Boolean.FALSE;
|
||||
variables = new HashMap<>();
|
||||
}
|
||||
|
||||
// 执行计算
|
||||
try {
|
||||
Object result = FlowableUtils.getExpressionValue(variables, express);
|
||||
return Boolean.TRUE.equals(result);
|
||||
|
|
|
@ -696,7 +696,8 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
|
|||
}
|
||||
|
||||
private void validateStartUserSelectAssignees(Long userId, ProcessDefinition definition,
|
||||
Map<String, List<Long>> startUserSelectAssignees, Map<String,Object> variables) {
|
||||
Map<String, List<Long>> startUserSelectAssignees,
|
||||
Map<String,Object> variables) {
|
||||
// 1. 获取预测的节点信息
|
||||
BpmApprovalDetailRespVO detailRespVO = getApprovalDetail(userId, new BpmApprovalDetailReqVO()
|
||||
.setProcessDefinitionId(definition.getId())
|
||||
|
@ -705,9 +706,11 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
|
|||
if (CollUtil.isEmpty(activityNodes)){
|
||||
return;
|
||||
}
|
||||
// 2.移除掉不是发起人自选审批人节点
|
||||
activityNodes.removeIf(task -> !Objects.equals(BpmTaskCandidateStrategyEnum.START_USER_SELECT.getStrategy(), task.getCandidateStrategy()));
|
||||
// 3.流程发起时要先获取当前流程的预测走向节点,发起时只校验预测的节点发起人自选审批人的审批人和抄送人是否都配置了
|
||||
|
||||
// 2.1 移除掉不是发起人自选审批人节点
|
||||
activityNodes.removeIf(task ->
|
||||
ObjectUtil.notEqual(BpmTaskCandidateStrategyEnum.START_USER_SELECT.getStrategy(), task.getCandidateStrategy()));
|
||||
// 2.2 流程发起时要先获取当前流程的预测走向节点,发起时只校验预测的节点发起人自选审批人的审批人和抄送人是否都配置了
|
||||
activityNodes.forEach(task -> {
|
||||
List<Long> assignees = startUserSelectAssignees != null ? startUserSelectAssignees.get(task.getId()) : null;
|
||||
if (CollUtil.isEmpty(assignees)) {
|
||||
|
|
Loading…
Reference in New Issue