This commit is contained in:
chenjianxing 2020-11-03 21:19:12 +08:00
commit aea60b4827
4 changed files with 21 additions and 14 deletions

View File

@ -1,9 +1,7 @@
package io.metersphere.notice.service;
import io.metersphere.base.domain.ApiTestReport;
import io.metersphere.base.domain.LoadTestReportWithBLOBs;
import io.metersphere.base.domain.SystemParameter;
import io.metersphere.base.domain.TestCaseWithBLOBs;
import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.UserMapper;
import io.metersphere.commons.constants.APITestStatus;
import io.metersphere.commons.constants.NoticeConstants;
import io.metersphere.commons.constants.ParamConstants;
@ -46,6 +44,8 @@ public class MailService {
private UserService userService;
@Resource
private SystemParameterService systemParameterService;
@Resource
private UserMapper userMapper;
//接口和性能测试
public void sendLoadNotification(MessageDetail messageDetail, LoadTestReportWithBLOBs loadTestReport, String eventType) {
@ -297,7 +297,8 @@ public class MailService {
Map<String, String> context = new HashMap<>();
BaseSystemConfigDTO baseSystemConfigDTO = systemParameterService.getBaseInfo();
context.put("url", baseSystemConfigDTO.getUrl());
context.put("creator", reviewRequest.getCreator());
User user = userMapper.selectByPrimaryKey(reviewRequest.getCreator());
context.put("creator", user.getName());
context.put("reviewName", reviewRequest.getName());
context.put("start", start);
context.put("end", end);
@ -328,6 +329,8 @@ public class MailService {
context.put("start", start);
context.put("end", end);
context.put("id", testPlan.getId());
User user = userMapper.selectByPrimaryKey(testPlan.getCreator());
context.put("creator", user.getName());
return context;
}

View File

@ -229,7 +229,6 @@ public class PerformanceTestService {
startEngine(loadTest, engine, request.getTriggerMode());
LoadTestReportWithBLOBs loadTestReport = loadTestReportMapper.selectByPrimaryKey(engine.getReportId());
loadTestReport.setTriggerMode("API");
if (StringUtils.equals(NoticeConstants.API, loadTestReport.getTriggerMode()) || StringUtils.equals(NoticeConstants.SCHEDULE, loadTestReport.getTriggerMode())) {
performanceNoticeTask.registerNoticeTask(loadTestReport);
}

View File

@ -561,7 +561,9 @@ public class TestCaseReviewService {
}
/*编辑,新建,完成,删除通知内容*/
private static String getReviewContext(SaveTestCaseReviewRequest reviewRequest, String type) {
private String getReviewContext(SaveTestCaseReviewRequest reviewRequest, String type) {
User user = userMapper.selectByPrimaryKey(reviewRequest.getCreator());
Long startTime = reviewRequest.getCreateTime();
Long endTime = reviewRequest.getEndTime();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@ -577,11 +579,11 @@ public class TestCaseReviewService {
}
String context = "";
if (StringUtils.equals(NoticeConstants.CREATE, type)) {
context = "测试评审任务通知:" + reviewRequest.getCreator() + "发起的" + "'" + reviewRequest.getName() + "'" + "待开始,计划开始时间是" + start + "计划结束时间为" + end + "请跟进";
context = "测试评审任务通知:" + user.getName() + "发起的" + "'" + reviewRequest.getName() + "'" + "待开始,计划开始时间是" + start + "计划结束时间为" + end + "请跟进";
} else if (StringUtils.equals(NoticeConstants.UPDATE, type)) {
context = "测试评审任务通知:" + reviewRequest.getCreator() + "发起的" + "'" + reviewRequest.getName() + "'" + "已完成,计划开始时间是" + start + "计划结束时间为" + end + "已完成";
context = "测试评审任务通知:" + user.getName() + "发起的" + "'" + reviewRequest.getName() + "'" + "已完成,计划开始时间是" + start + "计划结束时间为" + end + "已完成";
} else if (StringUtils.equals(NoticeConstants.DELETE, type)) {
context = "测试评审任务通知:" + reviewRequest.getCreator() + "发起的" + "'" + reviewRequest.getName() + "'" + "计划开始时间是" + start + "计划结束时间为" + end + "已删除";
context = "测试评审任务通知:" + user.getName() + "发起的" + "'" + reviewRequest.getName() + "'" + "计划开始时间是" + start + "计划结束时间为" + end + "已删除";
}
return context;

View File

@ -93,6 +93,8 @@ public class TestPlanService {
DingTaskService dingTaskService;
@Resource
WxChatTaskService wxChatTaskService;
@Resource
UserMapper userMapper;
public void addTestPlan(AddTestPlanRequest testPlan) {
if (getTestPlanByName(testPlan.getName()).size() > 0) {
@ -534,7 +536,8 @@ public class TestPlanService {
return projectName;
}
private static String getTestPlanContext(AddTestPlanRequest testPlan, String type) {
private String getTestPlanContext(AddTestPlanRequest testPlan, String type) {
User user = userMapper.selectByPrimaryKey(testPlan.getCreator());
Long startTime = testPlan.getPlannedStartTime();
Long endTime = testPlan.getPlannedEndTime();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@ -554,11 +557,11 @@ public class TestPlanService {
}
String context = "";
if (StringUtils.equals(NoticeConstants.CREATE, type)) {
context = "测试计划任务通知:" + testPlan.getCreator() + "创建的" + "'" + testPlan.getName() + "'" + "待开始,计划开始时间是" + start + "计划结束时间为" + end + "请跟进";
context = "测试计划任务通知:" + user.getName() + "创建的" + "'" + testPlan.getName() + "'" + "待开始,计划开始时间是" + start + "计划结束时间为" + end + "请跟进";
} else if (StringUtils.equals(NoticeConstants.UPDATE, type)) {
context = "测试计划任务通知:" + testPlan.getCreator() + "创建的" + "'" + testPlan.getName() + "'" + "已完成,计划开始时间是" + start + "计划结束时间为" + end + "已完成";
context = "测试计划任务通知:" + user.getName() + "创建的" + "'" + testPlan.getName() + "'" + "已完成,计划开始时间是" + start + "计划结束时间为" + end + "已完成";
} else if (StringUtils.equals(NoticeConstants.DELETE, type)) {
context = "测试计划任务通知:" + testPlan.getCreator() + "创建的" + "'" + testPlan.getName() + "'" + "计划开始时间是" + start + "计划结束时间为" + end + "已删除";
context = "测试计划任务通知:" + user.getName() + "创建的" + "'" + testPlan.getName() + "'" + "计划开始时间是" + start + "计划结束时间为" + end + "已删除";
}
return context;
}