Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
gsc
/
gsc-vcp-web-facade
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 d8a2a9d2
authored
Nov 27, 2025
by
林冲
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat:字段长度校验
1 parent
20f87916
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
3 deletions
src/main/java/com/gsc4cloud/gsc/facade/vpcweb/service/evalorder/EvalElectronicContractService.java
src/main/java/com/gsc4cloud/gsc/facade/vpcweb/service/evalorder/EvalElectronicContractService.java
View file @
d8a2a9d
...
...
@@ -399,9 +399,13 @@ public class EvalElectronicContractService {
if
(
row
.
getPlateNo
().
length
()
>
10
)
{
errors
.
add
(
"车牌号不能超过10位"
);
}
// 车架号必须是17位,否则提示“车架号必须是17位”
if
(
row
.
getVin
().
length
()
!=
17
)
{
errors
.
add
(
"车架号必须是17位"
);
// 车架号必须是16位或17位
if
(
row
.
getVin
().
length
()
!=
16
&&
row
.
getVin
().
length
()
!=
17
)
{
errors
.
add
(
"车架号必须是16位或17位"
);
}
// 车架号必须是大写英文字符+数字
if
(!
row
.
getVin
().
matches
(
"^[A-Z0-9]{16,17}$"
))
{
errors
.
add
(
"车架号必须由大写英文字符和数字组成"
);
}
if
(
row
.
getBrand
().
length
()
>
20
)
{
errors
.
add
(
"品牌不能超过20个字符"
);
...
...
@@ -413,6 +417,53 @@ public class EvalElectronicContractService {
errors
.
add
(
"支付方式不能超过20个字符"
);
}
// 定金金额校验:最多10位数,不包含小数
if
(
row
.
getDepositAmount
()
!=
null
)
{
String
depositAmountStr
=
row
.
getDepositAmount
().
toString
();
if
(
depositAmountStr
.
contains
(
"."
))
{
errors
.
add
(
"定金金额不能包含小数"
);
}
// 去除可能的负号再检查位数
String
absDepositAmount
=
depositAmountStr
.
replace
(
"-"
,
""
).
replace
(
"."
,
""
);
if
(
absDepositAmount
.
length
()
>
10
)
{
errors
.
add
(
"定金金额最多10位数"
);
}
}
// 尾款金额校验:最多10位数,不包含小数
if
(
row
.
getFinalAmount
()
!=
null
)
{
String
finalAmountStr
=
row
.
getFinalAmount
().
toString
();
if
(
finalAmountStr
.
contains
(
"."
))
{
errors
.
add
(
"尾款金额不能包含小数"
);
}
// 去除可能的负号再检查位数
String
absFinalAmount
=
finalAmountStr
.
replace
(
"-"
,
""
).
replace
(
"."
,
""
);
if
(
absFinalAmount
.
length
()
>
10
)
{
errors
.
add
(
"尾款金额最多10位数"
);
}
}
// 收款人校验:1-20字符
if
(
StringUtils
.
isNotBlank
(
row
.
getPayeeName
()))
{
if
(
row
.
getPayeeName
().
length
()
<
1
||
row
.
getPayeeName
().
length
()
>
20
)
{
errors
.
add
(
"收款人长度必须在1-20字符之间"
);
}
}
// 开户行校验:1-20字符
if
(
StringUtils
.
isNotBlank
(
row
.
getBankName
()))
{
if
(
row
.
getBankName
().
length
()
<
1
||
row
.
getBankName
().
length
()
>
20
)
{
errors
.
add
(
"开户行长度必须在1-20字符之间"
);
}
}
// 收款银行账号校验:数字 1-20字符
if
(
StringUtils
.
isNotBlank
(
row
.
getBankAccountNo
()))
{
if
(!
row
.
getBankAccountNo
().
matches
(
"^[0-9]{1,20}$"
))
{
errors
.
add
(
"收款银行账号必须是1-20位数字"
);
}
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment