mirror of
https://gitee.com/dromara/sms4j.git
synced 2025-12-07 09:29:08 +08:00
修复自定义配置下报错的bug
This commit is contained in:
parent
6a04b9eb09
commit
3e10e0251f
@ -1,13 +1,13 @@
|
|||||||
package org.dromara.sms4j.core.factory;
|
package org.dromara.sms4j.core.factory;
|
||||||
|
|
||||||
import org.dromara.sms4j.core.SupplierSqlConfig;
|
|
||||||
import org.dromara.sms4j.emay.config.EmaySmsConfig;
|
|
||||||
import org.dromara.sms4j.aliyun.config.AlibabaSmsConfig;
|
import org.dromara.sms4j.aliyun.config.AlibabaSmsConfig;
|
||||||
import org.dromara.sms4j.api.SmsBlend;
|
import org.dromara.sms4j.api.SmsBlend;
|
||||||
import org.dromara.sms4j.cloopen.config.CloopenSmsConfig;
|
import org.dromara.sms4j.cloopen.config.CloopenSmsConfig;
|
||||||
import org.dromara.sms4j.comm.enumerate.SupplierType;
|
import org.dromara.sms4j.comm.enumerate.SupplierType;
|
||||||
import org.dromara.sms4j.comm.exception.SmsBlendException;
|
import org.dromara.sms4j.comm.exception.SmsBlendException;
|
||||||
|
import org.dromara.sms4j.core.SupplierSqlConfig;
|
||||||
import org.dromara.sms4j.core.config.SupplierFactory;
|
import org.dromara.sms4j.core.config.SupplierFactory;
|
||||||
|
import org.dromara.sms4j.emay.config.EmaySmsConfig;
|
||||||
import org.dromara.sms4j.huawei.config.HuaweiSmsConfig;
|
import org.dromara.sms4j.huawei.config.HuaweiSmsConfig;
|
||||||
import org.dromara.sms4j.jdcloud.config.JdCloudSmsConfig;
|
import org.dromara.sms4j.jdcloud.config.JdCloudSmsConfig;
|
||||||
import org.dromara.sms4j.tencent.config.TencentSmsConfig;
|
import org.dromara.sms4j.tencent.config.TencentSmsConfig;
|
||||||
@ -18,6 +18,7 @@ import org.dromara.sms4j.unisms.config.UniSmsConfig;
|
|||||||
* <p>构造工厂,用于获取一个厂商的短信实现对象
|
* <p>构造工厂,用于获取一个厂商的短信实现对象
|
||||||
* 在调用对应厂商的短信发送方法前,请先确保你的配置已经实现,否则无法发送该厂商对应的短信,一般情况下厂商会回执因缺少的配置所造成的的异常,但不会
|
* 在调用对应厂商的短信发送方法前,请先确保你的配置已经实现,否则无法发送该厂商对应的短信,一般情况下厂商会回执因缺少的配置所造成的的异常,但不会
|
||||||
* 以java异常的形式抛出
|
* 以java异常的形式抛出
|
||||||
|
*
|
||||||
* @author :Wind
|
* @author :Wind
|
||||||
* 2023/4/8 15:55
|
* 2023/4/8 15:55
|
||||||
**/
|
**/
|
||||||
@ -28,6 +29,7 @@ public abstract class SmsFactory {
|
|||||||
/**
|
/**
|
||||||
* createSmsBlend
|
* createSmsBlend
|
||||||
* <p>获取各个厂商的实现类
|
* <p>获取各个厂商的实现类
|
||||||
|
*
|
||||||
* @param supplierType 厂商枚举
|
* @param supplierType 厂商枚举
|
||||||
* @author :Wind
|
* @author :Wind
|
||||||
*/
|
*/
|
||||||
@ -52,12 +54,13 @@ public abstract class SmsFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* refresh
|
* refresh
|
||||||
* <p>刷新配置,用于切换配置后的刷新,防止因厂商sdk内部的保存导致配置更新不及时
|
* <p>刷新配置,用于切换配置后的刷新,防止因厂商sdk内部的保存导致配置更新不及时
|
||||||
* 此方法会造成一定的性能损失,不建议经常性调用
|
* 此方法会造成一定的性能损失,不建议经常性调用
|
||||||
|
*
|
||||||
* @author :Wind
|
* @author :Wind
|
||||||
*/
|
*/
|
||||||
public static void refresh(){
|
public static void refresh() {
|
||||||
AlibabaSmsConfig.refresh(SupplierFactory.getAlibabaConfig());
|
AlibabaSmsConfig.refresh(SupplierFactory.getAlibabaConfig());
|
||||||
HuaweiSmsConfig.refresh(SupplierFactory.getHuaweiConfig());
|
HuaweiSmsConfig.refresh(SupplierFactory.getHuaweiConfig());
|
||||||
UniSmsConfig.refresh(SupplierFactory.getUniConfig());
|
UniSmsConfig.refresh(SupplierFactory.getUniConfig());
|
||||||
@ -68,36 +71,46 @@ public abstract class SmsFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* refresh
|
* refresh
|
||||||
* <p>根据厂商类型枚举刷新对应厂商的配置,此方法不会刷新全部厂商的配置对象,只会重构所选厂商的对象,性能损失相对较小
|
* <p>根据厂商类型枚举刷新对应厂商的配置,此方法不会刷新全部厂商的配置对象,只会重构所选厂商的对象,性能损失相对较小
|
||||||
|
*
|
||||||
* @param supplierType 厂商类型枚举
|
* @param supplierType 厂商类型枚举
|
||||||
* @author :Wind
|
* @author :Wind
|
||||||
*/
|
*/
|
||||||
public static void refresh(SupplierType supplierType){
|
public static void refresh(SupplierType supplierType) {
|
||||||
switch (supplierType) {
|
switch (supplierType) {
|
||||||
case ALIBABA:
|
case ALIBABA:
|
||||||
AlibabaSmsConfig.refresh(SupplierFactory.getAlibabaConfig());
|
AlibabaSmsConfig.refresh(SupplierFactory.getAlibabaConfig());
|
||||||
|
break;
|
||||||
case HUAWEI:
|
case HUAWEI:
|
||||||
HuaweiSmsConfig.refresh(SupplierFactory.getHuaweiConfig());
|
HuaweiSmsConfig.refresh(SupplierFactory.getHuaweiConfig());
|
||||||
|
break;
|
||||||
case UNI_SMS:
|
case UNI_SMS:
|
||||||
UniSmsConfig.refresh(SupplierFactory.getUniConfig());
|
UniSmsConfig.refresh(SupplierFactory.getUniConfig());
|
||||||
|
break;
|
||||||
case TENCENT:
|
case TENCENT:
|
||||||
TencentSmsConfig.refresh(SupplierFactory.getTencentConfig());
|
TencentSmsConfig.refresh(SupplierFactory.getTencentConfig());
|
||||||
|
break;
|
||||||
case JD_CLOUD:
|
case JD_CLOUD:
|
||||||
JdCloudSmsConfig.refresh(SupplierFactory.getJdCloudConfig());
|
JdCloudSmsConfig.refresh(SupplierFactory.getJdCloudConfig());
|
||||||
|
break;
|
||||||
case CLOOPEN:
|
case CLOOPEN:
|
||||||
CloopenSmsConfig.refresh(SupplierFactory.getCloopenConfig());
|
CloopenSmsConfig.refresh(SupplierFactory.getCloopenConfig());
|
||||||
|
break;
|
||||||
case EMAY:
|
case EMAY:
|
||||||
EmaySmsConfig.refresh(SupplierFactory.getEmayConfig());
|
EmaySmsConfig.refresh(SupplierFactory.getEmayConfig());
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
throw new SmsBlendException("An attempt to construct a SmsBlend object failed. Please check that the enumeration is valid");
|
throw new SmsBlendException("An attempt to construct a SmsBlend object failed. Please check that the enumeration is valid");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* refreshSqlConfig
|
* refreshSqlConfig
|
||||||
* <p>重新读取sql配置
|
* <p>重新读取sql配置
|
||||||
|
*
|
||||||
* @author :Wind
|
* @author :Wind
|
||||||
*/
|
*/
|
||||||
public static void refreshSqlConfig() {
|
public static void refreshSqlConfig() {
|
||||||
SupplierSqlConfig.refreshSqlConfig();
|
SupplierSqlConfig.refreshSqlConfig();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user