From d508a4d9d0aec0756a10fc7b7c8f28236c00e500 Mon Sep 17 00:00:00 2001 From: dxfeng Date: Thu, 30 Jun 2022 16:22:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=BA=E5=91=98=E5=AF=BC=E5=85=A5=EF=BC=8C?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E8=A1=A8=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/表结构SQL/MySQL.sql | 18 +++++++- docs/表结构SQL/Oracle.sql | 15 +++++++ docs/表结构SQL/SqlServer.sql | 15 +++++++ .../mapper/hrmresource/HrmResourceMapper.java | 15 +++++++ .../mapper/hrmresource/HrmResourceMapper.xml | 11 ++++- .../transmethod/HrmResourceTransMethod.java | 4 +- .../HrmResourceImportProcessUtil.java | 41 ++++--------------- 7 files changed, 83 insertions(+), 36 deletions(-) diff --git a/docs/表结构SQL/MySQL.sql b/docs/表结构SQL/MySQL.sql index 01328f74..3b488975 100644 --- a/docs/表结构SQL/MySQL.sql +++ b/docs/表结构SQL/MySQL.sql @@ -473,4 +473,20 @@ CREATE TABLE JCL_ORG_MAP ( create_time date null, update_time date null, CONSTRAINT JCL_ORG_MAP PRIMARY KEY (id) -); \ No newline at end of file +); + +-- HR_LOG +CREATE TABLE HR_LOG ( + id int AUTO_INCREMENT NOT NULL, + operate_desc varchar(100) NULL, + operator_id int NULL, + operator_name varchar(100) NULL, + create_time date NULL, + operate_type int NULL, + params_str varchar(100) NULL, + client_ip varchar(100) NULL, + method_name varchar(100) NULL, + delete_type int NULL, + class_name varchar(100) NULL, + CONSTRAINT HR_LOG_PK PRIMARY KEY (id) +); diff --git a/docs/表结构SQL/Oracle.sql b/docs/表结构SQL/Oracle.sql index 22fb8b8d..c4c7400e 100644 --- a/docs/表结构SQL/Oracle.sql +++ b/docs/表结构SQL/Oracle.sql @@ -443,4 +443,19 @@ CREATE TABLE JCL_ORG_STAFFS ( CREATE_TIME DATE NULL, UPDATE_TIME DATE NULL, CONSTRAINT JCL_ORG_STAFFS_PK PRIMARY KEY (ID) +); + +CREATE TABLE HR_LOG ( + ID NUMBER NOT NULL, + OPERATE_DESC NVARCHAR2(100) NULL, + OPERATOR_ID NUMBER NULL, + OPERATOR_NAME NVARCHAR2(100) NULL, + CREATE_TIME DATE NULL, + OPERATE_TYPE NUMBER NULL, + PARAMS_STR NVARCHAR2(100) NULL, + CLIENT_IP NVARCHAR2(100) NULL, + METHOD_NAME NVARCHAR2(100) NULL, + DELETE_TYPE NUMBER NULL, + CLASS_NAME NVARCHAR2(100) NULL, + CONSTRAINT HR_LOG_PK PRIMARY KEY (ID) ); \ No newline at end of file diff --git a/docs/表结构SQL/SqlServer.sql b/docs/表结构SQL/SqlServer.sql index f56d5247..cd0d1dac 100644 --- a/docs/表结构SQL/SqlServer.sql +++ b/docs/表结构SQL/SqlServer.sql @@ -442,4 +442,19 @@ CREATE TABLE JCL_ORG_STAFFS ( create_time datetime null, update_time datetime null, CONSTRAINT JCL_ORG_STAFFS_PK PRIMARY KEY (id) +); + +CREATE TABLE HR_LOG ( + id int IDENTITY(1,1) NOT NULL, + operate_desc varchar(100) NULL, + operator_id int NULL, + operator_name varchar(100) NULL, + create_time datetime NULL, + operate_type int NULL, + params_str varchar(100) NULL, + client_ip varchar(100) NULL, + method_name varchar(100) NULL, + delete_type int NULL, + class_name varchar(100) NULL, + CONSTRAINT HR_LOG_PK PRIMARY KEY (id) ); \ No newline at end of file diff --git a/src/com/engine/organization/mapper/hrmresource/HrmResourceMapper.java b/src/com/engine/organization/mapper/hrmresource/HrmResourceMapper.java index 97f2b629..9c0b37e1 100644 --- a/src/com/engine/organization/mapper/hrmresource/HrmResourceMapper.java +++ b/src/com/engine/organization/mapper/hrmresource/HrmResourceMapper.java @@ -1,5 +1,7 @@ package com.engine.organization.mapper.hrmresource; +import org.apache.ibatis.annotations.Param; + /** * @description: * @author:dxfeng @@ -8,5 +10,18 @@ package com.engine.organization.mapper.hrmresource; */ public interface HrmResourceMapper { + /** + * 获取最大ID + * + * @return + */ Long getMaxId(); + + /** + * 根据ID查询姓名 + * + * @param id + * @return + */ + String getLastNameById(@Param("id") Long id); } diff --git a/src/com/engine/organization/mapper/hrmresource/HrmResourceMapper.xml b/src/com/engine/organization/mapper/hrmresource/HrmResourceMapper.xml index 623d442e..3b201228 100644 --- a/src/com/engine/organization/mapper/hrmresource/HrmResourceMapper.xml +++ b/src/com/engine/organization/mapper/hrmresource/HrmResourceMapper.xml @@ -12,7 +12,9 @@ - t.id + t + . + id , t.creator , t.delete_type , t.create_time @@ -23,4 +25,11 @@ select max(id) from jcl_org_hrmresource + + \ No newline at end of file diff --git a/src/com/engine/organization/transmethod/HrmResourceTransMethod.java b/src/com/engine/organization/transmethod/HrmResourceTransMethod.java index 23d79f3c..98cc35cb 100644 --- a/src/com/engine/organization/transmethod/HrmResourceTransMethod.java +++ b/src/com/engine/organization/transmethod/HrmResourceTransMethod.java @@ -2,7 +2,7 @@ package com.engine.organization.transmethod; import com.engine.organization.mapper.comp.CompMapper; import com.engine.organization.mapper.department.DepartmentMapper; -import com.engine.organization.mapper.employee.EmployeeMapper; +import com.engine.organization.mapper.hrmresource.HrmResourceMapper; import com.engine.organization.util.db.MapperProxyFactory; /** @@ -21,6 +21,6 @@ public class HrmResourceTransMethod { } public static String getManagerName(String managerId) { - return MapperProxyFactory.getProxy(EmployeeMapper.class).getEmployeeNameById(Long.parseLong(managerId)); + return MapperProxyFactory.getProxy(HrmResourceMapper.class).getLastNameById(Long.parseLong(managerId)); } } diff --git a/src/com/engine/organization/util/saveimport/HrmResourceImportProcessUtil.java b/src/com/engine/organization/util/saveimport/HrmResourceImportProcessUtil.java index 1b14301d..97880b03 100644 --- a/src/com/engine/organization/util/saveimport/HrmResourceImportProcessUtil.java +++ b/src/com/engine/organization/util/saveimport/HrmResourceImportProcessUtil.java @@ -142,13 +142,13 @@ public class HrmResourceImportProcessUtil { this.keyField = Util.null2String(request.getParameter("keyField")); switch (keyField) { case "workcode": - keyField="work_code"; + keyField = "work_code"; break; case "lastname": - keyField="last_name"; + keyField = "last_name"; break; case "loginid": - keyField="login_id"; + keyField = "login_id"; break; default: break; @@ -260,7 +260,7 @@ public class HrmResourceImportProcessUtil { Class resourcePOClass = HrmResourcePO.class; Class importParamClass = HrmResourceImportParam.class; - 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 field = "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(","); @@ -706,7 +706,6 @@ public class HrmResourceImportProcessUtil { HrmFaceCheckManager.setUserPassowrd(id + "", password_tmp); String password = encrypts[0]; - String salt = encrypts[1]; hrmResourcePO.setPassWord(password); boolean flag = true; @@ -747,14 +746,9 @@ public class HrmResourceImportProcessUtil { } } else if (paramClassDeclaredField.get(hrmResourceImportParam) != null) { if (voFieldType.endsWith("String")) { - if (recordSet.getDBType().equalsIgnoreCase("mysql") || recordSet.getDBType().equalsIgnoreCase("postgresql")) { - if (Util.null2String(paramClassDeclaredField.get(hrmResourceImportParam)).equals("")) { - insertFields.append(s).append(","); - insertValues.append("null,"); - } else { - insertFields.append(s).append(","); - insertValues.append("'").append(paramClassDeclaredField.get(hrmResourceImportParam)).append("',"); - } + if (Util.null2String(paramClassDeclaredField.get(hrmResourceImportParam)).equals("")) { + insertFields.append(s).append(","); + insertValues.append("null,"); } else { insertFields.append(s).append(","); insertValues.append("'").append(paramClassDeclaredField.get(hrmResourceImportParam)).append("',"); @@ -772,17 +766,8 @@ public class HrmResourceImportProcessUtil { } } insertStr = insertStr + insertFields + "creator,delete_type,create_time) values(" + insertValues + createrid + ",'" + 0 + "','" + date + "')"; - boolean resourceInsertFlag = true; if (!execSql(insertStr)) {//添加人员信息 flag = false; - resourceInsertFlag = false; - } - if (resourceInsertFlag) {// 仅当人员插入成功后才进行自定义字段操作 - PasswordUtil.updateResourceSalt(id + "", salt); - // TODO 更新自定义字段 - //if (!updateBaseData(hrmResourceImportParam.getBaseFields(), hrmResourceImportParam.getBaseFieldsValue(), id.intValue())) { - // flag = false; - //} } /*写日志*/ @@ -1197,12 +1182,8 @@ public class HrmResourceImportProcessUtil { } } else if (Util.null2String(paramClassDeclaredField.get(hrmResourceImportParam)).trim().length() > 0) { if (voFieldType.endsWith("String")) { - if (recordSet.getDBType().equalsIgnoreCase("mysql") || recordSet.getDBType().equalsIgnoreCase("postgresql")) { - if (Util.null2String(paramClassDeclaredField.get(hrmResourceImportParam)).equals("")) { - updateStr.append(fields[k]).append("=null,"); - } else { - updateStr.append(fields[k]).append("='").append(paramClassDeclaredField.get(hrmResourceImportParam)).append("',"); - } + if (Util.null2String(paramClassDeclaredField.get(hrmResourceImportParam)).equals("")) { + updateStr.append(fields[k]).append("=null,"); } else { updateStr.append(fields[k]).append("='").append(paramClassDeclaredField.get(hrmResourceImportParam)).append("',"); } @@ -1216,12 +1197,8 @@ public class HrmResourceImportProcessUtil { } } - // TODO updateStr.append(" update_time ='").append(DateUtil.getCurrentDate()).append("' where id=").append(keyMap.get(key)); - execSql(updateStr.toString()); - // TODO 更新自定义字段 - // updateBaseData(hrmResourceImportParam.getBaseFields(), hrmResourceImportParam.getBaseFieldsValue().trim(), keyMap.get(key)); } } catch (Exception e) { //数据异常