Commit dfa76a5c by 284718418@qq.com

ResumeSDK

parent d0dce346
...@@ -12,6 +12,7 @@ import cn.timer.api.controller.kqgl.ClockInTool; ...@@ -12,6 +12,7 @@ import cn.timer.api.controller.kqgl.ClockInTool;
import cn.timer.api.dto.baidu.*; import cn.timer.api.dto.baidu.*;
import cn.timer.api.bean.clazz.NationClass; import cn.timer.api.bean.clazz.NationClass;
import cn.timer.api.dto.email.SendMessageDto; import cn.timer.api.dto.email.SendMessageDto;
import cn.timer.api.dto.resumesdk.ResumeSdkDto;
import cn.timer.api.dto.template.InterviewNotice; import cn.timer.api.dto.template.InterviewNotice;
import cn.timer.api.dto.zpgl.ImportCandidateDto; import cn.timer.api.dto.zpgl.ImportCandidateDto;
import cn.timer.api.dto.zpgl.ZpglRcxxDto; import cn.timer.api.dto.zpgl.ZpglRcxxDto;
...@@ -21,6 +22,7 @@ import cn.timer.api.utils.ResultUtil; ...@@ -21,6 +22,7 @@ import cn.timer.api.utils.ResultUtil;
import cn.timer.api.utils.ZpglMessageTemplate; import cn.timer.api.utils.ZpglMessageTemplate;
import cn.timer.api.utils.baidu.BaiduTicUtil; import cn.timer.api.utils.baidu.BaiduTicUtil;
import cn.timer.api.utils.baidu.Base64; import cn.timer.api.utils.baidu.Base64;
import cn.timer.api.utils.resumesdk.ResumeSDKUtil;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
...@@ -54,6 +56,8 @@ public class ZpglServiceImpl implements ZpglService { ...@@ -54,6 +56,8 @@ public class ZpglServiceImpl implements ZpglService {
@Autowired @Autowired
private BaiduTicUtil baiduTicUtil; private BaiduTicUtil baiduTicUtil;
@Autowired
private ResumeSDKUtil resumeSDKUtil;
@Autowired @Autowired
private JavaMailSender mailSender; private JavaMailSender mailSender;
...@@ -67,6 +71,9 @@ public class ZpglServiceImpl implements ZpglService { ...@@ -67,6 +71,9 @@ public class ZpglServiceImpl implements ZpglService {
@Autowired @Autowired
private OSSService ossService; private OSSService ossService;
@Value("${config-8timer.Aliyun.RESUMESDK_APPCODE}")
private String RESUMESDK_APPCODE;
@Override @Override
public boolean updateZpglRcxx(UserBean userBean, ZpglRcxxDto zpglRcxxDto) { public boolean updateZpglRcxx(UserBean userBean, ZpglRcxxDto zpglRcxxDto) {
...@@ -259,11 +266,15 @@ public class ZpglServiceImpl implements ZpglService { ...@@ -259,11 +266,15 @@ public class ZpglServiceImpl implements ZpglService {
@Override @Override
public Result<Object> addResumeImportCandidate(UserBean userBean, MultipartFile file, ImportCandidateDto importCandidateDto) { public Result<Object> addResumeImportCandidate(UserBean userBean, MultipartFile file, ImportCandidateDto importCandidateDto) {
BaiduTicResumeDto baiduTicResumeDto = BaiduTicResumeDto.builder().filename(file.getOriginalFilename()).filetype(importCandidateDto.getSuffix()).filedata(Base64.getStrFromPath(file)).build(); /*BaiduTicResumeDto baiduTicResumeDto = BaiduTicResumeDto.builder().filename(file.getOriginalFilename()).filetype(importCandidateDto.getSuffix()).filedata(Base64.getStrFromPath(file)).build();
ResponseEntity<String> resumeString = baiduTicUtil.getResumeByCvParser(baiduTicResumeDto); ResponseEntity<String> resumeString = baiduTicUtil.getResumeByCvParser(baiduTicResumeDto);*/
ResumeSdkDto resumeSdkDto = ResumeSdkDto.builder().ocr_type(1).need_avatar(0).file_name(file.getOriginalFilename()).file_cont(Base64.getStrFromPath(file)).filetype(importCandidateDto.getSuffix()).build();
ResponseEntity<String> resumeString = resumeSDKUtil.getResumeByCvParser(resumeSdkDto, RESUMESDK_APPCODE);
JSONObject json = (JSONObject) JSONObject.parse(resumeString.getBody()); JSONObject json = (JSONObject) JSONObject.parse(resumeString.getBody());
log.info("招聘-导入候选人简历{}", resumeString.getBody()); log.info("招聘-导入候选人简历{}", resumeString.getBody());
ResumeExtract resumeExtract = null; return ResultUtil.success();
/*ResumeExtract resumeExtract = null;
if ("success".equals(json.get("error_msg"))) { if ("success".equals(json.get("error_msg"))) {
if (StringUtils.isEmpty(json.get("results"))) { if (StringUtils.isEmpty(json.get("results"))) {
log.info("招聘-导入候选人简历:results is null"); log.info("招聘-导入候选人简历:results is null");
...@@ -287,7 +298,7 @@ public class ZpglServiceImpl implements ZpglService { ...@@ -287,7 +298,7 @@ public class ZpglServiceImpl implements ZpglService {
importCandidateDto.setFilePath(data.getData()); importCandidateDto.setFilePath(data.getData());
importCandidateDto.setFileName(file.getOriginalFilename()); importCandidateDto.setFileName(file.getOriginalFilename());
} }
return this.addZpglRcxx(userBean, resumeExtract, importCandidateDto); return this.addZpglRcxx(userBean, resumeExtract, importCandidateDto);*/
} }
@Override @Override
......
package cn.timer.api.dto.resumesdk;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* 语言证书列表
* @author wuqingjun
* @email 284718418@qq.com
* @date 2022/4/22
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Cert_objs implements Serializable {
/**
* 语言名称
*/
private String langcert_lang;
/**
* 证书名称
*/
private String langcert_name;
/**
* 证书成绩
*/
private String langcert_score;
}
package cn.timer.api.dto.resumesdk;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* 教育经历
* @author wuqingjun
* @email 284718418@qq.com
* @date 2022/4/22
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Education_objs implements Serializable {
/**
* 学校名称
*/
private String edu_college;
/**
* 专业名称
*/
private String edu_major;
/**
* 开始时间
*/
private String start_date;
/**
* 结束时间
*/
private String end_date;
/**
* 学历
*/
private String edu_degree;
/**
* 学历:小学、初中、高中、中专、大专、本科、硕士研究生、博士研究生、博士后、mba
*/
private String edu_degree_norm;
/**
* 学校排名:取值1~1000
*/
private String edu_college_rank;
/**
* 学校类型取值0~7:
* 0:普通院校
* 1:985
* 2:211
* 3:港澳台院校
* 4:海外院校
* 5:中学
* 6:职业教育
* 7:培训机构
*/
private String edu_college_type;
}
package cn.timer.api.dto.resumesdk;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author wuqingjun
* @email 284718418@qq.com
* @date 2022/4/22
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Eval implements Serializable {
private int salary;
}
package cn.timer.api.dto.resumesdk;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author wuqingjun
* @email 284718418@qq.com
* @date 2022/4/22
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Industries implements Serializable {
private double tag_weight;
private String tag_name;
}
package cn.timer.api.dto.resumesdk;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* 工作经历及实习经历
* 其中实习经历通过job_nature="实习"进行标识
* @author wuqingjun
* @email 284718418@qq.com
* @date 2022/4/22
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Job_exp_objs implements Serializable {
/**
* 职位
*/
private String job_position;
/**
* 结束时间
*/
private String end_date;
/**
* 工作内容
*/
private String job_content;
/**
* 公司名称
*/
private String job_cpy;
/**
* 行业名称
*/
private String job_industry;
/**
* 公司规模
*/
private String job_cpy_size;
/**
* 持续时间 比如“1年3个月”、“3年”、“6个月”
*/
private String job_duration;
/**
* 开始时间
*/
private String start_date;
/**
* 工作性质 全职、兼职、实习
*/
private String job_nature;
}
package cn.timer.api.dto.resumesdk;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author wuqingjun
* @email 284718418@qq.com
* @date 2022/4/22
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class JsonRootBean implements Serializable {
private Status status;
private Result result;
private Eval eval;
private Tags tags;
}
package cn.timer.api.dto.resumesdk;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* 语言技能
* @author wuqingjun
* @email 284718418@qq.com
* @date 2022/4/22
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Lang_objs implements Serializable {
/**
* 语言名称
*/
private String language_name;
/**
* 熟练程度
*/
private String language_level;
/**
* 读写能力
*/
private String language_read_write;
/**
* 听说能力
*/
private String language_listen_speak;
}
package cn.timer.api.dto.resumesdk;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author wuqingjun
* @email 284718418@qq.com
* @date 2022/4/22
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Pos_tags implements Serializable {
private double tag_weight;
private String tag_name;
}
package cn.timer.api.dto.resumesdk;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author wuqingjun
* @email 284718418@qq.com
* @date 2022/4/22
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Pos_types implements Serializable {
private double tag_weight;
private String tag_name;
}
package cn.timer.api.dto.resumesdk;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* 项目经历
* @author wuqingjun
* @email 284718418@qq.com
* @date 2022/4/22
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Proj_exp_objs implements Serializable {
/**
* 开始时间
*/
private String start_date;
/**
* 结束时间
*/
private String end_date;
/**
* 项目名称
*/
private String proj_name;
/**
* 所在公司
*/
private String proj_cpy;
/**
* 担任职位
*/
private String proj_position;
/**
* 项目内容
*/
private String proj_content;
/**
* 项目职责
*/
private String proj_resp;
}
package cn.timer.api.dto.resumesdk;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* @author wuqingjun
* @email 284718418@qq.com
* @date 2022/4/22
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Result implements Serializable {
private String name;
private String gender;
private String age;
private String marital_status;
private String polit_status;
private String major;
private String surname;
private String height;
private String weight;
private Date birthday;
private String city_norm;
private String college;
private String college_type;
private String college_rank;
private String has_oversea_edu;
private String has_oversea_exp;
private String city;
private String grad_time;
private String degree;
private String race;
private String nationality;
private String english_level;
private String computer_level;
private String work_position;
private String work_company;
private String work_industry;
private String work_start_time;
private String work_year_norm;
private String work_year;
private String work_job_nature;
private String work_start_time_inf;
private String phone;
private String email;
private String postal_code;
private String qq;
private String weixin;
private String expect_salary;
private String expect_salary_min;
private String expect_salary_max;
private String expect_job;
private String expect_industry;
private String living_address;
private String living_address_norm;
private String hukou_address_norm;
private String hukou_address;
private String hometown_address_norm;
private String hometown_address;
private String resume_type;
private String resume_source;
private String resume_integrity;
private Date resume_parse_time;
private String resume_name;
private String avatar_data;
private List<Education_objs> education_objs;
private List<Job_exp_objs> job_exp_objs;
private List<Proj_exp_objs> proj_exp_objs;
private List<Training_objs> training_objs;
private List<Cert_objs> cert_objs;
private List<Lang_objs> lang_objs;
private List<Skills_objs> skills_objs;
private String cont_basic_info;
private String cont_expect_job;
private String cont_education;
private String cont_job_exp;
private String cont_proj_exp;
private String cont_job_skill;
private String raw_text;
}
package cn.timer.api.dto.resumesdk;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* 简历相关请求参数,每次一份简历
* @author wuqingjun
* @email 284718418@qq.com
* @date 2022/4/22
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ResumeSdkDto implements Serializable {
/**
* 简历文档名称,文件大小不超过10M
*/
private String file_name;
/**
* 简历文档类型,目前支持pdf、doc、docx、wps、txt、jpg、jpeg、png、bmp、tif格式
*/
private String filetype;
/**
* 必填字段 简历文件内容(以base64编码),其中:
* 1)图片简历:经based64编码后大小建议不超过1M,最短边至少50px,最长边最大4096px,
* 支持jpg/jpeg/png/bmp/tif/gif格式;
* 2)非图片简历:经based64编码后大小不超过10M(注:阿里云接口是不超过8M);
*/
private String file_cont;
/**
* 可选字段 是否需要解析头像,0为不需要,1为需要,默认为0
*/
private Integer need_avatar;
/**
* 可选字段 ocr(图片解析所用到的文字识别)类型,0为基础版,1为高级版,默认为0。
* 其中高级版效果更佳,但是收费略有不同,具体请参考报价单;
*/
private Integer ocr_type;
}
package cn.timer.api.dto.resumesdk;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* 技能列表
* @author wuqingjun
* @email 284718418@qq.com
* @date 2022/4/22
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Skills_objs implements Serializable {
/**
* 熟练程度
*/
private String skills_level;
/**
* 技能名称
* 技能名词,比如“java开发”、“市场调研”等
*/
private String skills_name;
/**
* 技能使用时间 时长
*/
private String skills_time;
}
package cn.timer.api.dto.resumesdk;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author wuqingjun
* @email 284718418@qq.com
* @date 2022/4/22
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Skills_tags implements Serializable {
private double tag_weight;
private String tag_name;
}
package cn.timer.api.dto.resumesdk;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author wuqingjun
* @email 284718418@qq.com
* @date 2022/4/22
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Status implements Serializable {
/**
* 200 正常状态,表示解析成功
* 250 账号(uid)或密码(pwd)错误
* 251 账号剩余用量为0(需及时充值)
* 260 请求参数错误
* 261 简历内容为空
* 262 简历内容过长
* 263 不支持的简历文件格式
* 264 base64解码出错
* 265 图片文件过大,或者长宽大小超过限制
* 266 输入参数file_name缺少文件后缀名(请带上正确的文件后缀,如果是纯文本则为.txt)
* 267 输入的json结构体有误(即解码失败)
* 240 简历解析内部错误
* 280 人岗匹配内部错误
*/
private int code;
/**
* 200 正常状态,表示解析成功
* 250 账号(uid)或密码(pwd)错误
* 251 账号剩余用量为0(需及时充值)
* 260 请求参数错误
* 261 简历内容为空
* 262 简历内容过长
* 263 不支持的简历文件格式
* 264 base64解码出错
* 265 图片文件过大,或者长宽大小超过限制
* 266 输入参数file_name缺少文件后缀名(请带上正确的文件后缀,如果是纯文本则为.txt)
* 267 输入的json结构体有误(即解码失败)
* 240 简历解析内部错误
* 280 人岗匹配内部错误
*/
private String message;
}
package cn.timer.api.dto.resumesdk;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
* @author wuqingjun
* @email 284718418@qq.com
* @date 2022/4/22
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Tags implements Serializable {
private List<Industries> industries;
private List<Pos_types> pos_types;
private List<Pos_tags> pos_tags;
private List<Skills_tags> skills_tags;
}
package cn.timer.api.dto.resumesdk;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* 培训经历
* @author wuqingjun
* @email 284718418@qq.com
* @date 2022/4/22
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Training_objs implements Serializable {
/**
* 培训机构 机构名称
*/
private String train_org;
/**
* 培训内容
* 内容描述
*/
private String train_cont;
/**
* 开始时间 比如“2019.09.01”、“2019.09”、“2019”
*/
private String start_date;
/**
* 结束时间 比如“2019.09.01”、“2019.09”、“2019”、“至今”
*/
private String end_date;
/**
* 培训地点
*/
private String train_loc;
/**
* 所获证书
*/
private String train_cert;
}
package cn.timer.api.utils.resumesdk;
import cn.timer.api.dto.resumesdk.ResumeSdkDto;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import java.util.ArrayList;
import java.util.List;
/**
* @author wuqingjun
* @email 284718418@qq.com
* @date 2022/4/22
*/
@Component
public class ResumeSDKUtil {
public ResponseEntity<String> getResumeByCvParser(ResumeSdkDto resumeSdkDto, String appCode){
String url = "http://resumesdk.market.alicloudapi.com/ResumeParser";
MultiValueMap<String, String> headers = new LinkedMultiValueMap<>();
List<String> list = new ArrayList<>();
list.add("Authorization");
list.add("APPCODE " + appCode);
list.add("Content-Type");
list.add("application/json; charset=UTF-8");
list.add("Content-Type");
list.add("application/json");
headers.put("header", list);
HttpEntity requestEntity = new HttpEntity(resumeSdkDto, headers);
return new RestTemplate().exchange(url, HttpMethod.POST,requestEntity, String.class);
}
}
...@@ -186,6 +186,7 @@ config-8timer: ...@@ -186,6 +186,7 @@ config-8timer:
project_package: 8timer2.0/ project_package: 8timer2.0/
expirationTime: 3153600000000L expirationTime: 3153600000000L
expirationTime_pri: 600000L expirationTime_pri: 600000L
RESUMESDK_APPCODE: 17e3b67b02ab4bef967025cc4938c072 #ResumeSDK简历解析 AppCode
esign: # e签宝 esign: # e签宝
callbackUrl: 'https://test-8timer-pc.youlingrc.com/callback/esign/dev' callbackUrl: 'https://test-8timer-pc.youlingrc.com/callback/esign/dev'
redirectUrl: 'http://test-8timer-pc.youlingrc.com/#/ElecCon/index' redirectUrl: 'http://test-8timer-pc.youlingrc.com/#/ElecCon/index'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment