refactor(项目管理): 消息通知判断是否发送自己
This commit is contained in:
parent
60492f0c34
commit
104d472d82
|
@ -2,13 +2,13 @@ package io.metersphere.system.notice.sender.impl;
|
||||||
|
|
||||||
|
|
||||||
import io.metersphere.project.domain.Notification;
|
import io.metersphere.project.domain.Notification;
|
||||||
import io.metersphere.system.notice.constants.NotificationConstants;
|
import io.metersphere.sdk.util.LogUtils;
|
||||||
import io.metersphere.system.notice.MessageDetail;
|
import io.metersphere.system.notice.MessageDetail;
|
||||||
import io.metersphere.system.notice.NoticeModel;
|
import io.metersphere.system.notice.NoticeModel;
|
||||||
import io.metersphere.system.notice.Receiver;
|
import io.metersphere.system.notice.Receiver;
|
||||||
|
import io.metersphere.system.notice.constants.NotificationConstants;
|
||||||
import io.metersphere.system.notice.sender.AbstractNoticeSender;
|
import io.metersphere.system.notice.sender.AbstractNoticeSender;
|
||||||
import io.metersphere.system.service.NotificationService;
|
import io.metersphere.system.service.NotificationService;
|
||||||
import io.metersphere.sdk.util.LogUtils;
|
|
||||||
import io.metersphere.system.uid.IDGenerator;
|
import io.metersphere.system.uid.IDGenerator;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
@ -29,14 +29,16 @@ public class InSiteNoticeSender extends AbstractNoticeSender {
|
||||||
List<Receiver> receivers = noticeModel.getReceivers();
|
List<Receiver> receivers = noticeModel.getReceivers();
|
||||||
// 排除自己
|
// 排除自己
|
||||||
List<Receiver> realReceivers = new ArrayList<>();
|
List<Receiver> realReceivers = new ArrayList<>();
|
||||||
|
if (noticeModel.isExcludeSelf() ) {
|
||||||
for (Receiver receiver : receivers) {
|
for (Receiver receiver : receivers) {
|
||||||
if (!StringUtils.equals(receiver.getUserId(), noticeModel.getOperator())) {
|
if (!StringUtils.equals(receiver.getUserId(), noticeModel.getOperator())) {
|
||||||
|
LogUtils.info("发送人是自己不发");
|
||||||
realReceivers.add(receiver);
|
realReceivers.add(receiver);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (CollectionUtils.isEmpty(realReceivers)) {
|
if (CollectionUtils.isEmpty(realReceivers)) {
|
||||||
LogUtils.info("发送人是自己不发");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue