REQ-3872: 通过post发送短信

This commit is contained in:
yanglin 2025-03-18 09:46:02 +08:00
parent f8e5a88240
commit f4fb56acd4

View File

@ -1,20 +1,22 @@
package cn.axzo.msg.center.notices.integration.client.impl;
import java.util.Map;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Configuration;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Maps;
import cn.hutool.core.net.URLEncoder;
import cn.hutool.core.util.BooleanUtil;
import cn.hutool.core.util.CharsetUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Maps;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Configuration;
import java.util.Map;
/**
* 信息中心短信服务组件
@ -100,7 +102,7 @@ public class RegulatoryGaoxinClient {
param.put("Pwd", pwd);
param.put("Mobile", phone);
param.put("Content", encodeContent);
return HttpUtil.toParams(param);
return JSON.toJSONString(param);
}
/**
@ -111,13 +113,13 @@ public class RegulatoryGaoxinClient {
private String executeSend(String param) {
try {
//构建url
String requestUrl = this.createUrl(param);
//String requestUrl = this.createUrl(param);
log.info("发送政务短信请求: {}", requestUrl);
log.info("发送政务短信请求, url={}, body={}", url, param);
//执行请求
String result = HttpUtil.post(
requestUrl, StrUtil.EMPTY_JSON
url, param
);
//打印发送结果