顺胜组织架构图补丁包开发
This commit is contained in:
parent
fb415853fd
commit
076f42849b
|
|
@ -24,6 +24,8 @@ public class ResourceChartPO {
|
|||
|
||||
private String lastName;
|
||||
|
||||
private String managerId;
|
||||
|
||||
private String sex;
|
||||
|
||||
private Integer departmentId;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.engine.organization.entity.hrmresource.param.HrmRelationSaveParam;
|
|||
import com.engine.organization.entity.hrmresource.param.SearchTemplateParam;
|
||||
import com.engine.organization.entity.searchtree.SearchTreeParams;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
|
@ -179,4 +180,14 @@ public interface HrmResourceService {
|
|||
Map<String, Object> chartResourceList(Integer departmentId,String versionId,String dimension);
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 获取虚拟维度 所有子部门和当前部门集合
|
||||
* @Author: liang.cheng
|
||||
* @Date: 2024/5/11 5:47 PM
|
||||
* @param: [departmentId]
|
||||
* @return: java.util.List<java.lang.Integer>
|
||||
*/
|
||||
List<Integer> getAllSubDepartment(String departmentId);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.engine.organization.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
|
|
@ -368,15 +369,21 @@ public class ChartServiceImpl extends Service implements ChartService {
|
|||
if (isRealDimension) {
|
||||
sql = "select a.id,a.lastname as name ,a.belongto ,a.companyworkyear,a.managerid,b."+levelFieldId+" as levelvalue from hrmresource a left join cus_fielddata b on a.id = b.id and scopeid = 3 where a.status < 4 and a.departmentid = ? ";
|
||||
} else {
|
||||
List<Integer> allSubDepartment = ServiceUtil.getService(HrmResourceServiceImpl.class, user).getAllSubDepartment(departmentId);
|
||||
String join = CollectionUtil.join(allSubDepartment, ",");
|
||||
sql = "select a.id,a.lastname as name ,a.belongto ,a.companyworkyear,a.managerid,c."+levelFieldId+" as levelvalue from hrmresource a inner join hrmresourcevirtual b on a.id = b.resourceid " +
|
||||
" left join cus_fielddata c on b.resourceid = c.id and scopeid = 3 where a.status < 4 and b.departmentid = ? ";
|
||||
" left join cus_fielddata c on b.resourceid = c.id and scopeid = 3 where a.status < 4 and b.departmentid in ("+join+")";
|
||||
rs.executeQuery(sql);
|
||||
}
|
||||
} else {
|
||||
sql = "select a.resourceid as id,a.lastname as name ,a.belongto ,a.companyworkyear,a.manager from jcl_chart_resource a where a.status < 4 and a.departmentid = ? and versionid = " + versionId;
|
||||
}
|
||||
|
||||
List<ChartPO> personList = new ArrayList<>();
|
||||
rs.executeQuery(sql, departmentId);
|
||||
if (isRealDimension) {
|
||||
rs.executeQuery(sql, departmentId);
|
||||
}
|
||||
|
||||
while (rs.next()) {
|
||||
String managerId;
|
||||
if (isRealTime) {
|
||||
|
|
@ -393,19 +400,31 @@ public class ChartServiceImpl extends Service implements ChartService {
|
|||
//Map<String, String> managerToFobjidMap = personList.stream()
|
||||
// .collect(Collectors.toMap(ChartPO::getManagerId, ChartPO::getFobjid,(existingValue, newValue) -> newValue));
|
||||
|
||||
Map<String, ChartPO> map = personList.stream()
|
||||
.collect(Collectors.toMap(ChartPO::getFobjid,
|
||||
chartPO -> chartPO,
|
||||
(existing, replacement) -> existing));
|
||||
personList = new ArrayList<>(map.values());
|
||||
|
||||
Map<String, String> managerToFobjidMap = personList.stream()
|
||||
.collect(Collectors.toMap(ChartPO::getFobjid, ChartPO::getManagerId));
|
||||
|
||||
// Map<String, String> managerToFobjidMap = personList.stream().collect(Collectors.toMap(ChartPO::getManagerId, ChartPO::getFobjid,(oldValue, newValue) -> newValue));
|
||||
|
||||
personList.forEach(chart -> {
|
||||
String managerId = managerToFobjidMap.get(chart.getManagerId());
|
||||
if (StringUtils.isNotEmpty(managerId)) {
|
||||
String fobjId = managerToFobjidMap.get(chart.getManagerId());
|
||||
if (StringUtils.isNotEmpty(fobjId)) {
|
||||
chart.setParentId(chart.getManagerId());
|
||||
}
|
||||
});
|
||||
|
||||
dataList.addAll(personList);
|
||||
departmentChartPO.setFonjob(personList.size());
|
||||
}
|
||||
|
||||
if (isRealDimension) {
|
||||
departmentChartPO.setFonjob(departmentOnJob);
|
||||
}
|
||||
departmentChartPO.setFonjob(departmentOnJob);
|
||||
|
||||
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.engine.organization.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.api.browser.bean.SearchConditionGroup;
|
||||
import com.api.browser.bean.SearchConditionItem;
|
||||
import com.api.browser.bean.SearchConditionOption;
|
||||
|
|
@ -52,6 +53,7 @@ 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 lombok.SneakyThrows;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.json.JSONException;
|
||||
|
|
@ -61,6 +63,7 @@ import weaver.conn.RecordSet;
|
|||
import weaver.general.StringUtil;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.companyvirtual.DepartmentVirtualComInfo;
|
||||
import weaver.hrm.definedfield.HrmFieldManager;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
|
@ -69,7 +72,6 @@ import java.time.LocalDate;
|
|||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import static weaver.general.Util.getIntValue;
|
||||
|
||||
|
|
@ -491,8 +493,10 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
}
|
||||
}
|
||||
} else {
|
||||
rs.executeQuery("select h.id,h.workcode,h.lastname,h.sex,h.departmentid,h.subcompanyid1,h.jobtitle,h.status,h.mobile " +
|
||||
" from hrmresourcevirtual v inner join hrmresource h on v.resourceid = h.id and v.virtualtype = ? and v.departmentid = ?", dimension, departmentId);
|
||||
List<Integer> allSubDepartment = getAllSubDepartment(String.valueOf(departmentId));
|
||||
String join = CollectionUtil.join(allSubDepartment, ",");
|
||||
rs.executeQuery("select h.id,h.workcode,h.lastname,h.sex,h.departmentid,h.subcompanyid1,h.jobtitle,h.status,h.mobile,h.managerid " +
|
||||
" from hrmresourcevirtual v inner join hrmresource h on v.resourceid = h.id and v.virtualtype = ? and v.departmentid in ("+join+")", dimension);
|
||||
while (rs.next()) {
|
||||
ResourceChartPO build = ResourceChartPO.builder()
|
||||
.id((long) Util.getIntValue(rs.getString("id")))
|
||||
|
|
@ -508,6 +512,13 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
resourceChartPOS.add(build);
|
||||
}
|
||||
resourceChartVOS = ResourceChartBO.convertToVO(resourceChartPOS);
|
||||
|
||||
//虚拟维度去重
|
||||
Map<Long, ResourceChartVO> map = resourceChartVOS.stream()
|
||||
.collect(Collectors.toMap(ResourceChartVO::getId,
|
||||
resourceChartVO -> resourceChartVO,
|
||||
(existing, replacement) -> existing));
|
||||
resourceChartVOS = new ArrayList<>(map.values());
|
||||
}
|
||||
|
||||
dataMap.put("columns", resourceListColumns);
|
||||
|
|
@ -1343,4 +1354,13 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
return selectKeys;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Integer> getAllSubDepartment(String departmentId){
|
||||
DepartmentVirtualComInfo comInfo = new DepartmentVirtualComInfo();
|
||||
ArrayList subList = new ArrayList();
|
||||
comInfo.getAllChildDeptByDepId(subList, departmentId);
|
||||
subList.add(departmentId);
|
||||
return subList;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue