Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yifu-mvp
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fangxinjiang
yifu-mvp
Commits
3abee3c4
Commit
3abee3c4
authored
Mar 01, 2023
by
fangxinjiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
手机号码校验 50个校验
parent
acdbd36c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
4 deletions
+39
-4
TCheckMobileController.java
...loud/plus/v1/check/controller/TCheckMobileController.java
+11
-1
TCheckMobileServiceImpl.java
...d/plus/v1/check/service/impl/TCheckMobileServiceImpl.java
+28
-3
No files found.
yifu-check/yifu-check-biz/src/main/java/com/yifu/cloud/plus/v1/check/controller/TCheckMobileController.java
View file @
3abee3c4
...
...
@@ -173,5 +173,15 @@ public class TCheckMobileController {
public
CheckBatchVo
checkMobileBatch
(
@RequestBody
List
<
String
>
list
)
{
return
tCheckMobileService
.
checkMobileBatch
(
list
);
}
/**
* @Author fxj
* @Description 批量手机号校验
* @Date 18:20 2023/3/1
**/
@Operation
(
description
=
"批量手机号校验"
)
@SysLog
(
"批量手机号校验"
)
@PostMapping
(
"/checkMobileBatch"
)
public
CheckBatchVo
checkMobileBatchs
(
@RequestBody
List
<
String
>
list
)
{
return
tCheckMobileService
.
checkMobileBatch
(
list
);
}
}
yifu-check/yifu-check-biz/src/main/java/com/yifu/cloud/plus/v1/check/service/impl/TCheckMobileServiceImpl.java
View file @
3abee3c4
...
...
@@ -178,9 +178,35 @@ public class TCheckMobileServiceImpl extends ServiceImpl<TCheckMobileMapper, TCh
}
}
List
<
String
>
noCurlist
=
new
ArrayList
<>();
Boolean
cur
;
Map
<
String
,
Boolean
>
backMap
=
new
HashMap
<>();
List
<
String
>
tempList
=
new
ArrayList
<>();
// 因手机号码最多50个所以这里 要特殊处理下
if
(
Common
.
isNotNull
(
list
)){
//计数器
int
count
=
1
;
for
(
String
phone:
list
){
tempList
.
add
(
phone
);
if
(
count
==
50
){
checkMobiles
(
tempList
,
vo
,
noMap
,
noCurlist
,
backMap
);
tempList
.
clear
();
// 重置
count
=
1
;
}
else
{
count
++;
}
}
}
checkMobiles
(
tempList
,
vo
,
noMap
,
noCurlist
,
backMap
);
return
vo
;
}
private
void
checkMobiles
(
List
<
String
>
list
,
CheckBatchVo
vo
,
Map
<
String
,
Boolean
>
noMap
,
List
<
String
>
noCurlist
,
Map
<
String
,
Boolean
>
backMap
)
{
StringBuilder
phones
=
new
StringBuilder
();
Boolean
cur
;
for
(
String
check
:
list
)
{
cur
=
noMap
.
get
(
check
);
if
(
cur
!=
null
)
{
...
...
@@ -213,10 +239,9 @@ public class TCheckMobileServiceImpl extends ServiceImpl<TCheckMobileMapper, TCh
if
(!
saveList
.
isEmpty
())
{
this
.
saveBatch
(
saveList
);
}
saveList
.
clear
();
}
}
vo
.
setCheckMap
(
backMap
);
return
vo
;
}
}
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