Commit 96875b1e022f03e9857f4027fd49c0785a45bfca
1 parent
1784aab1
【代码评审修改】 条件节点设置修改
Showing
2 changed files
with
32 additions
and
28 deletions
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/simple/BpmSimpleModelNodeVO.java
| ... | ... | @@ -101,20 +101,10 @@ public class BpmSimpleModelNodeVO { |
| 101 | 101 | @Schema(description = "条件节点") |
| 102 | 102 | private List<BpmSimpleModelNodeVO> conditionNodes; // 补充说明:有且仅有条件、并行、包容分支会使用 |
| 103 | 103 | |
| 104 | - // TODO @jason:conditionType、conditionExpression、defaultFlow、conditionGroups 搞成一个 condition 属性,会好点么? | |
| 105 | - @Schema(description = "条件类型", example = "1") | |
| 106 | - @InEnum(BpmSimpleModeConditionType.class) | |
| 107 | - private Integer conditionType; // 仅用于条件节点 BpmSimpleModelNodeType.CONDITION_NODE | |
| 108 | - | |
| 109 | - @Schema(description = "条件表达式", example = "${day>3}") | |
| 110 | - private String conditionExpression; // 仅用于条件节点 BpmSimpleModelNodeType.CONDITION_NODE | |
| 111 | - | |
| 112 | - @Schema(description = "是否默认条件", example = "true") | |
| 113 | - private Boolean defaultFlow; // 仅用于条件节点 BpmSimpleModelNodeType.CONDITION_NODE | |
| 114 | 104 | /** |
| 115 | - * 条件组 | |
| 105 | + * 条件节点设置 | |
| 116 | 106 | */ |
| 117 | - private ConditionGroups conditionGroups; // 仅用于条件节点 BpmSimpleModelNodeType.CONDITION_NODE | |
| 107 | + private ConditionSetting conditionSetting; // 仅用于条件节点 BpmSimpleModelNodeType.CONDITION_NODE | |
| 118 | 108 | |
| 119 | 109 | @Schema(description = "路由分支组", example = "[]") |
| 120 | 110 | private List<RouterCondition> routerGroups; |
| ... | ... | @@ -155,9 +145,7 @@ public class BpmSimpleModelNodeVO { |
| 155 | 145 | |
| 156 | 146 | @Schema(description = "值", example = "xxx") |
| 157 | 147 | private String value; |
| 158 | - | |
| 159 | 148 | } |
| 160 | - | |
| 161 | 149 | } |
| 162 | 150 | |
| 163 | 151 | @Schema(description = "审批节点拒绝处理策略") |
| ... | ... | @@ -192,7 +180,6 @@ public class BpmSimpleModelNodeVO { |
| 192 | 180 | |
| 193 | 181 | @Schema(description = "最大提醒次数", example = "1") |
| 194 | 182 | private Integer maxRemindCount; |
| 195 | - | |
| 196 | 183 | } |
| 197 | 184 | |
| 198 | 185 | @Schema(description = "空处理策略") |
| ... | ... | @@ -207,7 +194,6 @@ public class BpmSimpleModelNodeVO { |
| 207 | 194 | |
| 208 | 195 | @Schema(description = "指定人员审批的用户编号数组", example = "1") |
| 209 | 196 | private List<Long> userIds; |
| 210 | - | |
| 211 | 197 | } |
| 212 | 198 | |
| 213 | 199 | @Schema(description = "操作按钮设置") |
| ... | ... | @@ -226,6 +212,28 @@ public class BpmSimpleModelNodeVO { |
| 226 | 212 | private Boolean enable; |
| 227 | 213 | } |
| 228 | 214 | |
| 215 | + @Schema(description = "条件设置") | |
| 216 | + @Data | |
| 217 | + @Valid | |
| 218 | + // 仅用于条件节点 BpmSimpleModelNodeType.CONDITION_NODE | |
| 219 | + public static class ConditionSetting { | |
| 220 | + | |
| 221 | + @Schema(description = "条件类型", example = "1") | |
| 222 | + @InEnum(BpmSimpleModeConditionType.class) | |
| 223 | + private Integer conditionType; | |
| 224 | + | |
| 225 | + @Schema(description = "条件表达式", example = "${day>3}") | |
| 226 | + private String conditionExpression; | |
| 227 | + | |
| 228 | + @Schema(description = "是否默认条件", example = "true") | |
| 229 | + private Boolean defaultFlow; | |
| 230 | + | |
| 231 | + /** | |
| 232 | + * 条件组 | |
| 233 | + */ | |
| 234 | + private ConditionGroups conditionGroups; | |
| 235 | + } | |
| 236 | + | |
| 229 | 237 | @Schema(description = "条件组") |
| 230 | 238 | @Data |
| 231 | 239 | @Valid |
| ... | ... | @@ -270,7 +278,6 @@ public class BpmSimpleModelNodeVO { |
| 270 | 278 | @Schema(description = "运算符右边的值", example = "1") |
| 271 | 279 | @NotEmpty(message = "运算符右边的值不能为空") |
| 272 | 280 | private String rightSide; |
| 273 | - | |
| 274 | 281 | } |
| 275 | 282 | |
| 276 | 283 | @Schema(description = "延迟器") |
| ... | ... | @@ -286,7 +293,6 @@ public class BpmSimpleModelNodeVO { |
| 286 | 293 | @Schema(description = "延迟时间表达式", example = "PT1H,2025-01-01T00:00:00") |
| 287 | 294 | @NotEmpty(message = "延迟时间表达式不能为空") |
| 288 | 295 | private String delayTime; |
| 289 | - | |
| 290 | 296 | } |
| 291 | 297 | |
| 292 | 298 | @Schema(description = "路由分支") |
| ... | ... | @@ -308,7 +314,5 @@ public class BpmSimpleModelNodeVO { |
| 308 | 314 | |
| 309 | 315 | @Schema(description = "条件组", example = "{}") |
| 310 | 316 | private ConditionGroups conditionGroups; |
| 311 | - | |
| 312 | 317 | } |
| 313 | - | |
| 314 | 318 | } | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/SimpleModelUtils.java
| ... | ... | @@ -544,7 +544,7 @@ public class SimpleModelUtils { |
| 544 | 544 | |
| 545 | 545 | // 设置默认的序列流(条件) |
| 546 | 546 | BpmSimpleModelNodeVO defaultSeqFlow = CollUtil.findOne(node.getConditionNodes(), |
| 547 | - item -> BooleanUtil.isTrue(item.getDefaultFlow())); | |
| 547 | + item -> BooleanUtil.isTrue(item.getConditionSetting().getDefaultFlow())); | |
| 548 | 548 | Assert.notNull(defaultSeqFlow, "条件分支节点({})的默认序列流不能为空", node.getId()); |
| 549 | 549 | exclusiveGateway.setDefaultFlow(defaultSeqFlow.getId()); |
| 550 | 550 | return exclusiveGateway; |
| ... | ... | @@ -587,7 +587,7 @@ public class SimpleModelUtils { |
| 587 | 587 | inclusiveGateway.setId(node.getId()); |
| 588 | 588 | // 设置默认的序列流(条件) |
| 589 | 589 | BpmSimpleModelNodeVO defaultSeqFlow = CollUtil.findOne(node.getConditionNodes(), |
| 590 | - item -> BooleanUtil.isTrue(item.getDefaultFlow())); | |
| 590 | + item -> BooleanUtil.isTrue(item.getConditionSetting().getDefaultFlow())); | |
| 591 | 591 | Assert.notNull(defaultSeqFlow, "包容分支节点({})的默认序列流不能为空", node.getId()); |
| 592 | 592 | inclusiveGateway.setDefaultFlow(defaultSeqFlow.getId()); |
| 593 | 593 | // TODO @jason:setName |
| ... | ... | @@ -631,8 +631,8 @@ public class SimpleModelUtils { |
| 631 | 631 | * @param node 条件节点 |
| 632 | 632 | */ |
| 633 | 633 | public static String buildConditionExpression(BpmSimpleModelNodeVO node) { |
| 634 | - return buildConditionExpression(node.getConditionType(), node.getConditionExpression(), | |
| 635 | - node.getConditionGroups()); | |
| 634 | + return buildConditionExpression(node.getConditionSetting().getConditionType(), node.getConditionSetting().getConditionExpression(), | |
| 635 | + node.getConditionSetting().getConditionGroups()); | |
| 636 | 636 | } |
| 637 | 637 | |
| 638 | 638 | public static String buildConditionExpression(BpmSimpleModelNodeVO.RouterCondition router) { |
| ... | ... | @@ -771,11 +771,11 @@ public class SimpleModelUtils { |
| 771 | 771 | if (nodeType == BpmSimpleModelNodeType.CONDITION_BRANCH_NODE) { |
| 772 | 772 | // 查找满足条件的 BpmSimpleModelNodeVO 节点 |
| 773 | 773 | BpmSimpleModelNodeVO matchConditionNode = CollUtil.findOne(currentNode.getConditionNodes(), |
| 774 | - conditionNode -> !BooleanUtil.isTrue(conditionNode.getDefaultFlow()) | |
| 774 | + conditionNode -> !BooleanUtil.isTrue(conditionNode.getConditionSetting().getDefaultFlow()) | |
| 775 | 775 | && evalConditionExpress(variables, conditionNode)); |
| 776 | 776 | if (matchConditionNode == null) { |
| 777 | 777 | matchConditionNode = CollUtil.findOne(currentNode.getConditionNodes(), |
| 778 | - conditionNode -> BooleanUtil.isTrue(conditionNode.getDefaultFlow())); | |
| 778 | + conditionNode -> BooleanUtil.isTrue(conditionNode.getConditionSetting().getDefaultFlow())); | |
| 779 | 779 | } |
| 780 | 780 | Assert.notNull(matchConditionNode, "找不到条件节点({})", currentNode); |
| 781 | 781 | // 遍历满足条件的 BpmSimpleModelNodeVO 节点 |
| ... | ... | @@ -786,11 +786,11 @@ public class SimpleModelUtils { |
| 786 | 786 | if (nodeType == BpmSimpleModelNodeType.INCLUSIVE_BRANCH_NODE) { |
| 787 | 787 | // 查找满足条件的 BpmSimpleModelNodeVO 节点 |
| 788 | 788 | Collection<BpmSimpleModelNodeVO> matchConditionNodes = CollUtil.filterNew(currentNode.getConditionNodes(), |
| 789 | - conditionNode -> !BooleanUtil.isTrue(conditionNode.getDefaultFlow()) | |
| 789 | + conditionNode -> !BooleanUtil.isTrue(conditionNode.getConditionSetting().getDefaultFlow()) | |
| 790 | 790 | && evalConditionExpress(variables, conditionNode)); |
| 791 | 791 | if (CollUtil.isEmpty(matchConditionNodes)) { |
| 792 | 792 | matchConditionNodes = CollUtil.filterNew(currentNode.getConditionNodes(), |
| 793 | - conditionNode -> BooleanUtil.isTrue(conditionNode.getDefaultFlow())); | |
| 793 | + conditionNode -> BooleanUtil.isTrue(conditionNode.getConditionSetting().getDefaultFlow())); | |
| 794 | 794 | } |
| 795 | 795 | Assert.isTrue(!matchConditionNodes.isEmpty(), "找不到条件节点({})", currentNode); |
| 796 | 796 | // 遍历满足条件的 BpmSimpleModelNodeVO 节点 | ... | ... |