dongyukun
6 天以前 ed8fc5f674544d3af63c6f68093ffc038385c493
提交 | 用户 | 时间
bb2880 1 package com.iailab.module.bpm.framework.flowable.core.candidate.strategy.dept;
e7c126 2
H 3 import com.iailab.framework.common.util.string.StrUtils;
4 import com.iailab.module.bpm.framework.flowable.core.candidate.BpmTaskCandidateStrategy;
5 import com.iailab.module.bpm.framework.flowable.core.enums.BpmTaskCandidateStrategyEnum;
6 import com.iailab.module.system.api.dept.DeptApi;
7 import com.iailab.module.system.api.dept.dto.DeptRespDTO;
8 import org.springframework.stereotype.Component;
9
10 import javax.annotation.Resource;
11 import java.util.List;
12 import java.util.Set;
13
14 import static com.iailab.framework.common.util.collection.CollectionUtils.convertSet;
15
16 /**
17  * 部门的负责人 {@link BpmTaskCandidateStrategy} 实现类
18  *
bb2880 19  * @author hou
e7c126 20  */
H 21 @Component
22 public class BpmTaskCandidateDeptLeaderStrategy implements BpmTaskCandidateStrategy {
23
24     @Resource
25     private DeptApi deptApi;
26
27     @Override
28     public BpmTaskCandidateStrategyEnum getStrategy() {
29         return BpmTaskCandidateStrategyEnum.DEPT_LEADER;
30     }
31
32     @Override
33     public void validateParam(String param) {
34         Set<Long> deptIds = StrUtils.splitToLongSet(param);
bb2880 35         deptApi.validateDeptList(deptIds).checkError();
e7c126 36     }
H 37
38     @Override
bb2880 39     public Set<Long> calculateUsers(String param) {
e7c126 40         Set<Long> deptIds = StrUtils.splitToLongSet(param);
H 41         List<DeptRespDTO> depts = deptApi.getDeptList(deptIds).getCheckedData();
42         return convertSet(depts, DeptRespDTO::getLeaderUserId);
43     }
44
45 }