|
@@ -1,13 +1,33 @@
|
|
|
package com.citu.module.menduner.system.service.resume;
|
|
|
|
|
|
import cn.hutool.core.codec.Base64;
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.http.HttpUtil;
|
|
|
+import com.citu.module.menduner.system.controller.base.eduexp.EduExpRespVO;
|
|
|
+import com.citu.module.menduner.system.controller.base.job.interested.JobInterestedRespVO;
|
|
|
import com.citu.module.menduner.system.controller.base.person.info.PersonDetailExtendRespVO;
|
|
|
-import com.citu.module.menduner.system.controller.base.resume.resumesdk.TemResumeResVo;
|
|
|
+import com.citu.module.menduner.system.controller.base.person.info.PersonInfoRespVO;
|
|
|
+import com.citu.module.menduner.system.controller.base.person.skill.PersonSkillRespVO;
|
|
|
+import com.citu.module.menduner.system.controller.base.projectexp.ProjectExpRespVO;
|
|
|
+import com.citu.module.menduner.system.controller.base.resume.resumesdk.*;
|
|
|
+import com.citu.module.menduner.system.controller.base.trainexp.TrainExpRespVO;
|
|
|
+import com.citu.module.menduner.system.controller.base.workexp.WorkExpRespVO;
|
|
|
+import com.citu.module.menduner.system.enums.eduexp.EducationTypeEnum;
|
|
|
+import com.citu.module.menduner.system.enums.workexp.ExpTypeEnum;
|
|
|
+import com.citu.module.menduner.system.service.area.AreaService;
|
|
|
+import com.google.common.collect.ImmutableMap;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.time.LocalDateTime;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
import static com.citu.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
|
import static com.citu.module.menduner.system.enums.ErrorCodeConstants.MDE_PERSON_RESUME_ERROR;
|
|
|
|
|
@@ -18,6 +38,9 @@ public class OnlineResumeServiceImpl implements OnlineResumeService {
|
|
|
@Resource
|
|
|
private TenResumeService tenResumeService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ AreaService areaService;
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public TemResumeResVo resumeParser(String fileUrl) {
|
|
@@ -34,18 +57,190 @@ public class OnlineResumeServiceImpl implements OnlineResumeService {
|
|
|
|
|
|
@Override
|
|
|
public PersonDetailExtendRespVO parserByPerson(String fileUrl) {
|
|
|
- TemResumeResVo temResumeResVo = resumeParser(fileUrl);
|
|
|
+ TemResumeContent temResumeResVo = resumeParser(fileUrl).getResult();
|
|
|
PersonDetailExtendRespVO resp = new PersonDetailExtendRespVO();
|
|
|
// TODO 解析出简历对象后 赋值给resp
|
|
|
// TODO 没有的信息可不填
|
|
|
// TODO resp.info 人员基本信息 areaId、regId 需要取出省市区id,工作年限、工作经验通过 EducationTypeEnum|ExpTypeEnum 判断赋type值,其他基本信息根据情况填
|
|
|
+ resp.setPerson(temResumeResVoConvertToPersonInfoRespVO(temResumeResVo));
|
|
|
// TODO resp.interestedList 大概率取不出,但是可以填positionName
|
|
|
+ resp.setInterestedList(temResumeResVoConvertToJobInterestedRespVO(temResumeResVo));
|
|
|
// TODO resp.skillList 完全配不出格式,先不用管
|
|
|
+// resp.setSkillList()
|
|
|
// TODO resp.eduList 可填schoolName、educationType(EducationTypeEnum)、major、startTime、endTime
|
|
|
+ resp.setEduList(temResumeResVoConvertToEduExpRespVO(temResumeResVo));
|
|
|
// TODO resp.workList 可填enterpriseName、positionName、startTime、endTime、content
|
|
|
+ resp.setWorkList(temResumeResVoConvertToWorkExpRespVO(temResumeResVo));
|
|
|
// TODO resp.projectList 自行评估有没有
|
|
|
+ resp.setProjectList(temResumeResVoConvertToProjectExpRespVO(temResumeResVo));
|
|
|
// TODO resp.trainList 大概率没有
|
|
|
+ resp.setTrainList(temResumeResVoConvertToTrainExpRespVO(temResumeResVo));
|
|
|
// TODO resp.resume 将temResumeResVo丢进来
|
|
|
+ resp.setResume(temResumeResVo);
|
|
|
return resp;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ PersonInfoRespVO temResumeResVoConvertToPersonInfoRespVO(TemResumeContent temResumeResVo){
|
|
|
+ PersonInfoRespVO personInfoRespVO = new PersonInfoRespVO();
|
|
|
+ personInfoRespVO.setName(temResumeResVo.getName());
|
|
|
+// personInfoRespVO.setForeignName(temResumeResVo.getNameEn());
|
|
|
+ personInfoRespVO.setSex(temResumeResVo.getGender());
|
|
|
+ personInfoRespVO.setAvatar(temResumeResVo.getAvatarUrl());
|
|
|
+ personInfoRespVO.setPhone(temResumeResVo.getPhone());
|
|
|
+ personInfoRespVO.setEmail(temResumeResVo.getEmail());
|
|
|
+ personInfoRespVO.setWxCode(temResumeResVo.getWeixin());
|
|
|
+ personInfoRespVO.setBirthday(convertDate(temResumeResVo.getBirthday()));
|
|
|
+ personInfoRespVO.setMaritalStatus("3");
|
|
|
+ if(StringUtils.isNotBlank(temResumeResVo.getMaritalStatus())){
|
|
|
+ String maritalStatus = temResumeResVo.getMaritalStatus().replaceAll(" ", "");
|
|
|
+ Map<String,String> maritalStatusMap = new HashMap<>();
|
|
|
+ maritalStatusMap.put("未婚","0");
|
|
|
+ maritalStatusMap.put("未结婚","0");
|
|
|
+ maritalStatusMap.put("未婚未育","0");
|
|
|
+ maritalStatusMap.put("暂未结婚","0");
|
|
|
+ maritalStatusMap.put("已婚","1");
|
|
|
+ maritalStatusMap.put("已经结婚","1");
|
|
|
+ maritalStatusMap.put("已结婚","1");
|
|
|
+ maritalStatusMap.put("已婚已育","1");
|
|
|
+ personInfoRespVO.setMaritalStatus( maritalStatusMap.getOrDefault(maritalStatus,"3"));
|
|
|
+ }
|
|
|
+
|
|
|
+ if(StringUtils.isNotBlank(temResumeResVo.getCityNorm())){
|
|
|
+ String cityNorm = temResumeResVo.getCityNorm().replaceAll(" ", "");
|
|
|
+ String[] split = cityNorm.split("-");// 规范化的城市名,到“区县”一级: 中国-广东省 中国-湖南省-岳阳市 中国-湖南省-岳阳市-华容县
|
|
|
+ // 只有省级别
|
|
|
+ if(split.length ==2){
|
|
|
+ personInfoRespVO.setAreaId(areaService.getAreaByName(split[1]).getId());
|
|
|
+ }
|
|
|
+ // 只有市级别
|
|
|
+ if(split.length ==3){
|
|
|
+ personInfoRespVO.setAreaId(areaService.getAreaByName(split[2]).getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(StringUtils.isNotBlank(temResumeResVo.getHukouAddressNorm())){
|
|
|
+ String hukouAddressNorm = temResumeResVo.getHukouAddressNorm().replaceAll(" ", "");
|
|
|
+ String[] split = hukouAddressNorm.split("-");// 规范化的城市名,到“区县”一级: 中国-广东省 中国-湖南省-岳阳市 中国-湖南省-岳阳市-华容县
|
|
|
+ // 只有省级别
|
|
|
+ if(split.length ==2){
|
|
|
+ personInfoRespVO.setRegId(areaService.getAreaByName(split[1]).getId());
|
|
|
+ }
|
|
|
+ // 只有市级别
|
|
|
+ if(split.length ==3){
|
|
|
+ personInfoRespVO.setRegId(areaService.getAreaByName(split[2]).getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+// personInfoRespVO.setJobType(); // expect_jnature 期望工作性质
|
|
|
+// personInfoRespVO.setJobStatus();// // expect_jstatus 期望工作性质
|
|
|
+
|
|
|
+ personInfoRespVO.setFirstWorkTime(convertDate(temResumeResVo.getWorkStartTime()));
|
|
|
+ if(null == personInfoRespVO.getFirstWorkTime()){
|
|
|
+ personInfoRespVO.setFirstWorkTime(convertDate(temResumeResVo.getWorkStartTimeInf()));
|
|
|
+ }
|
|
|
+ personInfoRespVO.setAdvantage(temResumeResVo.getContMyDesc());
|
|
|
+ personInfoRespVO.setEduType(temResumeResVo.getDegree());
|
|
|
+ String type = ExpTypeEnum.getOCREnumByYear(temResumeResVo.getWorkYearNorm()).getType();
|
|
|
+ String type2 = ExpTypeEnum.getOCREnumByYear(temResumeResVo.getWorkYearInf()).getType();
|
|
|
+ personInfoRespVO.setExpType(null==type?type2:null);// expect_work_year 期望工作年限
|
|
|
+ return personInfoRespVO;
|
|
|
+ }
|
|
|
+ List<JobInterestedRespVO> temResumeResVoConvertToJobInterestedRespVO(TemResumeContent temResumeResVo){
|
|
|
+ List<JobInterestedRespVO> interestedList = new ArrayList<>();
|
|
|
+ JobInterestedRespVO jobInterestedRespVO =new JobInterestedRespVO();
|
|
|
+ if(StringUtils.isNotBlank(temResumeResVo.getExpectSalaryMin())){
|
|
|
+ jobInterestedRespVO.setPayFrom(new BigDecimal( temResumeResVo.getExpectSalaryMin()));
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank( temResumeResVo.getExpectSalaryMax())){
|
|
|
+ jobInterestedRespVO.setPayTo(new BigDecimal( temResumeResVo.getExpectSalaryMax()));
|
|
|
+ }
|
|
|
+
|
|
|
+ interestedList.add(jobInterestedRespVO);
|
|
|
+
|
|
|
+ return interestedList;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<EduExpRespVO> temResumeResVoConvertToEduExpRespVO(TemResumeContent temResumeResVo){
|
|
|
+ List<EduExpRespVO> respVOS =new ArrayList<>();
|
|
|
+
|
|
|
+ for (TemResumeEduVo educationObj : temResumeResVo.getEducationObjs()) {
|
|
|
+ //可填schoolName、educationType(EducationTypeEnum)、major、startTime、endTime
|
|
|
+ EduExpRespVO eduExpRespVO = new EduExpRespVO();
|
|
|
+ eduExpRespVO.setSchoolName(educationObj.getEduCollege());
|
|
|
+ eduExpRespVO.setEducationType(EducationTypeEnum.getEnumByOcrName(educationObj.getEduDegreeNorm()).getType());
|
|
|
+ eduExpRespVO.setMajor(educationObj.getEduMajor());
|
|
|
+ eduExpRespVO.setStartTime(convertDate(educationObj.getStartDate()));
|
|
|
+ eduExpRespVO.setEndTime(convertDate(educationObj.getEndDate()));
|
|
|
+ respVOS.add(eduExpRespVO);
|
|
|
+ }
|
|
|
+
|
|
|
+ return respVOS;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<WorkExpRespVO> temResumeResVoConvertToWorkExpRespVO(TemResumeContent temResumeResVo) {
|
|
|
+ List<WorkExpRespVO> respVOS =new ArrayList<>();
|
|
|
+ //可填enterpriseName、positionName、startTime、endTime、content
|
|
|
+ for (TemResumeWorkVo jobExpObj : temResumeResVo.getJobExpObjs()) {
|
|
|
+ WorkExpRespVO workExpRespVO = new WorkExpRespVO();
|
|
|
+ workExpRespVO.setEnterpriseName(jobExpObj.getJobCpy());
|
|
|
+ workExpRespVO.setPositionName(jobExpObj.getJobPosition());
|
|
|
+ workExpRespVO.setStartTime(convertDate(jobExpObj.getStartDate()));
|
|
|
+ workExpRespVO.setEndTime(convertDate(jobExpObj.getEndDate()));
|
|
|
+ workExpRespVO.setContent(jobExpObj.getJobContent());
|
|
|
+ workExpRespVO.setDeptName(jobExpObj.getJobDept());
|
|
|
+ respVOS.add(workExpRespVO);
|
|
|
+ }
|
|
|
+
|
|
|
+ return respVOS;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<ProjectExpRespVO> temResumeResVoConvertToProjectExpRespVO(TemResumeContent temResumeResVo){
|
|
|
+ List<ProjectExpRespVO> respVOS = new ArrayList<>();
|
|
|
+ for (TemResumetProjectVo projectVo : temResumeResVo.getProjExpObjs()) {
|
|
|
+ ProjectExpRespVO projectExpRespVO = new ProjectExpRespVO();
|
|
|
+ projectExpRespVO.setName(projectVo.getProjName());
|
|
|
+ projectExpRespVO.setContent(projectVo.getProjContent());
|
|
|
+ projectExpRespVO.setStartTime(convertDate(projectVo.getStartDate()));
|
|
|
+ projectExpRespVO.setEndTime(convertDate(projectVo.getEndDate()));
|
|
|
+ respVOS.add(projectExpRespVO);
|
|
|
+ }
|
|
|
+ return respVOS;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<TrainExpRespVO> temResumeResVoConvertToTrainExpRespVO(TemResumeContent temResumeResVo){
|
|
|
+ List<TrainExpRespVO> respVOS =new ArrayList<>();
|
|
|
+ for (TemResumetTrainingVo trainingObj : temResumeResVo.getTrainingObjs()) {
|
|
|
+ TrainExpRespVO trainExpRespVO = new TrainExpRespVO();
|
|
|
+ trainExpRespVO.setStartTime(convertDate(trainingObj.getStartDate()));
|
|
|
+ trainExpRespVO.setEndTime(convertDate(trainingObj.getEndDate()));
|
|
|
+ trainExpRespVO.setOrgName(trainingObj.getTrainOrg());
|
|
|
+ trainExpRespVO.setCourse(trainingObj.getTrainName());
|
|
|
+ trainExpRespVO.setContent(trainingObj.getTrainCont());
|
|
|
+ respVOS.add(trainExpRespVO);
|
|
|
+ }
|
|
|
+ return respVOS;
|
|
|
+ }
|
|
|
+
|
|
|
+ private LocalDateTime convertDate(String date){
|
|
|
+ if(null == date){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ String [] formats = {"yyyy.MM.dd","yyyy.MM","yyyy-MM-dd","yyyy/MM/dd","yyyy-MM","yyyy/MM","yyyy年MM月","yyyy年MM月dd"};
|
|
|
+ date = date.replaceAll(" ","");
|
|
|
+ if(date.length()>10){
|
|
|
+ date = date.substring(0,10);
|
|
|
+ }
|
|
|
+ for (String format : formats) {
|
|
|
+ try {
|
|
|
+ return DateUtil.parse(date,format).toLocalDateTime();
|
|
|
+ }catch (Exception e){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|