Commit b1dd51ac authored by 黎博's avatar 黎博

update

parent 4645568d
...@@ -26,17 +26,25 @@ public class WebhookServiceImpl implements WebhookService { ...@@ -26,17 +26,25 @@ public class WebhookServiceImpl implements WebhookService {
String key = JsonPath.read(jiraData, "$.issue.key"); String key = JsonPath.read(jiraData, "$.issue.key");
String summary = JsonPath.read(jiraData, "$.issue.fields.summary"); String summary = JsonPath.read(jiraData, "$.issue.fields.summary");
String priority = JsonPath.read(jiraData, "$.issue.fields.priority.name"); 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"); List<String> attachmentList = JsonPath.read(jiraData, "$.issue.fields.attachment[*].content");
// BUG创建的时候发送通知 // BUG创建的时候发送通知
if (StringUtils.equals(webhookEvent, "jira:issue_created")) { if (StringUtils.equals(webhookEvent, "jira:issue_created")) {
String title = "线上研发工单提交"; String title = "线上研发工单提交";
String content = creator + "提交了线上研发工单:" + key + "\n\n"; String content = "📣" + creator + "提交了线上研发工单:" + key + "\n\n";
content += "概要:[" + summary + "](" + "http://jira2.quantgroup.cn/browse/" + key + ")" + "\n\n" content += "概要:[" + summary + "](" + "http://jira2.quantgroup.cn/browse/" + key + ")" + "\n\n"
+ "- 优先级:" + priority + "\n" + "- 优先级:" + priority + "\n"
+ "- 经办人:" + assignee + "\n\n"; + "- 经办人:" + assignee + "\n\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) { for (String attachment: attachmentList) {
content += "![](" + attachment + ")\n" ; content += "> ![](" + attachment + ")\n" ;
}
} }
DingdingUtils.sendToDingding(DingdingUtils.buildMarkdownMsg(title, content, true), webhook); DingdingUtils.sendToDingding(DingdingUtils.buildMarkdownMsg(title, content, true), webhook);
} }
...@@ -60,7 +68,8 @@ public class WebhookServiceImpl implements WebhookService { ...@@ -60,7 +68,8 @@ public class WebhookServiceImpl implements WebhookService {
content += "📣研发工单 " + key + " 状态更新:" + "\n\n"; content += "📣研发工单 " + key + " 状态更新:" + "\n\n";
content += "概要:[" + summary + "](" + issueUrl + ")"+ "\n\n"; content += "概要:[" + summary + "](" + issueUrl + ")"+ "\n\n";
content += "状态变更为:【已解决】\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); DingdingUtils.sendToDingding(DingdingUtils.buildMarkdownMsg(title, content, false), webhook);
break; break;
case "issue_reopened": case "issue_reopened":
......
...@@ -338,16 +338,21 @@ public class DingdingUtils { ...@@ -338,16 +338,21 @@ public class DingdingUtils {
String issueUrl = "http://jira2.quantgroup.cn/browse/CSXT-178"; String issueUrl = "http://jira2.quantgroup.cn/browse/CSXT-178";
String content = "黎博提交了BUG:CSXT-178 \n\n"; String content = "黎博提交了BUG:CSXT-178 \n\n";
List<String> attachmentList = new ArrayList<>(); 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/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"); attachmentList.add("https://gw.alicdn.com/tfs/TB1ut3xxbsrBKNjSZFpXXcXhFXa-846-786.png");
content += "概要:[" + "【定时推送】啦啦啦" + "](" + issueUrl + ")"+ "\n\n" content += "概要:[" + "【定时推送】啦啦啦" + "](" + issueUrl + ")"+ "\n\n"
+ "- 优先级:" + "P3一般" + "\n" + "- 优先级:" + "P3一般" + "\n"
+ "- 模块:" + "kdsp" + "\n" + "- 经办人:" + "王晓彤" + "\n\n";
+ "- 经办人:" + "王晓彤" + "\n"; String[] descList = description.split("\n");
// content += "> 附件:\n"; for (String desc: descList) {
content += "> " + desc + "\n\n";
}
for (String attachment: attachmentList) { for (String attachment: attachmentList) {
content += "![](" + attachment + ")\n"; content += "> ![](" + attachment + ")\n";
} }
String msg = buildMarkdownMsg(title, content, false); String msg = buildMarkdownMsg(title, content, false);
sendToDingding(msg, "https://oapi.dingtalk.com/robot/send?access_token=835663338d638e40daaf3ab358af741ef0680a826a962c91bedc53b149d85ee1"); sendToDingding(msg, "https://oapi.dingtalk.com/robot/send?access_token=835663338d638e40daaf3ab358af741ef0680a826a962c91bedc53b149d85ee1");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment