BUG修复,岗位关联关系调整
This commit is contained in:
parent
837a237ffc
commit
ce2c34cfdd
|
|
@ -128,7 +128,7 @@ public class JobBrowserService extends BrowserService {
|
|||
}
|
||||
}
|
||||
// 分权
|
||||
DetachUtil detachUtil = new DetachUtil(user.getUID());
|
||||
DetachUtil detachUtil = new DetachUtil(user);
|
||||
if (detachUtil.isDETACH()) {
|
||||
sqlWhere += " AND t.parent_comp in (" + detachUtil.getJclRoleLevels() + ")";
|
||||
}
|
||||
|
|
@ -143,7 +143,7 @@ public class JobBrowserService extends BrowserService {
|
|||
*/
|
||||
private List<TreeNode> getCurrentTreeNode(SearchTreeParams params) {
|
||||
// 分权
|
||||
DetachUtil detachUtil = new DetachUtil(user.getUID());
|
||||
DetachUtil detachUtil = new DetachUtil(user);
|
||||
List<Long> jclRoleLevelList;
|
||||
if (StringUtils.isNotBlank(detachUtil.getJclRoleLevels())) {
|
||||
jclRoleLevelList = Arrays.stream(detachUtil.getJclRoleLevels().split(",")).map(Long::parseLong).collect(Collectors.toList());
|
||||
|
|
|
|||
|
|
@ -110,7 +110,10 @@ public class CompBO {
|
|||
// 处理被引用数据
|
||||
List<String> usedIds = getCompMapper().listUsedId();
|
||||
// 兼容MySQL
|
||||
usedIds.addAll(getCompMapper().listUsedIds());
|
||||
List<String> strings = getCompMapper().listUsedIds();
|
||||
if (CollectionUtils.isNotEmpty(strings)) {
|
||||
usedIds.addAll(strings);
|
||||
}
|
||||
List<String> collect = Arrays.stream(String.join(",", usedIds).split(",")).collect(Collectors.toList());
|
||||
Set<Integer> leafs = new HashSet<>();
|
||||
List<CompListDTO> collectTree = dtoList.stream().peek(e -> {
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ public class JobListDTO {
|
|||
//@TableTitle(title = "上级岗位", dataIndex = "parentJobName", key = "parentJobName")
|
||||
private String parentJobName;
|
||||
private Long parentJob;
|
||||
private Integer parentComp;
|
||||
private Integer ecCompany;
|
||||
/**
|
||||
* 是否关键岗
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -74,13 +74,13 @@ public class CompServiceImpl extends Service implements CompService {
|
|||
String orderSql = PageInfoSortUtil.getSortSql(params.getSortParams(), " showorder ");
|
||||
List<CompPO> allList = getCompMapper().listAll(orderSql);
|
||||
|
||||
new DetachUtil(user.getUID()).filterCompanyList(allList);
|
||||
new DetachUtil(user).filterCompanyList(allList);
|
||||
|
||||
// 通过子级遍历父级元素
|
||||
if (filter) {
|
||||
// 根据条件获取元素
|
||||
List<CompPO> filterCompPOs = getCompMapper().listByFilter(companyPO, orderSql);
|
||||
new DetachUtil(user.getUID()).filterCompanyList(filterCompPOs);
|
||||
new DetachUtil(user).filterCompanyList(filterCompPOs);
|
||||
|
||||
// 添加父级元素
|
||||
List<CompListDTO> compListDTOS = CompBO.buildCompDTOList(allList, filterCompPOs);
|
||||
|
|
|
|||
|
|
@ -133,12 +133,12 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
PageInfo<DepartmentListDTO> pageInfos;
|
||||
String orderSql = PageInfoSortUtil.getSortSql(param.getSortParams(), " showorder ");
|
||||
List<DepartmentPO> allList = getDepartmentMapper().listAll(orderSql);
|
||||
new DetachUtil(user.getUID()).filterDepartmentList(allList);
|
||||
new DetachUtil(user).filterDepartmentList(allList);
|
||||
// 通过子级遍历父级元素
|
||||
if (filter) {
|
||||
// 根据条件获取元素
|
||||
List<DepartmentPO> filterDeptPOs = getDepartmentMapper().listByFilter(departmentPO, orderSql);
|
||||
new DetachUtil(user.getUID()).filterDepartmentList(filterDeptPOs);
|
||||
new DetachUtil(user).filterDepartmentList(filterDeptPOs);
|
||||
// 添加父级元素
|
||||
List<DepartmentListDTO> compListDTOS = DepartmentBO.buildDeptDTOList(allList, filterDeptPOs);
|
||||
List<DepartmentListDTO> subList = PageUtil.subList(param.getCurrent(), param.getPageSize(), compListDTOS);
|
||||
|
|
@ -705,9 +705,9 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
|
|||
Integer parentCompId = StringUtil.isEmpty(id) ? null : Integer.parseInt(id);
|
||||
CompPO compBuild = CompPO.builder().subCompanyName(keyword).supSubComId(parentCompId).canceled(0).build();
|
||||
List<CompPO> allCompanys = getCompMapper().listAll("showOrder");
|
||||
new DetachUtil(user.getUID()).filterCompanyList(allCompanys);
|
||||
new DetachUtil(user).filterCompanyList(allCompanys);
|
||||
List<CompPO> filterComps = getCompMapper().listByFilter(compBuild, "showOrder");
|
||||
new DetachUtil(user.getUID()).filterCompanyList(filterComps);
|
||||
new DetachUtil(user).filterCompanyList(filterComps);
|
||||
|
||||
Map<Integer, CompPO> allMaps = allCompanys.stream().collect(Collectors.toMap(CompPO::getId, item -> item, (k1, k2) -> k1));
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ public class ExportCommonServiceImpl extends Service implements ExportCommonServ
|
|||
public XSSFWorkbook resourceExport(List<Long> ids) {
|
||||
|
||||
List<HrmResourceVO> hrmResourceVOS ;
|
||||
DetachUtil detachUtil = new DetachUtil(user.getUID());
|
||||
DetachUtil detachUtil = new DetachUtil(user);
|
||||
if (detachUtil.isDETACH()) {
|
||||
if (StringUtils.isBlank(detachUtil.getJclRoleLevels())) {
|
||||
hrmResourceVOS = new ArrayList<>();
|
||||
|
|
|
|||
|
|
@ -473,7 +473,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
}
|
||||
|
||||
// 分权查询
|
||||
DetachUtil detachUtil = new DetachUtil(user.getUID());
|
||||
DetachUtil detachUtil = new DetachUtil(user);
|
||||
String parentCompanyIds = detachUtil.getJclRoleLevels();
|
||||
if (detachUtil.isDETACH()) {
|
||||
sqlWhere += " And t.subcompanyid1 in(" + parentCompanyIds + ")";
|
||||
|
|
@ -521,9 +521,9 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
*/
|
||||
private List<SearchTree> buildTreeByCompAndDept(DepartmentPO departmentBuild, CompPO compBuild, JobPO jobBuild) {
|
||||
List<JobPO> jobPOS = getJobMapper().listPOsByFilter(jobBuild);
|
||||
new DetachUtil(user.getUID()).filterJobList(jobPOS);
|
||||
new DetachUtil(user).filterJobList(jobPOS);
|
||||
List<DepartmentPO> filterDeparts = getDepartmentMapper().listByFilter(departmentBuild, "showorder");
|
||||
new DetachUtil(user.getUID()).filterDepartmentList(filterDeparts);
|
||||
new DetachUtil(user).filterDepartmentList(filterDeparts);
|
||||
// 添加父级岗位
|
||||
Set<JobPO> builderJobs = new HashSet<>();
|
||||
for (JobPO jobPO : jobPOS) {
|
||||
|
|
@ -553,7 +553,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
|
||||
// 查询分部信息
|
||||
List<CompPO> filterComps = getCompMapper().listByFilter(compBuild, "showorder");
|
||||
new DetachUtil(user.getUID()).filterCompanyList(filterComps);
|
||||
new DetachUtil(user).filterCompanyList(filterComps);
|
||||
Set<DepartmentPO> builderDeparts = new HashSet<>();
|
||||
for (DepartmentPO departmentPO : filterDeparts) {
|
||||
buildParentDepts(departmentPO, builderDeparts);
|
||||
|
|
@ -570,7 +570,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
}
|
||||
}
|
||||
List<CompPO> allCompanys = getCompMapper().listAll("showorder");
|
||||
new DetachUtil(user.getUID()).filterCompanyList(allCompanys);
|
||||
new DetachUtil(user).filterCompanyList(allCompanys);
|
||||
Map<Integer, CompPO> allMaps = allCompanys.stream().collect(Collectors.toMap(CompPO::getId, item -> item, (k1, k2) -> k1));
|
||||
Set<CompPO> builderComps = new HashSet<>();
|
||||
for (CompPO compPO : filterComps) {
|
||||
|
|
|
|||
|
|
@ -156,12 +156,12 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
PageInfo<JobListDTO> pageInfos;
|
||||
String orderSql = PageInfoSortUtil.getSortSql(param.getSortParams(), " show_order ");
|
||||
List<JobListDTO> allList = getJobMapper().listNoFilter(orderSql);
|
||||
new DetachUtil(user.getUID()).filterJobDTOList(allList);
|
||||
new DetachUtil(user).filterJobDTOList(allList);
|
||||
// 通过子级遍历父级元素
|
||||
if (filter) {
|
||||
// 根据条件获取元素
|
||||
List<JobListDTO> filterJobPOs = getJobMapper().listByFilter(jobPO, orderSql);
|
||||
new DetachUtil(user.getUID()).filterJobDTOList(allList);
|
||||
new DetachUtil(user).filterJobDTOList(allList);
|
||||
// 添加父级元素
|
||||
List<JobListDTO> jobListDTOS = JobBO.buildJobDTOList(allList, filterJobPOs);
|
||||
List<JobListDTO> subList = PageUtil.subList(param.getCurrent(), param.getPageSize(), jobListDTOS);
|
||||
|
|
@ -661,10 +661,10 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
*/
|
||||
private List<SearchTree> buildTreeByCompAndDept(DepartmentPO departmentBuild, CompPO compBuild) {
|
||||
List<DepartmentPO> filterDeparts = getDepartmentMapper().listByFilter(departmentBuild, "showorder");
|
||||
new DetachUtil(user.getUID()).filterDepartmentList(filterDeparts);
|
||||
new DetachUtil(user).filterDepartmentList(filterDeparts);
|
||||
// 查询分部信息
|
||||
List<CompPO> filterComps = getCompMapper().listByFilter(compBuild, "showorder");
|
||||
new DetachUtil(user.getUID()).filterCompanyList(filterComps);
|
||||
new DetachUtil(user).filterCompanyList(filterComps);
|
||||
Set<DepartmentPO> builderDeparts = new HashSet<>();
|
||||
for (DepartmentPO departmentPO : filterDeparts) {
|
||||
buildParentDepts(departmentPO, builderDeparts);
|
||||
|
|
@ -679,7 +679,7 @@ public class JobServiceImpl extends Service implements JobService {
|
|||
}
|
||||
}
|
||||
List<CompPO> allCompanys = getCompMapper().listAll("showorder");
|
||||
new DetachUtil(user.getUID()).filterCompanyList(allCompanys);
|
||||
new DetachUtil(user).filterCompanyList(allCompanys);
|
||||
Map<Integer, CompPO> allMaps = allCompanys.stream().collect(Collectors.toMap(CompPO::getId, item -> item, (k1, k2) -> k1));
|
||||
Set<CompPO> builderComps = new HashSet<>();
|
||||
for (CompPO compPO : filterComps) {
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
String sql = "select id, fnumber, fname, ftype from jcl_org_map where ftype in (0, 1) ";
|
||||
|
||||
// 分部分权过滤
|
||||
DetachUtil detachUtil = new DetachUtil(user.getUID());
|
||||
DetachUtil detachUtil = new DetachUtil(user);
|
||||
if (detachUtil.isDETACH()) {
|
||||
String jclRoleLevels = detachUtil.getJclRoleLevels();
|
||||
if (StringUtils.isNotBlank(jclRoleLevels)) {
|
||||
|
|
@ -165,7 +165,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
|
||||
private void findCompanyItemByParantId(String id, int currentLevel, String level, RecordSet rs, List<Map<String, Object>> list, String whereSql, boolean expand) {
|
||||
String sql = "select id, fname, ftype, fparentid,fobjid,fecid,fnumber,fisvitual from jcl_org_map " + whereSql;
|
||||
DetachUtil detachUtil = new DetachUtil(user.getUID());
|
||||
DetachUtil detachUtil = new DetachUtil(user);
|
||||
if (detachUtil.isDETACH()) {
|
||||
if ("0".equals(id)) {
|
||||
sql += " and ftype = 1 and fobjid in(" + detachUtil.getJclRoleLevels() + ")";
|
||||
|
|
@ -373,7 +373,7 @@ public class OrgChartServiceImpl extends Service implements OrgChartService {
|
|||
|
||||
private void findUserItemByParantId(String id, int currentLevel, String level, RecordSet rs, List<Map<String, Object>> list, String whereSql, boolean expand) {
|
||||
String sql = "select t.id, t.fname, t.ftype, t.fparentid, t.fobjparentid, t.fleader, t.fleadername, t.fleaderimg, t.fleaderjob, t.fplan, t.fonjob, t.fnumber, t.fobjid, t.fecid, t.fleaderlv, t.fleaderst, t.fisvitual from jcl_org_map t " + whereSql;
|
||||
DetachUtil detachUtil = new DetachUtil(user.getUID());
|
||||
DetachUtil detachUtil = new DetachUtil(user);
|
||||
if (detachUtil.isDETACH()) {
|
||||
if ("0".equals(id)) {
|
||||
sql += " and t.ftype = 1 and t.fobjid in(" + detachUtil.getJclRoleLevels() + ")";
|
||||
|
|
|
|||
|
|
@ -4,13 +4,15 @@ 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 org.apache.commons.lang3.StringUtils;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.moduledetach.ManageDetachComInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
|
|
@ -18,18 +20,21 @@ import java.util.List;
|
|||
* @version: 1.0
|
||||
*/
|
||||
public class DetachUtil {
|
||||
private boolean DETACH = "true".equals(new BaseBean().getPropValue("hrmOrganization", "detach"));
|
||||
private boolean DETACH;
|
||||
|
||||
private final List<Integer> jclRoleLevels;
|
||||
private List<Integer> jclRoleLevels = new ArrayList<>();
|
||||
|
||||
public DetachUtil(Integer uId) {
|
||||
if (1 == uId) {
|
||||
public DetachUtil(User user) {
|
||||
ManageDetachComInfo manageDetachComInfo = new ManageDetachComInfo();
|
||||
DETACH = manageDetachComInfo.isUseManageDetach();
|
||||
if (1 == user.getUID()) {
|
||||
DETACH = false;
|
||||
}
|
||||
if (DETACH) {
|
||||
jclRoleLevels = ManagerDetachServiceImpl.getJclRoleLevels(uId);
|
||||
} else {
|
||||
jclRoleLevels = new ArrayList<>();
|
||||
String detachableSubCompanyIds = manageDetachComInfo.getDetachableSubcompanyIds(user);
|
||||
if (StringUtils.isNotBlank(detachableSubCompanyIds)) {
|
||||
jclRoleLevels = Stream.of(detachableSubCompanyIds.split(",")).map(Integer::parseInt).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -56,7 +61,7 @@ public class DetachUtil {
|
|||
*/
|
||||
public void filterJobDTOList(List<JobListDTO> jobList) {
|
||||
if (DETACH && CollectionUtils.isNotEmpty(jobList)) {
|
||||
jobList.removeIf(item -> !jclRoleLevels.contains(item.getParentComp()));
|
||||
jobList.removeIf(item -> !jclRoleLevels.contains(item.getEcCompany()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue