Commit afad8ac619c624bb5ef9b76c41809a1a57f617bc
1 parent
b65ccd76
仿钉钉流程设计- 增加发起人自己候选人策略
Showing
2 changed files
with
51 additions
and
0 deletions
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/candidate/strategy/BpmTaskCandidateStartUserStrategy.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.strategy; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.util.collection.SetUtils; | |
| 4 | +import cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.BpmTaskCandidateStrategy; | |
| 5 | +import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmTaskCandidateStrategyEnum; | |
| 6 | +import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService; | |
| 7 | +import jakarta.annotation.Resource; | |
| 8 | +import org.flowable.engine.delegate.DelegateExecution; | |
| 9 | +import org.springframework.context.annotation.Lazy; | |
| 10 | +import org.springframework.stereotype.Component; | |
| 11 | + | |
| 12 | +import java.util.Set; | |
| 13 | + | |
| 14 | +/** | |
| 15 | + * 发起人自己 {@link BpmTaskCandidateUserStrategy} 实现类。 用于需要发起人信息复核等场景 | |
| 16 | + * | |
| 17 | + * @author jason | |
| 18 | + */ | |
| 19 | +@Component | |
| 20 | +public class BpmTaskCandidateStartUserStrategy implements BpmTaskCandidateStrategy { | |
| 21 | + | |
| 22 | + @Resource | |
| 23 | + @Lazy // 延迟加载,避免循环依赖 | |
| 24 | + private BpmProcessInstanceService processInstanceService; | |
| 25 | + | |
| 26 | + @Override | |
| 27 | + public BpmTaskCandidateStrategyEnum getStrategy() { | |
| 28 | + return BpmTaskCandidateStrategyEnum.START_USER; | |
| 29 | + } | |
| 30 | + | |
| 31 | + /** | |
| 32 | + * 无需校验参数 | |
| 33 | + */ | |
| 34 | + @Override | |
| 35 | + public void validateParam(String param) {} | |
| 36 | + | |
| 37 | + @Override | |
| 38 | + public Set<Long> calculateUsers(DelegateExecution execution, String param) { | |
| 39 | + String startUserId = processInstanceService.getProcessInstance(execution.getProcessInstanceId()).getStartUserId(); | |
| 40 | + return SetUtils.asSet(Long.valueOf(startUserId)); | |
| 41 | + } | |
| 42 | + | |
| 43 | + /** | |
| 44 | + * 不需要参数 | |
| 45 | + */ | |
| 46 | + @Override | |
| 47 | + public boolean isParamRequired() { | |
| 48 | + return false; | |
| 49 | + } | |
| 50 | +} | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/enums/BpmTaskCandidateStrategyEnum.java
| ... | ... | @@ -21,6 +21,7 @@ public enum BpmTaskCandidateStrategyEnum { |
| 21 | 21 | POST(22, "岗位"), |
| 22 | 22 | USER(30, "用户"), |
| 23 | 23 | START_USER_SELECT(35, "发起人自选"), // 申请人自己,可在提交申请时选择此节点的审批人 |
| 24 | + START_USER(36, "发起人自己"), // 申请人自己, 一般紧挨开始节点,常用于发起人信息审核场景 | |
| 24 | 25 | USER_GROUP(40, "用户组"), |
| 25 | 26 | EXPRESSION(60, "流程表达式"), // 表达式 ExpressionManager |
| 26 | 27 | ; | ... | ... |