2025-03-04 17:59:01 +08:00
package com.engine.wysecond.service.impl ;
import com.engine.core.impl.Service ;
import com.engine.wysecond.entity.resume.* ;
import com.engine.wysecond.service.PersonnelResumeService ;
2025-05-19 14:03:14 +08:00
import com.engine.wysecond.util.FieldTransUtils ;
2025-03-04 17:59:01 +08:00
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.* ;
2025-05-19 14:03:14 +08:00
2025-03-04 17:59:01 +08:00
/ * *
* @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 ( ) ) ;
2025-03-05 15:22:50 +08:00
resultMap . put ( " workStartDate " , personnelResumePo . getWorkStartDate ( ) ) ;
2025-03-04 17:59:01 +08:00
resultMap . put ( " highPersonType " , personnelResumePo . getHighPersonType ( ) ) ;
2025-03-05 15:22:50 +08:00
resultMap . put ( " jobCall " , personnelResumePo . getJobCall ( ) ) ;
2025-03-04 17:59:01 +08:00
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 ( ) ) ;
2025-04-25 09:24:09 +08:00
resultMap . put ( " policy " , personnelResumePo . getPolicy ( ) ) ;
resultMap . put ( " position " , personnelResumePo . getPosition ( ) ) ;
2025-03-04 17:59:01 +08:00
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 ) ;
//按照起始时间排序
2025-03-05 15:22:50 +08:00
educationInfos . sort ( Comparator . comparing ( EducationOrWorkInfo : : getStartDate ) ) ;
2025-03-04 17:59:01 +08:00
//增加空行
2025-04-03 15:26:20 +08:00
//educationInfos.add(EducationOrWorkInfo.builder().build());
2025-03-04 17:59:01 +08:00
for ( EducationOrWorkInfo educationInfo : educationInfos ) {
List < PersonnelResumeTd > educTr = new ArrayList < > ( ) ;
2025-03-05 15:22:50 +08:00
educTr . add ( PersonnelResumeTd . builder ( ) . colspans ( 2 ) . value ( educationInfo . getStartAndEndDate ( ) ) . rowspans ( 1 ) . build ( ) ) ;
2025-03-04 17:59:01 +08:00
educTr . add ( PersonnelResumeTd . builder ( ) . colspans ( 2 ) . value ( educationInfo . getAddress ( ) ) . rowspans ( 1 ) . build ( ) ) ;
educTr . add ( PersonnelResumeTd . builder ( ) . colspans ( 1 ) . value ( educationInfo . getContent ( ) ) . rowspans ( 1 ) . build ( ) ) ;
2025-03-05 15:22:50 +08:00
educTr . add ( PersonnelResumeTd . builder ( ) . colspans ( 2 ) . value ( educationInfo . getLevel ( ) ) . rowspans ( 1 ) . build ( ) ) ;
2025-03-04 17:59:01 +08:00
datas . add ( educTr ) ;
}
columns . add ( PersonnelResumeTd . builder ( ) . colspans ( 1 ) . value ( " 简历 " ) . rowspans ( educationInfos . size ( ) + 1 ) . build ( ) ) ;
2025-03-05 15:22:50 +08:00
columns . add ( PersonnelResumeTd . builder ( ) . colspans ( 2 ) . value ( " 起始时间-结束时间 " ) . rowspans ( 1 ) . build ( ) ) ;
2025-03-04 17:59:01 +08:00
columns . add ( PersonnelResumeTd . builder ( ) . colspans ( 2 ) . value ( " 单位/学校(从高中毕业后开始填写) " ) . rowspans ( 1 ) . build ( ) ) ;
columns . add ( PersonnelResumeTd . builder ( ) . colspans ( 1 ) . value ( " 岗位/专业 " ) . rowspans ( 1 ) . build ( ) ) ;
2025-03-05 15:22:50 +08:00
columns . add ( PersonnelResumeTd . builder ( ) . colspans ( 2 ) . value ( " 业务职务层级/学历 " ) . rowspans ( 1 ) . build ( ) ) ;
2025-03-04 17:59:01 +08:00
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 < > ( ) ;
//教育经历
2025-07-17 19:06:38 +08:00
rs . executeQuery ( " select rxsj,bysj,byyx,xxzy,xl1 from uf_jxjl where xm = ? " , resourceId ) ;
2025-03-05 15:22:50 +08:00
EducationLevelComInfo educ = new EducationLevelComInfo ( ) ;
2025-03-04 17:59:01 +08:00
while ( rs . next ( ) ) {
2025-03-05 15:22:50 +08:00
String date = Util . null2String ( rs . getString ( " rxsj " ) ) + " - " + Util . null2String ( rs . getString ( " bysj " ) ) ;
2025-03-04 17:59:01 +08:00
educationOrWorkInfos . add ( EducationOrWorkInfo . builder ( )
. startDate ( Util . null2String ( rs . getString ( " rxsj " ) ) )
. startAndEndDate ( date )
. address ( Util . null2String ( rs . getString ( " byyx " ) ) )
. content ( Util . null2String ( rs . getString ( " xxzy " ) ) )
2025-07-17 19:06:38 +08:00
. level ( educ . getEducationLevelname ( Util . null2String ( rs . getString ( " xl1 " ) ) ) )
2025-03-04 17:59:01 +08:00
. build ( ) ) ;
}
//工作经历
2025-03-05 15:22:50 +08:00
rs . executeQuery ( " select qssj,zzsj,lldw,rzgw,zwzwdj from uf_gzjj where xm = ? " , resourceId ) ;
2025-03-04 17:59:01 +08:00
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 " ) ;
2025-04-25 09:24:09 +08:00
String position = rs . getPropValue ( " wysecond " , " position " ) ;
String policy = rs . getPropValue ( " wysecond " , " policy " ) ;
2025-05-19 14:03:14 +08:00
String jobTitle = rs . getPropValue ( " wysecond " , " jobTitle " ) ;
2025-03-04 17:59:01 +08:00
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 " +
2025-05-19 14:03:14 +08:00
" 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 " +
2025-03-04 17:59:01 +08:00
" 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 " +
2025-04-25 09:24:09 +08:00
" LEFT JOIN cus_fielddata d on d.id = h.id and d.scopeid = -1 and d.scope = 'HrmCustomFieldByInfoType' \ n " +
2025-03-04 17:59:01 +08:00
" 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 ( ) ) ) ) ;
2025-03-05 15:22:50 +08:00
personnelResumePo . setJobCall ( selectItemValue ( jobCall , Util . getIntValue ( rs . getString ( " jobCall " ) ) , String . valueOf ( user . getLanguage ( ) ) ) ) ;
2025-03-04 17:59:01 +08:00
personnelResumePo . setDepartment ( dept . getDepartmentName ( Util . null2String ( rs . getString ( " departmentid " ) ) ) ) ;
2025-05-19 14:03:14 +08:00
personnelResumePo . setJobTitle ( FieldTransUtils . selectJobTitleName ( Util . null2String ( rs . getString ( " jobTitle " ) ) ) ) ;
2025-03-04 17:59:01 +08:00
personnelResumePo . setPostionLevel ( selectPostionLevel ( Util . null2String ( rs . getString ( " postion " ) ) ) ) ;
2025-04-25 09:24:09 +08:00
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 ( ) ) ) ) ;
2025-03-04 17:59:01 +08:00
2025-03-05 15:22:50 +08:00
//全日制最高学历
//全日制最高学历毕业院校
//全日制最高学历毕业专业
2025-03-04 17:59:01 +08:00
List < EducationInfo > educationInfos = selectEducInfo ( id ) ;
2025-03-05 15:22:50 +08:00
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 ( ) ) ;
2025-03-04 17:59:01 +08:00
}
return personnelResumePo ;
}
2025-05-19 14:03:14 +08:00
2025-03-04 17:59:01 +08:00
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 ( ) ;
2025-03-05 15:22:50 +08:00
EducationLevelComInfo educ = new EducationLevelComInfo ( ) ;
rs . executeQuery ( " select id,xl,xw,byyx,xxzy,sfzgxw,sfzgxl,xxxs from uf_jxjl where xm = ? " , resourceId ) ;
2025-03-04 17:59:01 +08:00
while ( rs . next ( ) ) {
educationInfos . add ( EducationInfo . builder ( )
2025-03-05 15:22:50 +08:00
. 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 ( ) ) ) )
2025-03-04 17:59:01 +08:00
. byyx ( Util . null2String ( rs . getString ( " byyx " ) ) )
. xxzy ( Util . null2String ( rs . getString ( " xxzy " ) ) )
2025-03-05 15:22:50 +08:00
. xxxs ( Util . getIntValue ( rs . getString ( " xxxs " ) ) )
. sfzgxw ( Util . getIntValue ( rs . getString ( " sfzgxw " ) ) )
. sfzgxl ( Util . getIntValue ( rs . getString ( " sfzgxl " ) ) )
2025-03-04 17:59:01 +08:00
. build ( ) ) ;
}
return educationInfos ;
}
}