refactor(消息通知): 发送站内信时保留参数到数据库

This commit is contained in:
CaptainB 2021-11-26 14:15:05 +08:00 committed by 刘瑞斌
parent 075b9c7051
commit 883554b670
2 changed files with 34 additions and 11 deletions

View File

@ -1,5 +1,6 @@
package io.metersphere.notice.sender.impl;
import com.alibaba.fastjson.JSON;
import io.metersphere.base.domain.Notification;
import io.metersphere.commons.constants.NotificationConstants;
import io.metersphere.commons.utils.LogUtil;
@ -38,7 +39,7 @@ public class InSiteNoticeSender extends AbstractNoticeSender {
Map<String, Object> paramMap = noticeModel.getParamMap();
Notification notification = new Notification();
notification.setTitle(noticeModel.getSubject());
notification.setContent(context);
notification.setContent(JSON.toJSONString(paramMap));
notification.setOperator(noticeModel.getOperator());
notification.setOperation(noticeModel.getEvent());
notification.setResourceId((String) paramMap.get("id"));

View File

@ -125,17 +125,39 @@ export function getUrl(d) {
switch (d.resourceType) {
case "JENKINS_TASK" :
// jenkins 跳转需要特殊处理
if (d.content.indexOf("接口用例") > -1) {
url += "/api/definition?caseId=" + d.resourceId;
} else if (d.content.indexOf("性能测试") > -1) {
url += "/performance/test/edit/" + d.resourceId;
} else if (d.content.indexOf("接口测试") > -1) {
url += "/api/automation/report/view/" + d.resourceId;
} else if (d.content.indexOf("测试计划") > -1) {
url += "/track/plan/view/" + d.resourceId;
} else {
url += "/track/plan/all";
try {
let obj = JSON.parse(d.content);
// 接口自动化,性能测试
if (obj.reportUrl) {
let s = obj.reportUrl.indexOf('#');
url += obj.reportUrl.substring(s + 1);
}
// 接口用例
else if (obj.caseStatus) {
url += "/api/definition?caseId=" + d.resourceId;
}
// 测试计划
else if (obj.url) {
let s = obj.url.indexOf('#');
url += obj.url.substring(s + 1);
} else {
url += "/track/plan/all";
}
} catch (e) {
// jenkins 跳转需要特殊处理
if (d.content.indexOf("接口用例") > -1) {
url += "/api/definition?caseId=" + d.resourceId;
} else if (d.content.indexOf("性能测试") > -1) {
url += "/performance/test/edit/" + d.resourceId;
} else if (d.content.indexOf("接口测试") > -1) {
url += "/api/automation/report/view/" + d.resourceId;
} else if (d.content.indexOf("测试计划运行") > -1) {
url += "/track/plan/view/" + d.resourceId;
} else {
url += "/track/plan/all";
}
}
break;
case "TEST_PLAN_TASK" :
url += "/track/plan/view/" + d.resourceId;