Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gjjs-bd-common
Overview
Overview
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
s_guodong
gjjs-bd-common
Commits
96a4bb21
Commit
96a4bb21
authored
Aug 11, 2023
by
s_guodong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加bigdecimal的检验
parent
1e68e2b7
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
153 deletions
+25
-153
DemoListVo.java
...src/main/java/com/ceb/gjjs/mda/special/vo/DemoListVo.java
+0
-34
DemoResultVo.java
...c/main/java/com/ceb/gjjs/mda/special/vo/DemoResultVo.java
+0
-31
DemoVo.java
...ess/src/main/java/com/ceb/gjjs/mda/special/vo/DemoVo.java
+0
-48
DemoVo_2.java
...s/src/main/java/com/ceb/gjjs/mda/special/vo/DemoVo_2.java
+0
-35
ValidatorUtil.java
...ss/src/main/java/com/ceb/gjjs/mda/util/ValidatorUtil.java
+25
-5
No files found.
gjjs-bd-business/src/main/java/com/ceb/gjjs/mda/special/vo/DemoListVo.java
deleted
100644 → 0
View file @
1e68e2b7
package
com
.
ceb
.
gjjs
.
mda
.
special
.
vo
;
import
com.brilliance.mda.runtime.annotation.Need
;
import
com.brilliance.mda.runtime.annotation.RelPath
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
lombok.Data
;
import
org.hibernate.validator.constraints.Length
;
import
java.io.Serializable
;
/**
* @Description
* @Author s_guodong
* @Date 2023/8/10
*/
@Data
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
class
DemoListVo
implements
Serializable
{
@JsonIgnore
private
static
final
long
serialVersionUID
=
1L
;
@Length
(
max
=
20
,
message
=
"最大长度为20"
)
@RelPath
(
"cur"
)
private
String
aa
;
@Need
@RelPath
(
"act"
)
private
String
bb
;
}
gjjs-bd-business/src/main/java/com/ceb/gjjs/mda/special/vo/DemoResultVo.java
deleted
100644 → 0
View file @
1e68e2b7
package
com
.
ceb
.
gjjs
.
mda
.
special
.
vo
;
import
com.brilliance.mda.runtime.annotation.RelPath
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
lombok.Data
;
import
java.util.List
;
/**
* @Description
* @Author s_guodong
* @Date 2023/8/11
*/
@Data
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
class
DemoResultVo
extends
RespondBaseVo
{
@RelPath
(
"acdgrp_rec_account"
)
private
String
acount
;
private
String
b
;
@RelPath
(
"dataList"
)
private
List
<
DemoListVo
>
data_list
;
@RelPath
(
"acd"
)
private
DemoVo_2
acd_data
;
@RelPath
(
"addrs"
)
private
List
<
String
>
addrLines
;
}
gjjs-bd-business/src/main/java/com/ceb/gjjs/mda/special/vo/DemoVo.java
deleted
100644 → 0
View file @
1e68e2b7
package
com
.
ceb
.
gjjs
.
mda
.
special
.
vo
;
import
com.brilliance.mda.runtime.annotation.Need
;
import
com.brilliance.mda.runtime.annotation.RelPath
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
lombok.Data
;
import
org.hibernate.validator.constraints.Length
;
import
java.io.Serializable
;
import
java.util.List
;
/**
* @Description
* @Author s_guodong
* @Date 2023/8/10
*/
@Data
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
class
DemoVo
extends
RequestBaseVo
implements
Serializable
{
@JsonIgnore
private
static
final
long
serialVersionUID
=
1L
;
@Length
(
max
=
2
,
message
=
"最大长度为20"
)
@RelPath
(
"acdgrp_rec_account"
)
private
String
a
;
@Length
(
max
=
2
,
message
=
"最大长度为2"
)
@Need
private
String
b
;
@RelPath
(
"dataList"
)
@Need
private
List
<
DemoListVo
>
list
;
@RelPath
(
"acd"
)
@Need
private
DemoVo_2
demoVo_2
;
@RelPath
(
"addrs"
)
@Need
private
List
<
String
>
addrList
;
}
gjjs-bd-business/src/main/java/com/ceb/gjjs/mda/special/vo/DemoVo_2.java
deleted
100644 → 0
View file @
1e68e2b7
package
com
.
ceb
.
gjjs
.
mda
.
special
.
vo
;
import
com.brilliance.mda.runtime.annotation.Need
;
import
com.brilliance.mda.runtime.annotation.RelPath
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
lombok.Data
;
import
org.hibernate.validator.constraints.Length
;
import
java.io.Serializable
;
/**
* @Description
* @Author s_guodong
* @Date 2023/8/10
*/
@Data
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
public
class
DemoVo_2
implements
Serializable
{
@JsonIgnore
private
static
final
long
serialVersionUID
=
1L
;
@Length
(
max
=
20
,
message
=
"最大长度为20"
)
@RelPath
(
"entname"
)
private
String
name
;
@Length
(
max
=
2
,
message
=
"最大长度为2"
)
@RelPath
(
"inr"
)
private
String
addr
;
}
gjjs-bd-business/src/main/java/com/ceb/gjjs/mda/util/ValidatorUtil.java
View file @
96a4bb21
package
com
.
ceb
.
gjjs
.
mda
.
util
;
import
com.brilliance.mda.runtime.annotation.Need
;
import
com.brilliance.mda.support.jakson.serialize.DecimalLength
;
import
org.apache.commons.lang3.StringUtils
;
import
org.hibernate.validator.constraints.Length
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotNull
;
import
java.lang.reflect.Field
;
import
java.math.BigDecimal
;
import
java.util.List
;
/**
...
...
@@ -27,17 +29,35 @@ public class ValidatorUtil {
o
=
f
.
get
(
obj
);
}
catch
(
IllegalAccessException
e
)
{
}
if
(
f
.
isAnnotationPresent
(
Length
.
class
)
&&
type
.
isAssignableFrom
(
String
.
class
)
)
{
if
(
f
.
isAnnotationPresent
(
Length
.
class
))
{
Length
length
=
f
.
getAnnotation
(
Length
.
class
);
int
min
=
length
.
min
();
int
max
=
length
.
max
();
String
message
=
length
.
message
();
if
(
o
!=
null
)
{
String
stringValue
=
(
String
)
o
;
if
(
stringValue
.
length
()
>
max
||
stringValue
.
length
()
<
min
)
{
return
"参数校验错误["
+
f
.
getName
()
+
":"
+
message
+
"]"
;
if
(
type
.
isAssignableFrom
(
String
.
class
))
{
int
min
=
length
.
min
();
String
stringValue
=
(
String
)
o
;
if
(
stringValue
.
length
()
>
max
||
stringValue
.
length
()
<
min
)
{
return
"参数校验错误["
+
f
.
getName
()
+
":"
+
message
+
"]"
;
}
}
else
if
(
type
.
isAssignableFrom
(
BigDecimal
.
class
))
{
String
bigDecimal
=
o
.
toString
();
String
replace
=
bigDecimal
.
replace
(
"."
,
""
);
if
(
replace
.
length
()
>
max
)
{
return
"参数校验错误["
+
f
.
getName
()
+
":"
+
message
+
"]"
;
}
if
(
f
.
isAnnotationPresent
(
DecimalLength
.
class
))
{
DecimalLength
annotation
=
f
.
getAnnotation
(
DecimalLength
.
class
);
int
i
=
bigDecimal
.
indexOf
(
"."
);
String
substring
=
bigDecimal
.
substring
(
i
+
1
);
if
(
substring
.
length
()
>
annotation
.
value
())
{
return
"参数校验错误["
+
f
.
getName
()
+
":小数点最大"
+
annotation
.
value
()
+
"]"
;
}
}
}
}
}
if
(
f
.
isAnnotationPresent
(
NotEmpty
.
class
)
&&
type
.
isAssignableFrom
(
String
.
class
))
{
if
(
o
==
null
||
StringUtils
.
isBlank
((
String
)
o
))
{
...
...
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