Commit 62a1fa82963c98d98e5e297234e7819f4b1697bb
Merge remote-tracking branch 'origin/feature/bpm' into feature/bpm
Showing
6 changed files
with
15 additions
and
8 deletions
yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmChildProcessMultiInstanceSourceTypeEnum.java
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/simple/BpmSimpleModelNodeVO.java
| ... | ... | @@ -394,7 +394,7 @@ public class BpmSimpleModelNodeVO { |
| 394 | 394 | */ |
| 395 | 395 | @Schema(description = "回调任务 Key", example = "xxx", hidden = true) |
| 396 | 396 | private String callbackTaskDefineKey; |
| 397 | - | |
| 397 | + | |
| 398 | 398 | } |
| 399 | 399 | |
| 400 | 400 | @Schema(description = "流程表单触发器设置", example = "{}") |
| ... | ... | @@ -509,7 +509,7 @@ public class BpmSimpleModelNodeVO { |
| 509 | 509 | |
| 510 | 510 | @Schema(description = "完成比例", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") |
| 511 | 511 | @NotNull(message = "完成比例不能为空") |
| 512 | - private Integer completeRatio; | |
| 512 | + private Integer completeRatio; // TODO @lesan:approveRatio 要不这个,和上面保持一致? | |
| 513 | 513 | |
| 514 | 514 | @Schema(description = "多实例来源类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| 515 | 515 | @NotNull(message = "多实例来源类型不能为空") | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/behavior/BpmParallelMultiInstanceBehavior.java
| ... | ... | @@ -48,6 +48,7 @@ public class BpmParallelMultiInstanceBehavior extends ParallelMultiInstanceBehav |
| 48 | 48 | */ |
| 49 | 49 | @Override |
| 50 | 50 | protected int resolveNrOfInstances(DelegateExecution execution) { |
| 51 | + // 情况一:UserTask 节点 | |
| 51 | 52 | if (execution.getCurrentFlowElement() instanceof UserTask) { |
| 52 | 53 | // 第一步,设置 collectionVariable 和 CollectionVariable |
| 53 | 54 | // 从 execution.getVariable() 读取所有任务处理人的 key |
| ... | ... | @@ -72,6 +73,7 @@ public class BpmParallelMultiInstanceBehavior extends ParallelMultiInstanceBehav |
| 72 | 73 | return assigneeUserIds.size(); |
| 73 | 74 | } |
| 74 | 75 | |
| 76 | + // 情况二:CallActivity 节点 | |
| 75 | 77 | if (execution.getCurrentFlowElement() instanceof CallActivity) { |
| 76 | 78 | FlowElement flowElement = execution.getCurrentFlowElement(); |
| 77 | 79 | Integer sourceType = BpmnModelUtils.parseMultiInstanceSourceType(flowElement); | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/behavior/BpmSequentialMultiInstanceBehavior.java
| ... | ... | @@ -41,6 +41,7 @@ public class BpmSequentialMultiInstanceBehavior extends SequentialMultiInstanceB |
| 41 | 41 | */ |
| 42 | 42 | @Override |
| 43 | 43 | protected int resolveNrOfInstances(DelegateExecution execution) { |
| 44 | + // 情况一:UserTask 节点 | |
| 44 | 45 | if (execution.getCurrentFlowElement() instanceof UserTask) { |
| 45 | 46 | // 第一步,设置 collectionVariable 和 CollectionVariable |
| 46 | 47 | // 从 execution.getVariable() 读取所有任务处理人的 key |
| ... | ... | @@ -66,6 +67,7 @@ public class BpmSequentialMultiInstanceBehavior extends SequentialMultiInstanceB |
| 66 | 67 | return assigneeUserIds.size(); |
| 67 | 68 | } |
| 68 | 69 | |
| 70 | + // 情况二:CallActivity 节点 | |
| 69 | 71 | if (execution.getCurrentFlowElement() instanceof CallActivity) { |
| 70 | 72 | FlowElement flowElement = execution.getCurrentFlowElement(); |
| 71 | 73 | Integer sourceType = BpmnModelUtils.parseMultiInstanceSourceType(flowElement); | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/util/SimpleModelUtils.java
| ... | ... | @@ -721,6 +721,8 @@ public class SimpleModelUtils { |
| 721 | 721 | } else if (node.getDelaySetting().getDelayType().equals(BpmDelayTimerTypeEnum.FIXED_TIME_DURATION.getType())) { |
| 722 | 722 | boundaryEvent = buildTimeoutBoundaryEvent(receiveTask, BpmBoundaryEventTypeEnum.DELAY_TIMER_TIMEOUT.getType(), |
| 723 | 723 | null, null, node.getDelaySetting().getDelayTime()); |
| 724 | + } else { | |
| 725 | + throw new UnsupportedOperationException("不支持的延迟类型:" + node.getDelaySetting()); | |
| 724 | 726 | } |
| 725 | 727 | flowElements.add(boundaryEvent); |
| 726 | 728 | } |
| ... | ... | @@ -751,7 +753,7 @@ public class SimpleModelUtils { |
| 751 | 753 | // 重要:设置 callbackTaskDefineKey,用于 HTTP 回调 |
| 752 | 754 | node.getTriggerSetting().getHttpRequestSetting().setCallbackTaskDefineKey(receiveTask.getId()); |
| 753 | 755 | } |
| 754 | - | |
| 756 | + | |
| 755 | 757 | // 触发器使用 ServiceTask 来实现 |
| 756 | 758 | ServiceTask serviceTask = new ServiceTask(); |
| 757 | 759 | serviceTask.setId(node.getId()); |
| ... | ... | @@ -877,6 +879,7 @@ public class SimpleModelUtils { |
| 877 | 879 | childProcessSetting.getMultiInstanceSetting().getSourceType().equals(BpmChildProcessMultiInstanceSourceTypeEnum.MULTI_FORM.getType())) { |
| 878 | 880 | multiInstanceCharacteristics.setInputDataItem(childProcessSetting.getMultiInstanceSetting().getSource()); |
| 879 | 881 | } |
| 882 | +// TODO @lesan:String.format(approveMethodEnum.getCompletionCondition(), String.format("%.2f", approveRatio / 100D))); | |
| 880 | 883 | multiInstanceCharacteristics.setCompletionCondition(String.format("${ nrOfCompletedInstances/nrOfInstances >= %s}", |
| 881 | 884 | String.format("%.2f", childProcessSetting.getMultiInstanceSetting().getCompleteRatio() / 100D))); |
| 882 | 885 | callActivity.setLoopCharacteristics(multiInstanceCharacteristics); |
| ... | ... | @@ -901,9 +904,7 @@ public class SimpleModelUtils { |
| 901 | 904 | } |
| 902 | 905 | |
| 903 | 906 | private static BoundaryEvent buildTimeoutBoundaryEvent(Activity attachedToRef, Integer type, |
| 904 | - String timeDuration, | |
| 905 | - String timeCycle, | |
| 906 | - String timeDate) { | |
| 907 | + String timeDuration, String timeCycle, String timeDate) { | |
| 907 | 908 | // 1.1 定时器边界事件 |
| 908 | 909 | BoundaryEvent boundaryEvent = new BoundaryEvent(); |
| 909 | 910 | boundaryEvent.setId("Event-" + IdUtil.fastUUID()); |
| ... | ... | @@ -922,7 +923,7 @@ public class SimpleModelUtils { |
| 922 | 923 | } |
| 923 | 924 | boundaryEvent.addEventDefinition(eventDefinition); |
| 924 | 925 | |
| 925 | - // 2.1 添加定时器边界事件类型 | |
| 926 | + // 2. 添加定时器边界事件类型 | |
| 926 | 927 | addExtensionElement(boundaryEvent, BOUNDARY_EVENT_TYPE, type); |
| 927 | 928 | return boundaryEvent; |
| 928 | 929 | } | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmProcessInstanceServiceImpl.java
| ... | ... | @@ -414,7 +414,8 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService |
| 414 | 414 | // 处理每个任务的 tasks 属性 |
| 415 | 415 | for (HistoricActivityInstance activity : taskActivities) { |
| 416 | 416 | HistoricTaskInstance task = taskMap.get(activity.getTaskId()); |
| 417 | - // ChildProcess 子流程节点仅存在于 activity 中,并且没有自身的 task ,需要跳过执行 | |
| 417 | + // 特殊情况:子流程节点 ChildProcess 仅存在于 activity 中,并且没有自身的 task,需要跳过执行 | |
| 418 | + // TODO @芋艿:后续看看怎么优化! | |
| 418 | 419 | if (task == null) { |
| 419 | 420 | continue; |
| 420 | 421 | } | ... | ... |