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
fdb908e8
Commit
fdb908e8
authored
Mar 17, 2020
by
zhouzihao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dev-发生邮件测试通过
parent
01443501
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
54 additions
and
11 deletions
+54
-11
src/main/java/com/vandyo/sentry/core/cases/CarInfoDecorator.java
...n/java/com/vandyo/sentry/core/cases/CarInfoDecorator.java
+1
-0
src/main/java/com/vandyo/sentry/core/cases/CarListDecorator.java
...n/java/com/vandyo/sentry/core/cases/CarListDecorator.java
+1
-0
src/main/java/com/vandyo/sentry/core/cases/CarStatusDecorator.java
...java/com/vandyo/sentry/core/cases/CarStatusDecorator.java
+1
-0
src/main/java/com/vandyo/sentry/core/cases/EmptyCase.java
src/main/java/com/vandyo/sentry/core/cases/EmptyCase.java
+2
-0
src/main/java/com/vandyo/sentry/core/cases/LoginCase.java
src/main/java/com/vandyo/sentry/core/cases/LoginCase.java
+1
-0
src/main/java/com/vandyo/sentry/core/collectionMachine/CollectionDealer.java
...andyo/sentry/core/collectionMachine/CollectionDealer.java
+9
-0
src/main/java/com/vandyo/sentry/core/collectionMachine/DataClearDealer.java
...vandyo/sentry/core/collectionMachine/DataClearDealer.java
+24
-5
src/main/java/com/vandyo/sentry/core/collectionMachine/EmailDealer.java
...com/vandyo/sentry/core/collectionMachine/EmailDealer.java
+5
-2
src/main/resources/application.yaml
src/main/resources/application.yaml
+10
-4
No files found.
src/main/java/com/vandyo/sentry/core/cases/CarInfoDecorator.java
View file @
fdb908e8
...
@@ -53,6 +53,7 @@ public class CarInfoDecorator extends CaseDecorator {
...
@@ -53,6 +53,7 @@ public class CarInfoDecorator extends CaseDecorator {
newRes
.
setData
(
carMap
);
newRes
.
setData
(
carMap
);
newRes
.
setSuccess
(
true
);
newRes
.
setSuccess
(
true
);
}
else
{
}
else
{
newRes
.
setKey
(
carInfoUrl
);
newRes
.
setStatus
(
Signature
.
matchStatus
(
response
.
getStatus
()));
newRes
.
setStatus
(
Signature
.
matchStatus
(
response
.
getStatus
()));
newRes
.
setSuccess
(
false
);
newRes
.
setSuccess
(
false
);
}
}
...
...
src/main/java/com/vandyo/sentry/core/cases/CarListDecorator.java
View file @
fdb908e8
...
@@ -49,6 +49,7 @@ public class CarListDecorator extends CaseDecorator {
...
@@ -49,6 +49,7 @@ public class CarListDecorator extends CaseDecorator {
newRes
.
setSuccess
(
true
);
newRes
.
setSuccess
(
true
);
}
}
}
else
{
}
else
{
newRes
.
setKey
(
carListUrl
);
newRes
.
setStatus
(
Signature
.
matchStatus
(
response
.
getStatus
()));
newRes
.
setStatus
(
Signature
.
matchStatus
(
response
.
getStatus
()));
newRes
.
setSuccess
(
false
);
newRes
.
setSuccess
(
false
);
}
}
...
...
src/main/java/com/vandyo/sentry/core/cases/CarStatusDecorator.java
View file @
fdb908e8
...
@@ -54,6 +54,7 @@ public class CarStatusDecorator extends CaseDecorator{
...
@@ -54,6 +54,7 @@ public class CarStatusDecorator extends CaseDecorator{
newRes
.
setData
(
carMap
);
newRes
.
setData
(
carMap
);
newRes
.
setSuccess
(
true
);
newRes
.
setSuccess
(
true
);
}
else
{
}
else
{
newRes
.
setKey
(
carStatusUrl
);
newRes
.
setStatus
(
Signature
.
matchStatus
(
response
.
getStatus
()));
newRes
.
setStatus
(
Signature
.
matchStatus
(
response
.
getStatus
()));
newRes
.
setSuccess
(
false
);
newRes
.
setSuccess
(
false
);
}
}
...
...
src/main/java/com/vandyo/sentry/core/cases/EmptyCase.java
View file @
fdb908e8
...
@@ -18,6 +18,8 @@ public class EmptyCase extends Case {
...
@@ -18,6 +18,8 @@ public class EmptyCase extends Case {
this
.
uid
=
uid
;
this
.
uid
=
uid
;
}
}
// FIXME: 更灵活的初始调用
@Override
@Override
public
Res
<
Map
<
String
,
String
>>
check
()
{
public
Res
<
Map
<
String
,
String
>>
check
()
{
Res
<
Map
<
String
,
String
>>
res
=
new
Res
<>();
Res
<
Map
<
String
,
String
>>
res
=
new
Res
<>();
...
...
src/main/java/com/vandyo/sentry/core/cases/LoginCase.java
View file @
fdb908e8
...
@@ -42,6 +42,7 @@ public class LoginCase extends Case {
...
@@ -42,6 +42,7 @@ public class LoginCase extends Case {
res
.
setSId
(
sid
);
res
.
setSId
(
sid
);
res
.
setSuccess
(
true
);
res
.
setSuccess
(
true
);
}
else
{
}
else
{
res
.
setKey
(
loginUrl
);
res
.
setSuccess
(
false
);
res
.
setSuccess
(
false
);
res
.
setStatus
(
Signature
.
matchStatus
(
response
.
getStatus
()));
res
.
setStatus
(
Signature
.
matchStatus
(
response
.
getStatus
()));
}
}
...
...
src/main/java/com/vandyo/sentry/core/collectionMachine/CollectionDealer.java
View file @
fdb908e8
...
@@ -21,4 +21,13 @@ public interface CollectionDealer {
...
@@ -21,4 +21,13 @@ public interface CollectionDealer {
* @return
* @return
*/
*/
String
formatData
(
Map
<
String
,
Map
<
ErrStatus
,
Long
>>
data
);
String
formatData
(
Map
<
String
,
Map
<
ErrStatus
,
Long
>>
data
);
/**
* 通过名字 错误面板格式化
* @param data
* @param names
* @return
*/
String
formatData
(
Map
<
String
,
Map
<
ErrStatus
,
Long
>>
data
,
Map
<
String
,
String
>
names
);
}
}
src/main/java/com/vandyo/sentry/core/collectionMachine/DataClearDealer.java
View file @
fdb908e8
...
@@ -2,20 +2,39 @@ package com.vandyo.sentry.core.collectionMachine;
...
@@ -2,20 +2,39 @@ package com.vandyo.sentry.core.collectionMachine;
import
com.vandyo.sentry.core.dto.ErrStatus
;
import
com.vandyo.sentry.core.dto.ErrStatus
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Objects
;
public
abstract
class
DataClearDealer
implements
CollectionDealer
{
public
abstract
class
DataClearDealer
implements
CollectionDealer
{
@Override
@Override
public
String
formatData
(
Map
<
String
,
Map
<
ErrStatus
,
Long
>>
data
)
{
public
String
formatData
(
Map
<
String
,
Map
<
ErrStatus
,
Long
>>
data
)
{
return
formatData
(
data
,
null
);
}
@Override
public
String
formatData
(
Map
<
String
,
Map
<
ErrStatus
,
Long
>>
data
,
Map
<
String
,
String
>
names
)
{
StringBuilder
builder
=
new
StringBuilder
();
StringBuilder
builder
=
new
StringBuilder
();
builder
.
append
(
"接口报错:\n"
);
builder
.
append
(
"接口报错:\n"
);
for
(
Map
.
Entry
<
String
,
Map
<
ErrStatus
,
Long
>>
entry:
data
.
entrySet
()){
for
(
Map
.
Entry
<
String
,
Map
<
ErrStatus
,
Long
>>
entry
:
data
.
entrySet
())
{
builder
.
append
(
entry
.
getKey
()+
" :\n"
);
builder
.
append
(
entry
.
getKey
());
if
(
Objects
.
nonNull
(
names
)
&&
names
.
containsKey
(
entry
.
getKey
()))
{
builder
.
append
(
" | "
+
names
.
get
(
entry
.
getKey
()));
}
builder
.
append
(
":\n"
);
Map
<
ErrStatus
,
Long
>
value
=
entry
.
getValue
();
Map
<
ErrStatus
,
Long
>
value
=
entry
.
getValue
();
for
(
Map
.
Entry
<
ErrStatus
,
Long
>
i:
value
.
entrySet
())
{
for
(
Map
.
Entry
<
ErrStatus
,
Long
>
i
:
value
.
entrySet
())
{
builder
.
append
(
"
\t"
+
i
.
getKey
().
getDes
()+
":"
+
i
.
getValue
()+
"次。\n"
);
builder
.
append
(
"
"
+
i
.
getKey
().
getDes
()
+
":"
+
i
.
getValue
()
+
"次。\n"
);
}
}
builder
.
append
(
"\n"
);
}
}
Date
d
=
new
Date
();
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
builder
.
append
(
"\n\n 当前时间: "
+
sdf
.
format
(
d
));
return
builder
.
toString
();
return
builder
.
toString
();
}
}
}
}
src/main/java/com/vandyo/sentry/core/collectionMachine/EmailDealer.java
View file @
fdb908e8
package
com
.
vandyo
.
sentry
.
core
.
collectionMachine
;
package
com
.
vandyo
.
sentry
.
core
.
collectionMachine
;
import
com.vandyo.sentry.core.config.MapConfig
;
import
com.vandyo.sentry.core.dto.ErrStatus
;
import
com.vandyo.sentry.core.dto.ErrStatus
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.mail.SimpleMailMessage
;
import
org.springframework.mail.SimpleMailMessage
;
...
@@ -13,14 +14,16 @@ public class EmailDealer extends DataClearDealer {
...
@@ -13,14 +14,16 @@ public class EmailDealer extends DataClearDealer {
@Autowired
@Autowired
private
JavaMailSender
javaMailSender
;
private
JavaMailSender
javaMailSender
;
@Autowired
private
MapConfig
mapConfig
;
@Override
@Override
public
void
deal
(
Map
<
String
,
Map
<
ErrStatus
,
Long
>>
data
)
{
public
void
deal
(
Map
<
String
,
Map
<
ErrStatus
,
Long
>>
data
)
{
String
content
=
formatData
(
data
);
String
content
=
formatData
(
data
,
mapConfig
.
getDesMap
()
);
SimpleMailMessage
message
=
new
SimpleMailMessage
();
SimpleMailMessage
message
=
new
SimpleMailMessage
();
message
.
setFrom
(
"zhouzihao@vandyo.com"
);
message
.
setFrom
(
"zhouzihao@vandyo.com"
);
message
.
setTo
(
"1042181618@qq.com"
);
message
.
setTo
(
"1042181618@qq.com"
);
message
.
setSubject
(
"
服务报错
"
);
message
.
setSubject
(
"
[服务报错]
"
);
message
.
setText
(
content
);
message
.
setText
(
content
);
javaMailSender
.
send
(
message
);
javaMailSender
.
send
(
message
);
}
}
...
...
src/main/resources/application.yaml
View file @
fdb908e8
...
@@ -7,18 +7,24 @@ vandyo:
...
@@ -7,18 +7,24 @@ vandyo:
checkmeta
:
checkmeta
:
desMap
:
desMap
:
"
[/car/my_car/info]"
:
车辆信息
"
[/car/my_car/info]"
:
车辆信息
"
[/car/car_detect]"
:
车体检
"
[/car/my_car/list]"
:
车列表
"
[/carDynamic/api/status/car/state/get]"
:
车动态
test
:
测试接口
test
:
测试接口
timeMap
:
timeMap
:
"
[/car/my_car/info]"
:
6
"
[/car/my_car/info]"
:
6
"
[/car/car_detect]"
:
6
"
[/car/my_car/list]"
:
6
"
[/carDynamic/api/status/car/state/get]"
:
6
test
:
2
test
:
2
spring
:
spring
:
mail
:
mail
:
host
:
ima
p.exmail.qq.com
host
:
smt
p.exmail.qq.com
default-encoding
:
UTF-8
default-encoding
:
UTF-8
username
:
zhouzihao
username
:
zhouzihao
@vandyo.com
password
:
zzhcool123
password
:
ceFMW5jhPn2eZpHn
port
:
993
port
:
465
properties
:
properties
:
mail
:
mail
:
smtp
:
smtp
:
...
...
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