fix: --bug=1007055 --user=刘瑞斌 测试计划完成后,浏览执行的测试计划,通知会不断提醒测试任务完成 https://www.tapd.cn/55049933/s/1061683
This commit is contained in:
parent
b438d6d52c
commit
78a1e74b89
|
@ -258,6 +258,7 @@ public class TestPlanService {
|
||||||
List<String> follows = request.getFollows();
|
List<String> follows = request.getFollows();
|
||||||
if (StringUtils.isNotBlank(request.getId())) {
|
if (StringUtils.isNotBlank(request.getId())) {
|
||||||
testPlanFollowService.deleteTestPlanFollowByPlanId(request.getId());
|
testPlanFollowService.deleteTestPlanFollowByPlanId(request.getId());
|
||||||
|
if (!CollectionUtils.isEmpty(follows)) {
|
||||||
for (String follow : follows) {
|
for (String follow : follows) {
|
||||||
TestPlanFollow testPlanFollow = new TestPlanFollow();
|
TestPlanFollow testPlanFollow = new TestPlanFollow();
|
||||||
testPlanFollow.setTestPlanId(request.getId());
|
testPlanFollow.setTestPlanId(request.getId());
|
||||||
|
@ -265,6 +266,7 @@ public class TestPlanService {
|
||||||
testPlanFollowService.insert(testPlanFollow);
|
testPlanFollowService.insert(testPlanFollow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return this.editTestPlan(request);
|
return this.editTestPlan(request);
|
||||||
}
|
}
|
||||||
|
@ -470,8 +472,6 @@ public class TestPlanService {
|
||||||
if (passNum == statusList.size()) { // 全部通过
|
if (passNum == statusList.size()) { // 全部通过
|
||||||
testPlanWithBLOBs.setStatus(TestPlanStatus.Completed.name());
|
testPlanWithBLOBs.setStatus(TestPlanStatus.Completed.name());
|
||||||
this.editTestPlan(testPlanWithBLOBs);
|
this.editTestPlan(testPlanWithBLOBs);
|
||||||
// 发送成功通知
|
|
||||||
// sendCompletedNotice(testPlanWithBLOBs);
|
|
||||||
} else if (prepareNum == 0 && passNum + failNum == statusList.size()) { // 已结束
|
} else if (prepareNum == 0 && passNum + failNum == statusList.size()) { // 已结束
|
||||||
testPlanWithBLOBs.setStatus(TestPlanStatus.Finished.name());
|
testPlanWithBLOBs.setStatus(TestPlanStatus.Finished.name());
|
||||||
editTestPlan(testPlanWithBLOBs);
|
editTestPlan(testPlanWithBLOBs);
|
||||||
|
@ -507,8 +507,6 @@ public class TestPlanService {
|
||||||
if (passNum == statusList.size()) { // 全部通过
|
if (passNum == statusList.size()) { // 全部通过
|
||||||
testPlanWithBLOBs.setStatus(TestPlanStatus.Completed.name());
|
testPlanWithBLOBs.setStatus(TestPlanStatus.Completed.name());
|
||||||
this.editTestPlan(testPlanWithBLOBs);
|
this.editTestPlan(testPlanWithBLOBs);
|
||||||
// 发送成功通知
|
|
||||||
// sendCompletedNotice(testPlanWithBLOBs);
|
|
||||||
} else if (prepareNum == 0 && passNum + failNum == statusList.size()) { // 已结束
|
} else if (prepareNum == 0 && passNum + failNum == statusList.size()) { // 已结束
|
||||||
testPlanWithBLOBs.setStatus(TestPlanStatus.Finished.name());
|
testPlanWithBLOBs.setStatus(TestPlanStatus.Finished.name());
|
||||||
editTestPlan(testPlanWithBLOBs);
|
editTestPlan(testPlanWithBLOBs);
|
||||||
|
@ -721,36 +719,8 @@ public class TestPlanService {
|
||||||
String status = calcTestPlanStatus(planId);
|
String status = calcTestPlanStatus(planId);
|
||||||
testPlan.setStatus(status);
|
testPlan.setStatus(status);
|
||||||
testPlanMapper.updateByPrimaryKeySelective(testPlan);
|
testPlanMapper.updateByPrimaryKeySelective(testPlan);
|
||||||
TestPlan testPlans = getTestPlan(planId);
|
|
||||||
|
|
||||||
sendCompletedNotice(testPlans);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendCompletedNotice(TestPlan testPlan) {
|
|
||||||
if (StringUtils.equals(TestPlanStatus.Completed.name(), testPlan.getStatus())) {
|
|
||||||
try {
|
|
||||||
String context = getTestPlanContext(testPlan, NoticeConstants.Event.COMPLETE);
|
|
||||||
Map paramMap = getTestPlanParamMap(testPlan);
|
|
||||||
SessionUser user = SessionUtils.getUser();
|
|
||||||
if (user != null) {
|
|
||||||
paramMap.put("operator", user.getName());
|
|
||||||
}
|
|
||||||
NoticeModel noticeModel = NoticeModel.builder()
|
|
||||||
.operator(SessionUtils.getUserId())
|
|
||||||
.context(context)
|
|
||||||
.subject(Translator.get("test_plan_notification"))
|
|
||||||
.mailTemplate("track/TestPlanComplete")
|
|
||||||
.paramMap(paramMap)
|
|
||||||
.event(NoticeConstants.Event.COMPLETE)
|
|
||||||
.build();
|
|
||||||
noticeSendService.send(NoticeConstants.TaskType.TEST_PLAN_TASK, noticeModel);
|
|
||||||
} catch (Exception e) {
|
|
||||||
LogUtil.error(e.getMessage(), e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private String calcTestPlanStatus(String planId) {
|
private String calcTestPlanStatus(String planId) {
|
||||||
// test-plan-functional-case status
|
// test-plan-functional-case status
|
||||||
List<String> funcStatusList = extTestPlanTestCaseMapper.getStatusByPlanId(planId);
|
List<String> funcStatusList = extTestPlanTestCaseMapper.getStatusByPlanId(planId);
|
||||||
|
|
Loading…
Reference in New Issue