diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/strategy/BpmTaskCandidateAssignEmptyStrategy.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/strategy/BpmTaskCandidateAssignEmptyStrategy.java index 78eda0cab..d6bd19caf 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/strategy/BpmTaskCandidateAssignEmptyStrategy.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/strategy/BpmTaskCandidateAssignEmptyStrategy.java @@ -1,11 +1,16 @@ package cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.strategy; +import cn.hutool.core.lang.Assert; +import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmProcessDefinitionInfoDO; import cn.iocoder.yudao.module.bpm.enums.definition.BpmUserTaskAssignEmptyHandlerTypeEnum; import cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.BpmTaskCandidateStrategy; import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmTaskCandidateStrategyEnum; import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils; +import cn.iocoder.yudao.module.bpm.service.definition.BpmProcessDefinitionService; import cn.iocoder.yudao.module.system.api.user.AdminUserApi; +import jakarta.annotation.Resource; import org.flowable.engine.delegate.DelegateExecution; +import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; import java.util.HashSet; @@ -20,6 +25,10 @@ import java.util.Set; @Component public class BpmTaskCandidateAssignEmptyStrategy extends BpmTaskCandidateAbstractStrategy { + @Resource + @Lazy // 延迟加载,避免循环依赖 + private BpmProcessDefinitionService processDefinitionService; + public BpmTaskCandidateAssignEmptyStrategy(AdminUserApi adminUserApi) { super(adminUserApi); } @@ -45,8 +54,9 @@ public class BpmTaskCandidateAssignEmptyStrategy extends BpmTaskCandidateAbstrac // 情况二:流程管理员 if (Objects.equals(assignEmptyHandlerType, BpmUserTaskAssignEmptyHandlerTypeEnum.ASSIGN_ADMIN.getType())) { - // TODO 芋艿:需要等待流程实例的管理员支持 - throw new UnsupportedOperationException("暂时实现!!!"); + BpmProcessDefinitionInfoDO processDefinition = processDefinitionService.getProcessDefinitionInfo(execution.getProcessDefinitionId()); + Assert.notNull(processDefinition, "流程定义({})不存在", execution.getProcessDefinitionId()); + return new HashSet<>(processDefinition.getManagerUserIds()); } // 都不满足,还是返回空