refactor: 收件人为空不发通知
This commit is contained in:
parent
b148152d02
commit
c81813f8fa
|
@ -34,6 +34,9 @@ public class DingNoticeSender extends AbstractNoticeSender {
|
|||
.map(Receiver::getUserId)
|
||||
.distinct()
|
||||
.collect(Collectors.toList()));
|
||||
if (CollectionUtils.isEmpty(phoneList)) {
|
||||
return;
|
||||
}
|
||||
LogUtil.info("钉钉收件人地址: " + phoneList);
|
||||
at.setAtMobiles(phoneList);
|
||||
request.setAt(at);
|
||||
|
|
|
@ -6,6 +6,7 @@ import io.metersphere.notice.domain.Receiver;
|
|||
import io.metersphere.notice.sender.AbstractNoticeSender;
|
||||
import io.metersphere.notice.sender.NoticeModel;
|
||||
import io.metersphere.notice.service.MailService;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.mail.javamail.JavaMailSenderImpl;
|
||||
import org.springframework.mail.javamail.MimeMessageHelper;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -41,6 +42,9 @@ public class MailNoticeSender extends AbstractNoticeSender {
|
|||
.map(Receiver::getUserId)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(userIds)) {
|
||||
return;
|
||||
}
|
||||
List<String> emails = super.getUserEmails(noticeModel, userIds);
|
||||
String[] users = emails.toArray(new String[0]);
|
||||
LogUtil.info("收件人地址: " + emails);
|
||||
|
|
|
@ -29,6 +29,9 @@ public class WeComNoticeSender extends AbstractNoticeSender {
|
|||
.distinct()
|
||||
.collect(Collectors.toList()));
|
||||
message.setMentionedMobileList(phoneLists);
|
||||
if (CollectionUtils.isEmpty(phoneLists)) {
|
||||
return;
|
||||
}
|
||||
LogUtil.info("企业微信收件人: ", phoneLists);
|
||||
try {
|
||||
WxChatbotClient.send(messageDetail.getWebhook(), message);
|
||||
|
|
Loading…
Reference in New Issue