From 2fb33877f5429229b9a0d4ae169e6abc6ecfdfce Mon Sep 17 00:00:00 2001 From: dxfeng Date: Wed, 29 Jun 2022 09:11:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=BA=E5=91=98=E5=AF=BC=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/hrmresource/po/HrmResourcePO.java | 179 ++++- .../organization/mapper/comp/CompMapper.xml | 4 +- .../mapper/hrmresource/HrmResourceMapper.java | 12 + .../mapper/hrmresource/HrmResourceMapper.xml | 26 + .../HrmResourceImportAdaptServiceImpl.java | 12 +- .../HrmResourceImportProcessServiceImpl.java | 699 ++++++++---------- .../service/impl/HrmResourceServiceImpl.java | 8 +- .../organization/util/PageInfoSortUtil.java | 26 +- 8 files changed, 575 insertions(+), 391 deletions(-) create mode 100644 src/com/engine/organization/mapper/hrmresource/HrmResourceMapper.java create mode 100644 src/com/engine/organization/mapper/hrmresource/HrmResourceMapper.xml diff --git a/src/com/engine/organization/entity/hrmresource/po/HrmResourcePO.java b/src/com/engine/organization/entity/hrmresource/po/HrmResourcePO.java index 678f639a..3245bc2c 100644 --- a/src/com/engine/organization/entity/hrmresource/po/HrmResourcePO.java +++ b/src/com/engine/organization/entity/hrmresource/po/HrmResourcePO.java @@ -40,7 +40,7 @@ public class HrmResourcePO { /** * 性别 */ - private Integer sex; + private String sex; /** * 账号类型 @@ -75,7 +75,7 @@ public class HrmResourcePO { /** * 职称 */ - private Long jobCall; + private Integer jobCall; /** * 职级 @@ -120,12 +120,12 @@ public class HrmResourcePO { /** * 直接上级 */ - private Long managerId; + private Integer managerId; /** * 助理 */ - private Long assistantId; + private Integer assistantId; /** * 移动电话 @@ -161,4 +161,175 @@ public class HrmResourcePO { private int deleteType; private Date createTime; private Date updateTime; + + /** + * 密码 + */ + private String passWord; + + /** + * 安全级别 + */ + private Integer secLevel; + + /** + * 出生日期 + */ + private String birthday; + + /** + * 民族 + */ + private String folk; + + /** + * 籍贯 + */ + private String nativePlace; + + /** + * 户口 + */ + private String regResidentPlace; + + /** + * 身份证号码 + */ + private String certificateNum; + + /** + * 婚姻状况 + */ + private String maritalStatus; + + /** + * 政治面貌 + */ + private String policy; + + /** + * 入团日期 + */ + private String beMemberDate; + + /** + * 入党日期 + */ + private String bePartyDate; + + /** + * 工会会员 + */ + private String islabouunion; + + /** + * 学位 + */ + private String degree; + + /** + * 健康状况 + */ + private String healthInfo; + + /** + * 学历 + */ + private Integer educationLevel; + + /** + * 身高 + */ + private String height; + + /** + * 体重 + */ + private Integer weight; + + /** + * 用工性质 + */ + private Integer useKind; + + /** + * 合同开始日期 + */ + private String startDate; + + /** + * 合同结束日期 + */ + private String endDate; + + /** + * 试用期结束日期 + */ + private String probationEndDate; + + /** + * 现居住地 + */ + private String residentPlace; + + /** + * 家庭联系方式 + */ + private String homeAddress; + + /** + * 暂住证号码 + */ + private String tempResidentNumber; + + /** + * 入职日期 + */ + private String companyStartDate; + + /** + * 参加工作日期 + */ + private String workStartDate; + + /** + * 公积金帐户 + */ + private String accumFundAccount; + + /** + * 工资账号户名 + */ + private String accountName; + + /** + * 工资银行 + */ + private Integer bankId; + + /** + * 工资账号 + */ + private String accountId; + + /** + * 显示顺序 + */ + private Integer showOrder; + + /** + * 人员密级 + */ + private Integer classification; + + + private String workYear; + + + private String companyWorkYear; + + private String baseFieldsValue=""; + + private String baseFields=""; + } diff --git a/src/com/engine/organization/mapper/comp/CompMapper.xml b/src/com/engine/organization/mapper/comp/CompMapper.xml index d22ac668..ad99cb0a 100644 --- a/src/com/engine/organization/mapper/comp/CompMapper.xml +++ b/src/com/engine/organization/mapper/comp/CompMapper.xml @@ -135,7 +135,9 @@ #{description}, 0, - #{showOrder}, + + #{showOrder}, + diff --git a/src/com/engine/organization/mapper/hrmresource/HrmResourceMapper.java b/src/com/engine/organization/mapper/hrmresource/HrmResourceMapper.java new file mode 100644 index 00000000..97f2b629 --- /dev/null +++ b/src/com/engine/organization/mapper/hrmresource/HrmResourceMapper.java @@ -0,0 +1,12 @@ +package com.engine.organization.mapper.hrmresource; + +/** + * @description: + * @author:dxfeng + * @createTime: 2022/05/20 + * @version: 1.0 + */ +public interface HrmResourceMapper { + + Long getMaxId(); +} diff --git a/src/com/engine/organization/mapper/hrmresource/HrmResourceMapper.xml b/src/com/engine/organization/mapper/hrmresource/HrmResourceMapper.xml new file mode 100644 index 00000000..623d442e --- /dev/null +++ b/src/com/engine/organization/mapper/hrmresource/HrmResourceMapper.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + t.id + , t.creator + , t.delete_type + , t.create_time + , t.update_time + + + + \ No newline at end of file diff --git a/src/com/engine/organization/service/impl/HrmResourceImportAdaptServiceImpl.java b/src/com/engine/organization/service/impl/HrmResourceImportAdaptServiceImpl.java index f6623595..b9f7a472 100644 --- a/src/com/engine/organization/service/impl/HrmResourceImportAdaptServiceImpl.java +++ b/src/com/engine/organization/service/impl/HrmResourceImportAdaptServiceImpl.java @@ -477,13 +477,13 @@ public class HrmResourceImportAdaptServiceImpl extends Service implements HrmRes } String val = ""; switch (key) { - case "loginid": + case "login_id": val = importParam.getLogin_id(); break; - case "workcode": + case "work_code": val = importParam.getWork_code(); break; - case "certificatenum": + case "certificate_num": val = importParam.getCertificate_num(); break; } @@ -536,15 +536,15 @@ public class HrmResourceImportAdaptServiceImpl extends Service implements HrmRes String val = ""; String errorMsg = ""; switch (key) { - case "loginid": + case "login_id": val = Util.null2String(importParam.getLogin_id()).trim(); errorMsg = SystemEnv.getHtmlLabelName(520127, userlanguage); break; - case "workcode": + case "work_code": val = Util.null2String(importParam.getWork_code()).trim(); errorMsg = SystemEnv.getHtmlLabelName(520128, userlanguage); break; - case "certificatenum": + case "certificate_num": val = Util.null2String(importParam.getCertificate_num()).trim(); errorMsg = SystemEnv.getHtmlLabelName(83623, userlanguage); break; diff --git a/src/com/engine/organization/service/impl/HrmResourceImportProcessServiceImpl.java b/src/com/engine/organization/service/impl/HrmResourceImportProcessServiceImpl.java index ca016ad6..b0efb931 100644 --- a/src/com/engine/organization/service/impl/HrmResourceImportProcessServiceImpl.java +++ b/src/com/engine/organization/service/impl/HrmResourceImportProcessServiceImpl.java @@ -1,9 +1,6 @@ package com.engine.organization.service.impl; import com.engine.common.entity.EncryptFieldEntity; -import com.engine.common.service.ThemeService; -import com.engine.common.service.impl.HrmCommonServiceImpl; -import com.engine.common.service.impl.ThemeServiceImpl; import com.engine.common.util.ParamUtil; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; @@ -17,8 +14,20 @@ import com.engine.hrm.util.HrmWeakPasswordUtil; import com.engine.hrm.util.face.HrmFaceCheckManager; import com.engine.hrm.util.face.ValidateFieldManager; import com.engine.hrm.util.face.bean.CheckItemBean; +import com.engine.organization.entity.company.po.CompPO; +import com.engine.organization.entity.department.po.DepartmentPO; import com.engine.organization.entity.hrmresource.param.HrmResourceImportParam; +import com.engine.organization.entity.hrmresource.po.HrmResourcePO; +import com.engine.organization.entity.job.po.JobPO; +import com.engine.organization.mapper.comp.CompMapper; +import com.engine.organization.mapper.department.DepartmentMapper; +import com.engine.organization.mapper.hrmresource.HrmResourceMapper; +import com.engine.organization.mapper.job.JobMapper; +import com.engine.organization.mapper.post.PostInfoMapper; +import com.engine.organization.mapper.post.PostMapper; import com.engine.organization.service.HrmResourceImportProcessService; +import com.engine.organization.util.PageInfoSortUtil; +import com.engine.organization.util.db.MapperProxyFactory; import com.weaver.integration.ldap.sync.oa.OaSync; import com.weaver.integration.ldap.util.AuthenticUtil; import ln.LN; @@ -26,7 +35,6 @@ import org.apache.commons.lang3.StringUtils; import org.json.JSONObject; import weaver.common.StringUtil; import weaver.conn.RecordSet; -import weaver.conn.RecordSetTrans; import weaver.encrypt.EncryptUtil; import weaver.general.BaseBean; import weaver.general.PasswordUtil; @@ -50,10 +58,8 @@ import weaver.hrm.settings.ChgPasswdReminder; import weaver.hrm.settings.RemindSettings; import weaver.hrm.tools.HrmDateCheck; import weaver.interfaces.hrm.HrmServiceManager; -import weaver.join.hrm.in.HrmResource; import weaver.join.hrm.in.ImportLog; import weaver.join.hrm.in.processImpl.HrmTlevelManager; -import weaver.matrix.MatrixUtil; import weaver.rtx.OrganisationCom; import weaver.systeminfo.SystemEnv; @@ -117,6 +123,31 @@ public class HrmResourceImportProcessServiceImpl extends Service implements HrmR //判断弱密码 private HrmWeakPasswordUtil hrmWeakPasswordUtil; + + private HrmResourceMapper getResourceMapper() { + return MapperProxyFactory.getProxy(HrmResourceMapper.class); + } + + private CompMapper getCompMapper() { + return MapperProxyFactory.getProxy(CompMapper.class); + } + + private DepartmentMapper getDepartmentMapper() { + return MapperProxyFactory.getProxy(DepartmentMapper.class); + } + + private JobMapper getJobMapper() { + return MapperProxyFactory.getProxy(JobMapper.class); + } + + private PostInfoMapper getPostInfoMapper() { + return MapperProxyFactory.getProxy(PostInfoMapper.class); + } + + private PostMapper getPostMapper() { + return MapperProxyFactory.getProxy(PostMapper.class); + } + @Override public void setUser(User user) { this.user = user; @@ -223,11 +254,11 @@ public class HrmResourceImportProcessServiceImpl extends Service implements HrmR try { String subCompanyName = ""; //分部名称 String departmentName = ""; //部门名称 - int subcompanyid1 = 0; // 分部Id - int departmentid = 0; // 部门id + long companyId = 0L; // 分部Id + long departmentId = 0L; // 部门id String key; // workcode_lastname 组合 getKeyMap(keyField); //获取重复性验证字段Map - int id; + Long id; ResourceComInfo resourcecominfo = new ResourceComInfo(); DepartmentComInfo departmentComInfo = new DepartmentComInfo(); @@ -242,23 +273,19 @@ public class HrmResourceImportProcessServiceImpl extends Service implements HrmR Set keySet = hrMap.keySet(); Object[] keyArray = keySet.toArray(); - Class hrmClass = HrmResource.class; + Class resourcePOClass = HrmResourcePO.class; Class importParamClass = HrmResourceImportParam.class; - String field = "id,subcompanyid1,departmentid,workcode,lastname," + "loginid,password,seclevel,sex,jobtitle,jobcall,joblevel," + "jobactivitydesc,managerid,assistantid,status,locationid,workroom," + "telephone,mobile,mobilecall,fax,email," + "systemlanguage,birthday,folk,nativeplace,regresidentplace," + "certificatenum,maritalstatus,policy,bememberdate,bepartydate," + "islabouunion,educationlevel,degree,healthinfo,height,weight," + "usekind,startdate,enddate,probationenddate,"//add by lvyi - + "residentplace,homeaddress,tempresidentnumber," + "datefield1,datefield2,datefield3,datefield4,datefield5," + "textfield1,textfield2,textfield3,textfield4,textfield5," + "numberfield1,numberfield2,numberfield3,numberfield4,numberfield5," + "tinyintfield1,tinyintfield2,tinyintfield3,tinyintfield4,tinyintfield5," + "companystartdate,workstartdate," + "accumfundaccount,accounttype,belongto,accountname,bankid1,accountid1,dsporder,classification"; + String field = "id,work_code,login_id,last_name,sex,account_type,belong_to,company_id,department_id,job_activity,job_title,job_call,job_level,job_group_id,job_activity_desc,status,system_language,resource_image_id,messager_url,location_id,manager_id,assistant_id,mobile,telephone,mobile_call,fax,email,workroom,pass_word,sec_level,birthday,folk,native_place,reg_resident_place,certificate_num,marital_status,policy,be_member_date,be_party_date,islabouunion,degree,health_info,education_level,height,weight,use_kind,start_date,end_date,probation_end_date,resident_place,home_address,temp_resident_number,company_start_date,work_start_date,accum_fund_account,account_name,bank_id,account_id,show_order,classification,company_work_year,work_year"; String[] fields = field.split(","); int createrid = 1; // 创建者id - int lastmodid = 1; // 最后修改者id + // 最后修改者id if (user != null) { createrid = user.getUID(); - lastmodid = user.getUID(); } - String lastmoddate = date; // 最后修改时间 - ChgPasswdReminder reminder = new ChgPasswdReminder(); RemindSettings settings = reminder.getRemindSettings(); //判断是否启用【启用初始密码】 @@ -278,18 +305,17 @@ public class HrmResourceImportProcessServiceImpl extends Service implements HrmR } Object obj; - HrmResource hrm; + HrmResourcePO hrmResourcePO; for (Object o : keyArray) { obj = o; hrmResourceImportParam = hrMap.get(obj); key = (String) obj; - hrm = new HrmResource(); + hrmResourcePO = new HrmResourcePO(); this.rowNum++; //TimeUnit.SECONDS.sleep(1); try { // 异常处理 if (operateType.equals("add")) { - if (keyMap.get(key) != null) { resultList.add(createLog(hrmResourceImportParam, "创建", "失败", SystemEnv.getHtmlLabelName(83520, userlanguage))); continue; @@ -330,27 +356,27 @@ public class HrmResourceImportProcessServiceImpl extends Service implements HrmR if (!subCompanyNames.equals(subCompanyName)) { tempSubCompanyName = subCompanyName; subCompanyName = subCompanyNames; - subcompanyid1 = getSubCompanyId(subCompanyName); + companyId = getSubCompanyId(subCompanyName); } - if (subcompanyid1 == -9) { + if (companyId == -9) { resultList.add(createLog(hrmResourceImportParam, "创建", "失败", SystemEnv.getErrorMsgName(56, userlanguage))); continue; } - if (subcompanyid1 == -2) { + if (companyId == -2) { resultList.add(createLog(hrmResourceImportParam, "创建", "失败", SystemEnv.getHtmlLabelName(126274, userlanguage))); continue; } - if (subcompanyid1 == -1) { + if (companyId == -1) { resultList.add(createLog(hrmResourceImportParam, "创建", "失败", SystemEnv.getHtmlLabelName(83524, userlanguage))); continue; } if (StringUtil.parseToInt(license.getConcurrentFlag(), 0) != 1) { - if (new HrmResourceManager().noMore(String.valueOf(subcompanyid1))) { + if (new HrmResourceManager().noMore(String.valueOf(companyId))) { resultList.add(createLog(hrmResourceImportParam, "创建", "失败", SystemEnv.getHtmlLabelName(83525, userlanguage))); continue; } } - hrm.setSubcompanyid1(subcompanyid1); + hrmResourcePO.setCompanyId(companyId); } else { resultList.add(createLog(hrmResourceImportParam, "创建", "失败", SystemEnv.getHtmlLabelName(83526, userlanguage))); continue; @@ -361,13 +387,13 @@ public class HrmResourceImportProcessServiceImpl extends Service implements HrmR if (departmentNames != null) { if (!subCompanyNames.equals(tempSubCompanyName) || !departmentNames.equals(departmentName)) { departmentName = departmentNames; - departmentid = getDeptId(departmentName, subcompanyid1); + departmentId = getDeptId(departmentName, companyId); } - if (departmentid == -2) { + if (departmentId == -2) { resultList.add(createLog(hrmResourceImportParam, "创建", "失败", SystemEnv.getHtmlLabelName(126275, userlanguage))); continue; } - hrm.setDepartmentid(departmentid); + hrmResourcePO.setDepartmentId(departmentId); } else { resultList.add(createLog(hrmResourceImportParam, "创建", "失败", SystemEnv.getHtmlLabelName(83527, userlanguage))); continue; @@ -381,44 +407,44 @@ public class HrmResourceImportProcessServiceImpl extends Service implements HrmR //主账号id-sunjsh if (hrmResourceImportParam.getAccount_type() != null && !"".equals(hrmResourceImportParam.getAccount_type())) { if ("主账号".equals(hrmResourceImportParam.getAccount_type())) { - hrm.setBelongto(-1); - hrm.setAccounttype(0); + hrmResourcePO.setBelongTo(-1L); + hrmResourcePO.setAccountType(0); } else if ("次账号".equals(hrmResourceImportParam.getAccount_type())) { if (hrmResourceImportParam.getBelong_to() != null && !"".equals(hrmResourceImportParam.getBelong_to().trim())) { - int belongTo = getBelongId(hrmResourceImportParam.getBelong_to(), keyField); - hrm.setBelongto(belongTo); + long belongTo = getBelongId(hrmResourceImportParam.getBelong_to(), keyField); + hrmResourcePO.setBelongTo(belongTo); if (!hrmResourceImportParam.getBelong_to().equals("") && belongTo == 0) { resultList.add(createLog(hrmResourceImportParam, "创建", "失败", SystemEnv.getHtmlLabelName(131279, userlanguage))); continue; } else { - hrm.setAccounttype(1); + hrmResourcePO.setAccountType(1); } } else { resultList.add(createLog(hrmResourceImportParam, "创建", "失败", SystemEnv.getHtmlLabelName(131279, userlanguage))); continue; } } else { - hrm.setBelongto(-1); - hrm.setAccounttype(0); + hrmResourcePO.setBelongTo(-1L); + hrmResourcePO.setAccountType(0); } } else if (hrmResourceImportParam.getBelong_to() != null && !"".equals(hrmResourceImportParam.getBelong_to().trim())) { - int belongto = getBelongId(hrmResourceImportParam.getBelong_to(), keyField); - hrm.setBelongto(belongto); - if (!hrmResourceImportParam.getBelong_to().equals("") && belongto == 0) { + long belongTo = getBelongId(hrmResourceImportParam.getBelong_to(), keyField); + hrmResourcePO.setBelongTo(belongTo); + if (!hrmResourceImportParam.getBelong_to().equals("") && belongTo == 0) { resultList.add(createLog(hrmResourceImportParam, "创建", "失败", SystemEnv.getHtmlLabelName(131279, userlanguage))); continue; } else { - hrm.setAccounttype(1); + hrmResourcePO.setAccountType(1); } } else { - hrm.setBelongto(-1); - hrm.setAccounttype(0); + hrmResourcePO.setBelongTo(-1L); + hrmResourcePO.setAccountType(0); } // 岗位id if (hrmResourceImportParam.getJob_title() != null && hrmResourceImportParam.getJob_activity() != null && hrmResourceImportParam.getJob_group_id() != null) { - int jobtitle = getJobTitles(hrmResourceImportParam.getJob_title(), hrmResourceImportParam.getJob_activity(), hrmResourceImportParam.getJob_group_id()); - hrm.setJobtitle(jobtitle); + String jobNames = hrmResourceImportParam.getJob_title(); + hrmResourcePO.setJobTitle(getJobTitles(companyId, departmentId, jobNames)); } else { resultList.add(createLog(hrmResourceImportParam, "创建", "失败", SystemEnv.getHtmlLabelName(83531, userlanguage))); continue; @@ -426,32 +452,22 @@ public class HrmResourceImportProcessServiceImpl extends Service implements HrmR //上级id if (hrmResourceImportParam.getManager_id() != null) { - int managerid = 0; // 上级Id - String managerstr = ""; //所有上级 - Map managerInfo = getManagerIdAndStr("", hrmResourceImportParam.getManager_id(), keyField); - if (managerInfo != null) { - managerid = managerInfo.get("managerid") != null ? (Integer) managerInfo.get("managerid") : 0; - managerstr = (String) (managerInfo.get("managerstr") != null ? managerInfo.get("managerstr") : ""); - } - hrm.setManagerid(managerid); - hrm.setManagerstr(managerstr); - + int managerid = getManagerId("", hrmResourceImportParam.getManager_id(), keyField); + hrmResourcePO.setManagerId(managerid); //如果vo.getManagerid()有值,但manageid未找到,说明填写有误 if (!hrmResourceImportParam.getManager_id().equals("") && managerid == 0) { resultList.add(createLog(hrmResourceImportParam, "创建", "失败", SystemEnv.getHtmlLabelName(83532, userlanguage))); continue; } } else { - - hrm.setManagerid(0); - hrm.setManagerstr(""); + hrmResourcePO.setManagerId(0); } // 助理id if (hrmResourceImportParam.getAssistant_id() != null) { - int assistantid = getAssistantid(hrmResourceImportParam.getAssistant_id(), keyField); - hrm.setAssistantid(assistantid); - if (!hrmResourceImportParam.getAssistant_id().equals("") && assistantid == 0) { + int assistantId = getAssistantid(hrmResourceImportParam.getAssistant_id(), keyField); + hrmResourcePO.setAssistantId(assistantId); + if (!hrmResourceImportParam.getAssistant_id().equals("") && assistantId == 0) { resultList.add(createLog(hrmResourceImportParam, "创建", "失败", SystemEnv.getHtmlLabelName(24678, userlanguage))); continue; } @@ -459,8 +475,7 @@ public class HrmResourceImportProcessServiceImpl extends Service implements HrmR // 办公地点 if (hrmResourceImportParam.getLocation_id() != null) { - int locationid = getLocationid(hrmResourceImportParam.getLocation_id()); - hrm.setLocationid(locationid); + hrmResourcePO.setLocationId(getLocationid(hrmResourceImportParam.getLocation_id())); } else { resultList.add(createLog(hrmResourceImportParam, "创建", "失败", SystemEnv.getHtmlLabelName(83533, userlanguage))); continue; @@ -471,7 +486,7 @@ public class HrmResourceImportProcessServiceImpl extends Service implements HrmR if (!"".equals(hrmResourceImportParam.getEmail().trim()) && hrmResourceImportParam.getEmail().contains("*")) { hrmResourceImportParam.setEmail(null); } else if ("".equals(hrmResourceImportParam.getEmail().trim())) { - hrm.setEmail(""); + hrmResourcePO.setEmail(""); } else { Pattern pattern = Pattern.compile("^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$"); Matcher matcher = pattern.matcher(hrmResourceImportParam.getEmail()); @@ -479,7 +494,7 @@ public class HrmResourceImportProcessServiceImpl extends Service implements HrmR resultList.add(createLog(hrmResourceImportParam, "创建", "失败", SystemEnv.getHtmlLabelName(24570, userlanguage))); continue; } else { - hrm.setEmail(hrmResourceImportParam.getEmail()); + hrmResourcePO.setEmail(hrmResourceImportParam.getEmail()); } } } @@ -488,7 +503,7 @@ public class HrmResourceImportProcessServiceImpl extends Service implements HrmR if (hrmResourceImportParam.getMobile() != null) { if ("".equals(hrmResourceImportParam.getMobile().trim()) || (!"".equals(hrmResourceImportParam.getMobile().trim()) && hrmResourceImportParam.getMobile().contains("*"))) hrmResourceImportParam.setMobile(null); - } else hrm.setMobile(""); + } else hrmResourcePO.setMobile(""); //工资银行-sunjsh if (hrmResourceImportParam.getBank_id() != null && !"".equals(hrmResourceImportParam.getBank_id())) { @@ -501,29 +516,29 @@ public class HrmResourceImportProcessServiceImpl extends Service implements HrmR String fieldvalue = HrmFieldManager.getReallyFieldvalue(jsonObject); if (!"".equals(fieldvalue)) { - hrm.setBankid1(new Integer(fieldvalue)); + hrmResourcePO.setBankId(new Integer(fieldvalue)); } else { - hrm.setBankid1(this.getBankId(hrmResourceImportParam.getBank_id())); + hrmResourcePO.setBankId(this.getBankId(hrmResourceImportParam.getBank_id())); } } //sunjsh-入职日期 if (hrmResourceImportParam.getCompany_start_date() != null && !"".equals(hrmResourceImportParam.getCompany_start_date())) { - hrm.setCompanystartdate(hrmResourceImportParam.getCompany_start_date()); + hrmResourcePO.setCompanyStartDate(hrmResourceImportParam.getCompany_start_date()); } //sunjsh-参加工作日期 if (hrmResourceImportParam.getWork_start_date() != null && !"".equals(hrmResourceImportParam.getWork_start_date())) { - hrm.setWorkstartdate(hrmResourceImportParam.getWork_start_date()); + hrmResourcePO.setWorkStartDate(hrmResourceImportParam.getWork_start_date()); } // 性别,为空或其他情况统一为0(男) String sex = "女".equals(hrmResourceImportParam.getSex()) ? "1" : "0"; - hrm.setSex(sex); + hrmResourcePO.setSex(sex); // 职称 if (hrmResourceImportParam.getJob_call() != null) { int jobcall = getJobcall(hrmResourceImportParam.getJob_call()); - hrm.setJobcall(jobcall); + hrmResourcePO.setJobCall(jobcall); } // 系统语言,默认简体中文 if (hrmResourceImportParam.getSystem_language() != null) { @@ -537,44 +552,44 @@ public class HrmResourceImportProcessServiceImpl extends Service implements HrmR resultList.add(createLog(hrmResourceImportParam, "创建", "失败", SystemEnv.getHtmlLabelName(84810, userlanguage))); continue; } - hrm.setSystemlanguage(systemlanguage); + hrmResourcePO.setSystemLanguage(systemlanguage); } else { - hrm.setSystemlanguage(7); + hrmResourcePO.setSystemLanguage(7); } // 婚姻状况,如果不是以下选项,则默认为未婚 String maritalStatus = "已婚".equals(hrmResourceImportParam.getMarital_status()) ? "1" : "离异".equals(hrmResourceImportParam.getMarital_status()) ? "2" : "0"; - hrm.setMaritalstatus(maritalStatus); + hrmResourcePO.setMaritalStatus(maritalStatus); // 员工状态 if (!"".equals(Util.null2String(hrmResourceImportParam.getStatus()))) { int status = getStatus(hrmResourceImportParam.getStatus()); - hrm.setStatus(status); + hrmResourcePO.setStatus(status); } else { - hrm.setStatus(1); + hrmResourcePO.setStatus(1); } // 人员密级 if (!"".equals(Util.null2String(hrmResourceImportParam.getClassification()))) { int classification = getClassification(hrmResourceImportParam.getClassification()); - hrm.setClassification(classification); + hrmResourcePO.setClassification(classification); } // 学历 if (hrmResourceImportParam.getEducation_level() != null) { int educationLevel = getEducationlevel(hrmResourceImportParam.getEducation_level()); - hrm.setEducationlevel(educationLevel); + hrmResourcePO.setEducationLevel(educationLevel); } // 工会会员,默认为是 String islabouunion = "是".equals(hrmResourceImportParam.getIslabouunion()) ? "1" : "0"; - hrm.setIslabouunion(islabouunion); + hrmResourcePO.setIslabouunion(islabouunion); // 健康状况 if (hrmResourceImportParam.getHealth_info() != null) { String healthinfo = getHealthinfo(hrmResourceImportParam.getHealth_info()); - hrm.setHealthinfo(healthinfo); + hrmResourcePO.setHealthInfo(healthinfo); } else { - hrm.setHealthinfo("0"); + hrmResourcePO.setHealthInfo("0"); } //安全级别不能大于999 @@ -593,26 +608,39 @@ public class HrmResourceImportProcessServiceImpl extends Service implements HrmR resultList.add(createLog(hrmResourceImportParam, "创建", "失败", "安全级别必须是数字")); continue; } else { - hrm.setSeclevel((short) Util.getIntValue(hrmResourceImportParam.getSec_level())); + hrmResourcePO.setSecLevel(Util.getIntValue(hrmResourceImportParam.getSec_level())); } } else { //安全级别为空时取缓存类中的安全级别 - hrm.setSeclevel((short) (0)); + hrmResourcePO.setSecLevel(0); } //职级 if (isInteger(hrmResourceImportParam.getJob_level())) { - int joblevel = hrmResourceImportParam.getJob_level().equals("") ? 0 : Integer.parseInt(hrmResourceImportParam.getJob_level()); - hrm.setJoblevel((short) joblevel); + // TODO + Long jobLevel = hrmResourceImportParam.getJob_level().equals("") ? 0 : Long.parseLong(hrmResourceImportParam.getJob_level()); + hrmResourcePO.setJobLevel(jobLevel); } else { - hrm.setJoblevel((short) 0); + hrmResourcePO.setJobLevel(0L); + } + Long jobGroupId = null; + //TODO 职务类别 + if (hrmResourceImportParam.getJob_group_id() != null) { + + } + + // 职务 + if (hrmResourceImportParam.getJob_activity() != null) { + // TODO 职务 + hrmResourcePO.setJobActivity(null); } + //用工性质 if (hrmResourceImportParam.getUse_kind() != null) { int useKind = getUseKind(hrmResourceImportParam.getUse_kind()); - hrm.setUsekind(useKind); + hrmResourcePO.setUseKind(useKind); } else { - hrm.setUsekind(0); + hrmResourcePO.setUseKind(0); } //如果新增导入的时候,登陆名不为空,需要校验一下当前的license @@ -632,11 +660,9 @@ public class HrmResourceImportProcessServiceImpl extends Service implements HrmR } - //id,非自动增长 - recordSet.executeProc("HrmResourceMaxId_Get", ""); - recordSet.next(); - id = recordSet.getInt(1); - hrm.setId(id); + ////id,非自动增长 + id = getResourceMapper().getMaxId() + 1; + hrmResourcePO.setId(id); //密码 加密 @@ -664,41 +690,41 @@ public class HrmResourceImportProcessServiceImpl extends Service implements HrmR String password = encrypts[0]; String salt = encrypts[1]; - hrm.setPassword(password); + hrmResourcePO.setPassWord(password); boolean flag = true; /*添加人员信息*/ - String insertStr = "insert into hrmResource("; + String insertStr = "insert into jcl_org_hrmresource("; StringBuilder insertFields = new StringBuilder(); StringBuilder insertValues = new StringBuilder(); String workcode = hrmResourceImportParam.getWork_code(); - workcode = CodeRuleManager.getCodeRuleManager().generateRuleCode(RuleCodeType.USER, String.valueOf(hrm.getSubcompanyid1()), String.valueOf(hrm.getDepartmentid()), String.valueOf(hrm.getJobtitle()), workcode); + workcode = CodeRuleManager.getCodeRuleManager().generateRuleCode(RuleCodeType.USER, workcode); hrmResourceImportParam.setWork_code(workcode); for (String s : fields) { - Field hrmField = hrmClass.getDeclaredField(s); + Field resourcePOClassField = resourcePOClass.getDeclaredField(PageInfoSortUtil.underlineToHump(s)); Field paramClassDeclaredField = importParamClass.getDeclaredField(s); - String hrmFieldType = hrmField.getType().getName(); + String hrmFieldType = resourcePOClassField.getType().getName(); String voFieldType = paramClassDeclaredField.getType().getName(); - hrmField.setAccessible(true); + resourcePOClassField.setAccessible(true); paramClassDeclaredField.setAccessible(true); //首先取hrm对象中的数据,没有去vo中的 - if (hrmField.get(hrm) != null) { + if (resourcePOClassField.get(hrmResourcePO) != null) { if (hrmFieldType.endsWith("String")) { insertFields.append(s).append(","); - insertValues.append("'").append(hrmField.get(hrm)).append("',"); + insertValues.append("'").append(resourcePOClassField.get(hrmResourcePO)).append("',"); } else if (hrmFieldType.endsWith("Integer") || hrmFieldType.endsWith("Short") || hrmFieldType.endsWith("Float")) { insertFields.append(s).append(","); - String insertValueStr = Util.null2String(hrmField.get(hrm)); + String insertValueStr = Util.null2String(resourcePOClassField.get(hrmResourcePO)); if ("".equals(insertValueStr) && recordSet.getDBType().equalsIgnoreCase("postgresql")) { insertValues.append("null,"); } else { - insertValues.append(hrmField.get(hrm)).append(","); + insertValues.append(resourcePOClassField.get(hrmResourcePO)).append(","); } } } else if (paramClassDeclaredField.get(hrmResourceImportParam) != null) { @@ -727,9 +753,7 @@ public class HrmResourceImportProcessServiceImpl extends Service implements HrmR } } } - ChgPasswdReminder cpr = new ChgPasswdReminder(); - RemindSettings hrmsettings = cpr.getRemindSettings(); - insertStr = insertStr + insertFields + "createrid,createdate,lastmodid,lastmoddate,lastlogindate,managerstr,mobileshowtype ," + DbFunctionUtil.getInsertColumnSql() + ") values(" + insertValues + createrid + ",'" + date + "'," + lastmodid + ",'" + lastmoddate + "','" + date + "','" + hrm.getManagerstr() + "'," + Util.getIntValue(hrmsettings.getMobileShowTypeDefault(), 0) + " ," + DbFunctionUtil.getInsertColumnValueSql(recordSet.getDBType(), lastmodid) + ")"; + insertStr = insertStr + insertFields + "creator,delete_type,create_time,update_time) values(" + insertValues + createrid + ",'" + 0 + "','" + date + "','" + date + "')"; boolean resourceInsertFlag = true; @@ -739,51 +763,18 @@ public class HrmResourceImportProcessServiceImpl extends Service implements HrmR } if (resourceInsertFlag) {// 仅当人员插入成功后才进行自定义字段操作 PasswordUtil.updateResourceSalt(id + "", salt); - - if (!updateBaseData(hrmResourceImportParam.getBaseFields(), hrmResourceImportParam.getBaseFieldsValue(), id)) //添加基础字段信息 + if (!updateBaseData(hrmResourceImportParam.getBaseFields(), hrmResourceImportParam.getBaseFieldsValue(), id.intValue())) //添加基础字段信息 flag = false; } /*添加人员缓存,人员默认按id显示顺序,HrmResource_Trigger_Insert 人员共享 入职维护项目状态*/ if (flag) { - - //HrmUserSettingManager.checkUserSettingInit(id) ; - //人员显示顺序 if (hrmResourceImportParam.getShow_order() == null) { - String taxissql = ("update HrmResource set dsporder = " + id + " where id = " + id); - recordSet.executeSql(taxissql); - } - //构建pinyin快速搜索 - if (hrmResourceImportParam.getLast_name() != null) { - String quickSearchStr = new HrmCommonServiceImpl().generateQuickSearchStr(hrmResourceImportParam.getLast_name()); - String sqlStr = "update HrmResource set pinyinlastname = ?, ecology_pinyin_search = ? where id = ?"; - recordSet.executeUpdate(sqlStr, quickSearchStr, quickSearchStr, id); + // TODO + // String taxissql = ("update HrmResource set dsporder = " + id + " where id = " + id); + // recordSet.executeSql(taxissql); } - - //触发器 - String para = "" + id + separator + hrm.getManagerid() + separator + hrm.getDepartmentid() + separator + hrm.getSubcompanyid1() + separator + hrm.getSeclevel() + separator + hrm.getManagerstr(); - recordSet.executeProc("HrmResource_Trigger_Insert", para); - - //共享信息 - /*String p_para = "" + id + separator + hrm.getDepartmentid() + separator + hrm.getSubcompanyid1() + separator + hrm.getManagerid() + separator + hrm.getSeclevel() + separator + hrm.getManagerstr() + separator + "0" + separator + "0" + separator + "0" + separator + "0" + separator + "0" + separator + "0"; - recordSet.executeProc("HrmResourceShare", p_para);*/ - - //入职维护状态 - String sql_1 = ("insert into HrmInfoStatus (itemid,hrmid,status) values(1," + id + ",1)"); - recordSet.executeSql(sql_1); - String sql_2 = ("insert into HrmInfoStatus (itemid,hrmid) values(2," + id + ")"); - recordSet.executeSql(sql_2); - String sql_3 = ("insert into HrmInfoStatus (itemid,hrmid) values(3," + id + ")"); - recordSet.executeSql(sql_3); - - String sql_10 = ("insert into HrmInfoStatus (itemid,hrmid) values(10," + id + ")"); - recordSet.executeSql(sql_10); - - HrmFaceCheckManager.sync(id + "", HrmFaceCheckManager.getOptInsert(), "hrm_e9_import_resource", HrmFaceCheckManager.getOaResource()); - - new HrmDateCheck().calWorkInfo("" + id); - } /*写日志*/ @@ -824,7 +815,7 @@ public class HrmResourceImportProcessServiceImpl extends Service implements HrmR } } - final String hrmId = String.valueOf(keyMap.get(key)); + String hrmId = String.valueOf(keyMap.get(key)); //分部id String subCompanyNames = hrmResourceImportParam.getCompany_id(); @@ -832,33 +823,33 @@ public class HrmResourceImportProcessServiceImpl extends Service implements HrmR if (!"".equals(Util.null2String(subCompanyNames))) { if (!subCompanyNames.equals(subCompanyName)) { subCompanyName = subCompanyNames; - subcompanyid1 = getSubCompanyId(subCompanyName); + companyId = getSubCompanyId(subCompanyName); issameSub = false; } - if (subcompanyid1 == -9) { + if (companyId == -9) { resultList.add(createLog(hrmResourceImportParam, "更新", "失败", SystemEnv.getErrorMsgName(56, userlanguage))); continue; } - if (subcompanyid1 == -2) { + if (companyId == -2) { resultList.add(createLog(hrmResourceImportParam, "更新", "失败", SystemEnv.getHtmlLabelName(126274, userlanguage))); continue; } - if (subcompanyid1 == 0 || subcompanyid1 == -1) { - resultList.add(createLog(hrmResourceImportParam, "更新", "失败", subcompanyid1 == 0 ? SystemEnv.getHtmlLabelName(83536, userlanguage) : SystemEnv.getHtmlLabelName(83524, userlanguage))); + if (companyId == 0 || companyId == -1) { + resultList.add(createLog(hrmResourceImportParam, "更新", "失败", companyId == 0 ? SystemEnv.getHtmlLabelName(83536, userlanguage) : SystemEnv.getHtmlLabelName(83524, userlanguage))); continue; } //qc139575 在验证并发非并发之前需要先CkHrmnum license.CkHrmnum(); if (StringUtil.parseToInt(license.getConcurrentFlag(), 0) != 1) { - if (!issameSub && new HrmResourceManager().noMore(String.valueOf(subcompanyid1))) { + if (!issameSub && new HrmResourceManager().noMore(String.valueOf(companyId))) { resultList.add(createLog(hrmResourceImportParam, "更新", "失败", SystemEnv.getHtmlLabelName(83525, userlanguage))); continue; } } - hrm.setSubcompanyid1(subcompanyid1); + hrmResourcePO.setCompanyId((long) companyId); } // 部门id @@ -866,61 +857,61 @@ public class HrmResourceImportProcessServiceImpl extends Service implements HrmR if (!"".equals(Util.null2String(departmentNames))) { //部门存在时 if (!issameSub || !departmentNames.equals(departmentName)) { departmentName = departmentNames; - departmentid = getDeptId(departmentName, subcompanyid1); + departmentId = getDeptId(departmentName, (long) companyId); - if (departmentid == 0) { + if (departmentId == 0) { resultList.add(createLog(hrmResourceImportParam, "更新", "失败", SystemEnv.getHtmlLabelName(83537, userlanguage))); continue; } - if (departmentid == -2) { + if (departmentId == -2) { resultList.add(createLog(hrmResourceImportParam, "更新", "失败", SystemEnv.getHtmlLabelName(126275, userlanguage))); continue; } } else { //add sjh 50102需要考虑不同公司名称相同部门架构情况 此时部门ID是不同的 - departmentid = getDeptId(departmentName, subcompanyid1); - if (departmentid == 0) { + departmentId = getDeptId(departmentName, (long) companyId); + if (departmentId == 0) { resultList.add(createLog(hrmResourceImportParam, "更新", "失败", SystemEnv.getHtmlLabelName(83537, userlanguage))); continue; } - if (departmentid == -2) { + if (departmentId == -2) { resultList.add(createLog(hrmResourceImportParam, "更新", "失败", SystemEnv.getHtmlLabelName(126275, userlanguage))); continue; } } - hrm.setDepartmentid(departmentid); + hrmResourcePO.setDepartmentId((long) departmentId); } //主账号id-sunjsh if (hrmResourceImportParam.getAccount_type() != null && !"".equals(hrmResourceImportParam.getAccount_type())) { if ("主账号".equals(hrmResourceImportParam.getAccount_type())) { - hrm.setBelongto(-1); - hrm.setAccounttype(0); + hrmResourcePO.setBelongTo(-1L); + hrmResourcePO.setAccountType(0); } else if ("次账号".equals(hrmResourceImportParam.getAccount_type())) { if (hrmResourceImportParam.getBelong_to() != null && !"".equals(hrmResourceImportParam.getBelong_to().trim())) { - int belongto = getBelongId(hrmResourceImportParam.getBelong_to(), keyField); - hrm.setBelongto(belongto); + long belongto = getBelongId(hrmResourceImportParam.getBelong_to(), keyField); + hrmResourcePO.setBelongTo(belongto); if (!hrmResourceImportParam.getBelong_to().equals("") && belongto == 0) { resultList.add(createLog(hrmResourceImportParam, "更新", "失败", SystemEnv.getHtmlLabelName(131279, userlanguage))); continue; } else { - hrm.setAccounttype(1); + hrmResourcePO.setAccountType(1); } } else { resultList.add(createLog(hrmResourceImportParam, "更新", "失败", SystemEnv.getHtmlLabelName(131279, userlanguage))); continue; } } else { - hrm.setBelongto(-1); - hrm.setAccounttype(0); + hrmResourcePO.setBelongTo(-1L); + hrmResourcePO.setAccountType(0); } } else if (hrmResourceImportParam.getBelong_to() != null && !"".equals(hrmResourceImportParam.getBelong_to().trim())) { - int belongto = getBelongId(hrmResourceImportParam.getBelong_to(), keyField); - hrm.setBelongto(belongto); + long belongto = getBelongId(hrmResourceImportParam.getBelong_to(), keyField); + hrmResourcePO.setBelongTo(belongto); if (!hrmResourceImportParam.getBelong_to().equals("") && belongto == 0) { resultList.add(createLog(hrmResourceImportParam, "更新", "失败", SystemEnv.getHtmlLabelName(131279, userlanguage))); continue; } else { - hrm.setAccounttype(1); + hrmResourcePO.setAccountType(1); } } @@ -949,56 +940,38 @@ public class HrmResourceImportProcessServiceImpl extends Service implements HrmR jobgroupname = hrmResourceImportParam.getJob_group_id(); } int jobtitleid = getJobTitles(hrmResourceImportParam.getJob_title(), jobactivityname, jobgroupname); - hrm.setJobtitle(jobtitleid); + hrmResourcePO.setJobTitle((long) jobtitleid); } if (Util.getIntValue(hrmId) < 0) continue; - //上级id - String managerstr = ""; //所有上级 - String oldmanagerstr = resourcecominfo.getManagersIDs(hrmId);//原来的所有上sex + // 级序列 if (!"".equals(Util.null2String(hrmResourceImportParam.getManager_id()))) { - int managerid = 0; // 上级Id - - Map managerInfo = getManagerIdAndStr(hrmId, hrmResourceImportParam.getManager_id(), keyField); - if (managerInfo != null) { - managerid = managerInfo.get("managerid") != null ? (Integer) managerInfo.get("managerid") : 0; - managerstr = (String) (managerInfo.get("managerstr") != null ? managerInfo.get("managerstr") : ""); - } - + int managerid = getManagerId(hrmId, hrmResourceImportParam.getManager_id(), keyField); //如果vo.getManagerid()有值,但manageid未找到,说明填写有误 if (hrmResourceImportParam.getManager_id() != null && !hrmResourceImportParam.getManager_id().equals("") && managerid == 0) { resultList.add(createLog(hrmResourceImportParam, "更新", "失败", SystemEnv.getHtmlLabelName(83532, userlanguage))); continue; } - hrm.setManagerid(managerid); - hrm.setManagerstr(managerstr); + hrmResourcePO.setManagerId(managerid); } else { - if (hrmResourceImportParam.getManager_id() == null) { - hrm.setManagerid(StringUtil.parseToInt(resourcecominfo.getManagerID(hrmId), 0)); - hrm.setManagerstr(resourcecominfo.getManagersIDs(hrmId)); - managerstr = resourcecominfo.getManagersIDs(hrmId); - hrmResourceImportParam.setManager_id(resourcecominfo.getManagerID(hrmId)); - } else { - hrm.setManagerid(0); - hrm.setManagerstr(""); - } + hrmResourcePO.setManagerId(0); } // 助理id if (!"".equals(Util.null2String(hrmResourceImportParam.getAssistant_id()))) { - int assistantid; - assistantid = getAssistantid(hrmResourceImportParam.getAssistant_id(), keyField); - if (hrmResourceImportParam.getAssistant_id() != null && !hrmResourceImportParam.getAssistant_id().equals("") && assistantid == 0) { + int assistantId; + assistantId = getAssistantid(hrmResourceImportParam.getAssistant_id(), keyField); + if (hrmResourceImportParam.getAssistant_id() != null && !hrmResourceImportParam.getAssistant_id().equals("") && assistantId == 0) { resultList.add(createLog(hrmResourceImportParam, "更新", "失败", SystemEnv.getHtmlLabelName(24678, userlanguage))); continue; } - hrm.setAssistantid(assistantid); + hrmResourcePO.setAssistantId(assistantId); } // 办公地点 if (!"".equals(Util.null2String(hrmResourceImportParam.getLocation_id()))) { int locationid = getLocationid(hrmResourceImportParam.getLocation_id()); - hrm.setLocationid(locationid); + hrmResourcePO.setLocationId(locationid); } //邮箱-sunjsh @@ -1006,7 +979,7 @@ public class HrmResourceImportProcessServiceImpl extends Service implements HrmR if (!"".equals(hrmResourceImportParam.getEmail().trim()) && hrmResourceImportParam.getEmail().contains("*")) { hrmResourceImportParam.setEmail(null); } else if ("".equals(hrmResourceImportParam.getEmail().trim())) { - hrm.setEmail(""); + hrmResourcePO.setEmail(""); } else { Pattern pattern = Pattern.compile("^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$"); Matcher matcher = pattern.matcher(hrmResourceImportParam.getEmail()); @@ -1014,14 +987,14 @@ public class HrmResourceImportProcessServiceImpl extends Service implements HrmR resultList.add(createLog(hrmResourceImportParam, "更新", "失败", SystemEnv.getHtmlLabelName(24570, userlanguage))); continue; } else { - hrm.setEmail(hrmResourceImportParam.getEmail()); + hrmResourcePO.setEmail(hrmResourceImportParam.getEmail()); } } } //mobile-sunjsh if (hrmResourceImportParam.getMobile() != null) { - if ("".equals(hrmResourceImportParam.getMobile().trim())) hrm.setMobile(""); + if ("".equals(hrmResourceImportParam.getMobile().trim())) hrmResourcePO.setMobile(""); else if (!"".equals(hrmResourceImportParam.getMobile().trim()) && hrmResourceImportParam.getMobile().contains("*")) hrmResourceImportParam.setMobile(null); } @@ -1037,31 +1010,28 @@ public class HrmResourceImportProcessServiceImpl extends Service implements HrmR String fieldvalue = HrmFieldManager.getReallyFieldvalue(jsonObject); if (!"".equals(fieldvalue)) { - hrm.setBankid1(new Integer(fieldvalue)); + hrmResourcePO.setBankId(new Integer(fieldvalue)); } else { -// vo.setBankid1(null); - hrm.setBankid1(this.getBankId(hrmResourceImportParam.getBank_id())); + hrmResourcePO.setBankId(this.getBankId(hrmResourceImportParam.getBank_id())); } } //sunjsh-入职日期 if (hrmResourceImportParam.getCompany_start_date() != null && !"".equals(hrmResourceImportParam.getCompany_start_date())) { - hrm.setCompanystartdate(hrmResourceImportParam.getCompany_start_date()); -// hrm.setCompanyworkyear(this.calculateDate(vo.getCompanystartdate())); + hrmResourcePO.setCompanyStartDate(hrmResourceImportParam.getCompany_start_date()); } else { hrmResourceImportParam.setCompany_start_date(null); } //sunjsh-参加工作日期 if (hrmResourceImportParam.getWork_start_date() != null && !"".equals(hrmResourceImportParam.getWork_start_date())) { - hrm.setWorkstartdate(hrmResourceImportParam.getWork_start_date()); + hrmResourcePO.setWorkStartDate(hrmResourceImportParam.getWork_start_date()); } else { hrmResourceImportParam.setWork_start_date(null); } // 职称 if (!"".equals(Util.null2String(hrmResourceImportParam.getJob_call()))) { - int jobcall = getJobcall(hrmResourceImportParam.getJob_call()); - hrm.setJobcall(jobcall); + hrmResourcePO.setJobCall(getJobcall(hrmResourceImportParam.getJob_call())); } // 系统语言,默认简体中文 if (!"".equals(Util.null2String(hrmResourceImportParam.getSystem_language()))) { @@ -1076,54 +1046,54 @@ public class HrmResourceImportProcessServiceImpl extends Service implements HrmR resultList.add(createLog(hrmResourceImportParam, "更新", "失败", SystemEnv.getHtmlLabelName(84810, userlanguage))); continue; } - hrm.setSystemlanguage(systemlanguage); + hrmResourcePO.setSystemLanguage(systemlanguage); } // 性别,为空或其他情况统一为0(男) if (hrmResourceImportParam.getSex() == null) { - hrm.setSex("0"); + hrmResourcePO.setSex("0"); } else if (!"".equals(Util.null2String(hrmResourceImportParam.getSex()))) { String sex = hrmResourceImportParam.getSex().equals("女") ? "1" : "0"; - hrm.setSex(sex); + hrmResourcePO.setSex(sex); } // 婚姻状况,如果不是以下选项,则默认为未婚 if (!"".equals(Util.null2String(hrmResourceImportParam.getMarital_status()))) { String maritalstatus = hrmResourceImportParam.getMarital_status().equals("已婚") ? "1" : hrmResourceImportParam.getMarital_status().equals("离异") ? "2" : "0"; - hrm.setMaritalstatus(maritalstatus); + hrmResourcePO.setMaritalStatus(maritalstatus); } // 员工状态 if (!"".equals(Util.null2String(hrmResourceImportParam.getStatus()))) { int status = getStatus(hrmResourceImportParam.getStatus()); - hrm.setStatus(status); + hrmResourcePO.setStatus(status); } else { // TODO 待验证 - hrm.setStatus(0); + hrmResourcePO.setStatus(0); } // 人员密级 if (!"".equals(Util.null2String(hrmResourceImportParam.getClassification()))) { int classification = getClassification(hrmResourceImportParam.getClassification()); - hrm.setClassification(classification); + hrmResourcePO.setClassification(classification); } // 学历 if (!"".equals(Util.null2String(hrmResourceImportParam.getEducation_level()))) { int educationlevel = getEducationlevel(hrmResourceImportParam.getEducation_level()); - hrm.setEducationlevel(educationlevel); + hrmResourcePO.setEducationLevel(educationlevel); } // 工会会员,默认为是 if (!"".equals(Util.null2String(hrmResourceImportParam.getIslabouunion()))) { String islabouunion = hrmResourceImportParam.getIslabouunion().equals("是") ? "1" : "0"; - hrm.setIslabouunion(islabouunion); + hrmResourcePO.setIslabouunion(islabouunion); } // 健康状况 if (!"".equals(Util.null2String(hrmResourceImportParam.getHealth_info()))) { String healthinfo = getHealthinfo(hrmResourceImportParam.getHealth_info()); - hrm.setHealthinfo(healthinfo); + hrmResourcePO.setHealthInfo(healthinfo); } //安全级别不能大于999 @@ -1142,23 +1112,24 @@ public class HrmResourceImportProcessServiceImpl extends Service implements HrmR resultList.add(createLog(hrmResourceImportParam, "更新", "失败", "安全级别必须是数字")); continue; } else { - hrm.setSeclevel((short) Util.getIntValue(hrmResourceImportParam.getSec_level())); + hrmResourcePO.setSecLevel(Util.getIntValue(hrmResourceImportParam.getSec_level())); } } else { + // TODO //安全级别为空时取缓存类中的安全级别 - hrm.setSeclevel(Short.parseShort(resourcecominfo.getSeclevel(hrmId))); + hrmResourcePO.setSecLevel(Integer.parseInt(resourcecominfo.getSeclevel(hrmId))); } //职级 if (isInteger(hrmResourceImportParam.getJob_level())) { int joblevel = hrmResourceImportParam.getJob_level().equals("") ? 0 : Integer.parseInt(hrmResourceImportParam.getJob_level()); - hrm.setJoblevel((short) joblevel); + hrmResourcePO.setJobLevel((long) joblevel); } //用工性质 if (hrmResourceImportParam.getUse_kind() != null) { int usekind = getUseKind(hrmResourceImportParam.getUse_kind()); - hrm.setUsekind(usekind); + hrmResourcePO.setUseKind(usekind); } @@ -1194,7 +1165,7 @@ public class HrmResourceImportProcessServiceImpl extends Service implements HrmR orgPwd = hrmResourceImportParam.getPass_word(); String[] pwdArr = PasswordUtil.encrypt(orgPwd); String salt = pwdArr[1]; - hrm.setPassword(pwdArr[0]); + hrmResourcePO.setPassWord(pwdArr[0]); PasswordUtil.updateResourceSalt(keyMap.get(key) + "", salt); HrmFaceCheckManager.setUserPassowrd(keyMap.get(key) + "", orgPwd); @@ -1206,7 +1177,7 @@ public class HrmResourceImportProcessServiceImpl extends Service implements HrmR String tmpstatus = ""; for (int k = 1; k < fields.length; k++) { - Field hrmField = hrmClass.getDeclaredField(fields[k]); + Field hrmField = resourcePOClass.getDeclaredField(fields[k]); Field paramClassDeclaredField = importParamClass.getDeclaredField(fields[k]); String hrmFieldType = hrmField.getType().getName(); @@ -1215,17 +1186,18 @@ public class HrmResourceImportProcessServiceImpl extends Service implements HrmR hrmField.setAccessible(true); paramClassDeclaredField.setAccessible(true); - if (Util.null2String(hrmField.get(hrm)).trim().length() > 0) { + if (Util.null2String(hrmField.get(hrmResourcePO)).trim().length() > 0) { if (hrmFieldType.endsWith("String")) - updateStr.append(fields[k]).append("='").append(hrmField.get(hrm)).append("',"); + updateStr.append(fields[k]).append("='").append(hrmField.get(hrmResourcePO)).append("',"); else if (hrmFieldType.endsWith("Integer") || hrmFieldType.endsWith("Short") || hrmFieldType.endsWith("Float")) if (false) { //0数据的这个临时改回去 } else { - updateStr.append(fields[k]).append("=").append(hrmField.get(hrm)).append(","); + updateStr.append(fields[k]).append("=").append(hrmField.get(hrmResourcePO)).append(","); } - if (fields[k].equals("status")) tmpstatus = Util.null2String(hrmField.get(hrm)); + if (fields[k].equals("status")) + tmpstatus = Util.null2String(hrmField.get(hrmResourcePO)); } else if (Util.null2String(paramClassDeclaredField.get(hrmResourceImportParam)).trim().length() > 0) { if (voFieldType.endsWith("String")) { if (recordSet.getDBType().equalsIgnoreCase("mysql") || recordSet.getDBType().equalsIgnoreCase("postgresql")) { @@ -1253,7 +1225,8 @@ public class HrmResourceImportProcessServiceImpl extends Service implements HrmR } } - updateStr.append(" lastmodid=").append(lastmodid).append(",lastmoddate='").append(lastmoddate).append("',managerstr='").append(hrm.getManagerstr()).append("',").append(DbFunctionUtil.getUpdateSetSql(new RecordSet().getDBType(), lastmodid)).append(" where id=").append(keyMap.get(key)); + // TODO + // updateStr.append(" lastmodid=").append(lastmodid).append(",lastmoddate='").append(lastmoddate).append("',managerstr='").append(hrmResourcePO.getManagerstr()).append("',").append(DbFunctionUtil.getUpdateSetSql(new RecordSet().getDBType(), lastmodid)).append(" where id=").append(keyMap.get(key)); if (!execSql(updateStr.toString())) flag = false; @@ -1337,54 +1310,15 @@ public class HrmResourceImportProcessServiceImpl extends Service implements HrmR if (flag) { recordSet.executeSql("select id from HrmResource_Trigger where id=" + hrmId); if (recordSet.next()) { - recordSet.executeSql("update HrmResource_Trigger set managerid=" + hrm.getManagerid() + ",departmentid=" + hrm.getDepartmentid() + ",subcompanyid1=" + hrm.getSubcompanyid1() + ",seclevel=" + hrm.getSeclevel() + ",managerstr='" + hrm.getManagerstr() + "' where id=" + hrmId); + // TODO recordSet.executeSql("update HrmResource_Trigger set managerid=" + hrmResourcePO.getManagerId() + ",departmentid=" + hrmResourcePO.getDepartmentId() + ",subcompanyid1=" + hrmResourcePO.getCompanyId() + ",seclevel=" + hrmResourcePO.getSecLevel() + ",managerstr='" + hrmResourcePO.getManagerstr() + "' where id=" + hrmId); } else { - String para = "" + hrmId + separator + hrm.getManagerid() + separator + hrm.getDepartmentid() + separator + hrm.getSubcompanyid1() + separator + hrm.getSeclevel() + separator + hrm.getManagerstr(); - recordSet.executeProc("HrmResource_Trigger_Insert", para); - } - - //构建pinyin快速搜索 - if (hrmResourceImportParam.getLast_name() != null) { - String quickSearchStr = new HrmCommonServiceImpl().generateQuickSearchStr(hrmResourceImportParam.getLast_name()); - String sqlStr = "update HrmResource set pinyinlastname = ?, ecology_pinyin_search = ? where id = ?"; - recordSet.executeUpdate(sqlStr, quickSearchStr, quickSearchStr, hrmId); + // TODO + // String para = "" + hrmId + separator + hrmResourcePO.getManagerId() + separator + hrmResourcePO.getDepartmentId() + separator + hrmResourcePO.getCompanyId() + separator + hrmResourcePO.getSecLevel() + separator + hrmResourcePO.getManagerstr(); + // recordSet.executeProc("HrmResource_Trigger_Insert", para); } } //更新下级managerstr - if (flag && !"".equals(Util.null2String(hrmResourceImportParam.getManager_id()))) { - String temOldmanagerstr = "," + hrmId + oldmanagerstr; - temOldmanagerstr = temOldmanagerstr.endsWith(",") ? temOldmanagerstr : (temOldmanagerstr + ","); - String sql = "select id,departmentid,subcompanyid1,managerid,seclevel,managerstr from HrmResource where managerstr like '%" + temOldmanagerstr + "'"; - recordSet.executeSql(sql); - while (recordSet.next()) { - String nowmanagerstr = Util.null2String(recordSet.getString("managerstr")); - String resourceid = recordSet.getString("id"); - //指定上级为自身的情况,不更新自身上级 - if (hrmId.equals(resourceid)) continue; - String nowmanagerstr2 = ""; - int index = nowmanagerstr.lastIndexOf(oldmanagerstr); - if (index != -1) { - if (!"".equals(managerstr)) { - nowmanagerstr2 = nowmanagerstr.substring(0, index) + ("".equals(oldmanagerstr) ? managerstr.substring(1) : managerstr); - } else { - nowmanagerstr2 = nowmanagerstr.substring(0, index) + ("".equals(oldmanagerstr) ? "" : ","); - } - - } - RecordSetTrans rst = new RecordSetTrans(); - rst.setAutoCommit(false); - try { - String para = resourceid + separator + nowmanagerstr2; - rst.executeProc("HrmResource_UpdateManagerStr", para); - rst.commit(); - } catch (Exception e) { - rst.rollback(); - new BaseBean().writeLog(e); - } - - } - } if (flag) { HrmFaceCheckManager.sync(keyMap.get(key) + "", HrmFaceCheckManager.getOptUpdate(), "hrm_e9_import_resource", HrmFaceCheckManager.getOaResource()); @@ -1427,9 +1361,6 @@ public class HrmResourceImportProcessServiceImpl extends Service implements HrmR } -// endTime = System.currentTimeMillis(); -// System.out.println("---分部、部门层级更新结束,用时:"+(endTime - startTime)); -// startTime = endTime; //更新人员、分部、部门、职位、岗位、职位类型缓存 resourcecominfo.removeResourceCache(); @@ -1609,37 +1540,34 @@ public class HrmResourceImportProcessServiceImpl extends Service implements HrmR * @param subCompanyName 分部名称 eg:泛微广东>泛微深圳 * @return */ - public int getSubCompanyId(String subCompanyName) { + public Long getSubCompanyId(String subCompanyName) { String[] subCompanyNames = subCompanyName.split(">"); if (subCompanyNames.length >= 10) { - return -9; + return -9L; } - int currentId = 0; - int parentId = 0; + long currentId = 0L; + long parentId = 0L; int curCount = 0; - int iscanceled; String currentidsql; - String canceledsql; String sql; - String sqlInsert; RecordSet recordSet = new RecordSet(); - String supsubcomidConditon = DbDialectFactory.get(recordSet.getDBType()).isNull("supsubcomid", 0); + String supsubcomidConditon = DbDialectFactory.get(recordSet.getDBType()).isNull("parent_company", 0); for (String companyName : subCompanyNames) { if (StringUtil.isNull(companyName)) continue; - sql = "select id from HrmSubCompany where ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(subcompanyname))," + userlanguage + ")))='" + companyName.trim() + "' and " + supsubcomidConditon + "=" + parentId; + sql = "select id from jcl_org_comp where ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(comp_name))," + userlanguage + ")))='" + companyName.trim() + "' and " + supsubcomidConditon + "=" + parentId; if (recordSet.getDBType().equalsIgnoreCase("oracle") || DialectUtil.isMySql(recordSet.getDBType()) || recordSet.getDBType().equalsIgnoreCase("postgresql")) { - sql = "select id from HrmSubCompany where ltrim(rtrim(convToMultiLang(ltrim(rtrim(subcompanyname))," + userlanguage + ")))='" + companyName.trim() + "' and " + supsubcomidConditon + "=" + parentId; + sql = "select id from jcl_org_comp where ltrim(rtrim(convToMultiLang(ltrim(rtrim(comp_name))," + userlanguage + ")))='" + companyName.trim() + "' and " + supsubcomidConditon + "=" + parentId; } - currentidsql = sql + " and (canceled is null or canceled != 1)"; + currentidsql = sql + " and (delete_type = 0)"; currentId = getResultSetId(currentidsql); if (parentId == 0 && currentId == 0) { - recordSet.executeSql("select COUNT(id) from HrmSubCompany where supsubcomid = 0 and (canceled is null or canceled != '1')"); + recordSet.executeSql("select COUNT(id) from jcl_org_comp where " + supsubcomidConditon + " = 0 "); if (recordSet.next()) { curCount = recordSet.getInt(1); } @@ -1647,36 +1575,27 @@ public class HrmResourceImportProcessServiceImpl extends Service implements HrmR //added by wcd 2015-02-06 [限制分部数] if (currentId == 0) { - canceledsql = sql + " and canceled='1' "; - iscanceled = getResultSetId(canceledsql); - if (iscanceled == 0) { - } else { - currentId = -2; - break; - } if (scCount == 0 || curCount < scCount) { // 如果编码为空 自动生成编码 - String subcompanycode = ""; + String compNo = ""; try { - subcompanycode = CodeRuleManager.getCodeRuleManager().generateRuleCode(RuleCodeType.SUBCOMPANY, subcompanycode); + compNo = CodeRuleManager.getCodeRuleManager().generateRuleCode(RuleCodeType.SUBCOMPANY, compNo); } catch (Exception e) { new BaseBean().writeLog(e); } - sqlInsert = "insert into HrmSubCompany(subcompanyname,subcompanydesc,companyid,supsubcomid ," + DbFunctionUtil.getInsertColumnSql() + " , subcompanycode) values('" + companyName.trim() + "','" + companyName.trim() + "',1" + "," + parentId + " ," + DbFunctionUtil.getInsertColumnValueSql(recordSet.getDBType(), 1) + ",'" + subcompanycode + "')"; // 创建 - execSql(sqlInsert); - HrmTriggerUtil.generateSubcompanyPinyin(companyName.trim(), null); - currentId = getResultSetId(sql); - HrmTriggerUtil.Tri_I_SubComKPICheckFlow(String.valueOf(currentId)); - MatrixUtil.updateSubcompayData(currentId + ""); - //新增分部,統一调用门户接口创建门户菜单 - ThemeService themService = new ThemeServiceImpl(); - themService.createSubCompanyMenu(currentId, parentId); -// sql = "insert into leftmenuconfig (userid,infoid,visible,viewindex,resourceid,resourcetype,locked,lockedbyid,usecustomname,customname,customname_e) select distinct userid,infoid,visible,viewindex," + currentId + ",2,locked,lockedbyid,usecustomname,customname,customname_e from leftmenuconfig where resourcetype=1 and resourceid=1"; -// execSql(sql); -// sql = "insert into mainmenuconfig (userid,infoid,visible,viewindex,resourceid,resourcetype,locked,lockedbyid,usecustomname,customname,customname_e) select distinct userid,infoid,visible,viewindex," + currentId + ",2,locked,lockedbyid,usecustomname,customname,customname_e from mainmenuconfig where resourcetype=1 and resourceid=1"; -// execSql(sql); - - HrmFaceCheckManager.sync(currentId + "", HrmFaceCheckManager.getOptInsert(), "HRM_E9_IMPORT", HrmFaceCheckManager.getOaSubcompany()); + CompPO compPO = CompPO.builder() + .compNo(compNo) + .compName(companyName.trim()) + .compNameShort(companyName.trim()) + .parentCompany((long) parentId) + // .forbiddenTag(0) + .creator((long) user.getUID()) + .deleteType(0) + .createTime(new Date()) + .build(); + getCompMapper().insertIgnoreNull(compPO); + currentId = compPO.getId().intValue(); + } else { currentId = -1; } @@ -1689,60 +1608,105 @@ public class HrmResourceImportProcessServiceImpl extends Service implements HrmR /** * 获取部门id,不存在就创建 * - * @param deptNames 部门名称 - * @param subCompanyId 所属分部id + * @param deptNames 部门名称 + * @param companyId 所属分部id * @return */ - public int getDeptId(String deptNames, int subCompanyId) { + public Long getDeptId(String deptNames, long companyId) { - String[] deptName = deptNames.split(">"); - int currentId = 0; - int parentId = 0; - int iscanceled; + String[] deptNameArray = deptNames.split(">"); + long currentId = 0L; + long parentId = 0L; - String currentidsql; - String canceledsql; + String currentIdSql; String sql; - String sqlInsert; RecordSet recordSet = new RecordSet(); - String supdepidConditon = DbDialectFactory.get(recordSet.getDBType()).isNull("supdepid", 0); + String supdepidConditon = DbDialectFactory.get(recordSet.getDBType()).isNull("parent_dept", 0); - for (String s : deptName) { - if (s == null || s.equals("")) { + for (String deptName : deptNameArray) { + if (deptName == null || deptName.equals("")) { continue; } - sql = "select id from HrmDepartment where subcompanyid1=" + subCompanyId + " and ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(departmentname))," + userlanguage + ")))='" + s.trim() + "' and " + supdepidConditon + "=" + parentId; + sql = "select id from jcl_org_dept where parent_comp=" + companyId + " and ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(dept_name))," + userlanguage + ")))='" + deptName.trim() + "' and " + supdepidConditon + "=" + parentId; if (recordSet.getDBType().equalsIgnoreCase("oracle") || DialectUtil.isMySql(recordSet.getDBType()) || recordSet.getDBType().equalsIgnoreCase("postgresql")) { - sql = "select id from HrmDepartment where subcompanyid1=" + subCompanyId + " and ltrim(rtrim(convToMultiLang(ltrim(rtrim(departmentname))," + userlanguage + ")))='" + s.trim() + "' and " + supdepidConditon + "=" + parentId; + sql = "select id from jcl_org_dept where parent_comp=" + companyId + " and ltrim(rtrim(convToMultiLang(ltrim(rtrim(dept_name))," + userlanguage + ")))='" + deptName.trim() + "' and " + supdepidConditon + "=" + parentId; } - currentidsql = sql + " and (canceled !=1 or canceled is null)"; - currentId = getResultSetId(currentidsql); + currentIdSql = sql + " and delete_type = 0"; + currentId = getResultSetId(currentIdSql); if (currentId == 0) { - canceledsql = sql + " and canceled='1' "; - iscanceled = getResultSetId(canceledsql); - if (iscanceled == 0) { - } else { - currentId = -2; - break; + // 如果编码为空 自动生成编码 + String deptNo = ""; + try { + deptNo = CodeRuleManager.getCodeRuleManager().generateRuleCode(RuleCodeType.DEPARTMENT, deptNo); + } catch (Exception e) { + new BaseBean().writeLog(e); } + DepartmentPO departmentPO = DepartmentPO.builder() + .deptNo(deptNo) + .deptName(deptName.trim()) + .deptNameShort(deptName.trim()) + .parentComp(companyId) + .parentDept(parentId) + .forbiddenTag(0) + .creator((long) user.getUID()) + .deleteType(0) + .createTime(new Date()) + .build(); + getDepartmentMapper().insertIgnoreNull(departmentPO); + currentId = departmentPO.getId().intValue(); + } + parentId = currentId; + } + return currentId; + } + + public Long getJobTitles(Long companyId, Long departmentId, String jobNames) { + + + String[] jobNameArray = jobNames.split(">"); + long currentId = 0L; + Long parentId = 0L; + String currentIdSql; + String sql; + RecordSet recordSet = new RecordSet(); + String parentJobConditon = DbDialectFactory.get(recordSet.getDBType()).isNull("parent_job", 0); + + for (String jobName : jobNameArray) { + if (jobName == null || jobName.equals("")) { + continue; + } + sql = "select id from jcl_org_job where parent_comp=" + companyId + " and parent_dept = " + departmentId + " and ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(job_name))," + userlanguage + ")))='" + jobName.trim() + "' and " + parentJobConditon + "=" + parentId; + if (recordSet.getDBType().equalsIgnoreCase("oracle") || DialectUtil.isMySql(recordSet.getDBType()) || recordSet.getDBType().equalsIgnoreCase("postgresql")) { + sql = "select id from jcl_org_job where parent_comp=" + companyId + " and parent_dept = " + departmentId + " and ltrim(rtrim(convToMultiLang(ltrim(rtrim(job_name))," + userlanguage + ")))='" + jobName.trim() + "' and " + parentJobConditon + "=" + parentId; + } + currentIdSql = sql + " and delete_type = 0"; + currentId = getResultSetId(currentIdSql); + + if (currentId == 0) { // 如果编码为空 自动生成编码 - String departmentcode = ""; + String jobNo = ""; try { - departmentcode = CodeRuleManager.getCodeRuleManager().generateRuleCode(RuleCodeType.DEPARTMENT, String.valueOf(subCompanyId), departmentcode); + jobNo = CodeRuleManager.getCodeRuleManager().generateRuleCode(RuleCodeType.JOBTITLES, jobNo); } catch (Exception e) { new BaseBean().writeLog(e); } - sqlInsert = "insert into HrmDepartment (departmentname,Departmentmark,subcompanyid1,supdepid ," + DbFunctionUtil.getInsertColumnSql() + ", departmentcode) values('" + s.trim() + "','" + s.trim() + "'," + subCompanyId + "," + parentId + " ," + DbFunctionUtil.getInsertColumnValueSql(recordSet.getDBType(), 1) + ", '" + departmentcode + "')"; // 创建 - execSql(sqlInsert); - HrmTriggerUtil.generateDepartmentPinyin(s.trim(), null); - currentId = getResultSetId(sql); - HrmTriggerUtil.Tri_I_DeptKPICheckFlow(String.valueOf(currentId)); - MatrixUtil.updateDepartmentData(currentId + ""); - HrmFaceCheckManager.sync(currentId + "", HrmFaceCheckManager.getOptInsert(), "HRM_E9_IMPORT_getDeptId", HrmFaceCheckManager.getOaDepartment()); + JobPO jobPO = JobPO.builder() + .jobNo(jobNo) + .jobName(jobName) + .parentComp(companyId) + .parentDept(departmentId) + .parentJob(parentId) + .forbiddenTag(0) + .creator((long) user.getUID()) + .deleteType(0) + .createTime(new Date()) + .build(); + getJobMapper().insertIgnoreNull(jobPO); + currentId = jobPO.getId(); } parentId = currentId; } @@ -1876,34 +1840,21 @@ public class HrmResourceImportProcessServiceImpl extends Service implements HrmR * @param keyField 关键字段 * @return */ - public Map getManagerIdAndStr(String hrmid, String keyFieldValue, String keyField) { + public int getManagerId(String hrmid, String keyFieldValue, String keyField) { - int managerId; - String managerstr; + int managerId = 0; RecordSet recordSet = new RecordSet(); - Map managerInfo = new HashMap<>(); if (!keyFieldValue.equals("")) { -// String selSql = "select id,managerstr from hrmResource where " + keyField + "='" + keyFieldValue + "'"; - String selSql = "select id,managerstr from hrmResource where ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + ")))= '" + keyFieldValue + "'"; + String selSql = "select id from jcl_org_hrmresource where ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + ")))= '" + keyFieldValue + "'"; if (recordSet.getDBType().equalsIgnoreCase("oracle") || DialectUtil.isMySql(recordSet.getDBType()) || recordSet.getDBType().equalsIgnoreCase("postgresql")) { - selSql = "select id,managerstr from hrmResource where ltrim(rtrim(convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + ")))= '" + keyFieldValue + "'"; + selSql = "select id from jcl_org_hrmresource where ltrim(rtrim(convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + ")))= '" + keyFieldValue + "'"; } recordSet.execute(selSql); while (recordSet.next()) { managerId = recordSet.getInt("id"); - managerstr = recordSet.getString("managerstr"); - if (!hrmid.equals("" + managerId)) { //设置上级为自身的情况 - managerstr = "," + managerId + managerstr; - } else { - managerstr = "," + managerId + ","; - } - - managerstr = managerstr.endsWith(",") ? managerstr : (managerstr + ","); - managerInfo.put("managerid", managerId); - managerInfo.put("managerstr", managerstr); } } - return managerInfo; + return managerId; } /** @@ -1918,10 +1869,9 @@ public class HrmResourceImportProcessServiceImpl extends Service implements HrmR int getAssistantid = 0; RecordSet recordSet = new RecordSet(); if (!keyFieldValue.equals("")) { -// String selSql = "select id from hrmResource where " + keyField + "='" + keyFieldValue + "'"; - String selSql = "select id from hrmResource where ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + ")))= '" + keyFieldValue + "'"; + String selSql = "select id from jcl_org_hrmresource where ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + ")))= '" + keyFieldValue + "'"; if (recordSet.getDBType().equalsIgnoreCase("oracle") || DialectUtil.isMySql(recordSet.getDBType()) || recordSet.getDBType().equalsIgnoreCase("postgresql")) { - selSql = "select id from hrmResource where ltrim(rtrim(convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + ")))= '" + keyFieldValue + "'"; + selSql = "select id from jcl_org_hrmresource where ltrim(rtrim(convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + ")))= '" + keyFieldValue + "'"; } getAssistantid = getResultSetId(selSql); } @@ -1935,18 +1885,17 @@ public class HrmResourceImportProcessServiceImpl extends Service implements HrmR * @param keyField 关键字段 * @return */ - public int getBelongId(String keyFieldValue, String keyField) { + public Long getBelongId(String keyFieldValue, String keyField) { int getAssistantid = -1; RecordSet recordSet = new RecordSet(); if (!keyFieldValue.equals("")) { -// String selSql = "select id from hrmResource where " + keyField + "='" + keyFieldValue + "'"; - String selSql = "select id from hrmResource where ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + ")))= '" + keyFieldValue + "'"; + String selSql = "select id from jcl_org_hrmresource where ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + ")))= '" + keyFieldValue + "'"; if (recordSet.getDBType().equalsIgnoreCase("oracle") || DialectUtil.isMySql(recordSet.getDBType()) || recordSet.getDBType().equalsIgnoreCase("postgresql")) { - selSql = "select id from hrmResource where ltrim(rtrim(convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + ")))= '" + keyFieldValue + "'"; + selSql = "select id from jcl_org_hrmresource where ltrim(rtrim(convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + ")))= '" + keyFieldValue + "'"; } getAssistantid = getResultSetId(selSql); } - return getAssistantid; + return (long) getAssistantid; } /** @@ -2174,10 +2123,11 @@ public class HrmResourceImportProcessServiceImpl extends Service implements HrmR * @param keyField key值,重复性验证字段 */ public void getKeyMap(String keyField) { + // TODO RecordSet recordSet = new RecordSet(); - String sql = "select id, accounttype,isADAccount,certificatenum,loginid,workcode, ltrim(rtrim(convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + "))) as " + keyField + " from hrmResource"; + String sql = "select id, account_type, certificate_num, login_id, work_code, ltrim(rtrim(convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + "))) as " + keyField + " from jcl_org_hrmresource"; if (recordSet.getDBType().equalsIgnoreCase("sqlserver")) { - sql = "select id, accounttype,isADAccount,certificatenum,loginid,workcode, ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + "))) as " + keyField + " from hrmResource"; + sql = "select id, account_type, certificate_num, login_id, work_code, ltrim(rtrim(dbo.convToMultiLang(ltrim(rtrim(" + keyField + "))," + userlanguage + "))) as " + keyField + " from jcl_org_hrmresource"; } recordSet.execute(sql); String cerNum; @@ -2195,10 +2145,11 @@ public class HrmResourceImportProcessServiceImpl extends Service implements HrmR checkInfos.put(key, checkInfo); } - cerNum = recordSet.getString("certificatenum"); + cerNum = recordSet.getString("certificate_num"); keyMap.put(recordSet.getString(keyField), recordSet.getInt("id")); + // TODO isADAccountMap.put(Util.null2String(recordSet.getString("id")), Util.null2String(recordSet.getString("isADAccount"))); - String accounttype = recordSet.getString("accounttype"); + String accounttype = recordSet.getString("account_type"); if (!"1".equalsIgnoreCase(accounttype)) { if (StringUtil.isNotNull(cerNum)) { certificateNums.put(StringUtil.vString(cerNum), recordSet.getInt("id")); @@ -2306,15 +2257,15 @@ public class HrmResourceImportProcessServiceImpl extends Service implements HrmR String val = ""; String errorMsg = ""; switch (key) { - case "loginid": + case "login_id": val = Util.null2String(importParam.getLogin_id()).trim(); errorMsg = SystemEnv.getHtmlLabelName(522076, userlanguage); break; - case "workcode": + case "work_code": val = Util.null2String(importParam.getWork_code()).trim(); errorMsg = SystemEnv.getHtmlLabelName(520197, userlanguage); break; - case "certificatenum": + case "certificate_num": val = Util.null2String(importParam.getCertificate_num()).trim(); errorMsg = SystemEnv.getHtmlLabelName(83521, userlanguage); break; diff --git a/src/com/engine/organization/service/impl/HrmResourceServiceImpl.java b/src/com/engine/organization/service/impl/HrmResourceServiceImpl.java index 07684783..9e3b3baf 100644 --- a/src/com/engine/organization/service/impl/HrmResourceServiceImpl.java +++ b/src/com/engine/organization/service/impl/HrmResourceServiceImpl.java @@ -1,6 +1,5 @@ package com.engine.organization.service.impl; -import com.alibaba.fastjson.JSON; import com.api.browser.bean.SearchConditionGroup; import com.api.browser.bean.SearchConditionItem; import com.cloudstore.eccom.result.WeaResultMsg; @@ -267,10 +266,9 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic //如果读取数据和验证模板没有发生错误 if (errorInfo.isEmpty()) { Map hrMap = importAdapt.getHrmImportMap(); - System.out.println(JSON.toJSON(hrMap)); - HrmResourceImportProcessService importProcess = (HrmResourceImportProcessService) Class.forName("com.engine.organization.service.impl.HrmResourceImportProcessServiceImpl").newInstance(); - importProcess.init(request); - importProcess.processMap(hrMap); + HrmResourceImportProcessService importProcess = (HrmResourceImportProcessService) Class.forName("com.engine.organization.service.impl.HrmResourceImportProcessServiceImpl").newInstance(); + importProcess.init(request); + importProcess.processMap(hrMap); } else { if (errorInfo != null && !errorInfo.isEmpty()) { Map error; diff --git a/src/com/engine/organization/util/PageInfoSortUtil.java b/src/com/engine/organization/util/PageInfoSortUtil.java index 9146a6b8..79d267e0 100644 --- a/src/com/engine/organization/util/PageInfoSortUtil.java +++ b/src/com/engine/organization/util/PageInfoSortUtil.java @@ -21,7 +21,7 @@ public class PageInfoSortUtil { * @return */ public static String getSortSql(String sortParams) { - JSONArray jsonArray = JSONObject.parseArray(sortParams); + JSONArray jsonArray = JSONObject.parseArray(sortParams); if (CollectionUtils.isNotEmpty(jsonArray)) { JSONObject jsonObject = (JSONObject) jsonArray.get(0); String orderKey = upperCharToUnderLine(jsonObject.getString("orderkey")); @@ -54,4 +54,28 @@ public class PageInfoSortUtil { } return builder.toString(); } + + /** + * 下划线转驼峰 + * + * @param str + * @return + */ + public static String underlineToHump(String str) { + //正则匹配下划线及后一个字符,删除下划线并将匹配的字符转成大写 + Matcher matcher = Pattern.compile("_([a-z])").matcher(str); + StringBuffer sb = new StringBuffer(str); + if (matcher.find()) { + sb = new StringBuffer(); + //将当前匹配的子串替换成指定字符串,并且将替换后的子串及之前到上次匹配的子串之后的字符串添加到StringBuffer对象中 + //正则之前的字符和被替换的字符 + matcher.appendReplacement(sb, matcher.group(1).toUpperCase()); + //把之后的字符串也添加到StringBuffer对象中 + matcher.appendTail(sb); + } else { + //去除除字母之外的前面带的下划线 + return sb.toString().replaceAll("_", ""); + } + return underlineToHump(sb.toString()); + } }