Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MeterSphere
metersphere
提交
633bfd3e
M
metersphere
项目概览
MeterSphere
/
metersphere
上一次同步 3 年多
通知
25
Star
1
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
metersphere
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
633bfd3e
编写于
10月 22, 2020
作者:
C
Captain.B
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: 检查 userIds 是否为空
上级
dd8d52a3
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
18 addition
and
4 deletion
+18
-4
backend/src/main/java/io/metersphere/notice/service/DingTaskService.java
...n/java/io/metersphere/notice/service/DingTaskService.java
+4
-0
backend/src/main/java/io/metersphere/notice/service/MailService.java
.../main/java/io/metersphere/notice/service/MailService.java
+9
-3
backend/src/main/java/io/metersphere/notice/service/WxChatTaskService.java
...java/io/metersphere/notice/service/WxChatTaskService.java
+5
-1
未找到文件。
backend/src/main/java/io/metersphere/notice/service/DingTaskService.java
浏览文件 @
633bfd3e
...
...
@@ -9,6 +9,7 @@ import io.metersphere.commons.constants.NoticeConstants;
import
io.metersphere.notice.domain.MessageDetail
;
import
io.metersphere.notice.domain.UserDetail
;
import
io.metersphere.service.UserService
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
...
...
@@ -53,6 +54,9 @@ public class DingTaskService {
}
public
void
sendDingTask
(
String
context
,
List
<
String
>
userIds
,
String
Webhook
)
{
if
(
CollectionUtils
.
isEmpty
(
userIds
))
{
return
;
}
DingTalkClient
client
=
new
DefaultDingTalkClient
(
Webhook
);
OapiRobotSendRequest
request
=
new
OapiRobotSendRequest
();
request
.
setMsgtype
(
"text"
);
...
...
backend/src/main/java/io/metersphere/notice/service/MailService.java
浏览文件 @
633bfd3e
...
...
@@ -281,6 +281,9 @@ public class MailService {
}
private
void
sendReviewNotice
(
List
<
String
>
userIds
,
Map
<
String
,
String
>
context
,
String
Template
)
throws
MessagingException
{
if
(
CollectionUtils
.
isEmpty
(
userIds
))
{
return
;
}
JavaMailSenderImpl
javaMailSender
=
getMailSender
();
MimeMessage
mimeMessage
=
javaMailSender
.
createMimeMessage
();
MimeMessageHelper
helper
=
new
MimeMessageHelper
(
mimeMessage
,
true
);
...
...
@@ -301,6 +304,9 @@ public class MailService {
}
private
void
sendTestPlanNotice
(
List
<
String
>
userIds
,
Map
<
String
,
String
>
context
,
String
Template
)
throws
MessagingException
{
if
(
CollectionUtils
.
isEmpty
(
userIds
))
{
return
;
}
JavaMailSenderImpl
javaMailSender
=
getMailSender
();
MimeMessage
mimeMessage
=
javaMailSender
.
createMimeMessage
();
MimeMessageHelper
helper
=
new
MimeMessageHelper
(
mimeMessage
,
true
);
...
...
@@ -308,9 +314,6 @@ public class MailService {
helper
.
setSubject
(
"MeterSphere平台"
+
Translator
.
get
(
"test_plan_notification"
));
String
[]
users
;
List
<
String
>
emails
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isEmpty
(
userIds
))
{
return
;
}
List
<
UserDetail
>
list
=
userService
.
queryTypeByIds
(
userIds
);
list
.
forEach
(
u
->
{
emails
.
add
(
u
.
getEmail
());
...
...
@@ -323,6 +326,9 @@ public class MailService {
}
private
void
sendIssuesNotice
(
List
<
String
>
userIds
,
Map
<
String
,
String
>
context
,
String
Template
)
throws
MessagingException
{
if
(
CollectionUtils
.
isEmpty
(
userIds
))
{
return
;
}
JavaMailSenderImpl
javaMailSender
=
getMailSender
();
MimeMessage
mimeMessage
=
javaMailSender
.
createMimeMessage
();
MimeMessageHelper
helper
=
new
MimeMessageHelper
(
mimeMessage
,
true
);
...
...
backend/src/main/java/io/metersphere/notice/service/WxChatTaskService.java
浏览文件 @
633bfd3e
...
...
@@ -7,6 +7,7 @@ import io.metersphere.notice.message.TextMessage;
import
io.metersphere.notice.util.SendResult
;
import
io.metersphere.notice.util.WxChatbotClient
;
import
io.metersphere.service.UserService
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
...
...
@@ -52,8 +53,11 @@ public class WxChatTaskService {
}
public
void
enterpriseWechatTask
(
String
context
,
List
<
String
>
userIds
,
String
Webhook
)
{
if
(
CollectionUtils
.
isEmpty
(
userIds
))
{
return
;
}
TextMessage
message
=
new
TextMessage
(
context
);
List
<
String
>
mentionedMobileList
=
new
ArrayList
<
String
>();
List
<
String
>
mentionedMobileList
=
new
ArrayList
<>();
List
<
UserDetail
>
list
=
userService
.
queryTypeByIds
(
userIds
);
List
<
String
>
phoneList
=
new
ArrayList
<>();
list
.
forEach
(
u
->
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录