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.dept.dto.DeptRespDTO; 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 BpmTaskCandidateDeptLeaderStrategy implements BpmTaskCandidateStrategy { @Resource private DeptApi deptApi; @Override public BpmTaskCandidateStrategyEnum getStrategy() { return BpmTaskCandidateStrategyEnum.DEPT_LEADER; } @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 depts = deptApi.getDeptList(deptIds).getCheckedData(); return convertSet(depts, DeptRespDTO::getLeaderUserId); } }