提交 | 用户 | 时间
|
bb2880
|
1 |
package com.iailab.module.bpm.framework.flowable.core.candidate.strategy.dept; |
H |
2 |
|
|
3 |
import cn.hutool.core.lang.Assert; |
|
4 |
import com.iailab.framework.common.util.string.StrUtils; |
|
5 |
import com.iailab.module.bpm.framework.flowable.core.candidate.BpmTaskCandidateStrategy; |
|
6 |
import com.iailab.module.bpm.framework.flowable.core.enums.BpmTaskCandidateStrategyEnum; |
|
7 |
import org.springframework.stereotype.Component; |
|
8 |
|
|
9 |
import java.util.List; |
|
10 |
import java.util.Set; |
|
11 |
|
|
12 |
/** |
|
13 |
* 连续多级部门的负责人 {@link BpmTaskCandidateStrategy} 实现类 |
|
14 |
* |
|
15 |
* @author hou |
|
16 |
*/ |
|
17 |
@Component |
|
18 |
public class BpmTaskCandidateDeptLeaderMultiStrategy extends AbstractBpmTaskCandidateDeptLeaderStrategy { |
|
19 |
|
|
20 |
@Override |
|
21 |
public BpmTaskCandidateStrategyEnum getStrategy() { |
|
22 |
return BpmTaskCandidateStrategyEnum.MULTI_DEPT_LEADER_MULTI; |
|
23 |
} |
|
24 |
|
|
25 |
@Override |
|
26 |
public void validateParam(String param) { |
|
27 |
// 参数格式: | 分隔:1)左边为部门(多个部门用 , 分隔)。2)右边为部门层级 |
|
28 |
String[] params = param.split("\\|"); |
|
29 |
Assert.isTrue(params.length == 2, "参数格式不匹配"); |
|
30 |
List<Long> deptIds = StrUtils.splitToLong(params[0], ","); |
|
31 |
int level = Integer.parseInt(params[1]); |
|
32 |
// 校验部门存在 |
|
33 |
deptApi.validateDeptList(deptIds).checkError(); |
|
34 |
Assert.isTrue(level > 0, "部门层级必须大于 0"); |
|
35 |
} |
|
36 |
|
|
37 |
@Override |
|
38 |
public Set<Long> calculateUsers(String param) { |
|
39 |
String[] params = param.split("\\|"); |
|
40 |
List<Long> deptIds = StrUtils.splitToLong(params[0], ","); |
|
41 |
int level = Integer.parseInt(params[1]); |
|
42 |
return super.getMultiLevelDeptLeaderIds(deptIds, level); |
|
43 |
} |
|
44 |
|
|
45 |
} |