!1204 BPM:更多设置-自动去重

Merge pull request !1204 from Lesan/feature/bpm-自动去重
This commit is contained in:
芋道源码
2025-01-22 23:59:12 +00:00
committed by Gitee
2 changed files with 6 additions and 17 deletions

View File

@@ -15,10 +15,9 @@ import java.util.Arrays;
@AllArgsConstructor
public enum BpmAutoApproveType implements IntArrayValuable {
// TODO @lesan0、1、/2 会不会好理解一点哈。
NONE(1, "自动通过"),
APPROVE_ALL(2, "审批一次,后续重复的审批节点自动通过"),
APPROVE_SEQUENT(3, "仅针对连续审批的节点自动通过");
NONE(0, "不自动通过"),
APPROVE_ALL(1, "仅审批一次,后续重复的审批节点均自动通过"),
APPROVE_SEQUENT(2, "针对连续审批节点自动通过");
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BpmAutoApproveType::getType).toArray();

View File

@@ -62,8 +62,7 @@ import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionU
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*;
import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*;
import static cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_RETURN_FLAG;
import static cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils.parseReasonRequire;
import static cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils.parseSignEnable;
import static cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils.*;
/**
* 流程任务实例 Service 实现类
@@ -1197,17 +1196,8 @@ public class BpmTaskServiceImpl implements BpmTaskService {
log.error("[processTaskAssigned][taskId({}) 没有找到流程模型({})]", task.getId(), task.getProcessDefinitionId());
return;
}
// TODO @lesan这里的逻辑要不在 BpmnModelUtils 抽个方法???尽量收敛
FlowNode taskElement = (FlowNode) BpmnModelUtils.getFlowElementById(bpmnModel, task.getTaskDefinitionKey());
List<SequenceFlow> incomingFlows = taskElement.getIncomingFlows();
List<String> sourceTaskIds = new ArrayList<>();
// TODO @lesan这种 CollUtil.isnotempty 简化
if (incomingFlows != null && !incomingFlows.isEmpty()) {
// TODO @lesan这种idea 一般会告警,可以处理掉哈。一切警告,皆是错误
incomingFlows.forEach(flow -> {
sourceTaskIds.add(flow.getSourceRef());
});
}
List<String> sourceTaskIds = getElementIncomingFlows(getFlowElementById(bpmnModel, task.getTaskDefinitionKey()))
.stream().map(SequenceFlow::getSourceRef).toList();
if (sameAssigneeQuery.taskDefinitionKeys(sourceTaskIds).count() > 0) {
getSelf().approveTask(Long.valueOf(task.getAssignee()), new BpmTaskApproveReqVO().setId(task.getId())
.setReason(BpmAutoApproveType.APPROVE_SEQUENT.getName()));