diff --git a/interface/InitStaffPermanentNum.jsp b/interface/InitStaffPermanentNum.jsp new file mode 100644 index 00000000..fcd3240d --- /dev/null +++ b/interface/InitStaffPermanentNum.jsp @@ -0,0 +1,61 @@ +<%@ page import="weaver.conn.RecordSet" %> +<%@ page import="com.engine.organization.entity.staff.po.StaffPO" %> +<%@ page import="java.util.List" %> +<%@ page import="java.util.ArrayList" %> +<%@ page import="com.engine.organization.entity.job.po.JobPO" %> +<%@ page import="com.engine.organization.util.db.MapperProxyFactory" %> +<%@ page import="com.engine.organization.mapper.job.JobMapper" %> +<%@ page import="com.engine.organization.entity.staff.bo.StaffBO" %> +<%@ page import="com.engine.organization.mapper.staff.StaffMapper" %> +<%@ page contentType="text/html; charset=UTF-8" %> +<% + + RecordSet rs = new RecordSet(); + List staffPOList = new ArrayList<>(); + String sql = "select * from jcl_org_staff where permanent_num = 0 and is_used = 0 and delete_type = 0"; + rs.executeQuery(sql); + while (rs.next()) { + StaffPO staffPO = new StaffPO(); + staffPO.setId(-1 == rs.getInt("id") ? 0L : (long) rs.getInt("id")); + staffPO.setPlanId(-1 == rs.getInt("plan_id") ? 0L : (long) rs.getInt("plan_id")); + staffPO.setCompId(-1 == rs.getInt("comp_id") ? 0 : rs.getInt("comp_id")); + staffPO.setEcCompany(-1 == rs.getInt("ec_company") ? 0 : rs.getInt("ec_company")); + staffPO.setDeptId(-1 == rs.getInt("dept_id") ? 0 : rs.getInt("dept_id")); + staffPO.setEcDepartment(-1 == rs.getInt("ec_department") ? 0 : rs.getInt("ec_department")); + staffPO.setJobId(-1 == rs.getInt("job_id") ? 0L : (long) rs.getInt("job_id")); + staffPO.setStaffNum(-1 == rs.getInt("staff_num") ? 0 : rs.getInt("staff_num")); + staffPO.setControlPolicy(-1 == rs.getInt("control_policy") ? 0 : rs.getInt("control_policy")); + staffPO.setPermanentNum(-1 == rs.getInt("permanent_num") ? 0 : rs.getInt("permanent_num")); + staffPO.setFreezeNum(-1 == rs.getInt("freeze_num") ? 0 : rs.getInt("freeze_num")); + staffPO.setDescription(rs.getString("description")); + staffPO.setCreator((long) rs.getInt("creator")); staffPO.setCreator((long) rs.getInt("creator")); + staffPOList.add(staffPO); + } + + for (StaffPO staffPO : staffPOList) { + sql = "select count(1) as num from hrmresource where STATUS < 4"; + if (null != staffPO.getEcCompany() && 0 != staffPO.getEcCompany()) { + sql += " and subcompanyid1 = " + staffPO.getEcCompany(); + } + if (null != staffPO.getEcDepartment() && 0 != staffPO.getEcDepartment()) { + sql += " and departmentid = " + staffPO.getEcDepartment(); + } + if (null != staffPO.getJobId() && 0 != staffPO.getJobId()) { + JobPO jobById = MapperProxyFactory.getProxy(JobMapper.class).getJobById(staffPO.getJobId()); + if (null == jobById) { + continue; + } + Integer ecJobTitle = jobById.getEcJobTitle(); + sql += " and jobtitle = " + ecJobTitle; + } + rs.executeQuery(sql); + if (rs.next()) { + staffPO.setPermanentNum(-1 == rs.getInt("num") ? 0 : rs.getInt("num")); + StaffBO.buildStaffDesc(staffPO); + MapperProxyFactory.getProxy(StaffMapper.class).updateStaff(staffPO); + } + } + + + out.println("在编数初始化完成"); +%> \ No newline at end of file