Commit e00b68da by zwb

修改简历html模版名称为默认

parent bc93f3a3
......@@ -5,8 +5,6 @@ import com.bkty.system.api.model.LoginUser;
import com.bkty.system.domain.dto.ResumeByPdfDto;
import com.bkty.system.domain.dto.ResumeListItemCache;
import com.bkty.system.domain.dto.ResumeMakeDto;
import com.bkty.system.domain.entity.FunctionResumeDownloadNumber;
import com.bkty.system.domain.vo.ResumeByPdfVo;
import com.bkty.system.domain.vo.ResumeVo;
import com.bkty.system.service.resume.NewEditionResumeService;
import com.bkty.system.service.resume.ResumeCacheService;
......@@ -16,10 +14,8 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.common.core.annotation.RepeatSubmit;
import org.dromara.common.core.domain.R;
import org.dromara.common.core.domain.UserLoginInfo;
import org.dromara.common.core.exception.JxgException;
import org.dromara.common.core.exception.WarnException;
import org.dromara.common.core.utils.SecurityUtils;
import org.dromara.common.satoken.utils.LoginHelper;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
......@@ -139,7 +135,7 @@ public class NewEditionResumeController {
@PostMapping("/create-resume-by-html")
public R createResumeHtml(@RequestBody ResumeByPdfDto dto){
return new R<>(this.newEditionResumeService.createResumeHtml(dto.getResumeId()));
return new R<>(this.newEditionResumeService.createResumeHtml(dto.getResumeId(), dto.getTemplateName()));
}
}
package com.bkty.system.service.resume;
import com.bkty.system.domain.dto.ResumeByPdfDto;
import com.bkty.system.domain.dto.ResumeListItemCache;
import com.bkty.system.domain.dto.ResumeMakeDto;
import com.bkty.system.domain.vo.ResumeByPdfVo;
import com.bkty.system.domain.vo.ResumeVo;
import org.springframework.web.multipart.MultipartFile;
......@@ -65,8 +63,10 @@ public interface NewEditionResumeService {
/**
* 根据模版生成html文件
*
* @param resumeId
* @param templateName
* @return
*/
String createResumeHtml(String resumeId);
String createResumeHtml(String resumeId, String templateName);
}
......@@ -2,7 +2,6 @@ package com.bkty.system.service.resume.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
......@@ -13,7 +12,6 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.bkty.system.api.model.LoginUser;
import com.bkty.system.config.AiConfigProperties;
import com.bkty.system.config.CommonAsyncThreadPool;
import com.bkty.system.domain.dto.ResumeByPdfDto;
import com.bkty.system.domain.dto.ResumeListItemCache;
import com.bkty.system.domain.dto.ResumeMakeDto;
import com.bkty.system.domain.entity.*;
......@@ -30,17 +28,14 @@ import lombok.extern.slf4j.Slf4j;
import org.dromara.common.core.constant.CacheConstants;
import org.dromara.common.core.constant.Constants;
import org.dromara.common.core.constant.CozeConstsnts;
import org.dromara.common.core.constant.SecurityConstants;
import org.dromara.common.core.domain.UserLoginInfo;
import org.dromara.common.core.enums.ResumeEnum;
import org.dromara.common.core.exception.WarnException;
import org.dromara.common.core.utils.SecurityUtils;
import org.dromara.common.core.utils.SnowFlakeUtil;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.core.utils.WebUtils;
import org.dromara.common.satoken.utils.LoginHelper;
import org.springframework.beans.BeanUtils;
import org.springframework.context.ApplicationContext;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.http.HttpHeaders;
import org.springframework.scheduling.annotation.Async;
......@@ -57,7 +52,6 @@ import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
* @author Herbert
......@@ -655,7 +649,7 @@ public class NewEditionResumeServiceImpl implements NewEditionResumeService {
}
//缓存简历大JSON
queryNewEditionResumeId(resumeMakeDto.getResumeId());
return createResumeHtml(resumeMakeDto.getResumeId());
return createResumeHtml(resumeMakeDto.getResumeId(), resumeMakeDto.getTemplateName());
}
@Override
......@@ -691,7 +685,10 @@ public class NewEditionResumeServiceImpl implements NewEditionResumeService {
}
@Override
public String createResumeHtml(String resumeId) {
public String createResumeHtml(String resumeId, String templateName) {
if (StringUtils.isBlank(templateName)) {
templateName = "tpl1.ejs";
}
if (StringUtils.isBlank(resumeId)) {
throw new WarnException("简历ID不能为空");
}
......@@ -738,7 +735,7 @@ public class NewEditionResumeServiceImpl implements NewEditionResumeService {
String htmlName = resumeId + ".html";
FileProcessor.processFile(properties.getPath() + "template/" + "templateName", properties.getPath() + "output/" + htmlName, "<%- data %>", jsonString);
FileProcessor.processFile(properties.getPath() + "template/" + templateName, properties.getPath() + "output/" + htmlName, "<%- data %>", jsonString);
redisTemplate.opsForValue().set(CacheConstants.CREATE_RESUME_HTML_DATA.formatted(resumeId), jsonString);
redisTemplate.opsForValue().set(CacheConstants.CREATE_RESUME_HTML.formatted(resumeId), properties.getHtmlDown() + htmlName);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment