Commit 62a1fa82963c98d98e5e297234e7819f4b1697bb

Authored by jason
2 parents 0565db2f e892dcab

Merge remote-tracking branch 'origin/feature/bpm' into feature/bpm

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