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
fa8137f8
authored
Dec 17, 2025
by
zwb
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修改简历生成html文件添加字体参数
parent
1ed5c8ba
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
56 additions
and
5 deletions
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/domain/dto/ResumeByPdfDto.java
employmentBusiness-pc-modules/employmentBusiness-pc-system/src/main/java/com/bkty/system/domain/dto/ResumeMakeDto.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-modules/employmentBusiness-pc-system/src/main/java/com/bkty/system/utils/FileProcessor.java
employmentBusiness-pc-modules/employmentBusiness-pc-system/src/main/java/com/bkty/system/controller/NewEditionResumeController.java
View file @
fa8137f8
...
...
@@ -156,7 +156,7 @@ public class NewEditionResumeController {
if
(
dto
.
getResumeId
()
==
null
)
{
throw
new
WarnException
(
"简历ID不能为空"
);
}
return
new
R
<>(
this
.
newEditionResumeService
.
createResumeHtml
(
dto
.
getResumeId
(),
dto
.
getTemplateName
()));
return
new
R
<>(
this
.
newEditionResumeService
.
createResumeHtml
(
dto
.
getResumeId
(),
dto
.
getTemplateName
()
,
dto
.
getFontSize
(),
dto
.
getLineHeight
()
));
}
/**
...
...
employmentBusiness-pc-modules/employmentBusiness-pc-system/src/main/java/com/bkty/system/domain/dto/ResumeByPdfDto.java
View file @
fa8137f8
...
...
@@ -15,4 +15,10 @@ public class ResumeByPdfDto {
@Schema
(
description
=
"权益id"
)
private
String
vipId
;
@Schema
(
description
=
"字体大小"
)
private
String
fontSize
;
@Schema
(
description
=
"行高"
)
private
String
lineHeight
;
}
employmentBusiness-pc-modules/employmentBusiness-pc-system/src/main/java/com/bkty/system/domain/dto/ResumeMakeDto.java
View file @
fa8137f8
package
com
.
bkty
.
system
.
domain
.
dto
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
java.util.List
;
...
...
@@ -60,4 +61,10 @@ public class ResumeMakeDto {
/**模块名称*/
private
String
modelName
;
/**字体大小*/
private
String
fontSize
;
/**行高*/
private
String
lineHeight
;
}
employmentBusiness-pc-modules/employmentBusiness-pc-system/src/main/java/com/bkty/system/service/resume/NewEditionResumeService.java
View file @
fa8137f8
...
...
@@ -72,7 +72,7 @@ public interface NewEditionResumeService {
* @param templateName
* @return
*/
String
createResumeHtml
(
String
resumeId
,
String
templateName
);
String
createResumeHtml
(
String
resumeId
,
String
templateName
,
String
fontSize
,
String
lineHeight
);
/**
* 简历模块优化
...
...
@@ -128,4 +128,5 @@ public interface NewEditionResumeService {
* @return
*/
ResumeByPdfVo
createResumeMinPng
(
ResumeByPdfDto
dto
);
}
employmentBusiness-pc-modules/employmentBusiness-pc-system/src/main/java/com/bkty/system/service/resume/impl/NewEditionResumeServiceImpl.java
View file @
fa8137f8
...
...
@@ -662,7 +662,7 @@ public class NewEditionResumeServiceImpl implements NewEditionResumeService {
}
//缓存简历大JSON
queryNewEditionResumeId
(
resumeMakeDto
.
getResumeId
());
return
createResumeHtml
(
resumeMakeDto
.
getResumeId
(),
resumeMakeDto
.
getTemplateName
());
return
createResumeHtml
(
resumeMakeDto
.
getResumeId
(),
resumeMakeDto
.
getTemplateName
()
,
resumeMakeDto
.
getFontSize
(),
resumeMakeDto
.
getLineHeight
()
);
}
@Override
...
...
@@ -698,10 +698,16 @@ public class NewEditionResumeServiceImpl implements NewEditionResumeService {
}
@Override
public
String
createResumeHtml
(
String
resumeId
,
String
templateName
)
{
public
String
createResumeHtml
(
String
resumeId
,
String
templateName
,
String
fontSize
,
String
lineHeight
)
{
if
(
StringUtils
.
isBlank
(
templateName
))
{
templateName
=
"tpl21.ejs"
;
}
if
(
fontSize
==
null
||
fontSize
.
equals
(
""
))
{
fontSize
=
"14px"
;
}
if
(
lineHeight
==
null
||
lineHeight
.
equals
(
""
))
{
lineHeight
=
"1.7"
;
}
if
(
StringUtils
.
isBlank
(
resumeId
))
{
throw
new
WarnException
(
"简历ID不能为空"
);
}
...
...
@@ -721,6 +727,8 @@ public class NewEditionResumeServiceImpl implements NewEditionResumeService {
// 更新 base_info
objectMap
.
put
(
"base"
,
jsonObject
);
}
// objectMap.put("fontSize",fontSize!=null?fontSize:"14px");
// objectMap.put("lineHeight",lineHeight!=null?lineHeight:"1.7");
String
jsonString
=
JSON
.
toJSONString
(
objectMap
);
if
(
objectMap
.
get
(
"base"
)
!=
null
)
{
...
...
@@ -748,7 +756,7 @@ public class NewEditionResumeServiceImpl implements NewEditionResumeService {
String
htmlName
=
resumeId
+
".html"
;
FileProcessor
.
processFile
(
properties
.
getPath
()
+
"template/"
+
templateName
,
properties
.
getPath
()
+
"output/"
+
htmlName
,
"<%- data %>"
,
jsonString
);
FileProcessor
.
processFile
WithSize
(
properties
.
getPath
()
+
"template/"
+
templateName
,
properties
.
getPath
()
+
"output/"
+
htmlName
,
"<%- data %>"
,
jsonString
,
"<%- FontSize %>"
,
fontSize
,
"<%- LineHeight %>"
,
lineHeight
);
redisTemplate
.
opsForValue
().
set
(
CacheConstants
.
CREATE_RESUME_HTML_DATA
.
formatted
(
resumeId
),
jsonString
);
redisTemplate
.
opsForValue
().
set
(
CacheConstants
.
CREATE_RESUME_HTML
.
formatted
(
resumeId
),
properties
.
getHtmlDown
()
+
htmlName
);
...
...
employmentBusiness-pc-modules/employmentBusiness-pc-system/src/main/java/com/bkty/system/utils/FileProcessor.java
View file @
fa8137f8
...
...
@@ -34,6 +34,35 @@ public class FileProcessor {
e
.
printStackTrace
();
}
}
public
static
void
processFileWithSize
(
String
sourceFilePath
,
String
targetFilePath
,
String
oldData
,
String
newData
,
String
oldFontSize
,
String
newFontSize
,
String
oldLineHeight
,
String
newLineHeight
)
{
File
sourceFile
=
new
File
(
sourceFilePath
);
File
targetFile
=
new
File
(
targetFilePath
);
// 读取和替换逻辑
try
(
BufferedReader
reader
=
new
BufferedReader
(
new
InputStreamReader
(
new
FileInputStream
(
sourceFile
),
StandardCharsets
.
UTF_8
));
BufferedWriter
writer
=
new
BufferedWriter
(
new
OutputStreamWriter
(
new
FileOutputStream
(
targetFile
),
StandardCharsets
.
UTF_8
)))
{
String
line
;
while
((
line
=
reader
.
readLine
())
!=
null
)
{
// 替换字符串
String
replacedLine
=
line
;
if
(
line
.
contains
(
oldData
))
{
replacedLine
=
line
.
replace
(
oldData
,
newData
);
}
if
(
line
.
contains
(
oldFontSize
))
{
replacedLine
=
line
.
replace
(
oldFontSize
,
newFontSize
);
}
if
(
line
.
contains
(
oldLineHeight
))
{
replacedLine
=
line
.
replace
(
oldLineHeight
,
newLineHeight
);
}
writer
.
write
(
replacedLine
);
writer
.
newLine
();
// 写入换行符
}
System
.
out
.
println
(
"文件处理完成,已生成新的HTML文件:"
+
targetFilePath
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
public
static
void
main
(
String
[]
args
)
{
// 示例:读取 `/data/test.txt`,将 `Hello` 替换为 `Hi`,生成 `/data/result.html`
...
...
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