Merge pull request '分部、部门、岗位、人员 分权功能开发' (#32) from feature/dxf into develop
Reviewed-on: #32pull/34/head
commit
796487941c
@ -0,0 +1,74 @@
|
||||
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.dto.JobListDTO;
|
||||
import com.engine.organization.entity.job.po.JobPO;
|
||||
import com.engine.organization.service.impl.ManagerDetachServiceImpl;
|
||||
import com.weaver.general.BaseBean;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/10/28
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class DetachUtil {
|
||||
private boolean IS_DETACH = "true".equals(new BaseBean().getPropValue("hrmOrganization", "detach"));
|
||||
|
||||
private final List<Long> jclRoleLevels;
|
||||
|
||||
public DetachUtil(Integer uId) {
|
||||
if (1 == uId) {
|
||||
IS_DETACH = false;
|
||||
}
|
||||
if (IS_DETACH) {
|
||||
jclRoleLevels = ManagerDetachServiceImpl.getJclRoleLevels(uId);
|
||||
} else {
|
||||
jclRoleLevels = new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据分权配置过滤分部
|
||||
*/
|
||||
public void filterCompanyList(List<CompPO> companyList) {
|
||||
if (IS_DETACH && CollectionUtils.isNotEmpty(companyList)) {
|
||||
companyList.removeIf(item -> !jclRoleLevels.contains(item.getId()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据分权配置过滤分部
|
||||
*/
|
||||
public void filterDepartmentList(List<DepartmentPO> departmentList) {
|
||||
if (IS_DETACH && CollectionUtils.isNotEmpty(departmentList)) {
|
||||
departmentList.removeIf(item -> !jclRoleLevels.contains(item.getParentComp()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据分权配置过滤分部
|
||||
*/
|
||||
public void filterJobDTOList(List<JobListDTO> jobList) {
|
||||
if (IS_DETACH && CollectionUtils.isNotEmpty(jobList)) {
|
||||
jobList.removeIf(item -> !jclRoleLevels.contains(item.getParentComp()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据分权配置过滤分部
|
||||
*/
|
||||
public void filterJobList(List<JobPO> jobList) {
|
||||
if (IS_DETACH && CollectionUtils.isNotEmpty(jobList)) {
|
||||
jobList.removeIf(item -> !jclRoleLevels.contains(item.getParentComp()));
|
||||
}
|
||||
}
|
||||
|
||||
public List<Long> getJclRoleLevels() {
|
||||
return jclRoleLevels;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue