mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
cf-framework:sms移到cf-module-system-biz
This commit is contained in:
@@ -144,11 +144,6 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.cf.imes</groupId>
|
||||
<artifactId>cf-spring-boot-starter-biz-sms</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.cf.imes</groupId>
|
||||
<artifactId>cf-spring-boot-starter-biz-pay</artifactId>
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>com.cf.imes</groupId>
|
||||
<artifactId>cf-framework</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>cf-spring-boot-starter-biz-sms</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>${project.artifactId}</name>
|
||||
<description>短信拓展,支持阿里云、腾讯云</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.cf.imes</groupId>
|
||||
<artifactId>cf-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Spring 核心 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 监控相关 -->
|
||||
<dependency>
|
||||
<groupId>io.opentracing</groupId>
|
||||
<artifactId>opentracing-util</artifactId> <!-- aliyun 短信需要,进行链路追踪 -->
|
||||
</dependency>
|
||||
|
||||
<!-- Test 测试相关 -->
|
||||
<dependency>
|
||||
<groupId>com.cf.imes</groupId>
|
||||
<artifactId>cf-spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- 工具类相关 -->
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<optional>true</optional> <!-- 设置为可选,因为使用到 @VisibleForTesting 用于单元测试 -->
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>jakarta.validation</groupId>
|
||||
<artifactId>jakarta.validation-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 三方云服务相关 -->
|
||||
|
||||
<!-- SMS SDK begin -->
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>aliyun-java-sdk-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>aliyun-java-sdk-dysmsapi</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.tencentcloudapi</groupId>
|
||||
<artifactId>tencentcloud-sdk-java-sms</artifactId>
|
||||
</dependency>
|
||||
<!-- SMS SDK end -->
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
-1
@@ -1 +0,0 @@
|
||||
com.cf.imes.framework.sms.config.ChenfengSmsAutoConfiguration
|
||||
-188
@@ -1,188 +0,0 @@
|
||||
package com.cf.imes.framework.sms.core.client.impl.aliyun;
|
||||
|
||||
import cn.hutool.core.lang.Pair;
|
||||
import cn.hutool.core.util.ReflectUtil;
|
||||
import com.cf.imes.framework.common.util.collection.MapUtils;
|
||||
import com.cf.imes.framework.sms.core.client.dto.SmsReceiveRespDTO;
|
||||
import com.cf.imes.framework.sms.core.client.dto.SmsSendRespDTO;
|
||||
import com.cf.imes.framework.sms.core.client.dto.SmsTemplateRespDTO;
|
||||
import com.cf.imes.framework.sms.core.enums.SmsTemplateAuditStatusEnum;
|
||||
import com.cf.imes.framework.sms.core.property.SmsProperties;
|
||||
import com.cf.imes.framework.test.core.ut.BaseMockitoUnitTest;
|
||||
import com.aliyuncs.IAcsClient;
|
||||
import com.aliyuncs.dysmsapi.model.v20170525.QuerySmsTemplateRequest;
|
||||
import com.aliyuncs.dysmsapi.model.v20170525.QuerySmsTemplateResponse;
|
||||
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest;
|
||||
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.ArgumentMatcher;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import static com.cf.imes.framework.common.util.json.JsonUtils.*;
|
||||
import static com.cf.imes.framework.test.core.util.RandomUtils.*;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.ArgumentMatchers.argThat;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
/**
|
||||
* {@link AliyunSmsClient} 的单元测试
|
||||
*
|
||||
* @author 晨丰科技
|
||||
*/
|
||||
public class AliyunSmsClientTest extends BaseMockitoUnitTest {
|
||||
|
||||
private final SmsProperties properties = new SmsProperties()
|
||||
.setApiKey(randomString()) // 随机一个 apiKey,避免构建报错
|
||||
.setApiSecret(randomString()) // 随机一个 apiSecret,避免构建报错
|
||||
.setSignature("晨丰科技");
|
||||
|
||||
@InjectMocks
|
||||
private final AliyunSmsClient smsClient = new AliyunSmsClient(properties);
|
||||
|
||||
@Mock
|
||||
private IAcsClient client;
|
||||
|
||||
@Test
|
||||
public void testDoInit() {
|
||||
// 准备参数
|
||||
// mock 方法
|
||||
|
||||
// 调用
|
||||
smsClient.doInit();
|
||||
// 断言
|
||||
assertNotSame(client, ReflectUtil.getFieldValue(smsClient, "acsClient"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void tesSendSms_success() throws Throwable {
|
||||
// 准备参数
|
||||
Long sendLogId = randomLongId();
|
||||
String mobile = randomString();
|
||||
String apiTemplateId = randomString();
|
||||
List<Pair<String, Object>> templateParams = Lists.newArrayList(
|
||||
new Pair<>("code", 1234), new Pair<>("op", "login"));
|
||||
// mock 方法
|
||||
SendSmsResponse response = randomPojo(SendSmsResponse.class, o -> o.setCode("OK"));
|
||||
when(client.getAcsResponse(argThat((ArgumentMatcher<SendSmsRequest>) acsRequest -> {
|
||||
assertEquals(mobile, acsRequest.getPhoneNumbers());
|
||||
assertEquals(properties.getSignature(), acsRequest.getSignName());
|
||||
assertEquals(apiTemplateId, acsRequest.getTemplateCode());
|
||||
assertEquals(toJsonString(MapUtils.convertMap(templateParams)), acsRequest.getTemplateParam());
|
||||
assertEquals(sendLogId.toString(), acsRequest.getOutId());
|
||||
return true;
|
||||
}))).thenReturn(response);
|
||||
|
||||
// 调用
|
||||
SmsSendRespDTO result = smsClient.sendSms(sendLogId, mobile,
|
||||
apiTemplateId, templateParams);
|
||||
// 断言
|
||||
assertTrue(result.getSuccess());
|
||||
assertEquals(response.getRequestId(), result.getApiRequestId());
|
||||
assertEquals(response.getCode(), result.getApiCode());
|
||||
assertEquals(response.getMessage(), result.getApiMsg());
|
||||
assertEquals(response.getBizId(), result.getSerialNo());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void tesSendSms_fail() throws Throwable {
|
||||
// 准备参数
|
||||
Long sendLogId = randomLongId();
|
||||
String mobile = randomString();
|
||||
String apiTemplateId = randomString();
|
||||
List<Pair<String, Object>> templateParams = Lists.newArrayList(
|
||||
new Pair<>("code", 1234), new Pair<>("op", "login"));
|
||||
// mock 方法
|
||||
SendSmsResponse response = randomPojo(SendSmsResponse.class, o -> o.setCode("ERROR"));
|
||||
when(client.getAcsResponse(argThat((ArgumentMatcher<SendSmsRequest>) acsRequest -> {
|
||||
assertEquals(mobile, acsRequest.getPhoneNumbers());
|
||||
assertEquals(properties.getSignature(), acsRequest.getSignName());
|
||||
assertEquals(apiTemplateId, acsRequest.getTemplateCode());
|
||||
assertEquals(toJsonString(MapUtils.convertMap(templateParams)), acsRequest.getTemplateParam());
|
||||
assertEquals(sendLogId.toString(), acsRequest.getOutId());
|
||||
return true;
|
||||
}))).thenReturn(response);
|
||||
|
||||
// 调用
|
||||
SmsSendRespDTO result = smsClient.sendSms(sendLogId, mobile, apiTemplateId, templateParams);
|
||||
// 断言
|
||||
assertFalse(result.getSuccess());
|
||||
assertEquals(response.getRequestId(), result.getApiRequestId());
|
||||
assertEquals(response.getCode(), result.getApiCode());
|
||||
assertEquals(response.getMessage(), result.getApiMsg());
|
||||
assertEquals(response.getBizId(), result.getSerialNo());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseSmsReceiveStatus() {
|
||||
// 准备参数
|
||||
String text = "[\n" +
|
||||
" {\n" +
|
||||
" \"phone_number\" : \"13900000001\",\n" +
|
||||
" \"send_time\" : \"2017-01-01 11:12:13\",\n" +
|
||||
" \"report_time\" : \"2017-02-02 22:23:24\",\n" +
|
||||
" \"success\" : true,\n" +
|
||||
" \"err_code\" : \"DELIVERED\",\n" +
|
||||
" \"err_msg\" : \"用户接收成功\",\n" +
|
||||
" \"sms_size\" : \"1\",\n" +
|
||||
" \"biz_id\" : \"12345\",\n" +
|
||||
" \"out_id\" : \"67890\"\n" +
|
||||
" }\n" +
|
||||
"]";
|
||||
// mock 方法
|
||||
|
||||
// 调用
|
||||
List<SmsReceiveRespDTO> statuses = smsClient.parseSmsReceiveStatus(text);
|
||||
// 断言
|
||||
assertEquals(1, statuses.size());
|
||||
assertTrue(statuses.get(0).getSuccess());
|
||||
assertEquals("DELIVERED", statuses.get(0).getErrorCode());
|
||||
assertEquals("用户接收成功", statuses.get(0).getErrorMsg());
|
||||
assertEquals("13900000001", statuses.get(0).getMobile());
|
||||
assertEquals(LocalDateTime.of(2017, 2, 2, 22, 23, 24),
|
||||
statuses.get(0).getReceiveTime());
|
||||
assertEquals("12345", statuses.get(0).getSerialNo());
|
||||
assertEquals(67890L, statuses.get(0).getLogId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetSmsTemplate() throws Throwable {
|
||||
// 准备参数
|
||||
String apiTemplateId = randomString();
|
||||
// mock 方法
|
||||
QuerySmsTemplateResponse response = randomPojo(QuerySmsTemplateResponse.class, o -> {
|
||||
o.setCode("OK");
|
||||
o.setTemplateStatus(1); // 设置模板通过
|
||||
});
|
||||
when(client.getAcsResponse(argThat((ArgumentMatcher<QuerySmsTemplateRequest>) acsRequest -> {
|
||||
assertEquals(apiTemplateId, acsRequest.getTemplateCode());
|
||||
return true;
|
||||
}))).thenReturn(response);
|
||||
|
||||
// 调用
|
||||
SmsTemplateRespDTO result = smsClient.getSmsTemplate(apiTemplateId);
|
||||
// 断言
|
||||
assertEquals(response.getTemplateCode(), result.getId());
|
||||
assertEquals(response.getTemplateContent(), result.getContent());
|
||||
Assertions.assertEquals(SmsTemplateAuditStatusEnum.SUCCESS.getStatus(), result.getAuditStatus());
|
||||
assertEquals(response.getReason(), result.getAuditReason());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConvertSmsTemplateAuditStatus() {
|
||||
assertEquals(SmsTemplateAuditStatusEnum.CHECKING.getStatus(),
|
||||
smsClient.convertSmsTemplateAuditStatus(0));
|
||||
assertEquals(SmsTemplateAuditStatusEnum.SUCCESS.getStatus(),
|
||||
smsClient.convertSmsTemplateAuditStatus(1));
|
||||
assertEquals(SmsTemplateAuditStatusEnum.FAIL.getStatus(),
|
||||
smsClient.convertSmsTemplateAuditStatus(2));
|
||||
assertThrows(IllegalArgumentException.class, () -> smsClient.convertSmsTemplateAuditStatus(3),
|
||||
"未知审核状态(3)");
|
||||
}
|
||||
|
||||
}
|
||||
-231
@@ -1,231 +0,0 @@
|
||||
package com.cf.imes.framework.sms.core.client.impl.tencent;
|
||||
|
||||
import cn.hutool.core.lang.Pair;
|
||||
import cn.hutool.core.util.ReflectUtil;
|
||||
import com.cf.imes.framework.common.util.collection.ArrayUtils;
|
||||
import com.cf.imes.framework.common.util.collection.MapUtils;
|
||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||
import com.cf.imes.framework.sms.core.client.dto.SmsReceiveRespDTO;
|
||||
import com.cf.imes.framework.sms.core.client.dto.SmsSendRespDTO;
|
||||
import com.cf.imes.framework.sms.core.client.dto.SmsTemplateRespDTO;
|
||||
import com.cf.imes.framework.sms.core.enums.SmsTemplateAuditStatusEnum;
|
||||
import com.cf.imes.framework.sms.core.property.SmsProperties;
|
||||
import com.cf.imes.framework.test.core.ut.BaseMockitoUnitTest;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.tencentcloudapi.sms.v20210111.SmsClient;
|
||||
import com.tencentcloudapi.sms.v20210111.models.DescribeSmsTemplateListResponse;
|
||||
import com.tencentcloudapi.sms.v20210111.models.DescribeTemplateListStatus;
|
||||
import com.tencentcloudapi.sms.v20210111.models.SendSmsResponse;
|
||||
import com.tencentcloudapi.sms.v20210111.models.SendStatus;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.cf.imes.framework.common.util.json.JsonUtils.*;
|
||||
import static com.cf.imes.framework.test.core.util.RandomUtils.*;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.ArgumentMatchers.argThat;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
/**
|
||||
* {@link TencentSmsClient} 的单元测试
|
||||
*
|
||||
* @author shiwp
|
||||
*/
|
||||
public class TencentSmsClientTest extends BaseMockitoUnitTest {
|
||||
|
||||
private final SmsProperties properties = new SmsProperties()
|
||||
.setApiKey(randomString() + " " + randomString()) // 随机一个 apiKey,避免构建报错
|
||||
.setApiSecret(randomString()) // 随机一个 apiSecret,避免构建报错
|
||||
.setSignature("晨丰科技");
|
||||
|
||||
@InjectMocks
|
||||
private TencentSmsClient smsClient = new TencentSmsClient(properties);
|
||||
|
||||
@Mock
|
||||
private SmsClient client;
|
||||
|
||||
@Test
|
||||
public void testDoInit() {
|
||||
// 准备参数
|
||||
// mock 方法
|
||||
|
||||
// 调用
|
||||
smsClient.doInit();
|
||||
// 断言
|
||||
assertNotSame(client, ReflectUtil.getFieldValue(smsClient, "client"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRefresh() {
|
||||
// 准备参数
|
||||
SmsProperties p = new SmsProperties()
|
||||
.setApiKey(randomString() + " " + randomString()) // 随机一个 apiKey,避免构建报错
|
||||
.setApiSecret(randomString()) // 随机一个 apiSecret,避免构建报错
|
||||
.setSignature("晨丰科技");
|
||||
// 调用
|
||||
smsClient.refresh(p);
|
||||
// 断言
|
||||
assertNotSame(client, ReflectUtil.getFieldValue(smsClient, "client"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDoSendSms_success() throws Throwable {
|
||||
// 准备参数
|
||||
Long sendLogId = randomLongId();
|
||||
String mobile = randomString();
|
||||
String apiTemplateId = randomString();
|
||||
List<Pair<String, Object>> templateParams = Lists.newArrayList(
|
||||
new Pair<>("1", 1234), new Pair<>("2", "login"));
|
||||
String requestId = randomString();
|
||||
String serialNo = randomString();
|
||||
// mock 方法
|
||||
SendSmsResponse response = randomPojo(SendSmsResponse.class, o -> {
|
||||
o.setRequestId(requestId);
|
||||
SendStatus[] sendStatuses = new SendStatus[1];
|
||||
o.setSendStatusSet(sendStatuses);
|
||||
SendStatus sendStatus = new SendStatus();
|
||||
sendStatuses[0] = sendStatus;
|
||||
sendStatus.setCode(TencentSmsClient.API_CODE_SUCCESS);
|
||||
sendStatus.setMessage("send success");
|
||||
sendStatus.setSerialNo(serialNo);
|
||||
});
|
||||
when(client.SendSms(argThat(request -> {
|
||||
assertEquals(mobile, request.getPhoneNumberSet()[0]);
|
||||
assertEquals(properties.getSignature(), request.getSignName());
|
||||
assertEquals(apiTemplateId, request.getTemplateId());
|
||||
assertEquals(toJsonString(ArrayUtils.toArray(new ArrayList<>(MapUtils.convertMap(templateParams).values()), String::valueOf)),
|
||||
toJsonString(request.getTemplateParamSet()));
|
||||
assertEquals(sendLogId, ReflectUtil.getFieldValue(JsonUtils.parseObject(request.getSessionContext(), TencentSmsClient.SessionContext.class), "logId"));
|
||||
return true;
|
||||
}))).thenReturn(response);
|
||||
|
||||
// 调用
|
||||
SmsSendRespDTO result = smsClient.sendSms(sendLogId, mobile, apiTemplateId, templateParams);
|
||||
// 断言
|
||||
assertTrue(result.getSuccess());
|
||||
assertEquals(response.getRequestId(), result.getApiRequestId());
|
||||
assertEquals(response.getSendStatusSet()[0].getCode(), result.getApiCode());
|
||||
assertEquals(response.getSendStatusSet()[0].getMessage(), result.getApiMsg());
|
||||
assertEquals(response.getSendStatusSet()[0].getSerialNo(), result.getSerialNo());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDoSendSms_fail() throws Throwable {
|
||||
// 准备参数
|
||||
Long sendLogId = randomLongId();
|
||||
String mobile = randomString();
|
||||
String apiTemplateId = randomString();
|
||||
List<Pair<String, Object>> templateParams = Lists.newArrayList(
|
||||
new Pair<>("1", 1234), new Pair<>("2", "login"));
|
||||
String requestId = randomString();
|
||||
String serialNo = randomString();
|
||||
// mock 方法
|
||||
SendSmsResponse response = randomPojo(SendSmsResponse.class, o -> {
|
||||
o.setRequestId(requestId);
|
||||
SendStatus[] sendStatuses = new SendStatus[1];
|
||||
o.setSendStatusSet(sendStatuses);
|
||||
SendStatus sendStatus = new SendStatus();
|
||||
sendStatuses[0] = sendStatus;
|
||||
sendStatus.setCode("ERROR");
|
||||
sendStatus.setMessage("send success");
|
||||
sendStatus.setSerialNo(serialNo);
|
||||
});
|
||||
when(client.SendSms(argThat(request -> {
|
||||
assertEquals(mobile, request.getPhoneNumberSet()[0]);
|
||||
assertEquals(properties.getSignature(), request.getSignName());
|
||||
assertEquals(apiTemplateId, request.getTemplateId());
|
||||
assertEquals(toJsonString(ArrayUtils.toArray(new ArrayList<>(MapUtils.convertMap(templateParams).values()), String::valueOf)),
|
||||
toJsonString(request.getTemplateParamSet()));
|
||||
assertEquals(sendLogId, ReflectUtil.getFieldValue(JsonUtils.parseObject(request.getSessionContext(), TencentSmsClient.SessionContext.class), "logId"));
|
||||
return true;
|
||||
}))).thenReturn(response);
|
||||
|
||||
// 调用
|
||||
SmsSendRespDTO result = smsClient.sendSms(sendLogId, mobile, apiTemplateId, templateParams);
|
||||
// 断言
|
||||
assertFalse(result.getSuccess());
|
||||
assertEquals(response.getRequestId(), result.getApiRequestId());
|
||||
assertEquals(response.getSendStatusSet()[0].getCode(), result.getApiCode());
|
||||
assertEquals(response.getSendStatusSet()[0].getMessage(), result.getApiMsg());
|
||||
assertEquals(response.getSendStatusSet()[0].getSerialNo(), result.getSerialNo());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseSmsReceiveStatus() {
|
||||
// 准备参数
|
||||
String text = "[\n" +
|
||||
" {\n" +
|
||||
" \"user_receive_time\": \"2015-10-17 08:03:04\",\n" +
|
||||
" \"nationcode\": \"86\",\n" +
|
||||
" \"mobile\": \"13900000001\",\n" +
|
||||
" \"report_status\": \"SUCCESS\",\n" +
|
||||
" \"errmsg\": \"DELIVRD\",\n" +
|
||||
" \"description\": \"用户短信送达成功\",\n" +
|
||||
" \"sid\": \"12345\",\n" +
|
||||
" \"ext\": {\"logId\":\"67890\"}\n" +
|
||||
" }\n" +
|
||||
"]";
|
||||
// mock 方法
|
||||
|
||||
// 调用
|
||||
List<SmsReceiveRespDTO> statuses = smsClient.parseSmsReceiveStatus(text);
|
||||
// 断言
|
||||
assertEquals(1, statuses.size());
|
||||
assertTrue(statuses.get(0).getSuccess());
|
||||
assertEquals("DELIVRD", statuses.get(0).getErrorCode());
|
||||
assertEquals("用户短信送达成功", statuses.get(0).getErrorMsg());
|
||||
assertEquals("13900000001", statuses.get(0).getMobile());
|
||||
assertEquals(LocalDateTime.of(2015, 10, 17, 8, 3, 4), statuses.get(0).getReceiveTime());
|
||||
assertEquals("12345", statuses.get(0).getSerialNo());
|
||||
assertEquals(67890L, statuses.get(0).getLogId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetSmsTemplate() throws Throwable {
|
||||
// 准备参数
|
||||
Long apiTemplateId = randomLongId();
|
||||
String requestId = randomString();
|
||||
|
||||
// mock 方法
|
||||
DescribeSmsTemplateListResponse response = randomPojo(DescribeSmsTemplateListResponse.class, o -> {
|
||||
DescribeTemplateListStatus[] describeTemplateListStatuses = new DescribeTemplateListStatus[1];
|
||||
DescribeTemplateListStatus templateStatus = new DescribeTemplateListStatus();
|
||||
templateStatus.setTemplateId(apiTemplateId);
|
||||
templateStatus.setStatusCode(0L);// 设置模板通过
|
||||
describeTemplateListStatuses[0] = templateStatus;
|
||||
o.setDescribeTemplateStatusSet(describeTemplateListStatuses);
|
||||
o.setRequestId(requestId);
|
||||
});
|
||||
when(client.DescribeSmsTemplateList(argThat(request -> {
|
||||
assertEquals(apiTemplateId, request.getTemplateIdSet()[0]);
|
||||
return true;
|
||||
}))).thenReturn(response);
|
||||
|
||||
// 调用
|
||||
SmsTemplateRespDTO result = smsClient.getSmsTemplate(apiTemplateId.toString());
|
||||
// 断言
|
||||
assertEquals(response.getDescribeTemplateStatusSet()[0].getTemplateId().toString(), result.getId());
|
||||
assertEquals(response.getDescribeTemplateStatusSet()[0].getTemplateContent(), result.getContent());
|
||||
Assertions.assertEquals(SmsTemplateAuditStatusEnum.SUCCESS.getStatus(), result.getAuditStatus());
|
||||
assertEquals(response.getDescribeTemplateStatusSet()[0].getReviewReply(), result.getAuditReason());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConvertSmsTemplateAuditStatus() {
|
||||
assertEquals(SmsTemplateAuditStatusEnum.SUCCESS.getStatus(),
|
||||
smsClient.convertSmsTemplateAuditStatus(0));
|
||||
assertEquals(SmsTemplateAuditStatusEnum.CHECKING.getStatus(),
|
||||
smsClient.convertSmsTemplateAuditStatus(1));
|
||||
assertEquals(SmsTemplateAuditStatusEnum.FAIL.getStatus(),
|
||||
smsClient.convertSmsTemplateAuditStatus(-1));
|
||||
assertThrows(IllegalArgumentException.class, () -> smsClient.convertSmsTemplateAuditStatus(3),
|
||||
"未知审核状态(3)");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -28,7 +28,6 @@
|
||||
<module>cf-spring-boot-starter-test</module>
|
||||
|
||||
<module>cf-spring-boot-starter-biz-operatelog</module>
|
||||
<module>cf-spring-boot-starter-biz-sms</module>
|
||||
|
||||
<module>cf-spring-boot-starter-biz-pay</module>
|
||||
<module>cf-spring-boot-starter-biz-organ</module>
|
||||
|
||||
@@ -46,10 +46,6 @@
|
||||
<groupId>com.cf.imes</groupId>
|
||||
<artifactId>cf-spring-boot-starter-biz-operatelog</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.cf.imes</groupId>
|
||||
<artifactId>cf-spring-boot-starter-biz-sms</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.cf.imes</groupId>
|
||||
@@ -213,6 +209,23 @@
|
||||
<artifactId>cf-spring-boot-starter-biz-pay</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 三方云服务相关 -->
|
||||
|
||||
<!-- SMS SDK begin -->
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>aliyun-java-sdk-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>aliyun-java-sdk-dysmsapi</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.tencentcloudapi</groupId>
|
||||
<artifactId>tencentcloud-sdk-java-sms</artifactId>
|
||||
</dependency>
|
||||
<!-- SMS SDK end -->
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -257,10 +270,6 @@
|
||||
<groupId>com.cf.imes</groupId>
|
||||
<artifactId>cf-spring-boot-starter-biz-organ</artifactId>
|
||||
</include>
|
||||
<include>
|
||||
<groupId>com.cf.imes</groupId>
|
||||
<artifactId>cf-spring-boot-starter-biz-sms</artifactId>
|
||||
</include>
|
||||
<include>
|
||||
<groupId>com.cf.imes</groupId>
|
||||
<artifactId>cf-spring-boot-starter-elasticsearch</artifactId>
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package com.cf.imes.module.system.controller.admin.sms;
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.framework.common.util.servlet.ServletUtils;
|
||||
import com.cf.imes.framework.operatelog.core.annotations.OperateLog;
|
||||
import com.cf.imes.framework.sms.core.enums.SmsChannelEnum;
|
||||
import com.cf.imes.module.system.framework.sms.core.enums.SmsChannelEnum;
|
||||
import com.cf.imes.module.system.service.sms.SmsSendService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ package com.cf.imes.module.system.dal.dataobject.sms;
|
||||
|
||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
import com.cf.imes.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.cf.imes.framework.sms.core.enums.SmsChannelEnum;
|
||||
import com.cf.imes.module.system.framework.sms.core.enums.SmsChannelEnum;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
+6
-5
@@ -1,18 +1,19 @@
|
||||
package com.cf.imes.framework.sms.config;
|
||||
package com.cf.imes.module.system.framework.sms.config;
|
||||
|
||||
import com.cf.imes.framework.sms.core.client.SmsClientFactory;
|
||||
import com.cf.imes.framework.sms.core.client.impl.SmsClientFactoryImpl;
|
||||
import com.cf.imes.framework.sms.core.property.SmsProperties;
|
||||
import com.cf.imes.module.system.framework.sms.core.client.SmsClientFactory;
|
||||
import com.cf.imes.module.system.framework.sms.core.client.impl.SmsClientFactoryImpl;
|
||||
import com.cf.imes.module.system.framework.sms.core.property.SmsProperties;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* 短信配置类
|
||||
*
|
||||
* @author 晨丰科技
|
||||
*/
|
||||
@AutoConfiguration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableConfigurationProperties(SmsProperties.class)
|
||||
public class ChenfengSmsAutoConfiguration {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.cf.imes.module.system.framework.sms;
|
||||
package com.cf.imes.module.system.framework.sms.config;
|
||||
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.cf.imes.module.system.framework.sms;
|
||||
package com.cf.imes.module.system.framework.sms.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
+4
-4
@@ -1,9 +1,9 @@
|
||||
package com.cf.imes.framework.sms.core.client;
|
||||
package com.cf.imes.module.system.framework.sms.core.client;
|
||||
|
||||
import cn.hutool.core.lang.Pair;
|
||||
import com.cf.imes.framework.sms.core.client.dto.SmsReceiveRespDTO;
|
||||
import com.cf.imes.framework.sms.core.client.dto.SmsSendRespDTO;
|
||||
import com.cf.imes.framework.sms.core.client.dto.SmsTemplateRespDTO;
|
||||
import com.cf.imes.module.system.framework.sms.core.client.dto.SmsReceiveRespDTO;
|
||||
import com.cf.imes.module.system.framework.sms.core.client.dto.SmsSendRespDTO;
|
||||
import com.cf.imes.module.system.framework.sms.core.client.dto.SmsTemplateRespDTO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package com.cf.imes.framework.sms.core.client;
|
||||
package com.cf.imes.module.system.framework.sms.core.client;
|
||||
|
||||
import com.cf.imes.framework.sms.core.property.SmsProperties;
|
||||
import com.cf.imes.module.system.framework.sms.core.property.SmsProperties;
|
||||
|
||||
/**
|
||||
* 短信客户端的工厂接口
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.cf.imes.framework.sms.core.client.dto;
|
||||
package com.cf.imes.module.system.framework.sms.core.client.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.cf.imes.framework.sms.core.client.dto;
|
||||
package com.cf.imes.module.system.framework.sms.core.client.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package com.cf.imes.framework.sms.core.client.dto;
|
||||
package com.cf.imes.module.system.framework.sms.core.client.dto;
|
||||
|
||||
import com.cf.imes.framework.sms.core.enums.SmsTemplateAuditStatusEnum;
|
||||
import com.cf.imes.module.system.framework.sms.core.enums.SmsTemplateAuditStatusEnum;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
package com.cf.imes.framework.sms.core.client.impl;
|
||||
package com.cf.imes.module.system.framework.sms.core.client.impl;
|
||||
|
||||
import com.cf.imes.framework.sms.core.client.SmsClient;
|
||||
import com.cf.imes.framework.sms.core.property.SmsProperties;
|
||||
import com.cf.imes.module.system.framework.sms.core.client.SmsClient;
|
||||
import com.cf.imes.module.system.framework.sms.core.property.SmsProperties;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
+9
-9
@@ -1,14 +1,14 @@
|
||||
package com.cf.imes.framework.sms.core.client.impl;
|
||||
package com.cf.imes.module.system.framework.sms.core.client.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.cf.imes.framework.sms.core.client.SmsClient;
|
||||
import com.cf.imes.framework.sms.core.client.SmsClientFactory;
|
||||
import com.cf.imes.framework.sms.core.client.impl.aliyun.AliyunSmsClient;
|
||||
import com.cf.imes.framework.sms.core.client.impl.debug.DebugDingTalkSmsClient;
|
||||
import com.cf.imes.framework.sms.core.client.impl.tencent.TencentSmsClient;
|
||||
import com.cf.imes.framework.sms.core.enums.SmsChannelEnum;
|
||||
import com.cf.imes.framework.sms.core.property.SmsChannelProperties;
|
||||
import com.cf.imes.framework.sms.core.property.SmsProperties;
|
||||
import com.cf.imes.module.system.framework.sms.core.client.SmsClient;
|
||||
import com.cf.imes.module.system.framework.sms.core.client.SmsClientFactory;
|
||||
import com.cf.imes.module.system.framework.sms.core.client.impl.aliyun.AliyunSmsClient;
|
||||
import com.cf.imes.module.system.framework.sms.core.client.impl.debug.DebugDingTalkSmsClient;
|
||||
import com.cf.imes.module.system.framework.sms.core.client.impl.tencent.TencentSmsClient;
|
||||
import com.cf.imes.module.system.framework.sms.core.enums.SmsChannelEnum;
|
||||
import com.cf.imes.module.system.framework.sms.core.property.SmsChannelProperties;
|
||||
import com.cf.imes.module.system.framework.sms.core.property.SmsProperties;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.Assert;
|
||||
+10
-10
@@ -1,25 +1,25 @@
|
||||
package com.cf.imes.framework.sms.core.client.impl.aliyun;
|
||||
package com.cf.imes.module.system.framework.sms.core.client.impl.aliyun;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.lang.Pair;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.aliyuncs.auth.Credential;
|
||||
import com.cf.imes.framework.common.util.collection.MapUtils;
|
||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||
import com.cf.imes.framework.sms.core.client.dto.SmsReceiveRespDTO;
|
||||
import com.cf.imes.framework.sms.core.client.dto.SmsSendRespDTO;
|
||||
import com.cf.imes.framework.sms.core.client.dto.SmsTemplateRespDTO;
|
||||
import com.cf.imes.framework.sms.core.client.impl.AbstractSmsClient;
|
||||
import com.cf.imes.framework.sms.core.enums.SmsTemplateAuditStatusEnum;
|
||||
import com.aliyuncs.DefaultAcsClient;
|
||||
import com.aliyuncs.IAcsClient;
|
||||
import com.aliyuncs.auth.Credential;
|
||||
import com.aliyuncs.dysmsapi.model.v20170525.QuerySmsTemplateRequest;
|
||||
import com.aliyuncs.dysmsapi.model.v20170525.QuerySmsTemplateResponse;
|
||||
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest;
|
||||
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
|
||||
import com.aliyuncs.profile.DefaultProfile;
|
||||
import com.aliyuncs.profile.IClientProfile;
|
||||
import com.cf.imes.framework.sms.core.property.SmsProperties;
|
||||
import com.cf.imes.framework.common.util.collection.MapUtils;
|
||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||
import com.cf.imes.module.system.framework.sms.core.client.dto.SmsReceiveRespDTO;
|
||||
import com.cf.imes.module.system.framework.sms.core.client.dto.SmsSendRespDTO;
|
||||
import com.cf.imes.module.system.framework.sms.core.client.dto.SmsTemplateRespDTO;
|
||||
import com.cf.imes.module.system.framework.sms.core.client.impl.AbstractSmsClient;
|
||||
import com.cf.imes.module.system.framework.sms.core.enums.SmsTemplateAuditStatusEnum;
|
||||
import com.cf.imes.module.system.framework.sms.core.property.SmsProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
+7
-7
@@ -1,4 +1,4 @@
|
||||
package com.cf.imes.framework.sms.core.client.impl.debug;
|
||||
package com.cf.imes.module.system.framework.sms.core.client.impl.debug;
|
||||
|
||||
import cn.hutool.core.codec.Base64;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
@@ -11,12 +11,12 @@ import cn.hutool.crypto.digest.HmacAlgorithm;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.cf.imes.framework.common.util.collection.MapUtils;
|
||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||
import com.cf.imes.framework.sms.core.client.dto.SmsReceiveRespDTO;
|
||||
import com.cf.imes.framework.sms.core.client.dto.SmsSendRespDTO;
|
||||
import com.cf.imes.framework.sms.core.client.dto.SmsTemplateRespDTO;
|
||||
import com.cf.imes.framework.sms.core.client.impl.AbstractSmsClient;
|
||||
import com.cf.imes.framework.sms.core.enums.SmsTemplateAuditStatusEnum;
|
||||
import com.cf.imes.framework.sms.core.property.SmsProperties;
|
||||
import com.cf.imes.module.system.framework.sms.core.client.dto.SmsReceiveRespDTO;
|
||||
import com.cf.imes.module.system.framework.sms.core.client.dto.SmsSendRespDTO;
|
||||
import com.cf.imes.module.system.framework.sms.core.client.dto.SmsTemplateRespDTO;
|
||||
import com.cf.imes.module.system.framework.sms.core.client.impl.AbstractSmsClient;
|
||||
import com.cf.imes.module.system.framework.sms.core.enums.SmsTemplateAuditStatusEnum;
|
||||
import com.cf.imes.module.system.framework.sms.core.property.SmsProperties;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
+13
-8
@@ -1,22 +1,27 @@
|
||||
package com.cf.imes.framework.sms.core.client.impl.tencent;
|
||||
package com.cf.imes.module.system.framework.sms.core.client.impl.tencent;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.lang.Pair;
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import com.cf.imes.framework.common.util.collection.ArrayUtils;
|
||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||
import com.cf.imes.framework.sms.core.client.dto.SmsReceiveRespDTO;
|
||||
import com.cf.imes.framework.sms.core.client.dto.SmsSendRespDTO;
|
||||
import com.cf.imes.framework.sms.core.client.dto.SmsTemplateRespDTO;
|
||||
import com.cf.imes.framework.sms.core.client.impl.AbstractSmsClient;
|
||||
import com.cf.imes.framework.sms.core.enums.SmsTemplateAuditStatusEnum;
|
||||
import com.cf.imes.framework.sms.core.property.SmsProperties;
|
||||
import com.cf.imes.module.system.framework.sms.core.client.dto.SmsReceiveRespDTO;
|
||||
import com.cf.imes.module.system.framework.sms.core.client.dto.SmsSendRespDTO;
|
||||
import com.cf.imes.module.system.framework.sms.core.client.dto.SmsTemplateRespDTO;
|
||||
import com.cf.imes.module.system.framework.sms.core.client.impl.AbstractSmsClient;
|
||||
import com.cf.imes.module.system.framework.sms.core.enums.SmsTemplateAuditStatusEnum;
|
||||
import com.cf.imes.module.system.framework.sms.core.property.SmsProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.tencentcloudapi.common.Credential;
|
||||
import com.tencentcloudapi.sms.v20210111.SmsClient;
|
||||
import com.tencentcloudapi.sms.v20210111.models.*;
|
||||
import com.tencentcloudapi.sms.v20210111.models.DescribeSmsTemplateListRequest;
|
||||
import com.tencentcloudapi.sms.v20210111.models.DescribeSmsTemplateListResponse;
|
||||
import com.tencentcloudapi.sms.v20210111.models.DescribeTemplateListStatus;
|
||||
import com.tencentcloudapi.sms.v20210111.models.SendSmsRequest;
|
||||
import com.tencentcloudapi.sms.v20210111.models.SendSmsResponse;
|
||||
import com.tencentcloudapi.sms.v20210111.models.SendStatus;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.cf.imes.framework.sms.core.enums;
|
||||
package com.cf.imes.module.system.framework.sms.core.enums;
|
||||
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.cf.imes.framework.sms.core.enums;
|
||||
package com.cf.imes.module.system.framework.sms.core.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package com.cf.imes.framework.sms.core.property;
|
||||
package com.cf.imes.module.system.framework.sms.core.property;
|
||||
|
||||
import com.cf.imes.framework.sms.core.enums.SmsChannelEnum;
|
||||
import com.cf.imes.module.system.framework.sms.core.enums.SmsChannelEnum;
|
||||
import lombok.Data;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.cf.imes.framework.sms.core.property;
|
||||
package com.cf.imes.module.system.framework.sms.core.property;
|
||||
|
||||
import com.cf.imes.framework.common.util.encrypt.AesUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package com.cf.imes.module.system.service.sms;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.sms.core.client.SmsClient;
|
||||
import com.cf.imes.module.system.framework.sms.core.client.SmsClient;
|
||||
import com.cf.imes.module.system.controller.admin.sms.vo.channel.SmsChannelPageReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.sms.vo.channel.SmsChannelSaveReqVO;
|
||||
import com.cf.imes.module.system.dal.dataobject.sms.SmsChannelDO;
|
||||
|
||||
+3
-3
@@ -4,9 +4,9 @@ import cn.hutool.core.text.CharSequenceUtil;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.sms.core.client.SmsClient;
|
||||
import com.cf.imes.framework.sms.core.client.SmsClientFactory;
|
||||
import com.cf.imes.framework.sms.core.property.SmsProperties;
|
||||
import com.cf.imes.module.system.framework.sms.core.client.SmsClient;
|
||||
import com.cf.imes.module.system.framework.sms.core.client.SmsClientFactory;
|
||||
import com.cf.imes.module.system.framework.sms.core.property.SmsProperties;
|
||||
import com.cf.imes.module.system.controller.admin.sms.vo.channel.SmsChannelPageReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.sms.vo.channel.SmsChannelSaveReqVO;
|
||||
import com.cf.imes.module.system.dal.dataobject.sms.SmsChannelDO;
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ import com.cf.imes.module.system.dal.dataobject.user.AdminUserDO;
|
||||
import com.cf.imes.module.system.dal.mysql.sms.SmsCodeMapper;
|
||||
import com.cf.imes.module.system.dal.redis.RedisKeyConstants;
|
||||
import com.cf.imes.module.system.enums.sms.SmsSceneEnum;
|
||||
import com.cf.imes.module.system.framework.sms.SmsCodeProperties;
|
||||
import com.cf.imes.module.system.framework.sms.config.SmsCodeProperties;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.module.system.enums.ErrorCodeConstants;
|
||||
import com.cf.imes.module.system.service.user.AdminUserService;
|
||||
|
||||
+3
-3
@@ -7,9 +7,9 @@ import cn.hutool.core.lang.Pair;
|
||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
import com.cf.imes.framework.common.enums.UserTypeEnum;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.sms.core.client.SmsClient;
|
||||
import com.cf.imes.framework.sms.core.client.dto.SmsReceiveRespDTO;
|
||||
import com.cf.imes.framework.sms.core.client.dto.SmsSendRespDTO;
|
||||
import com.cf.imes.module.system.framework.sms.core.client.SmsClient;
|
||||
import com.cf.imes.module.system.framework.sms.core.client.dto.SmsReceiveRespDTO;
|
||||
import com.cf.imes.module.system.framework.sms.core.client.dto.SmsSendRespDTO;
|
||||
import com.cf.imes.module.system.dal.dataobject.sms.SmsTemplateDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.user.AdminUserDO;
|
||||
import com.cf.imes.module.system.mq.message.sms.SmsSendMessage;
|
||||
|
||||
+3
-3
@@ -9,9 +9,9 @@ import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.sms.core.client.SmsClient;
|
||||
import com.cf.imes.framework.sms.core.client.dto.SmsTemplateRespDTO;
|
||||
import com.cf.imes.framework.sms.core.enums.SmsTemplateAuditStatusEnum;
|
||||
import com.cf.imes.module.system.framework.sms.core.client.SmsClient;
|
||||
import com.cf.imes.module.system.framework.sms.core.client.dto.SmsTemplateRespDTO;
|
||||
import com.cf.imes.module.system.framework.sms.core.enums.SmsTemplateAuditStatusEnum;
|
||||
import com.cf.imes.module.system.controller.admin.sms.vo.template.SmsTemplatePageReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.sms.vo.template.SmsTemplateSaveReqVO;
|
||||
import com.cf.imes.module.system.dal.dataobject.sms.SmsChannelDO;
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package com.cf.imes.module.system.service.sms.handler;
|
||||
|
||||
import cn.hutool.core.lang.Pair;
|
||||
import com.cf.imes.framework.sms.core.client.dto.SmsSendRespDTO;
|
||||
import com.cf.imes.module.system.framework.sms.core.client.dto.SmsSendRespDTO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
+2
-2
@@ -2,10 +2,10 @@ package com.cf.imes.module.system.service.sms.handler.impl;
|
||||
|
||||
import cn.hutool.core.lang.Pair;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.cf.imes.framework.sms.core.client.dto.SmsSendRespDTO;
|
||||
import com.cf.imes.module.system.framework.sms.core.client.dto.SmsSendRespDTO;
|
||||
import com.cf.imes.module.system.dal.redis.RedisKeyConstants;
|
||||
import com.cf.imes.module.system.enums.sms.SmsTemplateTypeEnum;
|
||||
import com.cf.imes.module.system.framework.sms.SmsCodeProperties;
|
||||
import com.cf.imes.module.system.framework.sms.config.SmsCodeProperties;
|
||||
import com.cf.imes.module.system.service.sms.handler.SmsSendAfterSendHandler;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ package com.cf.imes.module.system.service.sms;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import com.cf.imes.framework.common.enums.UserTypeEnum;
|
||||
import com.cf.imes.framework.sms.config.ChenfengSmsAutoConfiguration;
|
||||
import com.cf.imes.module.system.framework.sms.config.ChenfengSmsAutoConfiguration;
|
||||
import com.cf.imes.module.system.test.BaseDbAndRedisIntegrationTest;
|
||||
import com.cf.imes.module.system.mq.consumer.sms.SmsSendConsumer;
|
||||
import com.cf.imes.module.system.mq.producer.sms.SmsProducer;
|
||||
|
||||
+4
-4
@@ -3,10 +3,10 @@ package com.cf.imes.module.system.service.sms;
|
||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.framework.sms.core.client.SmsClient;
|
||||
import com.cf.imes.framework.sms.core.client.SmsClientFactory;
|
||||
import com.cf.imes.framework.sms.core.enums.SmsChannelEnum;
|
||||
import com.cf.imes.framework.sms.core.property.SmsChannelProperties;
|
||||
import com.cf.imes.module.system.framework.sms.core.client.SmsClient;
|
||||
import com.cf.imes.module.system.framework.sms.core.client.SmsClientFactory;
|
||||
import com.cf.imes.module.system.framework.sms.core.enums.SmsChannelEnum;
|
||||
import com.cf.imes.module.system.framework.sms.core.property.SmsChannelProperties;
|
||||
import com.cf.imes.framework.test.core.ut.BaseDbUnitTest;
|
||||
import com.cf.imes.module.system.controller.admin.sms.vo.channel.SmsChannelPageReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.sms.vo.channel.SmsChannelSaveReqVO;
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ import com.cf.imes.module.system.api.sms.dto.code.SmsCodeValidateReqDTO;
|
||||
import com.cf.imes.module.system.dal.dataobject.sms.SmsCodeDO;
|
||||
import com.cf.imes.module.system.dal.mysql.sms.SmsCodeMapper;
|
||||
import com.cf.imes.module.system.enums.sms.SmsSceneEnum;
|
||||
import com.cf.imes.module.system.framework.sms.SmsCodeProperties;
|
||||
import com.cf.imes.module.system.framework.sms.config.SmsCodeProperties;
|
||||
import com.baomidou.mybatisplus.annotation.DbType;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
+3
-3
@@ -4,9 +4,9 @@ import cn.hutool.core.lang.Pair;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
import com.cf.imes.framework.common.enums.UserTypeEnum;
|
||||
import com.cf.imes.framework.sms.core.client.SmsClient;
|
||||
import com.cf.imes.framework.sms.core.client.dto.SmsReceiveRespDTO;
|
||||
import com.cf.imes.framework.sms.core.client.dto.SmsSendRespDTO;
|
||||
import com.cf.imes.module.system.framework.sms.core.client.SmsClient;
|
||||
import com.cf.imes.module.system.framework.sms.core.client.dto.SmsReceiveRespDTO;
|
||||
import com.cf.imes.module.system.framework.sms.core.client.dto.SmsSendRespDTO;
|
||||
import com.cf.imes.framework.test.core.ut.BaseMockitoUnitTest;
|
||||
import com.cf.imes.module.system.dal.dataobject.sms.SmsChannelDO;
|
||||
import com.cf.imes.module.system.dal.dataobject.sms.SmsTemplateDO;
|
||||
|
||||
+3
-3
@@ -5,9 +5,9 @@ import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.collection.ArrayUtils;
|
||||
import com.cf.imes.framework.common.util.object.ObjectUtils;
|
||||
import com.cf.imes.framework.sms.core.client.SmsClient;
|
||||
import com.cf.imes.framework.sms.core.client.dto.SmsTemplateRespDTO;
|
||||
import com.cf.imes.framework.sms.core.enums.SmsTemplateAuditStatusEnum;
|
||||
import com.cf.imes.module.system.framework.sms.core.client.SmsClient;
|
||||
import com.cf.imes.module.system.framework.sms.core.client.dto.SmsTemplateRespDTO;
|
||||
import com.cf.imes.module.system.framework.sms.core.enums.SmsTemplateAuditStatusEnum;
|
||||
import com.cf.imes.framework.test.core.ut.BaseDbUnitTest;
|
||||
import com.cf.imes.module.system.controller.admin.sms.vo.template.SmsTemplatePageReqVO;
|
||||
import com.cf.imes.module.system.controller.admin.sms.vo.template.SmsTemplateSaveReqVO;
|
||||
|
||||
Reference in New Issue
Block a user