mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-20 10:13:28 +08:00
fix 修复子流程中设置发起人变量错误问题
This commit is contained in:
parent
9cf9c6a100
commit
472dfc165d
@ -85,15 +85,29 @@ public class WorkflowUtils {
|
|||||||
}
|
}
|
||||||
//解决设计器选择设置流程发起人设置变量有问题
|
//解决设计器选择设置流程发起人设置变量有问题
|
||||||
Collection<FlowElement> flowElements = bpmnModel.getMainProcess().getFlowElements();
|
Collection<FlowElement> flowElements = bpmnModel.getMainProcess().getFlowElements();
|
||||||
for (FlowElement flowElement : flowElements) {
|
repairInitiatorVariable(flowElements);
|
||||||
if (flowElement instanceof UserTask && INITIATOR_SET.equals(((UserTask) flowElement).getAssignee())) {
|
|
||||||
((UserTask) flowElement).setAssignee(INITIATOR_SET_UPDATE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 2.将bpmnModel转为xml
|
// 2.将bpmnModel转为xml
|
||||||
return new BpmnXMLConverter().convertToXML(bpmnModel);
|
return new BpmnXMLConverter().convertToXML(bpmnModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修复发起人节点变量错误问题
|
||||||
|
*
|
||||||
|
* @param flowElements 节点
|
||||||
|
*/
|
||||||
|
private static void repairInitiatorVariable(Collection<FlowElement> flowElements) {
|
||||||
|
for (FlowElement flowElement : flowElements) {
|
||||||
|
if (flowElement instanceof SubProcess) {
|
||||||
|
Collection<FlowElement> subFlowElements = ((SubProcess) flowElement).getFlowElements();
|
||||||
|
repairInitiatorVariable(subFlowElements);
|
||||||
|
} else {
|
||||||
|
if (flowElement instanceof UserTask && INITIATOR_SET.equals(((UserTask) flowElement).getAssignee())) {
|
||||||
|
((UserTask) flowElement).setAssignee(INITIATOR_SET_UPDATE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xml转为bpmnModel
|
* xml转为bpmnModel
|
||||||
*
|
*
|
||||||
@ -153,8 +167,8 @@ public class WorkflowUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
FlowElement targetFlowElement = outgoingFlows.get(0).getTargetFlowElement();
|
FlowElement targetFlowElement = outgoingFlows.get(0).getTargetFlowElement();
|
||||||
if (!(targetFlowElement instanceof UserTask)) {
|
if (!(targetFlowElement instanceof UserTask) && !subtask) {
|
||||||
throw new ServerException(subtask ? "子流程开始节点后第一个节点必须是用户任务!" : "开始节点后第一个节点必须是用户任务!");
|
throw new ServerException("开始节点后第一个节点必须是用户任务!");
|
||||||
}
|
}
|
||||||
|
|
||||||
List<EndEvent> endEventList = flowElements.stream().filter(EndEvent.class::isInstance).map(EndEvent.class::cast).collect(Collectors.toList());
|
List<EndEvent> endEventList = flowElements.stream().filter(EndEvent.class::isInstance).map(EndEvent.class::cast).collect(Collectors.toList());
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user