潘志宝
9 天以前 6b13839488edcd06046e26a41fe897358176689c
提交 | 用户 | 时间
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.user.AdminUserApi;
8 import com.iailab.module.system.api.user.dto.AdminUserRespDTO;
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
bb2880 17
e7c126 18 /**
H 19  * 部门的成员 {@link BpmTaskCandidateStrategy} 实现类
20  *
bb2880 21  * @author hou
e7c126 22  */
H 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);
bb2880 39         deptApi.validateDeptList(deptIds).checkError();
e7c126 40     }
H 41
42     @Override
bb2880 43     public Set<Long> calculateUsers(String param) {
e7c126 44         Set<Long> deptIds = StrUtils.splitToLongSet(param);
H 45         List<AdminUserRespDTO> users = adminUserApi.getUserListByDeptIds(deptIds).getCheckedData();
46         return convertSet(users, AdminUserRespDTO::getId);
47     }
48
49 }