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
9e7baafb
Commit
9e7baafb
authored
Mar 19, 2020
by
zhouzihao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dev-添加banner和userInfo接口
parent
3e0b690d
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
122 additions
and
4 deletions
+122
-4
src/main/java/com/vandyo/sentry/core/Tmp.java
src/main/java/com/vandyo/sentry/core/Tmp.java
+9
-3
src/main/java/com/vandyo/sentry/core/cases/BannerListDecorator.java
...ava/com/vandyo/sentry/core/cases/BannerListDecorator.java
+54
-0
src/main/java/com/vandyo/sentry/core/cases/UserInfoDecorator.java
.../java/com/vandyo/sentry/core/cases/UserInfoDecorator.java
+54
-0
src/main/java/com/vandyo/sentry/core/collectionMachine/CollectionMachine.java
...ndyo/sentry/core/collectionMachine/CollectionMachine.java
+1
-1
src/main/resources/application.yaml
src/main/resources/application.yaml
+4
-0
No files found.
src/main/java/com/vandyo/sentry/core/Tmp.java
View file @
9e7baafb
...
...
@@ -42,18 +42,24 @@ public class Tmp {
log
.
info
(
"we run it {} times"
,
++
times
);
Case
case1
=
null
;
// 上线前使用这段代码
// case1 = new EmptyCase(sId,uid);
// 登录
case1
=
new
LoginCase
(
mobile
,
pwd
);
// 查询用户信息
case1
=
new
UserInfoDecorator
(
case1
);
case1
=
new
CarListDecorator
(
case1
);
case1
=
new
CarInfoDecorator
(
case1
);
case1
=
new
CarDetectDecorator
(
case1
);
case1
=
new
CarStatusDecorator
(
case1
);
case1
.
check
();
// 注释掉这段代码
// banner接口
Case
case2
=
null
;
case2
=
new
TestCase
();
case2
=
new
EmptyCase
(
sId
,
uid
);
case2
=
new
BannerListDecorator
(
case2
);
case2
.
check
();
log
.
info
(
"over!"
);
}
...
...
src/main/java/com/vandyo/sentry/core/cases/BannerListDecorator.java
0 → 100644
View file @
9e7baafb
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.Res
;
import
com.vandyo.sentry.core.tools.Signature
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* 获取Banner列表接口
*/
public
class
BannerListDecorator
extends
CaseDecorator
{
private
final
static
String
bannerListUrl
=
"/user/banner/list"
;
public
BannerListDecorator
(
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
());
Map
<
String
,
String
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"uid"
,
oldRes
.
getUId
());
paramMap
.
put
(
"type"
,
"1"
);
HttpResponse
response
=
HttpRequest
.
post
(
Signature
.
host
+
bannerListUrl
)
.
body
(
JSONUtil
.
parseFromMap
(
paramMap
).
toString
())
.
execute
();
if
(
response
.
isOk
())
{
JSONObject
jsonObject
=
JSONUtil
.
parseObj
(
response
.
body
());
//todo 检测 返回值可用性
newRes
.
setData
(
carMap
);
newRes
.
setSuccess
(
true
);
}
else
{
newRes
.
setKey
(
bannerListUrl
);
newRes
.
setStatus
(
Signature
.
matchStatus
(
response
.
getStatus
()));
newRes
.
setSuccess
(
false
);
}
return
newRes
;
}
else
{
oldRes
.
setIgnore
(
true
);
return
oldRes
;
}
}
}
src/main/java/com/vandyo/sentry/core/cases/UserInfoDecorator.java
0 → 100644
View file @
9e7baafb
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.collectionMachine.CollectionMachine
;
import
com.vandyo.sentry.core.dto.Res
;
import
com.vandyo.sentry.core.tools.Signature
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* 获取用户信息接口
*/
public
class
UserInfoDecorator
extends
CaseDecorator
{
private
final
static
String
UserInfoUrl
=
"/user/info/get"
;
public
UserInfoDecorator
(
Case
aCase
)
{
super
(
aCase
);
}
@Override
public
Res
<
Map
<
String
,
String
>>
check
()
{
Res
<
Map
<
String
,
String
>>
oldRes
=
super
.
check
();
if
(
oldRes
.
getSuccess
())
{
Map
<
String
,
String
>
data
=
new
HashMap
<>();
data
.
put
(
"uid"
,
oldRes
.
getUId
());
HttpResponse
response
=
HttpRequest
.
get
(
Signature
.
host
+
UserInfoUrl
+
"?"
+
Signature
.
getUrlParamsByMap
(
Signature
.
sign
(
data
,
oldRes
.
getSId
())))
.
execute
();
Res
<
Map
<
String
,
String
>>
newRes
=
new
Res
<>();
newRes
.
setSId
(
oldRes
.
getSId
());
newRes
.
setUId
(
oldRes
.
getUId
());
if
(
response
.
isOk
())
{
JSONObject
json
=
JSONUtil
.
parseObj
(
response
.
body
());
newRes
.
setSuccess
(
true
);
}
else
{
newRes
.
setKey
(
UserInfoUrl
);
newRes
.
setStatus
(
Signature
.
matchStatus
(
response
.
getStatus
()));
newRes
.
setSuccess
(
false
);
}
CollectionMachine
.
post
(
newRes
);
return
newRes
;
}
else
{
oldRes
.
setIgnore
(
true
);
return
oldRes
;
}
}
}
\ No newline at end of file
src/main/java/com/vandyo/sentry/core/collectionMachine/CollectionMachine.java
View file @
9e7baafb
...
...
@@ -20,7 +20,7 @@ public class CollectionMachine {
public
static
void
post
(
Res
<
Map
<
String
,
String
>>
log
)
{
// 应该对于不同的请求统一管理 还是 每个单独管理呢?
logger
.
info
(
"temp long is {}"
,
temp
.
size
());
//
logger.info("temp long is {}", temp.size());
if
(
log
.
getIgnore
()
||
log
.
getSuccess
())
{
//pass
}
else
{
...
...
src/main/resources/application.yaml
View file @
9e7baafb
...
...
@@ -10,12 +10,16 @@ checkmeta:
"
[/car/car_detect]"
:
车体检
"
[/car/my_car/list]"
:
车列表
"
[/carDynamic/api/status/car/state/get]"
:
车动态
"
[/user/banner/list]"
:
首页获取banner
"
[/user/info/get]"
:
获取用户信息
test
:
测试接口
timeMap
:
"
[/car/my_car/info]"
:
6
"
[/car/car_detect]"
:
6
"
[/car/my_car/list]"
:
6
"
[/carDynamic/api/status/car/state/get]"
:
6
"
[/user/banner/list]"
:
6
"
[/user/info/get]"
:
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