|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package com.engine.organization.service.impl;
|
|
|
|
|
|
|
|
|
|
import com.api.browser.bean.SearchConditionItem;
|
|
|
|
|
import com.engine.core.impl.Service;
|
|
|
|
|
import com.engine.organization.entity.DeleteParam;
|
|
|
|
|
import com.engine.organization.entity.company.bo.CompBO;
|
|
|
|
@ -24,6 +25,7 @@ import com.engine.organization.mapper.resource.HrmResourceMapper;
|
|
|
|
|
import com.engine.organization.service.PersonnelResumeService;
|
|
|
|
|
import com.engine.organization.util.MenuBtn;
|
|
|
|
|
import com.engine.organization.util.OrganizationAssert;
|
|
|
|
|
import com.engine.organization.util.OrganizationFormItemUtil;
|
|
|
|
|
import com.engine.organization.util.db.MapperProxyFactory;
|
|
|
|
|
import com.engine.organization.util.detach.DetachUtil;
|
|
|
|
|
import com.engine.organization.util.page.PageUtil;
|
|
|
|
@ -61,11 +63,16 @@ public class PersonnelResumeServiceImpl extends Service implements PersonnelResu
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> getSearchTree(SearchTreeParams params) {
|
|
|
|
|
String keyword = params.getKeyword();
|
|
|
|
|
String id = params.getId();
|
|
|
|
|
String type = Util.null2String(params.getType());
|
|
|
|
|
List<SearchTree> treeList = getFilterDatas(id, type, keyword);
|
|
|
|
|
return SearchTreeUtil.getSearchTree(type, treeList);
|
|
|
|
|
// 查询所有满足条件的人员ID、根据人员向上查找对应的组织架构
|
|
|
|
|
List<ResourcePO> resourcePOList = null;
|
|
|
|
|
if (CollectionUtils.isNotEmpty(params.getSubcompanyid1()) || CollectionUtils.isNotEmpty(params.getDepartmentid()) || CollectionUtils.isNotEmpty(params.getJobId()) || CollectionUtils.isNotEmpty(params.getResourceId())) {
|
|
|
|
|
params.setPersonnelScreening(true);
|
|
|
|
|
// 人员筛选
|
|
|
|
|
resourcePOList = getHrmResourceMapper().getPersonnelScreening(params.getSubcompanyid1(), params.getDepartmentid(), params.getJobId(), params.getResourceId());
|
|
|
|
|
resourcePOList.removeIf(item->!item.getLastName().contains(params.getKeyword()));
|
|
|
|
|
}
|
|
|
|
|
List<SearchTree> treeList = getFilterDatas(params, resourcePOList);
|
|
|
|
|
return SearchTreeUtil.getSearchTree(Util.null2String(params.getType()), treeList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -165,29 +172,66 @@ public class PersonnelResumeServiceImpl extends Service implements PersonnelResu
|
|
|
|
|
return resultMap;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<SearchTree> getFilterDatas(String id, String type, String keyword) {
|
|
|
|
|
@Override
|
|
|
|
|
public List<SearchConditionItem> personnelScreening() {
|
|
|
|
|
List<SearchConditionItem> items = new ArrayList<>();
|
|
|
|
|
// 所属分部
|
|
|
|
|
SearchConditionItem companyItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "分部", "194", "subcompanyid1", "");
|
|
|
|
|
// 所属部门
|
|
|
|
|
SearchConditionItem departmentItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "部门", "57", "departmentid", "");
|
|
|
|
|
|
|
|
|
|
SearchConditionItem jobItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "岗位", "666", "jobId", "");
|
|
|
|
|
|
|
|
|
|
SearchConditionItem resourceItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "人员", "17", "resourceId", "");
|
|
|
|
|
items.add(companyItem);
|
|
|
|
|
items.add(departmentItem);
|
|
|
|
|
items.add(jobItem);
|
|
|
|
|
items.add(resourceItem);
|
|
|
|
|
return items;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<SearchTree> getFilterDatas(SearchTreeParams params, List<ResourcePO> resourcePOList) {
|
|
|
|
|
String keyword = params.getKeyword();
|
|
|
|
|
String id = params.getId();
|
|
|
|
|
String type = Util.null2String(params.getType());
|
|
|
|
|
|
|
|
|
|
List<SearchTree> searchTree = new ArrayList<>();
|
|
|
|
|
// 通过分部、公司 组装数据
|
|
|
|
|
if (StringUtil.isEmpty(id) || ModuleTypeEnum.subcompanyfielddefined.getValue().toString().equals(type)) {
|
|
|
|
|
Integer subCompanyId1 = StringUtil.isEmpty(id) ? null : Integer.parseInt(id);
|
|
|
|
|
if (params.isPersonnelScreening()) {
|
|
|
|
|
new DetachUtil(user).filterResourceList(resourcePOList);
|
|
|
|
|
if (null != subCompanyId1) {
|
|
|
|
|
resourcePOList.removeIf(item -> !subCompanyId1.equals(item.getSubcompanyid1()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
DepartmentPO departmentBuild = DepartmentPO.builder().departmentName(keyword).subCompanyId1(subCompanyId1).canceled(0).build();
|
|
|
|
|
CompPO compBuild = CompPO.builder().subCompanyName(keyword).supSubComId(subCompanyId1).canceled(0).build();
|
|
|
|
|
// 所属分部下的岗位
|
|
|
|
|
JobPO jobBuild = JobPO.builder().jobTitleName(keyword).ecCompany(subCompanyId1).forbiddenTag(0).build();
|
|
|
|
|
ResourcePO resourcePO = ResourcePO.builder().lastName(keyword).subcompanyid1(subCompanyId1).build();
|
|
|
|
|
searchTree = buildTreeByCompAndDept(departmentBuild, compBuild, jobBuild, resourcePO);
|
|
|
|
|
searchTree = buildTreeByCompAndDept(params, resourcePOList, departmentBuild, compBuild, jobBuild, resourcePO);
|
|
|
|
|
} else if (ModuleTypeEnum.departmentfielddefined.getValue().toString().equals(type)) {
|
|
|
|
|
Integer departmentId = Integer.parseInt(id);
|
|
|
|
|
if (null != resourcePOList) {
|
|
|
|
|
new DetachUtil(user).filterResourceList(resourcePOList);
|
|
|
|
|
resourcePOList.removeIf(item -> !departmentId.equals(item.getDepartmentid()));
|
|
|
|
|
}
|
|
|
|
|
DepartmentPO departmentBuild = DepartmentPO.builder().departmentName(keyword).supDepId(departmentId).canceled(0).build();
|
|
|
|
|
// 所属分部下的岗位
|
|
|
|
|
JobPO jobBuild = JobPO.builder().jobTitleName(keyword).ecDepartment(departmentId).forbiddenTag(0).build();
|
|
|
|
|
ResourcePO resourcePO = ResourcePO.builder().lastName(keyword).departmentid(departmentId).build();
|
|
|
|
|
|
|
|
|
|
searchTree = buildTreeByDeptAndJob(departmentBuild, jobBuild, resourcePO);
|
|
|
|
|
searchTree = buildTreeByDeptAndJob(params, resourcePOList, departmentBuild, jobBuild, resourcePO);
|
|
|
|
|
|
|
|
|
|
} else if (ModuleTypeEnum.jobfielddefined.getValue().toString().equals(type)) {
|
|
|
|
|
Long jobId = Long.parseLong(id);
|
|
|
|
|
JobPO jobById = getJobMapper().getJobById(jobId);
|
|
|
|
|
if (null != resourcePOList) {
|
|
|
|
|
new DetachUtil(user).filterResourceList(resourcePOList);
|
|
|
|
|
resourcePOList.removeIf(item -> !(jobById.getEcCompany().equals(item.getSubcompanyid1()) && jobById.getEcDepartment().equals(item.getDepartmentid())) && jobById.getEcJobTitle().equals(item.getJobtitle()));
|
|
|
|
|
return SearchTreeUtil.builderTreeMode(ResourceBO.buildSetToSearchTree(resourcePOList));
|
|
|
|
|
}
|
|
|
|
|
ResourcePO resourcePO = ResourcePO.builder().lastName(keyword).subcompanyid1(jobById.getEcCompany()).departmentid(jobById.getEcDepartment()).jobtitle(jobById.getEcJobTitle()).build();
|
|
|
|
|
List<ResourcePO> resourcePOS = getHrmResourceMapper().listByFilter(resourcePO);
|
|
|
|
|
searchTree = SearchTreeUtil.builderTreeMode(ResourceBO.buildSetToSearchTree(resourcePOS));
|
|
|
|
@ -203,9 +247,14 @@ public class PersonnelResumeServiceImpl extends Service implements PersonnelResu
|
|
|
|
|
* @param jobBuild
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private List<SearchTree> buildTreeByCompAndDept(DepartmentPO departmentBuild, CompPO compBuild, JobPO jobBuild, ResourcePO resourcePO) {
|
|
|
|
|
private List<SearchTree> buildTreeByCompAndDept(SearchTreeParams params, List<ResourcePO> resourcePOList, DepartmentPO departmentBuild, CompPO compBuild, JobPO jobBuild, ResourcePO resourcePO) {
|
|
|
|
|
// 查询人员数据
|
|
|
|
|
List<ResourcePO> resourcePOS = getHrmResourceMapper().listByFilter(resourcePO);
|
|
|
|
|
List<ResourcePO> resourcePOS;
|
|
|
|
|
if (params.isPersonnelScreening()) {
|
|
|
|
|
resourcePOS = resourcePOList;
|
|
|
|
|
} else {
|
|
|
|
|
resourcePOS = getHrmResourceMapper().listByFilter(resourcePO);
|
|
|
|
|
}
|
|
|
|
|
Set<JobPO> builderJobs = new HashSet<>();
|
|
|
|
|
|
|
|
|
|
// 补充人员所有岗位,关联人员及聚才林岗位
|
|
|
|
@ -220,8 +269,15 @@ public class PersonnelResumeServiceImpl extends Service implements PersonnelResu
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<JobPO> jobPOS = getJobMapper().listPOsByFilter(jobBuild);
|
|
|
|
|
if (params.isPersonnelScreening()) {
|
|
|
|
|
jobPOS.removeIf(item -> !params.getJobId().contains(item.getId()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
new DetachUtil(user).filterJobList(jobPOS);
|
|
|
|
|
List<DepartmentPO> filterDeparts = getDepartmentMapper().listByFilter(departmentBuild, "showorder");
|
|
|
|
|
if (params.isPersonnelScreening()) {
|
|
|
|
|
filterDeparts.removeIf(item -> !params.getDepartmentid().contains(item.getId()));
|
|
|
|
|
}
|
|
|
|
|
new DetachUtil(user).filterDepartmentList(filterDeparts);
|
|
|
|
|
// 添加父级岗位
|
|
|
|
|
builderJobs.addAll(jobPOS);
|
|
|
|
@ -242,12 +298,17 @@ public class PersonnelResumeServiceImpl extends Service implements PersonnelResu
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(departmentsByIds)) {
|
|
|
|
|
departmentsByIds.removeIf(item -> item.getCanceled() != null && item.getCanceled() != 0);
|
|
|
|
|
filterDeparts.addAll(departmentsByIds);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 查询分部信息
|
|
|
|
|
List<CompPO> filterComps = getCompMapper().listByFilter(compBuild, "showorder");
|
|
|
|
|
if (params.isPersonnelScreening()) {
|
|
|
|
|
filterComps.removeIf(item -> !params.getSubcompanyid1().contains(item.getId()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
new DetachUtil(user).filterCompanyList(filterComps);
|
|
|
|
|
Set<DepartmentPO> builderDeparts = new HashSet<>();
|
|
|
|
|
for (DepartmentPO departmentPO : filterDeparts) {
|
|
|
|
@ -274,9 +335,14 @@ public class PersonnelResumeServiceImpl extends Service implements PersonnelResu
|
|
|
|
|
return SearchTreeUtil.builderTreeMode(CompBO.buildSetToSearchTree(builderComps), searchTrees);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<SearchTree> buildTreeByDeptAndJob(DepartmentPO departmentBuild, JobPO jobBuild, ResourcePO resourcePO) {
|
|
|
|
|
private List<SearchTree> buildTreeByDeptAndJob(SearchTreeParams params, List<ResourcePO> resourcePOList, DepartmentPO departmentBuild, JobPO jobBuild, ResourcePO resourcePO) {
|
|
|
|
|
// 查询人员数据
|
|
|
|
|
List<ResourcePO> resourcePOS = getHrmResourceMapper().listByFilter(resourcePO);
|
|
|
|
|
List<ResourcePO> resourcePOS;
|
|
|
|
|
if (params.isPersonnelScreening()) {
|
|
|
|
|
resourcePOS = resourcePOList;
|
|
|
|
|
} else {
|
|
|
|
|
resourcePOS = getHrmResourceMapper().listByFilter(resourcePO);
|
|
|
|
|
}
|
|
|
|
|
Set<JobPO> builderJobs = new HashSet<>();
|
|
|
|
|
|
|
|
|
|
// 补充人员所有岗位,关联人员及聚才林岗位
|
|
|
|
@ -290,7 +356,14 @@ public class PersonnelResumeServiceImpl extends Service implements PersonnelResu
|
|
|
|
|
List<SearchTree> resourceTrees = SearchTreeUtil.builderTreeMode(ResourceBO.buildSetToSearchTree(resourcePOS));
|
|
|
|
|
|
|
|
|
|
List<JobPO> jobPOS = getJobMapper().listPOsByFilter(jobBuild);
|
|
|
|
|
if (params.isPersonnelScreening()) {
|
|
|
|
|
jobPOS.removeIf(item -> !params.getJobId().contains(item.getId()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<DepartmentPO> filterDeparts = getDepartmentMapper().listByFilter(departmentBuild, "showorder");
|
|
|
|
|
if (params.isPersonnelScreening()) {
|
|
|
|
|
filterDeparts.removeIf(item -> !params.getDepartmentid().contains(item.getId()));
|
|
|
|
|
}
|
|
|
|
|
// 添加父级岗位
|
|
|
|
|
builderJobs.addAll(jobPOS);
|
|
|
|
|
// 添加岗位的上级部门或分部
|
|
|
|
@ -309,6 +382,7 @@ public class PersonnelResumeServiceImpl extends Service implements PersonnelResu
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(departmentsByIds)) {
|
|
|
|
|
departmentsByIds.removeIf(item -> item.getCanceled() != null && item.getCanceled() != 0);
|
|
|
|
|
filterDeparts.addAll(departmentsByIds);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -321,7 +395,6 @@ public class PersonnelResumeServiceImpl extends Service implements PersonnelResu
|
|
|
|
|
return SearchTreeUtil.builderTreeMode(DepartmentBO.buildSetToSearchTree(builderDeparts), jobTrees);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 添加查询元素的父级元素
|
|
|
|
|
*
|
|
|
|
@ -346,6 +419,9 @@ public class PersonnelResumeServiceImpl extends Service implements PersonnelResu
|
|
|
|
|
* @param builderComps
|
|
|
|
|
*/
|
|
|
|
|
private void buildParentComps(CompPO compPO, Set<CompPO> builderComps, Map<Integer, CompPO> allMaps) {
|
|
|
|
|
if (null != compPO.getCanceled() && 0 != compPO.getCanceled()) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
builderComps.add(compPO);
|
|
|
|
|
CompPO parentComp = allMaps.get(compPO.getSupSubComId());
|
|
|
|
|
if (null != parentComp) {
|
|
|
|
|