Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibznotify
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibznotify
提交
fb5969af
提交
fb5969af
编写于
4年前
作者:
zhouweidong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
钉钉待办集成
上级
263a308e
变更
5
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
173 行增加
和
37 行删除
+173
-37
DevBootSecurityConfig.java
...rc/main/java/cn/ibizlab/config/DevBootSecurityConfig.java
+6
-0
Msg.java
.../src/main/java/cn/ibizlab/core/extensions/domain/Msg.java
+6
-0
NotifyCoreService.java
...cn/ibizlab/core/extensions/service/NotifyCoreService.java
+118
-36
apiSecurityConfig.java
...rc/main/java/cn/ibizlab/api/config/apiSecurityConfig.java
+5
-0
NotifyCoreResource.java
...va/cn/ibizlab/api/rest/extensions/NotifyCoreResource.java
+38
-1
未找到文件。
ibznotify-boot/src/main/java/cn/ibizlab/config/DevBootSecurityConfig.java
浏览文件 @
fb5969af
...
@@ -114,8 +114,14 @@ public class DevBootSecurityConfig extends WebSecurityConfigurerAdapter {
...
@@ -114,8 +114,14 @@ public class DevBootSecurityConfig extends WebSecurityConfigurerAdapter {
.
antMatchers
(
"/"
+
downloadpath
+
"/**"
).
permitAll
()
.
antMatchers
(
"/"
+
downloadpath
+
"/**"
).
permitAll
()
.
antMatchers
(
"/"
+
uploadpath
).
permitAll
()
.
antMatchers
(
"/"
+
uploadpath
).
permitAll
()
.
antMatchers
(
"/"
+
previewpath
+
"/**"
).
permitAll
()
.
antMatchers
(
"/"
+
previewpath
+
"/**"
).
permitAll
()
//消息发送请求
.
antMatchers
(
"/SendMsg"
).
permitAll
()
.
antMatchers
(
"/SendMsg"
).
permitAll
()
.
antMatchers
(
"/createMsgTemplate"
).
permitAll
()
.
antMatchers
(
"/createMsgTemplate"
).
permitAll
()
.
antMatchers
(
"/trade/pagepay"
).
permitAll
()
.
antMatchers
(
"/dingtalk/sendlinkmsg"
).
permitAll
()
.
antMatchers
(
"/dingtalk/createworkrecord"
).
permitAll
()
.
antMatchers
(
"/dingtalk/finishworkrecord"
).
permitAll
()
.
anyRequest
().
authenticated
()
.
anyRequest
().
authenticated
()
// 防止iframe 造成跨域
// 防止iframe 造成跨域
.
and
().
headers
().
frameOptions
().
disable
();
.
and
().
headers
().
frameOptions
().
disable
();
...
...
This diff is collapsed.
Click to expand it.
ibznotify-core/src/main/java/cn/ibizlab/core/extensions/domain/Msg.java
浏览文件 @
fb5969af
package
cn
.
ibizlab
.
core
.
extensions
.
domain
;
package
cn
.
ibizlab
.
core
.
extensions
.
domain
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.Data
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotBlank
;
...
@@ -12,6 +13,7 @@ import java.util.Map;
...
@@ -12,6 +13,7 @@ import java.util.Map;
* 其余类型消息则以模板内容为准。
* 其余类型消息则以模板内容为准。
*/
*/
@Data
@Data
@Builder
public
class
Msg
{
public
class
Msg
{
/**
/**
...
@@ -41,6 +43,10 @@ public class Msg {
...
@@ -41,6 +43,10 @@ public class Msg {
* 消息链接
* 消息链接
*/
*/
private
String
url
;
private
String
url
;
/**
* 待办标识
*/
private
String
recordid
;
/**
/**
* 消息模板参数
* 消息模板参数
*/
*/
...
...
This diff is collapsed.
Click to expand it.
ibznotify-core/src/main/java/cn/ibizlab/core/extensions/service/NotifyCoreService.java
浏览文件 @
fb5969af
...
@@ -24,8 +24,9 @@ import com.dingtalk.api.DefaultDingTalkClient;
...
@@ -24,8 +24,9 @@ import com.dingtalk.api.DefaultDingTalkClient;
import
com.dingtalk.api.DingTalkClient
;
import
com.dingtalk.api.DingTalkClient
;
import
com.dingtalk.api.request.OapiGettokenRequest
;
import
com.dingtalk.api.request.OapiGettokenRequest
;
import
com.dingtalk.api.request.OapiMessageCorpconversationAsyncsendV2Request
;
import
com.dingtalk.api.request.OapiMessageCorpconversationAsyncsendV2Request
;
import
com.dingtalk.api.response.OapiGettokenResponse
;
import
com.dingtalk.api.request.OapiWorkrecordAddRequest
;
import
com.dingtalk.api.response.OapiMessageCorpconversationAsyncsendV2Response
;
import
com.dingtalk.api.request.OapiWorkrecordUpdateRequest
;
import
com.dingtalk.api.response.*
;
import
lombok.SneakyThrows
;
import
lombok.SneakyThrows
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -46,31 +47,39 @@ public class NotifyCoreService {
...
@@ -46,31 +47,39 @@ public class NotifyCoreService {
/**
/**
* 钉钉获取token api
* 钉钉获取token api
*/
*/
private
final
String
dingTalkTokenApi
=
"https://oapi.dingtalk.com/gettoken"
;
private
static
final
String
dingTalkTokenApi
=
"https://oapi.dingtalk.com/gettoken"
;
/**
/**
* 钉钉发送消息api
* 钉钉发送消息api
*/
*/
private
final
String
dingTalkSendMsgApi
=
"https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend_v2"
;
private
static
final
String
dingTalkSendMsgApi
=
"https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend_v2"
;
/**
* 钉钉创建待办api
*/
private
static
final
String
dingTalkCreateWorkRecordApi
=
"https://oapi.dingtalk.com/topapi/workrecord/add"
;
/**
* 钉钉完成待办api
*/
private
static
final
String
dingTalkFinishWorkRecordApi
=
"https://oapi.dingtalk.com/topapi/workrecord/update"
;
/**
/**
* 微信获取token api
* 微信获取token api
*/
*/
private
final
String
weChatGetTokenApi
=
"https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s"
;
private
final
String
weChatGetTokenApi
=
"https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s"
;
/**
/**
* 微信发送消息api
* 微信发送消息api
*/
*/
private
final
String
weChatSendMsgApi
=
"https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=%s"
;
private
final
String
weChatSendMsgApi
=
"https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=%s"
;
/**
/**
* 阿里短信服务域名
* 阿里短信服务域名
*/
*/
private
final
String
aliSmsDomain
=
"dysmsapi.aliyuncs.com"
;
private
static
final
String
aliSmsDomain
=
"dysmsapi.aliyuncs.com"
;
/**
/**
* 阿里短信服务单处理行为
* 阿里短信服务单处理行为
*/
*/
private
final
String
aliSendSmsAction
=
"SendSms"
;
private
static
final
String
aliSendSmsAction
=
"SendSms"
;
/**
/**
* 阿里短信服务单处理行为
* 阿里短信服务单处理行为
*/
*/
private
final
String
aliSendSmsVersion
=
"2017-05-25"
;
private
static
final
String
aliSendSmsVersion
=
"2017-05-25"
;
/**
/**
* 消息类型
* 消息类型
...
@@ -91,6 +100,17 @@ public class NotifyCoreService {
...
@@ -91,6 +100,17 @@ public class NotifyCoreService {
put
(
64
,
"dingtalk-msg"
);
put
(
64
,
"dingtalk-msg"
);
}};
}};
private
static
DingTalkClient
sendMsgClient
;
private
static
DingTalkClient
createWorkRecordClient
;
private
static
DingTalkClient
finishWorkRecordClient
;
private
static
DingTalkClient
getTokenClient
;
static
{
getTokenClient
=
new
DefaultDingTalkClient
(
dingTalkTokenApi
);
sendMsgClient
=
new
DefaultDingTalkClient
(
dingTalkSendMsgApi
);
createWorkRecordClient
=
new
DefaultDingTalkClient
(
dingTalkCreateWorkRecordApi
);
finishWorkRecordClient
=
new
DefaultDingTalkClient
(
dingTalkFinishWorkRecordApi
);
}
@Autowired
@Autowired
@Lazy
@Lazy
RestTemplate
restTemplate
;
RestTemplate
restTemplate
;
...
@@ -113,12 +133,11 @@ public class NotifyCoreService {
...
@@ -113,12 +133,11 @@ public class NotifyCoreService {
public
String
getDingTalkToken
(
MsgOpenAccess
openAccess
){
public
String
getDingTalkToken
(
MsgOpenAccess
openAccess
){
String
accessKey
=
openAccess
.
getAccessKey
();
String
accessKey
=
openAccess
.
getAccessKey
();
String
accessSecret
=
openAccess
.
getSecretKey
();
String
accessSecret
=
openAccess
.
getSecretKey
();
DingTalkClient
client
=
new
DefaultDingTalkClient
(
dingTalkTokenApi
);
OapiGettokenRequest
req
=
new
OapiGettokenRequest
();
OapiGettokenRequest
req
=
new
OapiGettokenRequest
();
req
.
setAppkey
(
accessKey
);
req
.
setAppkey
(
accessKey
);
req
.
setAppsecret
(
accessSecret
);
req
.
setAppsecret
(
accessSecret
);
req
.
setHttpMethod
(
"GET"
);
req
.
setHttpMethod
(
"GET"
);
OapiGettokenResponse
rsp
=
c
lient
.
execute
(
req
);
OapiGettokenResponse
rsp
=
getTokenC
lient
.
execute
(
req
);
getResult
(
rsp
.
getBody
());
getResult
(
rsp
.
getBody
());
return
rsp
.
getBody
();
return
rsp
.
getBody
();
}
}
...
@@ -144,33 +163,18 @@ public class NotifyCoreService {
...
@@ -144,33 +163,18 @@ public class NotifyCoreService {
@SneakyThrows
@SneakyThrows
private
boolean
sendDingTalkMsg
(
Msg
msg
,
String
tid
){
private
boolean
sendDingTalkMsg
(
Msg
msg
,
String
tid
){
String
authUserId
=
getAuthUserId
(
msg
.
getUserids
(),
MsgType
.
dingtalk
);
String
authUserId
=
getAuthUserId
(
msg
.
getUserids
(),
MsgType
.
dingtalk
);
MsgTemplate
template
=
templateService
.
get
(
tid
);
MsgTemplate
template
=
templateService
.
get
ById
(
tid
);
MsgOpenAccess
openAccess
=
template
.
getOpenaccess
();
MsgOpenAccess
openAccess
=
template
.
getOpenaccess
();
DingTalkClient
client
=
new
DefaultDingTalkClient
(
dingTalkSendMsgApi
);
OapiMessageCorpconversationAsyncsendV2Request
req
=
new
OapiMessageCorpconversationAsyncsendV2Request
();
OapiMessageCorpconversationAsyncsendV2Request
req
=
new
OapiMessageCorpconversationAsyncsendV2Request
();
req
.
setAgentId
(
Long
.
parseLong
(
template
.
getTemplateId
()));
req
.
setAgentId
(
Long
.
parseLong
(
template
.
getTemplateId
()));
req
.
setUseridList
(
authUserId
);
req
.
setUseridList
(
authUserId
);
OapiMessageCorpconversationAsyncsendV2Request
.
Msg
dingtalkMsg
=
new
OapiMessageCorpconversationAsyncsendV2Request
.
Msg
();
OapiMessageCorpconversationAsyncsendV2Request
.
Msg
dingtalkMsg
=
new
OapiMessageCorpconversationAsyncsendV2Request
.
Msg
();
dingtalkMsg
.
setMsgtype
(
"text"
);
if
((!
StringUtils
.
isEmpty
(
template
.
getTemplateUrl
()))
||
(!
StringUtils
.
isEmpty
(
msg
.
getUrl
()))
){
OapiMessageCorpconversationAsyncsendV2Request
.
Text
obj2
=
new
OapiMessageCorpconversationAsyncsendV2Request
.
Text
();
//链接消息
obj2
.
setContent
(
StringUtils
.
isEmpty
(
msg
.
getContent
())?
template
.
getContent
():
msg
.
getContent
());
dingtalkMsg
.
setMsgtype
(
"link"
);
dingtalkMsg
.
setText
(
obj2
);
dingtalkMsg
.
setLink
(
new
OapiMessageCorpconversationAsyncsendV2Request
.
Link
());
req
.
setMsg
(
dingtalkMsg
);
dingtalkMsg
.
getLink
().
setTitle
(
StringUtils
.
isEmpty
(
msg
.
getTitle
())?
template
.
getTemplateName
():
msg
.
getTitle
());
OapiMessageCorpconversationAsyncsendV2Response
rsp
=
sendMsgClient
.
execute
(
req
,
openAccess
.
getAccessToken
());
dingtalkMsg
.
getLink
().
setText
(
StringUtils
.
isEmpty
(
msg
.
getContent
())?
template
.
getContent
():
msg
.
getContent
());
dingtalkMsg
.
getLink
().
setMessageUrl
(
StringUtils
.
isEmpty
(
msg
.
getUrl
())?
template
.
getTemplateUrl
():
msg
.
getUrl
());
dingtalkMsg
.
getLink
().
setPicUrl
(
"test"
);
req
.
setMsg
(
dingtalkMsg
);
}
else
{
//文本消息
dingtalkMsg
.
setMsgtype
(
"text"
);
OapiMessageCorpconversationAsyncsendV2Request
.
Text
obj2
=
new
OapiMessageCorpconversationAsyncsendV2Request
.
Text
();
obj2
.
setContent
(
StringUtils
.
isEmpty
(
msg
.
getContent
())?
template
.
getContent
():
msg
.
getContent
());
dingtalkMsg
.
setText
(
obj2
);
req
.
setMsg
(
dingtalkMsg
);
}
OapiMessageCorpconversationAsyncsendV2Response
rsp
=
client
.
execute
(
req
,
openAccess
.
getAccessToken
());
getResult
(
rsp
.
getBody
());
getResult
(
rsp
.
getBody
());
return
true
;
return
true
;
}
}
...
@@ -183,7 +187,7 @@ public class NotifyCoreService {
...
@@ -183,7 +187,7 @@ public class NotifyCoreService {
@SneakyThrows
@SneakyThrows
private
boolean
sendAliSms
(
String
tid
,
String
userId
,
Map
templParams
){
private
boolean
sendAliSms
(
String
tid
,
String
userId
,
Map
templParams
){
String
authUserId
=
getAuthUserId
(
userId
,
MsgType
.
aliyun
);
String
authUserId
=
getAuthUserId
(
userId
,
MsgType
.
aliyun
);
MsgTemplate
template
=
templateService
.
get
(
tid
);
MsgTemplate
template
=
templateService
.
get
ById
(
tid
);
MsgOpenAccess
openAccess
=
template
.
getOpenaccess
();
MsgOpenAccess
openAccess
=
template
.
getOpenaccess
();
String
region
=
openAccess
.
getRegionId
();
String
region
=
openAccess
.
getRegionId
();
String
accessKey
=
openAccess
.
getAccessKey
();
String
accessKey
=
openAccess
.
getAccessKey
();
...
@@ -215,7 +219,7 @@ public class NotifyCoreService {
...
@@ -215,7 +219,7 @@ public class NotifyCoreService {
private
boolean
sendAliEMail
(
String
tid
,
String
userId
){
private
boolean
sendAliEMail
(
String
tid
,
String
userId
){
String
authUserId
=
getAuthUserId
(
userId
,
MsgType
.
aliyun
);
String
authUserId
=
getAuthUserId
(
userId
,
MsgType
.
aliyun
);
MsgTemplate
template
=
templateService
.
get
(
tid
);
MsgTemplate
template
=
templateService
.
get
ById
(
tid
);
MsgOpenAccess
openAccess
=
template
.
getOpenaccess
();
MsgOpenAccess
openAccess
=
template
.
getOpenaccess
();
String
region
=
openAccess
.
getRegionId
();
String
region
=
openAccess
.
getRegionId
();
String
accessKey
=
openAccess
.
getAccessKey
();
String
accessKey
=
openAccess
.
getAccessKey
();
...
@@ -243,7 +247,7 @@ public class NotifyCoreService {
...
@@ -243,7 +247,7 @@ public class NotifyCoreService {
*/
*/
private
boolean
sendWeChatMsg
(
String
tid
,
String
userId
,
Map
templParams
){
private
boolean
sendWeChatMsg
(
String
tid
,
String
userId
,
Map
templParams
){
String
authUserId
=
getAuthUserId
(
userId
,
MsgType
.
wechat
);
String
authUserId
=
getAuthUserId
(
userId
,
MsgType
.
wechat
);
MsgTemplate
template
=
templateService
.
get
(
tid
);
MsgTemplate
template
=
templateService
.
get
ById
(
tid
);
MsgOpenAccess
openAccess
=
template
.
getOpenaccess
();
MsgOpenAccess
openAccess
=
template
.
getOpenaccess
();
Map
paramMap
=
new
HashMap
();
Map
paramMap
=
new
HashMap
();
paramMap
.
put
(
"template_id"
,
template
.
getTemplateId
());
paramMap
.
put
(
"template_id"
,
template
.
getTemplateId
());
...
@@ -491,4 +495,82 @@ public class NotifyCoreService {
...
@@ -491,4 +495,82 @@ public class NotifyCoreService {
return
useMsg
;
return
useMsg
;
}
}
/**
* 发送钉钉链接消息
* @return
*/
@SneakyThrows
public
Long
sendLinkMsg
(
Msg
msg
){
String
authUserId
=
getAuthUserId
(
msg
.
getUserids
(),
MsgType
.
dingtalk
);
MsgTemplate
template
=
templateService
.
getById
(
msg
.
getTemplateid
());
if
(
template
==
null
){
throw
new
BadRequestAlertException
(
String
.
format
(
"发送链接消息失败,无法获取到[%s]对应的rt模板"
,
msg
.
getTemplateid
()),
""
,
""
);
}
MsgOpenAccess
openAccess
=
template
.
getOpenaccess
();
OapiMessageCorpconversationAsyncsendV2Request
req
=
new
OapiMessageCorpconversationAsyncsendV2Request
();
req
.
setAgentId
(
Long
.
parseLong
(
template
.
getTemplateId
()));
req
.
setUseridList
(
authUserId
);
OapiMessageCorpconversationAsyncsendV2Request
.
Msg
dingtalkMsg
=
new
OapiMessageCorpconversationAsyncsendV2Request
.
Msg
();
dingtalkMsg
.
setMsgtype
(
"link"
);
dingtalkMsg
.
setLink
(
new
OapiMessageCorpconversationAsyncsendV2Request
.
Link
());
dingtalkMsg
.
getLink
().
setTitle
(
StringUtils
.
isEmpty
(
msg
.
getTitle
())?
template
.
getTemplateName
():
msg
.
getTitle
());
dingtalkMsg
.
getLink
().
setText
(
StringUtils
.
isEmpty
(
msg
.
getContent
())?
template
.
getContent
():
msg
.
getContent
());
dingtalkMsg
.
getLink
().
setMessageUrl
(
StringUtils
.
isEmpty
(
msg
.
getUrl
())?
template
.
getTemplateUrl
():
msg
.
getUrl
());
dingtalkMsg
.
getLink
().
setPicUrl
(
"test"
);
req
.
setMsg
(
dingtalkMsg
);
OapiMessageCorpconversationAsyncsendV2Response
rsp
=
sendMsgClient
.
execute
(
req
,
openAccess
.
getAccessToken
());
getResult
(
rsp
.
getBody
());
return
rsp
.
getTaskId
();
}
/**
* 建立待办
* @param msg
* @return
*/
@SneakyThrows
public
String
createWorkRecord
(
Msg
msg
){
String
authUserId
=
getAuthUserId
(
msg
.
getUserids
(),
MsgType
.
dingtalk
);
MsgTemplate
template
=
templateService
.
getById
(
msg
.
getTemplateid
());
if
(
template
==
null
){
throw
new
BadRequestAlertException
(
String
.
format
(
"创建待办失败,无法获取到[%s]对应的rt模板"
,
msg
.
getTemplateid
()),
""
,
""
);
}
MsgOpenAccess
openAccess
=
template
.
getOpenaccess
();
OapiWorkrecordAddRequest
req
=
new
OapiWorkrecordAddRequest
();
req
.
setUserid
(
authUserId
);
req
.
setCreateTime
(
new
Date
().
getTime
());
req
.
setTitle
(
StringUtils
.
isEmpty
(
msg
.
getTitle
())?
template
.
getTemplateName
():
msg
.
getTitle
());
req
.
setUrl
(
StringUtils
.
isEmpty
(
msg
.
getUrl
())?
template
.
getTemplateUrl
():
msg
.
getUrl
());
List
<
OapiWorkrecordAddRequest
.
FormItemVo
>
list2
=
new
ArrayList
<>();
OapiWorkrecordAddRequest
.
FormItemVo
obj3
=
new
OapiWorkrecordAddRequest
.
FormItemVo
();
list2
.
add
(
obj3
);
obj3
.
setTitle
(
StringUtils
.
isEmpty
(
msg
.
getTitle
())?
template
.
getTemplateName
():
msg
.
getTitle
());
obj3
.
setContent
(
StringUtils
.
isEmpty
(
msg
.
getContent
())?
template
.
getContent
():
msg
.
getContent
());
req
.
setFormItemList
(
list2
);
OapiWorkrecordAddResponse
rsp
=
createWorkRecordClient
.
execute
(
req
,
openAccess
.
getAccessToken
());
getResult
(
rsp
.
getBody
());
return
rsp
.
getRecordId
();
}
/**
* 完成待办
* @param msg
* @return
*/
@SneakyThrows
public
boolean
finishWorkRecord
(
Msg
msg
){
String
authUserId
=
getAuthUserId
(
msg
.
getUserids
(),
MsgType
.
dingtalk
);
MsgTemplate
template
=
templateService
.
getById
(
msg
.
getTemplateid
());
if
(
template
==
null
){
throw
new
BadRequestAlertException
(
String
.
format
(
"完成待办失败,无法获取到[%s]对应的rt模板"
,
msg
.
getTemplateid
()),
""
,
""
);
}
MsgOpenAccess
openAccess
=
template
.
getOpenaccess
();
OapiWorkrecordUpdateRequest
req
=
new
OapiWorkrecordUpdateRequest
();
req
.
setUserid
(
authUserId
);
req
.
setRecordId
(
msg
.
getRecordid
());
OapiWorkrecordUpdateResponse
rsp
=
finishWorkRecordClient
.
execute
(
req
,
openAccess
.
getAccessToken
());
getResult
(
rsp
.
getBody
());
return
rsp
.
getResult
();
}
}
}
This diff is collapsed.
Click to expand it.
ibznotify-provider/ibznotify-provider-api/src/main/java/cn/ibizlab/api/config/apiSecurityConfig.java
浏览文件 @
fb5969af
...
@@ -119,8 +119,13 @@ public class apiSecurityConfig extends WebSecurityConfigurerAdapter {
...
@@ -119,8 +119,13 @@ public class apiSecurityConfig extends WebSecurityConfigurerAdapter {
.
antMatchers
(
"/"
+
downloadpath
+
"/**"
).
permitAll
()
.
antMatchers
(
"/"
+
downloadpath
+
"/**"
).
permitAll
()
.
antMatchers
(
"/"
+
uploadpath
).
permitAll
()
.
antMatchers
(
"/"
+
uploadpath
).
permitAll
()
.
antMatchers
(
"/"
+
previewpath
+
"/**"
).
permitAll
()
.
antMatchers
(
"/"
+
previewpath
+
"/**"
).
permitAll
()
//消息发送请求
.
antMatchers
(
"/SendMsg"
).
permitAll
()
.
antMatchers
(
"/SendMsg"
).
permitAll
()
.
antMatchers
(
"/createMsgTemplate"
).
permitAll
()
.
antMatchers
(
"/createMsgTemplate"
).
permitAll
()
.
antMatchers
(
"/trade/pagepay"
).
permitAll
()
.
antMatchers
(
"/dingtalk/sendlinkmsg"
).
permitAll
()
.
antMatchers
(
"/dingtalk/createworkrecord"
).
permitAll
()
.
antMatchers
(
"/dingtalk/finishworkrecord"
).
permitAll
()
// 所有请求都需要认证
// 所有请求都需要认证
.
anyRequest
().
authenticated
()
.
anyRequest
().
authenticated
()
// 防止iframe 造成跨域
// 防止iframe 造成跨域
...
...
This diff is collapsed.
Click to expand it.
ibznotify-provider/ibznotify-provider-api/src/main/java/cn/ibizlab/api/rest/extensions/NotifyCoreResource.java
浏览文件 @
fb5969af
...
@@ -15,13 +15,50 @@ public class NotifyCoreResource {
...
@@ -15,13 +15,50 @@ public class NotifyCoreResource {
@Autowired
@Autowired
NotifyCoreService
notifyCoreService
;
NotifyCoreService
notifyCoreService
;
/**
* 发送工作流消息
* @param msg
* @return
*/
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/SendMsg"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/SendMsg"
)
public
ResponseEntity
<
Boolean
>
SendMsg
(
@Validated
@RequestBody
Msg
msg
){
public
ResponseEntity
<
Boolean
>
SendMsg
(
@Validated
@RequestBody
Msg
msg
){
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
notifyCoreService
.
sendMsg
(
msg
));
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
notifyCoreService
.
sendMsg
(
msg
));
}
}
/**
* 建立消息模板
* @param template
* @return
*/
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/createMsgTemplate"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/createMsgTemplate"
)
public
ResponseEntity
<
Boolean
>
createMsgTemplate
(
@Validated
@RequestBody
Template
template
){
public
ResponseEntity
<
Boolean
>
createMsgTemplate
(
@Validated
@RequestBody
Template
template
){
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
notifyCoreService
.
createMsgTemplate
(
template
));
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
notifyCoreService
.
createMsgTemplate
(
template
));
}
}
/**
* 发送钉钉链接消息
* @param msg
* @return
*/
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/dingtalk/sendlinkmsg"
)
public
ResponseEntity
<
Long
>
sendDingTalkLinkMsg
(
@RequestBody
Msg
msg
){
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
notifyCoreService
.
sendLinkMsg
(
msg
));
}
/**
* 创建钉钉待办
* @param msg
* @return
*/
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/dingtalk/createworkrecord"
)
public
ResponseEntity
<
String
>
createDingTalkWorkRecord
(
@RequestBody
Msg
msg
){
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
notifyCoreService
.
createWorkRecord
(
msg
));
}
/**
* 完成钉钉待办
* @param msg
* @return
*/
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/dingtalk/finishworkrecord"
)
public
ResponseEntity
<
Boolean
>
finishDingTalkWorkRecord
(
@RequestBody
Msg
msg
){
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
notifyCoreService
.
finishWorkRecord
(
msg
));
}
}
}
This diff is collapsed.
Click to expand it.
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录