组织架构图表添加人员汇报关系配置,配置后部门卡片内人员汇报关系按配置逻辑加载。
This commit is contained in:
parent
076f42849b
commit
601fe344e7
|
|
@ -241,6 +241,7 @@ public class ChartServiceImpl extends Service implements ChartService {
|
|||
@Override
|
||||
public Map<String, Object> getDepartmentDetail(Map<String, Object> params) {
|
||||
String rootId = Util.null2String(params.get("rootId"));
|
||||
|
||||
// 维度
|
||||
String dimension = Util.null2String(params.get("fclass"));
|
||||
dimension = StringUtils.isBlank(dimension) ? "0" : dimension;
|
||||
|
|
@ -259,7 +260,6 @@ public class ChartServiceImpl extends Service implements ChartService {
|
|||
return ServiceUtil.getService(HrmResourceServiceImpl.class, user).chartResourceList(Integer.parseInt(departmentId), versionId, dimension);
|
||||
}
|
||||
|
||||
|
||||
// 初始化表名
|
||||
initTableNameByClass(dimension, versionId);
|
||||
|
||||
|
|
@ -369,10 +369,37 @@ 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 in ("+join+")";
|
||||
|
||||
//v4 汇报关系类型获取
|
||||
rs.executeQuery("select hbgxlx from uf_wdlj where wd = ?",dimension);
|
||||
rs.next();
|
||||
String hbgxlx = Util.null2String(rs.getString("hbgxlx"));
|
||||
if ("".equals(hbgxlx)) {
|
||||
//不显示人员
|
||||
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 = 99999";
|
||||
|
||||
}else if ("0".equals(hbgxlx)){
|
||||
//直接上级
|
||||
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 in ("+join+")";
|
||||
|
||||
}else if ("1".equals(hbgxlx)) {
|
||||
//专业上级
|
||||
String professionalSuperId = new BaseBean().getPropValue("hrmOrganization", "professionalSuperId");
|
||||
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,c."+professionalSuperId+" as 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 in ("+join+")";
|
||||
|
||||
}else if ("2".equals(hbgxlx)) {
|
||||
//仅展示本部门
|
||||
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 = "+departmentId;
|
||||
}
|
||||
|
||||
rs.executeQuery(sql);
|
||||
}
|
||||
} else {
|
||||
|
|
@ -397,9 +424,6 @@ public class ChartServiceImpl extends Service implements ChartService {
|
|||
departmentOnJob++;
|
||||
}
|
||||
//顺胜二开 直接上级单独节点
|
||||
//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,
|
||||
|
|
@ -409,14 +433,19 @@ public class ChartServiceImpl extends Service implements ChartService {
|
|||
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));
|
||||
List<ChartPO> finalPersonList = personList;
|
||||
personList.forEach(element -> finalPersonList.stream()
|
||||
.filter(other -> element.getManagerId().equals(other.getId()))
|
||||
.findFirst()
|
||||
.ifPresent(matched -> element.setParentId(matched.getId())));
|
||||
|
||||
personList.forEach(chart -> {
|
||||
String fobjId = managerToFobjidMap.get(chart.getManagerId());
|
||||
if (StringUtils.isNotEmpty(fobjId)) {
|
||||
chart.setParentId(chart.getManagerId());
|
||||
}
|
||||
});
|
||||
|
||||
// personList.forEach(chart -> {
|
||||
// String fobjId = managerToFobjidMap.get(chart.getManagerId());
|
||||
// if (StringUtils.isNotEmpty(fobjId)) {
|
||||
// chart.setParentId(chart.getManagerId());
|
||||
// }
|
||||
// });
|
||||
|
||||
dataList.addAll(personList);
|
||||
departmentChartPO.setFonjob(personList.size());
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import com.api.hrm.util.HrmFieldSearchConditionComInfo;
|
|||
import com.cloudstore.eccom.constant.WeaBoolAttr;
|
||||
import com.cloudstore.eccom.pc.table.WeaTableColumn;
|
||||
import com.cloudstore.eccom.result.WeaResultMsg;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.hrm.util.face.HrmFaceCheckManager;
|
||||
import com.engine.organization.component.OrganizationWeaTable;
|
||||
|
|
@ -493,10 +494,41 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
}
|
||||
}
|
||||
} else {
|
||||
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);
|
||||
|
||||
String sql = "";
|
||||
//v4 汇报关系类型获取
|
||||
rs.executeQuery("select hbgxlx from uf_wdlj where wd = ?",dimension);
|
||||
rs.next();
|
||||
String hbgxlx = Util.null2String(rs.getString("hbgxlx"));
|
||||
if ("".equals(hbgxlx)) {
|
||||
//不显示人员
|
||||
sql = "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 = 99999";
|
||||
|
||||
}else if ("0".equals(hbgxlx)){
|
||||
//直接上级
|
||||
List<Integer> allSubDepartment = getAllSubDepartment(String.valueOf(departmentId));
|
||||
String join = CollectionUtil.join(allSubDepartment, ",");
|
||||
sql = "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+")";
|
||||
|
||||
}else if ("1".equals(hbgxlx)) {
|
||||
//专业上级
|
||||
List<Integer> allSubDepartment = getAllSubDepartment(String.valueOf(departmentId));
|
||||
String join = CollectionUtil.join(allSubDepartment, ",");
|
||||
sql = "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+")";
|
||||
|
||||
|
||||
}else if ("2".equals(hbgxlx)) {
|
||||
//仅展示本部门
|
||||
sql = "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 ="+departmentId;
|
||||
}
|
||||
|
||||
|
||||
rs.executeQuery(sql, dimension);
|
||||
|
||||
while (rs.next()) {
|
||||
ResourceChartPO build = ResourceChartPO.builder()
|
||||
.id((long) Util.getIntValue(rs.getString("id")))
|
||||
|
|
|
|||
Loading…
Reference in New Issue