fix: 修复邮件提示测试报告不存在

This commit is contained in:
wenyann 2021-03-21 23:02:51 +08:00
parent 1d0ea00553
commit f0ad527813
3 changed files with 18 additions and 17 deletions

View File

@ -247,26 +247,22 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl
NoticeSendService noticeSendService = CommonBeanFactory.getBean(NoticeSendService.class);
assert systemParameterService != null;
assert noticeSendService != null;
BaseSystemConfigDTO baseSystemConfigDTO = systemParameterService.getBaseInfo();
String url = reportUrl;
String url2 = reportUrl;
if (StringUtils.isEmpty(url)) {
url = baseSystemConfigDTO.getUrl() + "/#/api/report/view/" + report.getId();
url2 = baseSystemConfigDTO.getUrl() + "/#/api/automation/report/view/" + report.getId();
}
String url = baseSystemConfigDTO.getUrl() + "/#/api/report/view/" + report.getId();
String url2 = baseSystemConfigDTO.getUrl() + "/#/api/automation/report/view/" + report.getId();
String successContext = "";
String failedContext = "";
String subject = "";
String event = "";
if (StringUtils.equals(ReportTriggerMode.API.name(), report.getTriggerMode())) {
successContext = "接口测试 API任务通知:'" + report.getName() + "'执行成功" + "\n" + "请点击下面链接进入测试报告页面" + "\n" + "旧版接口测试路径" + url + "\n" + "新版接口测试路径" + url2;
failedContext = "接口测试 API任务通知:'" + report.getName() + "'执行失败" + "\n" + "请点击下面链接进入测试报告页面" + "\n" + "旧版接口测试路径" + url + "\n" + "新版接口测试路径" + url2;
successContext = "接口测试 API任务通知:'" + report.getName() + "'执行成功" + "\n" + "【接口定义暂无报告链接】" + "\n" + "请点击下面链接进入测试报告页面" + "\n" + "(旧版)接口测)路径" + url + "\n" + "新版接口测试路径" + url2;
failedContext = "接口测试 API任务通知:'" + report.getName() + "'执行失败" + "\n" + "【接口定义暂无报告链接】" + "\n" + "请点击下面链接进入测试报告页面" + "\n" + "旧版接口测试路径" + url + "\n" + "新版接口测试路径" + url2;
subject = Translator.get("task_notification_jenkins");
}
if (StringUtils.equals(ReportTriggerMode.SCHEDULE.name(), report.getTriggerMode())) {
successContext = "接口测试定时任务通知:'" + report.getName() + "'执行成功" + "\n" + "请点击下面链接进入测试报告页面" + "\n" + "旧版接口测试路径" + url + "\n" + "新版接口测试路径" + url2;
failedContext = "接口测试定时任务通知:'" + report.getName() + "'执行失败" + "\n" + "请点击下面链接进入测试报告页面" + "\n" + "旧版接口测试路径" + url + "\n" + "新版接口测试路径" + url2;
successContext = "接口测试定时任务通知:'" + report.getName() + "'执行成功" + "\n" + "【接口定义暂无报告链接】" + "\n" + "请点击下面链接进入测试报告页面" + "\n" + "旧版接口测试路径" + url + "\n" + "新版接口测试路径" + url2;
failedContext = "接口测试定时任务通知:'" + report.getName() + "'执行失败" + "\n" + "【接口定义暂无报告链接】" + "\n" + "请点击下面链接进入测试报告页面" + "\n" + "旧版接口测试路径" + url + "\n" + "新版接口测试路径" + url2;
subject = Translator.get("task_notification");
}
if (StringUtils.equals("Success", report.getStatus())) {

View File

@ -11,11 +11,15 @@
<p style="margin-left: 60px">您好:
</div>
<div style="margin-left: 100px">
successContext = "接口测试定时任务通知:'" + report.getName() + "'执行成功" + "\n" + "【接口定义暂无报告链接】"+"\n" +"请点击下面链接进入测试报告页面" +
"\n" + "(旧版)接口测试路径" + url + "\n" + "(新版)接口测试路径" + url2;
<p>您所执行的 ${testName} 接口测试运行失败<br/>
请点击下面链接进入测试报告页面</p>
请点击下面链接进入测试报告页面【接口定义暂无报告路径】<br/>
【旧版接口测试报告路径】</p>
<a href="${url}/#/${type}/report/view/${id}">${url}/#/${type}/report/view/${id}</a>
<p>新版接口测试报告路径</p>
<a href="${url}/#/api/automation">${url}/#/api/automation</a>
<p>新版接口测试报告路径</p>
<a href="${url}/#/api/automation/report/view/${id}">${url}/#/api/automation/report/view/${id}</a>
</div>
</div>

View File

@ -11,10 +11,11 @@
</div>
<div style="margin-left: 100px">
<p>您所执行的 ${testName} 接口测试运行成功<br/>
请点击下面链接进入测试报告页面</p>
请点击下面链接进入测试报告页面【接口定义暂无报告路径】<br/>
【旧版接口测试报告路径】</p>
<a href="${url}/#/${type}/report/view/${id}">${url}/#/${type}/report/view/${id}</a>
<p>新版接口测试报告路径</p>
<a href="${url}/#/api/automation">${url}/#/api/automation</a>
<p>新版接口测试报告路径</p>
<a href="${url}/#/api/automation/report/view/${id}">${url}/#/api/automation/report/view/${id}</a>
</div>
</body>
</html>