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
db93e21b
authored
Dec 25, 2025
by
zwb
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修改简历pdf生成时名称添加随机值
parent
5838e4e5
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
5 deletions
employmentBusiness-pc-modules/employmentBusiness-pc-system/src/main/java/com/bkty/system/controller/JobRecommendController.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/controller/JobRecommendController.java
View file @
db93e21b
...
@@ -16,6 +16,7 @@ import io.swagger.v3.oas.annotations.Operation;
...
@@ -16,6 +16,7 @@ import io.swagger.v3.oas.annotations.Operation;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
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.R
;
import
org.dromara.common.core.exception.JxgException
;
import
org.dromara.common.core.exception.JxgException
;
import
org.dromara.common.core.exception.WarnException
;
import
org.dromara.common.core.exception.WarnException
;
...
@@ -68,6 +69,7 @@ public class JobRecommendController {
...
@@ -68,6 +69,7 @@ public class JobRecommendController {
* @param dto
* @param dto
* @return
* @return
*/
*/
@RepeatSubmit
(
interval
=
1000
)
@PostMapping
(
"/save-analysis-data"
)
@PostMapping
(
"/save-analysis-data"
)
private
R
<
String
>
saveAnalysisData
(
@RequestBody
AnalysisCareerDto
dto
){
private
R
<
String
>
saveAnalysisData
(
@RequestBody
AnalysisCareerDto
dto
){
if
(
CollectionUtil
.
isEmpty
(
dto
.
getCareer
()))
{
if
(
CollectionUtil
.
isEmpty
(
dto
.
getCareer
()))
{
...
@@ -82,6 +84,12 @@ public class JobRecommendController {
...
@@ -82,6 +84,12 @@ public class JobRecommendController {
if
(
ObjectUtil
.
isEmpty
(
dto
.
getResumeId
()))
{
if
(
ObjectUtil
.
isEmpty
(
dto
.
getResumeId
()))
{
throw
new
JxgException
(
"简历Id不能为空"
);
throw
new
JxgException
(
"简历Id不能为空"
);
}
}
if
(
dto
.
getCareer
().
size
()>
5
){
throw
new
JxgException
(
"期望职业最多只能选择五个"
);
}
if
(
dto
.
getTargetCity
().
size
()>
5
){
throw
new
JxgException
(
"期望城市最多只能选择五个"
);
}
String
id
=
aiAnalysisService
.
saveAnalysisData
(
dto
);
String
id
=
aiAnalysisService
.
saveAnalysisData
(
dto
);
return
new
R
<>(
id
);
return
new
R
<>(
id
);
}
}
...
...
employmentBusiness-pc-modules/employmentBusiness-pc-system/src/main/java/com/bkty/system/service/resume/impl/NewEditionResumeServiceImpl.java
View file @
db93e21b
...
@@ -50,10 +50,7 @@ import java.io.InputStreamReader;
...
@@ -50,10 +50,7 @@ import java.io.InputStreamReader;
import
java.time.LocalDate
;
import
java.time.LocalDate
;
import
java.time.format.DateTimeFormatter
;
import
java.time.format.DateTimeFormatter
;
import
java.time.temporal.ChronoUnit
;
import
java.time.temporal.ChronoUnit
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.regex.Matcher
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
java.util.regex.Pattern
;
...
@@ -1091,6 +1088,9 @@ public class NewEditionResumeServiceImpl implements NewEditionResumeService {
...
@@ -1091,6 +1088,9 @@ public class NewEditionResumeServiceImpl implements NewEditionResumeService {
public
String
sanitizeFileName
(
String
fileName
)
{
public
String
sanitizeFileName
(
String
fileName
)
{
if
(
fileName
==
null
)
return
null
;
if
(
fileName
==
null
)
return
null
;
// 生成8位随机字符串(包含数字和小写字母)
String
randomSuffix
=
generateRandomString
(
5
);
// [^a-zA-Z0-9\u4e00-\u9fa5.-] 表示不是字母、数字、中文、点、短横线的字符都替换成 _
// [^a-zA-Z0-9\u4e00-\u9fa5.-] 表示不是字母、数字、中文、点、短横线的字符都替换成 _
String
sanitized
=
fileName
.
replaceAll
(
"[^a-zA-Z0-9\\u4e00-\\u9fa5.-]"
,
"_"
);
String
sanitized
=
fileName
.
replaceAll
(
"[^a-zA-Z0-9\\u4e00-\\u9fa5.-]"
,
"_"
);
...
@@ -1100,7 +1100,22 @@ public class NewEditionResumeServiceImpl implements NewEditionResumeService {
...
@@ -1100,7 +1100,22 @@ public class NewEditionResumeServiceImpl implements NewEditionResumeService {
// 可选:连续多个特殊字符替换成一个 _
// 可选:连续多个特殊字符替换成一个 _
sanitized
=
sanitized
.
replaceAll
(
"_+"
,
"_"
);
sanitized
=
sanitized
.
replaceAll
(
"_+"
,
"_"
);
return
sanitized
;
// 组合最终文件名:原始清理后的名称 + 随机后缀
return
sanitized
+
"_"
+
randomSuffix
;
}
// 生成指定长度的随机字符串
private
String
generateRandomString
(
int
length
)
{
String
chars
=
"abcdefghijklmnopqrstuvwxyz0123456789"
;
StringBuilder
sb
=
new
StringBuilder
();
Random
random
=
new
Random
();
for
(
int
i
=
0
;
i
<
length
;
i
++)
{
int
index
=
random
.
nextInt
(
chars
.
length
());
sb
.
append
(
chars
.
charAt
(
index
));
}
return
sb
.
toString
();
}
}
private
ResumeModelVo
initModelVo
(
FunctionResumeModel
m
)
{
private
ResumeModelVo
initModelVo
(
FunctionResumeModel
m
)
{
...
...
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