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
f334f670
Commit
f334f670
authored
Dec 19, 2023
by
s_guodong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
565700d3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
72 additions
and
17 deletions
+72
-17
AbstractCommonResource.java
...om/ceb/gjjs/mda/resource/base/AbstractCommonResource.java
+43
-8
RequestBaseVo.java
.../main/java/com/ceb/gjjs/mda/special/vo/RequestBaseVo.java
+9
-9
RequestPageBaseVo.java
...n/java/com/ceb/gjjs/mda/special/vo/RequestPageBaseVo.java
+20
-0
No files found.
gjjs-bd-business/src/main/java/com/ceb/gjjs/mda/resource/base/AbstractCommonResource.java
View file @
f334f670
...
@@ -8,6 +8,7 @@ import com.brilliance.mda.support.td.BDAuthInfo;
...
@@ -8,6 +8,7 @@ import com.brilliance.mda.support.td.BDAuthInfo;
import
com.ceb.gjjs.mda.bo.Usr
;
import
com.ceb.gjjs.mda.bo.Usr
;
import
com.ceb.gjjs.mda.dao.UsrMapper
;
import
com.ceb.gjjs.mda.dao.UsrMapper
;
import
com.ceb.gjjs.mda.special.vo.RequestBaseVo
;
import
com.ceb.gjjs.mda.special.vo.RequestBaseVo
;
import
com.ceb.gjjs.mda.special.vo.RequestPageBaseVo
;
import
com.ceb.gjjs.mda.util.ReflectUtil
;
import
com.ceb.gjjs.mda.util.ReflectUtil
;
import
com.ceb.gjjs.mda.util.ValidatorUtil
;
import
com.ceb.gjjs.mda.util.ValidatorUtil
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
@@ -159,6 +160,31 @@ public abstract class AbstractCommonResource<V extends BaseVO> {
...
@@ -159,6 +160,31 @@ public abstract class AbstractCommonResource<V extends BaseVO> {
return
ValidatorUtil
.
check
(
baseVO
);
return
ValidatorUtil
.
check
(
baseVO
);
}
}
protected
<
T
>
ResponseSet
<
T
>
executeRule
(
RequestPageBaseVo
requestPageBaseVo
,
Class
<
T
>
respondVoClass
,
String
rule
)
{
V
baseVO
=
getVo
();
T
t
=
null
;
try
{
t
=
respondVoClass
.
newInstance
();
}
catch
(
Exception
e
)
{
}
String
s
=
resetAndcheckBaseParam
(
requestPageBaseVo
,
baseVO
);
if
(!
StringUtils
.
isBlank
(
s
))
{
return
new
ResponseSet
<>(
ResponseSet
.
CODE_FAILURE
,
s
,
t
);
}
String
checkResult
=
resetAndcheckParam
(
requestPageBaseVo
,
baseVO
);
if
(
StringUtils
.
isNotBlank
(
checkResult
))
{
return
new
ResponseSet
<>(
ResponseSet
.
CODE_FAILURE
,
checkResult
,
t
);
}
String
[]
ruleArr
=
new
String
[]{
rule
};
ResponseSet
responseSet
=
getCommonService
().
executeRule
(
baseVO
,
ruleArr
);
Object
data
=
responseSet
.
getData
();
if
(
data
!=
null
)
{
ReflectUtil
.
setValue2RespondVo
(
t
,
respondVoClass
,
data
,
baseVO
.
getClass
());
setTotal
(
t
,
baseVO
);
responseSet
.
setData
(
t
);
}
return
responseSet
;
}
protected
<
T
>
ResponseSet
<
T
>
executeRule
(
RequestBaseVo
requestBaseVo
,
Class
<
T
>
respondVoClass
,
String
rule
)
{
protected
<
T
>
ResponseSet
<
T
>
executeRule
(
RequestBaseVo
requestBaseVo
,
Class
<
T
>
respondVoClass
,
String
rule
)
{
V
baseVO
=
getVo
();
V
baseVO
=
getVo
();
...
@@ -239,31 +265,40 @@ public abstract class AbstractCommonResource<V extends BaseVO> {
...
@@ -239,31 +265,40 @@ public abstract class AbstractCommonResource<V extends BaseVO> {
private
String
resetAndcheckBaseParam
(
RequestBaseVo
requestBaseVo
,
V
baseVO
)
{
private
String
resetAndcheckBaseParam
(
RequestBaseVo
requestBaseVo
,
V
baseVO
)
{
String
cifno
=
requestBaseVo
.
getCifno
();
String
cifno
=
requestBaseVo
.
getCifno
();
if
(
StringUtils
.
isBlank
(
cifno
))
{
if
(
StringUtils
.
isBlank
(
cifno
))
{
return
"客户号
cifno
不能为空"
;
return
"客户号不能为空"
;
}
}
baseVO
.
setCifno
(
cifno
);
baseVO
.
setCifno
(
cifno
);
if
(
cifno
.
length
()
>
10
)
{
if
(
cifno
.
length
()
>
10
)
{
return
"客户号
cifno不能超过10
"
;
return
"客户号
长度过长
"
;
}
}
String
userid
=
requestBaseVo
.
getUserid
();
String
userid
=
requestBaseVo
.
getUserid
();
if
(
StringUtils
.
isBlank
(
userid
))
{
if
(
StringUtils
.
isBlank
(
userid
))
{
return
"用户
userid
不能为空"
;
return
"用户
号
不能为空"
;
}
}
baseVO
.
setUserid
(
userid
);
baseVO
.
setUserid
(
userid
);
if
(
userid
.
length
()
>
8
)
{
if
(
userid
.
length
()
>
8
)
{
return
"用户
userid不能超过8
"
;
return
"用户
号长度过长
"
;
}
}
String
src
=
requestBaseVo
.
getSrc
();
String
src
=
requestBaseVo
.
getSrc
();
if
(
StringUtils
.
isBlank
(
src
))
{
if
(
StringUtils
.
isBlank
(
src
))
{
return
"业务来源
src
不能为空"
;
return
"业务来源不能为空"
;
}
}
baseVO
.
setSrc
(
src
);
baseVO
.
setSrc
(
src
);
if
(
src
.
length
()
>
12
)
{
if
(
src
.
length
()
>
12
)
{
return
"业务来源
src不能超过12
"
;
return
"业务来源
长度过长
"
;
}
}
baseVO
.
setTransid
(
requestBaseVo
.
getTransid
());
baseVO
.
setTransid
(
requestBaseVo
.
getTransid
());
baseVO
.
setPageNum
(
requestBaseVo
.
getPageNum
());
if
(
requestBaseVo
instanceof
RequestPageBaseVo
)
{
baseVO
.
setPageSize
(
requestBaseVo
.
getPageSize
());
RequestPageBaseVo
requestPageBaseVo
=
(
RequestPageBaseVo
)
requestBaseVo
;
if
(
requestPageBaseVo
.
getPageNum
()
<=
0
)
{
return
"分页页码必须大于0"
;
}
if
(
requestPageBaseVo
.
getPageSize
()
<=
0
)
{
return
"分页每页大小必须大于0"
;
}
baseVO
.
setPageNum
(
requestPageBaseVo
.
getPageNum
());
baseVO
.
setPageSize
(
requestPageBaseVo
.
getPageSize
());
}
before
(
baseVO
);
before
(
baseVO
);
return
""
;
return
""
;
}
}
...
...
gjjs-bd-business/src/main/java/com/ceb/gjjs/mda/special/vo/RequestBaseVo.java
View file @
f334f670
...
@@ -18,21 +18,21 @@ import java.io.Serializable;
...
@@ -18,21 +18,21 @@ import java.io.Serializable;
@Data
@Data
public
class
RequestBaseVo
implements
Serializable
{
public
class
RequestBaseVo
implements
Serializable
{
@Length
(
max
=
10
,
message
=
"
长度最大10
"
)
@Length
(
max
=
10
,
message
=
"
客户号长度过长
"
)
@Need
@Need
(
message
=
"客户号不能为空"
)
private
String
cifno
;
private
String
cifno
;
@Length
(
max
=
8
,
message
=
"
长度最大8
"
)
@Length
(
max
=
8
,
message
=
"
用户号长度过长
"
)
@Need
@Need
(
message
=
"用户号不能为空"
)
private
String
userid
;
private
String
userid
;
@Length
(
max
=
12
,
message
=
"
长度最大12
"
)
@Length
(
max
=
12
,
message
=
"
来源长度过长
"
)
@Need
@Need
(
message
=
"来源不能为空"
)
private
String
src
;
private
String
src
;
private
String
transid
;
private
String
transid
;
private
int
pageNum
;
//
private int pageNum;
//
private
int
pageSize
;
//
private int pageSize;
}
}
gjjs-bd-business/src/main/java/com/ceb/gjjs/mda/special/vo/RequestPageBaseVo.java
0 → 100644
View file @
f334f670
package
com
.
ceb
.
gjjs
.
mda
.
special
.
vo
;
import
com.fasterxml.jackson.annotation.JsonIgnoreProperties
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
lombok.Data
;
/**
* @Description 请求定制vo的基类 需要传分页参数的vo继承
* @Author s_guodong
* @Date 2023/8/10
*/
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@Data
public
class
RequestPageBaseVo
extends
RequestBaseVo
{
private
int
pageNum
;
private
int
pageSize
;
}
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