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.user.AdminUserApi;
8 import com.iailab.module.system.api.user.dto.AdminUserRespDTO;
9 import org.flowable.engine.delegate.DelegateExecution;
10 import org.springframework.stereotype.Component;
11
12 import javax.annotation.Resource;
13 import java.util.List;
14 import java.util.Set;
15
16 import static com.iailab.framework.common.util.collection.CollectionUtils.convertSet;
17
18 /**
19  * 部门的成员 {@link BpmTaskCandidateStrategy} 实现类
20  *
21  * @author kyle
22  */
23 @Component
24 public class BpmTaskCandidateDeptMemberStrategy implements BpmTaskCandidateStrategy {
25
26     @Resource
27     private DeptApi deptApi;
28     @Resource
29     private AdminUserApi adminUserApi;
30
31     @Override
32     public BpmTaskCandidateStrategyEnum getStrategy() {
33         return BpmTaskCandidateStrategyEnum.DEPT_MEMBER;
34     }
35
36     @Override
37     public void validateParam(String param) {
38         Set<Long> deptIds = StrUtils.splitToLongSet(param);
39         deptApi.validateDeptList(deptIds);
40     }
41
42     @Override
43     public Set<Long> calculateUsers(DelegateExecution execution, String param) {
44         Set<Long> deptIds = StrUtils.splitToLongSet(param);
45         List<AdminUserRespDTO> users = adminUserApi.getUserListByDeptIds(deptIds).getCheckedData();
46         return convertSet(users, AdminUserRespDTO::getId);
47     }
48
49 }