部门编制显示岗位编制之和

feature/简阳
Chengliang 1 year ago
parent ab5e011640
commit 1c2338ea30

@ -634,6 +634,7 @@ public class ChartServiceImpl extends Service implements ChartService {
list.add(stp.getDataId());
StringBuilder jobSql = new StringBuilder();
StringBuilder staffSql = new StringBuilder();
List<Integer> 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<Integer> 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;
}

Loading…
Cancel
Save