Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibznotify
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibznotify
提交
bbac2671
提交
bbac2671
编写于
4年前
作者:
zhouweidong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
钉钉、微信、阿里消息集成
上级
c2b17b89
master
无相关合并请求
变更
2
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
13 行增加
和
17 行删除
+13
-17
Msg.java
.../src/main/java/cn/ibizlab/core/extensions/domain/Msg.java
+0
-3
NotifyCoreService.java
...cn/ibizlab/core/extensions/service/NotifyCoreService.java
+13
-14
未找到文件。
ibznotify-core/src/main/java/cn/ibizlab/core/extensions/domain/Msg.java
浏览文件 @
bbac2671
...
...
@@ -9,9 +9,6 @@ import java.util.Map;
@Data
public
class
Msg
{
@NotBlank
(
message
=
"系统标识不能为空"
)
private
String
system
;
@NotBlank
(
message
=
"模板标识不能为空"
)
private
String
templateid
;
...
...
This diff is collapsed.
Click to expand it.
ibznotify-core/src/main/java/cn/ibizlab/core/extensions/service/NotifyCoreService.java
浏览文件 @
bbac2671
...
...
@@ -76,10 +76,10 @@ public class NotifyCoreService {
* 平台消息类型代码表
*/
private
static
Map
<
Integer
,
String
>
msgTypes
=
new
HashMap
(){{
put
(
2
,
"email"
);
put
(
4
,
"sms"
);
put
(
32
,
"wechat"
);
put
(
64
,
"dingtalk"
);
put
(
2
,
"
aliyun-
email"
);
put
(
4
,
"
aliyun-
sms"
);
put
(
32
,
"wechat
-msg
"
);
put
(
64
,
"dingtalk
-msg
"
);
}};
@Autowired
...
...
@@ -314,7 +314,7 @@ public class NotifyCoreService {
* @return
*/
public
boolean
createMsgTemplate
(
Template
template
){
String
system
=
template
.
getSystem
()
;
String
system
=
template
.
getSystem
()
.
toLowerCase
()
;
JSONArray
templates
=
template
.
getTemplate
();
for
(
int
a
=
0
;
a
<
templates
.
size
();
a
++){
List
<
MsgOpenAccess
>
openAccesses
=
new
ArrayList
<>();
...
...
@@ -328,15 +328,15 @@ public class NotifyCoreService {
openAccess
.
setId
(
system
+
templateType
);
openAccess
.
setName
(
templateType
);
openAccess
.
setDisabled
(
0
);
openAccess
.
setOpenType
(
templateType
);
openAccess
.
setOpenType
(
templateType
.
contains
(
"-"
)?
templateType
.
substring
(
0
,
templateType
.
indexOf
(
"-"
)):
templateType
);
openAccesses
.
add
(
openAccess
);
}
//创建消息模板
MsgTemplate
msgTemplate
=
JSONObject
.
toJavaObject
(
templates
.
getJSONObject
(
a
),
MsgTemplate
.
class
);
msgTemplate
.
setAccessId
(
openAccess
.
getId
());
msgTemplate
.
setOpenType
(
templateType
);
msgTemplate
.
setOpenType
(
templateType
.
contains
(
"-"
)?
templateType
.
substring
(
0
,
templateType
.
indexOf
(
"-"
)):
templateType
);
msgTemplate
.
setTemplateType
(
templateType
);
msgTemplate
.
setTid
(
system
+
msgTemplate
.
getTid
()+
templateType
);
msgTemplate
.
setTid
(
msgTemplate
.
getTid
()+
templateType
);
msgTemplates
.
add
(
msgTemplate
);
}
if
(
openAccesses
.
size
()>
0
)
...
...
@@ -353,27 +353,26 @@ public class NotifyCoreService {
* @return
*/
public
boolean
sendMsg
(
Msg
msg
){
String
system
=
msg
.
getSystem
();
String
templateId
=
msg
.
getTemplateid
();
String
userIds
=
msg
.
getUserids
();
Map
templParams
=
msg
.
getTemplparams
();
for
(
String
msgType:
getMsgType
(
msg
.
getMsgtypes
())){
MsgTemplate
msgTemplate
=
templateService
.
getById
(
system
+
templateId
+
msgType
);
MsgTemplate
msgTemplate
=
templateService
.
getById
(
templateId
+
msgType
);
if
(
msgTemplate
==
null
){
throw
new
BadRequestAlertException
(
String
.
format
(
"发送消息失败,无法获取到[%s]对应的rt模板"
,
templateId
),
""
,
""
);
}
else
{
switch
(
msgType
){
case
"sms"
:
case
"
aliyun-
sms"
:
sendAliSms
(
msgTemplate
.
getTid
(),
userIds
,
templParams
);
break
;
case
"email"
:
case
"
aliyun-
email"
:
sendAliEMail
(
msgTemplate
.
getTid
(),
userIds
);
break
;
case
"dingtalk"
:
case
"dingtalk
-msg
"
:
sendDingTalkMsg
(
msgTemplate
.
getTid
(),
userIds
);
break
;
case
"wechat"
:
case
"wechat
-msg
"
:
sendWeChatMsg
(
msgTemplate
.
getTid
(),
userIds
,
templParams
);
break
;
default
:
...
...
This diff is collapsed.
Click to expand it.
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录