fix(消息通知): 修复测试计划执行结束后没有给执行人发通知的问题

--bug=1013979 --user=刘瑞斌 【消息通知】设置测试计划执行成功的邮件通知特定测试计划收不到消息 https://www.tapd.cn/55049933/s/1187352
This commit is contained in:
CaptainB 2022-06-21 11:36:07 +08:00 committed by f2c-ci-robot[bot]
parent 23ec1794fa
commit dcd52ff297
3 changed files with 6 additions and 5 deletions

View File

@ -146,6 +146,9 @@ public abstract class AbstractNoticeSender implements NoticeSender {
toUsers.addAll(receivers); toUsers.addAll(receivers);
} }
} }
if (paramMap.containsKey("executor")) {
toUsers.add(new Receiver((String) paramMap.get("executor"), NotificationConstants.Type.SYSTEM_NOTICE.name()));
}
break; break;
case NoticeConstants.RelatedUser.CREATOR: case NoticeConstants.RelatedUser.CREATOR:
String creator = (String) paramMap.get("creator"); String creator = (String) paramMap.get("creator");

View File

@ -21,10 +21,7 @@ import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.mail.internet.InternetAddress; import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMessage;
import java.util.ArrayList; import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Component @Component
@ -97,7 +94,7 @@ public class MailNoticeSender extends AbstractNoticeSender {
LogUtil.debug("helper" + helper); LogUtil.debug("helper" + helper);
helper.setSubject("MeterSphere " + subject); helper.setSubject("MeterSphere " + subject);
LogUtil.info("收件人地址: {}", users); LogUtil.info("收件人地址: {}", Arrays.asList(users));
helper.setText(context, true); helper.setText(context, true);
helper.setTo(users); helper.setTo(users);
if (cc != null && cc.length > 0) { if (cc != null && cc.length > 0) {

View File

@ -108,6 +108,7 @@ public class TestPlanMessageService {
paramMap.put("projectId", projectId); paramMap.put("projectId", projectId);
if (userDTO != null) { if (userDTO != null) {
paramMap.put("operator", userDTO.getName()); paramMap.put("operator", userDTO.getName());
paramMap.put("executor", userDTO.getId());
} }
paramMap.putAll(new BeanMap(testPlanDTOWithMetric)); paramMap.putAll(new BeanMap(testPlanDTOWithMetric));