diff --git a/escheduler-alert/pom.xml b/escheduler-alert/pom.xml
index ed3baa40f0..04c80ccf64 100644
--- a/escheduler-alert/pom.xml
+++ b/escheduler-alert/pom.xml
@@ -102,6 +102,17 @@
escheduler-dao
+
+ org.apache.httpcomponents
+ httpcore
+ 4.4.6
+
+
+ org.apache.httpcomponents
+ httpclient
+ 4.5.5
+
+
diff --git a/escheduler-alert/src/main/java/cn/escheduler/alert/utils/Constants.java b/escheduler-alert/src/main/java/cn/escheduler/alert/utils/Constants.java
index 1e1a7671e8..70136f3972 100644
--- a/escheduler-alert/src/main/java/cn/escheduler/alert/utils/Constants.java
+++ b/escheduler-alert/src/main/java/cn/escheduler/alert/utils/Constants.java
@@ -128,4 +128,16 @@ public class Constants {
public static final String TH_END = "";
public static final int ALERT_SCAN_INTERVEL = 5000;
+
+ public static final String ENTERPRISE_WECHAT_CORP_ID = "enterprise.wechat.corp.id";
+
+ public static final String ENTERPRISE_WECHAT_SECRET = "enterprise.wechat.secret";
+
+ public static final String ENTERPRISE_WECHAT_TOKEN_URL = "enterprise.wechat.token.url";
+
+ public static final String ENTERPRISE_WECHAT_PUSH_URL = "enterprise.wechat.push.url";
+
+ public static final String ENTERPRISE_WECHAT_TEAM_SEND_MSG = "enterprise.wechat.team.send.msg";
+
+ public static final String ENTERPRISE_WECHAT_USER_SEND_MSG = "enterprise.wechat.user.send.msg";
}
diff --git a/escheduler-alert/src/main/java/cn/escheduler/alert/utils/EnterpriseWeChatUtils.java b/escheduler-alert/src/main/java/cn/escheduler/alert/utils/EnterpriseWeChatUtils.java
new file mode 100644
index 0000000000..169977b01e
--- /dev/null
+++ b/escheduler-alert/src/main/java/cn/escheduler/alert/utils/EnterpriseWeChatUtils.java
@@ -0,0 +1,167 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cn.escheduler.alert.utils;
+
+import com.alibaba.fastjson.JSON;
+
+import com.google.common.reflect.TypeToken;
+import org.apache.http.HttpEntity;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.util.EntityUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.Map;
+
+import static cn.escheduler.alert.utils.PropertyUtils.getString;
+
+/**
+ * qiye weixin utils
+ */
+public class EnterpriseWeChatUtils {
+
+ public static final Logger logger = LoggerFactory.getLogger(EnterpriseWeChatUtils.class);
+
+ private static final String enterpriseWeChatCorpId = getString(Constants.ENTERPRISE_WECHAT_CORP_ID);
+
+ private static final String enterpriseWeChatSecret = getString(Constants.ENTERPRISE_WECHAT_SECRET);
+
+ private static final String enterpriseWeChatTokenUrl = getString(Constants.ENTERPRISE_WECHAT_TOKEN_URL);
+ private String enterpriseWeChatTokenUrlReplace = enterpriseWeChatTokenUrl
+ .replaceAll("\\$corpId", enterpriseWeChatCorpId)
+ .replaceAll("\\$secret", enterpriseWeChatSecret);
+
+ private static final String enterpriseWeChatPushUrl = getString(Constants.ENTERPRISE_WECHAT_PUSH_URL);
+
+ private static final String enterpriseWeChatTeamSendMsg = getString(Constants.ENTERPRISE_WECHAT_TEAM_SEND_MSG);
+
+ private static final String enterpriseWeChatUserSendMsg = getString(Constants.ENTERPRISE_WECHAT_USER_SEND_MSG);
+
+ /**
+ * get winxin token info
+ * @return token string info
+ * @throws IOException
+ */
+ public String getToken() throws IOException {
+ String resp;
+
+ CloseableHttpClient httpClient = HttpClients.createDefault();
+ HttpGet httpGet = new HttpGet(enterpriseWeChatTokenUrlReplace);
+ CloseableHttpResponse response = httpClient.execute(httpGet);
+ try {
+ HttpEntity entity = response.getEntity();
+ resp = EntityUtils.toString(entity, "utf-8");
+ EntityUtils.consume(entity);
+ } finally {
+ response.close();
+ }
+
+ Map map = JSON.parseObject(resp,
+ new TypeToken