Oracle BUG修复

pull/189/MERGE^2
dxfeng 3 years ago
parent abc470935e
commit f27612db94

@ -34,4 +34,13 @@ public class ExtendInfoParams {
*
*/
private Map<String, Object> params;
/**
* Oracle
*/
private String sequenceName;
public String getSequenceName() {
return this.tableName + "_ID";
}
}

@ -27,9 +27,7 @@
</update>
<insert id="insertCodeRule" parameterType="com.engine.organization.entity.codesetting.po.CodeRulePO"
keyProperty="id"
keyColumn="id" useGeneratedKeys="true">
<insert id="insertCodeRule" parameterType="com.engine.organization.entity.codesetting.po.CodeRulePO" >
INSERT INTO JCL_CODERULE
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="creator != null">

@ -159,6 +159,97 @@
</trim>
</insert>
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.company.po.CompPO" databaseId="oracle">
<selectKey keyProperty="id" resultType="long" order="AFTER">
select JCL_ORG_COMP_ID.currval from dual
</selectKey>
INSERT INTO jcl_org_comp
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="compNo != null ">
comp_no,
</if>
<if test="compName != null ">
comp_name,
</if>
<if test="compNameShort != null ">
comp_name_short,
</if>
<if test="parentCompany != null ">
parent_company,
</if>
<if test="orgCode != null ">
org_code,
</if>
<if test="industry != null ">
industry,
</if>
<if test="compPrincipal != null ">
comp_principal,
</if>
<if test="description != null ">
description,
</if>
forbidden_tag,
<if test="showOrder != null ">
show_order,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="creator != null">
#{creator},
</if>
<if test="deleteType != null">
#{deleteType},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
<if test="compNo != null ">
#{compNo},
</if>
<if test="compName != null ">
#{compName},
</if>
<if test="compNameShort != null ">
#{compNameShort},
</if>
<if test="parentCompany != null ">
#{parentCompany},
</if>
<if test="orgCode != null ">
#{orgCode},
</if>
<if test="industry != null ">
#{industry},
</if>
<if test="compPrincipal != null ">
#{compPrincipal},
</if>
<if test="description != null ">
#{description},
</if>
0,
<if test="showOrder != null ">
#{showOrder},
</if>
</trim>
</insert>
<select id="list" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>

@ -265,6 +265,91 @@
0,
</trim>
</insert>
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.department.po.DepartmentPO" databaseId="oracle">
<selectKey keyProperty="id" resultType="long" order="AFTER">
select JCL_ORG_DEPT_ID.currval from dual
</selectKey>
INSERT INTO jcl_org_dept
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="deptNo != null ">
dept_no,
</if>
<if test="deptName != null ">
dept_name,
</if>
<if test="deptNameShort != null ">
dept_name_short,
</if>
<if test="parentComp != null ">
parent_comp,
</if>
<if test="parentDept != null ">
parent_dept,
</if>
<if test="deptPrincipal != null ">
dept_principal,
</if>
<if test="showOrder != null ">
show_order,
</if>
<if test="description != null ">
description,
</if>
forbidden_tag,
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="creator != null">
#{creator},
</if>
<if test="deleteType != null">
#{deleteType},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
<if test="deptNo != null ">
#{deptNo},
</if>
<if test="deptName != null ">
#{deptName},
</if>
<if test="deptNameShort != null ">
#{deptNameShort},
</if>
<if test="parentComp != null ">
#{parentComp},
</if>
<if test="parentDept != null ">
#{parentDept},
</if>
<if test="deptPrincipal != null ">
#{deptPrincipal},
</if>
<if test="showOrder != null ">
#{showOrder},
</if>
<if test="description != null ">
#{description},
</if>
0,
</trim>
</insert>
<update id="updateBaseDept" parameterType="com.engine.organization.entity.department.po.DepartmentPO">
update jcl_org_dept

@ -17,6 +17,23 @@
)
</insert>
<insert id="insertExt" parameterType="com.engine.organization.entity.extend.param.ExtendInfoParams" databaseId="oracle">
<selectKey keyProperty="id" resultType="long" order="AFTER">
select ${sequenceName}.currval from dual
</selectKey>
insert into ${tableName} (
<foreach collection="params" item="value" index="key" separator=",">
${key}
</foreach>
)
values (
<foreach collection="params" item="value" index="key" separator=",">
#{value}
</foreach>
)
</insert>
<update id="updateExt" parameterType="com.engine.organization.entity.extend.param.ExtendInfoParams">
update ${tableName} set
<foreach collection="params" item="value" index="key" separator=",">

@ -148,6 +148,79 @@
</trim>
</insert>
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.extend.po.ExtendGroupPO" databaseId="oracle">
<selectKey keyProperty="id" resultType="long" order="AFTER">
select JCL_FIELD_GROUP_ID.currval from dual
</selectKey>
INSERT INTO jcl_field_extendgroup
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="extendType != null ">
extend_type,
</if>
<if test="groupName != null ">
group_name,
</if>
<if test="pid != null ">
pid,
</if>
<if test="isShow != null ">
is_show,
</if>
<if test="showOrder != null ">
show_order,
</if>
<if test="isSystemDefault != null ">
is_system_default,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="creator != null">
#{creator},
</if>
<if test="deleteType != null">
#{deleteType},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
<if test="extendType != null ">
#{extendType},
</if>
<if test="groupName != null ">
#{groupName},
</if>
<if test="pid != null ">
#{pid},
</if>
<if test="isShow != null ">
#{isShow},
</if>
<if test="showOrder != null ">
#{showOrder},
</if>
<if test="isSystemDefault != null ">
#{isSystemDefault},
</if>
</trim>
</insert>
<update id="update">
update jcl_field_extendgroup
<set>

@ -196,9 +196,152 @@
</if>
</trim>
</insert>
<insert id="insertExtendInfo" parameterType="com.engine.organization.entity.extend.po.ExtendInfoPO" databaseId="oracle">
<selectKey keyProperty="id" resultType="long" order="AFTER">
select JCL_FIELD_INFO_ID.currval from dual
</selectKey>
INSERT INTO jcl_field_extendinfo
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="extendType != null ">
extend_type,
</if>
<if test="tableName != null ">
table_name,
</if>
<if test="fieldName != null ">
field_name,
</if>
<if test="fieldNameDesc != null ">
field_name_desc,
</if>
<if test="fieldType != null ">
field_type,
</if>
<if test="controlType != null ">
control_type,
</if>
<if test="browserType != null ">
browser_type,
</if>
<if test="extendGroupId != null ">
extend_group_id,
</if>
<if test="isenable != null ">
isenable,
</if>
<if test="isrequired != null ">
isrequired,
</if>
<if test="listShow != null ">
list_show,
</if>
<if test="searchShow != null ">
search_show,
</if>
<if test="editShow != null ">
edit_show,
</if>
<if test="addShow != null ">
add_show,
</if>
<if test="browserShow != null ">
browser_show,
</if>
<if test="customValue != null ">
custom_value,
</if>
<if test="showOrder != null ">
show_order,
</if>
<if test="isSystemDefault != null ">
is_system_default,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="creator != null">
#{creator},
</if>
<if test="deleteType != null">
#{deleteType},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
<if test="extendType != null ">
#{extendType},
</if>
<if test="tableName != null ">
#{tableName},
</if>
<if test="fieldName != null ">
#{fieldName},
</if>
<if test="fieldNameDesc != null ">
#{fieldNameDesc},
</if>
<if test="fieldType != null ">
#{fieldType},
</if>
<if test="controlType != null ">
#{controlType},
</if>
<if test="browserType != null ">
#{browserType},
</if>
<if test="extendGroupId != null ">
#{extendGroupId},
</if>
<if test="isenable != null ">
#{isenable},
</if>
<if test="isrequired != null ">
#{isrequired},
</if>
<if test="listShow != null ">
#{listShow},
</if>
<if test="searchShow != null ">
#{searchShow},
</if>
<if test="editShow != null ">
#{editShow},
</if>
<if test="addShow != null ">
#{addShow},
</if>
<if test="browserShow != null ">
#{browserShow},
</if>
<if test="customValue != null ">
#{customValue},
</if>
<if test="showOrder != null ">
#{showOrder},
</if>
<if test="isSystemDefault != null ">
#{isSystemDefault},
</if>
</trim>
</insert>
<update id="addTableColumn">
ALTER TABLE ${tableName}
ADD ${fieldName} ${dbType} NULL;
ADD ${fieldName} ${dbType} NULL
</update>
<update id="updateExtendInfo" parameterType="com.engine.organization.entity.extend.po.ExtendInfoPO">
update jcl_field_extendinfo
@ -226,7 +369,7 @@
ALTER TABLE ${tableName}
DROP
COLUMN
${fieldName};
${fieldName}
</update>
<update id="updateExtendGroupId">
UPDATE jcl_field_extendinfo

@ -94,6 +94,76 @@
</if>
</trim>
</insert>
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.extend.po.ExtendTitlePO" databaseId="oracle">
<selectKey keyProperty="id" resultType="long" order="AFTER">
select JCL_FIELD_TITLE_ID.currval from dual
</selectKey>
INSERT INTO jcl_field_extendtitle
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="groupId != null ">
group_id,
</if>
<if test="title != null ">
title,
</if>
<if test="showOrder != null ">
show_order,
</if>
<if test="isShow != null ">
is_show,
</if>
<if test="isSystemDefault != null ">
is_system_default,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="creator != null">
#{creator},
</if>
<if test="deleteType != null">
#{deleteType},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
<if test="groupId != null ">
#{groupId},
</if>
<if test="title != null ">
#{title},
</if>
<if test="showOrder != null ">
#{showOrder},
</if>
<if test="isShow != null ">
#{isShow},
</if>
<if test="isSystemDefault != null ">
#{isSystemDefault},
</if>
</trim>
</insert>
<update id="updateExtendTitle" parameterType="com.engine.organization.entity.extend.po.ExtendTitlePO">
update jcl_field_extendtitle
<set>

@ -60,6 +60,48 @@
</if>
</trim>
</insert>
<insert id="insertHistoryDetail" parameterType="com.engine.organization.entity.jclimport.po.JclImportHistoryDetailPO" databaseId="oracle">
<selectKey keyProperty="id" resultType="long" order="AFTER">
select JCL_IMPORT_DETAIL_ID.currval from dual
</selectKey>
INSERT INTO jcl_import_history_detail
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="pid != null">
pid,
</if>
<if test="rowNums != null">
row_nums,
</if>
<if test="status != null">
status,
</if>
<if test="operateDetail != null">
operate_detail,
</if>
<if test="relatedName != null ">
related_name,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="pid != null">
#{pid},
</if>
<if test="rowNums != null">
#{rowNums},
</if>
<if test="status != null">
#{status},
</if>
<if test="operateDetail != null">
#{operateDetail},
</if>
<if test="relatedName != null ">
#{relatedName},
</if>
</trim>
</insert>
<select id="countRows" resultType="java.lang.Integer">
select count(1)
from jcl_import_history_detail

@ -77,6 +77,61 @@
</trim>
</insert>
<insert id="insertHistory" parameterType="com.engine.organization.entity.jclimport.po.JclImportHistoryPO" databaseId="oracle">
<selectKey keyProperty="id" resultType="long" order="AFTER">
select JCL_IMPORT_HISTORY_ID.currval from dual
</selectKey>
INSERT INTO jcl_import_history
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="operator != null">
operator,
</if>
<if test="operateTime != null">
operate_time,
</if>
<if test="clientAddress != null">
client_address,
</if>
<if test="importType != null">
import_type,
</if>
<if test="sourceFrom != null ">
source_from,
</if>
<if test="operateType != null ">
operate_type,
</if>
<if test="status != null ">
status,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="operator != null">
#{operator},
</if>
<if test="operateTime != null">
#{operateTime},
</if>
<if test="clientAddress != null">
#{clientAddress},
</if>
<if test="importType != null">
#{importType},
</if>
<if test="sourceFrom != null ">
#{sourceFrom},
</if>
<if test="operateType != null ">
#{operateType},
</if>
<if test="status != null ">
#{status},
</if>
</trim>
</insert>
<update id="updateHistoryStatus">
update jcl_import_history
set status = #{status}

@ -163,6 +163,124 @@
0,
</trim>
</insert>
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.job.po.JobPO" databaseId="oracle">
<selectKey keyProperty="id" resultType="long" order="AFTER">
select JCL_ORG_JOB_ID.currval from dual
</selectKey>
INSERT INTO jcl_org_job
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="jobNo != null ">
job_no,
</if>
<if test="jobName != null ">
job_name,
</if>
<if test="parentComp != null ">
parent_comp,
</if>
<if test="parentDept != null ">
parent_dept,
</if>
<if test="sequenceId != null ">
sequence_id,
</if>
<if test="schemeId != null ">
scheme_id,
</if>
<if test="parentJob != null ">
parent_job,
</if>
<if test="isKey != null ">
is_key,
</if>
<if test="workplace != null ">
workplace,
</if>
<if test="description != null ">
description,
</if>
<if test="workDuty != null ">
work_duty,
</if>
<if test="workAuthority != null ">
work_authority,
</if>
<if test="showOrder != null ">
show_order,
</if>
forbidden_tag,
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="creator != null">
#{creator},
</if>
<if test="deleteType != null">
#{deleteType},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
<if test="jobNo != null ">
#{jobNo},
</if>
<if test="jobName != null ">
#{jobName},
</if>
<if test="parentComp != null ">
#{parentComp},
</if>
<if test="parentDept != null ">
#{parentDept},
</if>
<if test="sequenceId != null ">
#{sequenceId},
</if>
<if test="schemeId != null ">
#{schemeId},
</if>
<if test="parentJob != null ">
#{parentJob},
</if>
<if test="isKey != null ">
#{isKey},
</if>
<if test="workplace != null ">
#{workplace},
</if>
<if test="description != null ">
#{description},
</if>
<if test="workDuty != null ">
#{workDuty},
</if>
<if test="workAuthority != null ">
#{workAuthority},
</if>
<if test="showOrder != null ">
#{showOrder},
</if>
0,
</trim>
</insert>
<update id="updateBaseJob" parameterType="com.engine.organization.entity.job.po.JobPO">
update jcl_org_job
<set>

@ -168,6 +168,85 @@
</trim>
</insert>
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.postion.po.PostInfoPO" databaseId="oracle">
<selectKey keyProperty="id" resultType="long" order="AFTER">
select JCL_ORG_POST_INFO_ID.currval from dual
</selectKey>
INSERT INTO jcl_org_post_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="postInfoNo != null">
post_info_no,
</if>
<if test="postInfoName != null">
post_info_name,
</if>
<if test="postInfoAuthority != null">
post_info_authority,
</if>
<if test="postInfoDuty != null">
post_info_duty,
</if>
<if test="postInfoQualification != null">
post_info_qualification,
</if>
<if test="postId != null">
post_id,
</if>
<if test="description != null">
description,
</if>
forbidden_tag,
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="creator != null">
#{creator},
</if>
<if test="deleteType != null">
#{deleteType},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
<if test="postInfoNo != null">
#{postInfoNo},
</if>
<if test="postInfoName != null">
#{postInfoName},
</if>
<if test="postInfoAuthority != null">
#{postInfoAuthority},
</if>
<if test="postInfoDuty != null">
#{postInfoDuty},
</if>
<if test="postInfoQualification != null">
#{postInfoQualification},
</if>
<if test="postId != null">
#{postId},
</if>
<if test="description != null">
#{description},
</if>
0,
</trim>
</insert>
<update id="updateForbiddenTagById" parameterType="com.engine.organization.entity.postion.po.PostInfoPO">
update jcl_org_post_info
<set>

@ -125,6 +125,52 @@
</trim>
</insert>
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.postion.po.PostPO" databaseId="oracle">
<selectKey keyProperty="id" resultType="long" order="AFTER">
select JCL_ORG_POST_ID.currval from dual
</selectKey>
INSERT INTO jcl_org_post
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="postName != null ">
post_name,
</if>
<if test="description != null ">
description,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="creator != null">
#{creator},
</if>
<if test="deleteType != null">
#{deleteType},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
<if test="postName != null ">
#{postName},
</if>
<if test="description != null ">
#{description},
</if>
</trim>
</insert>
<update id="deleteByIds">
UPDATE jcl_org_post

@ -157,6 +157,73 @@
</trim>
</insert>
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.scheme.po.GradePO" databaseId="oracle">
<selectKey keyProperty="id" resultType="long" order="AFTER">
select JCL_ORG_GRADE_ID.currval from dual
</selectKey>
INSERT INTO jcl_org_grade
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="gradeNo != null ">
grade_no,
</if>
<if test="gradeName != null ">
grade_name,
</if>
<if test="description != null ">
description,
</if>
<if test="schemeId != null ">
scheme_id,
</if>
<if test="levelId != null ">
level_id,
</if>
forbidden_tag,
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="creator != null">
#{creator},
</if>
<if test="deleteType != null">
#{deleteType},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
<if test="gradeNo != null ">
#{gradeNo},
</if>
<if test="gradeName != null ">
#{gradeName},
</if>
<if test="description != null ">
#{description},
</if>
<if test="schemeId != null ">
#{schemeId},
</if>
<if test="levelId != null ">
#{levelId},
</if>
0,
</trim>
</insert>
<update id="updateForbiddenTagById" parameterType="com.engine.organization.entity.scheme.po.GradePO">
update jcl_org_grade
<set>

@ -162,6 +162,67 @@
</trim>
</insert>
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.scheme.po.LevelPO" databaseId="oracle">
<selectKey keyProperty="id" resultType="long" order="AFTER">
select JCL_ORG_LEVEL_ID.currval from dual
</selectKey>
INSERT INTO jcl_org_level
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="levelNo != null ">
level_no,
</if>
<if test="levelName != null ">
level_name,
</if>
<if test="description != null ">
description,
</if>
<if test="schemeId != null ">
scheme_id,
</if>
forbidden_tag,
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="creator != null">
#{creator},
</if>
<if test="deleteType != null">
#{deleteType},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
<if test="levelNo != null ">
#{levelNo},
</if>
<if test="levelName != null ">
#{levelName},
</if>
<if test="description != null ">
#{description},
</if>
<if test="schemeId != null ">
#{schemeId},
</if>
0,
</trim>
</insert>
<update id="updateForbiddenTagById" parameterType="com.engine.organization.entity.scheme.po.LevelPO">
update jcl_org_level
<set>

@ -142,6 +142,61 @@
</trim>
</insert>
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.scheme.po.SchemePO" databaseId="oracle">
<selectKey keyProperty="id" resultType="long" order="AFTER">
select JCL_ORG_SCHEME_ID.currval from dual
</selectKey>
INSERT INTO jcl_org_scheme
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="schemeNo != null ">
scheme_no,
</if>
<if test="schemeName != null ">
scheme_name,
</if>
<if test="schemeDescription != null ">
scheme_description,
</if>
forbidden_tag,
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="creator != null">
#{creator},
</if>
<if test="deleteType != null">
#{deleteType},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
<if test="schemeNo != null ">
#{schemeNo},
</if>
<if test="schemeName != null ">
#{schemeName},
</if>
<if test="schemeDescription != null ">
#{schemeDescription},
</if>
0,
</trim>
</insert>
<update id="updateScheme" parameterType="com.engine.organization.entity.scheme.po.SchemePO">
update jcl_org_scheme
<set>

@ -63,6 +63,7 @@
<select id="listUsedId" resultType="java.lang.String">
select sequence_id
from JCL_ORG_JOB
where delete_type = 0
</select>
<select id="getSequencesByIds" resultMap="BaseResultMap">
select
@ -152,6 +153,67 @@
</trim>
</insert>
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.sequence.po.SequencePO" databaseId="oracle">
<selectKey keyProperty="id" resultType="long" order="AFTER">
select JCL_ORG_SEQUENCE_ID.currval from dual
</selectKey>
INSERT INTO jcl_org_sequence
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="sequenceNo != null ">
sequence_no,
</if>
<if test="sequenceName != null ">
sequence_name,
</if>
<if test="description != null ">
description,
</if>
<if test="schemeId != null ">
scheme_id,
</if>
forbidden_tag,
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="creator != null">
#{creator},
</if>
<if test="deleteType != null">
#{deleteType},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
<if test="sequenceNo != null ">
#{sequenceNo},
</if>
<if test="sequenceName != null ">
#{sequenceName},
</if>
<if test="description != null ">
#{description},
</if>
<if test="schemeId != null ">
#{schemeId},
</if>
0,
</trim>
</insert>
<update id="updateForbiddenTagById" parameterType="com.engine.organization.entity.sequence.po.SequencePO">
update jcl_org_sequence
<set>

@ -34,8 +34,46 @@
<!-- 插入全部字段 -->
<insert id="insert" parameterType="com.engine.organization.entity.LoggerContext"
keyProperty="id" keyColumn="id" useGeneratedKeys="true"
>
keyProperty="id" keyColumn="id" useGeneratedKeys="true">
INSERT INTO hr_log
<trim prefix="(" suffix=")" suffixOverrides=",">
operate_desc,
operator_id,
operator_name,
create_time,
operate_type,
params_str,
client_ip,
method_name,
class_name,
delete_type,
operate_module_name,
operate_module,
message,
value
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
#{operateDesc},
#{operatorId},
#{operatorName},
#{createTime},
#{operateType},
#{paramsStr},
#{clientIp},
#{methodName},
#{className},
#{deleteType},
#{operateModuleName},
#{operateModule},
#{message},
#{value}
</trim>
</insert>
<insert id="insert" parameterType="com.engine.organization.entity.LoggerContext" databaseId="oracle">
<selectKey keyProperty="id" resultType="long" order="AFTER">
select HR_LOG_ID.currval from dual
</selectKey>
INSERT INTO hr_log
<trim prefix="(" suffix=")" suffixOverrides=",">
operate_desc,

@ -195,6 +195,108 @@
</trim>
</insert>
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.staff.po.StaffPO" databaseId="oracle">
<selectKey keyProperty="id" resultType="long" order="AFTER">
select JCL_ORG_STAFF_ID.currval from dual
</selectKey>
INSERT INTO jcl_org_staff
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="planId != null ">
plan_id,
</if>
<if test="compId != null ">
comp_id,
</if>
<if test="deptId != null ">
dept_id,
</if>
<if test="jobId != null ">
job_id,
</if>
<if test="staffNum != null ">
staff_num,
</if>
<if test="controlPolicy != null ">
control_policy,
</if>
<if test="permanentNum != null ">
permanent_num,
</if>
<if test="freezeNum != null ">
freeze_num,
</if>
<if test="lackStatus != null ">
lack_status,
</if>
<if test="staffDesc != null ">
staff_desc,
</if>
<if test="description != null ">
description,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="creator != null">
#{creator},
</if>
<if test="deleteType != null">
#{deleteType},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
<if test="planId != null ">
#{planId},
</if>
<if test="compId != null ">
#{compId},
</if>
<if test="deptId != null ">
#{deptId},
</if>
<if test="jobId != null ">
#{jobId},
</if>
<if test="staffNum != null ">
#{staffNum},
</if>
<if test="controlPolicy != null ">
#{controlPolicy},
</if>
<if test="permanentNum != null ">
#{permanentNum},
</if>
<if test="freezeNum != null ">
#{freezeNum},
</if>
<if test="lackStatus != null ">
#{lackStatus},
</if>
<if test="staffDesc != null ">
#{staffDesc},
</if>
<if test="description != null ">
#{description},
</if>
</trim>
</insert>
<update id="deleteByIds">
UPDATE jcl_org_staff
SET delete_type = 1

@ -177,6 +177,91 @@
</trim>
</insert>
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.staff.po.StaffPlanPO" databaseId="oracle">
<selectKey keyProperty="id" resultType="long" order="AFTER">
select JCL_ORG_STAFFPLAN_ID.currval from dual
</selectKey>
INSERT INTO jcl_org_staffplan
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="planNo != null ">
plan_no,
</if>
<if test="planName != null ">
plan_name,
</if>
<if test="planYear != null ">
plan_year,
</if>
<if test="timeStart != null ">
time_start,
</if>
<if test="timeEnd != null ">
time_end,
</if>
<if test="companyId != null ">
company_id,
</if>
<if test="controlDimension != null ">
control_dimension,
</if>
<if test="description != null ">
description,
</if>
forbidden_tag,
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="creator != null">
#{creator},
</if>
<if test="deleteType != null">
#{deleteType},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
<if test="planNo != null ">
#{planNo},
</if>
<if test="planName != null ">
#{planName},
</if>
<if test="planYear != null ">
#{planYear},
</if>
<if test="timeStart != null ">
#{timeStart},
</if>
<if test="timeEnd != null ">
#{timeEnd},
</if>
<if test="companyId != null ">
#{companyId},
</if>
<if test="controlDimension != null ">
#{controlDimension},
</if>
<if test="description != null ">
#{description},
</if>
0,
</trim>
</insert>
<update id="updateForbiddenTagById" parameterType="com.engine.organization.entity.staff.po.StaffPlanPO">
update jcl_org_staffplan
<set>

@ -98,4 +98,76 @@
</trim>
</insert>
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.staff.po.StaffsPO" databaseId="oracle">
<selectKey keyProperty="id" resultType="long" order="AFTER">
select JCL_ORG_STAFFS_ID.currval from dual
</selectKey>
INSERT INTO jcl_org_staffs
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="staffId != null ">
staff_id,
</if>
<if test="businessType != null ">
business_type,
</if>
<if test="changeNum != null ">
change_num,
</if>
<if test="businessSource != null ">
business_source,
</if>
<if test="requestId != null ">
requestid,
</if>
<if test="description != null ">
description,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="creator != null">
#{creator},
</if>
<if test="deleteType != null">
#{deleteType},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
<if test="staffId != null ">
#{staffId},
</if>
<if test="businessType != null ">
#{businessType},
</if>
<if test="changeNum != null ">
#{changeNum},
</if>
<if test="businessSource != null ">
#{businessSource},
</if>
<if test="requestId != null ">
#{requestId},
</if>
<if test="description != null ">
#{description},
</if>
</trim>
</insert>
</mapper>

@ -1,7 +1,5 @@
package com.engine.organization.service;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
@ -11,26 +9,6 @@ import java.util.Map;
* @version: 1.0
*/
public interface ImportCommonService {
/**
*
*
* @param params
* @param request
* @return
*/
Map<String, Object> saveImportResource(Map<String, Object> params, HttpServletRequest request);
/**
*
*
* @param params
* @param request
* @param user
* @return
*/
Map<String, Object> saveImport(Map<String, Object> params, HttpServletRequest request, User user);
/**
*

@ -15,9 +15,11 @@ import com.engine.organization.mapper.codesetting.CodeRuleMapper;
import com.engine.organization.mapper.extend.*;
import com.engine.organization.service.ExtService;
import com.engine.organization.util.OrganizationAssert;
import com.engine.organization.util.db.DBType;
import com.engine.organization.util.db.MapperProxyFactory;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.hrm.User;
@ -71,7 +73,7 @@ public class ExtServiceImpl extends Service implements ExtService {
List<String> readOnlyFieldList = Arrays.asList(readOnlyFields);
// 组装拓展页内容
for (ExtendInfoPO extendInfoPO : infoPOList) {
SearchConditionItem item = ExtendInfoBO.getSearchConditionItem(user, viewAttr, extendInfoPO, null == compExtMap ? null : compExtMap.get(extendInfoPO.getFieldName()));
SearchConditionItem item = ExtendInfoBO.getSearchConditionItem(user, viewAttr, extendInfoPO, null == compExtMap ? null : compExtMap.get(DBType.get(new RecordSet().getDBType()).equals(DBType.ORACLE) ? extendInfoPO.getFieldName().toUpperCase() : extendInfoPO.getFieldName()));
item.setFieldcol(16);
if (2 == viewAttr) {
if (CollectionUtils.isNotEmpty(readOnlyFieldList) && readOnlyFieldList.contains(extendInfoPO.getFieldName())) {
@ -108,7 +110,7 @@ public class ExtServiceImpl extends Service implements ExtService {
item.setViewAttr(3);
item.setRules("required");
}
if (StringUtils.isNotBlank(autoNoField) && extendInfoPO.getFieldName().equals(autoNoField)) {
if (StringUtils.isNotBlank(autoNoField) && extendInfoPO.getFieldName().equalsIgnoreCase(autoNoField)) {
// 判断是否开启自动编号
CodeRulePO codeRuleByType = MapperProxyFactory.getProxy(CodeRuleMapper.class).getCodeRuleByType(serialType);
if (null != codeRuleByType && "1".equals(codeRuleByType.getSerialEnable())) {
@ -156,7 +158,16 @@ public class ExtServiceImpl extends Service implements ExtService {
// 去除null 元素
List<Map<String, Object>> maps = getExtDTMapper().listCompExtDT(tableName, id, fields);
maps.removeIf(Objects::isNull);
tabinfoMap.put("datas", maps);
// 兼容Oracle,map的key转换为小写
List<Map<String, Object>> collect = maps.stream().map(item -> {
Map<String, Object> resultMap = new HashMap<>();
Set<String> keys = item.keySet();
for (String key : keys) {
resultMap.put(key.toLowerCase(), item.get(key));
}
return resultMap;
}).collect(Collectors.toList());
tabinfoMap.put("datas", collect);
tableMap.put("tabinfo", tabinfoMap);
tables.add(tableMap);
}
@ -172,7 +183,7 @@ public class ExtServiceImpl extends Service implements ExtService {
public List<TopTab> getTabInfo(String extendType, String tableName) {
List<TopTab> topTabs = new ArrayList<>();
List<ExtendInfoPO> infoPOList = getExtendInfoMapper().listFields(extendType, "", tableName, ExtendInfoOperateType.EDIT.getValue(), "1");
List<ExtendInfoPO> infoPOList1 = getExtendInfoMapper().listFields(extendType, "", tableName.toLowerCase().replace("ext", ""), ExtendInfoOperateType.EDIT.getValue(), "1");
List<ExtendInfoPO> infoPOList1 = getExtendInfoMapper().listFields(extendType, "", tableName.toUpperCase().replace("EXT", ""), ExtendInfoOperateType.EDIT.getValue(), "1");
infoPOList.addAll(infoPOList1);
List<Long> ids = infoPOList.stream().map(ExtendInfoPO::getExtendGroupId).collect(Collectors.toList());

@ -14,7 +14,6 @@ import com.engine.organization.entity.SelectOptionParam;
import com.engine.organization.entity.extend.param.ExtendInfoParams;
import com.engine.organization.entity.extend.po.ExtendInfoPO;
import com.engine.organization.entity.fieldset.param.FieldTypeTreeParam;
import com.engine.organization.entity.hrmresource.param.HrmResourceImportParam;
import com.engine.organization.entity.jclimport.po.CusFormFieldPO;
import com.engine.organization.entity.jclimport.po.JclImportHistoryDetailPO;
import com.engine.organization.entity.jclimport.po.JclImportHistoryPO;
@ -35,9 +34,6 @@ import com.engine.organization.util.OrganizationAssert;
import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.excel.ExcelUtil;
import com.engine.organization.util.relation.EcHrmRelationUtil;
import com.engine.organization.util.saveimport.HrmResourceImportAdaptUtil;
import com.engine.organization.util.saveimport.HrmResourceImportProcessUtil;
import com.engine.organization.util.saveimport.SaveImportProcessUtil;
import com.engine.organization.util.saveimport.hrmimport.HrmImportAdaptExcelE9;
import com.engine.organization.util.saveimport.hrmimport.HrmImportProcessE9;
import org.apache.commons.lang3.StringUtils;
@ -52,7 +48,6 @@ import weaver.file.ImageFileManager;
import weaver.general.BaseBean;
import weaver.general.GCONST;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.hrm.definedfield.HrmFieldManager;
import weaver.join.hrm.in.HrmResourceVo;
import weaver.systeminfo.SystemEnv;
@ -87,85 +82,6 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
return MapperProxyFactory.getProxy(SystemDataMapper.class);
}
@Override
public Map<String, Object> saveImportResource(Map<String, Object> params, HttpServletRequest request) {
Map<String, Object> returnMap = new HashMap<>();
try {
String keyField = (String) params.get("keyField");
switch (keyField) {
case "workcode":
params.put("keyField", "work_code");
break;
case "lastname":
params.put("keyField", "last_name");
break;
case "loginid":
params.put("keyField", "login_id");
break;
default:
break;
}
/*综合考虑多数据源后,实现通过配置文件配置适配器和解析类*/
List<Object> lsErrorInfo = new ArrayList<>();
HrmResourceImportAdaptUtil importAdaptUtil = new HrmResourceImportAdaptUtil();
FileUploadToPath fu = new FileUploadToPath(request);
int language = this.user.getLanguage();
importAdaptUtil.setUserlanguage(language);
List<String> errorInfo = importAdaptUtil.creatImportMap(fu);
//如果读取数据和验证模板没有发生错误
if (errorInfo.isEmpty()) {
Map<String, HrmResourceImportParam> hrMap = importAdaptUtil.getHrmImportMap();
HrmResourceImportProcessUtil importProcessUtil = new HrmResourceImportProcessUtil();
importProcessUtil.init(request);
importProcessUtil.processMap(hrMap);
} else {
Map<String, Object> error;
for (String s : errorInfo) {
error = new HashMap<>();
error.put("message", Util.null2String(s));
lsErrorInfo.add(error);
}
}
returnMap.put("errorInfo", lsErrorInfo);
returnMap.put("status", "1");
} catch (Exception e) {
returnMap.put("status", "-1");
returnMap.put("message", e.getMessage());
}
return returnMap;
}
@Override
public Map<String, Object> saveImport(Map<String, Object> params, HttpServletRequest request, User user) {
Map<String, Object> returnMap = new HashMap<>();
request.getSession(true).setAttribute("importBaseCreater", user);
try {
List<Object> lsErrorInfo = new ArrayList<>();
SaveImportProcessUtil importProcessUtil = new SaveImportProcessUtil();
List<String> errorInfo = importProcessUtil.importXls(request);
if (errorInfo != null && !errorInfo.isEmpty()) {
Map<String, Object> error;
for (String s : errorInfo) {
error = new HashMap<>();
error.put("message", Util.null2String(s));
lsErrorInfo.add(error);
}
}
returnMap.put("errorInfo", lsErrorInfo);
returnMap.put("status", "1");
returnMap.put("message", SystemEnv.getHtmlLabelName(24645, user.getLanguage()));
} catch (Exception e) {
new BaseBean().writeLog("导入基础数据失败:" + e);
returnMap.put("status", "-1");
returnMap.put("message", e.getMessage());
}
returnMap.put("pid", request.getSession(true).getAttribute("importExcelPid"));
return returnMap;
}
@Override
public Map<String, Object> getImportFields(String importType) {
String extendType = "";

@ -1,522 +0,0 @@
package com.engine.organization.util.saveimport;
import com.engine.hrm.entity.RuleCodeType;
import com.engine.hrm.util.CodeRuleManager;
import com.engine.hrm.util.HrmTriggerUtil;
import com.engine.hrm.util.face.HrmFaceCheckManager;
import com.engine.organization.entity.company.po.CompPO;
import com.engine.organization.entity.department.po.DepartmentPO;
import com.engine.organization.mapper.comp.CompMapper;
import com.engine.organization.mapper.department.DepartmentMapper;
import com.engine.organization.util.db.MapperProxyFactory;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.common.AjaxManager;
import weaver.hrm.common.DbFunctionUtil;
import weaver.hrm.company.DepartmentComInfo;
import weaver.hrm.company.SubCompanyComInfo;
import weaver.matrix.MatrixUtil;
import weaver.rtx.OrganisationCom;
import weaver.systeminfo.SysMaintenanceLog;
import weaver.systeminfo.SystemEnv;
import java.util.List;
/**
* @author:dxfeng
* @createTime: 2022/06/30
* @version: 1.0
*/
public class CompanyImportUtil {
private final RecordSet recordSet = new RecordSet();
private final OrganisationCom rtxService = new OrganisationCom(); //添加到rtx
private int id;
private String subcompanyname = "";
private String departmentname = "";
private String subcompanycode = "";
private Integer subcompanyshoworder;
private String departmentcode = "";
private Float departmentshoworder;
private int userlanguage = 7;
private int pid;
private String operateType;
private String message = "";
private CompMapper getCompMapper() {
return MapperProxyFactory.getProxy(CompMapper.class);
}
private DepartmentMapper getDepartmentMapper() {
return MapperProxyFactory.getProxy(DepartmentMapper.class);
}
public void setPid(int pid) {
this.pid = pid;
}
public void setUserLanguage(String userlanguage) {
this.userlanguage = Util.getIntValue(userlanguage);
}
/**
*
*/
public String valExcelData() {
String errorInfo = "";
if (Util.null2String(this.subcompanyname).length() == 0) {
errorInfo = SystemEnv.getHtmlLabelName(125704, userlanguage);
return errorInfo;
}
if (StringUtils.isNotEmpty(operateType) && operateType.equals("add")) {
if (!verifySubCompanyCode(subcompanycode)) return subcompanycode + "编号重复";
if (!verifyDeptCode(departmentcode)) return departmentcode + "编号重复";
}
return errorInfo;
}
/**
*
*/
public String save() {
boolean flag = false;
try {
if (StringUtils.isNotEmpty(operateType)) {
if (operateType.equals("add")) {
int subcompanyid = 0;
int departmentid;
if (Util.null2String(this.subcompanyname).length() > 0) {
//取分部
subcompanyid = getCompanyId(this.subcompanyname);
}
departmentid = getDeptId(this.departmentname, subcompanyid);
if (Util.null2String(this.departmentname).length() > 0) {
if (departmentid != 0) flag = true;
} else {
if (subcompanyid != 0) flag = true;
}
} else if (operateType.equals("update")) {
int subcompanyid = updateSubCompany();
if (subcompanyid == -1) return String.valueOf(flag);
int deptid = updateDept(subcompanyid);
if (deptid == -1) return String.valueOf(flag);
flag = true;
}
}
} catch (Exception e) {
new BaseBean().writeLog(e);
}
return String.valueOf(flag);
}
/**
*
*
* @param code
* @return
*/
private boolean verifySubCompanyCode(String code) {
if (StringUtils.isEmpty(code)) {
return true;
}
List<CompPO> compPOS = getCompMapper().listByNo(code);
return CollectionUtils.isEmpty(compPOS);
}
/**
* @param code
* @param name
* @param supsubcomid
* @return
*/
private boolean verifySubCompanyCode(String code, String name, int supsubcomid) {
if (StringUtils.isEmpty(code)) {
return true;
}
// TODO 部门重复编号验证
RecordSet recordSet = new RecordSet();
String sql = "select id from HrmSubCompany where subcompanyname = ? and supsubcomid = ?";
recordSet.executeQuery(sql, name, supsubcomid);
if (recordSet.next()) {
String id = recordSet.getString("id");
sql = "select id from HrmSubCompany where subcompanycode = ? and id != ?";
recordSet.executeQuery(sql, code, id);
return recordSet.getCounts() <= 0;
}
return verifySubCompanyCode(code);
}
/**
*
*
* @param code
* @return
*/
private boolean verifyDeptCode(String code) {
if (StringUtils.isEmpty(code)) {
return true;
}
List<DepartmentPO> departmentPOS = getDepartmentMapper().listByNo(code);
return CollectionUtils.isEmpty(departmentPOS);
}
private boolean verifyDeptCode(String code, String name, int subcompanyid, int supdepid) {
// TODO 部门编号校验
if (StringUtils.isEmpty(code)) return true;
RecordSet recordSet = new RecordSet();
String sql = "select id from HrmDepartment where departmentname = ? and subcompanyid1 = ? and supdepid = ?";
recordSet.executeQuery(sql, name, subcompanyid, supdepid);
if (recordSet.next()) {
String id = recordSet.getString("id");
sql = "select id from HrmDepartment where departmentcode = ? and id != ?";
recordSet.executeQuery(sql, code, id);
return recordSet.getCounts() <= 0;
}
return verifyDeptCode(code);
}
private int updateDept(int subcompanyid) {
String[] deptNames = departmentname.split(">");
int currentId = 0;
int parentId = 0;
String departmentcode = "";
Float departmentshoworder = null;
for (int i = 0; i < deptNames.length; i++) {
if (StringUtils.isEmpty(deptNames[i])) continue;
String sql = "select * from HrmDepartment where subcompanyid1=" + subcompanyid + " and departmentname='" + deptNames[i].trim() + "' and supdepid=" + parentId + " and (canceled !=1 or canceled is null)";
currentId = getResultSetId(sql);
if (currentId == 0) {
// 部门不存在
// 不存在
this.setMessage("" + deptNames[i] + "部门不存在");
return -1;
}
if (i == deptNames.length - 1) {
// 最后一层级 赋值编码和顺序
departmentcode = this.departmentcode;
departmentshoworder = this.departmentshoworder;
}
if (StringUtils.isNotEmpty(departmentcode) || departmentshoworder != null) {
recordSet.executeQuery(sql);
recordSet.next();
if (departmentshoworder == null)
departmentshoworder = Float.valueOf(Util.null2s(recordSet.getString("showorder"), "0"));
if (StringUtils.isEmpty(departmentcode))
departmentcode = Util.null2String(recordSet.getString("departmentcode"), "");
if (verifyDeptCode(departmentcode, deptNames[i], subcompanyid, parentId)) {
sql = "update hrmdepartment set departmentcode = ? , showorder = ? where departmentname = ? and subcompanyid1 = ? and supdepid = ? and (canceled !=1 or canceled is null)";
recordSet.executeUpdate(sql, departmentcode, departmentshoworder, deptNames[i], subcompanyid, parentId);
} else {
setMessage("" + departmentcode + "编号重复");
return -1;
}
}
parentId = currentId;
}
return currentId;
}
private int updateSubCompany() {
String[] subcompanynames = subcompanyname.split(">");
int parentId = 0;
int currentId = 0;
String subcompanycode = "";
Integer subcompanyshoworder = null;
for (int i = 0; i < subcompanynames.length; i++) {
if (StringUtils.isEmpty(subcompanynames[i])) continue;
String sql = "select * from HrmSubCompany where subcompanyname='"
+ subcompanynames[i].trim() + "' and supsubcomid=" + parentId;
currentId = getResultSetId(sql);
if (currentId == 0) {
// 不存在
this.setMessage("" + subcompanynames[i] + "分部不存在");
return -1;
}
if (i == subcompanynames.length - 1) {
// 最后一层级 赋值编码和顺序
subcompanycode = this.subcompanycode;
subcompanyshoworder = this.subcompanyshoworder;
}
// 如果编码和顺序不存在则不更新
if (StringUtils.isNotEmpty(subcompanycode) || subcompanyshoworder != null) {
recordSet.executeQuery(sql);
recordSet.next();
if (subcompanyshoworder == null)
subcompanyshoworder = Integer.valueOf(Util.null2s(recordSet.getString("showorder"), "0"));
if (StringUtils.isEmpty(subcompanycode))
subcompanycode = Util.null2String(recordSet.getString("subcompanycode"), "");
if (verifySubCompanyCode(subcompanycode, subcompanynames[i], parentId)) {
sql = "update HrmSubCompany set subcompanycode= ? , showorder = ? where subcompanyname = ? and supsubcomid = ?";
recordSet.executeUpdate(sql, subcompanycode, subcompanyshoworder, subcompanynames[i], parentId);
} else {
setMessage("" + subcompanycode + "编号重复");
return -1;
}
}
parentId = currentId;
}
return currentId;
}
/**
* Id
*
* @param companyName eg广>
*/
public int getCompanyId(String companyName) {
String[] companyNames = companyName.split(">");
int currentId = 0;
int parentId = 0;
String sql;
String sqlInsert;
String companyCode = "";
Integer companyShowOrder = null;
for (int i = 0; i < companyNames.length; i++) {
if (companyNames[i] == null && companyNames[i].equals("")) {
continue;
}
sql = "select id from HrmSubCompany where subcompanyname='"
+ companyNames[i].trim() + "' and supsubcomid=" + parentId;
currentId = getResultSetId(sql);
//added by wcd 2015-02-06 [限制分部数]
if (currentId == 0) {
if (i == companyNames.length - 1) {
// 最后一层级 赋值编码和顺序
companyCode = this.subcompanycode;
companyShowOrder = this.subcompanyshoworder;
if (companyShowOrder == null) {
companyShowOrder = 0;
}
}
if (AjaxManager.getData("", "getLnScCount;mf").equals("true")) {
// 如果编码为空 自动生成编码
try {
companyCode = CodeRuleManager.getCodeRuleManager().generateRuleCode(RuleCodeType.SUBCOMPANY, companyCode);
} catch (Exception e) {
setMessage("," + e.getMessage());
new BaseBean().writeLog(e);
return -1;
}
sqlInsert = "insert into HrmSubCompany(subcompanyname,subcompanydesc,companyid,supsubcomid,subcompanycode,showorder," + DbFunctionUtil.getInsertColumnSql() + ") values('"
+ companyNames[i] + "','" + companyNames[i] + "',1" + "," + parentId + ",'" + companyCode + "'," + companyShowOrder + "," + DbFunctionUtil.getInsertColumnValueSql(new RecordSet().getDBType(), 1) + ")"; // 创建
boolean isSuccess = execSql(sqlInsert);
HrmTriggerUtil.generateSubcompanyPinyin(companyNames[i], null);
currentId = getResultSetId(sql);
HrmTriggerUtil.Tri_I_SubComKPICheckFlow(String.valueOf(currentId));
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);
if (isSuccess) {
//同步分部数据到矩阵
MatrixUtil.updateSubcompayData("" + currentId);
HrmFaceCheckManager.sync(currentId + "", HrmFaceCheckManager.getOptInsert(), "hrm_import_subcompany", HrmFaceCheckManager.getOaSubcompany());
}
insertSysLog(companyNames[i]);
} else {
currentId = -1;
}
}
parentId = currentId;
if (currentId != -1)
rtxService.addSubCompany(parentId); //同步RTX
}
return currentId;
}
/**
* id
*
* @param deptNames
* @param subCompanyId id
*/
public int getDeptId(String deptNames, int subCompanyId) {
String[] deptName = deptNames.split(">");
int currentId = 0;
int parentId = 0;
String sql;
String sqlInsert;
String departmentcode = "";
Float departmentshoworder = null;
for (int i = 0; i < deptName.length; i++) {
if (deptName[i] == null || deptName[i].equals("")) {
continue;
}
sql = "select id from HrmDepartment where subcompanyid1=" + subCompanyId + " and departmentname='" + deptName[i].trim() + "' and supdepid=" + parentId + " and (canceled !=1 or canceled is null)";
currentId = getResultSetId(sql);
if (currentId == 0) {
if (i == deptName.length - 1) {
departmentcode = this.departmentcode;
departmentshoworder = this.departmentshoworder;
if (departmentshoworder == null) departmentshoworder = 0.00F;
}
// 如果编码为空 自动生成编码
try {
departmentcode = CodeRuleManager.getCodeRuleManager().generateRuleCode(RuleCodeType.DEPARTMENT, String.valueOf(subCompanyId), departmentcode);
} catch (Exception e) {
setMessage("" + e.getMessage());
new BaseBean().writeLog(e);
return -1;
}
sqlInsert = "insert into HrmDepartment (departmentname,Departmentmark,subcompanyid1,supdepid,departmentcode,showorder," + DbFunctionUtil.getInsertColumnSql() + ") values('"
+ deptName[i] + "','" + deptName[i] + "'," + subCompanyId + "," + parentId + ",'" + departmentcode + "'," + departmentshoworder + "," + DbFunctionUtil.getInsertColumnValueSql(new RecordSet().getDBType(), 1) + ")"; // 创建
boolean isSuccess = execSql(sqlInsert);
HrmTriggerUtil.generateDepartmentPinyin(deptName[i], null);
currentId = getResultSetId(sql);
HrmTriggerUtil.Tri_I_DeptKPICheckFlow(String.valueOf(currentId));
if (isSuccess) {
//同步部门数据到矩阵
MatrixUtil.updateDepartmentData("" + currentId);
HrmFaceCheckManager.sync(currentId + "", HrmFaceCheckManager.getOptInsert(), "hrm_import_deptment", HrmFaceCheckManager.getOaDepartment());
}
insertSysLog(deptName[i]);
rtxService.addDepartment(currentId); //同步RTX
}
parentId = currentId;
}
return currentId;
}
/**
* Id
*
* @param sql
*/
public int getResultSetId(String sql) {
int currentId = 0;
recordSet.execute(sql);
try {
while (recordSet.next()) {
currentId = recordSet.getInt("id");
}
} catch (Exception e) {
e.printStackTrace();
}
return currentId;
}
/**
*
*
* @param sql
*/
public boolean execSql(String sql) {
return recordSet.execute(sql);
}
public void removeCache() {
try {
weaver.matrix.MatrixUtil.sysSubcompayData();
weaver.matrix.MatrixUtil.sysDepartmentData();
SubCompanyComInfo SubCompanyComInfo = new SubCompanyComInfo();
SubCompanyComInfo.removeCompanyCache();
DepartmentComInfo DepartmentComInfo = new DepartmentComInfo();
DepartmentComInfo.removeCompanyCache();
//初始化应用分权
new weaver.hrm.appdetach.AppDetachComInfo().initSubDepAppData();
} catch (Exception e) {
new BaseBean().writeLog(e);
}
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getSubcompanyname() {
return subcompanyname;
}
public void setSubcompanyname(String subcompanyname) {
this.subcompanyname = subcompanyname;
}
public String getDepartmentname() {
return departmentname;
}
public void setDepartmentname(String departmentname) {
this.departmentname = departmentname;
}
public String getSubcompanycode() {
return subcompanycode;
}
public void setSubcompanycode(String subcompanycode) {
this.subcompanycode = subcompanycode;
}
public Integer getSubcompanyshoworder() {
return subcompanyshoworder;
}
public void setSubcompanyshoworder(Integer subcompanyshoworder) {
this.subcompanyshoworder = subcompanyshoworder;
}
public String getDepartmentcode() {
return departmentcode;
}
public void setDepartmentcode(String departmentcode) {
this.departmentcode = departmentcode;
}
public Float getDepartmentshoworder() {
return departmentshoworder;
}
public void setDepartmentshoworder(Float departmentshoworder) {
this.departmentshoworder = departmentshoworder;
}
public String getOperateType() {
return operateType;
}
public void setOperateType(String operateType) {
this.operateType = operateType;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
private void insertSysLog(String name) {
SysMaintenanceLog syslog = new SysMaintenanceLog();
syslog.resetParameter();
syslog.setRelatedId(pid);
syslog.setOperateType("-1");
syslog.setOperateItem("12");
syslog.setOperateUserid(0);
syslog.setRelatedName(name);
try {
syslog.setSysLogInfo();
} catch (Exception e) {
new BaseBean().writeLog(e);
}
}
}

@ -1,628 +0,0 @@
package com.engine.organization.util.saveimport;
import com.engine.common.util.ParamUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.hrm.service.ImportLogService;
import com.engine.hrm.service.impl.ImportLogServiceImpl;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.jetbrains.annotations.NotNull;
import weaver.file.ImageFileManager;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.hrm.excelimport.*;
import weaver.systeminfo.SystemEnv;
import javax.servlet.http.HttpServletRequest;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* @author:dxfeng
* @createTime: 2022/06/30
* @version: 1.0
*/
public class SaveImportProcessUtil {
/**
*
*/
private String importType;
/**
* excel
*/
private HSSFSheet sheet;
/**
*
*/
private final List<Object> lsImportSourceMap = new ArrayList<>();
/**
*
*/
private final List<String> errorInfo = new ArrayList<>();
/**
*
*/
private final Map<String, Method> parameterTypes = new HashMap<>();
/**
*
*/
private final Map<String, String> fieldTypes = new HashMap<>();
/**
*
*/
private final Map<String, String[]> mapImportSource = new HashMap<>();
/**
*
*/
private final Map<String, String> mapImportSourceName = new HashMap<>();
/**
* excel
*/
private final Map<String, String[]> mapImportSourceField = new HashMap<>();
/**
* excel
*/
private final Map<String, String[]> mapImportSourceFieldName = new HashMap<>();
/**
* --
*/
private int userLanguage = 7;
/**
*
*/
private String[] voFields;
/**
*
*/
private Class<?> importSourceClass;
/**
*
*/
private String keyField = "";
/**
*
*/
private String creator = "";
/**
*
*/
private String operateType = "";
/**
* false--true--
*/
private boolean isDeleted = false;
private User user;
private int pId = 0;
/**
* IP
*/
public SaveImportProcessUtil() {
// TODO 组织导入类
mapImportSource.put("company", new String[]{CompanyImportUtil.class.getName()});
mapImportSource.put("jobtitle", new String[]{HrmJobTitle.class.getName()});
mapImportSource.put("group", new String[]{HrmGroup.class.getName()});
mapImportSource.put("groupMember", new String[]{HrmGroupMember.class.getName()});
mapImportSource.put("resourcedetial", new String[]{HrmFamilyInfo.class.getName(),
HrmLanguageAbility.class.getName(),
HrmEducationInfo.class.getName(),
HrmWorkResume.class.getName(),
HrmTrainBeforeWork.class.getName(),
HrmCertification.class.getName(),
HrmRewardBeforeWork.class.getName()});
mapImportSource.put("city", new String[]{HrmCity.class.getName()});
mapImportSource.put("location", new String[]{HrmLoaction.class.getName()});
mapImportSource.put("special", new String[]{HrmSpeciality.class.getName()});
mapImportSource.put("area", new String[]{HrmArea.class.getName()});
mapImportSource.put("sensitiveword", new String[]{SensitiveWord.class.getName()});
mapImportSourceName.put("company", "分部、部门导入");
mapImportSourceName.put("jobtitle", "岗位体系导入");
mapImportSourceName.put("group", "常用组信息导入");
mapImportSourceName.put("groupMember", "常用组成员导入");
mapImportSourceName.put("resourcedetial", "个人数据导入");
mapImportSourceName.put("city", "位置信息导入");
mapImportSourceName.put("location", "办公地点信息导入");
mapImportSourceName.put("special", "专业信息导入");
mapImportSourceName.put("area", "行政区域导入");
mapImportSourceName.put("sensitiveword", "敏感词");
mapImportSourceField.put("company", new String[]{"subcompanyname,departmentname,subcompanyshoworder,subcompanycode,departmentshoworder,departmentcode"});
mapImportSourceField.put("jobtitle", new String[]{"jobtitlemark,jobtitlename,jobtitlecode,jobactivityname,jobgroupname,jobresponsibility,jobcompetency,jobtitleremark"});
mapImportSourceField.put("group", new String[]{"typename,groupname,username,keycode"});
mapImportSourceField.put("groupMember", new String[]{"workCode,lastName,loginId"});
mapImportSourceField.put("resourcedetial", new String[]{"lastname,loginid,member,title,company,jobtitle,address",
"lastname,loginid,language,level_n,memo",
"lastname,loginid,school,speciality,startdate,enddate,educationlevel,studydesc",
"lastname,loginid,company,startdate,enddate,jobtitle,workdesc,leavereason",
"lastname,loginid,trainname,trainstartdate,trainenddate,trainresource,trainmemo",
"lastname,loginid,certname,datefrom,dateto,awardfrom",
"lastname,loginid,rewardname,rewarddate,rewardmemo"});
mapImportSourceField.put("city", new String[]{"位置信息导入"});
mapImportSourceField.put("location", new String[]{"locationname,locationdesc,locationcityname,countryname,showorder"});
mapImportSourceField.put("special", new String[]{"name,description"});
mapImportSourceField.put("area", new String[]{"countryname,provincename,cityname,citytwoname,longitude,latitude"});
mapImportSourceField.put("sensitiveword", new String[]{"word,description,wordtype,handleway"});
mapImportSourceFieldName.put("company", new String[]{"分部[必填],部门,分部显示顺序,分部编号,部门显示顺序,部门编号"});
mapImportSourceFieldName.put("jobtitle", new String[]{"岗位简称[必填],岗位全称[必填],岗位编号,所属职务[必填],职务类别[必填],岗位职责,任职资格,备注"});
mapImportSourceFieldName.put("group", new String[]{"类型[必填],名称[必填],成员姓名[必填],成员登录名[必填]"});
mapImportSourceFieldName.put("groupMember", new String[]{"编号,姓名,登录名"});
mapImportSourceFieldName.put("resourcedetial", new String[]{"员工姓名[必填],员工登录名[必填],成员,称谓,工作单位,职务,地址",
"员工姓名[必填],员工登录名[必填],语言,水平,备注",
"员工姓名[必填],员工登录名[必填],学校名称,专业,开始日期,结束日期,学历,详细描述",
"员工姓名[必填],员工登录名[必填],公司名称,开始日期,结束日期,职务,工作描述,离开原因",
"员工姓名[必填],员工登录名[必填],培训名称,开始日期,结束日期,培训单位,备注",
"员工姓名[必填],员工登录名[必填],名称,开始日期,结束日期,颁发单位",
"员工姓名[必填],员工登录名[必填],奖惩名称,奖惩日期,备注"});
mapImportSourceFieldName.put("city", new String[]{"位置信息导入"});
mapImportSourceFieldName.put("location", new String[]{"办公地点简称[必填],办公地点全称[必填],城市[必填],国家,顺序"});
mapImportSourceFieldName.put("special", new String[]{"专业名称[必填],专业描述[必填]"});
mapImportSourceFieldName.put("area", new String[]{"国家[必填],省份,城市,区县,经度,纬度"});
mapImportSourceFieldName.put("sensitiveword", new String[]{"敏感词[必填],详细描述,所属分类[必填],处理方式[必填]"});
}
/**
*
*
* @param request
*/
public List<String> importXls(HttpServletRequest request) {
ImportLogService importLogService = ServiceUtil.getService(ImportLogServiceImpl.class, user);
Map<String, Object> params;
try {
this.user = (User) request.getSession(true).getAttribute("weaver_user@bean");
String filename = request.getParameter("excelfile");
this.importType = Util.null2String(request.getParameter("importType"));
this.keyField = Util.null2String(request.getParameter("keyField"));
this.creator = "" + user.getUID();
this.userLanguage = Util.getIntValue(request.getParameter("userlanguage"), 7);
this.operateType = Util.null2String(request.getParameter("operateType"));
// 常用组导入为覆盖时已经清除掉旧数据的常用组ID集合(暂时只用于常用组的导入)
List<Integer> deletedGroupId = new ArrayList<>();
ImageFileManager manager = new ImageFileManager();
manager.getImageFileInfoById(Util.getIntValue(filename));
HSSFWorkbook workbook = new HSSFWorkbook(new POIFSFileSystem(manager.getInputStream()));
params = ParamUtil.request2Map(request);
Map<String, Object> retmap = importLogService.saveImportLog(params, request, user);
if (Util.null2String(retmap.get("status")).equals("1")) {
this.pId = Util.getIntValue(Util.null2String(retmap.get("pId")));
String pIdName = "hrm" + this.importType + "PId";
request.getSession(true).setAttribute(pIdName, this.pId);
}
String[] tmpMapImportSource = mapImportSource.get(this.importType);
int idx = 0;
for (String tmpImportSource : tmpMapImportSource) {
idx++;
this.sheet = workbook.getSheetAt(idx);
importSourceClass = Class.forName(tmpImportSource);
voFields = mapImportSourceField.get(this.importType)[idx - 1].split(",");
initReflectParam();
/*校验模板有效性 */
if (idx == 1) {
String[] importSourceFieldName = mapImportSourceFieldName.get(this.importType);
String valExcelTempInfo = valExcelTemp(importSourceFieldName[idx - 1]);
if (valExcelTempInfo.length() > 0) {
this.errorInfo.add(valExcelTempInfo);
break;
}
}
readexcel();
String importSourceName;
if (tmpImportSource.equals(HrmFamilyInfo.class.getName())) {
importSourceName = SystemEnv.getHtmlLabelName(814, userLanguage);
} else if (tmpImportSource.equals(HrmLanguageAbility.class.getName())) {
importSourceName = SystemEnv.getHtmlLabelName(815, userLanguage);
} else if (tmpImportSource.equals(HrmEducationInfo.class.getName())) {
importSourceName = SystemEnv.getHtmlLabelName(813, userLanguage);
} else if (tmpImportSource.equals(HrmWorkResume.class.getName())) {
importSourceName = SystemEnv.getHtmlLabelName(15716, userLanguage);
} else if (tmpImportSource.equals(HrmTrainBeforeWork.class.getName())) {
importSourceName = SystemEnv.getHtmlLabelName(15717, userLanguage);
} else if (tmpImportSource.equals(HrmCertification.class.getName())) {
importSourceName = SystemEnv.getHtmlLabelName(1502, userLanguage);
} else if (tmpImportSource.equals(HrmRewardBeforeWork.class.getName())) {
importSourceName = SystemEnv.getHtmlLabelName(15718, userLanguage);
} else {
importSourceName = mapImportSourceName.get(this.importType);
}
Object obj = null;
Method method;
String flag;
String valErrorInfo;
if (lsImportSourceMap.size() == 0) {
this.errorInfo.add("【" + importSourceName + "】" + SystemEnv.getHtmlLabelName(34195, userLanguage) + "");
}
if ("area".equals(importType)) {
//如果是行政区域导入,先删除脏数据
HrmArea.deleteDirtyData();
}
for (int i = 0; i < lsImportSourceMap.size(); i++) {
obj = lsImportSourceMap.get(i);
if (importType.equals("groupMember")) {
String groupId = Util.null2String(request.getParameter("groupid"));
method = importSourceClass.getMethod("setGroupid", String.class);
method.invoke(obj, groupId);
}
method = importSourceClass.getMethod("setUserLanguage", String.class);
method.invoke(obj, "" + userLanguage);
if (this.importType.equals("company")) {
method = importSourceClass.getMethod("setOperateType", String.class);
method.invoke(obj, this.operateType);
}
method = importSourceClass.getMethod("valExcelData");
try {
valErrorInfo = (String) method.invoke(obj);
} catch (Exception e) {
//验证出错返回错误信息
params = new HashMap<>();
params.put("pId", this.pId);
params.put("lineNum", (i + 2));
params.put("relatedName", this.getRelatedName(obj));
params.put("msg", importSourceName + "第" + (i + 2) + "行数据,验证失败!");
params.put("status", "0");
importLogService.saveImportDeitalLog(params, user);
continue;
}
if (valErrorInfo.length() == 0) {
/*如果是常用组的导入,并且导入类型是覆盖,则需要先删除原有的数据*/
if (this.importType.equals("group") && this.operateType.equals("cover")) {
method = importSourceClass.getMethod("setOperateType", String.class);
method.invoke(obj, this.operateType);
method = importSourceClass.getMethod("getId");
int temp = (int) method.invoke(obj);
if (!deletedGroupId.contains(temp)) {
method = importSourceClass.getMethod("deleteOldData");
method.invoke(obj);
deletedGroupId.add(temp);
}
} else if (this.importType.equals("groupMember") && this.operateType.equals("cover")) {
/*如果是常用组成员的导入,并且导入类型是覆盖,则需要先删除原有的数据*/
method = importSourceClass.getMethod("setOperateType", String.class);
method.invoke(obj, this.operateType);
if (!this.isDeleted) {
method = importSourceClass.getMethod("deleteOldData");
method.invoke(obj);
this.isDeleted = true;
}
}
method = importSourceClass.getMethod("save");
flag = (String) method.invoke(obj);
params = new HashMap<>();
params.put("pId", this.pId);
params.put("lineNum", (i + 2));
params.put("relatedName", this.getRelatedName(obj));
String msg = importSourceName + "第" + (i + 2) + "行数据," + this.getRelatedName(obj);
if (this.importType.equals("company")) {
method = importSourceClass.getMethod("getMessage");
msg += (String) method.invoke(obj);
}
params.put("msg", flag.equals("true") ? msg + "导入成功" : msg + "导入失败");
params.put("status", flag.equals("true") ? "1" : "0");
importLogService.saveImportDeitalLog(params, user);
} else {
//验证出错返回错误信息
params = new HashMap<>();
params.put("pId", this.pId);
params.put("lineNum", (i + 2));
params.put("relatedName", this.getRelatedName(obj));
params.put("msg", importSourceName + "第" + (i + 2) + "行数据," + valErrorInfo);
params.put("status", "0");
importLogService.saveImportDeitalLog(params, user);
}
}
//加载缓存
method = importSourceClass.getMethod("removeCache");
if (obj != null) method.invoke(obj);
if (!this.importType.equals("resourcedetial")) {
params = new HashMap<>();
params.put("pId", this.pId);
params.put("status", "over");
importLogService.saveImportLogStatus(params, user);
}
}
if (this.importType.equals("resourcedetial")) {
//导入基本信息自定义明细字段
HrmResourceDefineDetialE9 HrmResourceDefineDetialE9 = new HrmResourceDefineDetialE9();
HrmResourceDefineDetialE9.importXls(workbook, this.pId, user);
params = new HashMap<>();
params.put("pId", this.pId);
params.put("status", "over");
importLogService.saveImportLogStatus(params, user);
}
} catch (FileNotFoundException e) {
params = new HashMap<>();
params.put("pId", this.pId);
params.put("status", "error");
importLogService.saveImportLogStatus(params, user);
} catch (IOException e) {
this.errorInfo.add(SystemEnv.getHtmlLabelName(83618, userLanguage));
new BaseBean().writeLog(e);
params = new HashMap<>();
params.put("pId", this.pId);
params.put("status", "error");
importLogService.saveImportLogStatus(params, user);
} catch (IndexOutOfBoundsException e) {
new BaseBean().writeLog("岗位导入的报错1。。。。");
this.errorInfo.add(SystemEnv.getHtmlLabelName(125871, userLanguage));
new BaseBean().writeLog(e);
params = new HashMap<>();
params.put("pId", this.pId);
params.put("status", "error");
importLogService.saveImportLogStatus(params, user);
} catch (Exception e) {
new BaseBean().writeLog("岗位导入的报错2。。。。");
new BaseBean().writeLog(e);
this.errorInfo.add(SystemEnv.getHtmlLabelName(125871, userLanguage));
params = new HashMap<>();
params.put("pId", this.pId);
params.put("status", "error");
importLogService.saveImportLogStatus(params, user);
}
return this.errorInfo;
}
/**
*
*
* @param importSourceFieldName
*/
public String valExcelTemp(String importSourceFieldName) {
String valExcelTempInfo = "";
HSSFRow row;
HSSFCell cell;
String cellValue;
try {
String[] fieldname = importSourceFieldName.split(",");
if (this.importType.equals("group")) {
if (this.keyField.equals("workcode")) {
fieldname[3] = "成员编号[必填]";
}
}
row = sheet.getRow(0);
for (int cellIndex = 0; cellIndex < row.getLastCellNum(); cellIndex++) {
cell = row.getCell((short) cellIndex);
if (cell == null) continue;
cellValue = getCellValue(cell).trim();
if (!fieldname[cellIndex].equals(cellValue)) {
valExcelTempInfo = SystemEnv.getHtmlLabelName(387156, user.getLanguage());
break;
}
}
} catch (Exception e) {
new BaseBean().writeLog(e);
valExcelTempInfo = SystemEnv.getHtmlLabelName(387156, user.getLanguage()) + "1";
}
return valExcelTempInfo;
}
/**
* excel
*/
public void readexcel() {
try {
HSSFRow row;
HSSFCell cell;
String cellValue;
// 行号
// 列号
int firstRow = 1;
lsImportSourceMap.clear();
int lastRow = sheet.getLastRowNum();
for (int i = firstRow; i <= lastRow; i++) {
row = sheet.getRow(i);
if (row == null) {
errorInfo.add(SystemEnv.getHtmlLabelName(15323, userLanguage) + " " + (i + 1) + " " + SystemEnv.getHtmlLabelName(83622, userLanguage));
continue;
}
Object obj = importSourceClass.newInstance();
for (int cellIndex = 0; cellIndex < row.getLastCellNum(); cellIndex++) {
cell = row.getCell((short) cellIndex);
if (cell == null) continue;
cellValue = getCellValue(cell).trim();
setImportSourceValue(cellIndex, cellValue, obj, null);
}
switch (this.importType) {
case "group":
((HrmGroup) obj).setKeyField(this.keyField);
((HrmGroup) obj).setOwner(this.creator);
((HrmGroup) obj).setOperateType(this.operateType);
break;
case "groupMember":
((HrmGroupMember) obj).setKeyField(this.keyField);
break;
case "sensitiveword":
((SensitiveWord) obj).setCreater(this.creator);
break;
}
lsImportSourceMap.add(obj);
}
} catch (Exception e) {
new BaseBean().writeLog(e);
}
}
/**
* excel
*
* @param cell
*/
public String getCellValue(HSSFCell cell) {
String cellValue = "";
if (cell == null)
return "";
switch (cell.getCellType()) {
case BOOLEAN: // 得到Boolean对象的方法
cellValue = String.valueOf(cell.getBooleanCellValue());
break;
case NUMERIC:
cellValue = getString(HSSFDateUtil.isCellDateFormatted(cell), cell.getDateCellValue(), cell.getNumericCellValue());
break;
case FORMULA: // 读取公式
cellValue = cell.getCellFormula();
break;
case STRING: // 读取String
cellValue = cell.getStringCellValue();
break;
}
cellValue = Util.toHtmlForHrm(cellValue);
return cellValue;
}
@NotNull
public static String getString(boolean cellDateFormatted, Date dateCellValue, double numericCellValue) {
String cellValue;
if (cellDateFormatted) {// 先看是否是日期格式
SimpleDateFormat sft = new SimpleDateFormat("yyyy-MM-dd");
cellValue = sft.format(dateCellValue); // 读取日期格式
} else {
cellValue = String.valueOf(new Double(numericCellValue)); // 读取数字
if (cellValue.endsWith(".0"))
cellValue = cellValue.substring(0, cellValue.indexOf("."));
}
return cellValue;
}
/**
*
*
* @param cellNum
* @param cellValue
* @param importSourceObj
*/
public void setImportSourceValue(int cellNum, String cellValue, Object importSourceObj, String field) {
if (field == null) {
String excelField = voFields[cellNum];
String methodName = "set" + excelField.substring(0, 1).toUpperCase() + excelField.substring(1);
Method method = parameterTypes.get(methodName);
try {
String fieldType = fieldTypes.get(excelField);
if (fieldType.equals("java.lang.String"))
method.invoke(importSourceObj, cellValue);
else if (fieldType.equals("java.lang.Integer") && !cellValue.equals("")) {
method.invoke(importSourceObj, Integer.parseInt(cellValue));
} else if (fieldType.equals("java.lang.Float") && !cellValue.equals(""))
method.invoke(importSourceObj, Float.parseFloat(cellValue));
else if (fieldType.equals("java.lang.Short") && !cellValue.equals("")) {
method.invoke(importSourceObj, Short.parseShort(cellValue));
}
} catch (Exception e) {
new BaseBean().writeLog(e);
}
} else {
String methodName = "set" + field.substring(0, 1).toUpperCase() + field.substring(1);
Method method = parameterTypes.get(methodName);
try {
method.invoke(importSourceObj, cellValue);
} catch (Exception e) {
new BaseBean().writeLog(e);
}
}
}
/**
* MapparameterTypesfieldTypes
*/
public void initReflectParam() {
try {
parameterTypes.clear();
fieldTypes.clear();
Method[] hrmResourceMethods = importSourceClass.getDeclaredMethods();
for (Method hrmResourceMethod : hrmResourceMethods) {
parameterTypes.put(hrmResourceMethod.getName(), hrmResourceMethod);
}
Field[] importSourceFields = importSourceClass.getDeclaredFields();
for (Field importSourceField : importSourceFields) {
Class<?> fieldTypeClass = importSourceField.getType();
if (fieldTypeClass == Integer.TYPE) {
fieldTypeClass = Integer.class;
}
fieldTypes.put(importSourceField.getName(), fieldTypeClass.getName());
}
} catch (Exception e) {
new BaseBean().writeLog(e);
}
}
private String getRelatedName(Object obj) {
String relatedName = "";
try {
switch (this.importType) {
case "company": {
Method method = importSourceClass.getMethod("getSubcompanyname");
relatedName = Util.null2String(method.invoke(obj));
method = importSourceClass.getMethod("getDepartmentname");
String departmentname = Util.null2String(method.invoke(obj));
if (departmentname.length() > 0) {
relatedName += ">";
}
relatedName += departmentname;
break;
}
case "loaction": {
Method method = importSourceClass.getMethod("getLocationname");
relatedName = Util.null2String(method.invoke(obj));
break;
}
case "jobtitle": {
Method method = importSourceClass.getMethod("setJobtitlemark");
relatedName = Util.null2String(method.invoke(obj));
break;
}
case "group": {
Method method = importSourceClass.getMethod("getGroupname");
relatedName = Util.null2String(method.invoke(obj));
break;
}
case "city":
case "special": {
Method method = importSourceClass.getMethod("getName");
relatedName = Util.null2String(method.invoke(obj));
break;
}
case "area": {
Method method = importSourceClass.getMethod("getCountryname");
relatedName = Util.null2String(method.invoke(obj));
break;
}
case "resourcedetial": {
Method method = importSourceClass.getMethod("getLastname");
relatedName = Util.null2String(method.invoke(obj));
break;
}
case "sensitiveword": {
Method method = importSourceClass.getMethod("getWord");
relatedName = Util.null2String(method.invoke(obj));
break;
}
}
} catch (Exception e) {
new BaseBean().writeLog(e);
}
return relatedName;
}
}

@ -28,19 +28,6 @@ public class ImportCommonController {
return ServiceUtil.getService(ImportCommonWrapper.class, user);
}
@POST
@Path("/saveImportResource")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult saveImportResource(@Context HttpServletRequest request, @Context HttpServletResponse response) {
try {
User user = HrmUserVarify.getUser(request, response);
Map<String, Object> map = ParamUtil.request2Map(request);
return ReturnResult.successed(getImportCommonWrapper(user).saveImportResource(map, request));
} catch (Exception e) {
return ReturnResult.exceptionHandle(e);
}
}
@GET
@Path("/getImportFields")
@Produces(MediaType.APPLICATION_JSON)

@ -20,10 +20,6 @@ public class ImportCommonWrapper extends Service {
return ServiceUtil.getService(ImportCommonServiceImpl.class, user);
}
public Map<String, Object> saveImportResource(Map<String, Object> params, HttpServletRequest request) {
return getImportCommonService(user).saveImportResource(params, request);
}
/**
*

Loading…
Cancel
Save