refactor: 测试计划执行完成通知支持通过率

--story=1005563 --user=刘瑞斌 【Bug转需求】测试计划列表增加的“通过率”和“运行时间”,消息通知模板参数参数变量没有“通过率”和“运行时间”参数 https://www.tapd.cn/55049933/s/1103720
This commit is contained in:
CaptainB 2022-02-14 15:19:49 +08:00 committed by 刘瑞斌
parent c3f359854e
commit ab6fca66be
4 changed files with 18 additions and 7 deletions

View File

@ -647,6 +647,9 @@ public class TestPlanReportService {
} else { } else {
subject = Translator.get("task_notification"); subject = Translator.get("task_notification");
} }
// 计算通过率
TestPlanDTOWithMetric testPlanDTOWithMetric = BeanUtils.copyBean(new TestPlanDTOWithMetric(), testPlan);
testPlanService.calcTestPlanRate(Collections.singletonList(testPlanDTOWithMetric));
String creator = testPlanReport.getCreator(); String creator = testPlanReport.getCreator();
UserDTO userDTO = userService.getUserDTO(creator); UserDTO userDTO = userService.getUserDTO(creator);
@ -658,7 +661,7 @@ public class TestPlanReportService {
if (userDTO != null) { if (userDTO != null) {
paramMap.put("operator", userDTO.getName()); paramMap.put("operator", userDTO.getName());
} }
paramMap.putAll(new BeanMap(testPlan)); paramMap.putAll(new BeanMap(testPlanDTOWithMetric));
String successfulMailTemplate = "TestPlanSuccessfulNotification"; String successfulMailTemplate = "TestPlanSuccessfulNotification";
String errfoMailTemplate = "TestPlanFailedNotification"; String errfoMailTemplate = "TestPlanFailedNotification";

View File

@ -372,7 +372,7 @@ public class TestPlanService {
testPlanTestCaseMapper.deleteByExample(testPlanTestCaseExample); testPlanTestCaseMapper.deleteByExample(testPlanTestCaseExample);
} }
private void calcTestPlanRate(List<TestPlanDTOWithMetric> testPlans) { public void calcTestPlanRate(List<TestPlanDTOWithMetric> testPlans) {
testPlans.forEach(testPlan -> { testPlans.forEach(testPlan -> {
testPlan.setTested(0); testPlan.setTested(0);
testPlan.setPassed(0); testPlan.setPassed(0);

View File

@ -260,6 +260,10 @@ export default {
label: this.$t('test_track.automatic_status_update'), label: this.$t('test_track.automatic_status_update'),
value: 'automaticStatusUpdate', value: 'automaticStatusUpdate',
}, },
{
label: this.$t('test_track.pass_rate'),
value: 'passRate',
},
{ {
label: this.$t('report.plan_share_url'), label: this.$t('report.plan_share_url'),
value: 'planShareUrl', value: 'planShareUrl',

View File

@ -251,15 +251,19 @@ export default {
}, },
{ {
label:this.$t('project.id'), label:this.$t('project.id'),
value:'projectId', value: 'projectId',
}, },
{ {
label:this.$t('commons.execution_times'), label: this.$t('commons.execution_times'),
value:'executionTimes', value: 'executionTimes',
}, },
{ {
label:this.$t('test_track.automatic_status_update'), label: this.$t('test_track.automatic_status_update'),
value:'automaticStatusUpdate', value: 'automaticStatusUpdate',
},
{
label: this.$t('test_track.pass_rate'),
value: 'passRate',
}, },
], ],
}; };