|
|
|
@ -55,6 +55,7 @@ import com.engine.organization.util.OrganizationFormItemUtil;
|
|
|
|
|
import com.engine.organization.util.coderule.CodeRuleUtil;
|
|
|
|
|
import com.engine.organization.util.db.DBType;
|
|
|
|
|
import com.engine.organization.util.db.MapperProxyFactory;
|
|
|
|
|
import com.engine.organization.util.detach.DetachUtil;
|
|
|
|
|
import com.engine.organization.util.page.PageUtil;
|
|
|
|
|
import com.engine.organization.util.tree.SearchTreeUtil;
|
|
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
|
@ -520,6 +521,13 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|
|
|
|
sqlWhere += " AND t.job_title = '" + jobTitle + "'";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 分权查询
|
|
|
|
|
List<Long> jclRoleLevels = new DetachUtil(user.getUID()).getJclRoleLevels();
|
|
|
|
|
String parentCompanyIds = StringUtils.join(jclRoleLevels, ",");
|
|
|
|
|
if (StringUtils.isNotBlank(parentCompanyIds)) {
|
|
|
|
|
sqlWhere += " And t.company_id in(" + parentCompanyIds + ")";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return sqlWhere;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -562,7 +570,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);
|
|
|
|
|
List<DepartmentPO> filterDeparts = getDepartmentMapper().listByFilter(departmentBuild, "show_order");
|
|
|
|
|
new DetachUtil(user.getUID()).filterDepartmentList(filterDeparts);
|
|
|
|
|
// 添加父级岗位
|
|
|
|
|
Set<JobPO> builderJobs = new HashSet<>();
|
|
|
|
|
for (JobPO jobPO : jobPOS) {
|
|
|
|
@ -592,6 +602,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|
|
|
|
|
|
|
|
|
// 查询分部信息
|
|
|
|
|
List<CompPO> filterComps = getCompMapper().listByFilter(compBuild, "show_order");
|
|
|
|
|
new DetachUtil(user.getUID()).filterCompanyList(filterComps);
|
|
|
|
|
Set<DepartmentPO> builderDeparts = new HashSet<>();
|
|
|
|
|
for (DepartmentPO departmentPO : filterDeparts) {
|
|
|
|
|
buildParentDepts(departmentPO, builderDeparts);
|
|
|
|
@ -607,9 +618,12 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|
|
|
|
filterComps.addAll(compsByIds);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
List<CompPO> allCompanys = getCompMapper().list("show_order");
|
|
|
|
|
new DetachUtil(user.getUID()).filterCompanyList(allCompanys);
|
|
|
|
|
Map<Long, CompPO> allMaps = allCompanys.stream().collect(Collectors.toMap(CompPO::getId, item -> item, (k1, k2) -> k1));
|
|
|
|
|
Set<CompPO> builderComps = new HashSet<>();
|
|
|
|
|
for (CompPO compPO : filterComps) {
|
|
|
|
|
buildParentComps(compPO, builderComps);
|
|
|
|
|
buildParentComps(compPO, builderComps,allMaps);
|
|
|
|
|
}
|
|
|
|
|
return SearchTreeUtil.builderTreeMode(CompBO.buildSetToSearchTree(builderComps), searchTrees);
|
|
|
|
|
}
|
|
|
|
@ -684,14 +698,11 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|
|
|
|
* @param compPO
|
|
|
|
|
* @param builderComps
|
|
|
|
|
*/
|
|
|
|
|
private void buildParentComps(CompPO compPO, Set<CompPO> builderComps) {
|
|
|
|
|
private void buildParentComps(CompPO compPO, Set<CompPO> builderComps,Map<Long, CompPO> allMaps) {
|
|
|
|
|
builderComps.add(compPO);
|
|
|
|
|
if (SearchTreeUtil.isTop(compPO.getParentCompany())) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
CompPO parentComp = getCompMapper().listById(compPO.getParentCompany());
|
|
|
|
|
CompPO parentComp = allMaps.get(compPO.getParentCompany());
|
|
|
|
|
if (null != parentComp) {
|
|
|
|
|
buildParentComps(parentComp, builderComps);
|
|
|
|
|
buildParentComps(parentComp, builderComps,allMaps);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|