first commit

This commit is contained in:
Ray
2026-02-19 03:37:37 +08:00
commit ccfd8c79a4
2813 changed files with 453657 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
package com.chuanglan.sms.request;
public class SmsBalanceRequest {
/**
* 用户账号,必填
*/
private String account;
/**
* 用户密码,必填
*/
private String password;
public SmsBalanceRequest() {
}
public SmsBalanceRequest(String account, String password) {
super();
this.account = account;
this.password = password;
}
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}

View File

@@ -0,0 +1,48 @@
package com.chuanglan.sms.request;
public class SmsPullRequest {
/**
* 用户账号,必填
*/
private String account;
/**
* 用户密码,必填
*/
private String password;
/**
* 拉取个数最大100默认20选填
*/
private String count;
public SmsPullRequest() {
}
public SmsPullRequest(String account, String password,String count) {
super();
this.account = account;
this.password = password;
this.count = count;
}
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getCount() {
return count;
}
public void setCount(String count) {
this.count = count;
}
}

View File

@@ -0,0 +1,48 @@
package com.chuanglan.sms.request;
public class SmsReportRequest {
/**
* 用户账号,必填
*/
private String account;
/**
* 用户密码,必填
*/
private String password;
/**
* 拉取个数最大100默认20选填
*/
private String count;
public SmsReportRequest() {
}
public SmsReportRequest(String account, String password,String count) {
super();
this.account = account;
this.password = password;
this.count = count;
}
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getCount() {
return count;
}
public void setCount(String count) {
this.count = count;
}
}

View File

@@ -0,0 +1,127 @@
package com.chuanglan.sms.request;
public class SmsSendRequest {
/**
* 用户账号,必填
*/
private String account;
/**
* 用户密码,必填
*/
private String password;
/**
* 短信内容。长度不能超过536个字符必填
*/
private String msg;
/**
* 机号码。多个手机号码使用英文逗号分隔,必填
*/
private String phone;
/**
* 定时发送短信时间。格式为yyyyMMddHHmm值小于或等于当前时间则立即发送默认立即发送选填
*/
private String sendtime;
/**
* 是否需要状态报告默认false选填
*/
private String report;
/**
* 下发短信号码扩展码纯数字建议1-3位选填
*/
private String extend;
/**
* 该条短信在您业务系统内的ID如订单号或者短信发送记录流水号选填
*/
private String uid;
public SmsSendRequest() {
}
public SmsSendRequest(String account, String password, String msg, String phone) {
super();
this.account = account;
this.password = password;
this.msg = msg;
this.phone = phone;
}
public SmsSendRequest(String account, String password, String msg, String phone, String report) {
super();
this.account = account;
this.password = password;
this.msg = msg;
this.phone = phone;
this.report=report;
}
public SmsSendRequest(String account, String password, String msg, String phone, String report,String sendtime) {
super();
this.account = account;
this.password = password;
this.msg = msg;
this.phone = phone;
this.sendtime=sendtime;
this.report=report;
}
public SmsSendRequest(String account, String password, String msg, String phone, String sendtime,String report,String uid) {
super();
this.account = account;
this.password = password;
this.msg = msg;
this.phone = phone;
this.sendtime=sendtime;
this.report=report;
this.uid=uid;
}
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getSendtime() {
return sendtime;
}
public void setSendtime(String sendtime) {
this.sendtime = sendtime;
}
public String getReport() {
return report;
}
public void setReport(String report) {
this.report = report;
}
public String getExtend() {
return extend;
}
public void setExtend(String extend) {
this.extend = extend;
}
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
}

View File

@@ -0,0 +1,118 @@
package com.chuanglan.sms.request;
/**
* @Description:变量短信发送实体类
*/
public class SmsVariableRequest {
/**
* 用户账号,必填
*/
private String account;
/**
* 用户密码,必填
*/
private String password;
/**
* 短信内容。长度不能超过536个字符必填
*/
private String msg;
/**
* 手机号码和变量参数,多组参数使用英文分号;区分,必填
*/
private String params;
/**
* 定时发送短信时间。格式为yyyyMMddHHmm值小于或等于当前时间则立即发送默认立即发送选填
*/
private String sendtime;
/**
* 是否需要状态报告默认false选填
*/
private String report;
/**
* 下发短信号码扩展码纯数字建议1-3位选填
*/
private String extend;
/**
* 该条短信在您业务系统内的ID如订单号或者短信发送记录流水号选填
*/
private String uid;
public SmsVariableRequest() {
}
public SmsVariableRequest(String account, String password, String msg, String params) {
super();
this.account = account;
this.password = password;
this.msg = msg;
this.params = params;
}
public SmsVariableRequest(String account, String password, String msg, String params, String report) {
super();
this.account = account;
this.password = password;
this.msg = msg;
this.params = params;
this.report = report;
}
// public SmsVarableRequest(String account, String password, String msg, String params, String sendtime) {
// super();
// this.account = account;
// this.password = password;
// this.msg = msg;
// this.params = params;
// this.sendtime = sendtime;
// }
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public String getSendtime() {
return sendtime;
}
public void setSendtime(String sendtime) {
this.sendtime = sendtime;
}
public String getReport() {
return report;
}
public void setReport(String report) {
this.report = report;
}
public String getExtend() {
return extend;
}
public void setExtend(String extend) {
this.extend = extend;
}
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
public String getParams() {
return params;
}
public void setParams(String params) {
this.params = params;
}
}

View File

@@ -0,0 +1,58 @@
package com.chuanglan.sms.response;
/**
* @Description:账号余额响应实体类
*/
public class SmsBalanceResponse {
/**
* 响应时间
*/
private String time;
/**
* 消息id
*/
private String balance;
/**
* 状态码说明(成功返回空)
*/
private String errorMsg;
/**
* 状态码(详细参考提交响应状态码)
*/
private String code;
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public String getBalance() {
return balance;
}
public void setBalance(String balance) {
this.balance = balance;
}
public String getErrorMsg() {
return errorMsg;
}
public void setErrorMsg(String errorMsg) {
this.errorMsg = errorMsg;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
@Override
public String toString() {
return "SmsBalanceResponse [time=" + time + ", balance=" + balance + ", errorMsg=" + errorMsg + ", code=" + code
+ "]";
}
}

View File

@@ -0,0 +1,103 @@
package com.chuanglan.sms.response;
import java.util.List;
/**
* @Description:上行明细响应实体类
*/
public class SmsPullResponse {
/**
* 请求状态
*/
private String ret;
/**
* 请求错误描述
*/
private String error;
/**
* 上行明细结果
*/
private List<Result> result;
public String getRet() {
return ret;
}
public void setRet(String ret) {
this.ret = ret;
}
public String getError() {
return error;
}
public void setError(String error) {
this.error = error;
}
public List<Result> getResult() {
return result;
}
public void setResult(List<Result> result) {
this.result = result;
}
static class Result{
/**
* 上行时间
*/
private String moTime;
/**
* 平台通道码
*/
private String spCode;
/**
* 上行号码
*/
private String mobile;
/**
* 运营商通道码
*/
private String destCode;
/**
* 上行内容
*/
private String messageContent;
public String getMoTime() {
return moTime;
}
public void setMoTime(String moTime) {
this.moTime = moTime;
}
public String getSpCode() {
return spCode;
}
public void setSpCode(String spCode) {
this.spCode = spCode;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getDestCode() {
return destCode;
}
public void setDestCode(String destCode) {
this.destCode = destCode;
}
public String getMessageContent() {
return messageContent;
}
public void setMessageContent(String messageContent) {
this.messageContent = messageContent;
}
}
}

View File

@@ -0,0 +1,115 @@
package com.chuanglan.sms.response;
import java.util.List;
/**
*
* @Description:状态报告响应实体类
*/
public class SmsReportResponse {
/**
* 请求状态
*/
private String ret;
/**
* 请求错误描述
*/
private String error;
/**
* 上行明细结果
*/
private List<Result> result;
public String getRet() {
return ret;
}
public void setRet(String ret) {
this.ret = ret;
}
public String getError() {
return error;
}
public void setError(String error) {
this.error = error;
}
public List<Result> getResult() {
return result;
}
public void setResult(List<Result> result) {
this.result = result;
}
static class Result{
/**
* 消息ID
*/
private String msgId;
/**
* 状态更新时间
*/
private String reportTime;
/**
* 接收短信的手机号码
*/
private String mobile;
/**
* 状态(详细参考状态报告状态码)
*/
private String status;
/**
* 状态说明
*/
private String statusDesc;
/**
* 拉取个数
*/
private String count;
public String getMsgId() {
return msgId;
}
public void setMsgId(String msgId) {
this.msgId = msgId;
}
public String getReportTime() {
return reportTime;
}
public void setReportTime(String reportTime) {
this.reportTime = reportTime;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getStatusDesc() {
return statusDesc;
}
public void setStatusDesc(String statusDesc) {
this.statusDesc = statusDesc;
}
public String getCount() {
return count;
}
public void setCount(String count) {
this.count = count;
}
}
}

View File

@@ -0,0 +1,56 @@
package com.chuanglan.sms.response;
/**
*
* @Description:普通短信发送响应实体类
*/
public class SmsSendResponse {
/**
* 响应时间
*/
private String time;
/**
* 消息id
*/
private String msgId;
/**
* 状态码说明(成功返回空)
*/
private String errorMsg;
/**
* 状态码(详细参考提交响应状态码)
*/
private String code;
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public String getMsgId() {
return msgId;
}
public void setMsgId(String msgId) {
this.msgId = msgId;
}
public String getErrorMsg() {
return errorMsg;
}
public void setErrorMsg(String errorMsg) {
this.errorMsg = errorMsg;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
@Override
public String toString() {
return "SmsSingleResponse [time=" + time + ", msgId=" + msgId + ", errorMsg=" + errorMsg + ", code=" + code
+ "]";
}
}

View File

@@ -0,0 +1,77 @@
package com.chuanglan.sms.response;
/**
*
* @Description:变量短信发送响应实体类
*/
public class SmsVariableResponse {
/**
* 响应时间
*/
private String time;
/**
* 消息id
*/
private String msgId;
/**
* 状态码说明(成功返回空)
*/
private String errorMsg;
/**
* 失败的个数
*/
private String failNum;
/**
* 成功的个数
*/
private String successNum;
/**
* 状态码(详细参考提交响应状态码)
*/
private String code;
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public String getMsgId() {
return msgId;
}
public void setMsgId(String msgId) {
this.msgId = msgId;
}
public String getErrorMsg() {
return errorMsg;
}
public void setErrorMsg(String errorMsg) {
this.errorMsg = errorMsg;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getFailNum() {
return failNum;
}
public void setFailNum(String failNum) {
this.failNum = failNum;
}
public String getSuccessNum() {
return successNum;
}
public void setSuccessNum(String successNum) {
this.successNum = successNum;
}
@Override
public String toString() {
return "SmsVarableResponse [time=" + time + ", msgId=" + msgId + ", errorMsg=" + errorMsg + ", failNum="
+ failNum + ", successNum=" + successNum + ", code=" + code + "]";
}
}

View File

@@ -0,0 +1,69 @@
package com.chuanglan.sms.util;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;
//import java.io.PrintWriter;
import java.net.HttpURLConnection;
import java.net.URL;
/**
*
* @Description:HTTP 请求
*/
public class ChuangLanSmsUtil {
/**
*
* @author tianyh
* @Description
* @param path
* @param postContent
* @return String
* @throws
*/
public static String sendSmsByPost(String path, String postContent) {
URL url = null;
try {
url = new URL(path);
HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
httpURLConnection.setRequestMethod("POST");// 提交模式
httpURLConnection.setConnectTimeout(10000);//连接超时 单位毫秒
httpURLConnection.setReadTimeout(10000);//读取超时 单位毫秒
// 发送POST请求必须设置如下两行
httpURLConnection.setDoOutput(true);
httpURLConnection.setDoInput(true);
httpURLConnection.setRequestProperty("Charset", "UTF-8");
httpURLConnection.setRequestProperty("Content-Type", "application/json");
// PrintWriter printWriter = new PrintWriter(httpURLConnection.getOutputStream());
// printWriter.write(postContent);
// printWriter.flush();
httpURLConnection.connect();
OutputStream os=httpURLConnection.getOutputStream();
os.write(postContent.getBytes("UTF-8"));
os.flush();
StringBuilder sb = new StringBuilder();
int httpRspCode = httpURLConnection.getResponseCode();
if (httpRspCode == HttpURLConnection.HTTP_OK) {
// 开始获取数据
BufferedReader br = new BufferedReader(
new InputStreamReader(httpURLConnection.getInputStream(), "utf-8"));
String line = null;
while ((line = br.readLine()) != null) {
sb.append(line);
}
br.close();
return sb.toString();
}
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}