Merge pull request '人员筛选接口开发、调整' (#121) from feature/dxf into develop

Reviewed-on: #121
pull/123/head^2
dxfeng 2 years ago
commit 9adce8b045

@ -1,6 +1,12 @@
package com.engine.organization.entity.searchtree;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
* @description:
@ -26,5 +32,38 @@ public class SearchTreeParams {
private String virtualCompanyid;
private String isLoadSubDepartment;
// 人员筛选,添加分部、部门、岗位、人员搜索条件
private String subcompanyid1;
private String departmentid;
private String jobId;
private String resourceId;
private boolean personnelScreening;
public List<Integer> getSubcompanyid1() {
if (StringUtils.isBlank(subcompanyid1)) {
return new ArrayList<>();
}
return Arrays.stream(subcompanyid1.split(",")).map(Integer::parseInt).collect(Collectors.toList());
}
public List<Integer> getDepartmentid() {
if (StringUtils.isBlank(departmentid)) {
return new ArrayList<>();
}
return Arrays.stream(departmentid.split(",")).map(Integer::parseInt).collect(Collectors.toList());
}
public List<Long> getJobId() {
if (StringUtils.isBlank(jobId)) {
return new ArrayList<>();
}
return Arrays.stream(jobId.split(",")).map(Long::parseLong).collect(Collectors.toList());
}
public List<Long> getResourceId() {
if (StringUtils.isBlank(resourceId)) {
return new ArrayList<>();
}
return Arrays.stream(resourceId.split(",")).map(Long::parseLong).collect(Collectors.toList());
}
}

@ -23,4 +23,5 @@ public interface HrmResourceMapper {
List<HrmFamilyInfoPO> getHrmFamilyInfoByUser(@Param("resourceId") Integer resourceId);
List<ResourcePO> getPersonnelScreening(@Param("subCompanyIds") List<Integer> subcompanyid1, @Param("departmentIds") List<Integer> departmentid, @Param("jobIds") List<Long> jobId, @Param("resourceIds") List<Long> resourceId);
}

@ -56,6 +56,36 @@
from HrmFamilyInfo
where resourceid = #{resourceId}
</select>
<select id="getPersonnelScreening" resultMap="HrmResourceMap">
select t.id, t.subcompanyid1 , t.departmentid , t.jobtitle , t.lastname , t.dspOrder
from hrmresource t inner join JCL_ORG_JOB a ON a.EC_COMPANY =t.SUBCOMPANYID1 AND a.EC_DEPARTMENT =t.DEPARTMENTID
AND a.EC_JOBTITLE =t.JOBTITLE
where 1 = 1
<if test="subCompanyIds != null and subCompanyIds.size > 0">
AND t.subcompanyid1 IN
<foreach collection="subCompanyIds" open="(" item="subcompanyid1" separator="," close=")">
#{subcompanyid1}
</foreach>
</if>
<if test="departmentIds != null and departmentIds.size > 0">
AND t.departmentid IN
<foreach collection="departmentIds" open="(" item="departmentid" separator="," close=")">
#{departmentid}
</foreach>
</if>
<if test="jobIds != null and jobIds.size > 0">
AND a.id IN
<foreach collection="jobIds" open="(" item="jobId" separator="," close=")">
#{jobId}
</foreach>
</if>
<if test="resourceIds != null and resourceIds.size > 0">
AND t.id IN
<foreach collection="resourceIds" open="(" item="resourceId" separator="," close=")">
#{resourceId}
</foreach>
</if>
</select>
<sql id="likeSql">
<if test="resourcePO.lastName != null and resourcePO.lastName != ''">

@ -1,7 +1,9 @@
package com.engine.organization.service;
import com.api.browser.bean.SearchConditionItem;
import com.engine.organization.entity.searchtree.SearchTreeParams;
import java.util.List;
import java.util.Map;
/**
@ -32,4 +34,6 @@ public interface PersonnelResumeService {
* @return
*/
Map<String, Object> hasRight();
List<SearchConditionItem> personnelScreening();
}

@ -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) {

@ -1,10 +1,12 @@
package com.engine.organization.util;
import com.alibaba.fastjson.JSONObject;
import com.api.browser.bean.BrowserBean;
import com.api.browser.bean.SearchConditionItem;
import com.api.browser.bean.SearchConditionOption;
import com.api.browser.util.ConditionFactory;
import com.api.browser.util.ConditionType;
import com.engine.organization.entity.browser.po.CustomBrowserBean;
import weaver.hrm.User;
import java.util.ArrayList;
@ -182,6 +184,14 @@ public class OrganizationFormItemUtil {
browser.setOtherParams(otherMap);
}
}
if ("666".equals(type)) {
BrowserBean browserBean = browser.getBrowserConditionParam();
String s = JSONObject.toJSONString(browserBean);
CustomBrowserBean customBrowserBean = JSONObject.parseObject(s, CustomBrowserBean.class);
customBrowserBean.setHasLeftTree(true);
customBrowserBean.setLeftToSearchKey("treeKey");
browser.setBrowserConditionParam(customBrowserBean);
}
return browser;
}

@ -2,6 +2,7 @@ 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.hrmresource.po.ResourcePO;
import com.engine.organization.entity.job.dto.JobListDTO;
import com.engine.organization.entity.job.po.JobPO;
import com.engine.organization.service.impl.ManagerDetachServiceImpl;
@ -70,6 +71,12 @@ public class DetachUtil {
}
}
public void filterResourceList(List<ResourcePO> resourcePOS) {
if (DETACH && CollectionUtils.isNotEmpty(resourcePOS)) {
resourcePOS.removeIf(item -> !jclRoleLevels.contains(item.getSubcompanyid1()));
}
}
public String getJclRoleLevels() {
return StringUtils.join(jclRoleLevels, ",");
}

@ -2,6 +2,7 @@ package com.engine.organization.web;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.api.browser.bean.SearchConditionGroup;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.organization.entity.searchtree.SearchTreeParams;
@ -18,6 +19,9 @@ import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
@ -75,4 +79,21 @@ public class PersonnelResumeController {
}
@GET
@Path("/personnelScreening")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult personnelScreening(@Context HttpServletRequest request, @Context HttpServletResponse response) {
try {
User user = HrmUserVarify.getUser(request, response);
Map<String,Object> returnMap = new HashMap<>();
List<SearchConditionGroup> addGroups = new ArrayList<>();
addGroups.add(new SearchConditionGroup("高级搜索条件", true, getPersonnelResumeWrapper(user).personnelScreening()));
returnMap.put("conditions",addGroups);
return ReturnResult.successed(returnMap);
} catch (Exception e) {
return ReturnResult.exceptionHandle(e);
}
}
}

@ -1,5 +1,6 @@
package com.engine.organization.wrapper;
import com.api.browser.bean.SearchConditionItem;
import com.engine.common.util.ServiceUtil;
import com.engine.organization.entity.searchtree.SearchTreeParams;
import com.engine.organization.service.PersonnelResumeService;
@ -7,6 +8,7 @@ import com.engine.organization.service.impl.PersonnelResumeServiceImpl;
import com.engine.organization.util.OrganizationWrapper;
import weaver.hrm.User;
import java.util.List;
import java.util.Map;
/**
@ -30,4 +32,8 @@ public class PersonnelResumeWrapper extends OrganizationWrapper {
public Map<String, Object> getResumeList(Integer uId) {
return getPersonnelResumeService(user).getResumeList(uId);
}
public List<SearchConditionItem> personnelScreening() {
return getPersonnelResumeService(user).personnelScreening();
}
}

Loading…
Cancel
Save