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
f48c12fa
Commit
f48c12fa
authored
Mar 19, 2020
by
zhouzihao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dev-查询车轨迹点的接口
parent
e27fa15c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
85 additions
and
1 deletion
+85
-1
src/main/java/com/vandyo/sentry/core/Tmp.java
src/main/java/com/vandyo/sentry/core/Tmp.java
+2
-1
src/main/java/com/vandyo/sentry/core/cases/CarLocausPointListDecorator.java
...vandyo/sentry/core/cases/CarLocausPointListDecorator.java
+79
-0
src/main/java/com/vandyo/sentry/core/cases/CarLocusPageDecorator.java
...a/com/vandyo/sentry/core/cases/CarLocusPageDecorator.java
+2
-0
src/main/resources/application.yaml
src/main/resources/application.yaml
+2
-0
No files found.
src/main/java/com/vandyo/sentry/core/Tmp.java
View file @
f48c12fa
...
...
@@ -51,7 +51,8 @@ public class Tmp {
case1
=
new
DayReportDecorator
(
case1
);
// 查询车轨迹接口
case1
=
new
CarLocusPageDecorator
(
case1
);
// 查询车轨迹点 接口
case1
=
new
CarLocausPointListDecorator
(
case1
);
case1
=
new
CarInfoDecorator
(
case1
);
case1
=
new
CarDetectDecorator
(
case1
);
case1
=
new
CarStatusDecorator
(
case1
);
...
...
src/main/java/com/vandyo/sentry/core/cases/CarLocausPointListDecorator.java
0 → 100644
View file @
f48c12fa
package
com
.
vandyo
.
sentry
.
core
.
cases
;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.http.HttpResponse
;
import
cn.hutool.json.JSONObject
;
import
cn.hutool.json.JSONUtil
;
import
com.vandyo.sentry.core.dto.ErrStatus
;
import
com.vandyo.sentry.core.dto.Res
;
import
com.vandyo.sentry.core.tools.Signature
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Objects
;
/**
* 查询车轨迹点的接口
*/
public
class
CarLocausPointListDecorator
extends
CaseDecorator
{
private
static
final
String
CarLocausPointListUrl
=
"/car/api/locus/points/list"
;
public
CarLocausPointListDecorator
(
Case
aCase
)
{
super
(
aCase
);
}
@Override
public
Res
<
Map
<
String
,
String
>>
check
()
{
Res
<
Map
<
String
,
String
>>
oldRes
=
super
.
check
();
if
(
oldRes
.
getSuccess
())
{
Map
<
String
,
String
>
carMap
=
oldRes
.
getData
();
Res
<
Map
<
String
,
String
>>
newRes
=
new
Res
<>();
newRes
.
setSId
(
oldRes
.
getSId
());
newRes
.
setUId
(
oldRes
.
getUId
());
if
(
Objects
.
isNull
(
carMap
)
||
!
carMap
.
containsKey
(
"cid"
)
||
!
carMap
.
containsKey
(
"traceid"
))
{
newRes
.
setIgnore
(
true
);
newRes
.
setStatus
(
ErrStatus
.
ErrUnexpected
);
newRes
.
setSuccess
(
false
);
}
else
{
String
cid
=
carMap
.
get
(
"cid"
);
Map
<
String
,
String
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"cid"
,
cid
);
paramMap
.
put
(
"uid"
,
oldRes
.
getUId
());
paramMap
.
put
(
"traceid"
,
carMap
.
get
(
"traceid"
));
paramMap
.
put
(
"start"
,
carMap
.
get
(
"sti"
));
paramMap
.
put
(
"end"
,
carMap
.
get
(
"eti"
));
// paramMap.put("start", String.valueOf(System.currentTimeMillis() / 1000 - 24 * 60 * 60));
// paramMap.put("end",String.valueOf(System.currentTimeMillis()/1000));
try
{
HttpResponse
response
=
HttpRequest
.
get
(
Signature
.
host
+
CarLocausPointListUrl
+
"?"
+
Signature
.
getUrlParamsByMap
(
Signature
.
sign
(
paramMap
,
oldRes
.
getSId
()))
).
execute
();
if
(
response
.
isOk
())
{
JSONObject
jsonObject
=
JSONUtil
.
parseObj
(
response
.
body
());
// JSONArray list = jsonObject.getJSONArray("result");
// if (list.size() > 0) {
// JSONObject result = list.getJSONObject(0);
// carMap.put("traceid",result.getStr("traceid"));
// }
newRes
.
setData
(
carMap
);
newRes
.
setSuccess
(
true
);
}
else
{
newRes
.
setKey
(
CarLocausPointListUrl
);
newRes
.
setStatus
(
Signature
.
matchStatus
(
response
.
getStatus
()));
newRes
.
setSuccess
(
false
);
}
}
catch
(
Exception
e
)
{
newRes
.
setKey
(
CarLocausPointListUrl
);
newRes
.
setStatus
(
ErrStatus
.
ErrUnknown
);
newRes
.
setSuccess
(
false
);
}
}
return
newRes
;
}
else
{
oldRes
.
setIgnore
(
true
);
return
oldRes
;
}
}
}
src/main/java/com/vandyo/sentry/core/cases/CarLocusPageDecorator.java
View file @
f48c12fa
...
...
@@ -55,6 +55,8 @@ public class CarLocusPageDecorator extends CaseDecorator {
if
(
list
.
size
()
>
0
)
{
JSONObject
result
=
list
.
getJSONObject
(
0
);
carMap
.
put
(
"traceid"
,
result
.
getStr
(
"traceid"
));
carMap
.
put
(
"sti"
,
result
.
getStr
(
"sti"
));
carMap
.
put
(
"eti"
,
result
.
getStr
(
"eti"
));
}
newRes
.
setData
(
carMap
);
newRes
.
setSuccess
(
true
);
...
...
src/main/resources/application.yaml
View file @
f48c12fa
...
...
@@ -15,6 +15,7 @@ checkmeta:
"
[/user/info/get]"
:
获取用户信息
"
[/car/api/reprt/reportDay/get]"
:
车日报
"
[/car/api/locus/list/page]"
:
轨迹查询接口
"
[/car/api/locus/points/list]"
:
车辆轨迹点接口
test
:
测试接口
timeMap
:
"
[/car/my_car/info]"
:
6
...
...
@@ -25,6 +26,7 @@ checkmeta:
"
[/user/info/get]"
:
6
"
[/car/api/reprt/reportDay/get]"
:
6
"
[/car/api/locus/list/page]"
:
6
"
[/car/api/locus/points/list]"
:
6
test
:
2
emailList[0]
:
"
1042181618@qq.com"
...
...
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