|
|
|
@ -32,6 +32,7 @@ import weaver.hrm.resource.ResourceComInfo;
|
|
|
|
|
|
|
|
|
|
import java.time.LocalDate;
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.concurrent.ExecutorService;
|
|
|
|
|
|
|
|
|
@ -68,6 +69,10 @@ public class ChartServiceImpl extends Service implements ChartService {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private ModeHrmResourceService getModeHrmResourceService(User user) {
|
|
|
|
|
return ServiceUtil.getService(ModeHrmResourceServiceImpl.class,user);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 是否实际组织维度
|
|
|
|
|
*/
|
|
|
|
@ -645,7 +650,7 @@ public class ChartServiceImpl extends Service implements ChartService {
|
|
|
|
|
public Map<String, Object> recordStatistics(StatisticsParam statisticsParam) {
|
|
|
|
|
Map<String, Object> result = new HashMap<>(2);
|
|
|
|
|
long startTime = System.currentTimeMillis();
|
|
|
|
|
//需要更新的数据List
|
|
|
|
|
//需要新增的数据List
|
|
|
|
|
List<StatisticsPO> list = filterIds(statisticsParam.getCompanyId());
|
|
|
|
|
RecordSetTrans rst = new RecordSetTrans();
|
|
|
|
|
// 核心线程数
|
|
|
|
@ -693,6 +698,20 @@ public class ChartServiceImpl extends Service implements ChartService {
|
|
|
|
|
rst.rollback();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//上海中远重工唯一分部在编数和编制更新
|
|
|
|
|
List<Integer> jobList = new ArrayList<>();
|
|
|
|
|
List<Integer> staffList = new ArrayList<>();
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
|
rs.executeQuery("select on_job_num,staff_num from jcl_org_onjob where type = 2 and super_id = 0");
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
jobList.add(Util.getIntValue(rs.getString("on_job_num"),0));
|
|
|
|
|
staffList.add(Util.getIntValue(rs.getString("staff_num"),0));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int jobSum = jobList.stream().mapToInt(Integer::intValue).sum();
|
|
|
|
|
int staffSum = staffList.stream().mapToInt(Integer::intValue).sum();
|
|
|
|
|
|
|
|
|
|
rs.executeUpdate("update jcl_org_onjob set on_job_num = ?,staff_num = ? where type = 1",jobSum,staffSum);
|
|
|
|
|
|
|
|
|
|
long endTime = System.currentTimeMillis();
|
|
|
|
|
long executionTime = endTime - startTime;
|
|
|
|
@ -710,43 +729,24 @@ public class ChartServiceImpl extends Service implements ChartService {
|
|
|
|
|
private StatisticsPO buildCount(StatisticsPO stp) {
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
|
DepartmentComInfo dept = new DepartmentComInfo();
|
|
|
|
|
SubCompanyComInfo subCompany = new SubCompanyComInfo();
|
|
|
|
|
ArrayList<Integer> list = new ArrayList<>();
|
|
|
|
|
list.add(stp.getDataId());
|
|
|
|
|
StringBuilder jobSql = new StringBuilder();
|
|
|
|
|
StringBuilder staffSql = new StringBuilder();
|
|
|
|
|
|
|
|
|
|
if (ModuleTypeEnum.subcompanyfielddefined.getValue().equals(stp.getType())) {
|
|
|
|
|
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" +
|
|
|
|
|
" 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 = ?");
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
|
|
if (ModuleTypeEnum.departmentfielddefined.getValue().equals(stp.getType())) {
|
|
|
|
|
dept.getAllChildDeptByDepId(list,String.valueOf(stp.getDataId()));
|
|
|
|
|
String value = StringUtils.join(list,",");
|
|
|
|
|
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 b.plan_year = ?");
|
|
|
|
|
}
|
|
|
|
|
int jobNum = getModeHrmResourceService(user).selcetPersonCount(value);
|
|
|
|
|
stp.setOnJobNum(jobNum);
|
|
|
|
|
|
|
|
|
|
if ("false".equals(new BaseBean().getPropValue("hrmOrganization","accountType"))) {
|
|
|
|
|
jobSql.append(" and accounttype != 1");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
rs.executeQuery(jobSql.toString());
|
|
|
|
|
rs.next();
|
|
|
|
|
stp.setOnJobNum(Util.getIntValue(rs.getString("count")));
|
|
|
|
|
LocalDateTime currentDateTime = LocalDateTime.now();
|
|
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM");
|
|
|
|
|
String currentYearMonth = currentDateTime.format(formatter);
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
rs.executeQuery("select bzrs from uf_bzgljmb where bm = ? and ny = ?",stp.getDataId(),currentYearMonth);
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
stp.setStaffNum(Util.getIntValue(rs.getString("bzrs"),0));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return stp;
|
|
|
|
@ -766,7 +766,9 @@ public class ChartServiceImpl extends Service implements ChartService {
|
|
|
|
|
List<Integer> hisCompanyList = new ArrayList<>();
|
|
|
|
|
List<Integer> hisDepartmentList = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
rs.executeQuery("select data_id from jcl_org_onjob where type = 1");
|
|
|
|
|
String propValue = new BaseBean().getPropValue("hrmOrganization", "subCompanyId");
|
|
|
|
|
|
|
|
|
|
rs.executeQuery("select data_id from jcl_org_onjob where type = 1 ");
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|
hisCompanyList.add(Util.getIntValue(rs.getString("data_id")));
|
|
|
|
|
}
|
|
|
|
@ -781,10 +783,12 @@ public class ChartServiceImpl extends Service implements ChartService {
|
|
|
|
|
StringBuilder sql1 = new StringBuilder();
|
|
|
|
|
sql.append("select id,supsubcomid from hrmsubcompany where 1=1");
|
|
|
|
|
sql1.append("select id,supdepid from hrmdepartment where 1=1");
|
|
|
|
|
if (companyId != null) {
|
|
|
|
|
sql.append(" and id = ").append(companyId);
|
|
|
|
|
sql1.append(" and subcompanyid1 = ").append(companyId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//中远重工指定分部数据记录
|
|
|
|
|
companyId = Integer.parseInt(propValue);
|
|
|
|
|
|
|
|
|
|
sql.append(" and id = ").append(companyId);
|
|
|
|
|
sql1.append(" and subcompanyid1 = ").append(companyId);
|
|
|
|
|
|
|
|
|
|
rs.executeQuery(sql.toString());
|
|
|
|
|
while (rs.next()) {
|
|
|
|
|