Commit c87bea5a7275779007f2959a247d6d6353414d99
1 parent
d9a2849c
【代码评审】BPM:review simple 字段、seq 连线
Showing
3 changed files
with
7 additions
and
64 deletions
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/simple/BpmSimpleModelNodeVO.java
| ... | ... | @@ -29,6 +29,7 @@ public class BpmSimpleModelNodeVO { |
| 29 | 29 | private String name; |
| 30 | 30 | |
| 31 | 31 | // TODO @jason:要不改成 placeholder 和一般 Element-Plus 组件一致。占位符,用于展示。@芋艿。这个不是 placeholder 占位符的含义。节点配置后。节点展示的内容,不知道取什么名字好??? |
| 32 | + // TODO @jason:【回复】占位文本(showText)是指当一个文本框没有被 focus 的时候显示的是提示文字,当他被点击之后就显示空白。。。虽然不是完全精准,但是 placeholder 相对正式点~ | |
| 32 | 33 | @Schema(description = "节点展示内容", example = "指定成员: 芋道源码") |
| 33 | 34 | private String showText; |
| 34 | 35 | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/SimpleModelUtils.java
| ... | ... | @@ -95,27 +95,21 @@ public class SimpleModelUtils { |
| 95 | 95 | return bpmnModel; |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | + // TODO @芋艿:在优化下这个注释 | |
| 98 | 99 | private static void traverseNodeToBuildSequenceFlow(Process process, BpmSimpleModelNodeVO node, String targetNodeId) { |
| 99 | - // 1.无效节点返回 | |
| 100 | + // 1.1 无效节点返回 | |
| 100 | 101 | if (!isValidNode(node)) { |
| 101 | 102 | return; |
| 102 | 103 | } |
| 103 | - | |
| 104 | - // 如果是网关分支节点. 后续节点可能为 null。但不是 END_EVENT 节点 | |
| 105 | - // TODO-DONE @芋艿:这个要不要挪到 START_NODE - INCLUSIVE_BRANCH_JOIN_NODE 待定;感觉 switch 那最终是分三个情况;branch、子节点、结束了;(每种情况的注释,需要写的更完整) | |
| 106 | -// if (!BpmSimpleModelNodeType.isBranchNode(node.getType()) && (childNode == null || childNode.getId() == null)) { | |
| 107 | -// SequenceFlow sequenceFlow = buildBpmnSequenceFlow(node.getId(), targetNodeId, null, null, null); | |
| 108 | -// process.addFlowElement(sequenceFlow); | |
| 109 | -// return; | |
| 110 | -// } | |
| 104 | + // 1.2 END_NODE 直接返回 | |
| 111 | 105 | BpmSimpleModelNodeType nodeType = BpmSimpleModelNodeType.valueOf(node.getType()); |
| 112 | 106 | Assert.notNull(nodeType, "模型节点类型不支持"); |
| 113 | - | |
| 114 | 107 | if (nodeType == END_NODE) { |
| 115 | 108 | return; |
| 116 | 109 | } |
| 110 | + | |
| 111 | + // 2.1 情况一:普通节点 | |
| 117 | 112 | BpmSimpleModelNodeVO childNode = node.getChildNode(); |
| 118 | - // 2.1 普通节点 | |
| 119 | 113 | if (!BpmSimpleModelNodeType.isBranchNode(node.getType())) { |
| 120 | 114 | if (!isValidNode(childNode)) { |
| 121 | 115 | // 2.1.1 普通节点且无孩子节点。分两种情况 |
| ... | ... | @@ -130,7 +124,7 @@ public class SimpleModelUtils { |
| 130 | 124 | traverseNodeToBuildSequenceFlow(process, childNode, targetNodeId); |
| 131 | 125 | } |
| 132 | 126 | } else { |
| 133 | - // 2.2 分支节点 | |
| 127 | + // 2.2 情况二:分支节点 | |
| 134 | 128 | List<BpmSimpleModelNodeVO> conditionNodes = node.getConditionNodes(); |
| 135 | 129 | Assert.notEmpty(conditionNodes, "分支节点的条件节点不能为空"); |
| 136 | 130 | // 分支终点节点 Id |
| ... | ... | @@ -177,57 +171,6 @@ public class SimpleModelUtils { |
| 177 | 171 | // 4.递归调用后续节点 继续递归建立 D->E 的连线 |
| 178 | 172 | traverseNodeToBuildSequenceFlow(process, childNode, targetNodeId); |
| 179 | 173 | } |
| 180 | - | |
| 181 | - // TODO @jason:下面的 PARALLEL_BRANCH_FORK_NODE、CONDITION_BRANCH_NODE、INCLUSIVE_BRANCH_FORK_NODE 是不是就是 isBranchNode?如果是的话,貌似不用 swtich,而是 if else 分类处理呢。 | |
| 182 | -// switch (nodeType) { | |
| 183 | -// case START_NODE: | |
| 184 | -// case APPROVE_NODE: | |
| 185 | -// case COPY_NODE: | |
| 186 | -// case PARALLEL_BRANCH_JOIN_NODE: | |
| 187 | -// case INCLUSIVE_BRANCH_JOIN_NODE: { | |
| 188 | -// SequenceFlow sequenceFlow = buildBpmnSequenceFlow(node.getId(), childNode.getId(), null, null, null); | |
| 189 | -// process.addFlowElement(sequenceFlow); | |
| 190 | -// // 递归调用后续节点 | |
| 191 | -// buildAndAddBpmnSequenceFlow(process, childNode, targetNodeId); | |
| 192 | -// break; | |
| 193 | -// } | |
| 194 | -// case PARALLEL_BRANCH_FORK_NODE: | |
| 195 | -// case CONDITION_BRANCH_NODE: | |
| 196 | -// case INCLUSIVE_BRANCH_FORK_NODE: { | |
| 197 | -// // TODO @jason:这里 sequenceFlowTargetId 不建议做这样的 default。万一可能有 bug 哈;直接弄到对应的 136- 146 会更安全一点。 | |
| 198 | -// String sequenceFlowTargetId = (childNode == null || childNode.getId() == null) ? targetNodeId : childNode.getId(); | |
| 199 | -// List<BpmSimpleModelNodeVO> conditionNodes = node.getConditionNodes(); | |
| 200 | -// Assert.notEmpty(conditionNodes, "网关节点的条件节点不能为空"); | |
| 201 | -// for (BpmSimpleModelNodeVO item : conditionNodes) { | |
| 202 | -// // 构建表达式 | |
| 203 | -// // TODO @jason:条件分支的情况下,需要分 item 搞的条件,和 conditionNodes 搞的条件 | |
| 204 | -// String conditionExpression = buildConditionExpression(item); | |
| 205 | -// | |
| 206 | -// BpmSimpleModelNodeVO nextNodeOnCondition = item.getChildNode(); | |
| 207 | -// // TODO @jason:isValidNode | |
| 208 | -// if (nextNodeOnCondition != null && nextNodeOnCondition.getId() != null) { | |
| 209 | -// // TODO @jason:会存在 item.name 未空的情况么?这个时候,要不要兜底处理拼接 | |
| 210 | -// SequenceFlow sequenceFlow = buildBpmnSequenceFlow(node.getId(), nextNodeOnCondition.getId(), | |
| 211 | -// item.getId(), item.getName(), conditionExpression); | |
| 212 | -// process.addFlowElement(sequenceFlow); | |
| 213 | -// // 递归调用后续节点 | |
| 214 | -// // TODO @jason:最好也有个例子,嘿嘿;S4 | |
| 215 | -// buildAndAddBpmnSequenceFlow(process, nextNodeOnCondition, sequenceFlowTargetId); | |
| 216 | -// } else { | |
| 217 | -// SequenceFlow sequenceFlow = buildBpmnSequenceFlow(node.getId(), sequenceFlowTargetId, | |
| 218 | -// item.getId(), item.getName(), conditionExpression); | |
| 219 | -// process.addFlowElement(sequenceFlow); | |
| 220 | -// } | |
| 221 | -// } | |
| 222 | -// // 递归调用后续节点 TODO @jason:最好有个例子哈 | |
| 223 | -// buildAndAddBpmnSequenceFlow(process, childNode, targetNodeId); | |
| 224 | -// break; | |
| 225 | -// } | |
| 226 | -// default: { | |
| 227 | -// // TODO 其它节点类型的实现 | |
| 228 | -// } | |
| 229 | -// } | |
| 230 | - | |
| 231 | 174 | } |
| 232 | 175 | |
| 233 | 176 | /** | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmModelServiceImpl.java