From 83ef362e453972f680ac761d28ca0f2f14bae5c7 Mon Sep 17 00:00:00 2001 From: dxfeng Date: Tue, 9 May 2023 09:29:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E5=9C=A8=E7=BC=96?= =?UTF-8?q?=E6=95=B0JSP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- interface/InitStaffPermanent.jsp | 61 ++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 interface/InitStaffPermanent.jsp diff --git a/interface/InitStaffPermanent.jsp b/interface/InitStaffPermanent.jsp new file mode 100644 index 00000000..fcd3240d --- /dev/null +++ b/interface/InitStaffPermanent.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