diff --git a/backend/src/main/java/io/metersphere/notice/sender/AbstractNoticeSender.java b/backend/src/main/java/io/metersphere/notice/sender/AbstractNoticeSender.java index e2c1950cb7..3d5482074b 100644 --- a/backend/src/main/java/io/metersphere/notice/sender/AbstractNoticeSender.java +++ b/backend/src/main/java/io/metersphere/notice/sender/AbstractNoticeSender.java @@ -131,19 +131,19 @@ public abstract class AbstractNoticeSender implements NoticeSender { } break; case NoticeConstants.RelatedUser.CREATOR: - Object creator = paramMap.get("creator"); - Object createUser = paramMap.get("createUser"); - Object createUserId = paramMap.get("createUserId"); - Object userId1 = paramMap.get("userId"); + String creator = (String) paramMap.get("creator"); + String createUser = (String) paramMap.get("createUser"); + String createUserId = (String) paramMap.get("createUserId"); + String userId1 = (String) paramMap.get("userId"); - if (userId1 != null) { - toUsers.add(new Receiver(userId1.toString(), NotificationConstants.Type.SYSTEM_NOTICE.name())); - } else if (creator != null) { - toUsers.add(new Receiver(creator.toString(), NotificationConstants.Type.SYSTEM_NOTICE.name())); - } else if (createUser != null) { - toUsers.add(new Receiver(createUser.toString(), NotificationConstants.Type.SYSTEM_NOTICE.name())); - } else if (createUserId != null) { - toUsers.add(new Receiver(createUserId.toString(), NotificationConstants.Type.SYSTEM_NOTICE.name())); + if (StringUtils.isNotBlank(userId1)) { + toUsers.add(new Receiver(userId1, NotificationConstants.Type.SYSTEM_NOTICE.name())); + } else if (StringUtils.isNotBlank(creator)) { + toUsers.add(new Receiver(creator, NotificationConstants.Type.SYSTEM_NOTICE.name())); + } else if (StringUtils.isNotBlank(createUser)) { + toUsers.add(new Receiver(createUser, NotificationConstants.Type.SYSTEM_NOTICE.name())); + } else if (StringUtils.isNotBlank(createUserId)) { + toUsers.add(new Receiver(createUserId, NotificationConstants.Type.SYSTEM_NOTICE.name())); } break; case NoticeConstants.RelatedUser.MAINTAINER: @@ -156,9 +156,9 @@ public abstract class AbstractNoticeSender implements NoticeSender { } break; case NoticeConstants.RelatedUser.FOLLOW_PEOPLE: - Object followPeople = paramMap.get("followPeople"); - if (followPeople != null) { - toUsers.add(new Receiver(followPeople.toString(), NotificationConstants.Type.SYSTEM_NOTICE.name())); + String followPeople = (String) paramMap.get("followPeople"); + if (StringUtils.isNotBlank(followPeople)) { + toUsers.add(new Receiver(followPeople, NotificationConstants.Type.SYSTEM_NOTICE.name())); } break; default: diff --git a/backend/src/main/java/io/metersphere/notice/sender/impl/InSiteNoticeSender.java b/backend/src/main/java/io/metersphere/notice/sender/impl/InSiteNoticeSender.java index ab6c86fc28..fd085bb5a9 100644 --- a/backend/src/main/java/io/metersphere/notice/sender/impl/InSiteNoticeSender.java +++ b/backend/src/main/java/io/metersphere/notice/sender/impl/InSiteNoticeSender.java @@ -27,7 +27,7 @@ public class InSiteNoticeSender extends AbstractNoticeSender { return; } - LogUtil.info("发送站内通知: {}", messageDetail.getUserIds()); + LogUtil.info("发送站内通知: {}", receivers); receivers.forEach(receiver -> { Map paramMap = noticeModel.getParamMap();