Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
byit-myth-job
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
liyuan
byit-myth-job
Commits
2e83f196
Commit
2e83f196
authored
Mar 27, 2020
by
guominglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改统一返回实体类的方式
parent
012d5f15
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
18 deletions
+12
-18
ApiFlowController.java
...h-admin/src/main/java/com/byit/api/ApiFlowController.java
+2
-2
ApiNodeController.java
...h-admin/src/main/java/com/byit/api/ApiNodeController.java
+2
-2
ResponseAdvice.java
...ore/src/main/java/com/byit/web/advice/ResponseAdvice.java
+8
-14
No files found.
byit-myth-admin/src/main/java/com/byit/api/ApiFlowController.java
View file @
2e83f196
...
@@ -33,9 +33,9 @@ public class ApiFlowController {
...
@@ -33,9 +33,9 @@ public class ApiFlowController {
@PostMapping
(
"publish"
)
@PostMapping
(
"publish"
)
@ApiOperation
(
"发布工作流,并开始调度"
)
@ApiOperation
(
"发布工作流,并开始调度"
)
public
ResponseResult
publishFlow
(
String
param
)
throws
Exception
{
public
String
publishFlow
(
String
param
)
throws
Exception
{
apiFlowService
.
publishFlow
(
param
);
apiFlowService
.
publishFlow
(
param
);
return
ResponseResult
.
ok
(
"SUCCESS"
)
;
return
"SUCCESS"
;
}
}
@PostMapping
(
"deleteFlow"
)
@PostMapping
(
"deleteFlow"
)
...
...
byit-myth-admin/src/main/java/com/byit/api/ApiNodeController.java
View file @
2e83f196
...
@@ -24,9 +24,9 @@ public class ApiNodeController {
...
@@ -24,9 +24,9 @@ public class ApiNodeController {
private
StringRedisTemplate
stringRedisTemplate
;
private
StringRedisTemplate
stringRedisTemplate
;
@PostMapping
(
"runNode"
)
@PostMapping
(
"runNode"
)
public
ResponseResult
runNode
(
String
param
){
public
String
runNode
(
String
param
){
String
monitorKey
=
apiNodeService
.
runNode
(
param
);
String
monitorKey
=
apiNodeService
.
runNode
(
param
);
return
ResponseResult
.
ok
(
monitorKey
)
;
return
monitorKey
;
}
}
@PostMapping
(
"runHistory"
)
@PostMapping
(
"runHistory"
)
...
...
byit-myth-core/myth-web-core/src/main/java/com/byit/web/advice/ResponseAdvice.java
View file @
2e83f196
...
@@ -6,8 +6,6 @@ import org.springframework.core.MethodParameter;
...
@@ -6,8 +6,6 @@ import org.springframework.core.MethodParameter;
import
org.springframework.http.MediaType
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.server.ServerHttpRequest
;
import
org.springframework.http.server.ServerHttpRequest
;
import
org.springframework.http.server.ServerHttpResponse
;
import
org.springframework.http.server.ServerHttpResponse
;
import
org.springframework.web.bind.annotation.ControllerAdvice
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.RestControllerAdvice
;
import
org.springframework.web.bind.annotation.RestControllerAdvice
;
import
org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice
;
import
org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice
;
...
@@ -17,8 +15,8 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
...
@@ -17,8 +15,8 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
* @author: huangfu
* @author: huangfu
* @date: 2019/12/25 16:57
* @date: 2019/12/25 16:57
**/
**/
@ControllerAdvice
@
Rest
ControllerAdvice
public
class
ResponseAdvice
implements
ResponseBodyAdvice
<
Object
>
{
public
class
ResponseAdvice
implements
ResponseBodyAdvice
{
@Override
@Override
public
boolean
supports
(
MethodParameter
methodParameter
,
Class
aClass
)
{
public
boolean
supports
(
MethodParameter
methodParameter
,
Class
aClass
)
{
return
true
;
return
true
;
...
@@ -35,17 +33,13 @@ public class ResponseAdvice implements ResponseBodyAdvice<Object> {
...
@@ -35,17 +33,13 @@ public class ResponseAdvice implements ResponseBodyAdvice<Object> {
*/
*/
@Override
@Override
public
Object
beforeBodyWrite
(
Object
body
,
MethodParameter
methodParameter
,
MediaType
mediaType
,
Class
aClass
,
ServerHttpRequest
serverHttpRequest
,
ServerHttpResponse
serverHttpResponse
)
{
public
Object
beforeBodyWrite
(
Object
body
,
MethodParameter
methodParameter
,
MediaType
mediaType
,
Class
aClass
,
ServerHttpRequest
serverHttpRequest
,
ServerHttpResponse
serverHttpResponse
)
{
if
(
body
instanceof
ResponseResult
){
String
simpleName
=
methodParameter
.
getParameterType
().
getSimpleName
();
if
(
"ResponseResult"
.
equals
(
simpleName
)){
return
body
;
return
body
;
}
else
if
(
"void"
.
equals
(
simpleName
)){
return
JSON
.
toJSONString
(
ResponseResult
.
ok
());
}
else
{
return
JSON
.
toJSONString
(
ResponseResult
.
ok
(
body
));
}
}
return
ResponseResult
.
ok
(
body
);
}
}
public
static
void
main
(
String
[]
args
)
{
ResponseResult
<
Object
>
ok
=
ResponseResult
.
ok
(
true
);
System
.
out
.
println
(
JSON
.
toJSONString
(
ok
));
}
}
}
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