简历是否重新解析逻辑完善

This commit is contained in:
2025-12-06 14:14:13 +08:00
parent 01ea6956c8
commit ad2e390d87
6 changed files with 46 additions and 10 deletions

View File

@@ -59,6 +59,9 @@ public class HotakeCvInfo extends BaseEntity
@ApiModelProperty("简历评分以及说明")
private String cvScore;
@ApiModelProperty("简历内容MD5 Hash")
private String cvMd5;
@ApiModelProperty("简历详细信息-固定模版")
private HotakeCvInfoDto cvInfoDto;

View File

@@ -20,8 +20,11 @@ public class VcEducationDto {
@ApiModelProperty("学校名")
private String institution;
@ApiModelProperty("时间")
private String date;
@ApiModelProperty("开始时间")
private String durationStart;
@ApiModelProperty("结束时间")
private String durationEnd;
@ApiModelProperty("证书附件")
private VcCertificateDto certificate;

View File

@@ -25,8 +25,11 @@ public class VcExperienceDto {
@ApiModelProperty("地点")
private String location;
@ApiModelProperty("时间")
private String duration;
@ApiModelProperty("开始时间")
private String durationStart;
@ApiModelProperty("结束时间")
private String durationEnd;
@ApiModelProperty("描述集合")
private List<VcExperienceDescriptionDto> description;

View File

@@ -3,6 +3,7 @@ package com.vetti.hotake.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.digest.MD5;
import cn.hutool.json.JSONUtil;
import com.vetti.common.ai.gpt.ChatGPTClient;
import com.vetti.common.core.service.BaseServiceImpl;
@@ -246,6 +247,12 @@ public class HotakeCvInfoServiceImpl extends BaseServiceImpl implements IHotakeC
.object(cvInfo.getCvUrl())
.build());
String contents = FileContentUtil.readFileContent(inputStream, cvInfo.getCvFileSuffix());
//验证文件内容是否改变,如果未改变不进行模型解析直接返回原有结果
String md5Hash = MD5.create().digestHex16(contents);
if(StrUtil.isNotEmpty(md5Hash) && md5Hash.equals(cvInfo.getCvMd5())){
//直接返回简历结果
return cvInfo;
}
//生成简历模版数据信息
HotakeCvInfoDto cvInfoDto = handleAnalysisCvInfo(contents);
cvInfo.setCvInfoDto(cvInfoDto);
@@ -278,7 +285,7 @@ public class HotakeCvInfoServiceImpl extends BaseServiceImpl implements IHotakeC
List<Map<String,String>> list = new LinkedList();
Map<String,String> entity = new HashMap<>();
entity.put("role","user");
entity.put("content","从下面提供的文本中提取所有能识别到的简历信息只提取原文中存在的内容不要补充、不推测、不总结。需要提取的字段包括name姓名、phone电话号码、email电子邮件地址、position岗位、location地点、links所有链接地址、currentWork(当前工作公司)、about关于我/自我介绍、skills_tools关键资格许可证、注册/会员资格、认证、languages语言能力、experience工作经历(除了title、company、location、duration,其他的都放到description里面,并且description里面要根据换行符分成不同的content)、education教育经历)。请将提取结果以结构化 JSON 格式返回,格式如下:{ \\\"name\\\": \\\"\\\", \\\"phone\\\": \\\"\\\", \\\"email\\\": \\\"\\\", \\\"links\\\": [{\\\"content\\\":\\\"\\\"}], \\\"about\\\": \\\"\\\", \\\"skillsTools\\\": [{\\\"content\\\":\\\"\\\"}], \\\"languages\\\": [{\\\"content\\\":\\\"\\\"}], \\\"experience\\\": [{\\\"title\\\": \\\"\\\", \\\"company\\\": \\\"\\\",\\\"location\\\": \\\"\\\",\\\"duration\\\": \\\"\\\",\\\"description\\\": [{\\\"content\\\":\\\"\\\"}]}], \\\"education\\\": [{\\\"degree\\\": \\\"\\\",\\\"institution\\\": \\\"\\\",\\\"date\\\": \\\"\\\"}] }。字段不存在则返回 null 或空数组。只返回标准可解析的 JSON结构 ,不要多余的```json等信息不要解释说明不要改写内容。以下为待处理文本"+contents);
entity.put("content","从下面提供的文本中提取所有能识别到的简历信息只提取原文中存在的内容不要补充、不推测、不总结。需要提取的字段包括name姓名、phone电话号码、email电子邮件地址、position岗位、location地点、links所有链接地址、currentWork(当前工作公司)、about关于我/自我介绍、skills_tools关键资格许可证、注册/会员资格、认证、languages语言能力、experience工作经历,除了title、company、location、durationStart、durationEnd,其他的都放到description里面,并且description里面要根据换行符分成不同的content),日期要拆分成开始时间(durationStart)和结束时间(durationEnd)、education教育经历,日期要拆分成开始时间(durationStart)和结束时间(durationEnd))。请将提取结果以结构化 JSON 格式返回,格式如下:{ \\\"name\\\": \\\"\\\", \\\"phone\\\": \\\"\\\", \\\"email\\\": \\\"\\\", \\\"links\\\": [{\\\"content\\\":\\\"\\\"}], \\\"about\\\": \\\"\\\", \\\"skillsTools\\\": [{\\\"content\\\":\\\"\\\"}], \\\"languages\\\": [{\\\"content\\\":\\\"\\\"}], \\\"experience\\\": [{\\\"title\\\": \\\"\\\", \\\"company\\\": \\\"\\\",\\\"location\\\": \\\"\\\",\\\"durationStart\\\": \\\"\\\",\\\"durationEnd\\\": \\\"\\\",\\\"description\\\": [{\\\"content\\\":\\\"\\\"}]}], \\\"education\\\": [{\\\"degree\\\": \\\"\\\",\\\"institution\\\": \\\"\\\",\\\"durationStart\\\": \\\"\\\",\\\"durationEnd\\\": \\\"\\\"}] }。字段不存在则返回 null 或空数组。只返回标准可解析的 JSON结构 ,不要多余的```json等信息不要解释说明不要改写内容。以下为待处理文本"+contents);
//根据AI做
list.add(entity);
String resultCv = chatGPTClient.handleAiChat(JSONUtil.toJsonStr(list), "JX");
@@ -341,8 +348,11 @@ public class HotakeCvInfoServiceImpl extends BaseServiceImpl implements IHotakeC
if(StrUtil.isEmpty(experienceDto.getLocation())){
experienceDto.setLocation("-");
}
if(StrUtil.isEmpty(experienceDto.getDuration())){
experienceDto.setDuration("-");
if(StrUtil.isEmpty(experienceDto.getDurationStart())){
experienceDto.setDurationStart("-");
}
if(StrUtil.isEmpty(experienceDto.getDurationEnd())){
experienceDto.setDurationEnd("-");
}
if (CollectionUtil.isNotEmpty(experienceDto.getDescription())){
for(VcExperienceDescriptionDto descriptionDto :experienceDto.getDescription()){
@@ -363,8 +373,11 @@ public class HotakeCvInfoServiceImpl extends BaseServiceImpl implements IHotakeC
if(StrUtil.isEmpty(educationDto.getInstitution())){
educationDto.setInstitution("-");
}
if(StrUtil.isEmpty(educationDto.getDate())){
educationDto.setDate("-");
if(StrUtil.isEmpty(educationDto.getDurationStart())){
educationDto.setDurationStart("-");
}
if(StrUtil.isEmpty(educationDto.getDurationEnd())){
educationDto.setDurationEnd("-");
}
if(educationDto.getCertificate() != null){
if(StrUtil.isEmpty(educationDto.getCertificate().getFileName())){
@@ -426,4 +439,11 @@ public class HotakeCvInfoServiceImpl extends BaseServiceImpl implements IHotakeC
return resultMsg;
}
public static void main(String[] args){
String md5s = MD5.create().digestHex16("You are a construction industry interview expert. Evaluate candidate responses and provide scores (1-5) and follow-up questions when needed. Always respond in JSON format.You are a construction industry interview expert. Evaluate candidate responses and provide scores (1-5) and follow-up questions when needed. Always respond in JSON format.You are a construction industry interview expert. Evaluate candidate responses and provide scores (1-5) and follow-up questions when needed. Always respond in JSON format.You are a construction industry interview expert. Evaluate candidate responses and provide scores (1-5) and follow-up questions when needed. Always respond in JSON format.You are a construction industry interview expert. Evaluate candidate responses and provide scores (1-5) and follow-up questions when needed. Always respond in JSON format.You are a construction industry interview expert. Evaluate candidate responses and provide scores (1-5) and follow-up questions when needed. Always respond in JSON format.You are a construction industry interview expert. Evaluate candidate responses and provide scores (1-5) and follow-up questions when needed. Always respond in JSON format.You are a construction industry interview expert. Evaluate candidate responses and provide scores (1-5) and follow-up questions when needed. Always respond in JSON format.You are a construction industry interview expert. Evaluate candidate responses and provide scores (1-5) and follow-up questions when needed. Always respond in JSON format.You are a construction industry interview expert. Evaluate candidate responses and provide scores (1-5) and follow-up questions when needed. Always respond in JSON format.");
System.out.println(md5s);
String md5s1 = MD5.create().digestHex16("You 1are a construction industry interview expert. Evaluate candidate responses and provide scores (1-5) and follow-up questions when needed. Always respond in JSON format.You are a construction industry interview expert. Evaluate candidate responses and provide scores (1-5) and follow-up questions when needed. Always respond in JSON format.You are a construction industry interview expert. Evaluate candidate responses and provide scores (1-5) and follow-up questions when needed. Always respond in JSON format.You are a construction industry interview expert. Evaluate candidate responses and provide scores (1-5) and follow-up questions when needed. Always respond in JSON format.You are a construction industry interview expert. Evaluate candidate responses and provide scores (1-5) and follow-up questions when needed. Always respond in JSON format.You are a construction industry interview expert. Evaluate candidate responses and provide scores (1-5) and follow-up questions when needed. Always respond in JSON format.You are a construction industry interview expert. Evaluate candidate responses and provide scores (1-5) and follow-up questions when needed. Always respond in JSON format.You are a construction industry interview expert. Evaluate candidate responses and provide scores (1-5) and follow-up questions when needed. Always respond in JSON format.You are a construction industry interview expert. Evaluate candidate responses and provide scores (1-5) and follow-up questions when needed. Always respond in JSON format.You are a construction industry interview expert. Evaluate candidate responses and provide scores (1-5) and follow-up questions when needed. Always respond in JSON format.");
System.out.println(md5s1);
}
}

View File

@@ -15,6 +15,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="status" column="status" />
<result property="cvTemplateJson" column="cv_template_json" />
<result property="cvScore" column="cv_score" />
<result property="cvMd5" column="cv_md5" />
<result property="delFlag" column="del_flag" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
@@ -24,7 +25,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectHotakeCvInfoVo">
select id, user_id, cv_name, cv_file_type, cv_url,file_size_show,cv_file_suffix, status,cv_template_json,cv_score,
select id, user_id, cv_name, cv_file_type, cv_url,file_size_show,cv_file_suffix, status,cv_template_json,cv_score,cv_md5,
del_flag, create_by, create_time, update_by, update_time, remark from hotake_cv_info
</sql>
@@ -58,6 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null">status,</if>
<if test="cvTemplateJson != null">cv_template_json,</if>
<if test="cvScore != null">cv_score,</if>
<if test="cvMd5 != null">cv_md5,</if>
<if test="delFlag != null">del_flag,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
@@ -75,6 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null">#{status},</if>
<if test="cvTemplateJson != null">#{cvTemplateJson},</if>
<if test="cvScore != null">#{cvScore},</if>
<if test="cvMd5 != null">#{cvMd5},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
@@ -96,6 +99,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<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="cvMd5 != null">cv_md5 = #{cvMd5},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>