2022-12-16 13:53:47 +08:00
package com.engine.organization.service.impl ;
import com.engine.core.impl.Service ;
import com.engine.organization.service.JclOrgService ;
2022-12-20 16:52:36 +08:00
import com.engine.organization.util.field.StaticFieldName ;
2022-12-16 13:53:47 +08:00
import org.apache.commons.lang3.StringUtils ;
import weaver.conn.RecordSet ;
/ * *
* @author : dxfeng
* @createTime : 2022 / 12 / 16
* @version : 1 . 0
* /
public class JclOrgServiceImpl extends Service implements JclOrgService {
@Override
public void supplementResourceInfo ( Integer userId ) {
// 查询职等职级字段
RecordSet rs = new RecordSet ( ) ;
// 所有字段信息存在,执行业务逻辑
2022-12-20 16:52:36 +08:00
if ( StringUtils . isNoneBlank ( StaticFieldName . zdzjFieldName , StaticFieldName . schemeFieldName , StaticFieldName . levelFieldName , StaticFieldName . gradeFieldName , StaticFieldName . sequenceFieldName ) ) {
2022-12-16 13:53:47 +08:00
String zdzjFieldValue = " " ;
String schemeFieldValue = " " ;
String levelFieldValue = " " ;
String gradeFieldValue = " " ;
String sequenceFieldValue = " " ;
2022-12-20 16:52:36 +08:00
String sql = " select " + StaticFieldName . zdzjFieldName + " from cus_fielddata where scope='HrmCustomFieldByInfoType' and scopeid=3 and id= " + userId ;
2022-12-16 13:53:47 +08:00
rs . execute ( sql ) ;
if ( rs . next ( ) ) {
2022-12-20 16:52:36 +08:00
zdzjFieldValue = rs . getString ( StaticFieldName . zdzjFieldName ) ;
2022-12-16 13:53:47 +08:00
}
2022-12-16 14:24:40 +08:00
// 职等职级为空时不处理
if ( StringUtils . isBlank ( zdzjFieldValue ) ) {
return ;
}
2022-12-16 13:53:47 +08:00
sql = " select xlid, zjid, zdid from v_jcl_zdzjs where fid=' " + zdzjFieldValue . substring ( zdzjFieldValue . indexOf ( " _ " ) + 1 ) + " ' " ;
rs . execute ( sql ) ;
if ( rs . next ( ) ) {
2022-12-20 16:52:36 +08:00
levelFieldValue = rs . getString ( " zdid " ) ;
gradeFieldValue = rs . getString ( " zjid " ) ;
2022-12-16 13:53:47 +08:00
sequenceFieldValue = rs . getString ( " xlid " ) ;
}
sql = " select scheme_id from jcl_org_sequence where id=' " + sequenceFieldValue + " ' " ;
rs . execute ( sql ) ;
if ( rs . next ( ) ) {
schemeFieldValue = rs . getString ( " scheme_id " ) ;
}
// 更新字段信息
2022-12-20 16:52:36 +08:00
sql = " update cus_fielddata set " + StaticFieldName . sequenceFieldName + " = ' " + sequenceFieldValue + " ' where scope='HrmCustomFieldByInfoType' and scopeid=3 and id= " + userId ;
2022-12-16 13:53:47 +08:00
rs . execute ( sql ) ;
2022-12-20 16:52:36 +08:00
sql = " update cus_fielddata set " + StaticFieldName . schemeFieldName + " = ' " + schemeFieldValue + " ' where scope='HrmCustomFieldByInfoType' and scopeid=3 and id= " + userId ;
2022-12-16 13:53:47 +08:00
rs . execute ( sql ) ;
2022-12-20 16:52:36 +08:00
sql = " update cus_fielddata set " + StaticFieldName . levelFieldName + " = ' " + levelFieldValue + " ' where scope='HrmCustomFieldByInfoType' and scopeid=3 and id= " + userId ;
2022-12-16 13:53:47 +08:00
rs . execute ( sql ) ;
2022-12-20 16:52:36 +08:00
sql = " update cus_fielddata set " + StaticFieldName . gradeFieldName + " = ' " + gradeFieldValue + " ' where scope='HrmCustomFieldByInfoType' and scopeid=3 and id= " + userId ;
2022-12-16 13:53:47 +08:00
rs . execute ( sql ) ;
}
}
}