houzhongjian
2024-12-03 874287a4c02d0a980d8b97c4a691b4f37ec5e812
提交 | 用户 | 时间
e7c126 1 package com.iailab.module.bpm.framework.flowable.core.candidate.strategy;
H 2
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.flowable.engine.delegate.DelegateExecution;
9 import org.springframework.stereotype.Component;
10
11 import javax.annotation.Resource;
12 import java.util.List;
13 import java.util.Set;
14
15 import static com.iailab.framework.common.util.collection.CollectionUtils.convertSet;
16
17 /**
18  * 部门的负责人 {@link BpmTaskCandidateStrategy} 实现类
19  *
20  * @author kyle
21  */
22 @Component
23 public class BpmTaskCandidateDeptLeaderStrategy implements BpmTaskCandidateStrategy {
24
25     @Resource
26     private DeptApi deptApi;
27
28     @Override
29     public BpmTaskCandidateStrategyEnum getStrategy() {
30         return BpmTaskCandidateStrategyEnum.DEPT_LEADER;
31     }
32
33     @Override
34     public void validateParam(String param) {
35         Set<Long> deptIds = StrUtils.splitToLongSet(param);
36         deptApi.validateDeptList(deptIds);
37     }
38
39     @Override
40     public Set<Long> calculateUsers(DelegateExecution execution, String param) {
41         Set<Long> deptIds = StrUtils.splitToLongSet(param);
42         List<DeptRespDTO> depts = deptApi.getDeptList(deptIds).getCheckedData();
43         return convertSet(depts, DeptRespDTO::getLeaderUserId);
44     }
45
46 }