人员导入,日志表结构

pull/134/MERGE^2
dxfeng 3 years ago
parent 66f5438d17
commit d508a4d9d0

@ -473,4 +473,20 @@ CREATE TABLE JCL_ORG_MAP (
create_time date null, create_time date null,
update_time date null, update_time date null,
CONSTRAINT JCL_ORG_MAP PRIMARY KEY (id) CONSTRAINT JCL_ORG_MAP PRIMARY KEY (id)
); );
-- 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)
);

@ -443,4 +443,19 @@ CREATE TABLE JCL_ORG_STAFFS (
CREATE_TIME DATE NULL, CREATE_TIME DATE NULL,
UPDATE_TIME DATE NULL, UPDATE_TIME DATE NULL,
CONSTRAINT JCL_ORG_STAFFS_PK PRIMARY KEY (ID) 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)
); );

@ -442,4 +442,19 @@ CREATE TABLE JCL_ORG_STAFFS (
create_time datetime null, create_time datetime null,
update_time datetime null, update_time datetime null,
CONSTRAINT JCL_ORG_STAFFS_PK PRIMARY KEY (id) 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)
); );

@ -1,5 +1,7 @@
package com.engine.organization.mapper.hrmresource; package com.engine.organization.mapper.hrmresource;
import org.apache.ibatis.annotations.Param;
/** /**
* @description: * @description:
* @author:dxfeng * @author:dxfeng
@ -8,5 +10,18 @@ package com.engine.organization.mapper.hrmresource;
*/ */
public interface HrmResourceMapper { public interface HrmResourceMapper {
/**
* ID
*
* @return
*/
Long getMaxId(); Long getMaxId();
/**
* ID
*
* @param id
* @return
*/
String getLastNameById(@Param("id") Long id);
} }

@ -12,7 +12,9 @@
<!-- 表字段 --> <!-- 表字段 -->
<sql id="baseColumns"> <sql id="baseColumns">
t.id t
.
id
, t.creator , t.creator
, t.delete_type , t.delete_type
, t.create_time , t.create_time
@ -23,4 +25,11 @@
select max(id) select max(id)
from jcl_org_hrmresource from jcl_org_hrmresource
</select> </select>
<select id="getLastNameById" resultType="java.lang.String">
select last_name
from jcl_org_hrmresource
where delete_type = 0
and id = #{id}
</select>
</mapper> </mapper>

@ -2,7 +2,7 @@ package com.engine.organization.transmethod;
import com.engine.organization.mapper.comp.CompMapper; import com.engine.organization.mapper.comp.CompMapper;
import com.engine.organization.mapper.department.DepartmentMapper; 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; import com.engine.organization.util.db.MapperProxyFactory;
/** /**
@ -21,6 +21,6 @@ public class HrmResourceTransMethod {
} }
public static String getManagerName(String managerId) { public static String getManagerName(String managerId) {
return MapperProxyFactory.getProxy(EmployeeMapper.class).getEmployeeNameById(Long.parseLong(managerId)); return MapperProxyFactory.getProxy(HrmResourceMapper.class).getLastNameById(Long.parseLong(managerId));
} }
} }

@ -142,13 +142,13 @@ public class HrmResourceImportProcessUtil {
this.keyField = Util.null2String(request.getParameter("keyField")); this.keyField = Util.null2String(request.getParameter("keyField"));
switch (keyField) { switch (keyField) {
case "workcode": case "workcode":
keyField="work_code"; keyField = "work_code";
break; break;
case "lastname": case "lastname":
keyField="last_name"; keyField = "last_name";
break; break;
case "loginid": case "loginid":
keyField="login_id"; keyField = "login_id";
break; break;
default: default:
break; break;
@ -260,7 +260,7 @@ public class HrmResourceImportProcessUtil {
Class<HrmResourcePO> resourcePOClass = HrmResourcePO.class; Class<HrmResourcePO> resourcePOClass = HrmResourcePO.class;
Class<HrmResourceImportParam> importParamClass = HrmResourceImportParam.class; Class<HrmResourceImportParam> 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(","); String[] fields = field.split(",");
@ -706,7 +706,6 @@ public class HrmResourceImportProcessUtil {
HrmFaceCheckManager.setUserPassowrd(id + "", password_tmp); HrmFaceCheckManager.setUserPassowrd(id + "", password_tmp);
String password = encrypts[0]; String password = encrypts[0];
String salt = encrypts[1];
hrmResourcePO.setPassWord(password); hrmResourcePO.setPassWord(password);
boolean flag = true; boolean flag = true;
@ -747,14 +746,9 @@ public class HrmResourceImportProcessUtil {
} }
} else if (paramClassDeclaredField.get(hrmResourceImportParam) != null) { } else if (paramClassDeclaredField.get(hrmResourceImportParam) != null) {
if (voFieldType.endsWith("String")) { if (voFieldType.endsWith("String")) {
if (recordSet.getDBType().equalsIgnoreCase("mysql") || recordSet.getDBType().equalsIgnoreCase("postgresql")) { if (Util.null2String(paramClassDeclaredField.get(hrmResourceImportParam)).equals("")) {
if (Util.null2String(paramClassDeclaredField.get(hrmResourceImportParam)).equals("")) { insertFields.append(s).append(",");
insertFields.append(s).append(","); insertValues.append("null,");
insertValues.append("null,");
} else {
insertFields.append(s).append(",");
insertValues.append("'").append(paramClassDeclaredField.get(hrmResourceImportParam)).append("',");
}
} else { } else {
insertFields.append(s).append(","); insertFields.append(s).append(",");
insertValues.append("'").append(paramClassDeclaredField.get(hrmResourceImportParam)).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 + "')"; insertStr = insertStr + insertFields + "creator,delete_type,create_time) values(" + insertValues + createrid + ",'" + 0 + "','" + date + "')";
boolean resourceInsertFlag = true;
if (!execSql(insertStr)) {//添加人员信息 if (!execSql(insertStr)) {//添加人员信息
flag = false; 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) { } else if (Util.null2String(paramClassDeclaredField.get(hrmResourceImportParam)).trim().length() > 0) {
if (voFieldType.endsWith("String")) { if (voFieldType.endsWith("String")) {
if (recordSet.getDBType().equalsIgnoreCase("mysql") || recordSet.getDBType().equalsIgnoreCase("postgresql")) { if (Util.null2String(paramClassDeclaredField.get(hrmResourceImportParam)).equals("")) {
if (Util.null2String(paramClassDeclaredField.get(hrmResourceImportParam)).equals("")) { updateStr.append(fields[k]).append("=null,");
updateStr.append(fields[k]).append("=null,");
} else {
updateStr.append(fields[k]).append("='").append(paramClassDeclaredField.get(hrmResourceImportParam)).append("',");
}
} else { } else {
updateStr.append(fields[k]).append("='").append(paramClassDeclaredField.get(hrmResourceImportParam)).append("',"); 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)); updateStr.append(" update_time ='").append(DateUtil.getCurrentDate()).append("' where id=").append(keyMap.get(key));
execSql(updateStr.toString()); execSql(updateStr.toString());
// TODO 更新自定义字段
// updateBaseData(hrmResourceImportParam.getBaseFields(), hrmResourceImportParam.getBaseFieldsValue().trim(), keyMap.get(key));
} }
} catch (Exception e) { } catch (Exception e) {
//数据异常 //数据异常

Loading…
Cancel
Save