Commit ad0d9d10c8f741f46a921a59face1566b072ec20
1 parent
742c2967
【功能新增】工作流:BpmTaskCandidateAssignEmptyStrategy 读取流程管理员
Showing
1 changed file
with
12 additions
and
2 deletions
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/strategy/BpmTaskCandidateAssignEmptyStrategy.java
| 1 | 1 | package cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.strategy; |
| 2 | 2 | |
| 3 | +import cn.hutool.core.lang.Assert; | |
| 4 | +import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmProcessDefinitionInfoDO; | |
| 3 | 5 | import cn.iocoder.yudao.module.bpm.enums.definition.BpmUserTaskAssignEmptyHandlerTypeEnum; |
| 4 | 6 | import cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.BpmTaskCandidateStrategy; |
| 5 | 7 | import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmTaskCandidateStrategyEnum; |
| 6 | 8 | import cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils; |
| 9 | +import cn.iocoder.yudao.module.bpm.service.definition.BpmProcessDefinitionService; | |
| 7 | 10 | import cn.iocoder.yudao.module.system.api.user.AdminUserApi; |
| 11 | +import jakarta.annotation.Resource; | |
| 8 | 12 | import org.flowable.engine.delegate.DelegateExecution; |
| 13 | +import org.springframework.context.annotation.Lazy; | |
| 9 | 14 | import org.springframework.stereotype.Component; |
| 10 | 15 | |
| 11 | 16 | import java.util.HashSet; |
| ... | ... | @@ -20,6 +25,10 @@ import java.util.Set; |
| 20 | 25 | @Component |
| 21 | 26 | public class BpmTaskCandidateAssignEmptyStrategy extends BpmTaskCandidateAbstractStrategy { |
| 22 | 27 | |
| 28 | + @Resource | |
| 29 | + @Lazy // 延迟加载,避免循环依赖 | |
| 30 | + private BpmProcessDefinitionService processDefinitionService; | |
| 31 | + | |
| 23 | 32 | public BpmTaskCandidateAssignEmptyStrategy(AdminUserApi adminUserApi) { |
| 24 | 33 | super(adminUserApi); |
| 25 | 34 | } |
| ... | ... | @@ -45,8 +54,9 @@ public class BpmTaskCandidateAssignEmptyStrategy extends BpmTaskCandidateAbstrac |
| 45 | 54 | |
| 46 | 55 | // 情况二:流程管理员 |
| 47 | 56 | if (Objects.equals(assignEmptyHandlerType, BpmUserTaskAssignEmptyHandlerTypeEnum.ASSIGN_ADMIN.getType())) { |
| 48 | - // TODO 芋艿:需要等待流程实例的管理员支持 | |
| 49 | - throw new UnsupportedOperationException("暂时实现!!!"); | |
| 57 | + BpmProcessDefinitionInfoDO processDefinition = processDefinitionService.getProcessDefinitionInfo(execution.getProcessDefinitionId()); | |
| 58 | + Assert.notNull(processDefinition, "流程定义({})不存在", execution.getProcessDefinitionId()); | |
| 59 | + return new HashSet<>(processDefinition.getManagerUserIds()); | |
| 50 | 60 | } |
| 51 | 61 | |
| 52 | 62 | // 都不满足,还是返回空 | ... | ... |