From 63037ffb1c94aad81b414442b2a8a30d2888c569 Mon Sep 17 00:00:00 2001 From: CaptainB Date: Mon, 25 Oct 2021 15:21:00 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8F=91=E9=80=81=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E6=97=B6=E7=BA=BF=E7=A8=8B=E5=AE=89=E5=85=A8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/metersphere/notice/domain/MessageDetail.java | 3 ++- .../io/metersphere/notice/sender/NoticeModel.java | 3 ++- .../notice/service/NoticeSendService.java | 13 ++++++++++--- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/backend/src/main/java/io/metersphere/notice/domain/MessageDetail.java b/backend/src/main/java/io/metersphere/notice/domain/MessageDetail.java index beec1d3866..799d0d1c1f 100644 --- a/backend/src/main/java/io/metersphere/notice/domain/MessageDetail.java +++ b/backend/src/main/java/io/metersphere/notice/domain/MessageDetail.java @@ -2,11 +2,12 @@ package io.metersphere.notice.domain; import lombok.Data; +import java.io.Serializable; import java.util.ArrayList; import java.util.List; @Data -public class MessageDetail { +public class MessageDetail implements Serializable { private List userIds = new ArrayList<>(); private String id; private String event; diff --git a/backend/src/main/java/io/metersphere/notice/sender/NoticeModel.java b/backend/src/main/java/io/metersphere/notice/sender/NoticeModel.java index c5620e6741..557e004c31 100644 --- a/backend/src/main/java/io/metersphere/notice/sender/NoticeModel.java +++ b/backend/src/main/java/io/metersphere/notice/sender/NoticeModel.java @@ -4,12 +4,13 @@ import io.metersphere.notice.domain.Receiver; import lombok.Builder; import lombok.Data; +import java.io.Serializable; import java.util.List; import java.util.Map; @Data @Builder -public class NoticeModel { +public class NoticeModel implements Serializable { /** * 保存 测试id */ diff --git a/backend/src/main/java/io/metersphere/notice/service/NoticeSendService.java b/backend/src/main/java/io/metersphere/notice/service/NoticeSendService.java index 4416bd42f3..7ade77f52d 100644 --- a/backend/src/main/java/io/metersphere/notice/service/NoticeSendService.java +++ b/backend/src/main/java/io/metersphere/notice/service/NoticeSendService.java @@ -8,6 +8,7 @@ import io.metersphere.notice.domain.MessageDetail; import io.metersphere.notice.sender.AbstractNoticeSender; import io.metersphere.notice.sender.NoticeModel; import io.metersphere.notice.sender.impl.*; +import org.apache.commons.lang3.SerializationUtils; import org.springframework.stereotype.Component; import javax.annotation.Resource; @@ -66,7 +67,9 @@ public class NoticeSendService { messageDetails.stream() .filter(messageDetail -> StringUtils.equals(messageDetail.getEvent(), noticeModel.getEvent())) .forEach(messageDetail -> { - this.getNoticeSender(messageDetail).send(messageDetail, noticeModel); + MessageDetail m = SerializationUtils.clone(messageDetail); + NoticeModel n = SerializationUtils.clone(noticeModel); + this.getNoticeSender(m).send(m, n); }); } catch (Exception e) { @@ -102,7 +105,9 @@ public class NoticeSendService { messageDetails.stream() .filter(messageDetail -> StringUtils.equals(messageDetail.getEvent(), noticeModel.getEvent())) .forEach(messageDetail -> { - this.getNoticeSender(messageDetail).send(messageDetail, noticeModel); + MessageDetail m = SerializationUtils.clone(messageDetail); + NoticeModel n = SerializationUtils.clone(noticeModel); + this.getNoticeSender(m).send(m, n); }); } catch (Exception e) { @@ -133,7 +138,9 @@ public class NoticeSendService { messageDetails.stream() .filter(messageDetail -> StringUtils.equals(messageDetail.getEvent(), noticeModel.getEvent())) .forEach(messageDetail -> { - this.getNoticeSender(messageDetail).send(messageDetail, noticeModel); + MessageDetail m = SerializationUtils.clone(messageDetail); + NoticeModel n = SerializationUtils.clone(noticeModel); + this.getNoticeSender(m).send(m, n); }); } catch (Exception e) {