Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
holmes
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
QA
holmes
Commits
b1dd51ac
Commit
b1dd51ac
authored
Feb 11, 2022
by
黎博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
4645568d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
10 deletions
+24
-10
WebhookServiceImpl.java
...cn/qg/holmes/service/quality/impl/WebhookServiceImpl.java
+14
-5
DingdingUtils.java
src/main/java/cn/qg/holmes/utils/DingdingUtils.java
+10
-5
No files found.
src/main/java/cn/qg/holmes/service/quality/impl/WebhookServiceImpl.java
View file @
b1dd51ac
...
...
@@ -26,17 +26,25 @@ public class WebhookServiceImpl implements WebhookService {
String
key
=
JsonPath
.
read
(
jiraData
,
"$.issue.key"
);
String
summary
=
JsonPath
.
read
(
jiraData
,
"$.issue.fields.summary"
);
String
priority
=
JsonPath
.
read
(
jiraData
,
"$.issue.fields.priority.name"
);
String
module
=
JsonPath
.
read
(
jiraData
,
"$.issue.fields.components[0].name
"
);
String
description
=
JsonPath
.
read
(
jiraData
,
"$.issue.fields.description
"
);
List
<
String
>
attachmentList
=
JsonPath
.
read
(
jiraData
,
"$.issue.fields.attachment[*].content"
);
// BUG创建的时候发送通知
if
(
StringUtils
.
equals
(
webhookEvent
,
"jira:issue_created"
))
{
String
title
=
"线上研发工单提交"
;
String
content
=
creator
+
"提交了线上研发工单:"
+
key
+
"\n\n"
;
String
content
=
"📣"
+
creator
+
"提交了线上研发工单:"
+
key
+
"\n\n"
;
content
+=
"概要:["
+
summary
+
"]("
+
"http://jira2.quantgroup.cn/browse/"
+
key
+
")"
+
"\n\n"
+
"- 优先级:"
+
priority
+
"\n"
+
"- 经办人:"
+
assignee
+
"\n\n"
;
for
(
String
attachment:
attachmentList
)
{
content
+=
"\n"
;
if
(
description
!=
null
)
{
String
[]
descList
=
description
.
split
(
"\n"
);
for
(
String
desc:
descList
)
{
content
+=
"> "
+
desc
+
"\n\n"
;
}
}
if
(
attachmentList
.
size
()
>
0
)
{
for
(
String
attachment:
attachmentList
)
{
content
+=
"> \n"
;
}
}
DingdingUtils
.
sendToDingding
(
DingdingUtils
.
buildMarkdownMsg
(
title
,
content
,
true
),
webhook
);
}
...
...
@@ -60,7 +68,8 @@ public class WebhookServiceImpl implements WebhookService {
content
+=
"📣研发工单 "
+
key
+
" 状态更新:"
+
"\n\n"
;
content
+=
"概要:["
+
summary
+
"]("
+
issueUrl
+
")"
+
"\n\n"
;
content
+=
"状态变更为:【已解决】\n\n"
;
content
+=
"请相关客服同学跟进验收一下~"
;
// content += "状态变更为:【已解决】, 解决结果为:【" + JsonPath.read(jiraData, "$.changelog.items[0].toString") + "】\n\n";
content
+=
"请相关客服同学跟进验收~"
;
DingdingUtils
.
sendToDingding
(
DingdingUtils
.
buildMarkdownMsg
(
title
,
content
,
false
),
webhook
);
break
;
case
"issue_reopened"
:
...
...
src/main/java/cn/qg/holmes/utils/DingdingUtils.java
View file @
b1dd51ac
...
...
@@ -338,16 +338,21 @@ public class DingdingUtils {
String
issueUrl
=
"http://jira2.quantgroup.cn/browse/CSXT-178"
;
String
content
=
"黎博提交了BUG:CSXT-178 \n\n"
;
List
<
String
>
attachmentList
=
new
ArrayList
<>();
String
description
=
"姓名:张犇\n"
+
"手机号:15610309807\n"
+
"详情:客户表示申请借款无法操作,提示存在在途业务,无法申请借款,请处理,谢谢"
;
// attachmentList.add("http://jira2.quantgroup.cn/secure/attachment/17004/%E5%BD%A9%E8%89%B2Q_%E7%94%BB%E6%9D%BF+1.jpg");
attachmentList
.
add
(
"http://jira2.quantgroup.cn/secure/attachment/17013/image.png"
);
//
attachmentList.add("http://jira2.quantgroup.cn/secure/attachment/17013/image.png");
attachmentList
.
add
(
"https://gw.alicdn.com/tfs/TB1ut3xxbsrBKNjSZFpXXcXhFXa-846-786.png"
);
content
+=
"概要:["
+
"【定时推送】啦啦啦"
+
"]("
+
issueUrl
+
")"
+
"\n\n"
+
"- 优先级:"
+
"P3一般"
+
"\n"
+
"- 模块:"
+
"kdsp"
+
"\n"
+
"- 经办人:"
+
"王晓彤"
+
"\n"
;
// content += "> 附件:\n";
+
"- 经办人:"
+
"王晓彤"
+
"\n\n"
;
String
[]
descList
=
description
.
split
(
"\n"
);
for
(
String
desc:
descList
)
{
content
+=
"> "
+
desc
+
"\n\n"
;
}
for
(
String
attachment:
attachmentList
)
{
content
+=
"\n"
;
content
+=
"
>
\n"
;
}
String
msg
=
buildMarkdownMsg
(
title
,
content
,
false
);
sendToDingding
(
msg
,
"https://oapi.dingtalk.com/robot/send?access_token=835663338d638e40daaf3ab358af741ef0680a826a962c91bedc53b149d85ee1"
);
...
...
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