仿钉钉流程设计- 增加发起人自己候选人策略

This commit is contained in:
jason 2024-05-20 21:20:26 +08:00
parent b65ccd769f
commit afad8ac619
2 changed files with 51 additions and 0 deletions

View File

@ -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;
}
}

View File

@ -21,6 +21,7 @@ public enum BpmTaskCandidateStrategyEnum {
POST(22, "岗位"), POST(22, "岗位"),
USER(30, "用户"), USER(30, "用户"),
START_USER_SELECT(35, "发起人自选"), // 申请人自己可在提交申请时选择此节点的审批人 START_USER_SELECT(35, "发起人自选"), // 申请人自己可在提交申请时选择此节点的审批人
START_USER(36, "发起人自己"), // 申请人自己, 一般紧挨开始节点常用于发起人信息审核场景
USER_GROUP(40, "用户组"), USER_GROUP(40, "用户组"),
EXPRESSION(60, "流程表达式"), // 表达式 ExpressionManager EXPRESSION(60, "流程表达式"), // 表达式 ExpressionManager
; ;