From 601fe344e76eee7b8bc455d8a82b94a00f0b38db Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Thu, 6 Jun 2024 15:11:45 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=84=E7=BB=87=E6=9E=B6=E6=9E=84=E5=9B=BE?= =?UTF-8?q?=E8=A1=A8=E6=B7=BB=E5=8A=A0=E4=BA=BA=E5=91=98=E6=B1=87=E6=8A=A5?= =?UTF-8?q?=E5=85=B3=E7=B3=BB=E9=85=8D=E7=BD=AE=EF=BC=8C=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E5=90=8E=E9=83=A8=E9=97=A8=E5=8D=A1=E7=89=87=E5=86=85=E4=BA=BA?= =?UTF-8?q?=E5=91=98=E6=B1=87=E6=8A=A5=E5=85=B3=E7=B3=BB=E6=8C=89=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E9=80=BB=E8=BE=91=E5=8A=A0=E8=BD=BD=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ChartServiceImpl.java | 59 ++++++++++++++----- .../service/impl/HrmResourceServiceImpl.java | 40 +++++++++++-- 2 files changed, 80 insertions(+), 19 deletions(-) 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")))