You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.6 KiB
Java
53 lines
1.6 KiB
Java
3 years ago
|
package com.engine.organization.util.detach;
|
||
|
|
||
|
import com.engine.organization.entity.company.po.CompPO;
|
||
|
import com.engine.organization.entity.department.po.DepartmentPO;
|
||
|
import com.engine.organization.entity.job.po.JobPO;
|
||
|
import com.engine.organization.service.impl.ManagerDetachServiceImpl;
|
||
|
import org.apache.commons.collections.CollectionUtils;
|
||
|
|
||
|
import java.util.List;
|
||
|
|
||
|
/**
|
||
|
* @author:dxfeng
|
||
|
* @createTime: 2022/10/28
|
||
|
* @version: 1.0
|
||
|
*/
|
||
|
public class DetachUtil {
|
||
|
// private static final boolean IS_DETACH = "true".equals(new BaseBean().getPropValue("", ""));
|
||
|
private boolean IS_DETACH = true;
|
||
|
|
||
|
private static List<Long> ecRoleLevels = null;
|
||
|
|
||
|
public DetachUtil(Integer uId) {
|
||
|
ecRoleLevels = ManagerDetachServiceImpl.getJclRoleLevels(uId);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 根据分权配置过滤分部
|
||
|
*/
|
||
|
public void filterCompanyList(List<CompPO> companyList) {
|
||
|
if (IS_DETACH && CollectionUtils.isNotEmpty(companyList)) {
|
||
|
companyList.removeIf(item -> !ecRoleLevels.contains(item.getId()));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 根据分权配置过滤分部
|
||
|
*/
|
||
|
public void filterDepartmentList(List<DepartmentPO> departmentList) {
|
||
|
if (IS_DETACH && CollectionUtils.isNotEmpty(departmentList)) {
|
||
|
departmentList.removeIf(item -> !ecRoleLevels.contains(item.getParentComp()));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 根据分权配置过滤分部
|
||
|
*/
|
||
|
public void filterJobList(List<JobPO> jobList) {
|
||
|
if (IS_DETACH && CollectionUtils.isNotEmpty(jobList)) {
|
||
|
jobList.removeIf(item -> !ecRoleLevels.contains(item.getParentComp()));
|
||
|
}
|
||
|
}
|
||
|
}
|