fix: 检查所有route->router

This commit is contained in:
Lesan 2025-01-09 09:17:49 +08:00
parent fcbf1d0765
commit 37cb20d964
3 changed files with 17 additions and 17 deletions

View File

@ -33,7 +33,7 @@ public enum BpmSimpleModelNodeType implements IntArrayValuable {
CONDITION_BRANCH_NODE(51, "条件分支", "exclusiveGateway"),
PARALLEL_BRANCH_NODE(52, "并行分支", "parallelGateway"),
INCLUSIVE_BRANCH_NODE(53, "包容分支", "inclusiveGateway"),
ROUTE_BRANCH_NODE(54, "路由分支", "exclusiveGateway")
ROUTER_BRANCH_NODE(54, "路由分支", "exclusiveGateway")
;
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BpmSimpleModelNodeType::getType).toArray();
@ -51,7 +51,7 @@ public enum BpmSimpleModelNodeType implements IntArrayValuable {
return Objects.equals(CONDITION_BRANCH_NODE.getType(), type)
|| Objects.equals(PARALLEL_BRANCH_NODE.getType(), type)
|| Objects.equals(INCLUSIVE_BRANCH_NODE.getType(), type)
|| Objects.equals(ROUTE_BRANCH_NODE.getType(), type);
|| Objects.equals(ROUTER_BRANCH_NODE.getType(), type);
}
public static BpmSimpleModelNodeType valueOf(Integer type) {

View File

@ -117,10 +117,10 @@ public class BpmSimpleModelNodeVO {
private ConditionGroups conditionGroups; // 仅用于条件节点 BpmSimpleModelNodeType.CONDITION_NODE
@Schema(description = "路由分支组", example = "[]")
private List<RouteCondition> routerGroups;
private List<RouterCondition> routerGroups;
@Schema(description = "默认分支 ID", example = "Flow_xxx")
private String defaultFlowId; // 仅用于路由分支节点 BpmSimpleModelNodeType.ROUTE_BRANCH_NODE
private String defaultFlowId; // 仅用于路由分支节点 BpmSimpleModelNodeType.ROUTER_BRANCH_NODE
@Schema(description = "任务监听器")
@Valid
@ -293,7 +293,7 @@ public class BpmSimpleModelNodeVO {
@Schema(description = "路由分支")
@Data
@Valid
public static class RouteCondition {
public static class RouterCondition {
@Schema(description = "节点 Id", example = "Activity_xxx") // 跳转到该节点
@NotEmpty(message = "节点 Id 不能为空")

View File

@ -188,7 +188,7 @@ public class SimpleModelUtils {
// 分支终点节点 ID
String branchEndNodeId = null;
if (nodeType == BpmSimpleModelNodeType.CONDITION_BRANCH_NODE
|| nodeType == BpmSimpleModelNodeType.ROUTE_BRANCH_NODE) { // 条件分支或路由分支
|| nodeType == BpmSimpleModelNodeType.ROUTER_BRANCH_NODE) { // 条件分支或路由分支
// 分两种情况 1. 分支节点有孩子节点为孩子节点 Id 2. 分支节点孩子为无效节点时 (分支嵌套且为分支最后一个节点) 为分支终点节点 ID
branchEndNodeId = isValidNode(childNode) ? childNode.getId() : targetNodeId;
} else if (nodeType == BpmSimpleModelNodeType.PARALLEL_BRANCH_NODE
@ -199,10 +199,10 @@ public class SimpleModelUtils {
Assert.notEmpty(branchEndNodeId, "分支终点节点 Id 不能为空");
// 3. 遍历分支节点
if (nodeType == BpmSimpleModelNodeType.ROUTE_BRANCH_NODE) {
if (nodeType == BpmSimpleModelNodeType.ROUTER_BRANCH_NODE) {
// 路由分支遍历
for (BpmSimpleModelNodeVO.RouteCondition route : node.getRouterGroups()) {
SequenceFlow sequenceFlow = RouteBranchNodeConvert.buildSequenceFlow(node.getId(), route);
for (BpmSimpleModelNodeVO.RouterCondition router : node.getRouterGroups()) {
SequenceFlow sequenceFlow = RouteBranchNodeConvert.buildSequenceFlow(node.getId(), router);
process.addFlowElement(sequenceFlow);
}
} else {
@ -233,7 +233,7 @@ public class SimpleModelUtils {
SequenceFlow sequenceFlow = buildBpmnSequenceFlow(branchEndNodeId, nextNodeId);
process.addFlowElement(sequenceFlow);
// 4.2 如果是路由分支需要连接后续节点为默认路由
} else if (nodeType == BpmSimpleModelNodeType.ROUTE_BRANCH_NODE) {
} else if (nodeType == BpmSimpleModelNodeType.ROUTER_BRANCH_NODE) {
SequenceFlow sequenceFlow = buildBpmnSequenceFlow(node.getId(), branchEndNodeId, node.getDefaultFlowId(),
null, null);
process.addFlowElement(sequenceFlow);
@ -646,9 +646,9 @@ public class SimpleModelUtils {
node.getConditionGroups());
}
public static String buildConditionExpression(BpmSimpleModelNodeVO.RouteCondition route) {
return buildConditionExpression(route.getConditionType(), route.getConditionExpression(),
route.getConditionGroups());
public static String buildConditionExpression(BpmSimpleModelNodeVO.RouterCondition router) {
return buildConditionExpression(router.getConditionType(), router.getConditionExpression(),
router.getConditionGroups());
}
public static String buildConditionExpression(Integer conditionType, String conditionExpression,
@ -735,12 +735,12 @@ public class SimpleModelUtils {
@Override
public BpmSimpleModelNodeType getType() {
return BpmSimpleModelNodeType.ROUTE_BRANCH_NODE;
return BpmSimpleModelNodeType.ROUTER_BRANCH_NODE;
}
public static SequenceFlow buildSequenceFlow(String nodeId, BpmSimpleModelNodeVO.RouteCondition route) {
String conditionExpression = ConditionNodeConvert.buildConditionExpression(route);
return buildBpmnSequenceFlow(nodeId, route.getNodeId(), null, null, conditionExpression);
public static SequenceFlow buildSequenceFlow(String nodeId, BpmSimpleModelNodeVO.RouterCondition router) {
String conditionExpression = ConditionNodeConvert.buildConditionExpression(router);
return buildBpmnSequenceFlow(nodeId, router.getNodeId(), null, null, conditionExpression);
}
}