!174 人员导入、CusFieldData触发器调整

Merge pull request !174 from dxfeng/feature/dxf
pull/175/MERGE
dxfeng 3 years ago committed by Gitee
commit 5a9a64f93a
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

@ -0,0 +1,66 @@
package com.engine.organization.entity.cusfielddata.po;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author:dxfeng
* @createTime: 2022/08/01
* @version: 1.0
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class CusFieldData {
private Integer seqOrder;
private String scope;
private Long scopeId;
private Long id;
/**
*
*/
private String field100001;
/**
* id
*/
private String field100002;
/**
* id
*/
private String field100003;
/**
* 线
*/
private String field100004;
/**
*
*/
private String field100005;
/**
*
*/
private String field100006;
/**
*
*/
private String field100007;
/**
*
*/
private String field100008;
/**
*
*/
private String field100009;
/**
*
*/
private String field100010;
private String field100011;
private String field100012;
private String field100013;
private String field100014;
}

@ -2,6 +2,7 @@ package com.engine.organization.mapper.hrmresource;
import com.alibaba.fastjson.JSONObject;
import com.engine.organization.entity.cusfielddata.po.CusFieldData;
import com.engine.organization.entity.jclimport.po.CusFormFieldPO;
import com.engine.organization.entity.jclimport.po.JclSelectItem;
import org.apache.ibatis.annotations.Param;
@ -65,4 +66,11 @@ public interface SystemDataMapper {
List<JclSelectItem> getSelectItems(@Param("tableName") String tableName, @Param("fieldId") Long fieldId);
CusFieldData getHrmCusFieldDataByIdAndScopeId(@Param("id") Long id, @Param("scopeId") Long scopeId);
int insertCusFieldData(CusFieldData cusFieldData);
int updateCusFieldData(CusFieldData cusFieldData);
}

@ -18,6 +18,10 @@
<result column="selectvalue" property="selectValue"/>
<result column="selectname" property="selectName"/>
</resultMap>
<insert id="insertCusFieldData">
insert into cus_fielddata(scope, scopeid, id)
values ('HrmCustomFieldByInfoType', #{scopeId}, #{id})
</insert>
<update id="updateResourceJobTitleByIds">
update hrmresource set JOBTITLE = #{jobTitle} where id in
@ -25,6 +29,20 @@
#{id}
</foreach>
</update>
<update id="updateCusFieldData">
update cus_fielddata
<set>
field100008=#{field100008},
field100006=#{field100006},
field100007=#{field100007},
field100005=#{field100005},
field100010=#{field100010},
field100009=#{field100009},
</set>
where scope = 'HrmCustomFieldByInfoType'
and id = #{id}
and scopeid = #{scopeId}
</update>
<select id="getSysLanguageByLicense" resultType="com.alibaba.fastjson.JSONObject">
select multilanguage, (select id from syslanguage where language='简体中文' or language='中文') as cnLanguageId
@ -141,6 +159,14 @@
</foreach>
order by groupid ,fieldorder
</select>
<select id="getHrmCusFieldDataByIdAndScopeId"
resultType="com.engine.organization.entity.cusfielddata.po.CusFieldData">
select *
from cus_fielddata
where scope = 'HrmCustomFieldByInfoType'
and scopeid = #{scopeId}
and id = #{id}
</select>
</mapper>

@ -7,6 +7,8 @@
<result column="job_name" property="jobName"/>
<result column="parent_comp" property="parentComp"/>
<result column="parent_dept" property="parentDept"/>
<result column="ec_company" property="ecCompany"/>
<result column="ec_department" property="ecDepartment"/>
<result column="sequence_id" property="sequenceId"/>
<result column="scheme_id" property="schemeId"/>
<result column="parent_job" property="parentJob"/>
@ -33,6 +35,8 @@
t.job_name,
t.parent_comp,
t.parent_dept,
t.ec_company,
t.ec_department,
t.sequence_id,
t.scheme_id,
t.parent_job,

@ -87,4 +87,8 @@ public interface GradeMapper {
@MapKey("id")
List<Map<String, Object>> listGradessByIds(@Param("ids") Collection<Long> ids);
GradePO getGradeByLevelId(@Param("levelId") long levelId);
}

@ -175,4 +175,21 @@
</foreach>
</update>
<select id="getGradeByLevelId" resultType="com.engine.organization.entity.scheme.po.GradePO">
select
<include refid="baseColumns"/>
from jcl_org_grade t where
<include refid="likeSQL"/>
</select>
<sql id="likeSQL">
concat(',', level_id, ',') like concat('%,', cast(#{levelId} as CHAR), ',%')
</sql>
<sql id="likeSQL" databaseId="oracle">
','||level_id||',' like '%,'||#{levelId}+',%'
</sql>
<sql id="likeSQL" databaseId="sqlserver">
','+level_id+',' like '%,'+cast(#{levelId} as varchar(20))+',%'
</sql>
</mapper>

@ -34,6 +34,7 @@ public interface SequenceMapper {
/**
* ID
*
* @param id
* @return
*/
@ -46,10 +47,11 @@ public interface SequenceMapper {
* @return
*/
@MapKey("id")
List<Map<String,Object>> listSequencesByIds(@Param("ids") Collection<Long> ids);
List<Map<String, Object>> listSequencesByIds(@Param("ids") Collection<Long> ids);
/**
*
*
* @param sequencePO
* @return
*/
@ -80,10 +82,13 @@ public interface SequenceMapper {
/**
*
*
* @param tag
* @return
*/
int getCountByTag(@Param("tag") int tag);
List<SequencePO> getSequencesByIds(@Param("ids") Collection<Long> ids);
SequencePO getSequenceBySchemeId(@Param("schemeId") Long schemeId);
}

@ -74,6 +74,11 @@
#{id}
</foreach>
</select>
<select id="getSequenceBySchemeId" resultType="com.engine.organization.entity.sequence.po.SequencePO">
select
<include refid="baseColumns"/>
from jcl_org_sequence t where scheme_id = #{schemeId}
</select>
<update id="updateSequence" parameterType="com.engine.organization.entity.sequence.po.SequencePO">
update jcl_org_sequence

@ -0,0 +1,109 @@
package com.engine.organization.trigger.cusfielddata;
import com.alibaba.fastjson.JSONObject;
import com.engine.organization.entity.cusfielddata.po.CusFieldData;
import com.engine.organization.entity.extend.param.ExtendInfoParams;
import com.engine.organization.entity.job.po.JobPO;
import com.engine.organization.entity.postion.po.PostInfoPO;
import com.engine.organization.entity.postion.po.PostPO;
import com.engine.organization.entity.scheme.po.GradePO;
import com.engine.organization.entity.scheme.po.LevelPO;
import com.engine.organization.entity.scheme.po.SchemePO;
import com.engine.organization.mapper.extend.ExtMapper;
import com.engine.organization.mapper.hrmresource.SystemDataMapper;
import com.engine.organization.mapper.job.JobMapper;
import com.engine.organization.mapper.post.PostInfoMapper;
import com.engine.organization.mapper.post.PostMapper;
import com.engine.organization.mapper.scheme.GradeMapper;
import com.engine.organization.mapper.scheme.LevelMapper;
import com.engine.organization.mapper.scheme.SchemeMapper;
import com.engine.organization.mapper.sequence.SequenceMapper;
import com.engine.organization.util.db.MapperProxyFactory;
import java.util.HashMap;
import java.util.Map;
/**
* @author:dxfeng
* @createTime: 2022/08/01
* @version: 1.0
*/
public class CusFieldDataTrigger {
public static void run(Long id) {
boolean updateFlag = false;
// 查询当前操作的数据
CusFieldData sourceData = MapperProxyFactory.getProxy(SystemDataMapper.class).getHrmCusFieldDataByIdAndScopeId(id, -1L);
String sourceField100001 = sourceData.getField100001();
String sourceField100002 = sourceData.getField100002();
String sourceField100003 = sourceData.getField100003();
// 查询需要更新的数据,没有则创建数据
CusFieldData directionData = MapperProxyFactory.getProxy(SystemDataMapper.class).getHrmCusFieldDataByIdAndScopeId(id, 3L);
if (null == directionData) {
directionData = new CusFieldData();
directionData.setScope("HrmCustomFieldByInfoType");
directionData.setScopeId(3L);
directionData.setId(id);
MapperProxyFactory.getProxy(SystemDataMapper.class).insertCusFieldData(directionData);
}
// field100001更新
if (null != sourceField100001 && sourceField100001.split("_").length == 2 && !sourceField100001.equals(directionData.getField100001())) {
String[] field100001Array = sourceField100001.split("_");
// 职等
long zdId = Long.parseLong(field100001Array[1]);
if (zdId > 1000) {
zdId = zdId - 1000;
}
LevelPO levelByID = MapperProxyFactory.getProxy(LevelMapper.class).getLevelByID(zdId);
directionData.setField100008(levelByID.getLevelName());
// 职等职级方案
SchemePO schemeByID = MapperProxyFactory.getProxy(SchemeMapper.class).getSchemeByID(levelByID.getSchemeId());
directionData.setField100006(schemeByID.getSchemeName());
// 职级
GradePO gradeByLevelId = MapperProxyFactory.getProxy(GradeMapper.class).getGradeByLevelId(zdId);
directionData.setField100007(gradeByLevelId.getGradeName());
MapperProxyFactory.getProxy(SequenceMapper.class).getSequenceBySchemeId(schemeByID.getId());
updateFlag = true;
}
// field100002更新
if (null != sourceField100002 && sourceField100002.split("_").length == 2 && !sourceField100002.equals(directionData.getField100002())) {
String[] field100002Array = sourceField100002.split("_");
Long gwId = Long.parseLong(field100002Array[1]);
JobPO jobById = MapperProxyFactory.getProxy(JobMapper.class).getJobById(gwId);
JSONObject hrmJobTitleByName = MapperProxyFactory.getProxy(SystemDataMapper.class).getHrmJobTitleByName(jobById.getJobName());
Long ecGwId = hrmJobTitleByName.getLong("id");
Long ecBmId = jobById.getEcDepartment();
Long ecGsId = jobById.getEcCompany();
Map<String, Object> hrmResourceMap = new HashMap<>();
// 岗位
hrmResourceMap.put("jobtitle", ecGwId);
// 部门
hrmResourceMap.put("departmentid", ecBmId);
// 公司
hrmResourceMap.put("subcompanyid1", ecGsId);
MapperProxyFactory.getProxy(ExtMapper.class).updateExt(ExtendInfoParams.builder().id(id).tableName("").params(hrmResourceMap).build());
updateFlag = true;
}
if (null != sourceField100003 && sourceField100003.split("_").length == 2 && !sourceField100003.equals(directionData.getField100003())) {
String[] field100003Array = sourceField100003.split("_");
long zwId = Long.parseLong(field100003Array[1]);
// 职务
PostInfoPO postInfoByID = MapperProxyFactory.getProxy(PostInfoMapper.class).getPostInfoByID(zwId);
directionData.setField100010(postInfoByID.getPostInfoName());
// 职务分类
PostPO postByID = MapperProxyFactory.getProxy(PostMapper.class).getPostByID(postInfoByID.getPostId());
directionData.setField100009(postByID.getPostName());
updateFlag = true;
}
// 更新数据
if (updateFlag) {
MapperProxyFactory.getProxy(SystemDataMapper.class).updateCusFieldData(directionData);
}
}
}

@ -421,10 +421,6 @@ public class HrmImportAdaptExcelE9 extends BaseBean implements IHrmImportAdapt {
fieldIndex = fieldsMap.get(cellNum);
// if (cell == null && !(Util.null2String(voFields[fieldIndex]).trim()).startsWith("field")) {
//
// continue;
// }
cellValue = getCellValue(cell).trim();
@ -1193,6 +1189,11 @@ public class HrmImportAdaptExcelE9 extends BaseBean implements IHrmImportAdapt {
if (cellValue.endsWith(".0"))
cellValue = cellValue.substring(0, cellValue.indexOf("."));
}
// 处理科学计数法
if (cellValue.contains("E")) {
cell.setCellType(CellType.STRING);
cellValue = cell.getStringCellValue();
}
break;
case FORMULA: //读取公式
cellValue = cell.getCellFormula();

@ -14,6 +14,7 @@ import com.engine.organization.entity.jclimport.po.JclImportHistoryDetailPO;
import com.engine.organization.entity.jclimport.po.JclImportHistoryPO;
import com.engine.organization.mapper.jclimport.JclImportHistoryDetailMapper;
import com.engine.organization.mapper.jclimport.JclImportHistoryMapper;
import com.engine.organization.trigger.cusfielddata.CusFieldDataTrigger;
import com.engine.organization.util.db.MapperProxyFactory;
import com.weaver.integration.ldap.sync.oa.OaSync;
import com.weaver.integration.ldap.util.AuthenticUtil;
@ -1586,7 +1587,10 @@ public class HrmImportProcessE9 extends BaseBean {
writeLog(e);
}
recordSet.setNoAutoEncrypt(true);
return recordSet.execute(sql);
boolean execute = recordSet.execute(sql);
// 更新聚才林相关字段
new CusFieldDataTrigger().run((long) id);
return execute;
}
@ -1666,7 +1670,14 @@ public class HrmImportProcessE9 extends BaseBean {
writeLog(e);
}
recordSet.setNoAutoEncrypt(true);
return (flag && !recordSet.execute(sql));
if (flag) {
boolean execute = recordSet.execute(sql);
// 更新聚才林相关字段
new CusFieldDataTrigger().run((long) id);
return !execute;
} else {
return false;
}
}

Loading…
Cancel
Save