提取技能维度 补充数据

This commit is contained in:
zk
2026-08-10 18:35:05 +08:00
parent 0a4b97e40e
commit ea3cb4dead
@@ -23,7 +23,7 @@ import java.util.stream.StreamSupport;
* 用户简历分析服务
* <p>主要功能:用户保存简历后异步分析,提取学校等级、经历质量、专业、技能等维度数据</p>
* <p>依赖:AiChatAbilityAI调用)、DictCacheService(专业分类缓存)</p>
* <p>使用表:bg_user_profile(主表,读取/更新)、bg_user_profile_*5张子表,读取)、
* <p>使用表:bg_user_profile(主表,读取/更新)、bg_user_profile_*6张子表,读取)、
* bg_skill_tag(技能入库)、bg_user_profile_skill_tag_relation(关联表)</p>
*
* @author zk
@@ -56,6 +56,9 @@ public class UserProfileAnalyzeService {
@Autowired
private UserProfileCompetitionMapper competitionMapper;
@Autowired
private UserProfileOrganizationMapper organizationMapper;
@Autowired
private SkillTagMapper skillTagMapper;
@@ -94,15 +97,16 @@ public class UserProfileAnalyzeService {
List<UserProfileInternship> internshipList = internshipMapper.selectList(new LambdaQueryWrapper<UserProfileInternship>().eq(UserProfileInternship::getUserId, userId));
List<UserProfileProject> projectList = projectMapper.selectList(new LambdaQueryWrapper<UserProfileProject>().eq(UserProfileProject::getUserId, userId));
List<UserProfileCompetition> competitionList = competitionMapper.selectList(new LambdaQueryWrapper<UserProfileCompetition>().eq(UserProfileCompetition::getUserId, userId));
List<UserProfileOrganization> organizationList = organizationMapper.selectList(new LambdaQueryWrapper<UserProfileOrganization>().eq(UserProfileOrganization::getUserId, userId));
// 2. 数据有效性检查
if (educationList.isEmpty() && workList.isEmpty() && internshipList.isEmpty() && projectList.isEmpty() && competitionList.isEmpty()) {
if (educationList.isEmpty() && workList.isEmpty() && internshipList.isEmpty() && projectList.isEmpty() && competitionList.isEmpty() && organizationList.isEmpty()) {
log.info("用户所有子表为空,清空技能标签, userId={}", userId);
clearSkillRelations(userId);
return;
}
String profileJson = buildProfileJson(profile, educationList, workList, internshipList, projectList, competitionList);
String profileJson = buildProfileJson(profile, educationList, workList, internshipList, projectList, competitionList, organizationList);
// 3. 第一次AI:简历综合分析(失败不影响后续)
try {
@@ -445,16 +449,20 @@ public class UserProfileAnalyzeService {
/** 构建用户简历JSON */
private String buildProfileJson(UserProfile profile, List<UserProfileEducation> educationList,
List<UserProfileWork> workList, List<UserProfileInternship> internshipList,
List<UserProfileProject> projectList, List<UserProfileCompetition> competitionList) {
List<UserProfileProject> projectList, List<UserProfileCompetition> competitionList,
List<UserProfileOrganization> organizationList) {
Map<String, Object> data = new HashMap<>();
data.put("name", profile.getName());
data.put("skills", profile.getSkills());
data.put("certificates", profile.getCertificates());
data.put("hobbies", profile.getHobbies());
data.put("languageSkills", profile.getLanguageSkills());
data.put("education", educationList);
data.put("work", workList);
data.put("internship", internshipList);
data.put("project", projectList);
data.put("competition", competitionList);
data.put("organization", organizationList);
try {
return HttpTool.objectMapper.writeValueAsString(data);
} catch (Exception e) {