package com.iailab.module.bpm.framework.flowable.core.candidate.strategy.dept; 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.DeptApi; 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 BpmTaskCandidateDeptMemberStrategy implements BpmTaskCandidateStrategy { @Resource private DeptApi deptApi; @Resource private AdminUserApi adminUserApi; @Override public BpmTaskCandidateStrategyEnum getStrategy() { return BpmTaskCandidateStrategyEnum.DEPT_MEMBER; } @Override public void validateParam(String param) { Set deptIds = StrUtils.splitToLongSet(param); deptApi.validateDeptList(deptIds).checkError(); } @Override public Set calculateUsers(String param) { Set deptIds = StrUtils.splitToLongSet(param); List users = adminUserApi.getUserListByDeptIds(deptIds).getCheckedData(); return convertSet(users, AdminUserRespDTO::getId); } }