From 38656dde58d96194a1d93f097d1d4322afc6861c Mon Sep 17 00:00:00 2001 From: dxfeng Date: Thu, 6 Jul 2023 10:47:34 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=84=E7=BB=87=E6=9E=B6=E6=9E=84=E5=9B=BE?= =?UTF-8?q?=EF=BC=8C=E9=83=A8=E9=97=A8=E8=B4=9F=E8=B4=A3=E4=BA=BA=E3=80=81?= =?UTF-8?q?=E4=B8=BB=E6=AC=A1=E8=B4=A6=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../organization/entity/chart/ChartPO.java | 10 +++++++ .../service/impl/ChartServiceImpl.java | 30 ++++++++++++++++--- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/src/com/engine/organization/entity/chart/ChartPO.java b/src/com/engine/organization/entity/chart/ChartPO.java index 46055172..e3b08876 100644 --- a/src/com/engine/organization/entity/chart/ChartPO.java +++ b/src/com/engine/organization/entity/chart/ChartPO.java @@ -31,6 +31,12 @@ public class ChartPO { // 在岗数 private Integer fonjob; + // 部门负责人 + private String fleader; + + // 人员主次账号 + private String belongto; + private String id; private String key; @@ -54,6 +60,10 @@ public class ChartPO { } public String getFisvitual() { + // 人员、岗位不展示次字段 + if (StringUtils.isNotBlank(ftype) && ("3".equals(ftype) || "4".equals(ftype))) { + return null; + } return StringUtils.isBlank(fisvitual) ? "0" : fisvitual; } diff --git a/src/com/engine/organization/service/impl/ChartServiceImpl.java b/src/com/engine/organization/service/impl/ChartServiceImpl.java index ea2203c7..c15b19c2 100644 --- a/src/com/engine/organization/service/impl/ChartServiceImpl.java +++ b/src/com/engine/organization/service/impl/ChartServiceImpl.java @@ -3,9 +3,11 @@ package com.engine.organization.service.impl; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; import com.engine.organization.entity.chart.ChartPO; +import com.engine.organization.mapper.hrmresource.SystemDataMapper; import com.engine.organization.service.ChartService; import com.engine.organization.util.HasRightUtil; import com.engine.organization.util.OrganizationAssert; +import com.engine.organization.util.db.MapperProxyFactory; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import weaver.conn.RecordSet; @@ -192,9 +194,9 @@ public class ChartServiceImpl extends Service implements ChartService { String sql; // 查询当当前部门下的人员 if ("0".equals(dimension)) { - sql = "select a.id,a.lastname as 'name' ,a.jobtitle from hrmresource a where a.departmentid = '" + departmentId + "'"; + sql = "select a.id,a.lastname as 'name' ,a.jobtitle ,a.belongto from hrmresource a where a.departmentid = '" + departmentId + "'"; } else { - sql = "select a.id,a.lastname as 'name' ,a.jobtitle from hrmresource a inner join hrmresourcevirtual b on a.id = b.resourceid where b.departmentid = '" + departmentId + "'"; + sql = "select a.id,a.lastname as 'name' ,a.jobtitle ,a.belongto from hrmresource a inner join hrmresourcevirtual b on a.id = b.resourceid where b.departmentid = '" + departmentId + "'"; } rs.executeQuery(sql); while (rs.next()){ @@ -206,8 +208,9 @@ public class ChartServiceImpl extends Service implements ChartService { chartPO.setFname(rs.getString("name")); // 岗位处理后的ID chartPO.setParentId(departmentId + "_" + jobTitle); - chartPO.setExpand("1"); + chartPO.setExpand("0"); chartPO.setHasChildren("0"); + chartPO.setBelongto(Util.null2String(rs.getString("belongto"))); resourceList.add(chartPO); jobTitleSet.add(jobTitle); @@ -239,9 +242,10 @@ public class ChartServiceImpl extends Service implements ChartService { } } // 查询部门本身 - sql = "select a.id,a.departmentname as 'name' from " + DEPARTMENT_TABLE + " a where id = '" + departmentId + "'"; + sql = "select a.id,a.departmentname as 'name',b.bmfzr from " + DEPARTMENT_TABLE + " a left join hrmdepartmentdefined b on a.id = b.deptid where a.id = '" + departmentId + "'"; rs.executeQuery(sql); if(rs.next()){ + String fLeader = Util.null2String(rs.getString("bmfzr")); ChartPO chartPO = new ChartPO(); chartPO.setFtype("2"); chartPO.setFobjid(departmentId); @@ -251,6 +255,9 @@ public class ChartServiceImpl extends Service implements ChartService { chartPO.setExpand("1"); chartPO.setHasChildren(CollectionUtils.isNotEmpty(dataList) ? "1" : "0"); chartPO.setFonjob(departmentOnJob); + + // 部门负责人 + chartPO.setFleader(getDepartmentLeader(fLeader)); dataList.add(chartPO); } @@ -445,4 +452,19 @@ public class ChartServiceImpl extends Service implements ChartService { } return false; } + + private String getDepartmentLeader(String ids) { + if (StringUtils.isBlank(ids)) { + return ""; + } + List leaderList = new ArrayList<>(); + String[] split = ids.split(","); + for (String s : split) { + String lastName = MapperProxyFactory.getProxy(SystemDataMapper.class).getScHrmResourceNameById(s); + if (StringUtils.isNotBlank(lastName)) { + leaderList.add(lastName); + } + } + return StringUtils.join(leaderList, ","); + } }