Loading dolphinscheduler-alert/pom.xml +0 −5 Original line number Diff line number Diff line Loading @@ -66,11 +66,6 @@ <artifactId>commons-email</artifactId> </dependency> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-core</artifactId> Loading dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/template/impl/DefaultHTMLTemplate.java +6 −11 Original line number Diff line number Diff line Loading @@ -16,13 +16,15 @@ */ package org.apache.dolphinscheduler.alert.template.impl; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ArrayNode; import org.apache.dolphinscheduler.alert.template.AlertTemplate; import org.apache.dolphinscheduler.alert.utils.Constants; import org.apache.dolphinscheduler.alert.utils.JSONUtils; import org.apache.dolphinscheduler.common.enums.ShowType; import org.apache.dolphinscheduler.common.utils.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.apache.dolphinscheduler.common.utils.*; import java.util.*; Loading Loading @@ -107,18 +109,11 @@ public class DefaultHTMLTemplate implements AlertTemplate { private String getTextTypeMessage(String content,boolean showAll){ if (StringUtils.isNotEmpty(content)){ List<String> list; try { list = JSONUtils.toList(content,String.class); }catch (Exception e){ logger.error("json format exception",e); return null; } ArrayNode list = JSONUtils.parseArray(content); StringBuilder contents = new StringBuilder(100); for (String str : list){ for (JsonNode jsonNode : list){ contents.append(Constants.TR); contents.append(Constants.TD).append(str).append(Constants.TD_END); contents.append(Constants.TD).append(jsonNode.toString()).append(Constants.TD_END); contents.append(Constants.TR_END); } Loading dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/DingTalkUtils.java +2 −2 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ package org.apache.dolphinscheduler.alert.utils; import com.alibaba.fastjson.JSON; import org.apache.dolphinscheduler.common.utils.*; import org.apache.commons.codec.binary.StringUtils; import org.apache.http.HttpEntity; import org.apache.http.HttpHost; Loading Loading @@ -129,7 +129,7 @@ public class DingTalkUtils { textContent.put("content", txt); items.put("text", textContent); return JSON.toJSONString(items); return JSONUtils.toJsonString(items); } Loading dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/EnterpriseWeChatUtils.java +44 −33 Original line number Diff line number Diff line Loading @@ -18,9 +18,8 @@ package org.apache.dolphinscheduler.alert.utils; import org.apache.dolphinscheduler.common.enums.ShowType; import org.apache.dolphinscheduler.common.utils.StringUtils; import com.alibaba.fastjson.JSON; import org.apache.dolphinscheduler.common.utils.*; import com.google.common.reflect.TypeToken; import org.apache.dolphinscheduler.plugin.model.AlertData; import org.apache.http.HttpEntity; import org.apache.http.client.methods.CloseableHttpResponse; Loading Loading @@ -64,6 +63,7 @@ public class EnterpriseWeChatUtils { /** * get Enterprise WeChat is enable * * @return isEnable */ public static boolean isEnable() { Loading @@ -81,6 +81,7 @@ public class EnterpriseWeChatUtils { /** * get Enterprise WeChat token info * * @return token string info * @throws IOException the IOException */ Loading @@ -99,10 +100,12 @@ public class EnterpriseWeChatUtils { response.close(); } Map<String, Object> map = JSON.parseObject(resp, new TypeToken<Map<String, Object>>() { }.getType()); return map.get("access_token").toString(); Map<String, String> map = JSONUtils.toMap(resp); if (map != null) { return map.get("access_token"); } else { return null; } } finally { httpClient.close(); } Loading @@ -110,6 +113,7 @@ public class EnterpriseWeChatUtils { /** * make team single Enterprise WeChat message * * @param toParty the toParty * @param agentId the agentId * @param msg the msg Loading @@ -123,6 +127,7 @@ public class EnterpriseWeChatUtils { /** * make team multi Enterprise WeChat message * * @param toParty the toParty * @param agentId the agentId * @param msg the msg Loading @@ -137,6 +142,7 @@ public class EnterpriseWeChatUtils { /** * make team single user message * * @param toUser the toUser * @param agentId the agentId * @param msg the msg Loading @@ -150,6 +156,7 @@ public class EnterpriseWeChatUtils { /** * make team multi user message * * @param toUser the toUser * @param agentId the agentId * @param msg the msg Loading @@ -164,6 +171,7 @@ public class EnterpriseWeChatUtils { /** * send Enterprise WeChat * * @param charset the charset * @param data the data * @param token the token Loading Loading @@ -196,6 +204,7 @@ public class EnterpriseWeChatUtils { /** * convert table to markdown style * * @param title the title * @param content the content * @return markdown table content Loading Loading @@ -225,6 +234,7 @@ public class EnterpriseWeChatUtils { /** * convert text to markdown style * * @param title the title * @param content the content * @return markdown text Loading Loading @@ -255,6 +265,7 @@ public class EnterpriseWeChatUtils { /** * Determine the mardown style based on the show type of the alert * * @return the markdown alert table/text */ public static String markdownByAlert(AlertData alert) { Loading dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/ExcelUtils.java +1 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.util.*; import org.apache.dolphinscheduler.common.utils.*; /** * excel utils Loading Loading
dolphinscheduler-alert/pom.xml +0 −5 Original line number Diff line number Diff line Loading @@ -66,11 +66,6 @@ <artifactId>commons-email</artifactId> </dependency> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-core</artifactId> Loading
dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/template/impl/DefaultHTMLTemplate.java +6 −11 Original line number Diff line number Diff line Loading @@ -16,13 +16,15 @@ */ package org.apache.dolphinscheduler.alert.template.impl; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ArrayNode; import org.apache.dolphinscheduler.alert.template.AlertTemplate; import org.apache.dolphinscheduler.alert.utils.Constants; import org.apache.dolphinscheduler.alert.utils.JSONUtils; import org.apache.dolphinscheduler.common.enums.ShowType; import org.apache.dolphinscheduler.common.utils.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.apache.dolphinscheduler.common.utils.*; import java.util.*; Loading Loading @@ -107,18 +109,11 @@ public class DefaultHTMLTemplate implements AlertTemplate { private String getTextTypeMessage(String content,boolean showAll){ if (StringUtils.isNotEmpty(content)){ List<String> list; try { list = JSONUtils.toList(content,String.class); }catch (Exception e){ logger.error("json format exception",e); return null; } ArrayNode list = JSONUtils.parseArray(content); StringBuilder contents = new StringBuilder(100); for (String str : list){ for (JsonNode jsonNode : list){ contents.append(Constants.TR); contents.append(Constants.TD).append(str).append(Constants.TD_END); contents.append(Constants.TD).append(jsonNode.toString()).append(Constants.TD_END); contents.append(Constants.TR_END); } Loading
dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/DingTalkUtils.java +2 −2 Original line number Diff line number Diff line Loading @@ -17,7 +17,7 @@ package org.apache.dolphinscheduler.alert.utils; import com.alibaba.fastjson.JSON; import org.apache.dolphinscheduler.common.utils.*; import org.apache.commons.codec.binary.StringUtils; import org.apache.http.HttpEntity; import org.apache.http.HttpHost; Loading Loading @@ -129,7 +129,7 @@ public class DingTalkUtils { textContent.put("content", txt); items.put("text", textContent); return JSON.toJSONString(items); return JSONUtils.toJsonString(items); } Loading
dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/EnterpriseWeChatUtils.java +44 −33 Original line number Diff line number Diff line Loading @@ -18,9 +18,8 @@ package org.apache.dolphinscheduler.alert.utils; import org.apache.dolphinscheduler.common.enums.ShowType; import org.apache.dolphinscheduler.common.utils.StringUtils; import com.alibaba.fastjson.JSON; import org.apache.dolphinscheduler.common.utils.*; import com.google.common.reflect.TypeToken; import org.apache.dolphinscheduler.plugin.model.AlertData; import org.apache.http.HttpEntity; import org.apache.http.client.methods.CloseableHttpResponse; Loading Loading @@ -64,6 +63,7 @@ public class EnterpriseWeChatUtils { /** * get Enterprise WeChat is enable * * @return isEnable */ public static boolean isEnable() { Loading @@ -81,6 +81,7 @@ public class EnterpriseWeChatUtils { /** * get Enterprise WeChat token info * * @return token string info * @throws IOException the IOException */ Loading @@ -99,10 +100,12 @@ public class EnterpriseWeChatUtils { response.close(); } Map<String, Object> map = JSON.parseObject(resp, new TypeToken<Map<String, Object>>() { }.getType()); return map.get("access_token").toString(); Map<String, String> map = JSONUtils.toMap(resp); if (map != null) { return map.get("access_token"); } else { return null; } } finally { httpClient.close(); } Loading @@ -110,6 +113,7 @@ public class EnterpriseWeChatUtils { /** * make team single Enterprise WeChat message * * @param toParty the toParty * @param agentId the agentId * @param msg the msg Loading @@ -123,6 +127,7 @@ public class EnterpriseWeChatUtils { /** * make team multi Enterprise WeChat message * * @param toParty the toParty * @param agentId the agentId * @param msg the msg Loading @@ -137,6 +142,7 @@ public class EnterpriseWeChatUtils { /** * make team single user message * * @param toUser the toUser * @param agentId the agentId * @param msg the msg Loading @@ -150,6 +156,7 @@ public class EnterpriseWeChatUtils { /** * make team multi user message * * @param toUser the toUser * @param agentId the agentId * @param msg the msg Loading @@ -164,6 +171,7 @@ public class EnterpriseWeChatUtils { /** * send Enterprise WeChat * * @param charset the charset * @param data the data * @param token the token Loading Loading @@ -196,6 +204,7 @@ public class EnterpriseWeChatUtils { /** * convert table to markdown style * * @param title the title * @param content the content * @return markdown table content Loading Loading @@ -225,6 +234,7 @@ public class EnterpriseWeChatUtils { /** * convert text to markdown style * * @param title the title * @param content the content * @return markdown text Loading Loading @@ -255,6 +265,7 @@ public class EnterpriseWeChatUtils { /** * Determine the mardown style based on the show type of the alert * * @return the markdown alert table/text */ public static String markdownByAlert(AlertData alert) { Loading
dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/ExcelUtils.java +1 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.util.*; import org.apache.dolphinscheduler.common.utils.*; /** * excel utils Loading