【代码评审修改】 条件节点设置修改
This commit is contained in:
parent
1784aab186
commit
96875b1e02
|
@ -101,20 +101,10 @@ public class BpmSimpleModelNodeVO {
|
||||||
@Schema(description = "条件节点")
|
@Schema(description = "条件节点")
|
||||||
private List<BpmSimpleModelNodeVO> conditionNodes; // 补充说明:有且仅有条件、并行、包容分支会使用
|
private List<BpmSimpleModelNodeVO> conditionNodes; // 补充说明:有且仅有条件、并行、包容分支会使用
|
||||||
|
|
||||||
// TODO @jason:conditionType、conditionExpression、defaultFlow、conditionGroups 搞成一个 condition 属性,会好点么?
|
|
||||||
@Schema(description = "条件类型", example = "1")
|
|
||||||
@InEnum(BpmSimpleModeConditionType.class)
|
|
||||||
private Integer conditionType; // 仅用于条件节点 BpmSimpleModelNodeType.CONDITION_NODE
|
|
||||||
|
|
||||||
@Schema(description = "条件表达式", example = "${day>3}")
|
|
||||||
private String conditionExpression; // 仅用于条件节点 BpmSimpleModelNodeType.CONDITION_NODE
|
|
||||||
|
|
||||||
@Schema(description = "是否默认条件", example = "true")
|
|
||||||
private Boolean defaultFlow; // 仅用于条件节点 BpmSimpleModelNodeType.CONDITION_NODE
|
|
||||||
/**
|
/**
|
||||||
* 条件组
|
* 条件节点设置
|
||||||
*/
|
*/
|
||||||
private ConditionGroups conditionGroups; // 仅用于条件节点 BpmSimpleModelNodeType.CONDITION_NODE
|
private ConditionSetting conditionSetting; // 仅用于条件节点 BpmSimpleModelNodeType.CONDITION_NODE
|
||||||
|
|
||||||
@Schema(description = "路由分支组", example = "[]")
|
@Schema(description = "路由分支组", example = "[]")
|
||||||
private List<RouterCondition> routerGroups;
|
private List<RouterCondition> routerGroups;
|
||||||
|
@ -155,9 +145,7 @@ public class BpmSimpleModelNodeVO {
|
||||||
|
|
||||||
@Schema(description = "值", example = "xxx")
|
@Schema(description = "值", example = "xxx")
|
||||||
private String value;
|
private String value;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Schema(description = "审批节点拒绝处理策略")
|
@Schema(description = "审批节点拒绝处理策略")
|
||||||
|
@ -192,7 +180,6 @@ public class BpmSimpleModelNodeVO {
|
||||||
|
|
||||||
@Schema(description = "最大提醒次数", example = "1")
|
@Schema(description = "最大提醒次数", example = "1")
|
||||||
private Integer maxRemindCount;
|
private Integer maxRemindCount;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Schema(description = "空处理策略")
|
@Schema(description = "空处理策略")
|
||||||
|
@ -207,7 +194,6 @@ public class BpmSimpleModelNodeVO {
|
||||||
|
|
||||||
@Schema(description = "指定人员审批的用户编号数组", example = "1")
|
@Schema(description = "指定人员审批的用户编号数组", example = "1")
|
||||||
private List<Long> userIds;
|
private List<Long> userIds;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Schema(description = "操作按钮设置")
|
@Schema(description = "操作按钮设置")
|
||||||
|
@ -226,6 +212,28 @@ public class BpmSimpleModelNodeVO {
|
||||||
private Boolean enable;
|
private Boolean enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Schema(description = "条件设置")
|
||||||
|
@Data
|
||||||
|
@Valid
|
||||||
|
// 仅用于条件节点 BpmSimpleModelNodeType.CONDITION_NODE
|
||||||
|
public static class ConditionSetting {
|
||||||
|
|
||||||
|
@Schema(description = "条件类型", example = "1")
|
||||||
|
@InEnum(BpmSimpleModeConditionType.class)
|
||||||
|
private Integer conditionType;
|
||||||
|
|
||||||
|
@Schema(description = "条件表达式", example = "${day>3}")
|
||||||
|
private String conditionExpression;
|
||||||
|
|
||||||
|
@Schema(description = "是否默认条件", example = "true")
|
||||||
|
private Boolean defaultFlow;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 条件组
|
||||||
|
*/
|
||||||
|
private ConditionGroups conditionGroups;
|
||||||
|
}
|
||||||
|
|
||||||
@Schema(description = "条件组")
|
@Schema(description = "条件组")
|
||||||
@Data
|
@Data
|
||||||
@Valid
|
@Valid
|
||||||
|
@ -270,7 +278,6 @@ public class BpmSimpleModelNodeVO {
|
||||||
@Schema(description = "运算符右边的值", example = "1")
|
@Schema(description = "运算符右边的值", example = "1")
|
||||||
@NotEmpty(message = "运算符右边的值不能为空")
|
@NotEmpty(message = "运算符右边的值不能为空")
|
||||||
private String rightSide;
|
private String rightSide;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Schema(description = "延迟器")
|
@Schema(description = "延迟器")
|
||||||
|
@ -286,7 +293,6 @@ public class BpmSimpleModelNodeVO {
|
||||||
@Schema(description = "延迟时间表达式", example = "PT1H,2025-01-01T00:00:00")
|
@Schema(description = "延迟时间表达式", example = "PT1H,2025-01-01T00:00:00")
|
||||||
@NotEmpty(message = "延迟时间表达式不能为空")
|
@NotEmpty(message = "延迟时间表达式不能为空")
|
||||||
private String delayTime;
|
private String delayTime;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Schema(description = "路由分支")
|
@Schema(description = "路由分支")
|
||||||
|
@ -308,7 +314,5 @@ public class BpmSimpleModelNodeVO {
|
||||||
|
|
||||||
@Schema(description = "条件组", example = "{}")
|
@Schema(description = "条件组", example = "{}")
|
||||||
private ConditionGroups conditionGroups;
|
private ConditionGroups conditionGroups;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -544,7 +544,7 @@ public class SimpleModelUtils {
|
||||||
|
|
||||||
// 设置默认的序列流(条件)
|
// 设置默认的序列流(条件)
|
||||||
BpmSimpleModelNodeVO defaultSeqFlow = CollUtil.findOne(node.getConditionNodes(),
|
BpmSimpleModelNodeVO defaultSeqFlow = CollUtil.findOne(node.getConditionNodes(),
|
||||||
item -> BooleanUtil.isTrue(item.getDefaultFlow()));
|
item -> BooleanUtil.isTrue(item.getConditionSetting().getDefaultFlow()));
|
||||||
Assert.notNull(defaultSeqFlow, "条件分支节点({})的默认序列流不能为空", node.getId());
|
Assert.notNull(defaultSeqFlow, "条件分支节点({})的默认序列流不能为空", node.getId());
|
||||||
exclusiveGateway.setDefaultFlow(defaultSeqFlow.getId());
|
exclusiveGateway.setDefaultFlow(defaultSeqFlow.getId());
|
||||||
return exclusiveGateway;
|
return exclusiveGateway;
|
||||||
|
@ -587,7 +587,7 @@ public class SimpleModelUtils {
|
||||||
inclusiveGateway.setId(node.getId());
|
inclusiveGateway.setId(node.getId());
|
||||||
// 设置默认的序列流(条件)
|
// 设置默认的序列流(条件)
|
||||||
BpmSimpleModelNodeVO defaultSeqFlow = CollUtil.findOne(node.getConditionNodes(),
|
BpmSimpleModelNodeVO defaultSeqFlow = CollUtil.findOne(node.getConditionNodes(),
|
||||||
item -> BooleanUtil.isTrue(item.getDefaultFlow()));
|
item -> BooleanUtil.isTrue(item.getConditionSetting().getDefaultFlow()));
|
||||||
Assert.notNull(defaultSeqFlow, "包容分支节点({})的默认序列流不能为空", node.getId());
|
Assert.notNull(defaultSeqFlow, "包容分支节点({})的默认序列流不能为空", node.getId());
|
||||||
inclusiveGateway.setDefaultFlow(defaultSeqFlow.getId());
|
inclusiveGateway.setDefaultFlow(defaultSeqFlow.getId());
|
||||||
// TODO @jason:setName
|
// TODO @jason:setName
|
||||||
|
@ -631,8 +631,8 @@ public class SimpleModelUtils {
|
||||||
* @param node 条件节点
|
* @param node 条件节点
|
||||||
*/
|
*/
|
||||||
public static String buildConditionExpression(BpmSimpleModelNodeVO node) {
|
public static String buildConditionExpression(BpmSimpleModelNodeVO node) {
|
||||||
return buildConditionExpression(node.getConditionType(), node.getConditionExpression(),
|
return buildConditionExpression(node.getConditionSetting().getConditionType(), node.getConditionSetting().getConditionExpression(),
|
||||||
node.getConditionGroups());
|
node.getConditionSetting().getConditionGroups());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String buildConditionExpression(BpmSimpleModelNodeVO.RouterCondition router) {
|
public static String buildConditionExpression(BpmSimpleModelNodeVO.RouterCondition router) {
|
||||||
|
@ -771,11 +771,11 @@ public class SimpleModelUtils {
|
||||||
if (nodeType == BpmSimpleModelNodeType.CONDITION_BRANCH_NODE) {
|
if (nodeType == BpmSimpleModelNodeType.CONDITION_BRANCH_NODE) {
|
||||||
// 查找满足条件的 BpmSimpleModelNodeVO 节点
|
// 查找满足条件的 BpmSimpleModelNodeVO 节点
|
||||||
BpmSimpleModelNodeVO matchConditionNode = CollUtil.findOne(currentNode.getConditionNodes(),
|
BpmSimpleModelNodeVO matchConditionNode = CollUtil.findOne(currentNode.getConditionNodes(),
|
||||||
conditionNode -> !BooleanUtil.isTrue(conditionNode.getDefaultFlow())
|
conditionNode -> !BooleanUtil.isTrue(conditionNode.getConditionSetting().getDefaultFlow())
|
||||||
&& evalConditionExpress(variables, conditionNode));
|
&& evalConditionExpress(variables, conditionNode));
|
||||||
if (matchConditionNode == null) {
|
if (matchConditionNode == null) {
|
||||||
matchConditionNode = CollUtil.findOne(currentNode.getConditionNodes(),
|
matchConditionNode = CollUtil.findOne(currentNode.getConditionNodes(),
|
||||||
conditionNode -> BooleanUtil.isTrue(conditionNode.getDefaultFlow()));
|
conditionNode -> BooleanUtil.isTrue(conditionNode.getConditionSetting().getDefaultFlow()));
|
||||||
}
|
}
|
||||||
Assert.notNull(matchConditionNode, "找不到条件节点({})", currentNode);
|
Assert.notNull(matchConditionNode, "找不到条件节点({})", currentNode);
|
||||||
// 遍历满足条件的 BpmSimpleModelNodeVO 节点
|
// 遍历满足条件的 BpmSimpleModelNodeVO 节点
|
||||||
|
@ -786,11 +786,11 @@ public class SimpleModelUtils {
|
||||||
if (nodeType == BpmSimpleModelNodeType.INCLUSIVE_BRANCH_NODE) {
|
if (nodeType == BpmSimpleModelNodeType.INCLUSIVE_BRANCH_NODE) {
|
||||||
// 查找满足条件的 BpmSimpleModelNodeVO 节点
|
// 查找满足条件的 BpmSimpleModelNodeVO 节点
|
||||||
Collection<BpmSimpleModelNodeVO> matchConditionNodes = CollUtil.filterNew(currentNode.getConditionNodes(),
|
Collection<BpmSimpleModelNodeVO> matchConditionNodes = CollUtil.filterNew(currentNode.getConditionNodes(),
|
||||||
conditionNode -> !BooleanUtil.isTrue(conditionNode.getDefaultFlow())
|
conditionNode -> !BooleanUtil.isTrue(conditionNode.getConditionSetting().getDefaultFlow())
|
||||||
&& evalConditionExpress(variables, conditionNode));
|
&& evalConditionExpress(variables, conditionNode));
|
||||||
if (CollUtil.isEmpty(matchConditionNodes)) {
|
if (CollUtil.isEmpty(matchConditionNodes)) {
|
||||||
matchConditionNodes = CollUtil.filterNew(currentNode.getConditionNodes(),
|
matchConditionNodes = CollUtil.filterNew(currentNode.getConditionNodes(),
|
||||||
conditionNode -> BooleanUtil.isTrue(conditionNode.getDefaultFlow()));
|
conditionNode -> BooleanUtil.isTrue(conditionNode.getConditionSetting().getDefaultFlow()));
|
||||||
}
|
}
|
||||||
Assert.isTrue(!matchConditionNodes.isEmpty(), "找不到条件节点({})", currentNode);
|
Assert.isTrue(!matchConditionNodes.isEmpty(), "找不到条件节点({})", currentNode);
|
||||||
// 遍历满足条件的 BpmSimpleModelNodeVO 节点
|
// 遍历满足条件的 BpmSimpleModelNodeVO 节点
|
||||||
|
|
Loading…
Reference in New Issue