Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
谢明辉
/
fanxing3
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit b79ddbd7
authored
Sep 30, 2021
by
xmh
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
gateway:
失败时返回信息格式化 task: TaskController.channelUnidWithTask 返回结果修改
1 parent
50509e46
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
5 deletions
fanxing-gateway/src/main/java/com/viontech/fanxing/forward/AuthorizationFilter.java
fanxing-task/src/main/java/com/viontech/fanxing/task/controller/web/TaskController.java
fanxing-gateway/src/main/java/com/viontech/fanxing/forward/AuthorizationFilter.java
View file @
b79ddbd
package
com
.
viontech
.
fanxing
.
forward
;
package
com
.
viontech
.
fanxing
.
forward
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.viontech.fanxing.commons.config.VionConfig
;
import
com.viontech.fanxing.commons.config.VionConfig
;
import
com.viontech.keliu.util.JsonMessageUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
@@ -85,7 +87,9 @@ public class AuthorizationFilter implements GlobalFilter {
...
@@ -85,7 +87,9 @@ public class AuthorizationFilter implements GlobalFilter {
response
.
setStatusCode
(
HttpStatus
.
UNAUTHORIZED
);
response
.
setStatusCode
(
HttpStatus
.
UNAUTHORIZED
);
return
response
.
writeWith
(
Mono
.
just
(
msg
).
map
(
x
->
{
return
response
.
writeWith
(
Mono
.
just
(
msg
).
map
(
x
->
{
byte
[]
bytes
=
x
.
getBytes
(
StandardCharsets
.
UTF_8
);
JsonMessageUtil
.
JsonMessage
errorJsonMsg
=
JsonMessageUtil
.
getErrorJsonMsg
(
msg
);
String
s
=
JSON
.
toJSONString
(
errorJsonMsg
);
byte
[]
bytes
=
s
.
getBytes
(
StandardCharsets
.
UTF_8
);
return
response
.
bufferFactory
().
wrap
(
bytes
);
return
response
.
bufferFactory
().
wrap
(
bytes
);
}));
}));
}
}
...
...
fanxing-task/src/main/java/com/viontech/fanxing/task/controller/web/TaskController.java
View file @
b79ddbd
...
@@ -2,6 +2,7 @@ package com.viontech.fanxing.task.controller.web;
...
@@ -2,6 +2,7 @@ package com.viontech.fanxing.task.controller.web;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.viontech.fanxing.commons.base.BaseExample
;
import
com.viontech.fanxing.commons.base.BaseExample
;
import
com.viontech.fanxing.commons.base.BaseModel
;
import
com.viontech.fanxing.commons.model.Task
;
import
com.viontech.fanxing.commons.model.Task
;
import
com.viontech.fanxing.commons.model.TaskExample
;
import
com.viontech.fanxing.commons.model.TaskExample
;
import
com.viontech.fanxing.commons.vo.TaskVo
;
import
com.viontech.fanxing.commons.vo.TaskVo
;
...
@@ -11,7 +12,7 @@ import lombok.extern.slf4j.Slf4j;
...
@@ -11,7 +12,7 @@ import lombok.extern.slf4j.Slf4j;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
import
java.util.List
;
import
java.util.
Set
;
import
java.util.
Map
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
@RestController
@RestController
...
@@ -75,10 +76,12 @@ public class TaskController extends TaskBaseController {
...
@@ -75,10 +76,12 @@ public class TaskController extends TaskBaseController {
@GetMapping
(
"channelUnidWithTask"
)
@GetMapping
(
"channelUnidWithTask"
)
public
JsonMessageUtil
.
JsonMessage
channelUnidWithTask
()
{
public
JsonMessageUtil
.
JsonMessage
channelUnidWithTask
()
{
TaskExample
taskExample
=
new
TaskExample
();
TaskExample
taskExample
=
new
TaskExample
();
taskExample
.
createColumns
().
hasChannelUnidColumn
();
taskExample
.
createColumns
().
hasChannelUnidColumn
().
addColumnStr
(
"count(*) as count"
);
taskExample
.
setGroupByClause
(
"channel_unid"
);
taskExample
.
setOrderByClause
(
"channel_unid"
);
List
<
Task
>
tasks
=
taskService
.
selectByExample
(
taskExample
);
List
<
Task
>
tasks
=
taskService
.
selectByExample
(
taskExample
);
Set
<
String
>
collect
=
tasks
.
stream
().
map
(
Task:
:
getChannelUnid
).
collect
(
Collectors
.
toSet
(
));
Map
<
String
,
Long
>
result
=
tasks
.
stream
().
collect
(
Collectors
.
toMap
(
Task:
:
getChannelUnid
,
BaseModel:
:
getCount
));
return
JsonMessageUtil
.
getSuccessJsonMsg
(
collec
t
);
return
JsonMessageUtil
.
getSuccessJsonMsg
(
resul
t
);
}
}
}
}
\ No newline at end of file
\ No newline at end of file
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