简历解析业务逻辑处理
This commit is contained in:
@@ -96,4 +96,17 @@ public class HotakeCvInfoController extends BaseController
|
|||||||
{
|
{
|
||||||
return R.ok(hotakeCvInfoService.deleteHotakeCvInfoById(id));
|
return R.ok(hotakeCvInfoService.deleteHotakeCvInfoById(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 简历解析以及生成问题和评分
|
||||||
|
*/
|
||||||
|
@ApiOperation("简历解析以及生成问题和评分")
|
||||||
|
@Log(title = "简历解析以及生成问题和评分", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/analysis")
|
||||||
|
public R<HotakeCvInfo> handleCvAnalysis(@RequestBody HotakeCvInfo hotakeCvInfo)
|
||||||
|
{
|
||||||
|
return R.ok(hotakeCvInfoService.handleCvAnalysis(hotakeCvInfo));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,6 +53,12 @@ public class HotakeCvInfo extends BaseEntity
|
|||||||
@Excel(name = "状态", readConverterExp = "0=,禁=用,1,启=用")
|
@Excel(name = "状态", readConverterExp = "0=,禁=用,1,启=用")
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
|
@ApiModelProperty("简历模版Json")
|
||||||
|
private String cvTemplateJson;
|
||||||
|
|
||||||
|
@ApiModelProperty("简历评分以及说明")
|
||||||
|
private String cvScore;
|
||||||
|
|
||||||
@ApiModelProperty("简历详细信息-固定模版")
|
@ApiModelProperty("简历详细信息-固定模版")
|
||||||
private HotakeCvInfoDto cvInfoDto;
|
private HotakeCvInfoDto cvInfoDto;
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,9 @@ public class HotakeProblemBaseInfo extends BaseEntity
|
|||||||
@Excel(name = "用户ID")
|
@Excel(name = "用户ID")
|
||||||
private Long userId;
|
private Long userId;
|
||||||
|
|
||||||
|
@ApiModelProperty("简历ID")
|
||||||
|
private Long cvId;
|
||||||
|
|
||||||
/** 问题 */
|
/** 问题 */
|
||||||
@ApiModelProperty("问题")
|
@ApiModelProperty("问题")
|
||||||
@Excel(name = "问题")
|
@Excel(name = "问题")
|
||||||
|
|||||||
@@ -23,6 +23,10 @@ public class HotakeCvInfoDto {
|
|||||||
private String phone;
|
private String phone;
|
||||||
@ApiModelProperty("邮箱")
|
@ApiModelProperty("邮箱")
|
||||||
private String email;
|
private String email;
|
||||||
|
@ApiModelProperty("岗位")
|
||||||
|
private String position;
|
||||||
|
@ApiModelProperty("地点")
|
||||||
|
private String location;
|
||||||
@ApiModelProperty("链接对象集合")
|
@ApiModelProperty("链接对象集合")
|
||||||
private List<VcLinksDto> linksList;
|
private List<VcLinksDto> linksList;
|
||||||
@ApiModelProperty("自我介绍")
|
@ApiModelProperty("自我介绍")
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.vetti.hotake.mapper;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.vetti.hotake.domain.HotakeProblemBaseInfo;
|
import com.vetti.hotake.domain.HotakeProblemBaseInfo;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 面试者问题库信息Mapper接口
|
* 面试者问题库信息Mapper接口
|
||||||
@@ -72,6 +73,6 @@ public interface HotakeProblemBaseInfoMapper
|
|||||||
* @param userId 面试者ID
|
* @param userId 面试者ID
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteHotakeProblemBaseInfoByUserId(Long userId);
|
public int deleteHotakeProblemBaseInfoByUserId(@Param("userId") Long userId,@Param("cvId") Long cvId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public interface IHotakeCvInfoService
|
|||||||
* @param cvInfoDto 简历信息
|
* @param cvInfoDto 简历信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public HotakeProblemBaseInfo handleHotakeCvInfo(HotakeCvInfoDto cvInfoDto);
|
public HotakeProblemBaseInfo handleHotakeCvInfo(HotakeCvInfoDto cvInfoDto,Long cvId);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -78,4 +78,13 @@ public interface IHotakeCvInfoService
|
|||||||
*/
|
*/
|
||||||
public int batchInsertHotakeCvInfo(List<HotakeCvInfo> hotakeCvInfoList);
|
public int batchInsertHotakeCvInfo(List<HotakeCvInfo> hotakeCvInfoList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 简历解析以及生成问题和评分
|
||||||
|
*
|
||||||
|
* @param hotakeCvInfo 简历信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public HotakeCvInfo handleCvAnalysis(HotakeCvInfo hotakeCvInfo);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,6 +73,6 @@ public interface IHotakeProblemBaseInfoService
|
|||||||
* @param userId 面试者用户ID
|
* @param userId 面试者用户ID
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteHotakeProblemBaseInfoByUserId(Long userId);
|
public int deleteHotakeProblemBaseInfoByUserId(Long userId,Long cvId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.vetti.hotake.service.impl;
|
package com.vetti.hotake.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.io.FileUtil;
|
import cn.hutool.core.io.FileUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
@@ -7,7 +8,6 @@ import com.vetti.common.ai.gpt.ChatGPTClient;
|
|||||||
import com.vetti.common.core.service.BaseServiceImpl;
|
import com.vetti.common.core.service.BaseServiceImpl;
|
||||||
import com.vetti.common.enums.FillTypeEnum;
|
import com.vetti.common.enums.FillTypeEnum;
|
||||||
import com.vetti.common.enums.MinioBucketNameEnum;
|
import com.vetti.common.enums.MinioBucketNameEnum;
|
||||||
import com.vetti.common.utils.DateUtils;
|
|
||||||
import com.vetti.common.utils.SecurityUtils;
|
import com.vetti.common.utils.SecurityUtils;
|
||||||
import com.vetti.common.utils.readFile.FileContentUtil;
|
import com.vetti.common.utils.readFile.FileContentUtil;
|
||||||
import com.vetti.hotake.domain.HotakeCvInfo;
|
import com.vetti.hotake.domain.HotakeCvInfo;
|
||||||
@@ -38,15 +38,13 @@ import java.util.Map;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@SuppressWarnings("all")
|
@SuppressWarnings("all")
|
||||||
@Service
|
@Service
|
||||||
public class HotakeCvInfoServiceImpl extends BaseServiceImpl implements IHotakeCvInfoService
|
public class HotakeCvInfoServiceImpl extends BaseServiceImpl implements IHotakeCvInfoService {
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 问题前缀
|
* 问题前缀
|
||||||
*/
|
*/
|
||||||
private final String QUESTION_PREFIX = "Question:";
|
private final String QUESTION_PREFIX = "Question:";
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private HotakeCvInfoMapper hotakeCvInfoMapper;
|
private HotakeCvInfoMapper hotakeCvInfoMapper;
|
||||||
|
|
||||||
@@ -59,8 +57,6 @@ public class HotakeCvInfoServiceImpl extends BaseServiceImpl implements IHotakeC
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IHotakeProblemBaseInfoService hotakeProblemBaseInfoService;
|
private IHotakeProblemBaseInfoService hotakeProblemBaseInfoService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询简历信息
|
* 查询简历信息
|
||||||
*
|
*
|
||||||
@@ -69,9 +65,17 @@ public class HotakeCvInfoServiceImpl extends BaseServiceImpl implements IHotakeC
|
|||||||
*/
|
*/
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
@Override
|
@Override
|
||||||
public HotakeCvInfo selectHotakeCvInfoById(Long id)
|
public HotakeCvInfo selectHotakeCvInfoById(Long id) {
|
||||||
{
|
HotakeCvInfo cvInfo = hotakeCvInfoMapper.selectHotakeCvInfoById(id);
|
||||||
return hotakeCvInfoMapper.selectHotakeCvInfoById(id);
|
HotakeCvInfoDto cvInfoDto = JSONUtil.toBean(cvInfo.getCvTemplateJson(),HotakeCvInfoDto.class);
|
||||||
|
cvInfo.setCvInfoDto(cvInfoDto);
|
||||||
|
HotakeProblemBaseInfo query = new HotakeProblemBaseInfo();
|
||||||
|
query.setCvId(id);
|
||||||
|
List<HotakeProblemBaseInfo> problemBaseInfoList = hotakeProblemBaseInfoService.selectHotakeProblemBaseInfoList(query);
|
||||||
|
if(CollectionUtil.isNotEmpty(problemBaseInfoList)){
|
||||||
|
cvInfo.setProblemBaseInfo(problemBaseInfoList.get(0));
|
||||||
|
}
|
||||||
|
return cvInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -82,9 +86,16 @@ public class HotakeCvInfoServiceImpl extends BaseServiceImpl implements IHotakeC
|
|||||||
*/
|
*/
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
@Override
|
@Override
|
||||||
public List<HotakeCvInfo> selectHotakeCvInfoList(HotakeCvInfo hotakeCvInfo)
|
public List<HotakeCvInfo> selectHotakeCvInfoList(HotakeCvInfo hotakeCvInfo) {
|
||||||
{
|
List<HotakeCvInfo> cvInfoList = hotakeCvInfoMapper.selectHotakeCvInfoList(hotakeCvInfo);
|
||||||
return hotakeCvInfoMapper.selectHotakeCvInfoList(hotakeCvInfo);
|
if(CollectionUtil.isNotEmpty(cvInfoList)){
|
||||||
|
for(HotakeCvInfo cvInfo : cvInfoList){
|
||||||
|
HotakeCvInfoDto cvInfoDto = JSONUtil.toBean(cvInfo.getCvTemplateJson(),HotakeCvInfoDto.class);
|
||||||
|
cvInfo.setCvInfoDto(cvInfoDto);
|
||||||
|
//返回问题记录
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return cvInfoList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -93,82 +104,64 @@ public class HotakeCvInfoServiceImpl extends BaseServiceImpl implements IHotakeC
|
|||||||
* @param hotakeCvInfo 简历信息
|
* @param hotakeCvInfo 简历信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Transactional(rollbackFor=Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@Override
|
@Override
|
||||||
public HotakeCvInfo insertHotakeCvInfo(HotakeCvInfo hotakeCvInfo)
|
public HotakeCvInfo insertHotakeCvInfo(HotakeCvInfo hotakeCvInfo) {
|
||||||
{
|
fill(FillTypeEnum.INSERT.getCode(), hotakeCvInfo);
|
||||||
fill(FillTypeEnum.INSERT.getCode(),hotakeCvInfo);
|
|
||||||
hotakeCvInfoMapper.insertHotakeCvInfo(hotakeCvInfo);
|
|
||||||
//获取文件后缀
|
|
||||||
String fileSuffix = FileUtil.getSuffix(hotakeCvInfo.getCvUrl());
|
String fileSuffix = FileUtil.getSuffix(hotakeCvInfo.getCvUrl());
|
||||||
if(StrUtil.isNotEmpty(fileSuffix)){
|
if (StrUtil.isNotEmpty(fileSuffix)) {
|
||||||
fileSuffix = fileSuffix.toLowerCase();
|
fileSuffix = fileSuffix.toLowerCase();
|
||||||
}
|
}
|
||||||
hotakeCvInfo.setCvFileSuffix(fileSuffix);
|
hotakeCvInfo.setCvFileSuffix(fileSuffix);
|
||||||
if("cv".equals(hotakeCvInfo.getCvFileType())){
|
hotakeCvInfoMapper.insertHotakeCvInfo(hotakeCvInfo);
|
||||||
try{
|
|
||||||
InputStream inputStream = minioClient.getObject(
|
|
||||||
GetObjectArgs.builder()
|
|
||||||
.bucket(MinioBucketNameEnum.CV.getCode())
|
|
||||||
.object(hotakeCvInfo.getCvUrl())
|
|
||||||
.build());
|
|
||||||
String contents = FileContentUtil.readFileContent(inputStream,hotakeCvInfo.getCvFileSuffix());
|
|
||||||
//生成简历模版数据信息
|
|
||||||
HotakeCvInfoDto cvInfoDto = handleAnalysisCvInfo(contents);
|
|
||||||
hotakeCvInfo.setCvInfoDto(cvInfoDto);
|
|
||||||
//对简历数据进行处理生成相应的题库数据
|
|
||||||
HotakeProblemBaseInfo problemBaseInfo = handleHotakeCvInfo(cvInfoDto);
|
|
||||||
hotakeCvInfo.setProblemBaseInfo(problemBaseInfo);
|
|
||||||
//生成对应的简历评分
|
|
||||||
handleHotakeCvInfoScore(cvInfoDto);
|
|
||||||
}catch (Exception e){
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return hotakeCvInfo;
|
return hotakeCvInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理简历信息
|
* 处理简历信息
|
||||||
|
*
|
||||||
* @param hotakeCvInfo 简历信息
|
* @param hotakeCvInfo 简历信息
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public HotakeProblemBaseInfo handleHotakeCvInfo(HotakeCvInfoDto cvInfoDto) {
|
public HotakeProblemBaseInfo handleHotakeCvInfo(HotakeCvInfoDto cvInfoDto,Long cvId) {
|
||||||
|
log.info("处理简历信息");
|
||||||
HotakeProblemBaseInfo problemBaseInfo = new HotakeProblemBaseInfo();
|
HotakeProblemBaseInfo problemBaseInfo = new HotakeProblemBaseInfo();
|
||||||
try{
|
try {
|
||||||
//调用AI大模型
|
//调用AI大模型
|
||||||
List<Map<String,String>> list = new LinkedList();
|
List<Map<String, String>> list = new LinkedList();
|
||||||
Map<String,String> mapEntity = new HashMap<>();
|
Map<String, String> mapEntity = new HashMap<>();
|
||||||
mapEntity.put("role","system");
|
mapEntity.put("role", "system");
|
||||||
mapEntity.put("content","You are an experienced interviewer for construction management positions. Generate targeted interview questions based on candidate resumes.");
|
mapEntity.put("content", "You are an experienced interviewer for construction management positions. Generate targeted interview questions based on candidate resumes.");
|
||||||
list.add(mapEntity);
|
list.add(mapEntity);
|
||||||
Map<String,String> mapEntityOne = new HashMap<>();
|
Map<String, String> mapEntityOne = new HashMap<>();
|
||||||
mapEntityOne.put("role","user");
|
mapEntityOne.put("role", "user");
|
||||||
mapEntityOne.put("content","Position: Construction Labourer"+
|
mapEntityOne.put("content", "Position: Construction Labourer" +
|
||||||
"\\nCandidate: "+cvInfoDto.getName()+
|
"\\nCandidate: " + cvInfoDto.getName() +
|
||||||
"\\nKey Skills: "+JSONUtil.toJsonStr(cvInfoDto.getSkillsToolsList())+
|
"\\nKey Skills: " + JSONUtil.toJsonStr(cvInfoDto.getSkillsToolsList()) +
|
||||||
"\\nExperience: "+JSONUtil.toJsonStr(cvInfoDto.getExperienceList())+
|
"\\nExperience: " + JSONUtil.toJsonStr(cvInfoDto.getExperienceList()) +
|
||||||
"\\nStrengths: Professional certifications, Relevant experience"+
|
"\\nStrengths: Professional certifications, Relevant experience" +
|
||||||
"\\nConcerns: "+JSONUtil.toJsonStr(cvInfoDto.getAbout()));
|
"\\nConcerns: " + JSONUtil.toJsonStr(cvInfoDto.getAbout()));
|
||||||
list.add(mapEntityOne);
|
list.add(mapEntityOne);
|
||||||
String promptText = JSONUtil.toJsonStr(list);
|
String promptText = JSONUtil.toJsonStr(list);
|
||||||
String resultMsg = chatGPTClient.handleAiChat(promptText,"CV");
|
String resultMsg = chatGPTClient.handleAiChat(promptText, "CV");
|
||||||
log.info("返回简历问题数据:{}",resultMsg);
|
log.info("返回简历问题数据:{}", resultMsg);
|
||||||
resultMsg = resultMsg.replaceAll("\n","#AA#");
|
resultMsg = resultMsg.replaceAll("\n", "#AA#");
|
||||||
String question = "";
|
String question = "";
|
||||||
Integer questionNums = 0;
|
Integer questionNums = 0;
|
||||||
if(StrUtil.isNotEmpty(resultMsg)){
|
if (StrUtil.isNotEmpty(resultMsg)) {
|
||||||
resultMsg = resultMsg.replaceAll(QUESTION_PREFIX,"");
|
resultMsg = resultMsg.replaceAll(QUESTION_PREFIX, "");
|
||||||
questionNums = resultMsg.split("#AA#").length;
|
questionNums = resultMsg.split("#AA#").length;
|
||||||
}
|
}
|
||||||
//生成预设问题记录
|
//生成预设问题记录
|
||||||
//先删除该用户的预设问题
|
//先删除该用户的预设问题
|
||||||
hotakeProblemBaseInfoService.deleteHotakeProblemBaseInfoByUserId(SecurityUtils.getUserId());
|
hotakeProblemBaseInfoService.deleteHotakeProblemBaseInfoByUserId(SecurityUtils.getUserId(),cvId);
|
||||||
problemBaseInfo.setUserId(SecurityUtils.getUserId());
|
problemBaseInfo.setUserId(SecurityUtils.getUserId());
|
||||||
problemBaseInfo.setContents(resultMsg);
|
problemBaseInfo.setContents(resultMsg);
|
||||||
problemBaseInfo.setQuestionNums(questionNums);
|
problemBaseInfo.setQuestionNums(questionNums);
|
||||||
|
problemBaseInfo.setCvId(cvId);
|
||||||
hotakeProblemBaseInfoService.insertHotakeProblemBaseInfo(problemBaseInfo);
|
hotakeProblemBaseInfoService.insertHotakeProblemBaseInfo(problemBaseInfo);
|
||||||
}catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return problemBaseInfo;
|
return problemBaseInfo;
|
||||||
@@ -181,11 +174,12 @@ public class HotakeCvInfoServiceImpl extends BaseServiceImpl implements IHotakeC
|
|||||||
* @param hotakeCvInfo 简历信息
|
* @param hotakeCvInfo 简历信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Transactional(rollbackFor=Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@Override
|
@Override
|
||||||
public HotakeCvInfo updateHotakeCvInfo(HotakeCvInfo hotakeCvInfo)
|
public HotakeCvInfo updateHotakeCvInfo(HotakeCvInfo hotakeCvInfo) {
|
||||||
{
|
fill(FillTypeEnum.UPDATE.getCode(), hotakeCvInfo);
|
||||||
hotakeCvInfo.setUpdateTime(DateUtils.getNowDate());
|
|
||||||
|
hotakeCvInfo.setCvTemplateJson(JSONUtil.toJsonStr(hotakeCvInfo.getCvInfoDto()));
|
||||||
hotakeCvInfoMapper.updateHotakeCvInfo(hotakeCvInfo);
|
hotakeCvInfoMapper.updateHotakeCvInfo(hotakeCvInfo);
|
||||||
return hotakeCvInfo;
|
return hotakeCvInfo;
|
||||||
}
|
}
|
||||||
@@ -196,10 +190,9 @@ public class HotakeCvInfoServiceImpl extends BaseServiceImpl implements IHotakeC
|
|||||||
* @param ids 需要删除的简历信息主键
|
* @param ids 需要删除的简历信息主键
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Transactional(rollbackFor=Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@Override
|
@Override
|
||||||
public int deleteHotakeCvInfoByIds(Long[] ids)
|
public int deleteHotakeCvInfoByIds(Long[] ids) {
|
||||||
{
|
|
||||||
return hotakeCvInfoMapper.deleteHotakeCvInfoByIds(ids);
|
return hotakeCvInfoMapper.deleteHotakeCvInfoByIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,43 +202,82 @@ public class HotakeCvInfoServiceImpl extends BaseServiceImpl implements IHotakeC
|
|||||||
* @param id 简历信息主键
|
* @param id 简历信息主键
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Transactional(rollbackFor=Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@Override
|
@Override
|
||||||
public int deleteHotakeCvInfoById(Long id)
|
public int deleteHotakeCvInfoById(Long id) {
|
||||||
{
|
|
||||||
return hotakeCvInfoMapper.deleteHotakeCvInfoById(id);
|
return hotakeCvInfoMapper.deleteHotakeCvInfoById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量新增简历信息
|
* 批量新增简历信息
|
||||||
*
|
*
|
||||||
* @param hotakeCvInfoList 简历信息列表
|
* @param hotakeCvInfoList 简历信息列表
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Transactional(rollbackFor=Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@Override
|
@Override
|
||||||
public int batchInsertHotakeCvInfo(List<HotakeCvInfo> hotakeCvInfoList){
|
public int batchInsertHotakeCvInfo(List<HotakeCvInfo> hotakeCvInfoList) {
|
||||||
return hotakeCvInfoMapper.batchInsertHotakeCvInfo(hotakeCvInfoList);
|
return hotakeCvInfoMapper.batchInsertHotakeCvInfo(hotakeCvInfoList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 简历解析以及生成问题和评分
|
||||||
|
* @param hotakeCvInfo 简历信息
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public HotakeCvInfo handleCvAnalysis(HotakeCvInfo hotakeCvInfo) {
|
||||||
|
HotakeCvInfo cvInfo = selectHotakeCvInfoById(hotakeCvInfo.getId());
|
||||||
|
if ("cv".equals(cvInfo.getCvFileType())) {
|
||||||
|
log.info("开始处理简历");
|
||||||
|
try {
|
||||||
|
InputStream inputStream = minioClient.getObject(
|
||||||
|
GetObjectArgs.builder()
|
||||||
|
.bucket(MinioBucketNameEnum.CV.getCode())
|
||||||
|
.object(cvInfo.getCvUrl())
|
||||||
|
.build());
|
||||||
|
String contents = FileContentUtil.readFileContent(inputStream, cvInfo.getCvFileSuffix());
|
||||||
|
//生成简历模版数据信息
|
||||||
|
HotakeCvInfoDto cvInfoDto = handleAnalysisCvInfo(contents);
|
||||||
|
cvInfo.setCvInfoDto(cvInfoDto);
|
||||||
|
//对简历数据进行处理生成相应的题库数据
|
||||||
|
HotakeProblemBaseInfo problemBaseInfo = handleHotakeCvInfo(cvInfoDto,hotakeCvInfo.getId());
|
||||||
|
cvInfo.setProblemBaseInfo(problemBaseInfo);
|
||||||
|
//生成对应的简历评分
|
||||||
|
String resultMsg = handleHotakeCvInfoScore(cvInfoDto);
|
||||||
|
cvInfo.setScore(resultMsg);
|
||||||
|
cvInfo.setCvTemplateJson(JSONUtil.toJsonStr(cvInfoDto));
|
||||||
|
fill(FillTypeEnum.UPDATE.getCode(), cvInfo);
|
||||||
|
hotakeCvInfoMapper.updateHotakeCvInfo(cvInfo);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return cvInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 简历解析数据
|
* 简历解析数据
|
||||||
|
*
|
||||||
* @param contents
|
* @param contents
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private HotakeCvInfoDto handleAnalysisCvInfo(String contents){
|
private HotakeCvInfoDto handleAnalysisCvInfo(String contents) {
|
||||||
|
log.info("开始简历解析");
|
||||||
|
try {
|
||||||
|
List<Map<String,String>> list = new LinkedList();
|
||||||
|
Map<String,String> entity = new HashMap<>();
|
||||||
|
entity.put("role","user");
|
||||||
|
entity.put("content","从下面提供的文本中提取所有能识别到的简历信息,只提取原文中存在的内容,不要补充、不推测、不总结。需要提取的字段包括:name(姓名)、phone(电话号码)、position(岗位)、location(地点)、email(电子邮件地址)、links(所有链接地址)、about(关于我/自我介绍)、skills_tools(关键资格(许可证、注册/会员资格、认证))、languages(语言能力)、experience(工作经历(除了title、company、location、duration其他的都放到描述里面))、education(教育经历)。请将提取结果以结构化 JSON 格式返回,格式如下:{ \\\"name\\\": \\\"\\\", \\\"phone\\\": \\\"\\\", \\\"position\\\": \\\"\\\", \\\"location\\\": \\\"\\\", \\\"email\\\": \\\"\\\", \\\"links\\\": [], \\\"about\\\": \\\"\\\", \\\"skills_tools\\\": [], \\\"languages\\\": [], \\\"experience\\\": [{\\\"title\\\": \\\"\\\", \\\"company\\\": \\\"\\\",\\\"location\\\": \\\"\\\",\\\"duration\\\": \\\"\\\",\\\"description\\\": []}], \\\"education\\\": [{\\\"degree\\\": \\\"\\\",\\\"institution\\\": \\\"\\\",\\\"date\\\": \\\"\\\"}] }。字段不存在则返回 null 或空数组。只返回标准可解析的 JSON结构 ,不要多余的```json等信息,不要解释说明,不要改写内容。以下为待处理文本:"+contents);
|
||||||
//根据AI做
|
//根据AI做
|
||||||
String pom = "[\n" +
|
list.add(entity);
|
||||||
" {\n" +
|
String resultCv = chatGPTClient.handleAiChat(JSONUtil.toJsonStr(list), "JX");
|
||||||
" \"role\": \"user\",\n" +
|
log.info("开始返回简历解析结果:{}", resultCv);
|
||||||
" \"content\": \"从下面提供的文本中提取所有能识别到的简历信息,只提取原文中存在的内容,不要补充、不推测、不总结。需要提取的字段包括:name(姓名)、phone(电话号码)、email(电子邮件地址)、links(所有链接地址)、about(关于我/自我介绍)、skills_tools(关键资格(许可证、注册/会员资格、认证))、languages(语言能力)、experience(工作经历(除了title、company、location、duration其他的都放到描述里面))、education(教育经历)。请将提取结果以结构化 JSON 格式返回,格式如下:{ \\\"name\\\": \\\"\\\", \\\"phone\\\": \\\"\\\", \\\"email\\\": \\\"\\\", \\\"links\\\": [], \\\"about\\\": \\\"\\\", \\\"skills_tools\\\": [], \\\"languages\\\": [], \\\"experience\\\": [{\\\"title\\\": \\\"\\\", \\\"company\\\": \\\"\\\",\\\"location\\\": \\\"\\\",\\\"duration\\\": \\\"\\\",\\\"description\\\": []}], \\\"education\\\": [{\\\"degree\\\": \\\"\\\",\\\"institution\\\": \\\"\\\",\\\"date\\\": \\\"\\\"}] }。字段不存在则返回 null 或空数组。只返回标准可解析的 JSON结构 ,不要多余的```json等信息,不要解释说明,不要改写内容。以下为待处理文本:" + contents +
|
HotakeCvInfoDto cvInfoDto = JSONUtil.toBean(resultCv, HotakeCvInfoDto.class);
|
||||||
" }\n" +
|
|
||||||
"]";
|
|
||||||
String resultCv = chatGPTClient.handleAiChat(pom,"JX");
|
|
||||||
try{
|
|
||||||
HotakeCvInfoDto cvInfoDto = JSONUtil.toBean(resultCv,HotakeCvInfoDto.class);
|
|
||||||
return cvInfoDto;
|
return cvInfoDto;
|
||||||
}catch (Exception e){
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return new HotakeCvInfoDto();
|
return new HotakeCvInfoDto();
|
||||||
}
|
}
|
||||||
@@ -253,36 +285,36 @@ public class HotakeCvInfoServiceImpl extends BaseServiceImpl implements IHotakeC
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理简历信息
|
* 处理简历信息
|
||||||
|
*
|
||||||
* @param hotakeCvInfo 简历信息
|
* @param hotakeCvInfo 简历信息
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private HotakeProblemBaseInfo handleHotakeCvInfoScore(HotakeCvInfoDto cvInfoDto) {
|
private String handleHotakeCvInfoScore(HotakeCvInfoDto cvInfoDto) {
|
||||||
HotakeProblemBaseInfo problemBaseInfo = new HotakeProblemBaseInfo();
|
String resultMsg = "";
|
||||||
try{
|
try {
|
||||||
//调用AI大模型
|
//调用AI大模型
|
||||||
List<Map<String,String>> list = new LinkedList();
|
List<Map<String, String>> list = new LinkedList();
|
||||||
Map<String,String> mapEntity = new HashMap<>();
|
Map<String, String> mapEntity = new HashMap<>();
|
||||||
mapEntity.put("role","system");
|
mapEntity.put("role", "system");
|
||||||
mapEntity.put("content","You are a construction industry HR expert. Evaluate resumes and provide scores and recommendations for construction management positions.");
|
mapEntity.put("content", "You are a construction industry HR expert. Evaluate resumes and provide scores and recommendations for construction management positions.");
|
||||||
list.add(mapEntity);
|
list.add(mapEntity);
|
||||||
Map<String,String> mapEntityOne = new HashMap<>();
|
Map<String, String> mapEntityOne = new HashMap<>();
|
||||||
mapEntityOne.put("role","user");
|
mapEntityOne.put("role", "user");
|
||||||
mapEntityOne.put("content","Position: Construction Labourer"+
|
mapEntityOne.put("content", "Position: Construction Labourer" +
|
||||||
"\\nCandidate: "+cvInfoDto.getName()+
|
"\\nCandidate: " + cvInfoDto.getName() +
|
||||||
"\\nResume Summary: "+JSONUtil.toJsonStr(cvInfoDto.getAbout())+
|
"\\nResume Summary: " + JSONUtil.toJsonStr(cvInfoDto.getAbout()) +
|
||||||
"\\nSkills: "+JSONUtil.toJsonStr(cvInfoDto.getSkillsToolsList())+
|
"\\nSkills: " + JSONUtil.toJsonStr(cvInfoDto.getSkillsToolsList()) +
|
||||||
"\\nExperience: "+JSONUtil.toJsonStr(cvInfoDto.getExperienceList())+
|
"\\nExperience: " + JSONUtil.toJsonStr(cvInfoDto.getExperienceList()) +
|
||||||
"\\nEducation: "+JSONUtil.toJsonStr(cvInfoDto.getEducationList())+
|
"\\nEducation: " + JSONUtil.toJsonStr(cvInfoDto.getEducationList()) +
|
||||||
"\\nCertifications: "+JSONUtil.toJsonStr(cvInfoDto.getSkillsToolsList()));
|
"\\nCertifications: " + JSONUtil.toJsonStr(cvInfoDto.getSkillsToolsList()));
|
||||||
list.add(mapEntityOne);
|
list.add(mapEntityOne);
|
||||||
String promptText = JSONUtil.toJsonStr(list);
|
String promptText = JSONUtil.toJsonStr(list);
|
||||||
String resultMsg = chatGPTClient.handleAiChat(promptText,"CV");
|
resultMsg = chatGPTClient.handleAiChat(promptText, "CV");
|
||||||
log.info("返回简历评分数据:{}",resultMsg);
|
log.info("返回简历评分数据:{}", resultMsg);
|
||||||
|
} catch (Exception e) {
|
||||||
}catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return problemBaseInfo;
|
return resultMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,8 +123,8 @@ public class HotakeProblemBaseInfoServiceImpl extends BaseServiceImpl implements
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteHotakeProblemBaseInfoByUserId(Long userId) {
|
public int deleteHotakeProblemBaseInfoByUserId(Long userId,Long cvId) {
|
||||||
|
|
||||||
return hotakeProblemBaseInfoMapper.deleteHotakeProblemBaseInfoByUserId(userId);
|
return hotakeProblemBaseInfoMapper.deleteHotakeProblemBaseInfoByUserId(userId,cvId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="fileSizeShow" column="file_size_show" />
|
<result property="fileSizeShow" column="file_size_show" />
|
||||||
<result property="cvFileSuffix" column="cv_file_suffix" />
|
<result property="cvFileSuffix" column="cv_file_suffix" />
|
||||||
<result property="status" column="status" />
|
<result property="status" column="status" />
|
||||||
|
<result property="cvTemplateJson" column="cv_template_json" />
|
||||||
|
<result property="cvScore" column="cv_score" />
|
||||||
<result property="delFlag" column="del_flag" />
|
<result property="delFlag" column="del_flag" />
|
||||||
<result property="createBy" column="create_by" />
|
<result property="createBy" column="create_by" />
|
||||||
<result property="createTime" column="create_time" />
|
<result property="createTime" column="create_time" />
|
||||||
@@ -22,7 +24,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectHotakeCvInfoVo">
|
<sql id="selectHotakeCvInfoVo">
|
||||||
select id, user_id, cv_name, cv_file_type, cv_url,file_size_show,cv_file_suffix, status,
|
select id, user_id, cv_name, cv_file_type, cv_url,file_size_show,cv_file_suffix, status,cv_template_json,cv_score,
|
||||||
del_flag, create_by, create_time, update_by, update_time, remark from hotake_cv_info
|
del_flag, create_by, create_time, update_by, update_time, remark from hotake_cv_info
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
@@ -54,6 +56,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="fileSizeShow != null">file_size_show,</if>
|
<if test="fileSizeShow != null">file_size_show,</if>
|
||||||
<if test="cvFileSuffix != null">cv_file_suffix,</if>
|
<if test="cvFileSuffix != null">cv_file_suffix,</if>
|
||||||
<if test="status != null">status,</if>
|
<if test="status != null">status,</if>
|
||||||
|
<if test="cvTemplateJson != null">cv_template_json,</if>
|
||||||
|
<if test="cvScore != null">cv_score,</if>
|
||||||
<if test="delFlag != null">del_flag,</if>
|
<if test="delFlag != null">del_flag,</if>
|
||||||
<if test="createBy != null">create_by,</if>
|
<if test="createBy != null">create_by,</if>
|
||||||
<if test="createTime != null">create_time,</if>
|
<if test="createTime != null">create_time,</if>
|
||||||
@@ -69,6 +73,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="fileSizeShow != null">#{fileSizeShow},</if>
|
<if test="fileSizeShow != null">#{fileSizeShow},</if>
|
||||||
<if test="cvFileSuffix != null">#{cvFileSuffix},</if>
|
<if test="cvFileSuffix != null">#{cvFileSuffix},</if>
|
||||||
<if test="status != null">#{status},</if>
|
<if test="status != null">#{status},</if>
|
||||||
|
<if test="cvTemplateJson != null">#{cvTemplateJson},</if>
|
||||||
|
<if test="cvScore != null">#{cvScore},</if>
|
||||||
<if test="delFlag != null">#{delFlag},</if>
|
<if test="delFlag != null">#{delFlag},</if>
|
||||||
<if test="createBy != null">#{createBy},</if>
|
<if test="createBy != null">#{createBy},</if>
|
||||||
<if test="createTime != null">#{createTime},</if>
|
<if test="createTime != null">#{createTime},</if>
|
||||||
@@ -88,6 +94,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="fileSizeShow != null">file_size_show = #{fileSizeShow},</if>
|
<if test="fileSizeShow != null">file_size_show = #{fileSizeShow},</if>
|
||||||
<if test="cvFileSuffix != null">cv_file_suffix = #{cvFileSuffix},</if>
|
<if test="cvFileSuffix != null">cv_file_suffix = #{cvFileSuffix},</if>
|
||||||
<if test="status != null">status = #{status},</if>
|
<if test="status != null">status = #{status},</if>
|
||||||
|
<if test="cvTemplateJson != null">cv_template_json = #{cvTemplateJson},</if>
|
||||||
|
<if test="cvScore != null">cv_score = #{cvScore},</if>
|
||||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||||
<if test="createBy != null">create_by = #{createBy},</if>
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||||||
<if test="createTime != null">create_time = #{createTime},</if>
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<resultMap type="HotakeProblemBaseInfo" id="HotakeProblemBaseInfoResult">
|
<resultMap type="HotakeProblemBaseInfo" id="HotakeProblemBaseInfoResult">
|
||||||
<result property="id" column="id" />
|
<result property="id" column="id" />
|
||||||
<result property="userId" column="user_id" />
|
<result property="userId" column="user_id" />
|
||||||
|
<result property="cvId" column="cv_id" />
|
||||||
<result property="contents" column="contents" />
|
<result property="contents" column="contents" />
|
||||||
<result property="status" column="status" />
|
<result property="status" column="status" />
|
||||||
<result property="delFlag" column="del_flag" />
|
<result property="delFlag" column="del_flag" />
|
||||||
@@ -18,13 +19,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectHotakeProblemBaseInfoVo">
|
<sql id="selectHotakeProblemBaseInfoVo">
|
||||||
select id, user_id, contents, status, del_flag, create_by, create_time, update_by, update_time, remark from hotake_problem_base_info
|
select id, user_id,cv_id, contents, status, del_flag, create_by, create_time, update_by, update_time, remark from hotake_problem_base_info
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectHotakeProblemBaseInfoList" parameterType="HotakeProblemBaseInfo" resultMap="HotakeProblemBaseInfoResult">
|
<select id="selectHotakeProblemBaseInfoList" parameterType="HotakeProblemBaseInfo" resultMap="HotakeProblemBaseInfoResult">
|
||||||
<include refid="selectHotakeProblemBaseInfoVo"/>
|
<include refid="selectHotakeProblemBaseInfoVo"/>
|
||||||
<where>
|
<where>
|
||||||
<if test="userId != null "> and user_id = #{userId}</if>
|
<if test="userId != null "> and user_id = #{userId}</if>
|
||||||
|
<if test="cvId != null "> and cv_id = #{cvId}</if>
|
||||||
<if test="contents != null and contents != ''"> and contents = #{contents}</if>
|
<if test="contents != null and contents != ''"> and contents = #{contents}</if>
|
||||||
<if test="status != null and status != ''"> and status = #{status}</if>
|
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||||
</where>
|
</where>
|
||||||
@@ -39,6 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
insert into hotake_problem_base_info
|
insert into hotake_problem_base_info
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
<if test="userId != null">user_id,</if>
|
<if test="userId != null">user_id,</if>
|
||||||
|
<if test="cvId != null">cv_id,</if>
|
||||||
<if test="contents != null">contents,</if>
|
<if test="contents != null">contents,</if>
|
||||||
<if test="status != null">status,</if>
|
<if test="status != null">status,</if>
|
||||||
<if test="delFlag != null">del_flag,</if>
|
<if test="delFlag != null">del_flag,</if>
|
||||||
@@ -50,6 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="userId != null">#{userId},</if>
|
<if test="userId != null">#{userId},</if>
|
||||||
|
<if test="cvId != null">#{cvId},</if>
|
||||||
<if test="contents != null">#{contents},</if>
|
<if test="contents != null">#{contents},</if>
|
||||||
<if test="status != null">#{status},</if>
|
<if test="status != null">#{status},</if>
|
||||||
<if test="delFlag != null">#{delFlag},</if>
|
<if test="delFlag != null">#{delFlag},</if>
|
||||||
@@ -65,6 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
update hotake_problem_base_info
|
update hotake_problem_base_info
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
<if test="userId != null">user_id = #{userId},</if>
|
<if test="userId != null">user_id = #{userId},</if>
|
||||||
|
<if test="cvId != null">cv_id = #{cvId},</if>
|
||||||
<if test="contents != null">contents = #{contents},</if>
|
<if test="contents != null">contents = #{contents},</if>
|
||||||
<if test="status != null">status = #{status},</if>
|
<if test="status != null">status = #{status},</if>
|
||||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||||
@@ -82,7 +87,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<delete id="deleteHotakeProblemBaseInfoByUserId" parameterType="Long">
|
<delete id="deleteHotakeProblemBaseInfoByUserId" parameterType="Long">
|
||||||
delete from hotake_problem_base_info where user_id = #{userId}
|
delete from hotake_problem_base_info where user_id = #{userId} and cv_id = #{cvId}
|
||||||
|
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<delete id="deleteHotakeProblemBaseInfoByIds" parameterType="String">
|
<delete id="deleteHotakeProblemBaseInfoByIds" parameterType="String">
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
com/vetti/hotake/domain/dto/VcDto/VcExperienceDto.class
|
||||||
|
com/vetti/hotake/domain/dto/VcDto/VcSkillsToolsDto.class
|
||||||
|
com/vetti/hotake/domain/dto/VcDto/VcEducationDto.class
|
||||||
|
com/vetti/hotake/domain/dto/VcDto/VcLinksDto.class
|
||||||
|
com/vetti/hotake/domain/dto/VcDto/VcExperienceDescriptionDto.class
|
||||||
|
com/vetti/hotake/domain/dto/VcDto/VcLanguagesDto.class
|
||||||
|
|||||||
Reference in New Issue
Block a user