历史编制 在职人数显示sql更改

pull/225/head
Chengliang 1 year ago
parent b4aa07b797
commit 4f446b20d0

@ -126,7 +126,7 @@ public class ChartServiceImpl extends Service implements ChartService {
topChartPO.setFtype(rs.getString("type"));
topChartPO.setFobjid(rs.getString("id"));
topChartPO.setFname(rs.getString("name"));
topChartPO.setOnJobNum(Util.getIntValue(rs.getString("on_job_num"),0));
topChartPO.setOnJobNum(isRealTime ? Util.getIntValue(rs.getString("on_job_num"),0) : Util.getIntValue(rs.getString("job_num"),0));
topChartPO.setStaffNum(Util.getIntValue(rs.getString("staff_num"),0));
topChartPO.setParentId(null);
topChartPO.setExpand("1");
@ -197,6 +197,7 @@ public class ChartServiceImpl extends Service implements ChartService {
chartPO.setFisvitual(rs.getString("isvitual"));
chartPO.setHasChildren(getHasChildren(chartPO.getFtype(), chartPO.getFobjid()).toString());
filterAndAddData(dataList, chartPO, hideDepartment);
//dataList.add(chartPO);
}
}
@ -403,12 +404,12 @@ public class ChartServiceImpl extends Service implements ChartService {
} else {
if (hasVirtualFields) {
if (showVirtual) {
return "select " + SUB_COMPANY_ID + " as id,subcompanyname as name,'1' as type,isvirtual as isvitual,b.on_job_num,b.staff_num from " + SUB_COMPANY_TABLE + " a left join jcl_org_onjob b on a." + SUB_COMPANY_ID + "=b.data_id and b.type=1 where versionid = " + versionId + " and subcompanyid = " + root;
return "select " + SUB_COMPANY_ID + " as id,subcompanyname as name,'1' as type,isvirtual as isvitual,a.job_num,a.staff_num from " + SUB_COMPANY_TABLE + " a where versionid = " + versionId + " and subcompanyid = " + root;
} else {
return "select " + SUB_COMPANY_ID + " as id,subcompanyname as name,'1' as type,isvirtual as isvitual,b.on_job_num,b.staff_num from " + SUB_COMPANY_TABLE + " a left join jcl_org_onjob b on a." + SUB_COMPANY_ID + "=b.data_id and b.type=1 where versionid = " + versionId + " and subcompanyid = " + root + " and (isvirtual is null or isvirtual != '1')";
return "select " + SUB_COMPANY_ID + " as id,subcompanyname as name,'1' as type,isvirtual as isvitual,a.job_num,a.staff_num from " + SUB_COMPANY_TABLE + " a where versionid = " + versionId + " and subcompanyid = " + root + " and (isvirtual is null or isvirtual != '1')";
}
} else {
return "select " + SUB_COMPANY_ID + " as id,subcompanyname as name,'1' as type,b.on_job_num,b.staff_num from " + SUB_COMPANY_TABLE + " a left join jcl_org_onjob b on a." + SUB_COMPANY_ID + "=b.data_id and b.type=1 where versionid = " + versionId + " and subcompanyid = " + root;
return "select " + SUB_COMPANY_ID + " as id,subcompanyname as name,'1' as type,a.job_num,a.staff_num from " + SUB_COMPANY_TABLE + " a where versionid = " + versionId + " and subcompanyid = " + root;
}
}
}
@ -636,7 +637,7 @@ public class ChartServiceImpl extends Service implements ChartService {
StringBuilder staffSql = new StringBuilder();
if (ModuleTypeEnum.subcompanyfielddefined.getValue().equals(stp.getType())) {
subCompany.getSubCompanyLists(String.valueOf(stp.getDataId()), list);
subCompany.getSubCompanyLists(String.valueOf(stp.getDataId()), list);
String value = StringUtils.join(list,",");
jobSql.append("select count(1) as count from hrmresource where status < 4 and subcompanyid1 in (").append(value).append(")");
staffSql.append("select a.staff_num from jcl_org_staff a inner join jcl_org_staffplan b\n" +
@ -702,34 +703,34 @@ public class ChartServiceImpl extends Service implements ChartService {
}
rs.executeQuery(sql.toString());
while (rs.next()) {
while (rs.next()) {
StatisticsPO statisticsPO = StatisticsPO.builder()
.dataId(Util.getIntValue(rs.getString("id")))
.superId(Util.getIntValue(rs.getString("supsubcomid")))
.type(1)
.onJobNum(0)
.staffNum(0)
.creator(user.getUID())
.createTime(OrganizationDateUtil.getFormatLocalDateTime(LocalDateTime.now()))
.updateTime(OrganizationDateUtil.getFormatLocalDateTime(LocalDateTime.now()))
.build();
companyList.add(statisticsPO);
}
StatisticsPO statisticsPO = StatisticsPO.builder()
.dataId(Util.getIntValue(rs.getString("id")))
.superId(Util.getIntValue(rs.getString("supsubcomid")))
.type(1)
.onJobNum(0)
.staffNum(0)
.creator(user.getUID())
.createTime(OrganizationDateUtil.getFormatLocalDateTime(LocalDateTime.now()))
.updateTime(OrganizationDateUtil.getFormatLocalDateTime(LocalDateTime.now()))
.build();
companyList.add(statisticsPO);
}
rs.executeQuery(sql1.toString());
while (rs.next()) {
StatisticsPO statisticsPO = StatisticsPO.builder()
.dataId(Util.getIntValue(rs.getString("id")))
.superId(Util.getIntValue(rs.getString("supdepid")))
.type(2)
.onJobNum(0)
.staffNum(0)
.creator(user.getUID())
.createTime(OrganizationDateUtil.getFormatLocalDateTime(LocalDateTime.now()))
.updateTime(OrganizationDateUtil.getFormatLocalDateTime(LocalDateTime.now()))
.build();
departmentList.add(statisticsPO);
rs.executeQuery(sql1.toString());
while (rs.next()) {
StatisticsPO statisticsPO = StatisticsPO.builder()
.dataId(Util.getIntValue(rs.getString("id")))
.superId(Util.getIntValue(rs.getString("supdepid")))
.type(2)
.onJobNum(0)
.staffNum(0)
.creator(user.getUID())
.createTime(OrganizationDateUtil.getFormatLocalDateTime(LocalDateTime.now()))
.updateTime(OrganizationDateUtil.getFormatLocalDateTime(LocalDateTime.now()))
.build();
departmentList.add(statisticsPO);
}
@ -747,7 +748,7 @@ public class ChartServiceImpl extends Service implements ChartService {
if (CollectionUtils.isNotEmpty(addCompanyList)) {
addCompanyList.forEach(item -> iRs.executeUpdate("insert into jcl_org_onjob(data_id,super_id,type,on_job_num,staff_num,creator,create_time,update_time)" +
" values(?,?,?,?,?,?,?,?)",item.getDataId(),item.getSuperId(),item.getType(),
" values(?,?,?,?,?,?,?,?)",item.getDataId(),item.getSuperId(),item.getType(),
item.getOnJobNum(),item.getStaffNum(),item.getCreator(),item.getCreateTime(),item.getUpdateTime()));
}
@ -1353,12 +1354,12 @@ public class ChartServiceImpl extends Service implements ChartService {
case "0":
if (hasVirtualFields) {
if (showVirtual) {
sql = "select " + SUB_COMPANY_ID + " as id,a.subcompanyname as name,'1' as type ,isvirtual as isvitual,b.on_job_num,b.staff_num from " + SUB_COMPANY_TABLE + " a left join jcl_org_onjob b on a."+ SUB_COMPANY_ID + "=b.data_id and b.type=1 where (a.canceled is null or a.canceled != '1') and (a.supsubcompanyid is null or a.supsubcompanyid = '0') and versionid = " + versionId;
sql = "select " + SUB_COMPANY_ID + " as id,a.subcompanyname as name,'1' as type ,isvirtual as isvitual,a.job_num,a.staff_num from " + SUB_COMPANY_TABLE + " a where (a.canceled is null or a.canceled != '1') and (a.supsubcompanyid is null or a.supsubcompanyid = '0') and versionid = " + versionId;
} else {
sql = "select " + SUB_COMPANY_ID + " as id,a.subcompanyname as name,'1' as type ,isvirtual as isvitual,b.on_job_num,b.staff_num from " + SUB_COMPANY_TABLE + " a left join jcl_org_onjob b on a."+ SUB_COMPANY_ID + "=b.data_id and b.type=1 where (a.canceled is null or a.canceled != '1') and (a.supsubcompanyid is null or a.supsubcompanyid = '0') and (isvirtual is null or isvirtual != '1') and versionid = " + versionId;
sql = "select " + SUB_COMPANY_ID + " as id,a.subcompanyname as name,'1' as type ,isvirtual as isvitual,a.job_num,a.staff_num from " + SUB_COMPANY_TABLE + " a where (a.canceled is null or a.canceled != '1') and (a.supsubcompanyid is null or a.supsubcompanyid = '0') and (isvirtual is null or isvirtual != '1') and versionid = " + versionId;
}
} else {
sql = "select " + SUB_COMPANY_ID + " as id,a.subcompanyname as name,'1' as type,b.on_job_num,b.staff_num from " + SUB_COMPANY_TABLE + " a left join jcl_org_onjob b on a."+ SUB_COMPANY_ID + "=b.data_id and b.type=1 where (a.canceled is null or a.canceled != '1') and (a.supsubcompanyid is null or a.supsubcompanyid = '0') and versionid = " + versionId;
sql = "select " + SUB_COMPANY_ID + " as id,a.subcompanyname as name,'1' as type,a.job_num,a.staff_num from " + SUB_COMPANY_TABLE + " a where (a.canceled is null or a.canceled != '1') and (a.supsubcompanyid is null or a.supsubcompanyid = '0') and versionid = " + versionId;
}
if (!isRealDimension) {
sql += " and companyid = " + fObjId;
@ -1367,26 +1368,26 @@ public class ChartServiceImpl extends Service implements ChartService {
case "1":
if (hasVirtualFields) {
if (showVirtual) {
sql = "select " + SUB_COMPANY_ID + " as id,a.subcompanyname as name,'1' as type ,isvirtual as isvitual,b.on_job_num,b.staff_num from " + SUB_COMPANY_TABLE + " a left join jcl_org_onjob b on a."+ SUB_COMPANY_ID + "=b.data_id and b.type=1 where (a.canceled is null or a.canceled != '1') and a.supsubcompanyid = '" + fObjId + "' and versionid = " + versionId +
" union select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type ,isvirtual as isvitual,b.on_job_num,b.staff_num from " + DEPARTMENT_TABLE + " a left join jcl_org_onjob b on a."+ SUB_COMPANY_ID + "=b.data_id and b.type=2 where (a.canceled is null or a.canceled != '1') and (a.supdepartmentid is null or a.supdepartmentid = '0') and subcompanyid = '" + fObjId + "' and versionid = " + versionId;
sql = "select " + SUB_COMPANY_ID + " as id,a.subcompanyname as name,'1' as type ,isvirtual as isvitual,a.job_num,a.staff_num from " + SUB_COMPANY_TABLE + " a where (a.canceled is null or a.canceled != '1') and a.supsubcompanyid = '" + fObjId + "' and versionid = " + versionId +
" union select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type ,isvirtual as isvitual,a.job_num,a.staff_num from " + DEPARTMENT_TABLE + " a where (a.canceled is null or a.canceled != '1') and (a.supdepartmentid is null or a.supdepartmentid = '0') and subcompanyid = '" + fObjId + "' and versionid = " + versionId;
} else {
sql = "select " + SUB_COMPANY_ID + " as id,a.subcompanyname as name,'1' as type ,isvirtual as isvitual,b.on_job_num,b.staff_num from " + SUB_COMPANY_TABLE + " a left join jcl_org_onjob b on a."+ SUB_COMPANY_ID + "=b.data_id and b.type=1 where (a.canceled is null or a.canceled != '1') and (isvirtual is null or isvirtual != '1') and a.supsubcompanyid = '" + fObjId + "' and versionid = " + versionId +
" union select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type ,isvirtual as isvitual,b.on_job_num,b.staff_num from " + DEPARTMENT_TABLE + " a left join jcl_org_onjob b on a."+ DEPARTMENT_ID + "=b.data_id and b.type=2 where (a.canceled is null or a.canceled != '1') and (a.supdepartmentid is null or a.supdepartmentid = '0') and (isvirtual is null or isvirtual != '1') and subcompanyid = '" + fObjId + "' and versionid = " + versionId;
sql = "select " + SUB_COMPANY_ID + " as id,a.subcompanyname as name,'1' as type ,isvirtual as isvitual,a.job_num,a.staff_num from " + SUB_COMPANY_TABLE + " a where (a.canceled is null or a.canceled != '1') and (isvirtual is null or isvirtual != '1') and a.supsubcompanyid = '" + fObjId + "' and versionid = " + versionId +
" union select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type ,isvirtual as isvitual,a.job_num,a.staff_num from " + DEPARTMENT_TABLE + " a where (a.canceled is null or a.canceled != '1') and (a.supdepartmentid is null or a.supdepartmentid = '0') and (isvirtual is null or isvirtual != '1') and subcompanyid = '" + fObjId + "' and versionid = " + versionId;
}
} else {
sql = "select " + SUB_COMPANY_ID + " as id,a.subcompanyname as name,'1' as type,b.on_job_num,b.staff_num from " + SUB_COMPANY_TABLE + " a left join jcl_org_onjob b on a."+ SUB_COMPANY_ID + "=b.data_id and b.type=1 where (canceled is null or canceled != '1') and supsubcompanyid = '" + fObjId + "' and versionid = " + versionId +
" union select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type,b.on_job_num,b.staff_num from " + DEPARTMENT_TABLE + " a left join jcl_org_onjob b on a."+ DEPARTMENT_ID + "=b.data_id and b.type=2 where (canceled is null or canceled != '1') and (supdepid is null or supdepid = '0') and subcompanyid = '" + fObjId + "' and versionid = " + versionId;
sql = "select " + SUB_COMPANY_ID + " as id,a.subcompanyname as name,'1' as type,a.job_num,a.staff_num from " + SUB_COMPANY_TABLE + " a where (canceled is null or canceled != '1') and supsubcompanyid = '" + fObjId + "' and versionid = " + versionId +
" union select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type,a.job_num,a.staff_num from " + DEPARTMENT_TABLE + " a where (canceled is null or canceled != '1') and (supdepid is null or supdepid = '0') and subcompanyid = '" + fObjId + "' and versionid = " + versionId;
}
break;
case "2":
if (hasVirtualFields) {
if (showVirtual) {
sql = "select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type ,isvirtual as isvitual,b.on_job_num,b.staff_num from " + DEPARTMENT_TABLE + " a left join jcl_org_onjob b on a."+ DEPARTMENT_ID + "=b.data_id and b.type=2 where (a.canceled is null or a.canceled != '1') and supdepartmentid = '" + fObjId + "' and versionid = " + versionId;
sql = "select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type ,isvirtual as isvitual,a.job_num,a.staff_num from " + DEPARTMENT_TABLE + " a where (a.canceled is null or a.canceled != '1') and supdepartmentid = '" + fObjId + "' and versionid = " + versionId;
} else {
sql = "select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type ,isvirtual as isvitual,b.on_job_num,b.staff_num from " + DEPARTMENT_TABLE + " a left join jcl_org_onjob b on a."+ DEPARTMENT_ID + "=b.data_id and b.type=2 where (canceled is null or canceled != '1') and (isvirtual is null or isvirtual != '1') and a.supdepartmentid = '" + fObjId + "' and versionid = " + versionId;
sql = "select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type ,isvirtual as isvitual,a.job_num,a.staff_num from " + DEPARTMENT_TABLE + " a where (canceled is null or canceled != '1') and (isvirtual is null or isvirtual != '1') and a.supdepartmentid = '" + fObjId + "' and versionid = " + versionId;
}
} else {
sql = "select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type,b.on_job_num,b.staff_num from " + DEPARTMENT_TABLE + " a left join jcl_org_onjob b on a."+ DEPARTMENT_ID + "=b.data_id and b.type=2 where (canceled is null or canceled != '1') and supdepid = '" + fObjId + "' and versionid = " + versionId;
sql = "select " + DEPARTMENT_ID + " as id,a.departmentname as name,'2' as type,a.job_num,a.staff_num from " + DEPARTMENT_TABLE + " a where (canceled is null or canceled != '1') and supdepid = '" + fObjId + "' and versionid = " + versionId;
}
break;
default:
@ -1423,7 +1424,7 @@ public class ChartServiceImpl extends Service implements ChartService {
chartPO.setFtype(recordSet.getString("type"));
chartPO.setFobjid(recordSet.getString("id"));
chartPO.setFname(recordSet.getString("name"));
chartPO.setOnJobNum(Util.getIntValue(recordSet.getString("on_job_num"),0));
chartPO.setOnJobNum(isRealTime ? Util.getIntValue(recordSet.getString("on_job_num"),0) : Util.getIntValue(recordSet.getString("job_num"),0));
chartPO.setStaffNum(Util.getIntValue(recordSet.getString("staff_num"),0));
chartPO.setParentId(topChartPO.getId());
chartPO.setFisvitual(recordSet.getString("isvitual"));

Loading…
Cancel
Save