钉钉群消息提醒工具类
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson.JSON;
import com.google.common.collect.Maps;
import org.apache.commons.lang3.StringUtils;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.Map;
public class DingAlertUtil {
public static final String WEBHOOK = "";
public static final String SECRET = "";
public static void alertDingMsg(String msg) {
sendText(WEBHOOK, SECRET, msg);
}
public static HttpResponse sendText(String webhook, String secret, String content) {
//get url
String url = webhook;
if (StringUtils.isNotBlank(secret)) {
long timestamp = System.currentTimeMillis();
url = webhook + String.format("×tamp=%s&sign=%s", timestamp, getSign(timestamp, secret));
}
//get bod