Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
#法外狂徒张三
DolphinScheduler
提交
1d624172
DolphinScheduler
项目概览
#法外狂徒张三
/
DolphinScheduler
与 Fork 源项目一致
Fork自
apache / DolphinScheduler
通知
12
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
DolphinScheduler
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1d624172
编写于
5月 14, 2019
作者:
feloxx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Change name
上级
e76af959
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
46 addition
and
46 deletion
+46
-46
escheduler-alert/src/main/java/cn/escheduler/alert/utils/Constants.java
...rt/src/main/java/cn/escheduler/alert/utils/Constants.java
+6
-6
escheduler-alert/src/main/java/cn/escheduler/alert/utils/EnterpriseWeChatUtils.java
...java/cn/escheduler/alert/utils/EnterpriseWeChatUtils.java
+19
-19
escheduler-alert/src/main/resources/alert.properties
escheduler-alert/src/main/resources/alert.properties
+7
-7
escheduler-alert/src/test/java/cn/escheduler/alert/utils/EnterpriseWeChatUtilsTest.java
.../cn/escheduler/alert/utils/EnterpriseWeChatUtilsTest.java
+14
-14
未找到文件。
escheduler-alert/src/main/java/cn/escheduler/alert/utils/Constants.java
浏览文件 @
1d624172
...
...
@@ -127,15 +127,15 @@ public class Constants {
public
static
final
int
ALERT_SCAN_INTERVEL
=
5000
;
public
static
final
String
QIYE_WEIXIN_CORP_ID
=
"qiye.weixin
.corp.id"
;
public
static
final
String
ENTERPRISE_WECHAT_CORP_ID
=
"enterprise.wechat
.corp.id"
;
public
static
final
String
QIYE_WEIXIN_SECRET
=
"qiye.weixin
.secret"
;
public
static
final
String
ENTERPRISE_WECHAT_SECRET
=
"enterprise.wechat
.secret"
;
public
static
final
String
QIYE_WEIXIN_TOKEN_URL
=
"qiye.weixin
.token.url"
;
public
static
final
String
ENTERPRISE_WECHAT_TOKEN_URL
=
"enterprise.wechat
.token.url"
;
public
static
final
String
QIYE_WEIXIN_PUSH_URL
=
"qiye.weixin
.push.url"
;
public
static
final
String
ENTERPRISE_WECHAT_PUSH_URL
=
"enterprise.wechat
.push.url"
;
public
static
final
String
QIYE_WEIXIN_TEAM_SEND_MSG
=
"qiye.weixin
.team.send.msg"
;
public
static
final
String
ENTERPRISE_WECHAT_TEAM_SEND_MSG
=
"enterprise.wechat
.team.send.msg"
;
public
static
final
String
QIYE_WEIXIN_USER_SEND_MSG
=
"qiye.weixin
.user.send.msg"
;
public
static
final
String
ENTERPRISE_WECHAT_USER_SEND_MSG
=
"enterprise.wechat
.user.send.msg"
;
}
escheduler-alert/src/main/java/cn/escheduler/alert/utils/
QiyeWeixin
Utils.java
→
escheduler-alert/src/main/java/cn/escheduler/alert/utils/
EnterpriseWeChat
Utils.java
浏览文件 @
1d624172
...
...
@@ -39,24 +39,24 @@ import static cn.escheduler.alert.utils.PropertyUtils.getString;
/**
* qiye weixin utils
*/
public
class
QiyeWeixin
Utils
{
public
class
EnterpriseWeChat
Utils
{
public
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
QiyeWeixin
Utils
.
class
);
public
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
EnterpriseWeChat
Utils
.
class
);
private
static
final
String
qiyeWeixinCorpId
=
getString
(
Constants
.
QIYE_WEIXIN
_CORP_ID
);
private
static
final
String
enterpriseWeChatCorpId
=
getString
(
Constants
.
ENTERPRISE_WECHAT
_CORP_ID
);
private
static
final
String
qiyeWeixinSecret
=
getString
(
Constants
.
QIYE_WEIXIN
_SECRET
);
private
static
final
String
enterpriseWeChatSecret
=
getString
(
Constants
.
ENTERPRISE_WECHAT
_SECRET
);
private
static
final
String
qiyeWeixinTokenUrl
=
getString
(
Constants
.
QIYE_WEIXIN
_TOKEN_URL
);
private
String
qiyeWeixinTokenUrlReplace
=
qiyeWeixin
TokenUrl
.
replaceAll
(
"\\$
weixinCorpId"
,
qiyeWeixin
CorpId
)
.
replaceAll
(
"\\$
weixinSecret"
,
qiyeWeixin
Secret
);
private
static
final
String
enterpriseWeChatTokenUrl
=
getString
(
Constants
.
ENTERPRISE_WECHAT
_TOKEN_URL
);
private
String
enterpriseWeChatTokenUrlReplace
=
enterpriseWeChat
TokenUrl
.
replaceAll
(
"\\$
corpId"
,
enterpriseWeChat
CorpId
)
.
replaceAll
(
"\\$
secret"
,
enterpriseWeChat
Secret
);
private
static
final
String
qiyeWeixinPushUrl
=
getString
(
Constants
.
QIYE_WEIXIN
_PUSH_URL
);
private
static
final
String
enterpriseWeChatPushUrl
=
getString
(
Constants
.
ENTERPRISE_WECHAT
_PUSH_URL
);
private
static
final
String
qiyeWeixinTeamSendMsg
=
getString
(
Constants
.
QIYE_WEIXIN
_TEAM_SEND_MSG
);
private
static
final
String
enterpriseWeChatTeamSendMsg
=
getString
(
Constants
.
ENTERPRISE_WECHAT
_TEAM_SEND_MSG
);
private
static
final
String
qiyeWeixinUserSendMsg
=
getString
(
Constants
.
QIYE_WEIXIN
_USER_SEND_MSG
);
private
static
final
String
enterpriseWeChatUserSendMsg
=
getString
(
Constants
.
ENTERPRISE_WECHAT
_USER_SEND_MSG
);
/**
* get winxin token info
...
...
@@ -67,7 +67,7 @@ public class QiyeWeixinUtils {
String
resp
;
CloseableHttpClient
httpClient
=
HttpClients
.
createDefault
();
HttpGet
httpGet
=
new
HttpGet
(
qiyeWeixin
TokenUrlReplace
);
HttpGet
httpGet
=
new
HttpGet
(
enterpriseWeChat
TokenUrlReplace
);
CloseableHttpResponse
response
=
httpClient
.
execute
(
httpGet
);
try
{
HttpEntity
entity
=
response
.
getEntity
();
...
...
@@ -91,7 +91,7 @@ public class QiyeWeixinUtils {
* @return weixin send message
*/
public
String
makeTeamSendMsg
(
String
toParty
,
String
agentId
,
String
msg
)
{
return
qiyeWeixin
TeamSendMsg
.
replaceAll
(
"\\$toParty"
,
toParty
)
return
enterpriseWeChat
TeamSendMsg
.
replaceAll
(
"\\$toParty"
,
toParty
)
.
replaceAll
(
"\\$agentId"
,
agentId
)
.
replaceAll
(
"\\$msg"
,
msg
);
}
...
...
@@ -105,7 +105,7 @@ public class QiyeWeixinUtils {
*/
public
String
makeTeamSendMsg
(
Collection
<
String
>
toParty
,
String
agentId
,
String
msg
)
{
String
listParty
=
FuncUtils
.
mkString
(
toParty
,
"|"
);
return
qiyeWeixin
TeamSendMsg
.
replaceAll
(
"\\$toParty"
,
listParty
)
return
enterpriseWeChat
TeamSendMsg
.
replaceAll
(
"\\$toParty"
,
listParty
)
.
replaceAll
(
"\\$agentId"
,
agentId
)
.
replaceAll
(
"\\$msg"
,
msg
);
}
...
...
@@ -118,7 +118,7 @@ public class QiyeWeixinUtils {
* @return weixin send message
*/
public
String
makeUserSendMsg
(
String
toUser
,
String
agentId
,
String
msg
)
{
return
qiyeWeixin
UserSendMsg
.
replaceAll
(
"\\$toUser"
,
toUser
)
return
enterpriseWeChat
UserSendMsg
.
replaceAll
(
"\\$toUser"
,
toUser
)
.
replaceAll
(
"\\$agentId"
,
agentId
)
.
replaceAll
(
"\\$msg"
,
msg
);
}
...
...
@@ -132,7 +132,7 @@ public class QiyeWeixinUtils {
*/
public
String
makeUserSendMsg
(
Collection
<
String
>
toUser
,
String
agentId
,
String
msg
)
{
String
listUser
=
FuncUtils
.
mkString
(
toUser
,
"|"
);
return
qiyeWeixin
UserSendMsg
.
replaceAll
(
"\\$toUser"
,
listUser
)
return
enterpriseWeChat
UserSendMsg
.
replaceAll
(
"\\$toUser"
,
listUser
)
.
replaceAll
(
"\\$agentId"
,
agentId
)
.
replaceAll
(
"\\$msg"
,
msg
);
}
...
...
@@ -146,10 +146,10 @@ public class QiyeWeixinUtils {
* @throws IOException
*/
public
String
sendQiyeWeixin
(
String
charset
,
String
data
,
String
token
)
throws
IOException
{
String
qiyeWeixinPushUrlReplace
=
qiyeWeixinPushUrl
.
replaceAll
(
"\\$weixinT
oken"
,
token
);
String
enterpriseWeChatPushUrlReplace
=
enterpriseWeChatPushUrl
.
replaceAll
(
"\\$t
oken"
,
token
);
CloseableHttpClient
httpclient
=
HttpClients
.
createDefault
();
HttpPost
httpPost
=
new
HttpPost
(
qiyeWeixin
PushUrlReplace
);
HttpPost
httpPost
=
new
HttpPost
(
enterpriseWeChat
PushUrlReplace
);
httpPost
.
setEntity
(
new
StringEntity
(
data
,
charset
));
CloseableHttpResponse
response
=
httpclient
.
execute
(
httpPost
);
String
resp
;
...
...
@@ -160,7 +160,7 @@ public class QiyeWeixinUtils {
}
finally
{
response
.
close
();
}
logger
.
info
(
"qiye weixin send [{}], param:{}, resp:{}"
,
qiyeWeixin
PushUrl
,
data
,
resp
);
logger
.
info
(
"qiye weixin send [{}], param:{}, resp:{}"
,
enterpriseWeChat
PushUrl
,
data
,
resp
);
return
resp
;
}
...
...
escheduler-alert/src/main/resources/alert.properties
浏览文件 @
1d624172
...
...
@@ -11,13 +11,13 @@ mail.passwd=xxxxxxx
#xls file path,need create if not exist
xls.file.path
=
/opt/xls
#
qiye weixin
configuration
qiye.weixin
.corp.id
=
xxxxxxx
qiye.weixin
.secret
=
xxxxxxx
qiye.weixin.token.url
=
https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=$weixinCorpId&corpsecret=$weixinS
ecret
qiye.weixin.push.url
=
https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=$weixinT
oken
qiye.weixin
.team.send.msg
=
{
\"
toparty
\"
:
\"
$toParty
\"
,
\"
agentid
\"
:
\"
$agentId
\"
,
\"
msgtype
\"
:
\"
text
\"
,
\"
text
\"
:{
\"
content
\"
:
\"
$msg
\"
},
\"
safe
\"
:
\"
0
\"
}
qiye.weixin
.user.send.msg
=
{
\"
touser
\"
:
\"
$toUser
\"
,
\"
agentid
\"
:
\"
$agentId
\"
,
\"
msgtype
\"
:
\"
text
\"
,
\"
text
\"
:{
\"
content
\"
:
\"
$msg
\"
},
\"
safe
\"
:
\"
0
\"
}
#
Enterprise WeChat
configuration
enterprise.wechat
.corp.id
=
xxxxxxx
enterprise.wechat
.secret
=
xxxxxxx
enterprise.wechat.token.url
=
https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=$corpId&corpsecret=$s
ecret
enterprise.wechat.push.url
=
https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=$t
oken
enterprise.wechat
.team.send.msg
=
{
\"
toparty
\"
:
\"
$toParty
\"
,
\"
agentid
\"
:
\"
$agentId
\"
,
\"
msgtype
\"
:
\"
text
\"
,
\"
text
\"
:{
\"
content
\"
:
\"
$msg
\"
},
\"
safe
\"
:
\"
0
\"
}
enterprise.wechat
.user.send.msg
=
{
\"
touser
\"
:
\"
$toUser
\"
,
\"
agentid
\"
:
\"
$agentId
\"
,
\"
msgtype
\"
:
\"
text
\"
,
\"
text
\"
:{
\"
content
\"
:
\"
$msg
\"
},
\"
safe
\"
:
\"
0
\"
}
escheduler-alert/src/test/java/cn/escheduler/alert/utils/
QiyeWeixin
UtilsTest.java
→
escheduler-alert/src/test/java/cn/escheduler/alert/utils/
EnterpriseWeChat
UtilsTest.java
浏览文件 @
1d624172
...
...
@@ -28,13 +28,13 @@ import java.util.Collection;
/**
* Please manually modify the configuration file before testing.
* file: alert.properties
*
qiye.weixin
.corp.id
*
qiye.weixin
.secret
*
qiye.weixin
.token.url
*
qiye.weixin
.push.url
*
qiye.weixin
.send.msg
*
enterprise.wechat
.corp.id
*
enterprise.wechat
.secret
*
enterprise.wechat
.token.url
*
enterprise.wechat
.push.url
*
enterprise.wechat
.send.msg
*/
public
class
QiyeWeixin
UtilsTest
{
public
class
EnterpriseWeChat
UtilsTest
{
// Please change
private
String
agentId
=
"1000002"
;
// app id
...
...
@@ -44,8 +44,8 @@ public class QiyeWeixinUtilsTest {
private
Collection
<
String
>
listUserId
=
Arrays
.
asList
(
"test1"
,
"test2"
);
@Test
public
void
testSendSingleTeamWe
ixin
()
{
QiyeWeixinUtils
wx
=
new
QiyeWeixin
Utils
();
public
void
testSendSingleTeamWe
Chat
()
{
EnterpriseWeChatUtils
wx
=
new
EnterpriseWeChat
Utils
();
try
{
String
token
=
wx
.
getToken
();
...
...
@@ -60,8 +60,8 @@ public class QiyeWeixinUtilsTest {
}
@Test
public
void
testSendMultiTeamWe
ixin
()
{
QiyeWeixinUtils
wx
=
new
QiyeWeixin
Utils
();
public
void
testSendMultiTeamWe
Chat
()
{
EnterpriseWeChatUtils
wx
=
new
EnterpriseWeChat
Utils
();
try
{
String
token
=
wx
.
getToken
();
...
...
@@ -76,8 +76,8 @@ public class QiyeWeixinUtilsTest {
}
@Test
public
void
testSendSingleUserWe
ixin
()
{
QiyeWeixinUtils
wx
=
new
QiyeWeixin
Utils
();
public
void
testSendSingleUserWe
Chat
()
{
EnterpriseWeChatUtils
wx
=
new
EnterpriseWeChat
Utils
();
try
{
String
token
=
wx
.
getToken
();
...
...
@@ -92,8 +92,8 @@ public class QiyeWeixinUtilsTest {
}
@Test
public
void
testSendMultiUserWe
ixin
()
{
QiyeWeixinUtils
wx
=
new
QiyeWeixin
Utils
();
public
void
testSendMultiUserWe
Chat
()
{
EnterpriseWeChatUtils
wx
=
new
EnterpriseWeChat
Utils
();
try
{
String
token
=
wx
.
getToken
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录