mirror of
				https://github.com/YunaiV/ruoyi-vue-pro.git
				synced 2025-10-30 10:05:59 +08:00 
			
		
		
		
	仿钉钉流程设计- 增加发起人自己候选人策略
This commit is contained in:
		| @ -0,0 +1,50 @@ | ||||
| package cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.strategy; | ||||
|  | ||||
| import cn.iocoder.yudao.framework.common.util.collection.SetUtils; | ||||
| 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.service.task.BpmProcessInstanceService; | ||||
| import jakarta.annotation.Resource; | ||||
| import org.flowable.engine.delegate.DelegateExecution; | ||||
| import org.springframework.context.annotation.Lazy; | ||||
| import org.springframework.stereotype.Component; | ||||
|  | ||||
| import java.util.Set; | ||||
|  | ||||
| /** | ||||
|  * 发起人自己 {@link BpmTaskCandidateUserStrategy} 实现类。 用于需要发起人信息复核等场景 | ||||
|  * | ||||
|  * @author jason | ||||
|  */ | ||||
| @Component | ||||
| public class BpmTaskCandidateStartUserStrategy implements BpmTaskCandidateStrategy { | ||||
|  | ||||
|     @Resource | ||||
|     @Lazy // 延迟加载,避免循环依赖 | ||||
|     private BpmProcessInstanceService processInstanceService; | ||||
|  | ||||
|     @Override | ||||
|     public BpmTaskCandidateStrategyEnum getStrategy() { | ||||
|         return BpmTaskCandidateStrategyEnum.START_USER; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 无需校验参数 | ||||
|      */ | ||||
|     @Override | ||||
|     public void validateParam(String param) {} | ||||
|  | ||||
|     @Override | ||||
|     public Set<Long> calculateUsers(DelegateExecution execution, String param) { | ||||
|         String startUserId = processInstanceService.getProcessInstance(execution.getProcessInstanceId()).getStartUserId(); | ||||
|         return SetUtils.asSet(Long.valueOf(startUserId)); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 不需要参数 | ||||
|      */ | ||||
|     @Override | ||||
|     public boolean isParamRequired() { | ||||
|         return false; | ||||
|     } | ||||
| } | ||||
| @ -21,6 +21,7 @@ public enum BpmTaskCandidateStrategyEnum { | ||||
|     POST(22, "岗位"), | ||||
|     USER(30, "用户"), | ||||
|     START_USER_SELECT(35, "发起人自选"), // 申请人自己,可在提交申请时选择此节点的审批人 | ||||
|     START_USER(36, "发起人自己"), // 申请人自己, 一般紧挨开始节点,常用于发起人信息审核场景 | ||||
|     USER_GROUP(40, "用户组"), | ||||
|     EXPRESSION(60, "流程表达式"), // 表达式 ExpressionManager | ||||
|     ; | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 jason
					jason