Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
聂康
local-rnr-openapi
Commits
df1d7dc5
Commit
df1d7dc5
authored
Jun 17, 2025
by
kang.nie@inzymeits.com
Browse files
初始化代码
parent
565dfc9e
Pipeline
#3110
failed with stages
in 0 seconds
Changes
83
Pipelines
1
Expand all
Show whitespace changes
Inline
Side-by-side
src/main/java/com/cusc/nirvana/user/rnr/openapi/util/ValidationUtil.java
0 → 100644
View file @
df1d7dc5
package
com.cusc.nirvana.user.rnr.openapi.util
;
import
com.cusc.nirvana.common.result.Response
;
import
com.cusc.nirvana.user.rnr.fp.common.ResponseCode
;
import
com.cusc.nirvana.user.rnr.mg.constants.CertTypeEnum
;
import
com.cusc.nirvana.user.rnr.openapi.constants.IdentifyConstants
;
import
org.apache.commons.lang3.StringUtils
;
import
java.util.Arrays
;
import
java.util.Optional
;
/**
* 校验工具类
*
* @author yubo
* @since 2022-04-19 13:49
*/
public
class
ValidationUtil
{
/**
* 检查手机格式
* @param phone
* @return
*/
public
static
Response
checkPhone
(
String
phone
){
if
(!
phone
.
matches
(
IdentifyConstants
.
PHONE_REGEX
)){
return
Response
.
createError
(
"手机格式错误"
,
ResponseCode
.
INVALID_DATA
.
getCode
());
}
return
Response
.
createSuccess
();
}
/**
* 使用正则表达式检查证件合法性
*
* @param certType
* @param identityNumber
*/
public
static
Response
checkIdentifyNumber
(
String
certType
,
String
identityNumber
)
{
Optional
<
CertTypeEnum
>
first
=
Arrays
.
stream
(
CertTypeEnum
.
values
())
.
filter
(
c
->
StringUtils
.
equalsIgnoreCase
(
c
.
getCode
(),
certType
))
.
findFirst
();
if
(!
first
.
isPresent
())
{
return
Response
.
createError
(
"证件类型错误"
,
ResponseCode
.
INVALID_DATA
.
getCode
());
}
CertTypeEnum
certTypeEnum
=
first
.
get
();
//如果是身份证,判断号码是否合法
if
(
certTypeEnum
==
CertTypeEnum
.
IDCARD
&&
!
identityNumber
.
matches
(
IdentifyConstants
.
ID_CARD_REGEX
))
{
return
Response
.
createError
(
"身份证号码格式错误"
,
ResponseCode
.
INVALID_DATA
.
getCode
());
}
else
if
(
certTypeEnum
==
CertTypeEnum
.
HKIDCARD
&&
!
identityNumber
.
matches
(
IdentifyConstants
.
HK_MACAU_REGEX
))
{
return
Response
.
createError
(
"港澳通行证号码格式错误"
,
ResponseCode
.
INVALID_DATA
.
getCode
());
}
else
if
(
certTypeEnum
==
CertTypeEnum
.
TAIBAOZHENG
&&
!
identityNumber
.
matches
(
IdentifyConstants
.
HK_TAIWAN_CITIZEN_REGEX
))
{
return
Response
.
createError
(
"台湾居民来往大陆通行证号码格式错误"
,
ResponseCode
.
INVALID_DATA
.
getCode
());
}
return
Response
.
createSuccess
();
}
//验证证件照片数量
//身份证、港澳通行证、台湾通行证 需要正反面两张照片
public
static
Response
checkIdentifyPics
(
String
certType
,
int
size
)
{
// if (StringUtils.equalsIgnoreCase(CertTypeEnum.IDCARD.getCode(), certType)
// || StringUtils.equalsIgnoreCase(CertTypeEnum.HKIDCARD.getCode(), certType)
// || StringUtils.equalsIgnoreCase(CertTypeEnum.TAIBAOZHENG.getCode(), certType)) {
if
(
size
<
2
)
{
return
Response
.
createError
(
"证件正反面照片不能为空"
,
ResponseCode
.
INVALID_DATA
.
getCode
());
}
// }
// if (size < 1) {
// return Response.createError("证件照不能为空", ResponseCode.INVALID_DATA.getCode());
// }
return
Response
.
createSuccess
();
}
}
src/main/resources/bootstrap-prod.yml
0 → 100644
View file @
df1d7dc5
This diff is collapsed.
Click to expand it.
src/main/resources/bootstrap.yml
0 → 100644
View file @
df1d7dc5
#server:
# port: 8082
spring
:
application
:
name
:
local-rnr-openapi
# profiles:
# active: dev
\ No newline at end of file
Prev
1
2
3
4
5
Next
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