Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
张文彪
/
employmentBusinessPc
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
c5291016
authored
Dec 10, 2025
by
zwb
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
添加简历html转为小图png
parent
686c074b
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
142 additions
and
2 deletions
employmentBusiness-pc-common/employmentBusiness-pc-common-core/src/main/java/org/dromara/common/core/constant/CacheConstants.java
employmentBusiness-pc-modules/employmentBusiness-pc-system/src/main/java/com/bkty/system/config/AiConfigProperties.java
employmentBusiness-pc-modules/employmentBusiness-pc-system/src/main/java/com/bkty/system/controller/NewEditionResumeController.java
employmentBusiness-pc-modules/employmentBusiness-pc-system/src/main/java/com/bkty/system/service/jobRecommend/impl/JobRecommendServiceImpl.java
employmentBusiness-pc-modules/employmentBusiness-pc-system/src/main/java/com/bkty/system/service/resume/NewEditionResumeService.java
employmentBusiness-pc-modules/employmentBusiness-pc-system/src/main/java/com/bkty/system/service/resume/impl/NewEditionResumeServiceImpl.java
employmentBusiness-pc-common/employmentBusiness-pc-common-core/src/main/java/org/dromara/common/core/constant/CacheConstants.java
View file @
c5291016
...
...
@@ -86,6 +86,22 @@ public interface CacheConstants {
*/
String
RESUME_TEMPLATE_PDF_ID
=
"template:resume:pdf:download:%s"
;
/**
* 简历下载数据缓存数据png min
*/
String
CREATE_RESUME_HTML_PNG_MIN_DATA
=
"create:resume:html:png:min:data:%s"
;
/**
* 简历下载数据缓存png min
*/
String
CREATE_RESUME_PNG_MIN_HTML
=
"create:resume:png:min:html:%s"
;
/**
* 下载使用简历对应模版缓存png min
*/
String
RESUME_TEMPLATE_PNG_MIN_ID
=
"template:resume:png:min:download:%s"
;
/**分析职业期望数据*/
String
REDIS_USER_ANALYSIS_KEY
=
"user:analysis:%s"
;
}
employmentBusiness-pc-modules/employmentBusiness-pc-system/src/main/java/com/bkty/system/config/AiConfigProperties.java
View file @
c5291016
...
...
@@ -27,7 +27,8 @@ public class AiConfigProperties {
public
String
htmlDown
;
// public String imagesDown = "https://xzt-dev.jinsehuaqin.com/images_down/";
public
String
imagesDown
;
// = "https://xzt-dev.jinsehuaqin.com/images_down/"
//
// public String avatarPath = "/resume/avatarImages/";
//
...
...
employmentBusiness-pc-modules/employmentBusiness-pc-system/src/main/java/com/bkty/system/controller/NewEditionResumeController.java
View file @
c5291016
...
...
@@ -164,6 +164,19 @@ public class NewEditionResumeController {
}
/**
* 根据html生成小png图片
* @param dto
* @return
*/
@PostMapping
(
"/create-resume-min-png"
)
public
R
<
ResumeByPdfVo
>
createResumeMinPng
(
@RequestBody
ResumeByPdfDto
dto
){
ResumeByPdfVo
vo
=
this
.
newEditionResumeService
.
createResumeMinPng
(
dto
);
return
new
R
<>(
vo
);
}
/**
* 简历模块优化
* @param dto
* @return
...
...
employmentBusiness-pc-modules/employmentBusiness-pc-system/src/main/java/com/bkty/system/service/jobRecommend/impl/JobRecommendServiceImpl.java
View file @
c5291016
...
...
@@ -139,7 +139,6 @@ public class JobRecommendServiceImpl implements JobRecommendService {
return
;
}
Integer
orlStatus
=
aiRecommendBase
.
getRecommendStatus
();
log
.
info
(
"修改岗位意向数据为推送中"
);
aiAnalysisMapper
.
updateAnalysis
(
analysisId
,
1
,
thisUserId
,
1
);
...
...
employmentBusiness-pc-modules/employmentBusiness-pc-system/src/main/java/com/bkty/system/service/resume/NewEditionResumeService.java
View file @
c5291016
...
...
@@ -122,4 +122,10 @@ public interface NewEditionResumeService {
void
reversalExperience
(
ResumeExpChangeDto
dto
)
throws
Exception
;
/**
* 根据html生成小png图片
* @param dto
* @return
*/
ResumeByPdfVo
createResumeMinPng
(
ResumeByPdfDto
dto
);
}
employmentBusiness-pc-modules/employmentBusiness-pc-system/src/main/java/com/bkty/system/service/resume/impl/NewEditionResumeServiceImpl.java
View file @
c5291016
...
...
@@ -964,6 +964,111 @@ public class NewEditionResumeServiceImpl implements NewEditionResumeService {
}
}
@Override
public
ResumeByPdfVo
createResumeMinPng
(
ResumeByPdfDto
dto
)
{
if
(
StringUtils
.
isBlank
(
dto
.
getResumeId
())){
throw
new
WarnException
(
"简历ID不能为空"
);
}
if
(
StringUtils
.
isBlank
(
dto
.
getTemplateName
())){
dto
.
setTemplateName
(
"tpl21.ejs"
);
}
ResumeByPdfVo
vo
=
new
ResumeByPdfVo
();
/**是否展示0.显示 1.不显示*/
Map
<
String
,
Object
>
objectMap
=
newEditionResumeUtil
.
queryAllModelData
(
dto
.
getResumeId
(),
"0"
);
Object
baseInfo
=
objectMap
.
get
(
"base"
);
if
(
baseInfo
!=
null
)
{
JSONObject
jsonObject
=
(
JSONObject
)
JSON
.
toJSON
(
baseInfo
);
String
age
=
jsonObject
.
getString
(
"birthday"
);
// 计算年龄
String
calculatedAge
=
calculationAge
(
age
);
// 放回 JSON 对象中
jsonObject
.
put
(
"birthday"
,
calculatedAge
);
jsonObject
.
put
(
"workTime"
,
""
);
// 更新 base_info
objectMap
.
put
(
"base"
,
jsonObject
);
}
log
.
info
(
"========导出简历数据1=========:{}"
,
objectMap
);
String
jsonString
=
JSON
.
toJSONString
(
objectMap
);
log
.
info
(
"========导出简历数据2=========:{}"
,
jsonString
);
if
(
objectMap
.
get
(
"base"
)
!=
null
){
Map
<
String
,
Object
>
map
=
JSON
.
parseObject
(
String
.
valueOf
(
objectMap
.
get
(
"base"
)),
Map
.
class
);
if
(
map
.
get
(
"resumeName"
)
!=
null
){
vo
.
setResumeName
(
map
!=
null
?
String
.
valueOf
(
map
.
get
(
"resumeName"
))
:
""
);
}
else
{
FunctionResumeBase
resumeBase
=
this
.
functionResumeBaseMapper
.
selectById
(
dto
.
getResumeId
());
vo
.
setResumeName
(
resumeBase
.
getResumeName
());
this
.
resumeCacheService
.
saveResumeModelDataCache
(
Long
.
valueOf
(
dto
.
getResumeId
()),
Long
.
valueOf
(
dto
.
getResumeId
()),
JSON
.
toJSONString
(
resumeBase
));
}
vo
.
setUserName
(
map
!=
null
?
String
.
valueOf
(
map
.
get
(
"username"
))
:
""
);
}
String
data
=
redisTemplate
.
opsForValue
().
get
(
CacheConstants
.
CREATE_RESUME_HTML_PNG_MIN_DATA
.
formatted
(
dto
.
getResumeId
()));
if
(
com
.
alibaba
.
excel
.
util
.
StringUtils
.
isNotBlank
(
data
)){
if
(
jsonString
.
equals
(
data
)){
String
template
=
redisTemplate
.
opsForValue
().
get
(
CacheConstants
.
RESUME_TEMPLATE_PNG_MIN_ID
.
formatted
(
dto
.
getResumeId
()));
if
(
com
.
alibaba
.
excel
.
util
.
StringUtils
.
isNotBlank
(
template
)
&&
template
.
equals
(
dto
.
getTemplateName
())){
String
json
=
redisTemplate
.
opsForValue
().
get
(
CacheConstants
.
CREATE_RESUME_PNG_MIN_HTML
.
formatted
(
dto
.
getResumeId
()));
if
(
com
.
alibaba
.
excel
.
util
.
StringUtils
.
isNotBlank
(
json
)){
ResumeByPdfVo
resume
=
JSON
.
parseObject
(
json
,
ResumeByPdfVo
.
class
);
return
resume
;
}
}
}
}
log
.
info
(
"简历预览数据: {}"
,
jsonString
);
String
htmlName
=
dto
.
getResumeId
()
+
".html"
;
FileProcessor
.
processFile
(
properties
.
getPath
()
+
"template/"
+
dto
.
getTemplateName
(),
properties
.
getPath
()
+
"output/"
+
htmlName
,
"<%- data %>"
,
jsonString
);
// Node.js 命令及参数
String
nodeExecutable
=
"node"
;
// 如果环境变量已配置 Node.js,可直接用 "node"
String
pngPathMin
=
properties
.
getPath
()
+
"screenshot_min"
;
String
inputFile
=
"file:///"
+
properties
.
getPath
()+
"output/"
+
dto
.
getResumeId
()
+
".html"
;
String
pngNameMin
=
SnowFlakeUtil
.
newIdString
()
+
"min.png"
;
//小图片
try
{
// 构建 ProcessBuilder 并传递参数
ProcessBuilder
processBuilder
=
new
ProcessBuilder
(
nodeExecutable
,
pngPathMin
,
inputFile
,
properties
.
getPath
()
+
"images/"
+
pngNameMin
);
// 合并标准输出和错误输出
processBuilder
.
redirectErrorStream
(
true
);
// 启动进程
Process
process
=
processBuilder
.
start
();
// 读取 Node.js 命令行输出
BufferedReader
reader
=
new
BufferedReader
(
new
InputStreamReader
(
process
.
getInputStream
()));
String
line
;
while
((
line
=
reader
.
readLine
())
!=
null
)
{
log
.
info
(
"Node.js 输出png: {}"
,
line
);
}
// 等待命令执行完成
int
exitCode
=
process
.
waitFor
();
log
.
info
(
"Node.js 命令执行完成,退出码: {}"
,
exitCode
);
}
catch
(
IOException
|
InterruptedException
e
)
{
e
.
printStackTrace
();
}
String
header
=
WebUtils
.
getRequest
().
getHeader
(
SecurityConstants
.
QQXB_FROM
);
// if(StringUtils.isNotBlank(header) && !SecurityConstants.QQXB_OUT.equals(header) && !SecurityConstants.JYXZ_OUT.equals(header)){
vo
.
setHtmlName
(
properties
.
getHtmlDown
()
+
htmlName
);
vo
.
setPngNameMin
(
properties
.
getImagesDown
()
+
pngNameMin
);
// }else {
// vo.setHtmlName(properties.getHtmlDownZs() + htmlName);
// vo.setPngNameMin(properties.getImagesDownZs() + pngNameMin);
// }
redisTemplate
.
opsForValue
().
set
(
CacheConstants
.
CREATE_RESUME_HTML_PNG_MIN_DATA
.
formatted
(
dto
.
getResumeId
()),
jsonString
);
redisTemplate
.
opsForValue
().
set
(
CacheConstants
.
CREATE_RESUME_PNG_MIN_HTML
.
formatted
(
dto
.
getResumeId
()),
JSON
.
toJSONString
(
vo
));
redisTemplate
.
opsForValue
().
set
(
CacheConstants
.
RESUME_TEMPLATE_PNG_MIN_ID
.
formatted
(
dto
.
getResumeId
()),
dto
.
getTemplateName
());
return
vo
;
}
public
String
sanitizeFileName
(
String
fileName
)
{
if
(
fileName
==
null
)
return
null
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment