mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-11-01 02:38:43 +08:00 
			
		
		
		
	【功能修复】工作流:BPMN 发起自选时,因为没有 ServiceTask 导致报错
This commit is contained in:
		| @@ -67,10 +67,7 @@ public class BpmProcessDefinitionRespVO { | ||||
|  | ||||
|     @Schema(description = "流程定义排序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||||
|     private Long sort; | ||||
|  | ||||
|     @Schema(description = "发起用户需要选择审批人的任务数组") | ||||
|     private List<UserTask> startUserSelectTasks; // 需要从对应的 BpmnModel 读取,非必须返回 | ||||
|  | ||||
|      | ||||
|     @Schema(description = "BPMN UserTask 用户任务") | ||||
|     @Data | ||||
|     public static class UserTask { | ||||
|   | ||||
| @@ -54,9 +54,6 @@ public class BpmApprovalDetailRespVO { | ||||
|         @Schema(description = "节点状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") | ||||
|         private Integer status; // 参见 BpmTaskStatusEnum 枚举 | ||||
|  | ||||
|         @Schema(description = "候选人策略", example = "35") | ||||
|         private Integer candidateStrategy; // 用于审批,抄送节点 | ||||
|  | ||||
|         @Schema(description = "节点的开始时间") | ||||
|         private LocalDateTime startTime; | ||||
|         @Schema(description = "节点的结束时间") | ||||
| @@ -65,6 +62,9 @@ public class BpmApprovalDetailRespVO { | ||||
|         @Schema(description = "审批节点的任务信息") | ||||
|         private List<ActivityNodeTask> tasks; | ||||
|  | ||||
|         @Schema(description = "候选人策略", example = "35") | ||||
|         private Integer candidateStrategy; // 参见 BpmTaskCandidateStrategyEnum 枚举。主要用于发起时,审批节点、抄送节点自选 | ||||
|  | ||||
|         @Schema(description = "候选人用户 ID 列表", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "1818") | ||||
|         @JsonIgnore // 不返回,只是方便后续读取,赋值给 candidateUsers | ||||
|         private List<Long> candidateUserIds; | ||||
|   | ||||
| @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.strategy.d | ||||
|  | ||||
| import cn.hutool.core.collection.CollUtil; | ||||
| import cn.hutool.core.lang.Assert; | ||||
| import cn.hutool.core.util.ObjectUtil; | ||||
| import cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.strategy.user.BpmTaskCandidateUserStrategy; | ||||
| import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmTaskCandidateStrategyEnum; | ||||
| import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils; | ||||
| @@ -10,16 +11,15 @@ import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService; | ||||
| import com.google.common.collect.Sets; | ||||
| import jakarta.annotation.Resource; | ||||
| import org.flowable.bpmn.model.BpmnModel; | ||||
| import org.flowable.bpmn.model.ServiceTask; | ||||
| import org.flowable.bpmn.model.Task; | ||||
| import org.flowable.bpmn.model.UserTask; | ||||
| import org.flowable.engine.delegate.DelegateExecution; | ||||
| import org.flowable.engine.runtime.ProcessInstance; | ||||
| import org.springframework.context.annotation.Lazy; | ||||
| import org.springframework.stereotype.Component; | ||||
|  | ||||
| import java.util.LinkedHashSet; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
| import java.util.Objects; | ||||
| import java.util.*; | ||||
|  | ||||
| /** | ||||
|  * 发起人自选 {@link BpmTaskCandidateUserStrategy} 实现类 | ||||
| @@ -79,15 +79,17 @@ public class BpmTaskCandidateStartUserSelectStrategy extends AbstractBpmTaskCand | ||||
|      * @param bpmnModel BPMN 模型 | ||||
|      * @return Task 列表 | ||||
|      */ | ||||
|     public static <T extends Task> List<T> getStartUserSelectUserTaskList(BpmnModel bpmnModel, Class<T> TaskClass ) { | ||||
|     public static List<Task> getStartUserSelectTaskList(BpmnModel bpmnModel) { | ||||
|         if (bpmnModel == null) { | ||||
|             return null; | ||||
|             return Collections.emptyList(); | ||||
|         } | ||||
|         List<T> tasks = BpmnModelUtils.getBpmnModelElements(bpmnModel, TaskClass); | ||||
|         List<Task> tasks = new ArrayList<>(); | ||||
|         tasks.addAll(BpmnModelUtils.getBpmnModelElements(bpmnModel, UserTask.class)); | ||||
|         tasks.addAll(BpmnModelUtils.getBpmnModelElements(bpmnModel, ServiceTask.class)); | ||||
|         if (CollUtil.isEmpty(tasks)) { | ||||
|             return null; | ||||
|             return Collections.emptyList(); | ||||
|         } | ||||
|         tasks.removeIf(serviceTask -> !Objects.equals(BpmnModelUtils.parseCandidateStrategy(serviceTask), | ||||
|         tasks.removeIf(task -> ObjectUtil.notEqual(BpmnModelUtils.parseCandidateStrategy(task), | ||||
|                 BpmTaskCandidateStrategyEnum.START_USER_SELECT.getStrategy())); | ||||
|         return tasks; | ||||
|     } | ||||
|   | ||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
		Reference in New Issue
	
	Block a user
	 YunaiV
					YunaiV