AI 优化修改点逻辑处理

This commit is contained in:
2026-01-18 11:21:34 +08:00
parent 7ceeb37b92
commit 6fa40308ee
6 changed files with 149 additions and 48 deletions

View File

@@ -142,6 +142,18 @@ public class SysProfileController extends BaseController
@PutMapping("/updatePersonalInfo")
public R updatePersonalInfoProfile(@RequestBody SysUser user)
{
//更新简历数据
if("cvOper".equals(user.getOperFlag())){
//查询简历数据
HotakeCvInfo query = new HotakeCvInfo();
query.setUserId(user.getUserId());
query.setCvFileType("cv");
List<HotakeCvInfo> cvInfoList = cvInfoService.selectHotakeCvInfoList(query);
if(CollectionUtil.isNotEmpty(cvInfoList)){
HotakeCvInfo cvInfo = cvInfoList.get(0);
user.setCvTemplateJson(cvInfo.getCvTemplateJson());
}
}
userService.updateUserProfile(user);
return R.ok();
}

View File

@@ -180,6 +180,8 @@ public class SysUser extends BaseEntity {
@ApiModelProperty("工作性值")
private HotakeWorkNatureDto workNatureDto;
@ApiModelProperty("操作标记(cvOper:简历操作,需要同步简历信息到用户)")
private String operFlag;
/**
* 部门对象
@@ -550,6 +552,15 @@ public class SysUser extends BaseEntity {
this.workNatureDto = workNatureDto;
}
public String getOperFlag() {
return operFlag;
}
public void setOperFlag(String operFlag) {
this.operFlag = operFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

View File

@@ -0,0 +1,33 @@
package com.vetti.common.enums;
/**
* 简历操作数据类型
*/
public enum CvOperDataTypeEnum {
IMPORT("import", "导入"),
MANUAL("manual", "手动"),
LINK("Link", "链接"),
;
private final String code;
private final String info;
CvOperDataTypeEnum(String code, String info)
{
this.code = code;
this.info = info;
}
public String getCode()
{
return code;
}
public String getInfo()
{
return info;
}
}

View File

@@ -93,6 +93,9 @@ public class HotakeCvInfo extends BaseEntity
@ApiModelProperty("逻辑修正的数量")
private Integer logicCorrectionsNum;
@ApiModelProperty("数据类型(import:导入,manual:手动,Link:链接)")
private String dataType;
@ApiModelProperty("简历分析结果数据")
private HotakeCvOptimizeDto cvOptimizeDto;

View File

@@ -8,8 +8,10 @@ import cn.hutool.json.JSONUtil;
import com.vetti.common.ai.gpt.ChatGPTClient;
import com.vetti.common.config.RuoYiConfig;
import com.vetti.common.core.service.BaseServiceImpl;
import com.vetti.common.enums.CvOperDataTypeEnum;
import com.vetti.common.enums.FillTypeEnum;
import com.vetti.common.enums.MinioBucketNameEnum;
import com.vetti.common.exception.ServiceException;
import com.vetti.common.utils.*;
import com.vetti.common.utils.readFile.FileContentUtil;
import com.vetti.hotake.domain.HotakeCvInfo;
@@ -158,6 +160,20 @@ public class HotakeCvInfoServiceImpl extends BaseServiceImpl implements IHotakeC
String resultStr = handleAnalyzedAttachment(hotakeCvInfo.getCvUrl(), fileSuffix);
hotakeCvInfo.setAnalyzedAttachmentJson(resultStr);
}
if("cv".equals(hotakeCvInfo.getCvFileType())) {
hotakeCvInfo.setCvTemplateJson(JSONUtil.toJsonStr(hotakeCvInfo.getCvInfoDto()));
//如果是手动创建的简历要生成简历的附件数据
if(CvOperDataTypeEnum.MANUAL.getCode().equals(hotakeCvInfo.getDataType())){
if(StrUtil.isNotEmpty(hotakeCvInfo.getCvTemplateJson())){
HotakeSysFile sysFile = createCvFile(hotakeCvInfo.getCvTemplateJson());
hotakeCvInfo.setCvName(sysFile.getFileName());
hotakeCvInfo.setFileSizeShow(sysFile.getFileSizeShow());
hotakeCvInfo.setCvUrl(sysFile.getStoragePath());
}
}
}
hotakeCvInfoMapper.insertHotakeCvInfo(hotakeCvInfo);
return hotakeCvInfo;
}
@@ -225,11 +241,19 @@ public class HotakeCvInfoServiceImpl extends BaseServiceImpl implements IHotakeC
fill(FillTypeEnum.UPDATE.getCode(), hotakeCvInfo);
hotakeCvInfo.setCvTemplateJson(JSONUtil.toJsonStr(hotakeCvInfo.getCvInfoDto()));
//修改的时候重新生成问题和评分
//创建简历
if("cv".equals(hotakeCvInfo.getCvFileType())) {
//如果是手动创建的简历要生成简历的附件数据
if(CvOperDataTypeEnum.MANUAL.getCode().equals(hotakeCvInfo.getDataType())){
if(StrUtil.isNotEmpty(hotakeCvInfo.getCvTemplateJson())){
HotakeSysFile sysFile = createCvFile(hotakeCvInfo.getCvTemplateJson());
hotakeCvInfo.setCvName(sysFile.getFileName());
hotakeCvInfo.setFileSizeShow(sysFile.getFileSizeShow());
hotakeCvInfo.setCvUrl(sysFile.getStoragePath());
}
}
}
hotakeCvInfoMapper.updateHotakeCvInfo(hotakeCvInfo);
return hotakeCvInfo;
}
@@ -406,12 +430,12 @@ public class HotakeCvInfoServiceImpl extends BaseServiceImpl implements IHotakeC
//个人介绍
cvInfoDto.setAbout(StringUtils.getObjectStr(dataMap.get("professional_summary")));
try{
try {
//技能工具
List<Map> skillsList = (List<Map>) dataMap.get("skills_certificates");
if(CollectionUtil.isNotEmpty(skillsList)){
if (CollectionUtil.isNotEmpty(skillsList)) {
Map map = skillsList.get(0);
if(map != null){
if (map != null) {
List<String> skillsAllList = (List<String>) map.get("skills");
//技能工具
List<VcSkillsToolsDto> skillsTools = new ArrayList<>();
@@ -426,10 +450,10 @@ public class HotakeCvInfoServiceImpl extends BaseServiceImpl implements IHotakeC
}
}
}catch (Exception e){
} catch (Exception e) {
//技能工具
List<String> skillsList = (List<String>) dataMap.get("skills_certificates");
if(CollectionUtil.isNotEmpty(skillsList)){
if (CollectionUtil.isNotEmpty(skillsList)) {
//技能工具
List<VcSkillsToolsDto> skillsTools = new ArrayList<>();
if (CollectionUtil.isNotEmpty(skillsList)) {
@@ -501,44 +525,12 @@ public class HotakeCvInfoServiceImpl extends BaseServiceImpl implements IHotakeC
cvInfo.setCvFileSuffix("pdf");
cvInfo.setStatus("1");
//生成简历PDF数据
String markdown = aiCommonToolsService.handleGenerateMarkdown(cvData);
markdown = markdown.replaceAll("markdown", "");
try {
String html = MarkdownUtil.markdownToHtml(markdown);
// 可注入 CSS
html = """
<html>
<head>
<style>
body { font-family: SimSun; }
h1 { color: #2c3e50; }
</style>
</head>
<body>
""" + html + """
</body>
</html>
""";
//生成PDF文件
String resultFileName = SecurityUtils.getUsername() + "_" + System.currentTimeMillis() + ".pdf";
cvInfo.setCvName(resultFileName);
String resultPathUrl = RuoYiConfig.getProfile() + SYSTEM_DIR + resultFileName;
HtmlToPdfUtil.htmlToPdf(html, resultPathUrl);
//上传到minio中
File pdf = new File(resultPathUrl);
MultipartFile multipartFile =
MultipartFileUtil.fileToMultipartFile(pdf);
HotakeSysFileVo fileVo = new HotakeSysFileVo();
fileVo.setMinioBucketName("cv-fs");
HotakeSysFile sysFile = sysFileService.insertHotakeSysFile(multipartFile, fileVo);
HotakeSysFile sysFile = createCvFile(cvData);
cvInfo.setCvName(sysFile.getFileName());
cvInfo.setFileSizeShow(sysFile.getFileSizeShow());
cvInfo.setCvUrl(sysFile.getStoragePath());
//创建简历对象数据
insertHotakeCvInfo(cvInfo);
//保存简历PDF附件数据
// log.info("Markdown数据为:{}",markdown);
} catch (Exception e) {
}
return cvInfo;
}
@@ -742,5 +734,46 @@ public class HotakeCvInfoServiceImpl extends BaseServiceImpl implements IHotakeC
return "";
}
/**
* 创建简历附件信息
*
* @param connect 简历内容
*/
private HotakeSysFile createCvFile(String connect) {
try {
String markdown = aiCommonToolsService.handleGenerateMarkdown(connect);
markdown = markdown.replaceAll("markdown", "");
String html = MarkdownUtil.markdownToHtml(markdown);
// 可注入 CSS
html = """
<html>
<head>
<style>
body { font-family: SimSun; }
h1 { color: #2c3e50; }
</style>
</head>
<body>
""" + html + """
</body>
</html>
""";
//生成PDF文件
String resultFileName = SecurityUtils.getUsername() + "_" + System.currentTimeMillis() + ".pdf";
String resultPathUrl = RuoYiConfig.getProfile() + SYSTEM_DIR + resultFileName;
HtmlToPdfUtil.htmlToPdf(html, resultPathUrl);
//上传到minio中
File pdf = new File(resultPathUrl);
MultipartFile multipartFile =
MultipartFileUtil.fileToMultipartFile(pdf);
HotakeSysFileVo fileVo = new HotakeSysFileVo();
fileVo.setMinioBucketName("cv-fs");
HotakeSysFile sysFile = sysFileService.insertHotakeSysFile(multipartFile, fileVo);
return sysFile;
} catch (Exception e) {
throw new ServiceException("Resume creation exception, please contact the administrator");
}
}
}

View File

@@ -25,6 +25,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="analyzedAttachmentJson" column="analyzed_attachment_json" />
<result property="dataType" column="data_type" />
<result property="delFlag" column="del_flag" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
@@ -35,7 +37,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<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,cv_md5,experience,ai_match_score,ai_match_score_percentage,cv_optimize_json,analyzed_attachment_json,
status,cv_template_json,cv_score,cv_md5,experience,ai_match_score,ai_match_score_percentage,
cv_optimize_json,analyzed_attachment_json,data_type,
del_flag, create_by, create_time, update_by, update_time, remark from hotake_cv_info
</sql>
@@ -48,6 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="cvUrl != null and cvUrl != ''"> and cv_url = #{cvUrl}</if>
<if test="cvFileSuffix != null and cvFileSuffix != ''"> and cv_file_suffix = #{cvFileSuffix}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="dataType != null and dataType != ''"> and data_type = #{dataType}</if>
<if test="delFlag != null and delFlag != ''"> and del_flag = #{delFlag}</if>
</where>
</select>
@@ -78,6 +82,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="analyzedAttachmentJson != null">analyzed_attachment_json,</if>
<if test="dataType != null">data_type,</if>
<if test="delFlag != null">del_flag,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
@@ -103,6 +109,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="cvOptimizeJson != null">#{cvOptimizeJson},</if>
<if test="analyzedAttachmentJson != null">#{analyzedAttachmentJson},</if>
<if test="dataType != null">#{dataType},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="createBy != null">#{createBy},</if>
@@ -135,6 +142,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="analyzedAttachmentJson != null">analyzed_attachment_json = #{analyzedAttachmentJson},</if>
<if test="dataType != null">data_type = #{dataType},</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>