parent
ca39d02c9f
commit
6c1bbda6db
@ -0,0 +1,20 @@ |
|||||||
|
package com.sinosoft.msg.config; |
||||||
|
|
||||||
|
import org.springframework.context.annotation.Bean; |
||||||
|
import org.springframework.context.annotation.Configuration; |
||||||
|
import org.springframework.boot.web.client.RestTemplateBuilder; |
||||||
|
import org.springframework.web.client.RestTemplate; |
||||||
|
|
||||||
|
import java.time.Duration; |
||||||
|
|
||||||
|
@Configuration |
||||||
|
public class RestConfig { |
||||||
|
|
||||||
|
@Bean |
||||||
|
public RestTemplate restTemplate(RestTemplateBuilder builder) { |
||||||
|
return builder |
||||||
|
.setConnectTimeout(Duration.ofSeconds(10)) |
||||||
|
.setReadTimeout(Duration.ofSeconds(30)) |
||||||
|
.build(); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,33 @@ |
|||||||
|
package com.sinosoft.msg.core.smsSend.config; |
||||||
|
|
||||||
|
|
||||||
|
import com.sinosoft.common.core.utils.SpringUtils; |
||||||
|
import com.sinosoft.msg.core.constant.MsgConstants; |
||||||
|
import com.sinosoft.msg.domain.MsgSmsServiceConfig; |
||||||
|
import com.sinosoft.msg.service.IMsgSmsServiceConfigService; |
||||||
|
import lombok.Data; |
||||||
|
import org.dromara.sms4j.provider.config.BaseConfig; |
||||||
|
|
||||||
|
/** |
||||||
|
* 梦网科技短信发送配置类 |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
public class NewSmsConfig extends BaseConfig { |
||||||
|
private String url; |
||||||
|
private String userName; |
||||||
|
private String password; |
||||||
|
|
||||||
|
public NewSmsConfig(){ |
||||||
|
MsgSmsServiceConfig config = SpringUtils.getBean(IMsgSmsServiceConfigService.class).getSmsServiceConfigBySupplier(getSupplier()); |
||||||
|
this.url=config.getApiAddress(); |
||||||
|
this.userName = config.getAccessKeyId(); |
||||||
|
this.password = config.getAccessKeySecret(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String getSupplier() { |
||||||
|
return MsgConstants.SUPPLIER_NEW; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,154 @@ |
|||||||
|
package com.sinosoft.msg.core.smsSend.domian; |
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlElement; |
||||||
|
|
||||||
|
public class Message { |
||||||
|
|
||||||
|
/** |
||||||
|
* 短信id |
||||||
|
*/ |
||||||
|
private String messageId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 手机号列表 |
||||||
|
*/ |
||||||
|
private MobileNums mobileNums; |
||||||
|
|
||||||
|
/** |
||||||
|
* 短信标题 |
||||||
|
*/ |
||||||
|
private String messTopic; |
||||||
|
|
||||||
|
/** |
||||||
|
* 发送数据(用;分隔) |
||||||
|
*/ |
||||||
|
private String sendData; |
||||||
|
|
||||||
|
/** |
||||||
|
*数据类型:0:使用模版 1:不使用模版 |
||||||
|
*/ |
||||||
|
private Integer dataType; // 0: 使用模板, 1: 不使用模板
|
||||||
|
/** |
||||||
|
* 发送方式 0: 即时发送, 1: 定时发送 |
||||||
|
*/ |
||||||
|
private Integer sendWay; // 0: 即时发送, 1: 定时发送
|
||||||
|
/** |
||||||
|
* 发送日期 |
||||||
|
*/ |
||||||
|
private String fixedDate; // 定时日期,可为空
|
||||||
|
/** |
||||||
|
*发送时间 |
||||||
|
*/ |
||||||
|
private String fixedTime; // 定时时间,可为空
|
||||||
|
/** |
||||||
|
* 发送机构 |
||||||
|
*/ |
||||||
|
private String unitCode; // 发送机构,如 "860000" 代表总部
|
||||||
|
/** |
||||||
|
* 优先级 |
||||||
|
*/ |
||||||
|
private Integer dealOrder; // 优先级
|
||||||
|
/** |
||||||
|
* 回执匹配方式 |
||||||
|
*/ |
||||||
|
private Integer answerMatch; // 回执匹配方式
|
||||||
|
|
||||||
|
@XmlElement(name = "MessageId") |
||||||
|
public String getMessageId() { |
||||||
|
return messageId; |
||||||
|
} |
||||||
|
|
||||||
|
public void setMessageId(String messageId) { |
||||||
|
this.messageId = messageId; |
||||||
|
} |
||||||
|
|
||||||
|
@XmlElement(name = "MobileNums") |
||||||
|
public MobileNums getMobileNums() { |
||||||
|
return mobileNums; |
||||||
|
} |
||||||
|
|
||||||
|
public void setMobileNums(MobileNums mobileNums) { |
||||||
|
this.mobileNums = mobileNums; |
||||||
|
} |
||||||
|
|
||||||
|
@XmlElement(name = "MessTopic") |
||||||
|
public String getMessTopic() { |
||||||
|
return messTopic; |
||||||
|
} |
||||||
|
|
||||||
|
public void setMessTopic(String messTopic) { |
||||||
|
this.messTopic = messTopic; |
||||||
|
} |
||||||
|
|
||||||
|
@XmlElement(name = "SendData") |
||||||
|
public String getSendData() { |
||||||
|
return sendData; |
||||||
|
} |
||||||
|
|
||||||
|
public void setSendData(String sendData) { |
||||||
|
this.sendData = sendData; |
||||||
|
} |
||||||
|
|
||||||
|
@XmlElement(name = "DataType") |
||||||
|
public Integer getDataType() { |
||||||
|
return dataType; |
||||||
|
} |
||||||
|
|
||||||
|
public void setDataType(Integer dataType) { |
||||||
|
this.dataType = dataType; |
||||||
|
} |
||||||
|
|
||||||
|
@XmlElement(name = "SendWay") |
||||||
|
public Integer getSendWay() { |
||||||
|
return sendWay; |
||||||
|
} |
||||||
|
|
||||||
|
public void setSendWay(Integer sendWay) { |
||||||
|
this.sendWay = sendWay; |
||||||
|
} |
||||||
|
|
||||||
|
@XmlElement(name = "FixedDate") |
||||||
|
public String getFixedDate() { |
||||||
|
return fixedDate; |
||||||
|
} |
||||||
|
|
||||||
|
public void setFixedDate(String fixedDate) { |
||||||
|
this.fixedDate = fixedDate; |
||||||
|
} |
||||||
|
|
||||||
|
@XmlElement(name = "FixedTime") |
||||||
|
public String getFixedTime() { |
||||||
|
return fixedTime; |
||||||
|
} |
||||||
|
|
||||||
|
public void setFixedTime(String fixedTime) { |
||||||
|
this.fixedTime = fixedTime; |
||||||
|
} |
||||||
|
|
||||||
|
@XmlElement(name = "UnitCode") |
||||||
|
public String getUnitCode() { |
||||||
|
return unitCode; |
||||||
|
} |
||||||
|
|
||||||
|
public void setUnitCode(String unitCode) { |
||||||
|
this.unitCode = unitCode; |
||||||
|
} |
||||||
|
|
||||||
|
@XmlElement(name = "DealOrder") |
||||||
|
public Integer getDealOrder() { |
||||||
|
return dealOrder; |
||||||
|
} |
||||||
|
|
||||||
|
public void setDealOrder(Integer dealOrder) { |
||||||
|
this.dealOrder = dealOrder; |
||||||
|
} |
||||||
|
|
||||||
|
@XmlElement(name = "AnswerMatch") |
||||||
|
public Integer getAnswerMatch() { |
||||||
|
return answerMatch; |
||||||
|
} |
||||||
|
|
||||||
|
public void setAnswerMatch(Integer answerMatch) { |
||||||
|
this.answerMatch = answerMatch; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,18 @@ |
|||||||
|
package com.sinosoft.msg.core.smsSend.domian; |
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlElement; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
public class MobileNums { |
||||||
|
|
||||||
|
private List<String> mobileNum; |
||||||
|
|
||||||
|
@XmlElement(name = "MobileNum") |
||||||
|
public List<String> getMobileNum() { |
||||||
|
return mobileNum; |
||||||
|
} |
||||||
|
|
||||||
|
public void setMobileNum(List<String> mobileNum) { |
||||||
|
this.mobileNum = mobileNum; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,34 @@ |
|||||||
|
package com.sinosoft.msg.core.smsSend.domian; |
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlElement; |
||||||
|
|
||||||
|
public class PublicInfo { |
||||||
|
|
||||||
|
/** |
||||||
|
* 系统代码 |
||||||
|
*/ |
||||||
|
private String systemCode; |
||||||
|
|
||||||
|
/** |
||||||
|
* 短信服务代码 |
||||||
|
*/ |
||||||
|
private String serviceCode; |
||||||
|
|
||||||
|
@XmlElement(name = "SystemCode") |
||||||
|
public String getSystemCode() { |
||||||
|
return systemCode; |
||||||
|
} |
||||||
|
|
||||||
|
public void setSystemCode(String systemCode) { |
||||||
|
this.systemCode = systemCode; |
||||||
|
} |
||||||
|
|
||||||
|
@XmlElement(name = "ServiceCode") |
||||||
|
public String getServiceCode() { |
||||||
|
return serviceCode; |
||||||
|
} |
||||||
|
|
||||||
|
public void setServiceCode(String serviceCode) { |
||||||
|
this.serviceCode = serviceCode; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,32 @@ |
|||||||
|
package com.sinosoft.msg.core.smsSend.domian; |
||||||
|
|
||||||
|
import jakarta.xml.bind.annotation.XmlElement; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement; |
||||||
|
|
||||||
|
@Data |
||||||
|
@XmlRootElement(name = "Messages")//定义xml根节点
|
||||||
|
public class SmsDto { |
||||||
|
|
||||||
|
private PublicInfo publicInfo; |
||||||
|
private Message message; |
||||||
|
|
||||||
|
@XmlElement(name = "PublicInfo") |
||||||
|
public PublicInfo getPublicInfo() { |
||||||
|
return publicInfo; |
||||||
|
} |
||||||
|
|
||||||
|
public void setPublicInfo(PublicInfo publicInfo) { |
||||||
|
this.publicInfo = publicInfo; |
||||||
|
} |
||||||
|
|
||||||
|
@XmlElement(name = "Message") |
||||||
|
public Message getMessage() { |
||||||
|
return message; |
||||||
|
} |
||||||
|
|
||||||
|
public void setMessage(Message message) { |
||||||
|
this.message = message; |
||||||
|
} |
||||||
|
} |
||||||
Loading…
Reference in new issue