diff --git a/vetti-hotakes/src/main/java/com/vetti/hotake/service/impl/HotakeAiCommonToolsServiceImpl.java b/vetti-hotakes/src/main/java/com/vetti/hotake/service/impl/HotakeAiCommonToolsServiceImpl.java index 629c658..3de37c6 100644 --- a/vetti-hotakes/src/main/java/com/vetti/hotake/service/impl/HotakeAiCommonToolsServiceImpl.java +++ b/vetti-hotakes/src/main/java/com/vetti/hotake/service/impl/HotakeAiCommonToolsServiceImpl.java @@ -1,6 +1,7 @@ package com.vetti.hotake.service.impl; import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONUtil; @@ -589,12 +590,12 @@ public class HotakeAiCommonToolsServiceImpl extends BaseServiceImpl implements I @Override public String handleWebInfoExtract(HotakeWebInfoExtractVo webInfoExtractVo) { //获取 - if(StrUtil.isEmpty(webInfoExtractVo.getWebUrl())){ + if (StrUtil.isEmpty(webInfoExtractVo.getWebUrl())) { throw new ServiceException(""); } String webUrl = webInfoExtractVo.getWebUrl(); - if(!webInfoExtractVo.getWebUrl().toLowerCase().contains("https")){ - webUrl = webUrl.replaceAll("http","https"); + if (!webInfoExtractVo.getWebUrl().toLowerCase().contains("https")) { + webUrl = webUrl.replaceAll("http", "https"); } String webContent = handleWebContentScraping(webUrl); @@ -1013,10 +1014,10 @@ public class HotakeAiCommonToolsServiceImpl extends BaseServiceImpl implements I String resultJsonOne = resultStrOne.replaceAll("```json", "").replaceAll("```", ""); log.info("AI面试问题生成结果:{}", resultJsonOne); - try{ - Map mapData = JSONUtil.toBean(resultJsonOne,Map.class); - List questionMapList = (List)mapData.get("interview_questions"); - if(CollectionUtil.isNotEmpty(questionMapList)){ + try { + Map mapData = JSONUtil.toBean(resultJsonOne, Map.class); + List questionMapList = (List) mapData.get("interview_questions"); + if (CollectionUtil.isNotEmpty(questionMapList)) { HotakeAiInterviewQuestionsInfo questionsInfo = new HotakeAiInterviewQuestionsInfo(); questionsInfo.setQuestionTitle("General Questions"); questionsInfo.setFocusType("Personality & Culture"); @@ -1026,7 +1027,7 @@ public class HotakeAiCommonToolsServiceImpl extends BaseServiceImpl implements I BigDecimal times = BigDecimal.ZERO; List questionDtoList = new ArrayList<>(); - for(Map map : questionMapList){ + for (Map map : questionMapList) { AiQuestionDto questionDto = new AiQuestionDto(); questionDto.setQuestions(map.get("question_text").toString()); questionDtoList.add(questionDto); @@ -1041,7 +1042,7 @@ public class HotakeAiCommonToolsServiceImpl extends BaseServiceImpl implements I hotakeAiInterviewQuestionsInfoMapper.insertHotakeAiInterviewQuestionsInfo(questionsInfo); return questionsInfo; } - }catch (Exception e){ + } catch (Exception e) { e.printStackTrace(); } return new HotakeAiInterviewQuestionsInfo(); @@ -1058,13 +1059,17 @@ public class HotakeAiCommonToolsServiceImpl extends BaseServiceImpl implements I HotakeCandidateAiInterviewAnalysisDto analysisDto = new HotakeCandidateAiInterviewAnalysisDto(); String prompt = AiCommonPromptConstants.initializationCandidateAiInterviewAnalysisPrompt(); String qa = ""; + String qStr = ""; + String aStr = ""; if (CollectionUtil.isNotEmpty(analysisVo.getAiInterviewQuestionRecordVoList())) { for (HotakeAiInterviewQuestionRecordVo recordVo : analysisVo.getAiInterviewQuestionRecordVoList()) { if ("assistant".equals(recordVo.getUserType())) { qa = qa + "Question:" + recordVo.getContentText(); + qStr = qStr + ";" + recordVo.getContentText(); } if ("user".equals(recordVo.getUserType())) { qa = qa + "Answer:" + recordVo.getContentText(); + aStr = aStr + ";" + recordVo.getContentText(); } } } @@ -1139,10 +1144,45 @@ public class HotakeAiCommonToolsServiceImpl extends BaseServiceImpl implements I } } //把面试结果分析和问答Qa保存到记录表中 - if(analysisVo.getRoleApplyId() != null){ + if (analysisVo.getRoleApplyId() != null) { HotakeRolesApplyInfo applyInfo = hotakeRolesApplyInfoMapper.selectHotakeRolesApplyInfoById(analysisVo.getRoleApplyId()); applyInfo.setAiInterviewAnalysisJson(JSONUtil.toJsonStr(analysisVo)); applyInfo.setAiInterviewAnalysisQaJson(JSONUtil.toJsonStr(analysisVo.getAiInterviewQuestionRecordVoList())); + HotakeRolesInfo rolesInf = hotakeRolesInfoMapper.selectHotakeRolesInfoById(applyInfo.getRoleId()); + try { + //候选人面试综合评估 + HotakeCandidateInterviewEvaluationVo evaluationVo = new HotakeCandidateInterviewEvaluationVo(); + + evaluationVo.setTitle(rolesInf.getRoleName()); + evaluationVo.setDescription(rolesInf.getAboutRole()); + evaluationVo.setRequiredSkills(rolesInf.getRequiredSkillsJson()); + evaluationVo.setPreferredSkills(rolesInf.getNiceToHaveSkillsJson()); + evaluationVo.setExperienceRequired(rolesInf.getJobExperience()); + HotakeCvInfoDto cvInfoDto = JSONUtil.toBean(applyInfo.getCvTemplateJson(), HotakeCvInfoDto.class); + evaluationVo.setName(cvInfoDto.getName()); + evaluationVo.setCurrentPosition(cvInfoDto.getPosition()); + evaluationVo.setEmail(cvInfoDto.getEmail()); + evaluationVo.setWorkExperience(JSONUtil.toJsonStr(cvInfoDto.getExperience())); + evaluationVo.setSkills(JSONUtil.toJsonStr(cvInfoDto.getSkillsTools())); + evaluationVo.setEducation(JSONUtil.toJsonStr(cvInfoDto.getEducation())); + evaluationVo.setCertifications(""); + evaluationVo.setInterviewData(DateUtil.now()); + + evaluationVo.setQuestions(qStr); + evaluationVo.setAnswers(aStr); + evaluationVo.setTechnical(analysisDto.getTechnical().toString()); + evaluationVo.setCommunication(analysisDto.getCommunication().toString()); + evaluationVo.setSafetyAwareness(""); + evaluationVo.setProblemSolving(""); + + HotakeCandidateInterviewEvaluationDto evaluationDto = getCandidateInterviewEvaluation(evaluationVo); + applyInfo.setEvaluationJson(JSONUtil.toJsonStr(evaluationDto)); + applyInfo.setEvaluationScore(new BigDecimal(evaluationDto.getOverallScore())); + } catch (Exception e) { + e.printStackTrace(); + } + + hotakeRolesApplyInfoMapper.updateHotakeRolesApplyInfo(applyInfo); } return analysisDto; @@ -1221,36 +1261,36 @@ public class HotakeAiCommonToolsServiceImpl extends BaseServiceImpl implements I try { Map dataMap = JSONUtil.toBean(resultJsonOne, Map.class); Map scoresMap = (Map) dataMap.get("scores"); - if(ObjectUtil.isNotEmpty(scoresMap.get("skills"))){ + if (ObjectUtil.isNotEmpty(scoresMap.get("skills"))) { dto.setSkills(new BigDecimal(scoresMap.get("skills").toString())); - }else{ + } else { dto.setSkills(BigDecimal.ZERO); } - if(ObjectUtil.isNotEmpty(scoresMap.get("experience"))){ + if (ObjectUtil.isNotEmpty(scoresMap.get("experience"))) { dto.setExperience(new BigDecimal(scoresMap.get("experience").toString())); - }else{ + } else { dto.setExperience(BigDecimal.ZERO); } - if(ObjectUtil.isNotEmpty(scoresMap.get("education"))){ + if (ObjectUtil.isNotEmpty(scoresMap.get("education"))) { dto.setEducation(new BigDecimal(scoresMap.get("education").toString())); - }else{ + } else { dto.setEducation(BigDecimal.ZERO); } - if(ObjectUtil.isNotEmpty(scoresMap.get("cultural"))){ + if (ObjectUtil.isNotEmpty(scoresMap.get("cultural"))) { dto.setCultural(new BigDecimal(scoresMap.get("cultural").toString())); - }else{ + } else { dto.setCultural(BigDecimal.ZERO); } - if(ObjectUtil.isNotEmpty(scoresMap.get("potential"))){ + if (ObjectUtil.isNotEmpty(scoresMap.get("potential"))) { dto.setPotential(new BigDecimal(scoresMap.get("potential").toString())); - }else{ + } else { dto.setPotential(BigDecimal.ZERO); } - List strengths = (List)dataMap.get("strengths"); + List strengths = (List) dataMap.get("strengths"); dto.setStrengths(strengths); - List weaknesses = (List)dataMap.get("weaknesses"); + List weaknesses = (List) dataMap.get("weaknesses"); dto.setWeaknesses(weaknesses); dto.setReason(dataMap.get("reason").toString()); @@ -1262,7 +1302,7 @@ public class HotakeAiCommonToolsServiceImpl extends BaseServiceImpl implements I add(dto.getCultural().multiply(new BigDecimal(0.15)).add(dto.getPotential().multiply(new BigDecimal(0.15))))); dto.setOverallScore(overallScore); - }catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); } return dto; @@ -1305,29 +1345,29 @@ public class HotakeAiCommonToolsServiceImpl extends BaseServiceImpl implements I String resultJsonOne = resultStrOne.replaceAll("```json", "").replaceAll("```", ""); log.info("招聘者查看候选人匹配度结果:{}", resultJsonOne); Map dataMap = JSONUtil.toBean(resultJsonOne, Map.class); - if(ObjectUtil.isNotEmpty(dataMap.get("strengths_score"))){ + if (ObjectUtil.isNotEmpty(dataMap.get("strengths_score"))) { dto.setStrengthsScore(new BigDecimal(dataMap.get("strengths_score").toString())); - }else{ + } else { dto.setStrengthsScore(BigDecimal.ZERO); } - if(ObjectUtil.isNotEmpty(dataMap.get("differences_score"))){ + if (ObjectUtil.isNotEmpty(dataMap.get("differences_score"))) { dto.setDifferencesScore(new BigDecimal(dataMap.get("differences_score").toString())); - }else{ + } else { dto.setDifferencesScore(BigDecimal.ZERO); } - if(ObjectUtil.isNotEmpty(dataMap.get("cultural_score"))){ + if (ObjectUtil.isNotEmpty(dataMap.get("cultural_score"))) { dto.setCulturalScore(new BigDecimal(dataMap.get("cultural_score").toString())); - }else{ + } else { dto.setCulturalScore(BigDecimal.ZERO); } - List strengths = (List)dataMap.get("key_strengths"); + List strengths = (List) dataMap.get("key_strengths"); dto.setKeyStrengths(strengths); - List differences = (List)dataMap.get("key_differences"); + List differences = (List) dataMap.get("key_differences"); dto.setKeyDifferences(differences); - List fitDetails = (List)dataMap.get("cultural_fit_details"); + List fitDetails = (List) dataMap.get("cultural_fit_details"); dto.setCulturalFitDetails(fitDetails); BigDecimal overallScore = dto.getStrengthsScore().multiply(new BigDecimal(0.4)). @@ -1350,25 +1390,25 @@ public class HotakeAiCommonToolsServiceImpl extends BaseServiceImpl implements I String prompt = AiCommonPromptConstants.initializationCandidateInterviewEvaluationPrompt(); String userPrompt_1 = "Job Posting:\n" + - "Title: "+evaluationVo.getTitle()+"\n" + - "Description: "+evaluationVo.getDescription()+"\n" + - "Required Skills: "+evaluationVo.getRequiredSkills()+"\n" + - "Preferred Skills: "+evaluationVo.getPreferredSkills()+"\n" + - "Experience Required: "+evaluationVo.getExperienceRequired()+"\n" + + "Title: " + evaluationVo.getTitle() + "\n" + + "Description: " + evaluationVo.getDescription() + "\n" + + "Required Skills: " + evaluationVo.getRequiredSkills() + "\n" + + "Preferred Skills: " + evaluationVo.getPreferredSkills() + "\n" + + "Experience Required: " + evaluationVo.getExperienceRequired() + "\n" + "\n" + "Candidate Information:\n" + - "Name: "+evaluationVo.getName()+"\n" + - "Current Position: "+evaluationVo.getCurrentPosition()+"\n" + - "Email: "+evaluationVo.getEmail()+"\n" + - "Work Experience: "+evaluationVo.getWorkExperience()+"\n" + - "Skills: "+evaluationVo.getSkills()+"\n" + - "Education: "+evaluationVo.getEducation()+"\n" + - "Certifications: "+evaluationVo.getCertifications()+"\n" + + "Name: " + evaluationVo.getName() + "\n" + + "Current Position: " + evaluationVo.getCurrentPosition() + "\n" + + "Email: " + evaluationVo.getEmail() + "\n" + + "Work Experience: " + evaluationVo.getWorkExperience() + "\n" + + "Skills: " + evaluationVo.getSkills() + "\n" + + "Education: " + evaluationVo.getEducation() + "\n" + + "Certifications: " + evaluationVo.getCertifications() + "\n" + "\n" + - "Interview Data:"+evaluationVo.getInterviewData()+"\n" + - "Questions: "+evaluationVo.getQuestions()+"\n" + - "Answers: "+evaluationVo.getAnswers()+"\n" + - "Scores: Technical="+evaluationVo.getTechnical()+", Communication="+evaluationVo.getCommunication()+", Safety Awareness="+evaluationVo.getSafetyAwareness()+", Problem Solving="+evaluationVo.getProblemSolving()+"}\n" + + "Interview Data:" + evaluationVo.getInterviewData() + "\n" + + "Questions: " + evaluationVo.getQuestions() + "\n" + + "Answers: " + evaluationVo.getAnswers() + "\n" + + "Scores: Technical=" + evaluationVo.getTechnical() + ", Communication=" + evaluationVo.getCommunication() + ", Safety Awareness=" + evaluationVo.getSafetyAwareness() + ", Problem Solving=" + evaluationVo.getProblemSolving() + "}\n" + "\n" + "Please analyze this candidate and provide a comprehensive overview with Assessment, Rating, and Questions scores."; @@ -1387,27 +1427,27 @@ public class HotakeAiCommonToolsServiceImpl extends BaseServiceImpl implements I String resultJsonOne = resultStrOne.replaceAll("```json", "").replaceAll("```", ""); log.info("候选人面试综合评估:{}", resultJsonOne); Map dataMap = JSONUtil.toBean(resultJsonOne, Map.class); - Map scoreBreakdownMap = (Map)dataMap.get("score_breakdown"); - if(scoreBreakdownMap != null){ - Map assessmentMap = (Map)scoreBreakdownMap.get("assessment"); - if(assessmentMap != null){ + Map scoreBreakdownMap = (Map) dataMap.get("score_breakdown"); + if (scoreBreakdownMap != null) { + Map assessmentMap = (Map) scoreBreakdownMap.get("assessment"); + if (assessmentMap != null) { dto.setAssessmentScore(assessmentMap.get("score").toString()); dto.setAssessmentLevel(assessmentMap.get("score").toString()); - List details = (List)assessmentMap.get("details"); + List details = (List) assessmentMap.get("details"); dto.setAssessmentDetails(details); } - Map ratingMap = (Map)scoreBreakdownMap.get("rating"); - if(ratingMap != null){ + Map ratingMap = (Map) scoreBreakdownMap.get("rating"); + if (ratingMap != null) { dto.setRatingScore(ratingMap.get("score").toString()); dto.setRatingLevel(ratingMap.get("score").toString()); - List details = (List)ratingMap.get("details"); + List details = (List) ratingMap.get("details"); dto.setRatingDetails(details); } - Map questionsMap = (Map)scoreBreakdownMap.get("questions"); - if(questionsMap != null){ + Map questionsMap = (Map) scoreBreakdownMap.get("questions"); + if (questionsMap != null) { dto.setQuestionsScore(questionsMap.get("score").toString()); dto.setQuestionsLevel(questionsMap.get("score").toString()); - List details = (List)questionsMap.get("details"); + List details = (List) questionsMap.get("details"); dto.setQuestionsDetails(details); } } diff --git a/vetti-hotakes/src/main/resources/mapper/hotake/HotakeRolesApplyInfoMapper.xml b/vetti-hotakes/src/main/resources/mapper/hotake/HotakeRolesApplyInfoMapper.xml index 59e7ac6..9ca90a7 100644 --- a/vetti-hotakes/src/main/resources/mapper/hotake/HotakeRolesApplyInfoMapper.xml +++ b/vetti-hotakes/src/main/resources/mapper/hotake/HotakeRolesApplyInfoMapper.xml @@ -52,9 +52,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select id, candidate_id,recruiter_id, role_id, full_name, email, phone_number, cv_file, cv_file_suffix,file_size_show, cover_letter, candidate_status, stage, last_contact, cv_template_json, cv_score, cv_md5, experience, ai_match_score, ai_match_score_percentage,status, ai_cv_scoring_ranking_json,ai_cv_score,candidate_compatibility_json, - candidate_compatibility_score,evaluation_json,evaluation_score, - ai_match_score_percentage,status, ai_cv_scoring_ranking_json,ai_cv_score,candidate_compatibility_json, - candidate_compatibility_score,ai_interview_analysis_json,ai_interview_analysis_qa_json, + candidate_compatibility_score,evaluation_json,evaluation_score,ai_interview_analysis_json,ai_interview_analysis_qa_json, del_flag, create_by, create_time, update_by, update_time, remark from hotake_roles_apply_info