diff --git a/src/com/engine/organization/service/impl/ChartServiceImpl.java b/src/com/engine/organization/service/impl/ChartServiceImpl.java index d67cda70..f506ab38 100644 --- a/src/com/engine/organization/service/impl/ChartServiceImpl.java +++ b/src/com/engine/organization/service/impl/ChartServiceImpl.java @@ -241,6 +241,7 @@ public class ChartServiceImpl extends Service implements ChartService { @Override public Map getDepartmentDetail(Map 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 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 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 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 managerToFobjidMap = personList.stream() - // .collect(Collectors.toMap(ChartPO::getManagerId, ChartPO::getFobjid,(existingValue, newValue) -> newValue)); - Map map = personList.stream() .collect(Collectors.toMap(ChartPO::getFobjid, chartPO -> chartPO, @@ -409,14 +433,19 @@ public class ChartServiceImpl extends Service implements ChartService { Map managerToFobjidMap = personList.stream() .collect(Collectors.toMap(ChartPO::getFobjid, ChartPO::getManagerId)); -// Map managerToFobjidMap = personList.stream().collect(Collectors.toMap(ChartPO::getManagerId, ChartPO::getFobjid,(oldValue, newValue) -> newValue)); + List 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()); diff --git a/src/com/engine/organization/service/impl/HrmResourceServiceImpl.java b/src/com/engine/organization/service/impl/HrmResourceServiceImpl.java index 4bd57d35..fe32571a 100644 --- a/src/com/engine/organization/service/impl/HrmResourceServiceImpl.java +++ b/src/com/engine/organization/service/impl/HrmResourceServiceImpl.java @@ -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 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 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 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")))