From dcd52ff2973e1fc935f0ad005f36d4c78076c8de Mon Sep 17 00:00:00 2001 From: CaptainB Date: Tue, 21 Jun 2022 11:36:07 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B6=88=E6=81=AF=E9=80=9A=E7=9F=A5):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E7=BB=93=E6=9D=9F=E5=90=8E=E6=B2=A1=E6=9C=89=E7=BB=99?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E4=BA=BA=E5=8F=91=E9=80=9A=E7=9F=A5=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1013979 --user=刘瑞斌 【消息通知】设置测试计划执行成功的邮件通知特定测试计划收不到消息 https://www.tapd.cn/55049933/s/1187352 --- .../io/metersphere/notice/sender/AbstractNoticeSender.java | 3 +++ .../metersphere/notice/sender/impl/MailNoticeSender.java | 7 ++----- .../metersphere/track/service/TestPlanMessageService.java | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/backend/src/main/java/io/metersphere/notice/sender/AbstractNoticeSender.java b/backend/src/main/java/io/metersphere/notice/sender/AbstractNoticeSender.java index 5d63b80278..fb00dddb06 100644 --- a/backend/src/main/java/io/metersphere/notice/sender/AbstractNoticeSender.java +++ b/backend/src/main/java/io/metersphere/notice/sender/AbstractNoticeSender.java @@ -146,6 +146,9 @@ public abstract class AbstractNoticeSender implements NoticeSender { toUsers.addAll(receivers); } } + if (paramMap.containsKey("executor")) { + toUsers.add(new Receiver((String) paramMap.get("executor"), NotificationConstants.Type.SYSTEM_NOTICE.name())); + } break; case NoticeConstants.RelatedUser.CREATOR: String creator = (String) paramMap.get("creator"); diff --git a/backend/src/main/java/io/metersphere/notice/sender/impl/MailNoticeSender.java b/backend/src/main/java/io/metersphere/notice/sender/impl/MailNoticeSender.java index ae62646023..7c9afb534b 100644 --- a/backend/src/main/java/io/metersphere/notice/sender/impl/MailNoticeSender.java +++ b/backend/src/main/java/io/metersphere/notice/sender/impl/MailNoticeSender.java @@ -21,10 +21,7 @@ import org.springframework.stereotype.Component; import javax.annotation.Resource; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Properties; +import java.util.*; import java.util.stream.Collectors; @Component @@ -97,7 +94,7 @@ public class MailNoticeSender extends AbstractNoticeSender { LogUtil.debug("helper" + helper); helper.setSubject("MeterSphere " + subject); - LogUtil.info("收件人地址: {}", users); + LogUtil.info("收件人地址: {}", Arrays.asList(users)); helper.setText(context, true); helper.setTo(users); if (cc != null && cc.length > 0) { diff --git a/backend/src/main/java/io/metersphere/track/service/TestPlanMessageService.java b/backend/src/main/java/io/metersphere/track/service/TestPlanMessageService.java index 71bb1bdb1a..e53dbea19d 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanMessageService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanMessageService.java @@ -108,6 +108,7 @@ public class TestPlanMessageService { paramMap.put("projectId", projectId); if (userDTO != null) { paramMap.put("operator", userDTO.getName()); + paramMap.put("executor", userDTO.getId()); } paramMap.putAll(new BeanMap(testPlanDTOWithMetric));