diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/notice/sender/SendNoticeAspect.java b/backend/services/system-setting/src/main/java/io/metersphere/system/notice/sender/SendNoticeAspect.java index 6bd7930b79..33a6a9d774 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/notice/sender/SendNoticeAspect.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/notice/sender/SendNoticeAspect.java @@ -148,8 +148,8 @@ public class SendNoticeAspect { SessionUser sessionUser = SessionUtils.getUser(); String currentProjectId = SessionUtils.getCurrentProjectId(); - LogUtils.info("event:"+event); - afterReturningNoticeSendService.sendNotice(taskType,event, resources, sessionUser, currentProjectId); + LogUtils.info("event:" + event); + afterReturningNoticeSendService.sendNotice(taskType, event, resources, sessionUser, currentProjectId); } catch (Exception e) { LogUtils.error(e.getMessage(), e); } finally { diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/notice/sender/impl/InSiteNoticeSender.java b/backend/services/system-setting/src/main/java/io/metersphere/system/notice/sender/impl/InSiteNoticeSender.java index 1ec6e75f5d..6cbd64f048 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/notice/sender/impl/InSiteNoticeSender.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/notice/sender/impl/InSiteNoticeSender.java @@ -2,13 +2,13 @@ package io.metersphere.system.notice.sender.impl; 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.NoticeModel; import io.metersphere.system.notice.Receiver; +import io.metersphere.system.notice.constants.NotificationConstants; import io.metersphere.system.notice.sender.AbstractNoticeSender; import io.metersphere.system.service.NotificationService; -import io.metersphere.sdk.util.LogUtils; import io.metersphere.system.uid.IDGenerator; import jakarta.annotation.Resource; import org.apache.commons.collections4.CollectionUtils; @@ -29,14 +29,16 @@ public class InSiteNoticeSender extends AbstractNoticeSender { List receivers = noticeModel.getReceivers(); // 排除自己 List realReceivers = new ArrayList<>(); - for (Receiver receiver : receivers) { - if (!StringUtils.equals(receiver.getUserId(), noticeModel.getOperator())) { - realReceivers.add(receiver); + if (noticeModel.isExcludeSelf() ) { + for (Receiver receiver : receivers) { + if (!StringUtils.equals(receiver.getUserId(), noticeModel.getOperator())) { + LogUtils.info("发送人是自己不发"); + realReceivers.add(receiver); + } } } if (CollectionUtils.isEmpty(realReceivers)) { - LogUtils.info("发送人是自己不发"); return; }