From 1c2338ea304b88be227c636b75169460ba39a1ff Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Thu, 23 Nov 2023 16:48:50 +0800 Subject: [PATCH] =?UTF-8?q?=E9=83=A8=E9=97=A8=E7=BC=96=E5=88=B6=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=B2=97=E4=BD=8D=E7=BC=96=E5=88=B6=E4=B9=8B=E5=92=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ChartServiceImpl.java | 35 +++++++++++++++---- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/src/com/engine/organization/service/impl/ChartServiceImpl.java b/src/com/engine/organization/service/impl/ChartServiceImpl.java index b6ea57f8..98a3d38e 100644 --- a/src/com/engine/organization/service/impl/ChartServiceImpl.java +++ b/src/com/engine/organization/service/impl/ChartServiceImpl.java @@ -634,6 +634,7 @@ public class ChartServiceImpl extends Service implements ChartService { list.add(stp.getDataId()); StringBuilder jobSql = new StringBuilder(); StringBuilder staffSql = new StringBuilder(); + List jobList = new ArrayList<>(); if (ModuleTypeEnum.subcompanyfielddefined.getValue().equals(stp.getType())) { subCompany.getSubCompanyLists(String.valueOf(stp.getDataId()), list); @@ -643,26 +644,46 @@ public class ChartServiceImpl extends Service implements ChartService { " on a.plan_id = b.id\n" + " and a.ec_company = ? and a.ec_department is null and a.delete_type = 0\n" + " and b.plan_year = ?"); + + rs.executeQuery(staffSql.toString(),stp.getDataId(),OrganizationDateUtil.getFormatYear(new Date())); + if (rs.next()) { + stp.setStaffNum(Util.getIntValue(rs.getString("staff_num"),0)); + } + }else { dept.getAllChildDeptByDepId(list,String.valueOf(stp.getDataId())); String value = StringUtils.join(list,","); + //编制数维度是岗位 部门展示页面显示当前部门所有岗位编制数之和 + rs.executeQuery("select id from jcl_org_job where ec_department = ?",stp.getDataId()); + while (rs.next()) { + jobList.add(Util.getIntValue(rs.getString("id"))); + } + String join = StringUtils.join(jobList, ","); + jobSql.append("select count(1) as count from hrmresource where status < 4 and departmentid in (").append(value).append(")"); staffSql.append("select a.staff_num from jcl_org_staff a inner join jcl_org_staffplan b\n" + " on a.plan_id = b.id\n" + - " and a.ec_department = ? and a.job_id is null and a.delete_type = 0\n" + + " and a.job_id in ("+join+") and a.delete_type = 0\n" + " and b.plan_year = ?"); + List count = new ArrayList<>(); + if (CollectionUtils.isEmpty(jobList)) { + stp.setStaffNum(0); + } else { + rs.executeQuery(staffSql.toString(),OrganizationDateUtil.getFormatYear(new Date())); + while (rs.next()) { + count.add(Util.getIntValue(rs.getString("staff_num"))); + } + stp.setStaffNum(count.stream().reduce(0, Integer::sum)); + } } rs.executeQuery(jobSql.toString()); rs.next(); stp.setOnJobNum(Util.getIntValue(rs.getString("count"))); - rs.executeQuery(staffSql.toString(),stp.getDataId(),OrganizationDateUtil.getFormatYear(new Date())); - if (rs.next()) { - stp.setStaffNum(Util.getIntValue(rs.getString("staff_num"))); - }else { - stp.setStaffNum(0); - } + + + return stp; }