| | |
| | | package org.springblade.common.utils; |
| | | |
| | | import liquibase.repackaged.org.apache.commons.lang3.text.StrSubstitutor; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | |
| | | import java.io.OutputStreamWriter; |
| | | import java.net.HttpURLConnection; |
| | | import java.net.URL; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | public class SmsUtils { |
| | | |
| | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | public static void send(String phone, Map<String, String> content) { |
| | | |
| | | StrSubstitutor strSubstitutor = new StrSubstitutor(content); |
| | | String url3 = "【上饶基层自治】您正在验证投票操作,验证码:${code}。如非本人操作,则密码可能已泄露,建议立即修改密码或联系客服。"; |
| | | String context3 = strSubstitutor.replace(url3); |
| | | String MAS_ID = "182"; |
| | | String PASSWORD = "bYcLgYwXOZspDzEnaGsNHAGUykKEiexknHY9H98xVTQ8Zbeya8bexQ=="; |
| | | String reqXML = buildRequestXMLString(MAS_ID, PASSWORD, "", phone, context3); |
| | | postXMLSendSMSRequest("http://218.204.110.232:8080/emc/HttpSendSMSService", reqXML); |
| | | } |
| | | |
| | | /** |
| | | * @param args |
| | | */ |
| | |
| | | //下面的MAS_ID、PASSWORD仅供测试使用,正式使用由移动公司分配 |
| | | String MAS_ID = "182"; |
| | | String PASSWORD = "bYcLgYwXOZspDzEnaGsNHAGUykKEiexknHY9H98xVTQ8Zbeya8bexQ=="; |
| | | // Map map = new HashMap<>(); |
| | | // map.put("ip", "127.0.0.1"); |
| | | // map.put("port", "3306"); |
| | | // map.put("tenantCode", "test001"); |
| | | // StrSubstitutor strSubstitutor = new StrSubstitutor(map); |
| | | // String url3 = "jdbc:mysql://${ip}:${port}/${tenantCode}?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Shanghai"; |
| | | // String context3 = strSubstitutor.replace(url3); |
| | | // System.out.println(context3); |
| | | |
| | | // String reqXML = buildRequestXMLString(MAS_ID, PASSWORD, "", "18720768376", "测试短信"); |
| | | |
| | | // postXMLSendSMSRequest("http://218.204.110.232:8080/emc/HttpSendSMSService", reqXML); |
| | | String reqXML = buildRequestXMLString(MAS_ID, PASSWORD, "", "18720768376", "测试短信"); |
| | | postXMLSendSMSRequest("http://218.204.110.232:8080/emc/HttpSendSMSService", reqXML); |
| | | } |
| | | } |
| | | |