From 78a1e74b89e57d3906d3eacdda2ee4c391656b34 Mon Sep 17 00:00:00 2001 From: CaptainB Date: Fri, 29 Oct 2021 15:16:07 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20--bug=3D1007055=20--user=3D=E5=88=98?= =?UTF-8?q?=E7=91=9E=E6=96=8C=20=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92?= =?UTF-8?q?=E5=AE=8C=E6=88=90=E5=90=8E=EF=BC=8C=E6=B5=8F=E8=A7=88=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E7=9A=84=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92=EF=BC=8C?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E4=BC=9A=E4=B8=8D=E6=96=AD=E6=8F=90=E9=86=92?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E4=BB=BB=E5=8A=A1=E5=AE=8C=E6=88=90=20https:?= =?UTF-8?q?//www.tapd.cn/55049933/s/1061683?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../track/service/TestPlanService.java | 38 ++----------------- 1 file changed, 4 insertions(+), 34 deletions(-) diff --git a/backend/src/main/java/io/metersphere/track/service/TestPlanService.java b/backend/src/main/java/io/metersphere/track/service/TestPlanService.java index 849fe3615e..711e63c11f 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanService.java @@ -256,8 +256,9 @@ public class TestPlanService { } } List follows = request.getFollows(); - if (StringUtils.isNotBlank(request.getId())) { - testPlanFollowService.deleteTestPlanFollowByPlanId(request.getId()); + if (StringUtils.isNotBlank(request.getId())) { + testPlanFollowService.deleteTestPlanFollowByPlanId(request.getId()); + if (!CollectionUtils.isEmpty(follows)) { for (String follow : follows) { TestPlanFollow testPlanFollow = new TestPlanFollow(); testPlanFollow.setTestPlanId(request.getId()); @@ -265,6 +266,7 @@ public class TestPlanService { testPlanFollowService.insert(testPlanFollow); } } + } return this.editTestPlan(request); } @@ -470,8 +472,6 @@ public class TestPlanService { if (passNum == statusList.size()) { // 全部通过 testPlanWithBLOBs.setStatus(TestPlanStatus.Completed.name()); this.editTestPlan(testPlanWithBLOBs); - // 发送成功通知 -// sendCompletedNotice(testPlanWithBLOBs); } else if (prepareNum == 0 && passNum + failNum == statusList.size()) { // 已结束 testPlanWithBLOBs.setStatus(TestPlanStatus.Finished.name()); editTestPlan(testPlanWithBLOBs); @@ -507,8 +507,6 @@ public class TestPlanService { if (passNum == statusList.size()) { // 全部通过 testPlanWithBLOBs.setStatus(TestPlanStatus.Completed.name()); this.editTestPlan(testPlanWithBLOBs); - // 发送成功通知 -// sendCompletedNotice(testPlanWithBLOBs); } else if (prepareNum == 0 && passNum + failNum == statusList.size()) { // 已结束 testPlanWithBLOBs.setStatus(TestPlanStatus.Finished.name()); editTestPlan(testPlanWithBLOBs); @@ -721,36 +719,8 @@ public class TestPlanService { String status = calcTestPlanStatus(planId); testPlan.setStatus(status); 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) { // test-plan-functional-case status List funcStatusList = extTestPlanTestCaseMapper.getStatusByPlanId(planId);