feat:集成移动云mas短信平台
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -81,6 +81,7 @@ public class SmsClientFactoryImpl implements SmsClientFactory {
|
|||||||
case TENCENT: return new TencentSmsClient(properties);
|
case TENCENT: return new TencentSmsClient(properties);
|
||||||
case HUAWEI: return new HuaweiSmsClient(properties);
|
case HUAWEI: return new HuaweiSmsClient(properties);
|
||||||
case QINIU: return new QiniuSmsClient(properties);
|
case QINIU: return new QiniuSmsClient(properties);
|
||||||
|
case CMCC_MAS: return new CmccMasSmsClient(properties);
|
||||||
}
|
}
|
||||||
// 创建失败,错误日志 + 抛出异常
|
// 创建失败,错误日志 + 抛出异常
|
||||||
log.error("[createSmsClient][配置({}) 找不到合适的客户端实现]", properties);
|
log.error("[createSmsClient][配置({}) 找不到合适的客户端实现]", properties);
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ public enum SmsChannelEnum {
|
|||||||
TENCENT("TENCENT", "腾讯云"),
|
TENCENT("TENCENT", "腾讯云"),
|
||||||
HUAWEI("HUAWEI", "华为云"),
|
HUAWEI("HUAWEI", "华为云"),
|
||||||
QINIU("QINIU", "七牛云"),
|
QINIU("QINIU", "七牛云"),
|
||||||
|
CMCC_MAS("CMCC_MAS", "中国移动云MAS"),
|
||||||
;
|
;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ public class SmsSendServiceImpl implements SmsSendService {
|
|||||||
Boolean isSend = CommonStatusEnum.ENABLE.getStatus().equals(template.getStatus())
|
Boolean isSend = CommonStatusEnum.ENABLE.getStatus().equals(template.getStatus())
|
||||||
&& CommonStatusEnum.ENABLE.getStatus().equals(smsChannel.getStatus());
|
&& CommonStatusEnum.ENABLE.getStatus().equals(smsChannel.getStatus());
|
||||||
String content = smsTemplateService.formatSmsTemplateContent(template.getContent(), templateParams);
|
String content = smsTemplateService.formatSmsTemplateContent(template.getContent(), templateParams);
|
||||||
|
|
||||||
Long sendLogId = smsLogService.createSmsLog(mobile, userId, userType, isSend, template, content, templateParams);
|
Long sendLogId = smsLogService.createSmsLog(mobile, userId, userType, isSend, template, content, templateParams);
|
||||||
|
|
||||||
// 发送 MQ 消息,异步执行发送短信
|
// 发送 MQ 消息,异步执行发送短信
|
||||||
@@ -183,7 +184,6 @@ public class SmsSendServiceImpl implements SmsSendService {
|
|||||||
if (CollUtil.isEmpty(receiveResults)) {
|
if (CollUtil.isEmpty(receiveResults)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 更新短信日志的接收结果. 因为量一般不大,所以先使用 for 循环更新
|
|
||||||
receiveResults.forEach(result -> smsLogService.updateSmsReceiveResult(result.getLogId(),
|
receiveResults.forEach(result -> smsLogService.updateSmsReceiveResult(result.getLogId(),
|
||||||
result.getSuccess(), result.getReceiveTime(), result.getErrorCode(), result.getErrorMsg()));
|
result.getSuccess(), result.getReceiveTime(), result.getErrorCode(), result.getErrorMsg()));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user