From 4f8ba53cf2106a452f11a3613c642a0635f8dc05 Mon Sep 17 00:00:00 2001 From: guoyuqi Date: Tue, 5 Mar 2024 18:31:49 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E9=A1=B9=E7=9B=AE=E7=AE=A1=E7=90=86):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B6=88=E6=81=AF=E7=AE=A1=E7=90=86=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E7=94=A8=E6=88=B7=E7=A7=BB=E9=99=A4=E8=BF=98=E4=BC=9A?= =?UTF-8?q?=E5=8F=91=E9=80=81=E9=80=9A=E7=9F=A5=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1036614 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001036614 --- .../service/NoticeMessageTaskService.java | 17 ++++++---- .../system/mapper/ExtSystemProjectMapper.java | 3 ++ .../system/mapper/ExtSystemProjectMapper.xml | 15 +++++++++ .../system/notice/MessageDetail.java | 1 + .../notice/sender/AbstractNoticeSender.java | 33 +++++++++++++------ .../notice/sender/SendNoticeAspect.java | 13 ++++++-- .../sender/impl/DingCustomNoticeSender.java | 11 +++++-- .../impl/DingEnterPriseNoticeSender.java | 4 +-- .../sender/impl/InSiteNoticeSender.java | 23 +++---------- .../notice/sender/impl/LarkNoticeSender.java | 12 +++++-- .../notice/sender/impl/MailNoticeSender.java | 17 +++++----- .../notice/sender/impl/WeComNoticeSender.java | 11 +++++-- .../sender/impl/WebhookNoticeSender.java | 5 ++- .../system/service/MessageDetailService.java | 1 + 14 files changed, 107 insertions(+), 59 deletions(-) diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/service/NoticeMessageTaskService.java b/backend/services/project-management/src/main/java/io/metersphere/project/service/NoticeMessageTaskService.java index 329b127ff6..465befbc9e 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/service/NoticeMessageTaskService.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/service/NoticeMessageTaskService.java @@ -15,6 +15,7 @@ import io.metersphere.system.domain.*; import io.metersphere.system.dto.sdk.OptionDTO; import io.metersphere.system.dto.sdk.request.MessageTaskRequest; import io.metersphere.system.mapper.CustomFieldMapper; +import io.metersphere.system.mapper.ExtSystemProjectMapper; import io.metersphere.system.mapper.UserMapper; import io.metersphere.system.mapper.UserRoleRelationMapper; import io.metersphere.system.notice.constants.NoticeConstants; @@ -57,6 +58,8 @@ public class NoticeMessageTaskService { private ExtProjectUserRoleMapper extProjectUserRoleMapper; @Resource protected CustomFieldMapper customFieldMapper; + @Resource + private ExtSystemProjectMapper extSystemProjectMapper; public static final String USER_IDS = "user_ids"; @@ -336,9 +339,7 @@ public class NoticeMessageTaskService { projectRobotExample.createCriteria().andIdIn(robotIds); List projectRobots = projectRobotMapper.selectByExample(projectRobotExample); Map robotMap = projectRobots.stream().collect(Collectors.toMap(ProjectRobot::getId, item -> item)); - UserExample userExample = new UserExample(); - userExample.createCriteria().andIdIn(userIds).andDeletedEqualTo(false); - List users = userMapper.selectByExample(userExample); + List users = extSystemProjectMapper.getProjectMemberByUserId(projectId, userIds); Map userNameMap = users.stream().collect(Collectors.toMap(User::getId, User::getName)); Map defaultRelatedUserMap = MessageTemplateUtils.getDefaultRelatedUserMap(); userNameMap.putAll(defaultRelatedUserMap); @@ -383,10 +384,12 @@ public class NoticeMessageTaskService { MessageTaskBlob messageTaskBlob = messageTaskBlobMap.get(messageTask.getId()); List receiverIds = messageTask.getReceivers(); for (String receiverId : receiverIds) { - OptionDTO optionDTO = new OptionDTO(); - optionDTO.setId(receiverId); - optionDTO.setName(userNameMap.get(receiverId)); - receivers.add(optionDTO); + if (userNameMap.get(receiverId)!=null) { + OptionDTO optionDTO = new OptionDTO(); + optionDTO.setId(receiverId); + optionDTO.setName(userNameMap.get(receiverId)); + receivers.add(optionDTO); + } } String platform = robotMap.get(messageTask.getProjectRobotId()).getPlatform(); String defaultSubject; diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtSystemProjectMapper.java b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtSystemProjectMapper.java index def8486c12..df2e6767db 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtSystemProjectMapper.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtSystemProjectMapper.java @@ -1,5 +1,6 @@ package io.metersphere.system.mapper; +import io.metersphere.system.domain.User; import io.metersphere.system.dto.OrganizationProjectOptionsDTO; import io.metersphere.system.dto.ProjectDTO; import io.metersphere.system.dto.ProjectResourcePoolDTO; @@ -31,4 +32,6 @@ public interface ExtSystemProjectMapper { String selectModuleSettingsByResourceIdAndTable(@Param("resourceId") String resourceId, @Param("resourceTable") String resourceTable); List getMemberByProjectId(@Param("projectId") String projectId, @Param("keyword") String keyword); + + List getProjectMemberByUserId(@Param("projectId") String projectId, @Param("userIds") List userIds); } diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtSystemProjectMapper.xml b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtSystemProjectMapper.xml index abd187d8f1..61b435ee3c 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtSystemProjectMapper.xml +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtSystemProjectMapper.xml @@ -209,4 +209,19 @@ order by u.name limit 100 + + \ No newline at end of file diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/notice/MessageDetail.java b/backend/services/system-setting/src/main/java/io/metersphere/system/notice/MessageDetail.java index d94fa96938..eaec7c15a0 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/notice/MessageDetail.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/notice/MessageDetail.java @@ -21,5 +21,6 @@ public class MessageDetail implements Serializable { private String template; private String appKey; private String appSecret; + private String projectId; } diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/notice/sender/AbstractNoticeSender.java b/backend/services/system-setting/src/main/java/io/metersphere/system/notice/sender/AbstractNoticeSender.java index 88a9f5897f..d82f66880d 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/notice/sender/AbstractNoticeSender.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/notice/sender/AbstractNoticeSender.java @@ -25,8 +25,7 @@ import io.metersphere.plan.mapper.TestPlanFollowerMapper; import io.metersphere.sdk.util.JSON; import io.metersphere.sdk.util.LogUtils; import io.metersphere.system.domain.User; -import io.metersphere.system.domain.UserExample; -import io.metersphere.system.mapper.UserMapper; +import io.metersphere.system.mapper.ExtSystemProjectMapper; import io.metersphere.system.notice.MessageDetail; import io.metersphere.system.notice.NoticeModel; import io.metersphere.system.notice.Receiver; @@ -59,7 +58,8 @@ public abstract class AbstractNoticeSender implements NoticeSender { @Resource private CaseReviewFollowerMapper caseReviewFollowerMapper; @Resource - private UserMapper userMapper; + private ExtSystemProjectMapper extSystemProjectMapper; + protected String getContext(MessageDetail messageDetail, NoticeModel noticeModel) { //处理自定义字段的值 @@ -150,7 +150,7 @@ public abstract class AbstractNoticeSender implements NoticeSender { // 去重复 List userIds = toUsers.stream().map(Receiver::getUserId).distinct().toList(); LogUtils.info("userIds: ", JSON.toJSONString(userIds)); - List users = getUsers(userIds); + List users = getUsers(userIds, messageDetail.getProjectId()); List realUserIds = users.stream().map(User::getId).toList(); return toUsers.stream().filter(t -> realUserIds.contains(t.getUserId())).toList(); } @@ -217,7 +217,7 @@ public abstract class AbstractNoticeSender implements NoticeSender { .map(t -> new Receiver(t.getUserId(), NotificationConstants.Type.SYSTEM_NOTICE.name())) .collect(Collectors.toList()); } - case NoticeConstants.TaskType.BUG_TASK -> { + case NoticeConstants.TaskType.BUG_TASK -> { BugFollowerExample bugFollowerExample = new BugFollowerExample(); bugFollowerExample.createCriteria().andBugIdEqualTo(id); List bugFollowers = bugFollowerMapper.selectByExample(bugFollowerExample); @@ -233,12 +233,25 @@ public abstract class AbstractNoticeSender implements NoticeSender { return receivers; } - protected List getUsers(List userIds) { - UserExample userExample = new UserExample(); + protected List getUsers(List userIds, String projectId) { if (CollectionUtils.isNotEmpty(userIds)) { - userExample.createCriteria().andIdIn(userIds); - return userMapper.selectByExample(userExample); + return extSystemProjectMapper.getProjectMemberByUserId(projectId, userIds); + } else { + return new ArrayList<>(); } - return new ArrayList<>(); + } + + protected List getReceivers(List receivers, Boolean excludeSelf, String operator) { + // 排除自己 + List realReceivers = new ArrayList<>(); + if (excludeSelf) { + for (Receiver receiver : receivers) { + if (!StringUtils.equals(receiver.getUserId(), operator)) { + LogUtils.info("发送人是自己不发"); + realReceivers.add(receiver); + } + } + } + return realReceivers; } } 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 325777b425..f46f5e73f7 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 @@ -42,6 +42,8 @@ public class SendNoticeAspect { private ThreadLocal source = new ThreadLocal<>(); private final static String ID = "id"; + private final static String PROJECT_ID = "projectId"; + @Pointcut("@annotation(io.metersphere.system.notice.annotation.SendNotice)") public void pointcut() { @@ -154,8 +156,15 @@ public class SendNoticeAspect { LogUtils.info("event:" + event); String resultStr = JSON.toJSONString(retValue); Map object = JSON.parseMap(resultStr); - if (MapUtils.isNotEmpty(object) && object.containsKey(ID)) { - resources.add(object); + if (MapUtils.isNotEmpty(object)) { + for (Map resource : resources) { + if (object.containsKey(ID) && resource.get(ID) == null) { + resource.put(ID, object.get(ID)); + } + if (object.containsKey(PROJECT_ID) && resource.get(PROJECT_ID) == null) { + resource.put(PROJECT_ID, object.get(PROJECT_ID)); + } + } } afterReturningNoticeSendService.sendNotice(taskType, event, resources, sessionUser, currentProjectId); } catch (Exception e) { diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/notice/sender/impl/DingCustomNoticeSender.java b/backend/services/system-setting/src/main/java/io/metersphere/system/notice/sender/impl/DingCustomNoticeSender.java index 62e79a5257..31dfa62e0e 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/notice/sender/impl/DingCustomNoticeSender.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/notice/sender/impl/DingCustomNoticeSender.java @@ -7,6 +7,7 @@ import io.metersphere.system.notice.NoticeModel; import io.metersphere.system.notice.Receiver; import io.metersphere.system.notice.sender.AbstractNoticeSender; import io.metersphere.system.notice.utils.DingClient; +import org.apache.commons.collections.CollectionUtils; import org.springframework.stereotype.Component; import java.util.List; @@ -16,15 +17,19 @@ import java.util.stream.Collectors; public class DingCustomNoticeSender extends AbstractNoticeSender { public void sendDingCustom(MessageDetail messageDetail, NoticeModel noticeModel, String context) { - List userIds = noticeModel.getReceivers().stream() + List receivers = super.getReceivers(noticeModel.getReceivers(), noticeModel.isExcludeSelf(), noticeModel.getOperator()); + if (CollectionUtils.isEmpty(receivers)) { + return; + } + List userIds = receivers.stream() .map(Receiver::getUserId) .distinct() .collect(Collectors.toList()); - List users = super.getUsers(userIds); + List users = super.getUsers(userIds, messageDetail.getProjectId()); List mobileList = users.stream().map(User::getPhone).toList(); LogUtils.info("钉钉自定义机器人收件人: {}", userIds); - DingClient.send(messageDetail.getWebhook(), messageDetail.getSubject()+": \n" + context, mobileList); + DingClient.send(messageDetail.getWebhook(), messageDetail.getSubject() + ": \n" + context, mobileList); } @Override diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/notice/sender/impl/DingEnterPriseNoticeSender.java b/backend/services/system-setting/src/main/java/io/metersphere/system/notice/sender/impl/DingEnterPriseNoticeSender.java index 449b073c8b..09d63cbbe7 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/notice/sender/impl/DingEnterPriseNoticeSender.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/notice/sender/impl/DingEnterPriseNoticeSender.java @@ -17,7 +17,7 @@ import org.springframework.stereotype.Component; @Component public class DingEnterPriseNoticeSender extends AbstractNoticeSender { - public void sendDing(MessageDetail messageDetail, NoticeModel noticeModel, String context) throws Exception { + public void sendDing(MessageDetail messageDetail, String context) throws Exception { Client client = DingEnterPriseNoticeSender.createClient(); GetAccessTokenResponse accessToken = getAccessToken(messageDetail.getAppKey(), messageDetail.getAppSecret()); OrgGroupSendHeaders orgGroupSendHeaders = new OrgGroupSendHeaders(); @@ -92,7 +92,7 @@ public class DingEnterPriseNoticeSender extends AbstractNoticeSender { public void send(MessageDetail messageDetail, NoticeModel noticeModel) { String context = super.getContext(messageDetail, noticeModel); try { - sendDing(messageDetail, noticeModel, context); + sendDing(messageDetail, context); LogUtils.debug("发送钉钉内部机器人结束"); } catch (Exception e) { LogUtils.error(e); 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 2823a6e885..7408b38b65 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 @@ -11,10 +11,8 @@ import io.metersphere.system.notice.sender.AbstractNoticeSender; import io.metersphere.system.service.NotificationService; import jakarta.annotation.Resource; import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; -import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -25,25 +23,12 @@ public class InSiteNoticeSender extends AbstractNoticeSender { private NotificationService notificationService; public void sendAnnouncement(MessageDetail messageDetail, NoticeModel noticeModel, String context) { - List receivers = noticeModel.getReceivers(); - // 排除自己 - List realReceivers = new ArrayList<>(); - if (noticeModel.isExcludeSelf() ) { - for (Receiver receiver : receivers) { - if (!StringUtils.equals(receiver.getUserId(), noticeModel.getOperator())) { - LogUtils.info("发送人是自己不发"); - realReceivers.add(receiver); - } - } - } - - if (CollectionUtils.isEmpty(realReceivers)) { + List receivers = super.getReceivers(noticeModel.getReceivers(), noticeModel.isExcludeSelf(), noticeModel.getOperator()); + if (CollectionUtils.isEmpty(receivers)) { return; } - - LogUtils.info("发送站内通知: {}", realReceivers); - realReceivers.forEach(receiver -> { - + LogUtils.info("发送站内通知: {}", receivers); + receivers.forEach(receiver -> { Map paramMap = noticeModel.getParamMap(); Notification notification = new Notification(); notification.setSubject(noticeModel.getSubject()); diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/notice/sender/impl/LarkNoticeSender.java b/backend/services/system-setting/src/main/java/io/metersphere/system/notice/sender/impl/LarkNoticeSender.java index 7d8101e1e5..43cda38062 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/notice/sender/impl/LarkNoticeSender.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/notice/sender/impl/LarkNoticeSender.java @@ -7,6 +7,7 @@ import io.metersphere.system.notice.sender.AbstractNoticeSender; import io.metersphere.system.notice.utils.LarkClient; import io.metersphere.sdk.util.LogUtils; import io.metersphere.system.domain.User; +import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; @@ -17,18 +18,23 @@ import java.util.stream.Collectors; public class LarkNoticeSender extends AbstractNoticeSender { public void sendLark(MessageDetail messageDetail, NoticeModel noticeModel, String context) { - List userIds = noticeModel.getReceivers().stream() + List receivers = super.getReceivers(noticeModel.getReceivers(), noticeModel.isExcludeSelf(), noticeModel.getOperator()); + if (CollectionUtils.isEmpty(receivers)) { + return; + } + List userIds = receivers.stream() .map(Receiver::getUserId) .distinct() .collect(Collectors.toList()); - List users = super.getUsers(userIds); + + List users = super.getUsers(userIds, messageDetail.getProjectId()); List collect = users.stream() .map(ud -> "" + ud.getName() + "") .toList(); LogUtils.info("飞书收件人: {}", userIds); context += StringUtils.join(collect, StringUtils.SPACE); - LarkClient.send(messageDetail.getWebhook(), messageDetail.getSubject()+": \n" + context); + LarkClient.send(messageDetail.getWebhook(), messageDetail.getSubject() + ": \n" + context); } @Override diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/notice/sender/impl/MailNoticeSender.java b/backend/services/system-setting/src/main/java/io/metersphere/system/notice/sender/impl/MailNoticeSender.java index 5a0e690276..dc50da0168 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/notice/sender/impl/MailNoticeSender.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/notice/sender/impl/MailNoticeSender.java @@ -33,17 +33,16 @@ public class MailNoticeSender extends AbstractNoticeSender { @Resource private SystemParameterMapper systemParameterMapper; - public void sendMail(String context, NoticeModel noticeModel) throws Exception { - - List userIds = noticeModel.getReceivers().stream() + public void sendMail(String context, NoticeModel noticeModel, String projectId) throws Exception { + List receivers = super.getReceivers(noticeModel.getReceivers(), noticeModel.isExcludeSelf(), noticeModel.getOperator()); + if (CollectionUtils.isEmpty(receivers)) { + return; + } + List userIds = receivers.stream() .map(Receiver::getUserId) .distinct() .collect(Collectors.toList()); - if (CollectionUtils.isEmpty(userIds)) { - return; - } - - String[] users = super.getUsers(userIds).stream() + String[] users = super.getUsers(userIds, projectId).stream() .map(User::getEmail) .distinct() .toArray(String[]::new); @@ -156,7 +155,7 @@ public class MailNoticeSender extends AbstractNoticeSender { public void send(MessageDetail messageDetail, NoticeModel noticeModel) { String context = super.getContext(messageDetail, noticeModel); try { - sendMail(context, noticeModel); + sendMail(context, noticeModel, messageDetail.getProjectId()); LogUtils.debug("发送邮件结束"); } catch (Exception e) { LogUtils.error(e); diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/notice/sender/impl/WeComNoticeSender.java b/backend/services/system-setting/src/main/java/io/metersphere/system/notice/sender/impl/WeComNoticeSender.java index d703d5f2a2..6f920ae793 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/notice/sender/impl/WeComNoticeSender.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/notice/sender/impl/WeComNoticeSender.java @@ -7,6 +7,7 @@ import io.metersphere.system.notice.NoticeModel; import io.metersphere.system.notice.Receiver; import io.metersphere.system.notice.sender.AbstractNoticeSender; import io.metersphere.system.notice.utils.WeComClient; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.stereotype.Component; import java.util.List; @@ -16,14 +17,18 @@ import java.util.stream.Collectors; public class WeComNoticeSender extends AbstractNoticeSender { public void sendWeCom(MessageDetail messageDetail, NoticeModel noticeModel, String context) { - List userIds = noticeModel.getReceivers().stream() + List receivers = super.getReceivers(noticeModel.getReceivers(), noticeModel.isExcludeSelf(), noticeModel.getOperator()); + if (CollectionUtils.isEmpty(receivers)) { + return; + } + List userIds = receivers.stream() .map(Receiver::getUserId) .distinct() .collect(Collectors.toList()); - List users = super.getUsers(userIds); + List users = super.getUsers(userIds, messageDetail.getProjectId()); List mobileList = users.stream().map(User::getPhone).toList(); LogUtils.info("企业微信收件人: {}", userIds); - WeComClient.send(messageDetail.getWebhook(), messageDetail.getSubject()+": \n" + context, mobileList); + WeComClient.send(messageDetail.getWebhook(), messageDetail.getSubject() + ": \n" + context, mobileList); } @Override diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/notice/sender/impl/WebhookNoticeSender.java b/backend/services/system-setting/src/main/java/io/metersphere/system/notice/sender/impl/WebhookNoticeSender.java index fee9827934..d41c396fd7 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/notice/sender/impl/WebhookNoticeSender.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/notice/sender/impl/WebhookNoticeSender.java @@ -25,7 +25,10 @@ public class WebhookNoticeSender extends AbstractNoticeSender { private void send(MessageDetail messageDetail, NoticeModel noticeModel, String context) { - List receivers = noticeModel.getReceivers(); + List receivers = super.getReceivers(noticeModel.getReceivers(), noticeModel.isExcludeSelf(), noticeModel.getOperator()); + if (CollectionUtils.isEmpty(receivers)) { + return; + } CloseableHttpClient httpClient = HttpClients.createDefault(); CloseableHttpResponse response = null; if (CollectionUtils.isNotEmpty(receivers)) { diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/service/MessageDetailService.java b/backend/services/system-setting/src/main/java/io/metersphere/system/service/MessageDetailService.java index 9a356109a7..6cca0e2e56 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/service/MessageDetailService.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/service/MessageDetailService.java @@ -89,6 +89,7 @@ public class MessageDetailService { messageDetail.setTaskType(messageTask.getTaskType()); messageDetail.setEvent(messageTask.getEvent()); messageDetail.setCreateTime(messageTask.getCreateTime()); + messageDetail.setProjectId(messageTask.getProjectId()); String projectRobotId = messageTask.getProjectRobotId(); ProjectRobot projectRobot = projectRobotMap.get(projectRobotId); //如果当前机器人停止,那么当前任务也失效