dongyukun
6 天以前 ed8fc5f674544d3af63c6f68093ffc038385c493
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package com.iailab.module.bpm.framework.flowable.core.candidate.strategy.user;
 
import com.iailab.framework.common.util.string.StrUtils;
import com.iailab.module.bpm.framework.flowable.core.candidate.BpmTaskCandidateStrategy;
import com.iailab.module.bpm.framework.flowable.core.enums.BpmTaskCandidateStrategyEnum;
import com.iailab.module.system.api.dept.PostApi;
import com.iailab.module.system.api.user.AdminUserApi;
import com.iailab.module.system.api.user.dto.AdminUserRespDTO;
import org.springframework.stereotype.Component;
 
import javax.annotation.Resource;
import java.util.List;
import java.util.Set;
 
import static com.iailab.framework.common.util.collection.CollectionUtils.convertSet;
 
 
/**
 * 岗位 {@link BpmTaskCandidateStrategy} 实现类
 *
 * @author hou
 */
@Component
public class BpmTaskCandidatePostStrategy implements BpmTaskCandidateStrategy {
 
    @Resource
    private PostApi postApi;
    @Resource
    private AdminUserApi adminUserApi;
 
    @Override
    public BpmTaskCandidateStrategyEnum getStrategy() {
        return BpmTaskCandidateStrategyEnum.POST;
    }
 
    @Override
    public void validateParam(String param) {
        Set<Long> postIds = StrUtils.splitToLongSet(param);
        postApi.validPostList(postIds);
    }
 
    @Override
    public Set<Long> calculateUsers(String param) {
        Set<Long> postIds = StrUtils.splitToLongSet(param);
        List<AdminUserRespDTO> users = adminUserApi.getUserListByPostIds(postIds).getCheckedData();
        return convertSet(users, AdminUserRespDTO::getId);
    }
 
}