From 79f64f7f93a29042450fc65b868cae92ae1dca7b Mon Sep 17 00:00:00 2001 From: dxfeng Date: Thu, 6 Jul 2023 10:06:38 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=BB=84=E7=BB=87=E6=9E=B6=E6=9E=84?= =?UTF-8?q?=E5=9B=BE=EF=BC=8C=E5=88=97=E8=A1=A8=E5=AD=97=E6=AE=B5=E8=BD=AC?= =?UTF-8?q?=E6=8D=A2=E3=80=81=E5=8D=A1=E7=89=87=E5=9C=A8=E5=B2=97=E6=95=B0?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../organization/entity/chart/ChartPO.java | 8 ++++++++ .../entity/hrmresource/po/ResourceChartPO.java | 6 +++--- .../mapper/resource/HrmResourceMapper.xml | 18 ++++++++++++++++-- .../service/impl/ChartServiceImpl.java | 5 +++++ .../service/impl/HrmResourceServiceImpl.java | 2 +- 5 files changed, 33 insertions(+), 6 deletions(-) diff --git a/src/com/engine/organization/entity/chart/ChartPO.java b/src/com/engine/organization/entity/chart/ChartPO.java index 5495144b..46055172 100644 --- a/src/com/engine/organization/entity/chart/ChartPO.java +++ b/src/com/engine/organization/entity/chart/ChartPO.java @@ -28,7 +28,11 @@ public class ChartPO { private String fisvitual; private String hasChildren; + // 在岗数 + private Integer fonjob; + private String id; + private String key; public String getId() { if (StringUtils.isNotBlank(ftype)) { @@ -52,4 +56,8 @@ public class ChartPO { public String getFisvitual() { return StringUtils.isBlank(fisvitual) ? "0" : fisvitual; } + + public String getKey() { + return getId(); + } } diff --git a/src/com/engine/organization/entity/hrmresource/po/ResourceChartPO.java b/src/com/engine/organization/entity/hrmresource/po/ResourceChartPO.java index 63868f50..48b68d96 100644 --- a/src/com/engine/organization/entity/hrmresource/po/ResourceChartPO.java +++ b/src/com/engine/organization/entity/hrmresource/po/ResourceChartPO.java @@ -26,11 +26,11 @@ public class ResourceChartPO { private String sex; - private Integer departmentId; + private String departmentId; - private Integer subcompanyid1; + private String subcompanyid1; - private Integer jobTitle; + private String jobTitle; private Integer status; diff --git a/src/com/engine/organization/mapper/resource/HrmResourceMapper.xml b/src/com/engine/organization/mapper/resource/HrmResourceMapper.xml index e7d48fa6..56208857 100644 --- a/src/com/engine/organization/mapper/resource/HrmResourceMapper.xml +++ b/src/com/engine/organization/mapper/resource/HrmResourceMapper.xml @@ -444,8 +444,22 @@ \ No newline at end of file diff --git a/src/com/engine/organization/service/impl/ChartServiceImpl.java b/src/com/engine/organization/service/impl/ChartServiceImpl.java index 006e5580..ea2203c7 100644 --- a/src/com/engine/organization/service/impl/ChartServiceImpl.java +++ b/src/com/engine/organization/service/impl/ChartServiceImpl.java @@ -186,6 +186,7 @@ public class ChartServiceImpl extends Service implements ChartService { List dataList = new ArrayList<>(); List resourceList = new ArrayList<>(); Set jobTitleSet = new HashSet<>(); + int departmentOnJob = 0; RecordSet rs = new RecordSet(); // TODO 查询当前实际的数据 String sql; @@ -201,6 +202,7 @@ public class ChartServiceImpl extends Service implements ChartService { ChartPO chartPO = new ChartPO(); chartPO.setFtype("4"); chartPO.setFobjid(rs.getString("id")); + chartPO.setId(chartPO.getFobjid()); chartPO.setFname(rs.getString("name")); // 岗位处理后的ID chartPO.setParentId(departmentId + "_" + jobTitle); @@ -231,6 +233,8 @@ public class ChartServiceImpl extends Service implements ChartService { List chartPOS = resourceMap.get(chartPO.getId()); if (CollectionUtils.isNotEmpty(chartPOS)) { dataList.addAll(chartPOS); + chartPO.setFonjob(chartPOS.size()); + departmentOnJob += chartPO.getFonjob(); } } } @@ -246,6 +250,7 @@ public class ChartServiceImpl extends Service implements ChartService { // 岗位处理后的ID chartPO.setExpand("1"); chartPO.setHasChildren(CollectionUtils.isNotEmpty(dataList) ? "1" : "0"); + chartPO.setFonjob(departmentOnJob); dataList.add(chartPO); } diff --git a/src/com/engine/organization/service/impl/HrmResourceServiceImpl.java b/src/com/engine/organization/service/impl/HrmResourceServiceImpl.java index 1680200d..c7d054eb 100644 --- a/src/com/engine/organization/service/impl/HrmResourceServiceImpl.java +++ b/src/com/engine/organization/service/impl/HrmResourceServiceImpl.java @@ -438,7 +438,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic list.add(ResourceListColumns.builder().title("姓名").dataIndex("lastName").key("lastName").build()); list.add(ResourceListColumns.builder().title("性别").dataIndex("sex").key("sex").build()); list.add(ResourceListColumns.builder().title("部门").dataIndex("departmentId").key("departmentId").build()); - list.add(ResourceListColumns.builder().title("分部").dataIndex("subcompamyid1").key("subcompamyid1").build()); + list.add(ResourceListColumns.builder().title("分部").dataIndex("subcompanyid1").key("subcompanyid1").build()); list.add(ResourceListColumns.builder().title("岗位").dataIndex("jobTitle").key("jobTitle").build()); //list.add(ResourceListColumns.builder().title("状态").dataIndex("status").key("status").build()); list.add(ResourceListColumns.builder().title("手机号").dataIndex("mobile").key("mobile").build()); -- 2.40.0.windows.1 From 38656dde58d96194a1d93f097d1d4322afc6861c Mon Sep 17 00:00:00 2001 From: dxfeng Date: Thu, 6 Jul 2023 10:47:34 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E7=BB=84=E7=BB=87=E6=9E=B6=E6=9E=84?= =?UTF-8?q?=E5=9B=BE=EF=BC=8C=E9=83=A8=E9=97=A8=E8=B4=9F=E8=B4=A3=E4=BA=BA?= =?UTF-8?q?=E3=80=81=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, ","); + } } -- 2.40.0.windows.1