Commit 9a28f78b by 284718418@qq.com

百度简历解析TIC

parent d499cf4f
......@@ -23,6 +23,8 @@ import cn.timer.api.dao.qyzx.QyzxEmpLoginMapper;
import cn.timer.api.dao.yggl.YgglMainEmpMapper;
import cn.timer.api.dao.zpgl.ZpglRcxxMapper;
import cn.timer.api.dto.baidu.BaiduTicResumeDto;
import cn.timer.api.dto.baidu.ResumeExtract;
import cn.timer.api.dto.zpgl.ImportCandidateDto;
import cn.timer.api.dto.zpgl.ZpglRcxxDto;
import cn.timer.api.dto.zpgl.ZpglRcxxEntryDto;
import cn.timer.api.utils.Md5;
......@@ -80,9 +82,6 @@ import java.util.Map;
@Slf4j
public class ZpglController {
@Autowired
private BaiduTicUtil baiduTicUtil;
@Value(value = "${config-8timer.init-password}")
private String pwd;
// 回调地址
......@@ -436,7 +435,7 @@ public class ZpglController {
@PostMapping("/resume_import_candidate")
@ApiOperation(value = "招聘-导入候选人简历", httpMethod = "POST", notes = "招聘-导入候选人简历")
public Result<Object> resumeImportCandidate(@CurrentUser UserBean userBean, @RequestParam(required = true) MultipartFile file,
HttpServletRequest request) {
@RequestBody ImportCandidateDto importCandidateDto, HttpServletRequest request) {
try {
// 获取文件 文档类型,目前支持pdf,doc,docx,wps,txt,jpg,jpeg,png,bmp,tif格式
String suffix = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1);
......@@ -446,24 +445,8 @@ public class ZpglController {
if("pdf,doc,docx,wps,txt,jpg,jpeg,png,bmp,tif".indexOf(suffix) == -1){
return ResultUtil.error("导入简历失败,目前支持pdf,doc,docx,wps,txt,jpg,jpeg,png,bmp,tif格式~");
}
BaiduTicResumeDto baiduTicResumeDto = BaiduTicResumeDto.builder().filename(file.getOriginalFilename()).filetype(suffix).filedata(Base64.getStrFromPath(file)).build();
ResponseEntity<String> resumeString = baiduTicUtil.getResumeByCvParser(baiduTicResumeDto);
JSONObject json = (JSONObject) JSONObject.parse(resumeString.getBody());
log.info("招聘-导入候选人简历{}",resumeString.getBody());
if("success".equals(json.get("error_msg"))){
if("results".equals(json.get("results"))){
ResumeExtract resumeExtract = JSONObject.toJavaObject(JSONObject.parse(json.get("results").toString()), ResumeExtract.class);
}else {
return ResultUtil.error("导入简历失败,请检查是否为简历文件~");
}
}else {
return ResultUtil.error("导入简历失败,请检查是否为简历文件~");
}
return ResultUtil.success("操作成功");
// return ZpglRcxx.builder().build().updateById()?ResultUtil.success("操作成功"):ResultUtil.error("操作失败");
boolean flag = zpglService.addResumeImportCandidate(userBean, file, importCandidateDto);
return flag?ResultUtil.success("操作成功"):ResultUtil.error("操作失败");
} catch (Exception e) {
e.printStackTrace();
throw new CustomException("招聘-导入候选人简历失败");
......
......@@ -3,7 +3,9 @@ package cn.timer.api.controller.zpgl.sevice;
import cn.timer.api.bean.clazz.SysRegion;
import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.dto.zpgl.ImportCandidateDto;
import cn.timer.api.dto.zpgl.ZpglRcxxDto;
import org.springframework.web.multipart.MultipartFile;
/**
* @author wuqingjun
......@@ -26,5 +28,12 @@ public interface ZpglService {
*/
SysRegion getSysRegion(Integer keyId);
/**
*
* @param file
* @return
*/
boolean addResumeImportCandidate(UserBean userBean, MultipartFile file, ImportCandidateDto importCandidateDto);
}
......@@ -7,12 +7,23 @@ import cn.timer.api.bean.zpgl.ZpglMslcLog;
import cn.timer.api.bean.zpgl.ZpglRcxx;
import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.config.enuminterface.JxglEnumInterface;
import cn.timer.api.config.exception.CustomException;
import cn.timer.api.dto.baidu.BaiduTicResumeDto;
import cn.timer.api.dto.baidu.ResumeExtract;
import cn.timer.api.dto.zpgl.ImportCandidateDto;
import cn.timer.api.dto.zpgl.ZpglRcxxDto;
import cn.timer.api.utils.ResultUtil;
import cn.timer.api.utils.ZpglMessageTemplate;
import cn.timer.api.utils.baidu.BaiduTicUtil;
import cn.timer.api.utils.baidu.Base64;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import org.springframework.web.multipart.MultipartFile;
import javax.transaction.Transactional;
import java.text.SimpleDateFormat;
......@@ -23,11 +34,15 @@ import java.util.Date;
* @email 284718418@qq.com
* @date 2022/3/18
*/
@Slf4j
@Service
@Transactional(rollbackOn = Exception.class)
public class ZpglServiceImpl implements ZpglService {
@Autowired
private BaiduTicUtil baiduTicUtil;
@Autowired
private ZpglMslcLogService zpglMslcLogService;
......@@ -137,4 +152,23 @@ public class ZpglServiceImpl implements ZpglService {
SysRegion::getRegionName, SysRegion::getKeyId, SysRegion::getZipCode,
SysRegion::getRegionCode));
}
@Override
public boolean addResumeImportCandidate(UserBean userBean, MultipartFile file, ImportCandidateDto importCandidateDto) {
BaiduTicResumeDto baiduTicResumeDto = BaiduTicResumeDto.builder().filename(file.getOriginalFilename()).filetype(importCandidateDto.getSuffix()).filedata(Base64.getStrFromPath(file)).build();
ResponseEntity<String> resumeString = baiduTicUtil.getResumeByCvParser(baiduTicResumeDto);
JSONObject json = (JSONObject) JSONObject.parse(resumeString.getBody());
log.info("招聘-导入候选人简历{}",resumeString.getBody());
if("success".equals(json.get("error_msg"))){
if("results".equals(json.get("results"))){
JSONObject jsonObject = (JSONObject)JSONObject.parse(json.get("results").toString());
ResumeExtract resumeExtract = JSONObject.toJavaObject(jsonObject, ResumeExtract.class);
}else {
throw new CustomException("导入简历失败,请检查是否为简历文件~");
}
}else {
throw new CustomException("导入简历失败,请检查是否为简历文件~");
}
return false;
}
}
......@@ -23,7 +23,7 @@ public class WorkInfo implements Serializable {
private String department; // 部门名称/所在部门
private String location; // 工作城市/工作地点
private String job; // 职位名称
private String package; // 该岗位工资水平,如,3000-5000元/月,输出为原文
//private String package; // 该岗位工资水平,如,3000-5000元/月,输出为原文
private String start_time; // 开始年份-月份,若只有年则只输出年。如2019-10或2019
private String end_time; // 结束年份-月份,若只有年则只输出年。如2019-10或2019
private String is_in; // 是否仍在:1表示在,0表示不在
......
package cn.timer.api.dto.zpgl;
import cn.timer.api.config.exception.ValidationMsg;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* 导入候选人
* @author wuqingjun
* @email 284718418@qq.com
* @date 2022-3-31 10:05:49
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ImportCandidateDto implements Serializable{
private static final long serialVersionUID = -1230023773946171911L;
/**
* 职位信息Id
*/
@NotNull(message = ValidationMsg.NOTNULL)
@ApiModelProperty(value = "职位信息Id")
private Integer id;
/**
* 状态 1:待初筛 2:初筛通过 3:已安排面试 4:已面试 5:面试通过 6:拟录用 7:已发Offer 8:待入职 9已淘汰 10已入职
*/
@ApiModelProperty(value = "状态 1:待初筛 2:初筛通过 3:已安排面试 4:已面试 5:面试通过 6:拟录用 7:已发Offer 8:待入职 9已淘汰 10已入职")
private Integer status;
/**
* 招聘渠道ID
*/
@ApiModelProperty(value = "招聘渠道ID")
private Integer zpglZpqdId;
/**
* 获取文件 文档类型,目前支持pdf,doc,docx,wps,txt,jpg,jpeg,png,bmp,tif格式
*/
@ApiModelProperty(value = "文档类型,目前支持pdf,doc,docx,wps,txt,jpg,jpeg,png,bmp,tif格式")
private String suffix;
}
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