fix: 修复测试计划发送通知相关
This commit is contained in:
parent
8320b0beb3
commit
5dfe6085f0
|
@ -98,7 +98,7 @@ public class TestPlanController {
|
|||
@PostMapping("/edit")
|
||||
@RequiresPermissions(PermissionConstants.PROJECT_TRACK_PLAN_READ_EDIT)
|
||||
@MsAuditLog(module = "track_test_plan", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#testPlanDTO.id)", content = "#msClass.getLogDetails(#testPlanDTO.id)", msClass = TestPlanService.class)
|
||||
@SendNotice(taskType = NoticeConstants.TaskType.TEST_PLAN_TASK, event = NoticeConstants.Event.UPDATE, mailTemplate = "track/TestPlanEnd", subject = "测试计划通知")
|
||||
@SendNotice(taskType = NoticeConstants.TaskType.TEST_PLAN_TASK, event = NoticeConstants.Event.UPDATE, mailTemplate = "track/TestPlanUpdate", subject = "测试计划通知")
|
||||
public TestPlan editTestPlan(@RequestBody AddTestPlanRequest testPlanDTO) {
|
||||
return testPlanService.editTestPlanWithRequest(testPlanDTO);
|
||||
}
|
||||
|
|
|
@ -840,6 +840,7 @@ public class TestPlanReportService {
|
|||
String event = "";
|
||||
String successContext = "${operator}执行的 ${name} 测试计划运行成功, 报告: ${planShareUrl}";
|
||||
String failedContext = "${operator}执行的 ${name} 测试计划运行失败, 报告: ${planShareUrl}";
|
||||
String context = "${operator}完成了测试计划: ${name}";
|
||||
if (StringUtils.equals(testPlanReport.getTriggerMode(), ReportTriggerMode.API.name())) {
|
||||
subject = Translator.get("task_notification_jenkins");
|
||||
} else {
|
||||
|
@ -874,10 +875,12 @@ public class TestPlanReportService {
|
|||
|
||||
NoticeModel noticeModel = NoticeModel.builder()
|
||||
.operator(creator)
|
||||
.context(context)
|
||||
.successContext(successContext)
|
||||
.successMailTemplate(successfulMailTemplate)
|
||||
.failedContext(failedContext)
|
||||
.failedMailTemplate(errfoMailTemplate)
|
||||
.mailTemplate("track/TestPlanComplete")
|
||||
.testId(testPlan.getId())
|
||||
.status(testPlanReport.getStatus())
|
||||
.event(event)
|
||||
|
|
|
@ -729,7 +729,7 @@ public class TestPlanService {
|
|||
private void sendCompletedNotice(TestPlan testPlan) {
|
||||
if (StringUtils.equals(TestPlanStatus.Completed.name(), testPlan.getStatus())) {
|
||||
try {
|
||||
String context = getTestPlanContext(testPlan, NoticeConstants.Event.UPDATE);
|
||||
String context = getTestPlanContext(testPlan, NoticeConstants.Event.COMPLETE);
|
||||
Map paramMap = getTestPlanParamMap(testPlan);
|
||||
SessionUser user = SessionUtils.getUser();
|
||||
if (user != null) {
|
||||
|
@ -739,7 +739,7 @@ public class TestPlanService {
|
|||
.operator(SessionUtils.getUserId())
|
||||
.context(context)
|
||||
.subject(Translator.get("test_plan_notification"))
|
||||
.mailTemplate("track/TestPlanEnd")
|
||||
.mailTemplate("track/TestPlanComplete")
|
||||
.paramMap(paramMap)
|
||||
.event(NoticeConstants.Event.COMPLETE)
|
||||
.build();
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>MeterSphere</title>
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<p style="text-align: left">${operator}完成了测试计划: ${name}<br>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -6,12 +6,7 @@
|
|||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<p style="text-align: left">${operator}创建的:<br>
|
||||
${name}<br>
|
||||
计划开始时间是:${start}<br>
|
||||
计划结束时间为:${end}<br>
|
||||
已删除!
|
||||
</p>
|
||||
<p style="text-align: left">${operator}删除了测试计划: ${name} </p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -7,8 +7,6 @@
|
|||
<body>
|
||||
<div>
|
||||
<p style="text-align: left">${operator}创建了测试计划${name}<br>
|
||||
点击下面链接进入测试计划页面</p>
|
||||
<a href="${url}/#/track/plan/all">${url}/#/track/plan/all</a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -7,8 +7,6 @@
|
|||
<body>
|
||||
<div>
|
||||
<p style="text-align: left">${operator}更新了测试计划: ${name}<br>
|
||||
点击下面链接进入测试计划页面</p>
|
||||
<a href="${url}/#/track/plan/view/${id}">${url}/#/track/plan/view</a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue