fix(项目管理): 修复发送通知内容不符问题

This commit is contained in:
guoyuqi 2024-02-05 15:13:13 +08:00 committed by 刘瑞斌
parent a7b04cc69b
commit 6a82fdf2ec
3 changed files with 7 additions and 11 deletions

View File

@ -1,13 +1,12 @@
package io.metersphere.system.notice.sender.impl; package io.metersphere.system.notice.sender.impl;
import io.metersphere.sdk.util.LogUtils;
import io.metersphere.system.domain.User;
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.sender.AbstractNoticeSender; import io.metersphere.system.notice.sender.AbstractNoticeSender;
import io.metersphere.system.notice.utils.DingClient; import io.metersphere.system.notice.utils.DingClient;
import io.metersphere.sdk.util.LogUtils;
import io.metersphere.system.domain.User;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.List; import java.util.List;
@ -25,8 +24,7 @@ public class DingCustomNoticeSender extends AbstractNoticeSender {
List<String> mobileList = users.stream().map(User::getPhone).toList(); List<String> mobileList = users.stream().map(User::getPhone).toList();
LogUtils.info("钉钉自定义机器人收件人: {}", userIds); LogUtils.info("钉钉自定义机器人收件人: {}", userIds);
context += StringUtils.join(mobileList, StringUtils.SPACE); DingClient.send(messageDetail.getWebhook(), messageDetail.getSubject()+": \n" + context, mobileList);
DingClient.send(messageDetail.getWebhook(), "消息通知: \n" + context, mobileList);
} }
@Override @Override

View File

@ -28,7 +28,7 @@ public class LarkNoticeSender extends AbstractNoticeSender {
LogUtils.info("飞书收件人: {}", userIds); LogUtils.info("飞书收件人: {}", userIds);
context += StringUtils.join(collect, StringUtils.SPACE); context += StringUtils.join(collect, StringUtils.SPACE);
LarkClient.send(messageDetail.getWebhook(), "消息通知: \n" + context); LarkClient.send(messageDetail.getWebhook(), messageDetail.getSubject()+": \n" + context);
} }
@Override @Override

View File

@ -1,13 +1,12 @@
package io.metersphere.system.notice.sender.impl; package io.metersphere.system.notice.sender.impl;
import io.metersphere.sdk.util.LogUtils;
import io.metersphere.system.domain.User;
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.sender.AbstractNoticeSender; import io.metersphere.system.notice.sender.AbstractNoticeSender;
import io.metersphere.system.notice.utils.WeComClient; import io.metersphere.system.notice.utils.WeComClient;
import io.metersphere.sdk.util.LogUtils;
import io.metersphere.system.domain.User;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.List; import java.util.List;
@ -24,8 +23,7 @@ public class WeComNoticeSender extends AbstractNoticeSender {
List<User> users = super.getUsers(userIds); List<User> users = super.getUsers(userIds);
List<String> mobileList = users.stream().map(User::getPhone).toList(); List<String> mobileList = users.stream().map(User::getPhone).toList();
LogUtils.info("企业微信收件人: {}", userIds); LogUtils.info("企业微信收件人: {}", userIds);
context += StringUtils.join(mobileList, StringUtils.SPACE); WeComClient.send(messageDetail.getWebhook(), messageDetail.getSubject()+": \n" + context, mobileList);
WeComClient.send(messageDetail.getWebhook(), "消息通知: \n" + context, mobileList);
} }
@Override @Override