简历业务逻辑完善

This commit is contained in:
2025-11-08 11:52:59 +08:00
parent 61d959e6b8
commit f38d157581
9 changed files with 186 additions and 53 deletions

View File

@@ -60,7 +60,7 @@ public class ChatGPTClient {
if("CV".equals(type)){
resultText = sendMessage(promptText, modelCV,objectMapper,client,role);
}else if("QA".equals(type)){
resultText = sendMessage(promptText, "ft:gpt-3.5-turbo-0125:vetti:construction-labourer-test:CWKBNvE2",objectMapper,client,role);
resultText = sendMessage(promptText, model,objectMapper,client,role);
} else {
resultText = sendMessage(promptText, model,objectMapper,client,role);
}

View File

@@ -0,0 +1,30 @@
package com.vetti.common.enums;
/**
* minio 桶的名称
*/
public enum MinioBucketNameEnum {
CV("cv-fs", "简历"),
NOTICE_TYPE("noticetype-fs", "通知"),
;
private final String code;
private final String info;
MinioBucketNameEnum(String code, String info)
{
this.code = code;
this.info = info;
}
public String getCode()
{
return code;
}
public String getInfo()
{
return info;
}
}

View File

@@ -563,6 +563,90 @@ public class ResumeTextExtractor {
return projects.getOrDefault(role, projects.get("Project Manager"));
}
/**
* 提取个人总结/简介
*
* @param text 简历文本
* @param role 申请职位
* @param experienceYears 工作经验年数
* @param skills 技能列表
* @return 个人总结
*/
public String extractSummary(String text, String role, int experienceYears, List<String> skills) {
// 查找明确的总结段落
String[] summaryPatterns = {
"(?:summary|profile|objective|about|overview)[:\\s]*([^\\n\\r]{50,200})",
"(?:professional\\s+summary|career\\s+summary|personal\\s+statement)[:\\s]*([^\\n\\r]{50,200})"
};
for (String patternStr : summaryPatterns) {
Pattern pattern = Pattern.compile(patternStr, Pattern.CASE_INSENSITIVE);
Matcher matcher = pattern.matcher(text);
if (matcher.find() && matcher.group(1) != null) {
String summary = matcher.group(1).trim();
if (summary.length() >= 30 && summary.length() <= 200) {
return cleanSummary(summary);
}
}
}
// 如果没有找到明确的总结,基于经验和技能生成
return generateSummary(role, experienceYears, skills);
}
/**
* 清理总结文本
*
* @param summary 原始总结文本
* @return 清理后的总结
*/
private String cleanSummary(String summary) {
return summary
.replaceAll("[^\\w\\s\\-\\.,]", "") // 移除特殊字符
.replaceAll("\\s+", " ") // 合并多个空格
.trim();
}
/**
* 基于职位和经验生成个人总结
*
* @param role 申请职位
* @param experienceYears 工作经验年数
* @param skills 技能列表
* @return 生成的个人总结
*/
private String generateSummary(String role, int experienceYears, List<String> skills) {
String experienceLevel = experienceYears >= 8 ? "Senior" :
experienceYears >= 4 ? "Experienced" : "Entry-level";
String roleDesc;
if ("Project Manager".equals(role)) {
roleDesc = "construction professional with proven project management experience";
} else {
roleDesc = "contracts professional with strong legal and negotiation background";
}
String topSkills = "";
if (skills.size() >= 2) {
topSkills = skills.get(0).toLowerCase() + " and " + skills.get(1).toLowerCase();
} else if (!skills.isEmpty()) {
topSkills = skills.get(0).toLowerCase();
}
if (experienceYears >= 8) {
return String.format("%s %s with %d years of experience in %s and industry best practices",
experienceLevel, roleDesc, experienceYears, topSkills);
} else if (experienceYears >= 4) {
return String.format("%s %s with solid background in %s and commitment to quality delivery",
experienceLevel, roleDesc, topSkills);
} else {
return String.format("%s candidate seeking career growth in construction with foundation in %s",
experienceLevel, topSkills);
}
}
/**
* 主要提取方法 - 从简历文本中提取所有结构化信息
*
@@ -591,6 +675,8 @@ public class ResumeTextExtractor {
// 教育背景列表
resumeData.setEducation(extractEducation(text));
resumeData.setSummary(extractSummary(text, role, personalInfo.getExperienceYears(), resumeData.getSkills()));
return resumeData;
}

View File

@@ -27,4 +27,7 @@ public class ResumeData {
@ApiModelProperty("候选人教育经历")
private List<Education> education;
@ApiModelProperty("个人总结")
private String summary;
}