提交 | 用户 | 时间
|
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.dal.dataobject.definition.BpmUserGroupDO; |
|
5 |
import com.iailab.module.bpm.framework.flowable.core.candidate.BpmTaskCandidateStrategy; |
|
6 |
import com.iailab.module.bpm.framework.flowable.core.enums.BpmTaskCandidateStrategyEnum; |
|
7 |
import com.iailab.module.bpm.service.definition.BpmUserGroupService; |
|
8 |
import org.flowable.engine.delegate.DelegateExecution; |
|
9 |
import org.springframework.stereotype.Component; |
|
10 |
|
|
11 |
import javax.annotation.Resource; |
|
12 |
import java.util.Collection; |
|
13 |
import java.util.List; |
|
14 |
import java.util.Set; |
|
15 |
|
|
16 |
import static com.iailab.framework.common.util.collection.CollectionUtils.convertSetByFlatMap; |
|
17 |
|
|
18 |
/** |
|
19 |
* 用户组 {@link BpmTaskCandidateStrategy} 实现类 |
|
20 |
* |
|
21 |
* @author kyle |
|
22 |
*/ |
|
23 |
@Component |
|
24 |
public class BpmTaskCandidateGroupStrategy implements BpmTaskCandidateStrategy { |
|
25 |
|
|
26 |
@Resource |
|
27 |
private BpmUserGroupService userGroupService; |
|
28 |
|
|
29 |
@Override |
|
30 |
public BpmTaskCandidateStrategyEnum getStrategy() { |
|
31 |
return BpmTaskCandidateStrategyEnum.USER_GROUP; |
|
32 |
} |
|
33 |
|
|
34 |
@Override |
|
35 |
public void validateParam(String param) { |
|
36 |
Set<Long> groupIds = StrUtils.splitToLongSet(param); |
|
37 |
userGroupService.getUserGroupList(groupIds); |
|
38 |
} |
|
39 |
|
|
40 |
@Override |
|
41 |
public Set<Long> calculateUsers(DelegateExecution execution, String param) { |
|
42 |
Set<Long> groupIds = StrUtils.splitToLongSet(param); |
|
43 |
List<BpmUserGroupDO> groups = userGroupService.getUserGroupList(groupIds); |
|
44 |
return convertSetByFlatMap(groups, BpmUserGroupDO::getUserIds, Collection::stream); |
|
45 |
} |
|
46 |
|
|
47 |
} |