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
921b3994
Commit
921b3994
authored
Aug 08, 2023
by
s_guodong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
去掉needInit,增加渠道缓存,增加参数校验方法
parent
65c8cebc
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
66 additions
and
12 deletions
+66
-12
pom.xml
gjjs-bd-business/pom.xml
+4
-0
AbstractCommonResource.java
...om/ceb/gjjs/mda/resource/base/AbstractCommonResource.java
+0
-4
ValidatorUtil.java
...ss/src/main/java/com/ceb/gjjs/mda/util/ValidatorUtil.java
+52
-0
AbstractRouteService.java
.../brilliance/mda/support/service/AbstractRouteService.java
+10
-8
No files found.
gjjs-bd-business/pom.xml
View file @
921b3994
...
...
@@ -80,6 +80,10 @@
<artifactId>
spring-boot-starter-jersey
</artifactId>
</dependency>
<dependency>
<groupId>
org.hibernate.validator
</groupId>
<artifactId>
hibernate-validator
</artifactId>
</dependency>
<dependency>
<groupId>
com.brilliance
</groupId>
<artifactId>
jrxx-bean
</artifactId>
<version>
0.0.1
</version>
...
...
gjjs-bd-business/src/main/java/com/ceb/gjjs/mda/resource/base/AbstractCommonResource.java
View file @
921b3994
package
com
.
ceb
.
gjjs
.
mda
.
resource
.
base
;
import
com.brilliance.mda.runtime.mda.driver.compile.processor.ModuleAnnotationProcess
;
import
com.brilliance.mda.runtime.request.BaseVO
;
import
com.brilliance.mda.runtime.response.ResponseSet
;
import
com.brilliance.mda.support.service.ICommonService
;
...
...
@@ -22,7 +21,6 @@ public abstract class AbstractCommonResource<V extends BaseVO> {
@Path
(
"/init"
)
@POST
public
ResponseSet
<
V
>
init
(
@RequestBody
V
req
)
{
req
.
setNeedInit
(
true
);
return
getCommonService
().
init
(
req
);
}
...
...
@@ -55,7 +53,6 @@ public abstract class AbstractCommonResource<V extends BaseVO> {
@POST
public
ResponseSet
<
V
>
executeCheck
(
@PathParam
(
"rule"
)
String
rule
,
@RequestBody
V
req
)
{
String
[]
ruleArr
=
rule
.
split
(
","
);
setInitFlag
(
req
,
ModuleAnnotationProcess
.
needInitCheck
,
ruleArr
);
return
getCommonService
().
executeCheck
(
req
,
ruleArr
);
}
...
...
@@ -63,7 +60,6 @@ public abstract class AbstractCommonResource<V extends BaseVO> {
@POST
public
ResponseSet
<
V
>
executeRule
(
@PathParam
(
"rule"
)
String
rule
,
@RequestBody
V
req
)
{
String
[]
ruleArr
=
rule
.
split
(
","
);
setInitFlag
(
req
,
ModuleAnnotationProcess
.
needInitRule
,
ruleArr
);
ResponseSet
<
V
>
res
=
getCommonService
().
executeRule
(
req
,
ruleArr
);
return
res
;
}
...
...
gjjs-bd-business/src/main/java/com/ceb/gjjs/mda/util/ValidatorUtil.java
0 → 100644
View file @
921b3994
package
com
.
ceb
.
gjjs
.
mda
.
util
;
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
;
/**
* @Description
* @Author s_guodong
* @Date 2023/8/8
*/
public
class
ValidatorUtil
{
public
static
String
check
(
Object
obj
)
{
Class
<?>
aClass
=
obj
.
getClass
();
Field
[]
fields
=
aClass
.
getDeclaredFields
();
for
(
Field
f
:
fields
)
{
f
.
setAccessible
(
true
);
Class
<?>
type
=
f
.
getType
();
Object
o
=
null
;
try
{
o
=
f
.
get
(
obj
);
}
catch
(
IllegalAccessException
e
)
{
}
if
(
f
.
isAnnotationPresent
(
Length
.
class
)
&&
type
.
isAssignableFrom
(
String
.
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
(
f
.
isAnnotationPresent
(
NotEmpty
.
class
)
&&
type
.
isAssignableFrom
(
String
.
class
))
{
if
(
o
==
null
||
StringUtils
.
isBlank
((
String
)
o
))
{
return
f
.
getName
()
+
":不能为空"
;
}
}
if
(
f
.
isAnnotationPresent
(
NotNull
.
class
)
&&
!
type
.
isAssignableFrom
(
String
.
class
))
{
if
(
o
==
null
)
{
return
f
.
getName
()
+
":不能为null"
;
}
}
}
return
""
;
}
}
gjjs-bd-runtime/src/main/java/com/brilliance/mda/support/service/AbstractRouteService.java
View file @
921b3994
...
...
@@ -332,11 +332,11 @@ public abstract class AbstractRouteService<V extends BaseVO> {
if
(
req
!=
null
)
{
ctx
.
setVo
(
req
);
}
if
(!
req
.
isNeedInit
())
{
logger
.
info
(
"不需要初始化"
);
return
;
}
logger
.
info
(
"开始初始化..."
);
//
if (!req.isNeedInit()) {
//
logger.info("不需要初始化");
//
return;
//
}
//
logger.info("开始初始化...");
StopWatch
watch
=
new
StopWatch
(
"initTrans"
);
IRuleEmitter
emitter
=
getEmitter
();
//将认证信息(usr、usg、ety)放入sysStream
...
...
@@ -461,12 +461,14 @@ public abstract class AbstractRouteService<V extends BaseVO> {
public
boolean
enterTransaction
(
V
req
)
{
if
(
req
!=
null
)
{
IContext
ctx
=
MdaEnv
.
getContext
();
String
src
=
req
.
getSrc
();
ctx
.
storeData
(
IContext
.
APP_KEY
,
src
);
Map
<
String
,
Object
>
params
=
req
.
getParams
();
chain
(
params
);
initTrans
(
req
);
IContext
ctx
=
MdaEnv
.
getContext
();
String
src
=
req
.
getSrc
();
if
(!
StringUtils
.
isBlank
(
src
))
{
ctx
.
storeData
(
IContext
.
APP_KEY
,
src
);
}
ctx
.
storeData
(
IContext
.
DISPLAY_KEY
,
req
);
}
return
true
;
...
...
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