人员简历相关接口开发
This commit is contained in:
parent
950da74ac8
commit
2e39235515
|
|
@ -0,0 +1,12 @@
|
|||
package com.api.organization.web;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/12/28
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Path("/bs/hrmorganization/personnelresume")
|
||||
public class PersonnelResumeController extends com.engine.organization.web.PersonnelResumeController {
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
package com.engine.organization.entity.hrmresource.bo;
|
||||
|
||||
import com.engine.organization.entity.hrmresource.po.ResourcePO;
|
||||
import com.engine.organization.entity.searchtree.SearchTree;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/12/28
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class ResourceBO {
|
||||
|
||||
public static List<SearchTree> buildSetToSearchTree(Collection<ResourcePO> builderJobs) {
|
||||
return builderJobs.stream().map(item -> {
|
||||
SearchTree tree = new SearchTree();
|
||||
tree.setCanClick(true);
|
||||
tree.setCanceled(true);
|
||||
tree.setIcon("icon-coms-content-o");
|
||||
tree.setId(item.getId().toString());
|
||||
tree.setIsParent(false);
|
||||
tree.setIsVirtual("0");
|
||||
tree.setName(item.getLastName());
|
||||
tree.setPid("0");
|
||||
tree.setSelected(false);
|
||||
tree.setType("3");
|
||||
tree.setParentComp(null == item.getJobId() ? "0" : item.getJobId().toString());
|
||||
tree.setOrderNum(null == item.getDspOrder() ? 0 : item.getDspOrder());
|
||||
return tree;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -26,4 +26,12 @@ public class ResourcePO {
|
|||
|
||||
private Integer jobtitle;
|
||||
|
||||
private String lastName;
|
||||
private Integer dspOrder;
|
||||
|
||||
/**
|
||||
* 临时关联聚才林岗位ID
|
||||
*/
|
||||
private Long jobId;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -147,4 +147,6 @@ public interface JobMapper {
|
|||
List<String> listUsedId();
|
||||
|
||||
List<String> isAllowDelete(@Param("jobId") Long jobId);
|
||||
|
||||
JobPO getJobByResource(@Param("resourcePO") ResourcePO resourcePO);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -509,6 +509,22 @@
|
|||
inner join hrmresource h on t.ec_jobtitle = h.jobtitle and t.ec_company = h.subcompanyid1 and
|
||||
t.ec_department = h.departmentid and t.id = #{jobId}
|
||||
</select>
|
||||
<select id="getJobByResource" resultType="com.engine.organization.entity.job.po.JobPO">
|
||||
select
|
||||
<include refid="baseColumns"/>
|
||||
from jcl_org_job t
|
||||
left join hrmjobtitles h on t.ec_jobTitle = h.id
|
||||
where t.delete_type = 0
|
||||
<if test="resourcePO.subcompanyid1 != null">
|
||||
and t.ec_company = #{resourcePO.subcompanyid1}
|
||||
</if>
|
||||
<if test="resourcePO.departmentid != null">
|
||||
and t.ec_department = #{resourcePO.departmentid}
|
||||
</if>
|
||||
<if test="resourcePO.jobtitle != null">
|
||||
and t.ec_jobTitle = #{resourcePO.jobtitle}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
<update id="updateJobCompany">
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.engine.organization.mapper.resource;
|
||||
|
||||
import com.engine.organization.entity.hrmresource.po.ResourcePO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -13,4 +14,7 @@ import java.util.List;
|
|||
public interface HrmResourceMapper {
|
||||
|
||||
List<ResourcePO> selectFilterDatas();
|
||||
|
||||
List<ResourcePO> listByFilter(@Param("resourcePO") ResourcePO resourcePO);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,12 +6,45 @@
|
|||
<result column="subcompanyid1" property="subcompanyid1"/>
|
||||
<result column="departmentid" property="departmentid"/>
|
||||
<result column="jobtitle" property="jobtitle"/>
|
||||
<result column="lastname" property="lastName"/>
|
||||
<result column="dspOrder" property="dspOrder"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="selectFilterDatas" resultType="com.engine.organization.entity.hrmresource.po.ResourcePO">
|
||||
SELECT DISTINCT subcompanyid1,departmentid,jobtitle from hrmresource
|
||||
SELECT DISTINCT subcompanyid1, departmentid, jobtitle
|
||||
from hrmresource
|
||||
</select>
|
||||
<select id="listByFilter" resultMap="HrmResourceMap">
|
||||
select id, subcompanyid1 , departmentid , jobtitle , lastname , dspOrder from hrmresource t
|
||||
where 1=1
|
||||
<include refid="likeSql"/>
|
||||
<if test="resourcePO.subcompanyid1 != null">
|
||||
and subcompanyid1 = #{resourcePO.subcompanyid1}
|
||||
</if>
|
||||
<if test="resourcePO.departmentid != null">
|
||||
and departmentid = #{resourcePO.departmentid}
|
||||
</if>
|
||||
<if test="resourcePO.jobtitle != null">
|
||||
and jobtitle = #{resourcePO.jobtitle}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<sql id="likeSql">
|
||||
<if test="resourcePO.lastName != null and resourcePO.lastName != ''">
|
||||
AND t.lastname like CONCAT('%',#{resourcePO.lastName},'%')
|
||||
</if>
|
||||
</sql>
|
||||
<sql id="likeSql" databaseId="oracle">
|
||||
<if test="resourcePO.lastName != null and resourcePO.lastName != ''">
|
||||
AND t.lastname like '%'||#{resourcePO.lastName}||'%'
|
||||
</if>
|
||||
</sql>
|
||||
<sql id="likeSql" databaseId="sqlserver">
|
||||
<if test="resourcePO.lastName != null and resourcePO.lastName != ''">
|
||||
AND t.lastname like '%'+#{resourcePO.lastName}+'%'
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package com.engine.organization.service;
|
||||
|
||||
import com.engine.organization.entity.searchtree.SearchTreeParams;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/12/28
|
||||
* @version: 1.0
|
||||
*/
|
||||
public interface PersonnelResumeService {
|
||||
/**
|
||||
* 左侧树
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> getSearchTree(SearchTreeParams params);
|
||||
|
||||
/**
|
||||
* 获取列表页面按钮信息
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> hasRight();
|
||||
}
|
||||
|
|
@ -19,7 +19,6 @@ import com.engine.organization.enums.OrgImportEnum;
|
|||
import com.engine.organization.mapper.extend.ExtendInfoMapper;
|
||||
import com.engine.organization.mapper.jclimport.ImportMapper;
|
||||
import com.engine.organization.mapper.jclimport.JclImportHistoryDetailMapper;
|
||||
import com.engine.organization.mapper.resource.ResourceMapper;
|
||||
import com.engine.organization.mapper.scheme.GradeMapper;
|
||||
import com.engine.organization.mapper.scheme.LevelMapper;
|
||||
import com.engine.organization.mapper.scheme.SchemeMapper;
|
||||
|
|
@ -872,35 +871,4 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
|
|||
return excelPath;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 判断所选关键字段是否查出多条数据
|
||||
*
|
||||
* @param historyDetailPO
|
||||
* @param keyField
|
||||
* @param keyFieldValue
|
||||
* @return
|
||||
*/
|
||||
private boolean hasSameKeyFieldValue(JclImportHistoryDetailPO historyDetailPO, String keyField, String keyFieldValue) {
|
||||
String operateDetail = "";
|
||||
if (StringUtils.isBlank(keyFieldValue)) {
|
||||
return false;
|
||||
}
|
||||
List<Long> resourceIds = MapperProxyFactory.getProxy(ResourceMapper.class).getIdByKeyField(keyField, keyFieldValue);
|
||||
if (CollectionUtils.isEmpty(resourceIds)) {
|
||||
operateDetail = "[" + keyFieldValue + "]未找到对应人员";
|
||||
}
|
||||
if (resourceIds.size() > 1) {
|
||||
operateDetail = "[" + keyFieldValue + "]查询到多个人员,请确认";
|
||||
}
|
||||
if (StringUtils.isNotBlank(operateDetail)) {
|
||||
historyDetailPO.setOperateDetail(operateDetail);
|
||||
historyDetailPO.setStatus("0");
|
||||
OrgImportUtil.saveImportDetailLog(historyDetailPO);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,276 @@
|
|||
package com.engine.organization.service.impl;
|
||||
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.organization.entity.DeleteParam;
|
||||
import com.engine.organization.entity.company.bo.CompBO;
|
||||
import com.engine.organization.entity.company.po.CompPO;
|
||||
import com.engine.organization.entity.department.bo.DepartmentBO;
|
||||
import com.engine.organization.entity.department.po.DepartmentPO;
|
||||
import com.engine.organization.entity.hrmresource.bo.ResourceBO;
|
||||
import com.engine.organization.entity.hrmresource.po.ResourcePO;
|
||||
import com.engine.organization.entity.job.bo.JobBO;
|
||||
import com.engine.organization.entity.job.po.JobPO;
|
||||
import com.engine.organization.entity.searchtree.SearchTree;
|
||||
import com.engine.organization.entity.searchtree.SearchTreeParams;
|
||||
import com.engine.organization.enums.ModuleTypeEnum;
|
||||
import com.engine.organization.mapper.comp.CompMapper;
|
||||
import com.engine.organization.mapper.department.DepartmentMapper;
|
||||
import com.engine.organization.mapper.job.JobMapper;
|
||||
import com.engine.organization.mapper.resource.HrmResourceMapper;
|
||||
import com.engine.organization.service.PersonnelResumeService;
|
||||
import com.engine.organization.util.MenuBtn;
|
||||
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;
|
||||
import weaver.general.StringUtil;
|
||||
import weaver.general.Util;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/12/28
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class PersonnelResumeServiceImpl extends Service implements PersonnelResumeService {
|
||||
|
||||
|
||||
private DepartmentMapper getDepartmentMapper() {
|
||||
return MapperProxyFactory.getProxy(DepartmentMapper.class);
|
||||
}
|
||||
|
||||
private CompMapper getCompMapper() {
|
||||
return MapperProxyFactory.getProxy(CompMapper.class);
|
||||
}
|
||||
|
||||
private JobMapper getJobMapper() {
|
||||
return MapperProxyFactory.getProxy(JobMapper.class);
|
||||
}
|
||||
|
||||
private HrmResourceMapper getHrmResourceMapper() {
|
||||
return MapperProxyFactory.getProxy(HrmResourceMapper.class);
|
||||
}
|
||||
|
||||
@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 = getFilterCompany(id, type, keyword);
|
||||
return SearchTreeUtil.getSearchTree(type, treeList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> hasRight() {
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
resultMap.put("hasRight", true);
|
||||
ArrayList<MenuBtn> topMenuList = new ArrayList<>();
|
||||
ArrayList<MenuBtn> rightMenuList = new ArrayList<>();
|
||||
// 新增
|
||||
topMenuList.add(MenuBtn.builder().isBatch("0").isTop("1").menuFun("screening").menuIcon("icon-coms-New-Flow").menuName("人员筛选").type("BTN_Screening").build());
|
||||
topMenuList.add(MenuBtn.builder().isBatch("0").isTop("1").menuFun("currentExport").menuIcon("icon-coms-edit").menuName("导出当前").type("BTN_CurrentExport").build());
|
||||
topMenuList.add(MenuBtn.builder().isBatch("0").isTop("1").menuFun("MergeExport").menuIcon("icon-coms-Delete").menuName("全部导出(合并)").type("BTN_MergeExport").build());
|
||||
topMenuList.add(MenuBtn.builder().isBatch("0").isTop("1").menuFun("AllExport").menuIcon("icon-coms-Delete").menuName("全部导出").type("BTN_AllExport").build());
|
||||
|
||||
resultMap.put("topMenu", topMenuList);
|
||||
// 新增
|
||||
rightMenuList.add(MenuBtn.builder().isBatch("0").isTop("0").menuFun("screening").menuIcon("icon-coms-New-Flow").menuName("人员筛选").type("BTN_Screening").build());
|
||||
rightMenuList.add(MenuBtn.builder().isBatch("0").isTop("0").menuFun("currentExport").menuIcon("icon-coms-edit").menuName("导出当前").type("BTN_CurrentExport").build());
|
||||
rightMenuList.add(MenuBtn.builder().isBatch("0").isTop("0").menuFun("MergeExport").menuIcon("icon-coms-Delete").menuName("全部导出(合并)").type("BTN_MergeExport").build());
|
||||
rightMenuList.add(MenuBtn.builder().isBatch("0").isTop("0").menuFun("AllExport").menuIcon("icon-coms-Delete").menuName("全部导出").type("BTN_AllExport").build());
|
||||
|
||||
resultMap.put("rightMenu", rightMenuList);
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
public List<SearchTree> getFilterCompany(String id, String type, String keyword) {
|
||||
List<SearchTree> searchTree = new ArrayList<>();
|
||||
// 通过分部、公司 组装数据
|
||||
if (StringUtil.isEmpty(id) || ModuleTypeEnum.subcompanyfielddefined.getValue().toString().equals(type)) {
|
||||
Integer subCompanyId1 = StringUtil.isEmpty(id) ? null : Integer.parseInt(id);
|
||||
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);
|
||||
} else if (ModuleTypeEnum.departmentfielddefined.getValue().toString().equals(type)) {
|
||||
Integer departmentId = Integer.parseInt(id);
|
||||
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);
|
||||
|
||||
} else if (ModuleTypeEnum.jobfielddefined.getValue().toString().equals(type)) {
|
||||
Long jobId = Long.parseLong(id);
|
||||
JobPO jobById = getJobMapper().getJobById(jobId);
|
||||
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));
|
||||
}
|
||||
return searchTree;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分部、部门 组装左侧树
|
||||
*
|
||||
* @param departmentBuild
|
||||
* @param compBuild
|
||||
* @param jobBuild
|
||||
* @return
|
||||
*/
|
||||
private List<SearchTree> buildTreeByCompAndDept(DepartmentPO departmentBuild, CompPO compBuild, JobPO jobBuild, ResourcePO resourcePO) {
|
||||
// 查询人员数据
|
||||
List<ResourcePO> resourcePOS = getHrmResourceMapper().listByFilter(resourcePO);
|
||||
Set<JobPO> builderJobs = new HashSet<>();
|
||||
|
||||
// 补充人员所有岗位,关联人员及聚才林岗位
|
||||
for (ResourcePO resource : resourcePOS) {
|
||||
JobPO jobByResource = getJobMapper().getJobByResource(resource);
|
||||
if (null != jobByResource) {
|
||||
resource.setJobId(jobByResource.getId());
|
||||
builderJobs.add(jobByResource);
|
||||
}
|
||||
}
|
||||
List<SearchTree> resourceTrees = SearchTreeUtil.builderTreeMode(ResourceBO.buildSetToSearchTree(resourcePOS));
|
||||
|
||||
|
||||
List<JobPO> jobPOS = getJobMapper().listPOsByFilter(jobBuild);
|
||||
new DetachUtil(user).filterJobList(jobPOS);
|
||||
List<DepartmentPO> filterDeparts = getDepartmentMapper().listByFilter(departmentBuild, "showorder");
|
||||
new DetachUtil(user).filterDepartmentList(filterDeparts);
|
||||
// 添加父级岗位
|
||||
builderJobs.addAll(jobPOS);
|
||||
// 添加岗位的上级部门或分部
|
||||
List<SearchTree> jobTrees = SearchTreeUtil.builderTreeMode(JobBO.buildSetToSearchTree(builderJobs), resourceTrees);
|
||||
String parentDeptS = jobTrees.stream().map(SearchTree::getParentComp).collect(Collectors.joining(","));
|
||||
if (!StringUtil.isEmpty(parentDeptS)) {
|
||||
// 兼容SQLServer每次最多in,2100条数据
|
||||
List<Long> ids = DeleteParam.builder().ids(parentDeptS).build().getIds();
|
||||
int ceilCount = (int) Math.ceil((double) ids.size() / 1000);
|
||||
List<DepartmentPO> departmentsByIds = new ArrayList<>();
|
||||
for (int i = 1; i < ceilCount + 1; i++) {
|
||||
List<Long> longs = PageUtil.subList(i, 1000, ids);
|
||||
List<DepartmentPO> departmentsById = getDepartmentMapper().getDeptsByIds(longs);
|
||||
if (CollectionUtils.isNotEmpty(departmentsById)) {
|
||||
departmentsByIds.addAll(departmentsById);
|
||||
}
|
||||
}
|
||||
|
||||
if (CollectionUtils.isNotEmpty(departmentsByIds)) {
|
||||
filterDeparts.addAll(departmentsByIds);
|
||||
}
|
||||
}
|
||||
|
||||
// 查询分部信息
|
||||
List<CompPO> filterComps = getCompMapper().listByFilter(compBuild, "showorder");
|
||||
new DetachUtil(user).filterCompanyList(filterComps);
|
||||
Set<DepartmentPO> builderDeparts = new HashSet<>();
|
||||
for (DepartmentPO departmentPO : filterDeparts) {
|
||||
buildParentDepts(departmentPO, builderDeparts);
|
||||
}
|
||||
List<SearchTree> departmentList = DepartmentBO.buildSetToSearchTree(builderDeparts);
|
||||
List<SearchTree> deptTrees = SearchTreeUtil.builderTreeMode(departmentList);
|
||||
List<SearchTree> searchTrees = SearchTreeUtil.builderTreeMode(departmentList, jobTrees);
|
||||
// 添加部门的上级分部
|
||||
String parentCompS = deptTrees.stream().map(SearchTree::getParentComp).collect(Collectors.joining(","));
|
||||
if (!StringUtil.isEmpty(parentCompS)) {
|
||||
List<CompPO> compsByIds = getCompMapper().getCompsByIds(DeleteParam.builder().ids(parentCompS).build().getIds());
|
||||
if (CollectionUtils.isNotEmpty(compsByIds)) {
|
||||
filterComps.addAll(compsByIds);
|
||||
}
|
||||
}
|
||||
List<CompPO> allCompanys = getCompMapper().listAll("showorder");
|
||||
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) {
|
||||
buildParentComps(compPO, builderComps, allMaps);
|
||||
}
|
||||
return SearchTreeUtil.builderTreeMode(CompBO.buildSetToSearchTree(builderComps), searchTrees);
|
||||
}
|
||||
|
||||
private List<SearchTree> buildTreeByDeptAndJob(DepartmentPO departmentBuild, JobPO jobBuild, ResourcePO resourcePO) {
|
||||
// 查询人员数据
|
||||
List<ResourcePO> resourcePOS = getHrmResourceMapper().listByFilter(resourcePO);
|
||||
Set<JobPO> builderJobs = new HashSet<>();
|
||||
|
||||
// 补充人员所有岗位,关联人员及聚才林岗位
|
||||
for (ResourcePO resource : resourcePOS) {
|
||||
JobPO jobByResource = getJobMapper().getJobByResource(resource);
|
||||
if (null != jobByResource) {
|
||||
resource.setJobId(jobByResource.getId());
|
||||
builderJobs.add(jobByResource);
|
||||
}
|
||||
}
|
||||
List<SearchTree> resourceTrees = SearchTreeUtil.builderTreeMode(ResourceBO.buildSetToSearchTree(resourcePOS));
|
||||
|
||||
List<JobPO> jobPOS = getJobMapper().listPOsByFilter(jobBuild);
|
||||
List<DepartmentPO> filterDeparts = getDepartmentMapper().listByFilter(departmentBuild, "showorder");
|
||||
// 添加父级岗位
|
||||
builderJobs.addAll(jobPOS);
|
||||
// 添加岗位的上级部门或分部
|
||||
List<SearchTree> jobTrees = SearchTreeUtil.builderTreeMode(JobBO.buildSetToSearchTree(builderJobs), resourceTrees);
|
||||
String parentDeptS = jobTrees.stream().map(SearchTree::getParentComp).collect(Collectors.joining(","));
|
||||
if (!StringUtil.isEmpty(parentDeptS)) {
|
||||
// 兼容SQLServer每次最多in,2100条数据
|
||||
List<Long> ids = (List<Long>) DeleteParam.builder().ids(parentDeptS).build().getIds();
|
||||
int ceilCount = (int) Math.ceil((double) ids.size() / 1000);
|
||||
List<DepartmentPO> departmentsByIds = new ArrayList<>();
|
||||
for (int i = 0; i < ceilCount - 1; i++) {
|
||||
List<DepartmentPO> departmentsById = getDepartmentMapper().getDeptsByIds(PageUtil.subList(i, 1000, ids));
|
||||
if (CollectionUtils.isNotEmpty(departmentsById)) {
|
||||
departmentsByIds.addAll(departmentsById);
|
||||
}
|
||||
}
|
||||
|
||||
if (CollectionUtils.isNotEmpty(departmentsByIds)) {
|
||||
filterDeparts.addAll(departmentsByIds);
|
||||
}
|
||||
}
|
||||
|
||||
// 查询分部信息
|
||||
Set<DepartmentPO> builderDeparts = new HashSet<>();
|
||||
for (DepartmentPO departmentPO : filterDeparts) {
|
||||
buildParentDepts(departmentPO, builderDeparts);
|
||||
}
|
||||
return SearchTreeUtil.builderTreeMode(DepartmentBO.buildSetToSearchTree(builderDeparts), jobTrees);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加查询元素的父级元素
|
||||
*
|
||||
* @param departmentPO
|
||||
* @param builderDeparts
|
||||
*/
|
||||
private void buildParentDepts(DepartmentPO departmentPO, Set<DepartmentPO> builderDeparts) {
|
||||
builderDeparts.add(departmentPO);
|
||||
if (SearchTreeUtil.isTop(departmentPO.getSupDepId())) {
|
||||
return;
|
||||
}
|
||||
DepartmentPO parentDept = getDepartmentMapper().getDeptById(departmentPO.getSupDepId());
|
||||
if (null != parentDept) {
|
||||
buildParentDepts(parentDept, builderDeparts);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加查询元素的父级元素
|
||||
*
|
||||
* @param compPO
|
||||
* @param builderComps
|
||||
*/
|
||||
private void buildParentComps(CompPO compPO, Set<CompPO> builderComps, Map<Integer, CompPO> allMaps) {
|
||||
builderComps.add(compPO);
|
||||
CompPO parentComp = allMaps.get(compPO.getSupSubComId());
|
||||
if (null != parentComp) {
|
||||
buildParentComps(parentComp, builderComps, allMaps);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
package com.engine.organization.web;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.engine.common.util.ParamUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.organization.entity.searchtree.SearchTreeParams;
|
||||
import com.engine.organization.util.response.ReturnResult;
|
||||
import com.engine.organization.wrapper.PersonnelResumeWrapper;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.GET;
|
||||
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.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/12/28
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class PersonnelResumeController {
|
||||
public PersonnelResumeWrapper getPersonnelResumeWrapper(User user) {
|
||||
return ServiceUtil.getService(PersonnelResumeWrapper.class, user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 左侧树接口
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@GET
|
||||
@Path("/getSearchTree")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult getSearchTree(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
SearchTreeParams params = JSONObject.toJavaObject((JSON) JSONObject.toJSON(map), SearchTreeParams.class);
|
||||
return ReturnResult.successed(getPersonnelResumeWrapper(user).getSearchTree(params));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/hasRight")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult hasRight(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return ReturnResult.successed(getPersonnelResumeWrapper(user).hasRight());
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package com.engine.organization.wrapper;
|
||||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.organization.entity.searchtree.SearchTreeParams;
|
||||
import com.engine.organization.service.PersonnelResumeService;
|
||||
import com.engine.organization.service.impl.PersonnelResumeServiceImpl;
|
||||
import com.engine.organization.util.OrganizationWrapper;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2022/12/28
|
||||
* @version: 1.0
|
||||
*/
|
||||
public class PersonnelResumeWrapper extends OrganizationWrapper {
|
||||
private PersonnelResumeService getPersonnelResumeService(User user) {
|
||||
return ServiceUtil.getService(PersonnelResumeServiceImpl.class, user);
|
||||
}
|
||||
|
||||
public Map<String, Object> getSearchTree(SearchTreeParams params) {
|
||||
return getPersonnelResumeService(user).getSearchTree(params);
|
||||
}
|
||||
|
||||
public Map<String, Object> hasRight() {
|
||||
return getPersonnelResumeService(user).hasRight();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue