主要代码类如下
package com.test.common;
import java.io.IOException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map;
import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; 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.json.JSONObject;
/*
- 文件名:com.test.common;.SendRobotMsgUtils.java
- 简述:TODO
- 详述:
- 新建时间:2022年5月2日 下午12:31:41
- 修改内容:[新增]
- 修改时间:2022年5月2日 下午12:31:41
- 版本:1.0
- / public class SendRobotMsgUtils {
@SuppressWarnings({ "rawtypes", "unchecked" })
public boolean wechatRobotTxtMsg(String webhookUrl,String msgContent,List<String> mentioned_mobile_list) {
boolean falg=false;
//webhook地址
String msgtype="text";
HttpResponse response=null;
try {
if(webhookUrl!=null&&msgContent!=null) {
HttpPost httpPost=new HttpPost(webhookUrl);
CloseableHttpClient httpclient=HttpClients.createDefault();
httpPo