潘志宝
9 天以前 9d5be382e52f9ac57199d5ef75cc23f925a4cdb0
提交 | 用户 | 时间
bb2880 1 package com.iailab.module.bpm.framework.flowable.core.candidate.strategy.user;
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.PostApi;
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 BpmTaskCandidatePostStrategy implements BpmTaskCandidateStrategy {
25
26     @Resource
27     private PostApi postApi;
28     @Resource
29     private AdminUserApi adminUserApi;
30
31     @Override
32     public BpmTaskCandidateStrategyEnum getStrategy() {
33         return BpmTaskCandidateStrategyEnum.POST;
34     }
35
36     @Override
37     public void validateParam(String param) {
38         Set<Long> postIds = StrUtils.splitToLongSet(param);
39         postApi.validPostList(postIds);
40     }
41
42     @Override
bb2880 43     public Set<Long> calculateUsers(String param) {
e7c126 44         Set<Long> postIds = StrUtils.splitToLongSet(param);
H 45         List<AdminUserRespDTO> users = adminUserApi.getUserListByPostIds(postIds).getCheckedData();
46         return convertSet(users, AdminUserRespDTO::getId);
47     }
48
49 }