From bfdff00cced7b9fc77fa457d36d4852662b0273d Mon Sep 17 00:00:00 2001 From: WangXu10 Date: Wed, 19 Jun 2024 17:50:40 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E5=85=B3=E6=B3=A8=E4=BA=BA=E6=94=B6=E4=B8=8D=E5=88=B0?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E9=80=9A=E7=9F=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1040946 --user=王旭 【项目管理】消息设置-测试计划-删除测试计划和更新测试计划,通知接受人为创建人或关注人收不到通知 https://www.tapd.cn/55049933/s/1532107 --- .../system/notice/sender/AbstractNoticeSender.java | 11 +++++++++-- .../java/io/metersphere/plan/dto/TestPlanDTO.java | 4 ++++ .../plan/service/TestPlanSendNoticeService.java | 12 +++++++++--- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/notice/sender/AbstractNoticeSender.java b/backend/services/system-setting/src/main/java/io/metersphere/system/notice/sender/AbstractNoticeSender.java index 6960e25c30..2d26402e43 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/notice/sender/AbstractNoticeSender.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/notice/sender/AbstractNoticeSender.java @@ -155,8 +155,15 @@ public abstract class AbstractNoticeSender implements NoticeSender { } case NoticeConstants.RelatedUser.FOLLOW_PEOPLE -> { try { - List follows = handleFollows(messageDetail, noticeModel); - toUsers.addAll(follows); + List followUser = (List) paramMap.get("followUsers"); + if (CollectionUtils.isNotEmpty(followUser)) { + followUser.forEach(item ->{ + toUsers.add(new Receiver(item, NotificationConstants.Type.SYSTEM_NOTICE.name())); + }); + } else { + List follows = handleFollows(messageDetail, noticeModel); + toUsers.addAll(follows); + } } catch (Exception e) { LogUtils.error("查询关注人失败:{}", e); } diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/TestPlanDTO.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/TestPlanDTO.java index 95945df8ee..cbd7e54385 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/TestPlanDTO.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/TestPlanDTO.java @@ -4,6 +4,8 @@ import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.NoArgsConstructor; +import java.util.List; + /** * @author wx @@ -55,4 +57,6 @@ public class TestPlanDTO { @Schema(description = "message.domain.test_plan_description") private String description; + private List followUsers; + } diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanSendNoticeService.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanSendNoticeService.java index 22b5f517f3..f1843bbbea 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanSendNoticeService.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanSendNoticeService.java @@ -2,13 +2,12 @@ package io.metersphere.plan.service; import io.metersphere.functional.domain.FunctionalCase; import io.metersphere.functional.mapper.FunctionalCaseMapper; -import io.metersphere.plan.domain.TestPlan; -import io.metersphere.plan.domain.TestPlanConfig; -import io.metersphere.plan.domain.TestPlanExample; +import io.metersphere.plan.domain.*; import io.metersphere.plan.dto.TestPlanDTO; import io.metersphere.plan.dto.request.TestPlanCreateRequest; import io.metersphere.plan.dto.request.TestPlanUpdateRequest; import io.metersphere.plan.mapper.TestPlanConfigMapper; +import io.metersphere.plan.mapper.TestPlanFollowerMapper; import io.metersphere.plan.mapper.TestPlanMapper; import io.metersphere.sdk.constants.ReportStatus; import io.metersphere.sdk.constants.TestPlanConstants; @@ -49,6 +48,8 @@ public class TestPlanSendNoticeService { private CommonNoticeSendService commonNoticeSendService; @Resource private TestPlanConfigMapper testPlanConfigMapper; + @Resource + private TestPlanFollowerMapper testPlanFollowerMapper; public void sendNoticeCase(List relatedUsers, String userId, String caseId, String task, String event, String testPlanId) { FunctionalCase functionalCase = functionalCaseMapper.selectByPrimaryKey(caseId); @@ -155,10 +156,15 @@ public class TestPlanSendNoticeService { public TestPlanDTO sendDeleteNotice(String id) { TestPlan testPlan = testPlanMapper.selectByPrimaryKey(id); TestPlanConfig testPlanConfig = testPlanConfigMapper.selectByPrimaryKey(id); + TestPlanFollowerExample example = new TestPlanFollowerExample(); + example.createCriteria().andTestPlanIdEqualTo(id); + List testPlanFollowers = testPlanFollowerMapper.selectByExample(example); + List followUsers = testPlanFollowers.stream().map(TestPlanFollower::getUserId).toList(); TestPlanDTO dto = new TestPlanDTO(); if (testPlan != null) { BeanUtils.copyBean(dto, testPlan); BeanUtils.copyBean(dto, testPlanConfig); + dto.setFollowUsers(followUsers); return dto; } return null;