潘志宝
9 天以前 6b13839488edcd06046e26a41fe897358176689c
提交 | 用户 | 时间
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.permission.PermissionApi;
7 import com.iailab.module.system.api.permission.RoleApi;
8 import org.springframework.stereotype.Component;
9
10 import javax.annotation.Resource;
11 import java.util.Set;
12
13 /**
14  * 角色 {@link BpmTaskCandidateStrategy} 实现类
15  *
bb2880 16  * @author hou
e7c126 17  */
H 18 @Component
19 public class BpmTaskCandidateRoleStrategy implements BpmTaskCandidateStrategy {
20
21     @Resource
22     private RoleApi roleApi;
23     @Resource
24     private PermissionApi permissionApi;
25
26     @Override
27     public BpmTaskCandidateStrategyEnum getStrategy() {
28         return BpmTaskCandidateStrategyEnum.ROLE;
29     }
30
31     @Override
32     public void validateParam(String param) {
33         Set<Long> roleIds = StrUtils.splitToLongSet(param);
34         roleApi.validRoleList(roleIds);
35     }
36
37     @Override
bb2880 38     public Set<Long> calculateUsers(String param) {
e7c126 39         Set<Long> roleIds = StrUtils.splitToLongSet(param);
H 40         return permissionApi.getUserRoleIdListByRoleIds(roleIds).getCheckedData();
41     }
42
43 }