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
45289a21
authored
Dec 12, 2025
by
zwb
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
添加手机号邮箱校验
parent
297d8c34
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
82 additions
and
0 deletions
employmentBusiness-pc-modules/employmentBusiness-pc-system/src/main/java/com/bkty/system/utils/NewEditionResumeUtil.java
employmentBusiness-pc-modules/employmentBusiness-pc-system/src/main/java/com/bkty/system/utils/NewEditionResumeUtil.java
View file @
45289a21
...
@@ -3,6 +3,8 @@ import java.lang.reflect.Field;
...
@@ -3,6 +3,8 @@ import java.lang.reflect.Field;
import
java.util.Date
;
import
java.util.Date
;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Maps
;
import
java.util.regex.Pattern
;
import
java.util.regex.Matcher
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
...
@@ -19,6 +21,7 @@ import org.apache.poi.ss.formula.functions.T;
...
@@ -19,6 +21,7 @@ import org.apache.poi.ss.formula.functions.T;
import
org.dromara.common.core.constant.CacheConstants
;
import
org.dromara.common.core.constant.CacheConstants
;
import
org.dromara.common.core.domain.UserLoginInfo
;
import
org.dromara.common.core.domain.UserLoginInfo
;
import
org.dromara.common.core.enums.ResumeEnum
;
import
org.dromara.common.core.enums.ResumeEnum
;
import
org.dromara.common.core.exception.WarnException
;
import
org.dromara.common.core.utils.JsonToObjectMapper
;
import
org.dromara.common.core.utils.JsonToObjectMapper
;
import
org.dromara.common.core.utils.SnowFlakeUtil
;
import
org.dromara.common.core.utils.SnowFlakeUtil
;
import
org.dromara.common.core.utils.StringUtils
;
import
org.dromara.common.core.utils.StringUtils
;
...
@@ -31,6 +34,8 @@ import java.time.LocalDate;
...
@@ -31,6 +34,8 @@ import java.time.LocalDate;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.time.format.DateTimeFormatter
;
import
java.util.*
;
import
java.util.*
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
@Slf4j
@Slf4j
@Service
@Service
...
@@ -692,6 +697,9 @@ public class NewEditionResumeUtil {
...
@@ -692,6 +697,9 @@ public class NewEditionResumeUtil {
public
void
updateBaseInfo
(
ResumeMakeDto
resumeMakeDto
,
Long
userId
)
{
public
void
updateBaseInfo
(
ResumeMakeDto
resumeMakeDto
,
Long
userId
)
{
FunctionResumeBase
resumeBase
=
JsonToObjectMapper
.
mapJsonToObject
(
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
resumeMakeDto
.
getBodyData
())),
FunctionResumeBase
resumeBase
=
JsonToObjectMapper
.
mapJsonToObject
(
JSONObject
.
parseObject
(
JSON
.
toJSONString
(
resumeMakeDto
.
getBodyData
())),
FunctionResumeBase
.
class
);
FunctionResumeBase
.
class
);
if
(
validateChineseMobile
(
resumeBase
.
getPhone
())){
throw
new
WarnException
(
"手机号格式不正确"
);
}
resumeBase
.
setResumeName
(
resumeMakeDto
.
getResumeName
());
resumeBase
.
setResumeName
(
resumeMakeDto
.
getResumeName
());
resumeBase
.
setId
(
Long
.
valueOf
(
resumeMakeDto
.
getResumeId
()));
resumeBase
.
setId
(
Long
.
valueOf
(
resumeMakeDto
.
getResumeId
()));
resumeBase
.
setUserId
(
userId
);
resumeBase
.
setUserId
(
userId
);
...
@@ -718,6 +726,80 @@ public class NewEditionResumeUtil {
...
@@ -718,6 +726,80 @@ public class NewEditionResumeUtil {
resume
.
resumeCacheService
.
saveResumeModelDataCache
(
resumeBase
.
getId
(),
resumeBase
.
getId
(),
JSON
.
toJSONString
(
resumeBase
));
resume
.
resumeCacheService
.
saveResumeModelDataCache
(
resumeBase
.
getId
(),
resumeBase
.
getId
(),
JSON
.
toJSONString
(
resumeBase
));
}
}
// 更严格的RFC 5322实现
private
static
final
String
STRICT_EMAIL_REGEX
=
"^(?=.{1,64}@)[A-Za-z0-9_-]+(\\.[A-Za-z0-9_-]+)*@"
+
"[^-][A-Za-z0-9-]+(\\.[A-Za-z0-9-]+)*(\\.[A-Za-z]{2,})$"
;
private
static
final
Pattern
STRICT_EMAIL_PATTERN
=
Pattern
.
compile
(
STRICT_EMAIL_REGEX
,
Pattern
.
CASE_INSENSITIVE
);
/**
* 邮箱校验
* @param email
* @return
*/
public
boolean
validateEmailStrict
(
String
email
)
{
if
(
email
==
null
||
email
.
trim
().
isEmpty
())
{
return
false
;
}
String
emailStr
=
email
.
trim
();
// 长度检查
if
(
emailStr
.
length
()
>
254
)
{
return
false
;
}
String
[]
parts
=
emailStr
.
split
(
"@"
);
if
(
parts
.
length
!=
2
)
{
return
false
;
}
String
localPart
=
parts
[
0
];
String
domain
=
parts
[
1
];
// 本地部分长度检查(RFC 5321限制)
if
(
localPart
.
length
()
>
64
)
{
return
false
;
}
// 域名长度检查
if
(
domain
.
length
()
>
253
)
{
return
false
;
}
// 不允许连续的点
if
(
emailStr
.
contains
(
".."
))
{
return
false
;
}
// 本地部分不能以点开头或结尾
if
(
localPart
.
startsWith
(
"."
)
||
localPart
.
endsWith
(
"."
))
{
return
false
;
}
return
STRICT_EMAIL_PATTERN
.
matcher
(
emailStr
).
matches
();
}
/**
* 手机号校验
*/
public
Boolean
validateChineseMobile
(
String
phone
)
{
if
(
phone
==
null
||
phone
.
trim
().
isEmpty
())
{
return
false
;
}
// 去除空格和特殊字符
String
cleanPhone
=
phone
.
replaceAll
(
"\\s+|-"
,
""
);
// 正则表达式:1开头,第二位3-9,总共11位
Pattern
pattern
=
Pattern
.
compile
(
"^1[3-9]\\d{9}$"
);
Matcher
matcher
=
pattern
.
matcher
(
cleanPhone
);
return
matcher
.
matches
();
}
/**
/**
* 修改自定义模块信息
* 修改自定义模块信息
*/
*/
...
...
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