!1204 BPM:更多设置-自动去重
Merge pull request !1204 from Lesan/feature/bpm-自动去重
This commit is contained in:
commit
808f23ec49
|
@ -15,10 +15,9 @@ import java.util.Arrays;
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public enum BpmAutoApproveType implements IntArrayValuable {
|
public enum BpmAutoApproveType implements IntArrayValuable {
|
||||||
|
|
||||||
// TODO @lesan:0、1、/2 会不会好理解一点哈。
|
NONE(0, "不自动通过"),
|
||||||
NONE(1, "不自动通过"),
|
APPROVE_ALL(1, "仅审批一次,后续重复的审批节点均自动通过"),
|
||||||
APPROVE_ALL(2, "仅审批一次,后续重复的审批节点均自动通过"),
|
APPROVE_SEQUENT(2, "仅针对连续审批的节点自动通过");
|
||||||
APPROVE_SEQUENT(3, "仅针对连续审批的节点自动通过");
|
|
||||||
|
|
||||||
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BpmAutoApproveType::getType).toArray();
|
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BpmAutoApproveType::getType).toArray();
|
||||||
|
|
||||||
|
|
|
@ -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.framework.common.util.collection.CollectionUtils.*;
|
||||||
import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*;
|
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.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.*;
|
||||||
import static cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils.parseSignEnable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 流程任务实例 Service 实现类
|
* 流程任务实例 Service 实现类
|
||||||
|
@ -1197,17 +1196,8 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
||||||
log.error("[processTaskAssigned][taskId({}) 没有找到流程模型({})]", task.getId(), task.getProcessDefinitionId());
|
log.error("[processTaskAssigned][taskId({}) 没有找到流程模型({})]", task.getId(), task.getProcessDefinitionId());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// TODO @lesan:这里的逻辑,要不在 BpmnModelUtils 抽个方法???尽量收敛
|
List<String> sourceTaskIds = getElementIncomingFlows(getFlowElementById(bpmnModel, task.getTaskDefinitionKey()))
|
||||||
FlowNode taskElement = (FlowNode) BpmnModelUtils.getFlowElementById(bpmnModel, task.getTaskDefinitionKey());
|
.stream().map(SequenceFlow::getSourceRef).toList();
|
||||||
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());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (sameAssigneeQuery.taskDefinitionKeys(sourceTaskIds).count() > 0) {
|
if (sameAssigneeQuery.taskDefinitionKeys(sourceTaskIds).count() > 0) {
|
||||||
getSelf().approveTask(Long.valueOf(task.getAssignee()), new BpmTaskApproveReqVO().setId(task.getId())
|
getSelf().approveTask(Long.valueOf(task.getAssignee()), new BpmTaskApproveReqVO().setId(task.getId())
|
||||||
.setReason(BpmAutoApproveType.APPROVE_SEQUENT.getName()));
|
.setReason(BpmAutoApproveType.APPROVE_SEQUENT.getName()));
|
||||||
|
|
Loading…
Reference in New Issue