Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
baihang-report
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
data-spider
baihang-report
Commits
9a4d40fa
Commit
9a4d40fa
authored
Dec 07, 2021
by
陈宏杰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
告警
parent
d7569334
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
0 deletions
+25
-0
BaiHangFileReportService.java
...roup/report/service/baihang/BaiHangFileReportService.java
+5
-0
DingTalk.java
...in/java/cn/quantgroup/report/utils/dingtalk/DingTalk.java
+20
-0
No files found.
src/main/java/cn/quantgroup/report/service/baihang/BaiHangFileReportService.java
View file @
9a4d40fa
...
...
@@ -17,6 +17,7 @@ import cn.quantgroup.report.service.baihang.util.TuoMinUtils;
import
cn.quantgroup.report.service.http.IHttpService
;
import
cn.quantgroup.report.utils.DateUtils
;
import
cn.quantgroup.report.utils.SftpUtil
;
import
cn.quantgroup.report.utils.dingtalk.DingTalk
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.google.common.base.Stopwatch
;
...
...
@@ -97,6 +98,9 @@ public class BaiHangFileReportService {
@Value
(
"${baiHang.ftp.dataDirectory}"
)
private
String
baiHangFtpDataDirectory
;
@Autowired
private
DingTalk
dingTalk
;
...
...
@@ -182,6 +186,7 @@ public class BaiHangFileReportService {
throw
new
QGException
(
COMMON_ILLEGAL_PARAM_TOAST
,
"报送类型不正确"
);
}
log
.
info
(
"生成报送文件结束{}----- {} -- {},耗时 {}"
,
type
,
starTime
,
endTime
,
stopwatch
.
elapsed
(
TimeUnit
.
MILLISECONDS
));
dingTalk
.
alarmDingTalk
(
"Info"
,
"百行"
+
type
+
"征信数据报送"
,
"生成报送文件结束,开始时间:"
+
starTime
+
"结束时间:"
+
endTime
);
}
return
encryptFileName
;
}
...
...
src/main/java/cn/quantgroup/report/utils/dingtalk/DingTalk.java
View file @
9a4d40fa
...
...
@@ -4,6 +4,7 @@ package cn.quantgroup.report.utils.dingtalk;
import
cn.quantgroup.report.service.http.IHttpService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Component
;
...
...
@@ -32,6 +33,10 @@ public class DingTalk {
public
static
final
String
LEADER_WEB_HOOK
=
"https://oapi.dingtalk.com/robot/send?access_token=d851fef9aa00aa74dba08aa3f558f90b28f7ab6081afa0ba96cdf33c4d3414bd"
;
public
static
final
String
webHookPrefix
=
"https://oapi.dingtalk.com/robot/send?access_token=%s"
;
@Value
(
"${alarm.dingTalk.accessToken}"
)
private
String
alarmDingTalkAccessToken
;
@Async
public
void
talk
(
String
alarmLevel
,
String
msgTitle
,
String
msgContent
)
{
...
...
@@ -121,4 +126,19 @@ public class DingTalk {
.
append
(
":"
)
.
append
(
e
.
message
==
null
?
""
:
(
e
.
message
.
length
()
>
500
?
e
.
message
.
substring
(
0
,
499
)
:
e
.
message
)).
toString
();
}
@Async
public
void
alarmDingTalk
(
String
alarmLevel
,
String
msgTitle
,
String
msgContent
)
{
try
{
Map
<
String
,
String
>
param
=
new
HashMap
<>();
param
.
put
(
"webhook"
,
String
.
format
(
webHookPrefix
,
alarmDingTalkAccessToken
));
param
.
put
(
"alarmLevel"
,
alarmLevel
);
param
.
put
(
"msgTitle"
,
msgTitle
);
param
.
put
(
"msgContent"
,
msgContent
);
String
resp
=
iHttpService
.
post
(
talkUri
,
param
);
log
.
info
(
"钉钉报警接口调用结束, resp: {} "
,
resp
);
}
catch
(
Exception
e
){
log
.
warn
(
"钉钉报警接口调用异常! "
,
e
);
}
}
}
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