mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-02-03 04:04:58 +08:00
【功能新增】 增加审批人分配策略:表单内的部门负责人
This commit is contained in:
parent
61c9a04f9f
commit
b629e0a615
@ -0,0 +1,53 @@
|
|||||||
|
package cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.strategy.dept;
|
||||||
|
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
|
import cn.hutool.core.lang.Assert;
|
||||||
|
import cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.BpmTaskCandidateStrategy;
|
||||||
|
import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmTaskCandidateStrategyEnum;
|
||||||
|
import org.flowable.bpmn.model.BpmnModel;
|
||||||
|
import org.flowable.engine.delegate.DelegateExecution;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表单内部门负责人 {@link BpmTaskCandidateStrategy} 实现类
|
||||||
|
*
|
||||||
|
* @author jason
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class BpmTaskCandidateDeptLeaderOnFormStrategy extends AbstractBpmTaskCandidateDeptLeaderStrategy {
|
||||||
|
@Override
|
||||||
|
public BpmTaskCandidateStrategyEnum getStrategy() {
|
||||||
|
return BpmTaskCandidateStrategyEnum.DEPT_LEADER_ON_FORM;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void validateParam(String param) {
|
||||||
|
// 参数格式: | 分隔:1)左边为表单内部门字段。2)右边为部门层级
|
||||||
|
String[] params = param.split("\\|");
|
||||||
|
Assert.isTrue(params.length == 2, "参数格式不匹配");
|
||||||
|
Assert.notEmpty(param, "表单内部门字段不能为空");
|
||||||
|
int level = Integer.parseInt(params[1]);
|
||||||
|
Assert.isTrue(level > 0, "部门层级必须大于 0");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<Long> calculateUsersByTask(DelegateExecution execution, String param) {
|
||||||
|
String[] params = param.split("\\|");
|
||||||
|
Object result = execution.getVariable(params[0]);
|
||||||
|
int level = Integer.parseInt(params[1]);
|
||||||
|
return super.getMultiLevelDeptLeaderIds(Convert.toList(Long.class, result), level);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<Long> calculateUsersByActivity(BpmnModel bpmnModel, String activityId,
|
||||||
|
String param, Long startUserId, String processDefinitionId,
|
||||||
|
Map<String, Object> processVariables) {
|
||||||
|
String[] params = param.split("\\|");
|
||||||
|
Object result = processVariables == null ? null : processVariables.get(params[0]);
|
||||||
|
int level = Integer.parseInt(params[1]);
|
||||||
|
return super.getMultiLevelDeptLeaderIds(Convert.toList(Long.class, result), level);
|
||||||
|
}
|
||||||
|
}
|
@ -30,6 +30,7 @@ public enum BpmTaskCandidateStrategyEnum implements IntArrayValuable {
|
|||||||
START_USER_DEPT_LEADER_MULTI(38, "发起人连续多级部门的负责人"),
|
START_USER_DEPT_LEADER_MULTI(38, "发起人连续多级部门的负责人"),
|
||||||
USER_GROUP(40, "用户组"),
|
USER_GROUP(40, "用户组"),
|
||||||
USER_FIELD_ON_FORM(50, "表单内用户字段"),
|
USER_FIELD_ON_FORM(50, "表单内用户字段"),
|
||||||
|
DEPT_LEADER_ON_FORM(51, "表单内部分负责人"),
|
||||||
EXPRESSION(60, "流程表达式"), // 表达式 ExpressionManager
|
EXPRESSION(60, "流程表达式"), // 表达式 ExpressionManager
|
||||||
ASSIGN_EMPTY(1, "审批人为空"),
|
ASSIGN_EMPTY(1, "审批人为空"),
|
||||||
;
|
;
|
||||||
|
Loading…
Reference in New Issue
Block a user