|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
package weaver.interfaces.organization.cronJob;
|
|
|
|
|
package weaver.interfaces.organization.cronjob;
|
|
|
|
|
|
|
|
|
|
import com.engine.organization.entity.map.JclOrgMap;
|
|
|
|
|
import com.engine.organization.entity.staff.po.StaffPO;
|
|
|
|
|
import com.engine.organization.mapper.jclorgmap.JclOrgMapper;
|
|
|
|
|
import com.engine.organization.mapper.staff.StaffMapper;
|
|
|
|
|
import com.engine.organization.util.OrganizationDateUtil;
|
|
|
|
@ -12,7 +13,9 @@ import weaver.general.Util;
|
|
|
|
|
import weaver.interfaces.schedule.BaseCronJob;
|
|
|
|
|
|
|
|
|
|
import java.sql.Date;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 定时任务刷新在岗数、编制数
|
|
|
|
@ -39,21 +42,43 @@ public class JobAndPlanCron extends BaseCronJob {
|
|
|
|
|
List<JclOrgMap> jclOrgMaps = getJclOrgMapMapper().getJclOrgMapByType(fType,new java.sql.Date(OrganizationDateUtil.stringToDate(currentDate).getTime()));
|
|
|
|
|
|
|
|
|
|
for (JclOrgMap jclOrgMap : jclOrgMaps){
|
|
|
|
|
String id = String.valueOf(jclOrgMap.getId());
|
|
|
|
|
|
|
|
|
|
int id = jclOrgMap.getId();
|
|
|
|
|
countJobAndPlans(fType,id,currentDate);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 刷新在岗数
|
|
|
|
|
* 刷新在岗、编制数
|
|
|
|
|
*/
|
|
|
|
|
void countJobs(String type,int id,String currentDate) {
|
|
|
|
|
//找上级
|
|
|
|
|
void countJobAndPlans(String type,int id,String currentDate) {
|
|
|
|
|
Date date = new Date(OrganizationDateUtil.stringToDate(currentDate).getTime());
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
|
StaffPO staffPO = null;
|
|
|
|
|
switch (type) {
|
|
|
|
|
case "1":
|
|
|
|
|
staffPO = getStaffMapper().getStaffsByParamId(Integer.parseInt(type), String.valueOf(id), null, null);
|
|
|
|
|
break;
|
|
|
|
|
case "2":
|
|
|
|
|
staffPO = getStaffMapper().getStaffsByParamId(Integer.parseInt(type), null, String.valueOf(id), null);
|
|
|
|
|
break;
|
|
|
|
|
case "3":
|
|
|
|
|
staffPO = getStaffMapper().getStaffsByParamId(Integer.parseInt(type), null, null, String.valueOf(id));
|
|
|
|
|
rs.executeQuery("select count(1) as fonjob from jcl_org_map ftype=? and id=? and fdateend>?");
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
getJclOrgMapMapper().updateMapById(id, null, Integer.valueOf(rs.getString("fonjob")), date);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (staffPO != null) {
|
|
|
|
|
// 处理自身
|
|
|
|
|
getJclOrgMapMapper().updateMapById(id, staffPO.getStaffNum(), null, date);
|
|
|
|
|
}
|
|
|
|
|
//处理上级
|
|
|
|
|
String sql = "select fparentid from jcl_org_map where ftype=? and id=? and fdateend>?";
|
|
|
|
|
String typeSql = "select ftype from jcl_org_map where id=? and fdateend>?";
|
|
|
|
|
rs.executeQuery(sql, type, currentDate);
|
|
|
|
|
rs.executeQuery(sql, type, id, currentDate);
|
|
|
|
|
String fparentid = null;
|
|
|
|
|
String ftype = null;
|
|
|
|
|
if (rs.next()) {
|
|
|
|
@ -63,34 +88,13 @@ public class JobAndPlanCron extends BaseCronJob {
|
|
|
|
|
ftype = rs.getString("ftype");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
JclOrgMap jclOrgMap = getJclOrgMapMapper().getSumPlanAndJobByFParentId(new Date(OrganizationDateUtil.stringToDate(currentDate).getTime()), fparentid);
|
|
|
|
|
getJclOrgMapMapper().updateMapById(Integer.parseInt(fparentid), jclOrgMap.getFPlan(), jclOrgMap.getFOnJob(), new Date(OrganizationDateUtil.stringToDate(currentDate).getTime()));
|
|
|
|
|
JclOrgMap jclOrgMap = getJclOrgMapMapper().getSumPlanAndJobByFParentId(date, fparentid);
|
|
|
|
|
getJclOrgMapMapper().updateMapById(Integer.parseInt(fparentid), jclOrgMap.getFPlan(), null, date);
|
|
|
|
|
|
|
|
|
|
if (fparentid.equals("-1")) {
|
|
|
|
|
countJobs(ftype, Integer.parseInt(fparentid), currentDate);
|
|
|
|
|
countJobAndPlans(ftype, Integer.parseInt(fparentid), String.valueOf(currentDate));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 刷新编制数
|
|
|
|
|
*/
|
|
|
|
|
void countPlans(String type,int id,String currentDate) {
|
|
|
|
|
//找上级
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
|
String sql = "select fparentid from jcl_org_map where ftype=? and id=? and fdateend>?";
|
|
|
|
|
String typeSql = "select ftype from jcl_org_map where id=? and fdateend>?";
|
|
|
|
|
rs.executeQuery(sql, type, currentDate);
|
|
|
|
|
String fparentid = null;
|
|
|
|
|
String ftype = null;
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
fparentid = rs.getString("fparentid");
|
|
|
|
|
rs.executeQuery(typeSql, fparentid, currentDate);
|
|
|
|
|
if (rs.next()) {
|
|
|
|
|
ftype = rs.getString("ftype");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// JclOrgMap jclOrgMap
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|