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.permission.PermissionApi; import com.iailab.module.system.api.permission.RoleApi; import org.springframework.stereotype.Component; import javax.annotation.Resource; import java.util.Set; /** * 角色 {@link BpmTaskCandidateStrategy} 实现类 * * @author hou */ @Component public class BpmTaskCandidateRoleStrategy implements BpmTaskCandidateStrategy { @Resource private RoleApi roleApi; @Resource private PermissionApi permissionApi; @Override public BpmTaskCandidateStrategyEnum getStrategy() { return BpmTaskCandidateStrategyEnum.ROLE; } @Override public void validateParam(String param) { Set roleIds = StrUtils.splitToLongSet(param); roleApi.validRoleList(roleIds); } @Override public Set calculateUsers(String param) { Set roleIds = StrUtils.splitToLongSet(param); return permissionApi.getUserRoleIdListByRoleIds(roleIds).getCheckedData(); } }