|
|
@@ -2,11 +2,14 @@ package com.zd.laboratory.utils;
|
|
|
|
|
|
import cn.hutool.http.HttpRequest;
|
|
|
import cn.hutool.http.HttpResponse;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.zd.common.core.utils.HttpUtils;
|
|
|
import com.zd.common.core.utils.MD5Utils;
|
|
|
import com.zd.laboratory.domain.vo.IotTextMessageVo;
|
|
|
+import lombok.Data;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.http.HttpStatus;
|
|
|
|
|
|
import java.time.ZonedDateTime;
|
|
|
@@ -18,6 +21,7 @@ import java.util.List;
|
|
|
* @Date 2024-02-05
|
|
|
* @description 短信发送类
|
|
|
**/
|
|
|
+@Slf4j(topic = "TextMessageUtils")
|
|
|
public class TextMessageUtils {
|
|
|
|
|
|
//将长链接转换成短链
|
|
|
@@ -234,6 +238,7 @@ public class TextMessageUtils {
|
|
|
* @return
|
|
|
*/
|
|
|
public static JSONObject sendMessageTemp(String userName,String passWord,String signature,String tpId,List<String> phoneList,List<IotTextMessageVo> variableList){
|
|
|
+ log.info("sendMessageTemp begins,userName:{},passWord:{},signature:{},tpId:{},phoneList:{},variableList:{}",userName,passWord,signature,tpId,phoneList, JSON.toJSONString(variableList));
|
|
|
JSONObject jsonObject=getCommon(userName,passWord);
|
|
|
jsonObject.put("tpId",tpId);
|
|
|
jsonObject.put("signature",signature);
|
|
|
@@ -264,6 +269,7 @@ public class TextMessageUtils {
|
|
|
});
|
|
|
jsonObject.put("records",jsonArray);
|
|
|
String data=HttpUtils.sendPost(SEND_TEMPLATE_URL,jsonObject.toJSONString(),JSON_TYPE);
|
|
|
+ log.info("sendMessageTemp end,reponse:{}",data);
|
|
|
return JSONObject.parseObject(data);
|
|
|
}
|
|
|
|
|
|
@@ -287,6 +293,7 @@ public class TextMessageUtils {
|
|
|
* @return
|
|
|
*/
|
|
|
public static JSONObject sendMessageVoice(String userName,String passWord,String content,List<String> phoneList){
|
|
|
+ log.info("sendMessageVoice begins,userName:{},passWord:{},content:{},phoneList:{}",userName,passWord,content,phoneList);
|
|
|
JSONObject jsonObject=new JSONObject();
|
|
|
jsonObject.put("content",content);
|
|
|
String phoneStr="";
|
|
|
@@ -302,7 +309,8 @@ public class TextMessageUtils {
|
|
|
.header("Content-Type", "application/json")
|
|
|
.charset("utf-8")
|
|
|
.execute();
|
|
|
- System.out.println(reponse.toString());
|
|
|
+
|
|
|
+ log.info("sendMessageVoice end,reponse:{}",reponse.toString());
|
|
|
return JSONObject.parseObject(reponse.body());
|
|
|
}
|
|
|
|