11 changed files with 274 additions and 45 deletions
@ -0,0 +1,105 @@ |
|||
package com.zscat.mallplus.enums; |
|||
|
|||
import lombok.Getter; |
|||
|
|||
/** |
|||
* @Author dimengzhe |
|||
* @Date 2023/2/23 9:01 |
|||
* @Description |
|||
*/ |
|||
public class SmsEnum { |
|||
/** |
|||
* 手机短信登录验证码时效(秒) |
|||
*/ |
|||
public static final Long APP_LOGIN_CODE_TIME_LIMIT = 300L; |
|||
|
|||
|
|||
/** |
|||
* 发送验证码 |
|||
*/ |
|||
@Getter |
|||
public static enum SendEnum { |
|||
/** |
|||
* 登录 |
|||
*/ |
|||
LOGIN("1", "loginCode","登录"), |
|||
; |
|||
|
|||
/** |
|||
* code值 |
|||
*/ |
|||
private final String code; |
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private final String remarks; |
|||
/** |
|||
* 缓存识别码 |
|||
*/ |
|||
private final String redisKey; |
|||
|
|||
/** |
|||
* 构造器 |
|||
* |
|||
* @param code code值 |
|||
* @param redisKey 缓存识别码 |
|||
* @param remarks 备注 |
|||
*/ |
|||
private SendEnum(String code, String redisKey,String remarks) { |
|||
this.code = code; |
|||
this.remarks = remarks; |
|||
this.redisKey = redisKey; |
|||
} |
|||
} |
|||
|
|||
@Getter |
|||
public static enum SmsReturnEnum { |
|||
/** |
|||
* 发送短信返回参数 |
|||
*/ |
|||
ZERO("1", "提交成功"), |
|||
ONE("-1", "账号未注册"), |
|||
TWO("-2", "网络访问超时,请稍后再试"), |
|||
three("-3", "帐号或密码错误"), |
|||
FOUR("-4", "只支持单发"), |
|||
FIVE("-5", "余额不足,请充值"), |
|||
SIX("-6", "定时发送时间不是有效的时间格式"), |
|||
SEVEN("-7", "提交信息末尾未加签名,请添加中文的企业签名【 】或未采用gb2312编码"), |
|||
EIGHT("-8", "发送内容需在1到300字之间"), |
|||
NINE("-9", "发送号码为空"), |
|||
TEN("-10", "定时时间不能小于系统当前时间"), |
|||
ELEVEN("-11", "屏蔽手机号码"), |
|||
ONEZEROONE("-101", "调用接口速度太快"), |
|||
; |
|||
|
|||
/** |
|||
* code值 |
|||
*/ |
|||
private final String code; |
|||
/** |
|||
* 备注 |
|||
*/ |
|||
private final String remarks; |
|||
|
|||
/** |
|||
* 构造器 |
|||
* |
|||
* @param code code值 |
|||
* @param remarks 备注 |
|||
*/ |
|||
private SmsReturnEnum(String code, String remarks) { |
|||
this.code = code; |
|||
this.remarks = remarks; |
|||
} |
|||
public static String getValueByKey(String code) { |
|||
SmsReturnEnum[] sysReturnEnum = values(); |
|||
for (SmsReturnEnum returnEnum: sysReturnEnum) { |
|||
if (returnEnum.getCode().equals(code)) { |
|||
return returnEnum.getRemarks(); |
|||
} |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
} |
|||
} |
@ -0,0 +1,51 @@ |
|||
package com.zscat.mallplus.config; |
|||
|
|||
import org.apache.axis.client.Call; |
|||
import org.apache.axis.client.Service; |
|||
import org.apache.axis.encoding.XMLType; |
|||
|
|||
import javax.xml.namespace.QName; |
|||
|
|||
/** |
|||
* @Author dimengzhe |
|||
* @Date 2023/2/22 21:38 |
|||
* @Description |
|||
*/ |
|||
public class SmsConfig { |
|||
|
|||
static String msgSign="【汇融银链】"; |
|||
public static String SendWaitWorkMsg(String mobile, String pwd,String msg) { |
|||
try { |
|||
|
|||
String urlname = "http://sdk1.mb345.com/ws/LinkWS.asmx"; |
|||
String soapActionURI = "http://tempuri.org/BatchSend"; |
|||
Service s = new Service(); |
|||
Call call = (Call) s.createCall(); |
|||
call.setTimeout(new Integer(5000)); |
|||
call.setUseSOAPAction(true); |
|||
call.setSOAPActionURI(soapActionURI); |
|||
// wsdl中接口名称
|
|||
call.setOperationName(new QName("http://tempuri.org/", "BatchSend")); |
|||
call.setTargetEndpointAddress(urlname); |
|||
call.addParameter(new QName("http://tempuri.org/", "CorpID"), XMLType.XSD_STRING, |
|||
javax.xml.rpc.ParameterMode.IN); |
|||
call.addParameter(new QName("http://tempuri.org/", "Pwd"), XMLType.XSD_STRING, |
|||
javax.xml.rpc.ParameterMode.IN); |
|||
call.addParameter(new QName("http://tempuri.org/", "Mobile"), XMLType.XSD_STRING, |
|||
javax.xml.rpc.ParameterMode.IN); |
|||
call.addParameter(new QName("http://tempuri.org/", "Content"), XMLType.XSD_STRING, |
|||
javax.xml.rpc.ParameterMode.IN); |
|||
call.addParameter(new QName("http://tempuri.org/", "Cell"), XMLType.XSD_STRING, |
|||
javax.xml.rpc.ParameterMode.IN); |
|||
call.addParameter(new QName("http://tempuri.org/", "SendTime"), XMLType.XSD_STRING, |
|||
javax.xml.rpc.ParameterMode.IN); |
|||
String[] fn01 = {"YXT011836", "yxt_hryl230223", mobile, msg+msgSign, "", ""}; |
|||
String val = (String) call.invoke(fn01); |
|||
return val; |
|||
|
|||
} catch (Exception e) { |
|||
return e.getMessage(); |
|||
|
|||
} |
|||
} |
|||
} |
Loading…
Reference in new issue