Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
java-devop-sentry
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
zhouzihao
java-devop-sentry
Commits
a44aa406
Commit
a44aa406
authored
Mar 13, 2020
by
zhouzihao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dev-完善获取车辆列表
parent
2652c92f
Pipeline
#76
failed with stages
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
4 deletions
+19
-4
src/main/java/com/vandyo/sentry/core/cases/CarListDecorator.java
...n/java/com/vandyo/sentry/core/cases/CarListDecorator.java
+11
-3
src/main/java/com/vandyo/sentry/core/dto/ErrStatus.java
src/main/java/com/vandyo/sentry/core/dto/ErrStatus.java
+8
-1
No files found.
src/main/java/com/vandyo/sentry/core/cases/CarListDecorator.java
View file @
a44aa406
...
@@ -5,6 +5,7 @@ import cn.hutool.http.HttpResponse;
...
@@ -5,6 +5,7 @@ import cn.hutool.http.HttpResponse;
import
cn.hutool.json.JSONArray
;
import
cn.hutool.json.JSONArray
;
import
cn.hutool.json.JSONObject
;
import
cn.hutool.json.JSONObject
;
import
cn.hutool.json.JSONUtil
;
import
cn.hutool.json.JSONUtil
;
import
com.vandyo.sentry.core.dto.ErrStatus
;
import
com.vandyo.sentry.core.dto.Res
;
import
com.vandyo.sentry.core.dto.Res
;
import
com.vandyo.sentry.core.tools.Signature
;
import
com.vandyo.sentry.core.tools.Signature
;
...
@@ -35,9 +36,16 @@ public class CarListDecorator extends CaseDecorator {
...
@@ -35,9 +36,16 @@ public class CarListDecorator extends CaseDecorator {
if
(
response
.
isOk
()){
if
(
response
.
isOk
()){
JSONObject
json
=
JSONUtil
.
parseObj
(
response
.
body
());
JSONObject
json
=
JSONUtil
.
parseObj
(
response
.
body
());
JSONArray
list
=
json
.
getJSONArray
(
"result"
);
JSONArray
list
=
json
.
getJSONArray
(
"result"
);
if
(
list
.
size
()
<
1
){
//todo
newRes
.
setSuccess
(
false
);
newRes
.
setStatus
(
ErrStatus
.
ErrUnexpected
);
}
else
{
Map
<
String
,
String
>
carMap
=
new
HashMap
<>();
JSONObject
car
=
(
JSONObject
)
list
.
get
(
0
);
carMap
.
put
(
"cid"
,
car
.
getStr
(
"cid"
));
newRes
.
setData
(
carMap
);
newRes
.
setSuccess
(
true
);
newRes
.
setSuccess
(
true
);
}
}
else
{
}
else
{
newRes
.
setSuccess
(
false
);
newRes
.
setSuccess
(
false
);
}
}
...
...
src/main/java/com/vandyo/sentry/core/dto/ErrStatus.java
View file @
a44aa406
...
@@ -9,9 +9,16 @@ public enum ErrStatus {
...
@@ -9,9 +9,16 @@ public enum ErrStatus {
* 400错误
* 400错误
*/
*/
Err4xx
,
Err4xx
,
/**
* 超时错误
*/
ErrTimeout
,
/**
* 没有预期的返回值
*/
ErrUnexpected
,
/**
/**
* 未知错误
* 未知错误
*/
*/
ErrUnknown
;
ErrUnknown
;
//TODO 扩展数据 错误类型:超时错误
}
}
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