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
50c4bf3a
Commit
50c4bf3a
authored
Jun 22, 2022
by
fangxinjiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
小工具本地校验
parent
a5a8f0d7
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
128 additions
and
7 deletions
+128
-7
TCheckBankNo.java
...ava/com/yifu/cloud/plus/v1/check/entity/TCheckBankNo.java
+12
-0
TCheckBankNoController.java
...loud/plus/v1/check/controller/TCheckBankNoController.java
+18
-1
TCheckIdCardController.java
...loud/plus/v1/check/controller/TCheckIdCardController.java
+15
-0
TCheckMobileController.java
...loud/plus/v1/check/controller/TCheckMobileController.java
+17
-3
TCheckBankNoServiceImpl.java
...d/plus/v1/check/service/impl/TCheckBankNoServiceImpl.java
+16
-1
TCheckMobileServiceImpl.java
...d/plus/v1/check/service/impl/TCheckMobileServiceImpl.java
+17
-2
TCheckBankNoMapper.xml
...heck-biz/src/main/resources/mapper/TCheckBankNoMapper.xml
+2
-0
Common.java
.../com/yifu.cloud.plus.v1/yifu/common/core/util/Common.java
+31
-0
No files found.
yifu-check/yifu-check-api/src/main/java/com/yifu/cloud/plus/v1/check/entity/TCheckBankNo.java
View file @
50c4bf3a
...
@@ -98,5 +98,17 @@ public class TCheckBankNo extends BaseEntity {
...
@@ -98,5 +98,17 @@ public class TCheckBankNo extends BaseEntity {
@Schema
(
description
=
"银行卡类别 样例:借记卡"
)
@Schema
(
description
=
"银行卡类别 样例:借记卡"
)
private
String
cardCategory
;
private
String
cardCategory
;
/**
* 姓名
*/
@Schema
(
description
=
"姓名"
)
private
String
name
;
/**
* 身份证
*/
@Schema
(
description
=
"身份证"
)
private
String
idNum
;
}
}
yifu-check/yifu-check-biz/src/main/java/com/yifu/cloud/plus/v1/check/controller/TCheckBankNoController.java
View file @
50c4bf3a
...
@@ -120,7 +120,6 @@ public class TCheckBankNoController {
...
@@ -120,7 +120,6 @@ public class TCheckBankNoController {
*/
*/
@Operation
(
description
=
"银行卡号校验"
)
@Operation
(
description
=
"银行卡号校验"
)
@SysLog
(
"银行卡号校验"
)
@SysLog
(
"银行卡号校验"
)
//@Inner
@GetMapping
(
"/checkBankNo"
)
@GetMapping
(
"/checkBankNo"
)
public
R
<
TCheckBankNo
>
checkBankNo
(
@RequestParam
(
value
=
"name"
,
required
=
true
)
String
name
,
public
R
<
TCheckBankNo
>
checkBankNo
(
@RequestParam
(
value
=
"name"
,
required
=
true
)
String
name
,
@RequestParam
(
value
=
"idNum"
,
required
=
true
)
String
idNum
,
@RequestParam
(
value
=
"idNum"
,
required
=
true
)
String
idNum
,
...
@@ -128,4 +127,22 @@ public class TCheckBankNoController {
...
@@ -128,4 +127,22 @@ public class TCheckBankNoController {
@RequestParam
(
value
=
"mobile"
,
required
=
false
)
String
mobile
)
{
@RequestParam
(
value
=
"mobile"
,
required
=
false
)
String
mobile
)
{
return
tCheckBankNoService
.
checkBankNo
(
name
,
idNum
,
cardNo
,
mobile
);
return
tCheckBankNoService
.
checkBankNo
(
name
,
idNum
,
cardNo
,
mobile
);
}
}
/**
* 银行卡号校验
* @param name 姓名 是 [string]
* @param idNum 身份证号码,限单个 是 [string]
* @param cardNo 银行卡号,限单个 是 [string]
* @param mobile 银行预留手机号,仅支持国内11位号码
*/
@Operation
(
description
=
"银行卡号校验"
)
@SysLog
(
"银行卡号校验"
)
@Inner
@GetMapping
(
"/inner/checkBankNo"
)
public
R
<
TCheckBankNo
>
checkBankNoInner
(
@RequestParam
(
value
=
"name"
,
required
=
true
)
String
name
,
@RequestParam
(
value
=
"idNum"
,
required
=
true
)
String
idNum
,
@RequestParam
(
value
=
"cardNo"
,
required
=
true
)
String
cardNo
,
@RequestParam
(
value
=
"mobile"
,
required
=
false
)
String
mobile
)
{
return
tCheckBankNoService
.
checkBankNo
(
name
,
idNum
,
cardNo
,
mobile
);
}
}
}
yifu-check/yifu-check-biz/src/main/java/com/yifu/cloud/plus/v1/check/controller/TCheckIdCardController.java
View file @
50c4bf3a
...
@@ -132,4 +132,19 @@ public class TCheckIdCardController {
...
@@ -132,4 +132,19 @@ public class TCheckIdCardController {
public
R
<
List
<
TCheckIdCard
>>
checkIdCard
(
@RequestBody
List
<
TCheckIdCard
>
checkList
)
{
public
R
<
List
<
TCheckIdCard
>>
checkIdCard
(
@RequestBody
List
<
TCheckIdCard
>
checkList
)
{
return
tCheckIdCardService
.
checkIdCard
(
checkList
);
return
tCheckIdCardService
.
checkIdCard
(
checkList
);
}
}
/**
* @param checkList
* @Description: 校验姓名身份证
* @Author: fxj
* @Date: 2022-5-12 15:18:53
* @return: com.yifu.cloud.v1.common.core.util.R
**/
@Operation
(
description
=
"校验姓名身份证"
)
@SysLog
(
"校验姓名身份证"
)
@Inner
@PostMapping
(
"/inner/checkIdCard"
)
public
R
<
List
<
TCheckIdCard
>>
checkIdCardInner
(
@RequestBody
List
<
TCheckIdCard
>
checkList
)
{
return
tCheckIdCardService
.
checkIdCard
(
checkList
);
}
}
}
yifu-check/yifu-check-biz/src/main/java/com/yifu/cloud/plus/v1/check/controller/TCheckMobileController.java
View file @
50c4bf3a
...
@@ -32,6 +32,8 @@ import org.springframework.http.HttpHeaders;
...
@@ -32,6 +32,8 @@ import org.springframework.http.HttpHeaders;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.Map
;
/**
/**
* 手机号码校验
* 手机号码校验
...
@@ -118,10 +120,22 @@ public class TCheckMobileController {
...
@@ -118,10 +120,22 @@ public class TCheckMobileController {
*/
*/
@Operation
(
description
=
"检测手机号,多个手机号码用英文半角逗号隔开,仅支持国内号码"
)
@Operation
(
description
=
"检测手机号,多个手机号码用英文半角逗号隔开,仅支持国内号码"
)
@SysLog
(
"检测手机号状态"
)
@SysLog
(
"检测手机号状态"
)
//@Inner
@GetMapping
(
"/checkMobiles"
)
@GetMapping
(
"/checkMobiles"
)
public
R
checkMobiles
(
String
mobiles
)
{
public
R
<
Map
<
String
,
TCheckMobile
>>
checkMobiles
(
String
mobiles
)
{
return
R
.
ok
(
tCheckMobileService
.
checkMobiles
(
mobiles
));
return
tCheckMobileService
.
checkMobiles
(
mobiles
);
}
/**
* 手机号码状态校验
* @param mobiles 检测手机号,多个手机号码用英文半角逗号隔开,仅支持国内号码
* @return R
*/
@Operation
(
description
=
"检测手机号,多个手机号码用英文半角逗号隔开,仅支持国内号码"
)
@SysLog
(
"检测手机号状态"
)
@Inner
@GetMapping
(
"/inner/checkMobiles"
)
public
R
<
Map
<
String
,
TCheckMobile
>>
checkMobilesInner
(
String
mobiles
)
{
return
tCheckMobileService
.
checkMobiles
(
mobiles
);
}
}
}
}
yifu-check/yifu-check-biz/src/main/java/com/yifu/cloud/plus/v1/check/service/impl/TCheckBankNoServiceImpl.java
View file @
50c4bf3a
...
@@ -16,12 +16,14 @@
...
@@ -16,12 +16,14 @@
*/
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
check
.
service
.
impl
;
package
com
.
yifu
.
cloud
.
plus
.
v1
.
check
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yifu.cloud.plus.v1.check.entity.TCheckBankNo
;
import
com.yifu.cloud.plus.v1.check.entity.TCheckBankNo
;
import
com.yifu.cloud.plus.v1.check.mapper.TCheckBankNoMapper
;
import
com.yifu.cloud.plus.v1.check.mapper.TCheckBankNoMapper
;
import
com.yifu.cloud.plus.v1.check.service.TCanCheckService
;
import
com.yifu.cloud.plus.v1.check.service.TCanCheckService
;
import
com.yifu.cloud.plus.v1.check.service.TCheckBankNoService
;
import
com.yifu.cloud.plus.v1.check.service.TCheckBankNoService
;
import
com.yifu.cloud.plus.v1.check.utils.ChecksUtil
;
import
com.yifu.cloud.plus.v1.check.utils.ChecksUtil
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes
;
import
com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.MsgUtils
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.MsgUtils
;
...
@@ -40,11 +42,24 @@ import org.springframework.stereotype.Service;
...
@@ -40,11 +42,24 @@ import org.springframework.stereotype.Service;
public
class
TCheckBankNoServiceImpl
extends
ServiceImpl
<
TCheckBankNoMapper
,
TCheckBankNo
>
implements
TCheckBankNoService
{
public
class
TCheckBankNoServiceImpl
extends
ServiceImpl
<
TCheckBankNoMapper
,
TCheckBankNo
>
implements
TCheckBankNoService
{
private
final
TCanCheckService
canCheckService
;
private
final
TCanCheckService
canCheckService
;
@Override
@Override
public
R
<
TCheckBankNo
>
checkBankNo
(
String
name
,
String
idNum
,
String
cardNo
,
String
mobile
)
{
public
R
<
TCheckBankNo
>
checkBankNo
(
String
name
,
String
idNum
,
String
cardNo
,
String
mobile
)
{
if
(
Common
.
isEmpty
(
name
)
||
Common
.
isEmpty
(
idNum
)
||
Common
.
isEmpty
(
cardNo
)){
if
(
Common
.
isEmpty
(
name
)
||
Common
.
isEmpty
(
idNum
)
||
Common
.
isEmpty
(
cardNo
)){
return
R
.
failed
(
MsgUtils
.
getMessage
(
ErrorCodes
.
CHECKS_BANK_NO_REQUEST_PARAM_ERROR
));
return
R
.
failed
(
MsgUtils
.
getMessage
(
ErrorCodes
.
CHECKS_BANK_NO_REQUEST_PARAM_ERROR
));
}
}
return
ChecksUtil
.
checkBankNo
(
name
,
idNum
,
cardNo
,
mobile
,
canCheckService
.
getCanCheck
());
TCheckBankNo
checkBankNo
=
baseMapper
.
selectOne
(
Wrappers
.<
TCheckBankNo
>
query
().
lambda
()
.
eq
(
TCheckBankNo:
:
getBankNo
,
cardNo
)
.
eq
(
TCheckBankNo:
:
getName
,
name
)
.
eq
(
TCheckBankNo:
:
getIdNum
,
idNum
)
.
last
(
CommonConstants
.
LAST_ONE_SQL
));
if
(
Common
.
isNotNull
(
checkBankNo
)){
return
R
.
ok
(
checkBankNo
);
}
R
<
TCheckBankNo
>
res
=
ChecksUtil
.
checkBankNo
(
name
,
idNum
,
cardNo
,
mobile
,
canCheckService
.
getCanCheck
());
if
(
Common
.
isNotNull
(
res
)
&&
Common
.
isNotNull
(
res
.
getData
())){
baseMapper
.
insert
(
res
.
getData
());
}
return
res
;
}
}
}
}
yifu-check/yifu-check-biz/src/main/java/com/yifu/cloud/plus/v1/check/service/impl/TCheckMobileServiceImpl.java
View file @
50c4bf3a
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
*/
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
check
.
service
.
impl
;
package
com
.
yifu
.
cloud
.
plus
.
v1
.
check
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yifu.cloud.plus.v1.check.entity.TCheckMobile
;
import
com.yifu.cloud.plus.v1.check.entity.TCheckMobile
;
import
com.yifu.cloud.plus.v1.check.mapper.TCheckMobileMapper
;
import
com.yifu.cloud.plus.v1.check.mapper.TCheckMobileMapper
;
...
@@ -30,8 +31,10 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
...
@@ -30,8 +31,10 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
/**
* 手机号码校验
* 手机号码校验
...
@@ -44,6 +47,7 @@ import java.util.Map;
...
@@ -44,6 +47,7 @@ import java.util.Map;
public
class
TCheckMobileServiceImpl
extends
ServiceImpl
<
TCheckMobileMapper
,
TCheckMobile
>
implements
TCheckMobileService
{
public
class
TCheckMobileServiceImpl
extends
ServiceImpl
<
TCheckMobileMapper
,
TCheckMobile
>
implements
TCheckMobileService
{
private
final
TCanCheckService
canCheckService
;
private
final
TCanCheckService
canCheckService
;
/**
/**
* @Author fxj
* @Author fxj
* @Description 号码状态校验,单次请求上限100 多一个号码请以逗号分割
* @Description 号码状态校验,单次请求上限100 多一个号码请以逗号分割
...
@@ -53,12 +57,22 @@ public class TCheckMobileServiceImpl extends ServiceImpl<TCheckMobileMapper, TCh
...
@@ -53,12 +57,22 @@ public class TCheckMobileServiceImpl extends ServiceImpl<TCheckMobileMapper, TCh
public
R
<
Map
<
String
,
TCheckMobile
>>
checkMobiles
(
String
mobiles
){
public
R
<
Map
<
String
,
TCheckMobile
>>
checkMobiles
(
String
mobiles
){
R
<
Map
<
String
,
TCheckMobile
>>
mobileMapR
;
R
<
Map
<
String
,
TCheckMobile
>>
mobileMapR
;
Map
<
String
,
TCheckMobile
>
checkMobileMap
;
Map
<
String
,
TCheckMobile
>
checkMobileMap
;
Map
<
String
,
TCheckMobile
>
existMap
=
new
HashMap
<>();
if
(
Common
.
isNotNull
(
mobiles
)){
if
(
Common
.
isNotNull
(
mobiles
)){
List
<
String
>
mobileList
=
Common
.
initStrToList
(
mobiles
,
CommonConstants
.
COMMA_STRING
);
List
<
String
>
mobileList
=
Common
.
initStrToList
(
mobiles
,
CommonConstants
.
COMMA_STRING
);
if
(
Common
.
isNotEmpty
(
mobileList
)
&&
mobileList
.
size
()
>
CommonConstants
.
INTEGER_HUNDRED
){
if
(
Common
.
isNotEmpty
(
mobileList
)
&&
mobileList
.
size
()
>
CommonConstants
.
INTEGER_HUNDRED
){
return
R
.
failed
(
MsgUtils
.
getMessage
(
ErrorCodes
.
CHECKS_MOBILE_REQUEST_LIMIT_HUNDRED
));
return
R
.
failed
(
MsgUtils
.
getMessage
(
ErrorCodes
.
CHECKS_MOBILE_REQUEST_LIMIT_HUNDRED
));
}
}
mobileMapR
=
ChecksUtil
.
checkMobile
(
mobiles
,
canCheckService
.
getCanCheck
());
//1.先从本地库获取正常数据
List
<
TCheckMobile
>
checkMobiles
=
baseMapper
.
selectList
(
Wrappers
.<
TCheckMobile
>
query
().
lambda
()
.
in
(
TCheckMobile:
:
getMobile
,
mobileList
)
.
eq
(
TCheckMobile:
:
getStatus
,
CommonConstants
.
ONE_STRING
));
if
(
Common
.
isNotNull
(
checkMobiles
)){
checkMobiles
.
stream
().
collect
(
Collectors
.
toMap
(
TCheckMobile:
:
getMobile
,
TCheckMobile
->
TCheckMobile
));
}
mobileList
.
removeAll
(
existMap
.
values
());
//2.从远处端获取数据
mobileMapR
=
ChecksUtil
.
checkMobile
(
Common
.
ListToStr
(
mobileList
,
CommonConstants
.
COMMA_STRING
),
canCheckService
.
getCanCheck
());
if
(
Common
.
isEmpty
(
mobileMapR
)
&&
Common
.
isEmpty
(
mobileMapR
.
getData
())){
if
(
Common
.
isEmpty
(
mobileMapR
)
&&
Common
.
isEmpty
(
mobileMapR
.
getData
())){
return
R
.
failed
(
MsgUtils
.
getMessage
(
ErrorCodes
.
CHECKS_MOBILE_REQUEST_ERROR
));
return
R
.
failed
(
MsgUtils
.
getMessage
(
ErrorCodes
.
CHECKS_MOBILE_REQUEST_ERROR
));
}
}
...
@@ -78,7 +92,6 @@ public class TCheckMobileServiceImpl extends ServiceImpl<TCheckMobileMapper, TCh
...
@@ -78,7 +92,6 @@ public class TCheckMobileServiceImpl extends ServiceImpl<TCheckMobileMapper, TCh
checkMobileMap
.
put
(
mobile
,
checkMobile
);
checkMobileMap
.
put
(
mobile
,
checkMobile
);
}
}
}
}
mobileMapR
.
setData
(
checkMobileMap
);
}
}
}
else
{
}
else
{
return
R
.
failed
(
MsgUtils
.
getMessage
(
ErrorCodes
.
PARAM_NOT_EMPTY
));
return
R
.
failed
(
MsgUtils
.
getMessage
(
ErrorCodes
.
PARAM_NOT_EMPTY
));
...
@@ -86,6 +99,8 @@ public class TCheckMobileServiceImpl extends ServiceImpl<TCheckMobileMapper, TCh
...
@@ -86,6 +99,8 @@ public class TCheckMobileServiceImpl extends ServiceImpl<TCheckMobileMapper, TCh
if
(
Common
.
isNotNull
(
checkMobileMap
)){
if
(
Common
.
isNotNull
(
checkMobileMap
)){
this
.
saveBatch
(
checkMobileMap
.
values
());
this
.
saveBatch
(
checkMobileMap
.
values
());
}
}
checkMobileMap
.
putAll
(
existMap
);
mobileMapR
.
setData
(
checkMobileMap
);
return
mobileMapR
;
return
mobileMapR
;
}
}
...
...
yifu-check/yifu-check-biz/src/main/resources/mapper/TCheckBankNoMapper.xml
View file @
50c4bf3a
...
@@ -38,5 +38,7 @@
...
@@ -38,5 +38,7 @@
<result
property=
"bankNo"
column=
"bank_no"
/>
<result
property=
"bankNo"
column=
"bank_no"
/>
<result
property=
"cardType"
column=
"card_type"
/>
<result
property=
"cardType"
column=
"card_type"
/>
<result
property=
"cardCategory"
column=
"card_category"
/>
<result
property=
"cardCategory"
column=
"card_category"
/>
<result
property=
"name"
column=
"name"
/>
<result
property=
"idNum"
column=
"id_num"
/>
</resultMap>
</resultMap>
</mapper>
</mapper>
yifu-common/yifu-common-core/src/main/java/com/yifu.cloud.plus.v1/yifu/common/core/util/Common.java
View file @
50c4bf3a
...
@@ -4,6 +4,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
...
@@ -4,6 +4,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.List
;
import
java.util.regex.Matcher
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
java.util.regex.Pattern
;
...
@@ -123,4 +124,34 @@ public class Common {
...
@@ -123,4 +124,34 @@ public class Common {
}
}
return
result
;
return
result
;
}
}
/**
* 将集合拼成串
*
* @param <T>
* @param str
* @param regex 分隔符默认,
* @return
*/
public
static
<
T
>
String
ListToStr
(
Collection
<
T
>
str
,
String
regex
)
{
String
result
=
""
;
try
{
if
(
isNotNull
(
str
))
{
// 默认用,分割
if
(!
isNotNull
(
regex
))
{
regex
=
","
;
}
for
(
Object
strtemp
:
str
)
{
if
(
""
.
equals
(
result
))
{
result
=
String
.
valueOf
(
strtemp
);
}
else
{
result
=
result
+
regex
+
strtemp
;
}
}
}
}
catch
(
Exception
e
)
{
// 数据异常
}
return
result
;
}
}
}
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