Merge remote-tracking branch 'origin/feature/bpm' into feature/bpm
# Conflicts: # yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmSimpleModelNodeType.java
This commit is contained in:
commit
1e97ca282b
|
@ -30,6 +30,8 @@ public enum BpmSimpleModelNodeType implements IntArrayValuable {
|
|||
EXCLUSIVE_GATEWAY_NODE(4, "排他网关"), // TODO @jason:是不是改成叫 条件分支?
|
||||
PARALLEL_GATEWAY_FORK_NODE(5, "并行网关分叉节点"), // TODO @jason:是不是一个 并行分支 ?就可以啦?
|
||||
PARALLEL_GATEWAY_JOIN_NODE(6, "并行网关聚合节点"),
|
||||
INCLUSIVE_GATEWAY_FORK_NODE(7, "包容网关分叉节点"),
|
||||
INCLUSIVE_GATEWAY_JOIN_NODE(8, "包容网关聚合节点"),
|
||||
;
|
||||
|
||||
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BpmSimpleModelNodeType::getType).toArray();
|
||||
|
@ -38,9 +40,8 @@ public enum BpmSimpleModelNodeType implements IntArrayValuable {
|
|||
private final String name;
|
||||
|
||||
public static boolean isGatewayNode(Integer type) {
|
||||
// TODO 后续增加并行网关的支持
|
||||
return Objects.equals(EXCLUSIVE_GATEWAY_NODE.getType(), type)
|
||||
|| Objects.equals(PARALLEL_GATEWAY_FORK_NODE.getType(), type);
|
||||
return Objects.equals(EXCLUSIVE_GATEWAY_NODE.getType(), type) || Objects.equals(PARALLEL_GATEWAY_FORK_NODE.getType(), type)
|
||||
|| Objects.equals(INCLUSIVE_GATEWAY_FORK_NODE.getType(), type) ;
|
||||
}
|
||||
|
||||
public static BpmSimpleModelNodeType valueOf(Integer type) {
|
||||
|
|
|
@ -387,14 +387,16 @@ public class BpmnModelUtils {
|
|||
case START_EVENT_NODE:
|
||||
case APPROVE_USER_NODE:
|
||||
case SCRIPT_TASK_NODE:
|
||||
case PARALLEL_GATEWAY_JOIN_NODE:{
|
||||
case PARALLEL_GATEWAY_JOIN_NODE:
|
||||
case INCLUSIVE_GATEWAY_JOIN_NODE:{
|
||||
addBpmnSequenceFlowElement(mainProcess, node.getId(), childNode.getId(), null, null);
|
||||
// 递归调用后续节点
|
||||
addBpmnSequenceFlow(mainProcess, childNode, endId);
|
||||
break;
|
||||
}
|
||||
case PARALLEL_GATEWAY_FORK_NODE:
|
||||
case EXCLUSIVE_GATEWAY_NODE: {
|
||||
case EXCLUSIVE_GATEWAY_NODE:
|
||||
case INCLUSIVE_GATEWAY_FORK_NODE:{
|
||||
String gateWayEndId = (childNode == null || childNode.getId() == null) ? BpmnModelConstants.END_EVENT_ID : childNode.getId();
|
||||
List<BpmSimpleModelNodeVO> conditionNodes = node.getConditionNodes();
|
||||
Assert.notEmpty(conditionNodes, "网关节点的条件节点不能为空");
|
||||
|
@ -456,6 +458,12 @@ public class BpmnModelUtils {
|
|||
case PARALLEL_GATEWAY_JOIN_NODE:
|
||||
addBpmnParallelGatewayNode(mainProcess, simpleModelNode);
|
||||
break;
|
||||
case INCLUSIVE_GATEWAY_FORK_NODE:
|
||||
addBpmnInclusiveGatewayNode(mainProcess, simpleModelNode, Boolean.TRUE);
|
||||
break;
|
||||
case INCLUSIVE_GATEWAY_JOIN_NODE:
|
||||
addBpmnInclusiveGatewayNode(mainProcess, simpleModelNode, Boolean.FALSE);
|
||||
break;
|
||||
default: {
|
||||
// TODO 其它节点类型的实现
|
||||
}
|
||||
|
@ -510,11 +518,22 @@ public class BpmnModelUtils {
|
|||
Assert.notEmpty(node.getConditionNodes(), "网关节点的条件节点不能为空");
|
||||
ExclusiveGateway exclusiveGateway = new ExclusiveGateway();
|
||||
exclusiveGateway.setId(node.getId());
|
||||
// 条件节点的最后一个条件为 网关的 default sequence flow
|
||||
// 网关的最后一个条件为 网关的 default sequence flow
|
||||
exclusiveGateway.setDefaultFlow(String.format("%s_SequenceFlow_%d", node.getId(), node.getConditionNodes().size()));
|
||||
mainProcess.addFlowElement(exclusiveGateway);
|
||||
}
|
||||
|
||||
private static void addBpmnInclusiveGatewayNode(Process mainProcess, BpmSimpleModelNodeVO node, Boolean isFork) {
|
||||
InclusiveGateway inclusiveGateway = new InclusiveGateway();
|
||||
inclusiveGateway.setId(node.getId());
|
||||
if (isFork) {
|
||||
Assert.notEmpty(node.getConditionNodes(), "网关节点的条件节点不能为空");
|
||||
// 网关的最后一个条件为 网关的 default sequence flow
|
||||
inclusiveGateway.setDefaultFlow(String.format("%s_SequenceFlow_%d", node.getId(), node.getConditionNodes().size()));
|
||||
}
|
||||
mainProcess.addFlowElement(inclusiveGateway);
|
||||
}
|
||||
|
||||
private static void addBpmnEndEventNode(Process mainProcess) {
|
||||
EndEvent endEvent = new EndEvent();
|
||||
endEvent.setId(BpmnModelConstants.END_EVENT_ID);
|
||||
|
|
Loading…
Reference in New Issue