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