package com.engine.wysecond.service.impl ;
import com.engine.core.impl.Service ;
import com.engine.wysecond.entity.resume.* ;
import com.engine.wysecond.service.PersonnelResumeService ;
import com.engine.wysecond.util.FieldTransUtils ;
import lombok.SneakyThrows ;
import weaver.conn.RecordSet ;
import weaver.general.Util ;
import weaver.hrm.company.DepartmentComInfo ;
import weaver.hrm.job.EducationLevelComInfo ;
import weaver.hrm.job.JobTitlesComInfo ;
import java.util.* ;
/ * *
* @Author liang . cheng
* @Date 2025 / 2 / 17 14 : 41
* @Description :
* @Version 1.0
* /
public class PersonnelResumeServiceImpl extends Service implements PersonnelResumeService {
@Override
public Map < String , Object > getResumeList ( String resourceId ) {
Map < String , Object > resultMap = new HashMap < > ( 8 ) ;
PersonnelResumePo personnelResumePo = peopleMainInfo ( resourceId ) ;
resultMap . put ( "workcode" , personnelResumePo . getWorkcode ( ) ) ;
resultMap . put ( "lastName" , personnelResumePo . getLastName ( ) ) ;
resultMap . put ( "sex" , personnelResumePo . getSex ( ) ) ;
resultMap . put ( "birthday" , personnelResumePo . getBirthday ( ) ) ;
resultMap . put ( "resourceImageId" , personnelResumePo . getImage ( ) ) ;
resultMap . put ( "nation" , personnelResumePo . getNation ( ) ) ;
resultMap . put ( "nativePlace" , personnelResumePo . getNativePlace ( ) ) ;
resultMap . put ( "companyStartDate" , personnelResumePo . getCompanyStartDate ( ) ) ;
resultMap . put ( "joinPartyDate" , personnelResumePo . getJoinPartyDate ( ) ) ;
resultMap . put ( "workStartDate" , personnelResumePo . getWorkStartDate ( ) ) ;
resultMap . put ( "highPersonType" , personnelResumePo . getHighPersonType ( ) ) ;
resultMap . put ( "jobCall" , personnelResumePo . getJobCall ( ) ) ;
resultMap . put ( "department" , personnelResumePo . getDepartment ( ) ) ;
resultMap . put ( "jobTitle" , personnelResumePo . getJobTitle ( ) ) ;
resultMap . put ( "postionLevel" , personnelResumePo . getPostionLevel ( ) ) ;
resultMap . put ( "fullHighEducational" , personnelResumePo . getFullHighEducational ( ) ) ;
resultMap . put ( "fullHighMajor" , personnelResumePo . getFullHighMajor ( ) ) ;
resultMap . put ( "fullHighSchool" , personnelResumePo . getFullHighSchool ( ) ) ;
resultMap . put ( "fullHighDegree" , personnelResumePo . getFullHighDegree ( ) ) ;
resultMap . put ( "policy" , personnelResumePo . getPolicy ( ) ) ;
resultMap . put ( "position" , personnelResumePo . getPosition ( ) ) ;
resultMap . put ( "notfullHighEducational" , personnelResumePo . getNotfullHighEducational ( ) ) ;
resultMap . put ( "notfullHighMajor" , personnelResumePo . getNotfullHighMajor ( ) ) ;
resultMap . put ( "notfullHighSchool" , personnelResumePo . getNotfullHighSchool ( ) ) ;
resultMap . put ( "notfullHighDegree" , personnelResumePo . getNotfullHighDegree ( ) ) ;
//表格拓展
resultMap . put ( "tables" , peopleDetailInfo ( resourceId ) ) ;
return resultMap ;
}
@Override
public List < PersonnelResumeTable > peopleDetailInfo ( String resourceId ) {
List < PersonnelResumeTable > tables = new ArrayList < > ( ) ;
List < PersonnelResumeTd > columns = new ArrayList < > ( ) ;
List < List < PersonnelResumeTd > > datas = new ArrayList < > ( ) ;
//1.教育和工作经历经历
LinkedList < EducationOrWorkInfo > educationInfos = selectEducationOrWorkInfo ( resourceId ) ;
//按照起始时间排序
educationInfos . sort ( Comparator . comparing ( EducationOrWorkInfo : : getStartDate ) ) ;
//增加空行
//educationInfos.add(EducationOrWorkInfo.builder().build());
for ( EducationOrWorkInfo educationInfo : educationInfos ) {
List < PersonnelResumeTd > educTr = new ArrayList < > ( ) ;
educTr . add ( PersonnelResumeTd . builder ( ) . colspans ( 2 ) . value ( educationInfo . getStartAndEndDate ( ) ) . rowspans ( 1 ) . build ( ) ) ;
educTr . add ( PersonnelResumeTd . builder ( ) . colspans ( 2 ) . value ( educationInfo . getAddress ( ) ) . rowspans ( 1 ) . build ( ) ) ;
educTr . add ( PersonnelResumeTd . builder ( ) . colspans ( 1 ) . value ( educationInfo . getContent ( ) ) . rowspans ( 1 ) . build ( ) ) ;
educTr . add ( PersonnelResumeTd . builder ( ) . colspans ( 2 ) . value ( educationInfo . getLevel ( ) ) . rowspans ( 1 ) . build ( ) ) ;
datas . add ( educTr ) ;
}
columns . add ( PersonnelResumeTd . builder ( ) . colspans ( 1 ) . value ( "简历" ) . rowspans ( educationInfos . size ( ) + 1 ) . build ( ) ) ;
columns . add ( PersonnelResumeTd . builder ( ) . colspans ( 2 ) . value ( "起始时间-结束时间" ) . rowspans ( 1 ) . build ( ) ) ;
columns . add ( PersonnelResumeTd . builder ( ) . colspans ( 2 ) . value ( "单位/学校(从高中毕业后开始填写)" ) . rowspans ( 1 ) . build ( ) ) ;
columns . add ( PersonnelResumeTd . builder ( ) . colspans ( 1 ) . value ( "岗位/专业" ) . rowspans ( 1 ) . build ( ) ) ;
columns . add ( PersonnelResumeTd . builder ( ) . colspans ( 2 ) . value ( "业务职务层级/学历" ) . rowspans ( 1 ) . build ( ) ) ;
tables . add ( PersonnelResumeTable . builder ( ) . columns ( columns ) . datas ( datas ) . build ( ) ) ;
return tables ;
}
private LinkedList < EducationOrWorkInfo > selectEducationOrWorkInfo ( String resourceId ) {
RecordSet rs = new RecordSet ( ) ;
LinkedList < EducationOrWorkInfo > educationOrWorkInfos = new LinkedList < > ( ) ;
//教育经历
rs . executeQuery ( "select rxsj,bysj,byyx,xxzy,xl1 from uf_jxjl where xm = ?" , resourceId ) ;
EducationLevelComInfo educ = new EducationLevelComInfo ( ) ;
while ( rs . next ( ) ) {
String date = Util . null2String ( rs . getString ( "rxsj" ) ) + " - " + Util . null2String ( rs . getString ( "bysj" ) ) ;
educationOrWorkInfos . add ( EducationOrWorkInfo . builder ( )
. startDate ( Util . null2String ( rs . getString ( "rxsj" ) ) )
. startAndEndDate ( date )
. address ( Util . null2String ( rs . getString ( "byyx" ) ) )
. content ( Util . null2String ( rs . getString ( "xxzy" ) ) )
. level ( educ . getEducationLevelname ( Util . null2String ( rs . getString ( "xl1" ) ) ) )
. build ( ) ) ;
}
//工作经历
rs . executeQuery ( "select qssj,zzsj,lldw,rzgw,zwzwdj from uf_gzjj where xm = ?" , resourceId ) ;
while ( rs . next ( ) ) {
String date = Util . null2String ( rs . getString ( "qssj" ) ) + " - " + Util . null2String ( rs . getString ( "zzsj" ) ) ;
educationOrWorkInfos . add ( EducationOrWorkInfo . builder ( )
. startDate ( Util . null2String ( rs . getString ( "qssj" ) ) )
. startAndEndDate ( date )
. address ( Util . null2String ( rs . getString ( "lldw" ) ) )
. content ( Util . null2String ( rs . getString ( "rzgw" ) ) )
. level ( Util . null2String ( rs . getString ( "zwzwdj" ) ) )
. build ( ) ) ;
}
return educationOrWorkInfos ;
}
@SneakyThrows
@Override
public PersonnelResumePo peopleMainInfo ( String resourceId ) {
RecordSet rs = new RecordSet ( ) ;
String nation = rs . getPropValue ( "wysecond" , "nation" ) ;
String joinPartyDate = rs . getPropValue ( "wysecond" , "joinPartyDate" ) ;
String workStartDate = rs . getPropValue ( "wysecond" , "workStartDate" ) ;
String highPersonType = rs . getPropValue ( "wysecond" , "highPersonType" ) ;
String jobCall = rs . getPropValue ( "wysecond" , "jobCall" ) ;
String postion = rs . getPropValue ( "wysecond" , "postion" ) ;
String position = rs . getPropValue ( "wysecond" , "position" ) ;
String policy = rs . getPropValue ( "wysecond" , "policy" ) ;
String jobTitle = rs . getPropValue ( "wysecond" , "jobTitle" ) ;
DepartmentComInfo dept = new DepartmentComInfo ( ) ;
JobTitlesComInfo job = new JobTitlesComInfo ( ) ;
rs . executeQuery ( "SELECT h.id, workcode, lastname, sex, birthday, resourceimageid, b." + nation + " as nation, nativeplace, \n" +
" companystartdate, b." + joinPartyDate + " as joinPartyDate, c." + workStartDate + " as workStartDate, c." + highPersonType + " as highPersonType, \n" +
" b." + jobCall + " as jobCall,departmentid, d." + jobTitle + " as jobTitle, c." + postion + " as postion,d." + position + " as position, d." + policy + " as policy FROM hrmresource h \n" +
" LEFT JOIN cus_fielddata b on b.id = h.id and b.scopeid = 1 and b.scope = 'HrmCustomFieldByInfoType' \n" +
" LEFT JOIN cus_fielddata c on c.id = h.id and c.scopeid = 3 and c.scope = 'HrmCustomFieldByInfoType' \n" +
" LEFT JOIN cus_fielddata d on d.id = h.id and d.scopeid = -1 and d.scope = 'HrmCustomFieldByInfoType' \n" +
"where h.id = ?" , resourceId ) ;
PersonnelResumePo personnelResumePo = PersonnelResumePo . builder ( ) . build ( ) ;
if ( rs . next ( ) ) {
String id = Util . null2String ( rs . getString ( "id" ) ) ;
personnelResumePo . setWorkcode ( Util . null2String ( rs . getString ( "workcode" ) ) ) ;
personnelResumePo . setLastName ( Util . null2String ( rs . getString ( "lastname" ) ) ) ;
personnelResumePo . setSex ( Util . null2String ( rs . getString ( "sex" ) ) ) ;
personnelResumePo . setBirthday ( Util . null2String ( rs . getString ( "birthday" ) ) ) ;
personnelResumePo . setResourceImageId ( Util . null2String ( rs . getString ( "resourceimageid" ) ) ) ;
personnelResumePo . setNation ( selectNationName ( Util . null2String ( rs . getString ( "nation" ) ) ) ) ;
personnelResumePo . setNativePlace ( Util . null2String ( rs . getString ( "nativeplace" ) ) ) ;
personnelResumePo . setCompanyStartDate ( Util . null2String ( rs . getString ( "companystartdate" ) ) ) ;
personnelResumePo . setJoinPartyDate ( Util . null2String ( rs . getString ( "joinPartyDate" ) ) ) ;
personnelResumePo . setWorkStartDate ( Util . null2String ( rs . getString ( "workStartDate" ) ) ) ;
personnelResumePo . setHighPersonType ( selectItemValue ( highPersonType , Util . getIntValue ( rs . getString ( "highPersonType" ) ) , String . valueOf ( user . getLanguage ( ) ) ) ) ;
personnelResumePo . setJobCall ( selectItemValue ( jobCall , Util . getIntValue ( rs . getString ( "jobCall" ) ) , String . valueOf ( user . getLanguage ( ) ) ) ) ;
personnelResumePo . setDepartment ( dept . getDepartmentName ( Util . null2String ( rs . getString ( "departmentid" ) ) ) ) ;
personnelResumePo . setJobTitle ( FieldTransUtils . selectJobTitleName ( Util . null2String ( rs . getString ( "jobTitle" ) ) ) ) ;
personnelResumePo . setPostionLevel ( selectPostionLevel ( Util . null2String ( rs . getString ( "postion" ) ) ) ) ;
personnelResumePo . setPosition ( selectItemValue ( position , Util . getIntValue ( rs . getString ( "position" ) ) , String . valueOf ( user . getLanguage ( ) ) ) ) ;
personnelResumePo . setPolicy ( selectItemValue ( policy , Util . getIntValue ( rs . getString ( "policy" ) ) , String . valueOf ( user . getLanguage ( ) ) ) ) ;
//全日制最高学历
//全日制最高学历毕业院校
//全日制最高学历毕业专业
List < EducationInfo > educationInfos = selectEducInfo ( id ) ;
EducationInfo highEduc = educationInfos . stream ( )
. filter ( info - > ( info . getXxxs ( ) = = 0 & & info . getSfzgxl ( ) = = 0 ) )
. max ( Comparator . comparingInt ( EducationInfo : : getId ) )
. orElse ( new EducationInfo ( ) ) ;
personnelResumePo . setFullHighEducational ( highEduc . getXl ( ) ) ;
personnelResumePo . setFullHighSchool ( highEduc . getByyx ( ) ) ;
personnelResumePo . setFullHighMajor ( highEduc . getXxzy ( ) ) ;
//全日制最高学位
EducationInfo highMajor = educationInfos . stream ( )
. filter ( info - > ( info . getXxxs ( ) = = 0 & & info . getSfzgxw ( ) = = 0 ) )
. max ( Comparator . comparingInt ( EducationInfo : : getId ) )
. orElse ( new EducationInfo ( ) ) ;
personnelResumePo . setFullHighDegree ( highMajor . getXw ( ) ) ;
//非全全日制最高学历
//非全日制最高学历毕业院校
//非全日制最高学历毕业专业
EducationInfo nfHighEduc = educationInfos . stream ( )
. filter ( info - > ( info . getXxxs ( ) = = 1 & & info . getSfzgxl ( ) = = 0 ) )
. max ( Comparator . comparingInt ( EducationInfo : : getId ) )
. orElse ( new EducationInfo ( ) ) ;
personnelResumePo . setNotfullHighEducational ( nfHighEduc . getXl ( ) ) ;
personnelResumePo . setNotfullHighSchool ( nfHighEduc . getByyx ( ) ) ;
personnelResumePo . setNotfullHighMajor ( nfHighEduc . getXxzy ( ) ) ;
//非全日制最高学位
EducationInfo nfHighMajor = educationInfos . stream ( )
. filter ( info - > ( info . getXxxs ( ) = = 1 & & info . getSfzgxw ( ) = = 0 ) )
. max ( Comparator . comparingInt ( EducationInfo : : getId ) )
. orElse ( new EducationInfo ( ) ) ;
personnelResumePo . setNotfullHighDegree ( nfHighMajor . getXw ( ) ) ;
}
return personnelResumePo ;
}
private String selectItemValue ( String field , Integer selectValue , String language ) {
field = field . substring ( "field" . length ( ) ) ;
RecordSet rs = new RecordSet ( ) ;
rs . executeQuery ( "select selectname from cus_selectitem where fieldid = ? and selectvalue = ?" , field , selectValue ) ;
rs . next ( ) ;
return Util . formatMultiLang ( Util . null2String ( rs . getString ( "selectname" ) ) , language ) ;
}
private String selectWorkflowItem ( String fieldName , String tableName , Integer selectValue , String language ) {
RecordSet rs = new RecordSet ( ) ;
Integer fieldId = null ;
rs . executeQuery ( "select id from workflow_billfield where billid = (select id from workflow_bill where tablename = '" + tableName + "') \n" +
" and fieldname = '" + fieldName + "'" ) ;
if ( rs . next ( ) ) {
fieldId = Util . getIntValue ( rs . getString ( "id" ) ) ;
}
rs . executeQuery ( "select selectname from workflow_selectitem where fieldid = ? and selectvalue = ?" , fieldId , selectValue ) ;
rs . next ( ) ;
return Util . formatMultiLang ( Util . null2String ( rs . getString ( "selectname" ) ) , language ) ;
}
private String selectNationName ( String value ) {
RecordSet rs = new RecordSet ( ) ;
rs . executeQuery ( "select mz from uf_mz_ where id = ?" , value ) ;
rs . next ( ) ;
return Util . null2String ( rs . getString ( "mz" ) ) ;
}
private String selectPostionLevel ( String value ) {
RecordSet rs = new RecordSet ( ) ;
rs . executeQuery ( "select ywzwcj from uf_ywzwcj where id = ?" , value ) ;
rs . next ( ) ;
return Util . null2String ( rs . getString ( "ywzwcj" ) ) ;
}
private List < EducationInfo > selectEducInfo ( String resourceId ) {
List < EducationInfo > educationInfos = new ArrayList < > ( ) ;
RecordSet rs = new RecordSet ( ) ;
EducationLevelComInfo educ = new EducationLevelComInfo ( ) ;
rs . executeQuery ( "select id,xl,xw,byyx,xxzy,sfzgxw,sfzgxl,xxxs from uf_jxjl where xm = ?" , resourceId ) ;
while ( rs . next ( ) ) {
educationInfos . add ( EducationInfo . builder ( )
. id ( Util . getIntValue ( rs . getString ( "id" ) ) )
. xl ( educ . getEducationLevelname ( Util . null2String ( rs . getString ( "xl" ) ) ) )
. xw ( selectWorkflowItem ( "xw" , "uf_jxjl" , Util . getIntValue ( rs . getString ( "xw" ) ) , String . valueOf ( user . getLanguage ( ) ) ) )
. byyx ( Util . null2String ( rs . getString ( "byyx" ) ) )
. xxzy ( Util . null2String ( rs . getString ( "xxzy" ) ) )
. xxxs ( Util . getIntValue ( rs . getString ( "xxxs" ) ) )
. sfzgxw ( Util . getIntValue ( rs . getString ( "sfzgxw" ) ) )
. sfzgxl ( Util . getIntValue ( rs . getString ( "sfzgxl" ) ) )
. build ( ) ) ;
}
return educationInfos ;
}
}