Commit 7cf55c5300bdf026ad042525b14eded6fa04a3bc
1 parent
e5aede62
fix: 添加节点类型以区分不同节点
Showing
4 changed files
with
30 additions
and
2 deletions
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/enums/BpmnModelConstants.java
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/BpmnModelUtils.java
| ... | ... | @@ -410,6 +410,26 @@ public class BpmnModelUtils { |
| 410 | 410 | return parseExtensionElement(flowElement, TRIGGER_PARAM); |
| 411 | 411 | } |
| 412 | 412 | |
| 413 | + /** | |
| 414 | + * 给节点添加节点类型 | |
| 415 | + * | |
| 416 | + * @param nodeType 节点类型 | |
| 417 | + * @param flowElement 节点 | |
| 418 | + */ | |
| 419 | + public static void addNodeType(Integer nodeType, FlowElement flowElement) { | |
| 420 | + addExtensionElement(flowElement, BpmnModelConstants.NODE_TYPE, nodeType); | |
| 421 | + } | |
| 422 | + | |
| 423 | + /** | |
| 424 | + * 解析节点类型 | |
| 425 | + * | |
| 426 | + * @param flowElement 节点 | |
| 427 | + * @return 节点类型 | |
| 428 | + */ | |
| 429 | + public static Integer parseNodeType(FlowElement flowElement) { | |
| 430 | + return NumberUtils.parseInt(parseExtensionElement(flowElement, BpmnModelConstants.NODE_TYPE)); | |
| 431 | + } | |
| 432 | + | |
| 413 | 433 | // ========== BPM 简单查找相关的方法 ========== |
| 414 | 434 | |
| 415 | 435 | /** | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/SimpleModelUtils.java
| ... | ... | @@ -445,6 +445,8 @@ public class SimpleModelUtils { |
| 445 | 445 | addSignEnable(node.getSignEnable(), userTask); |
| 446 | 446 | // 审批意见 |
| 447 | 447 | addReasonRequire(node.getReasonRequire(), userTask); |
| 448 | + // 节点类型 | |
| 449 | + addNodeType(node.getType(), userTask); | |
| 448 | 450 | return userTask; |
| 449 | 451 | } |
| 450 | 452 | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmProcessInstanceServiceImpl.java
| ... | ... | @@ -67,6 +67,7 @@ import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils. |
| 67 | 67 | import static cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmApprovalDetailRespVO.ActivityNode; |
| 68 | 68 | import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*; |
| 69 | 69 | import static cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnModelConstants.START_USER_NODE_ID; |
| 70 | +import static cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils.parseNodeType; | |
| 70 | 71 | import static java.util.Arrays.asList; |
| 71 | 72 | import static java.util.Collections.singletonList; |
| 72 | 73 | import static org.flowable.bpmn.constants.BpmnXMLConstants.*; |
| ... | ... | @@ -325,7 +326,7 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService |
| 325 | 326 | ActivityNode activityNode = new ActivityNode().setId(task.getTaskDefinitionKey()).setName(task.getName()) |
| 326 | 327 | .setNodeType(START_USER_NODE_ID.equals(task.getTaskDefinitionKey()) |
| 327 | 328 | ? BpmSimpleModelNodeTypeEnum.START_USER_NODE.getType() |
| 328 | - : BpmSimpleModelNodeTypeEnum.APPROVE_NODE.getType()) | |
| 329 | + : parseNodeType(flowNode)) | |
| 329 | 330 | .setStatus(FlowableUtils.getTaskStatus(task)) |
| 330 | 331 | .setCandidateStrategy(BpmnModelUtils.parseCandidateStrategy(flowNode)) |
| 331 | 332 | .setStartTime(DateUtils.of(task.getCreateTime())).setEndTime(DateUtils.of(task.getEndTime())) |
| ... | ... | @@ -402,7 +403,7 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService |
| 402 | 403 | HistoricActivityInstance firstActivity = CollUtil.getFirst(taskActivities); // 取第一个任务,会签/或签的任务,开始时间相同 |
| 403 | 404 | ActivityNode activityNode = new ActivityNode().setId(firstActivity.getActivityId()) |
| 404 | 405 | .setName(firstActivity.getActivityName()) |
| 405 | - .setNodeType(BpmSimpleModelNodeTypeEnum.APPROVE_NODE.getType()) | |
| 406 | + .setNodeType(parseNodeType(flowNode)) | |
| 406 | 407 | .setStatus(BpmTaskStatusEnum.RUNNING.getStatus()) |
| 407 | 408 | .setCandidateStrategy(BpmnModelUtils.parseCandidateStrategy(flowNode)) |
| 408 | 409 | .setStartTime(DateUtils.of(CollUtil.getFirst(taskActivities).getStartTime())) | ... | ... |