fix: --bug=1007423 --user=刘瑞斌 【消息设置】-测试计划-执行完成-创建人未收到通知 https://www.tapd.cn/55049933/s/1058838

This commit is contained in:
CaptainB 2021-10-26 10:54:04 +08:00 committed by 刘瑞斌
parent 995c01f319
commit d7119d7bc1
1 changed files with 16 additions and 8 deletions

View File

@ -23,6 +23,7 @@ import io.metersphere.i18n.Translator;
import io.metersphere.log.vo.OperatingLogDetails;
import io.metersphere.notice.sender.NoticeModel;
import io.metersphere.notice.service.NoticeSendService;
import io.metersphere.service.ProjectService;
import io.metersphere.service.SystemParameterService;
import io.metersphere.service.UserService;
import io.metersphere.track.Factory.ReportComponentFactory;
@ -92,6 +93,8 @@ public class TestPlanReportService {
private TestPlanPrincipalMapper testPlanPrincipalMapper;
@Resource
private UserService userService;
@Resource
private ProjectService projectService;
private final ExecutorService executorService = Executors.newFixedThreadPool(20);
@ -858,15 +861,12 @@ public class TestPlanReportService {
if (userDTO != null) {
paramMap.put("operator", userDTO.getName());
}
paramMap.putAll(new BeanMap(testPlanReport));
paramMap.putAll(new BeanMap(testPlan));
String successfulMailTemplate = "";
String errfoMailTemplate = "";
if (StringUtils.equalsAny(testPlanReport.getTriggerMode(), ReportTriggerMode.SCHEDULE.name(), ReportTriggerMode.API.name())) {
successfulMailTemplate = "TestPlanSuccessfulNotification";
errfoMailTemplate = "TestPlanFailedNotification";
}
String successfulMailTemplate = "TestPlanSuccessfulNotification";
String errfoMailTemplate = "TestPlanFailedNotification";
String testPlanShareUrl = shareInfoService.getTestPlanShareUrl(testPlanReport.getId());
paramMap.put("planShareUrl", baseSystemConfigDTO.getUrl() + "/sharePlanReport" + testPlanShareUrl);
@ -883,7 +883,15 @@ public class TestPlanReportService {
.subject(subject)
.paramMap(paramMap)
.build();
noticeSendService.send(testPlanReport.getTriggerMode(), NoticeConstants.TaskType.TEST_PLAN_TASK, noticeModel);
if (StringUtils.equals(testPlanReport.getTriggerMode(), ReportTriggerMode.MANUAL.name())) {
noticeModel.setEvent(NoticeConstants.Event.COMPLETE);
noticeSendService.send(projectService.getProjectById(projectId), NoticeConstants.TaskType.TEST_PLAN_TASK, noticeModel);
}
if (StringUtils.equalsAny(testPlanReport.getTriggerMode(), ReportTriggerMode.SCHEDULE.name(), ReportTriggerMode.API.name())) {
noticeSendService.send(testPlanReport.getTriggerMode(), NoticeConstants.TaskType.TEST_PLAN_TASK, noticeModel);
}
}
public TestPlanReport getTestPlanReport(String planId) {