中远重工定时任务更新组织编制数和在职数

上海中远重工组织架构图
Chengliang 12 months ago
parent fca321abeb
commit d6aec4d72d

@ -33,4 +33,12 @@ public interface ModeHrmResourceService {
Map<String, Object> chartResourceChart(ModeHrmResourceParam modeHrmResourceParam);
/**
* @Description: ()
* @Author: liang.cheng
* @Date: 2024/4/26 2:11 PM
* @param: [departmentId]
* @return: int
*/
int selcetPersonCount(String departmentIds);
}

@ -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()) {

@ -97,6 +97,24 @@ public class ModeHrmResourceServiceImpl extends Service implements ModeHrmResour
return result;
}
@Override
public int selcetPersonCount(String departmentIds) {
RecordSet rs = new RecordSet();
int totalCount = 0;
rs.executeQuery("select count(1) as total_count from uf_zsygrzbdd where zt < 4 and bm in ("+departmentIds+")");
if (rs.next()) {
totalCount = Util.getIntValue(rs.getString("total_count"));
}
rs.executeQuery("select count(1) as total_count from uf_qlwbrydngljmb where zt < 4 and bmbz in ("+departmentIds+")");
if (rs.next()) {
totalCount += Util.getIntValue(rs.getString("total_count"));
}
return totalCount;
}
/**
*
* @param allSupDepartment
@ -106,7 +124,7 @@ public class ModeHrmResourceServiceImpl extends Service implements ModeHrmResour
RecordSet rs = new RecordSet();
List<ResourceChartPO> resourceChartPOS = new ArrayList<>();
String join = CollectionUtil.join(allSupDepartment, ",");
rs.executeQuery("select id, gh,xm,xb,bm,gw,sjhm from uf_zsygrzbdd where bm in ("+join+")");
rs.executeQuery("select id, gh,xm,xb,bm,gw,sjhm from uf_zsygrzbdd where zt < 4 and bm in ("+join+")");
while (rs.next()) {
ResourceChartPO build = ResourceChartPO.builder()
.id((long) Util.getIntValue(rs.getString("id")))
@ -132,7 +150,7 @@ public class ModeHrmResourceServiceImpl extends Service implements ModeHrmResour
RecordSet rs = new RecordSet();
List<ResourceChartPO> resourceChartPOS = new ArrayList<>();
String join = CollectionUtil.join(allSupDepartment, ",");
rs.executeQuery("select id, gh,xm,xb,bmbz,gw,lxfs from uf_qlwbrydngljmb where bmbz in ("+join+")");
rs.executeQuery("select id, gh,xm,xb,bmbz,gw,lxfs from uf_qlwbrydngljmb where zt < 4 and bmbz in ("+join+")");
while (rs.next()) {
ResourceChartPO build = ResourceChartPO.builder()
.id((long) Util.getIntValue(rs.getString("id")))

Loading…
Cancel
Save