You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
weaver-hrm-organization/interface/RefreshPlan.jsp

64 lines
3.4 KiB
Plaintext

<%@ page import="com.engine.organization.thread.CompanyTriggerRunnable" %>
<%@ page import="com.engine.organization.thread.DepartmentTriggerRunnable" %>
<%@ page import="com.engine.organization.thread.JobTriggerRunnable" %>
<%@ page import="org.apache.commons.lang3.StringUtils" %>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="java.util.HashSet" %>
<%@ page import="java.util.Set" %>
<%@ page import="com.engine.organization.util.db.MapperProxyFactory" %>
<%@ page import="com.engine.organization.mapper.job.JobMapper" %>
<%@ page import="com.engine.organization.entity.job.po.JobPO" %>
<%@ page import="com.engine.organization.entity.department.po.DepartmentPO" %>
<%@ page import="com.engine.organization.mapper.department.DepartmentMapper" %>
<%@ page import="com.engine.organization.mapper.comp.CompMapper" %>
<%@ page import="com.engine.organization.entity.company.po.CompPO" %>
<%@ page import="com.engine.organization.initdata.RefreshPlan" %>
<%@ page contentType="text/html; charset=UTF-8" %>
<%
RecordSet rs = new RecordSet();
// 刷新岗位
Set<Long> jobSet = new HashSet<>();
Set<Long> departmentSet = new HashSet<>();
Set<Long> companySet = new HashSet<>();
rs.executeQuery("select id, parent_job from jcl_org_job where id not in( select ifnull(parent_job, '') from jcl_org_job where delete_type =0 and forbidden_tag=0) and delete_type =0 and forbidden_tag=0");
while (rs.next()) {
Long jobId = Long.parseLong(Util.null2String(rs.getString("id")));
JobPO jobPO = MapperProxyFactory.getProxy(JobMapper.class).getJobById(jobId);
RefreshPlan.updateResourceJob(jobId);
new JobTriggerRunnable(jobPO, jobPO).run();
String parentJobId = Util.null2String(rs.getString("parent_job"));
if (StringUtils.isNotBlank(parentJobId)) {
RefreshPlan.refreshJob(Long.parseLong(parentJobId), jobSet);
}
}
// 刷新部门
rs.executeQuery("select id, parent_dept from jcl_org_dept where id not in( select ifnull(parent_dept , '') from jcl_org_dept where delete_type =0 and forbidden_tag=0) and delete_type =0 and forbidden_tag=0");
while (rs.next()) {
Long departmentId = Long.parseLong(Util.null2String(rs.getString("id")));
DepartmentPO deptById = MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptById(departmentId);
new DepartmentTriggerRunnable(deptById, deptById).run();
String parentDepartmentId = Util.null2String(rs.getString("parent_dept"));
if (StringUtils.isNotBlank(parentDepartmentId)) {
RefreshPlan.refreshDepartment(Long.parseLong(parentDepartmentId), departmentSet);
}
}
// 刷新分部
rs.executeQuery("select id, parent_company from jcl_org_comp where id not in( select ifnull(parent_company , '') from jcl_org_comp where delete_type =0 and forbidden_tag=0) and delete_type =0 and forbidden_tag=0");
while (rs.next()) {
Long companyId = Long.parseLong(Util.null2String(rs.getString("id")));
CompPO compPO = MapperProxyFactory.getProxy(CompMapper.class).listById(companyId);
new CompanyTriggerRunnable(compPO, compPO).run();
String parentCompanyId = Util.null2String(rs.getString("parent_company"));
if (StringUtils.isNotBlank(parentCompanyId)) {
RefreshPlan.refreshCompany(Long.parseLong(parentCompanyId), companySet);
}
}
out.println("数据刷新完成");
%>