mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-09-10 20:57:14 +08:00
refactor(system): 重构短信配置功能模块
This commit is contained in:
@@ -23,12 +23,6 @@
|
||||
<artifactId>cosid-spring-redis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SMS4J(短信聚合框架,轻松集成多家短信服务,解决接入多个短信 SDK 的繁琐流程) -->
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- X File Storage(一行代码将文件存储到本地、FTP、SFTP、WebDAV、阿里云 OSS、华为云 OBS...等其它兼容 S3 协议的存储平台) -->
|
||||
<dependency>
|
||||
<groupId>org.dromara.x-file-storage</groupId>
|
||||
@@ -54,11 +48,11 @@
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- postgresql Java 驱动 -->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.postgresql</groupId>-->
|
||||
<!-- <artifactId>postgresql</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- PostgreSQL Java 驱动 -->
|
||||
<!--<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
</dependency>-->
|
||||
|
||||
<!-- ContiNew Starter 扩展模块 - CURD(增删改查) -->
|
||||
<dependency>
|
||||
|
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package top.continew.admin.common.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import top.continew.starter.core.enums.BaseEnum;
|
||||
|
||||
/**
|
||||
* 方法类型枚举
|
||||
*
|
||||
* @author luoqiz
|
||||
* @since 2025/03/16 13:38
|
||||
*/
|
||||
@Getter
|
||||
@RequiredArgsConstructor
|
||||
public enum MethodTypeEnum implements BaseEnum<String> {
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
ADD("add", "新增"),
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*/
|
||||
UPDATE("update", "更新"),
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
DELETE("delete", "删除"),
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
SEARCH("search", "查询"),;
|
||||
|
||||
private final String value;
|
||||
private final String description;
|
||||
|
||||
}
|
@@ -13,17 +13,16 @@
|
||||
<description>系统管理模块(存放系统管理相关业务功能,例如:部门管理、角色管理、用户管理等)</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- 公共模块(存放公共工具类,公共配置等) -->
|
||||
<!-- 公共模块 -->
|
||||
<dependency>
|
||||
<groupId>top.continew</groupId>
|
||||
<artifactId>continew-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SMS4J(短信聚合框架,轻松集成多家短信服务,解决接入多个短信 SDK 的繁琐流程) -->
|
||||
<dependency>
|
||||
<groupId>org.dromara.sms4j</groupId>
|
||||
<artifactId>sms4j-spring-boot-starter</artifactId>
|
||||
<version>3.3.4</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
@@ -16,30 +16,33 @@
|
||||
|
||||
package top.continew.admin.system.config.sms;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.sms4j.core.factory.SmsFactory;
|
||||
import org.dromara.sms4j.core.proxy.SmsProxyFactory;
|
||||
import org.springframework.context.event.ContextRefreshedEvent;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 短信配置加载器
|
||||
*
|
||||
* @author luoqiz
|
||||
* @author Charles7c
|
||||
* @since 2025/03/15 22:15
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class SmsBlendConfig {
|
||||
@RequiredArgsConstructor
|
||||
public class SmsConfigLoader implements ApplicationRunner {
|
||||
|
||||
@Resource
|
||||
SmsJdbcReadConfig config;
|
||||
private final SmsReadConfigDatabaseImpl smsReadConfig;
|
||||
private final SmsLogProcessor smsLogProcessor;
|
||||
|
||||
@Resource
|
||||
private SmsRecordProcessor smsRecordProcessor;
|
||||
|
||||
@EventListener
|
||||
public void init(ContextRefreshedEvent event) {
|
||||
log.info("初始化短信配置");
|
||||
// 创建SmsBlend 短信实例
|
||||
SmsFactory.createSmsBlend(config);
|
||||
SmsProxyFactory.addPreProcessor(smsRecordProcessor);
|
||||
log.info("初始化短信配置完成");
|
||||
@Override
|
||||
public void run(ApplicationArguments args) {
|
||||
SmsFactory.createSmsBlend(smsReadConfig);
|
||||
SmsProxyFactory.addPreProcessor(smsLogProcessor);
|
||||
log.debug("短信配置初始化完成");
|
||||
}
|
||||
}
|
@@ -16,73 +16,67 @@
|
||||
|
||||
package top.continew.admin.system.config.sms;
|
||||
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.sms4j.api.entity.SmsResponse;
|
||||
import org.dromara.sms4j.api.proxy.CoreMethodProcessor;
|
||||
import org.springframework.stereotype.Component;
|
||||
import top.continew.admin.system.model.req.SmsRecordReq;
|
||||
import top.continew.admin.system.service.SmsRecordService;
|
||||
import top.continew.admin.common.enums.SuccessFailureStatusEnum;
|
||||
import top.continew.admin.system.model.req.SmsLogReq;
|
||||
import top.continew.admin.system.service.SmsLogService;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
/**
|
||||
* 短信日志处理器
|
||||
*
|
||||
* @author luoqiz
|
||||
* @author Charles7c
|
||||
* @since 2025/03/15 22:15
|
||||
*/
|
||||
@Component
|
||||
public class SmsRecordProcessor implements CoreMethodProcessor {
|
||||
@RequiredArgsConstructor
|
||||
public class SmsLogProcessor implements CoreMethodProcessor {
|
||||
|
||||
@Resource
|
||||
private SmsRecordService smsRecordService;
|
||||
private final SmsLogService smsLogService;
|
||||
|
||||
@Override
|
||||
public Object[] preProcessor(Method method, Object source, Object[] param) {
|
||||
return CoreMethodProcessor.super.preProcessor(method, source, param);
|
||||
public Object postProcessor(SmsResponse result, Object[] param) {
|
||||
if (NumberUtil.isNumber(result.getConfigId())) {
|
||||
SmsLogReq req = new SmsLogReq();
|
||||
req.setConfigId(Long.parseLong(result.getConfigId()));
|
||||
req.setPhone(param[0].toString());
|
||||
req.setParams(JSONUtil.toJsonStr(param[1]));
|
||||
req.setStatus(result.isSuccess() ? SuccessFailureStatusEnum.SUCCESS : SuccessFailureStatusEnum.FAILURE);
|
||||
req.setResMsg(JSONUtil.toJsonStr(result.getData()));
|
||||
smsLogService.add(req);
|
||||
}
|
||||
return CoreMethodProcessor.super.postProcessor(result, param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessagePreProcess(String phone, Object message) {
|
||||
System.out.println("发送短信前处理" + phone + message);
|
||||
// do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessageByTemplatePreProcess(String phone,
|
||||
String templateId,
|
||||
LinkedHashMap<String, String> messages) {
|
||||
log.debug("发送短信前处理 sendMessageByTemplatePreProcess " + phone + templateId + JSONUtil.toJsonPrettyStr(messages));
|
||||
// do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public void massTextingPreProcess(List<String> phones, String message) {
|
||||
log.debug("发送短信前处理 massTextingPreProcess " + JSONUtil.toJsonPrettyStr(phones) + message);
|
||||
// do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public void massTextingByTemplatePreProcess(List<String> phones,
|
||||
String templateId,
|
||||
LinkedHashMap<String, String> messages) {
|
||||
log.debug("发送短信前处理 massTextingByTemplatePreProcess " + JSONUtil.toJsonPrettyStr(phones) + JSONUtil
|
||||
.toJsonPrettyStr(messages));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object postProcessor(SmsResponse result, Object[] param) {
|
||||
SmsRecordReq record = new SmsRecordReq();
|
||||
record.setConfigId(Long.parseLong(result.getConfigId()));
|
||||
record.setPhone(param[0].toString());
|
||||
record.setParams(JSONUtil.toJsonPrettyStr(param[1]));
|
||||
record.setStatus(result.isSuccess());
|
||||
record.setResMsg(JSONUtil.toJsonPrettyStr(result.getData()));
|
||||
smsRecordService.add(record);
|
||||
return CoreMethodProcessor.super.postProcessor(result, param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exceptionHandleProcessor(Method method,
|
||||
Object source,
|
||||
Object[] param,
|
||||
Exception exception) throws RuntimeException {
|
||||
CoreMethodProcessor.super.exceptionHandleProcessor(method, source, param, exception);
|
||||
// do nothing
|
||||
}
|
||||
}
|
@@ -16,48 +16,49 @@
|
||||
|
||||
package top.continew.admin.system.config.sms;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.sms4j.core.datainterface.SmsReadConfig;
|
||||
import org.dromara.sms4j.provider.config.BaseConfig;
|
||||
import org.springframework.stereotype.Component;
|
||||
import top.continew.admin.system.config.sms.utils.SmsConvertUtils;
|
||||
import top.continew.admin.common.enums.DisEnableStatusEnum;
|
||||
import top.continew.admin.system.model.query.SmsConfigQuery;
|
||||
import top.continew.admin.system.model.resp.SmsConfigDetailResp;
|
||||
import top.continew.admin.system.model.resp.SmsConfigResp;
|
||||
import top.continew.admin.system.service.SmsConfigService;
|
||||
import top.continew.starter.extension.crud.model.query.SortQuery;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 短信配置读取-数据源实现
|
||||
*
|
||||
* @author luoqiz
|
||||
* @author Charles7c
|
||||
* @since 2025/03/15 22:15
|
||||
*/
|
||||
@Component
|
||||
public class SmsJdbcReadConfig implements SmsReadConfig {
|
||||
@RequiredArgsConstructor
|
||||
public class SmsReadConfigDatabaseImpl implements SmsReadConfig {
|
||||
|
||||
@Resource
|
||||
private SmsConfigService smsConfigService;
|
||||
private final SmsConfigService smsConfigService;
|
||||
|
||||
@Override
|
||||
public BaseConfig getSupplierConfig(String configId) {
|
||||
Long id = Long.parseLong(configId);
|
||||
SmsConfigDetailResp smsConfig = smsConfigService.get(id);
|
||||
if (smsConfig == null || !smsConfig.getIsEnable()) {
|
||||
SmsConfigResp smsConfig = smsConfigService.get(id);
|
||||
if (DisEnableStatusEnum.DISABLE.equals(smsConfig.getStatus())) {
|
||||
return null;
|
||||
}
|
||||
return SmsConvertUtils.smsConfig2BaseConfig(smsConfig);
|
||||
return smsConfig.getSupplier().toBaseConfig(smsConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BaseConfig> getSupplierConfigList() {
|
||||
SmsConfigQuery smsConfigQuery = new SmsConfigQuery();
|
||||
smsConfigQuery.setIsEnable(true);
|
||||
SortQuery sortQuery = new SortQuery();
|
||||
sortQuery.setSort(new String[] {"id", "desc"});
|
||||
List<SmsConfigResp> smsConfigList = smsConfigService.list(smsConfigQuery, sortQuery);
|
||||
List<BaseConfig> baseConfigList = new ArrayList<>();
|
||||
for (SmsConfigResp smsConfigResp : smsConfigList) {
|
||||
baseConfigList.add(SmsConvertUtils.smsConfig2BaseConfig(smsConfigResp));
|
||||
SmsConfigQuery query = new SmsConfigQuery();
|
||||
query.setStatus(DisEnableStatusEnum.ENABLE);
|
||||
List<SmsConfigResp> list = smsConfigService.list(query, null);
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
return List.of();
|
||||
}
|
||||
return baseConfigList;
|
||||
return list.stream().map(smsConfig -> smsConfig.getSupplier().toBaseConfig(smsConfig)).toList();
|
||||
}
|
||||
|
||||
}
|
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package top.continew.admin.system.config.sms.event;
|
||||
|
||||
import lombok.Data;
|
||||
import top.continew.admin.common.enums.MethodTypeEnum;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class SmsEventMessage implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final MethodTypeEnum type;
|
||||
private final String configId;
|
||||
}
|
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package top.continew.admin.system.config.sms.event;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.listener.ChannelTopic;
|
||||
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
|
||||
import org.springframework.data.redis.listener.adapter.MessageListenerAdapter;
|
||||
|
||||
@Configuration
|
||||
public class SmsRedisConfig {
|
||||
|
||||
public static final String SysSmsChannel = "system:sms:topic";
|
||||
|
||||
@Bean
|
||||
RedisMessageListenerContainer container(RedisConnectionFactory connectionFactory,
|
||||
MessageListenerAdapter listenerAdapter) {
|
||||
RedisMessageListenerContainer container = new RedisMessageListenerContainer();
|
||||
container.setConnectionFactory(connectionFactory);
|
||||
container.addMessageListener(listenerAdapter, new ChannelTopic(SysSmsChannel));
|
||||
return container;
|
||||
}
|
||||
|
||||
@Bean
|
||||
MessageListenerAdapter listenerAdapter(SmsRedisMessageSubscriber subscriber) {
|
||||
return new MessageListenerAdapter(subscriber, "onMessage");
|
||||
}
|
||||
}
|
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package top.continew.admin.system.config.sms.event;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class SmsRedisMessagePublisher {
|
||||
|
||||
@Resource
|
||||
private RedisTemplate redisTemplate;
|
||||
|
||||
public void publish(String channel, SmsEventMessage message) {
|
||||
redisTemplate.convertAndSend(channel, message);
|
||||
log.debug("Message published to Redis channel [" + channel + "]: " + message);
|
||||
}
|
||||
}
|
@@ -1,68 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package top.continew.admin.system.config.sms.event;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.sms4j.core.factory.SmsFactory;
|
||||
import org.dromara.sms4j.provider.config.BaseConfig;
|
||||
import org.springframework.data.redis.connection.Message;
|
||||
import org.springframework.data.redis.connection.MessageListener;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
import top.continew.admin.system.config.sms.SmsJdbcReadConfig;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class SmsRedisMessageSubscriber implements MessageListener {
|
||||
|
||||
@Resource
|
||||
private RedisTemplate redisTemplate;
|
||||
|
||||
@Resource
|
||||
private SmsJdbcReadConfig smsJdbcReadConfig;
|
||||
|
||||
@Override
|
||||
public void onMessage(Message message, byte[] pattern) {
|
||||
byte[] body = message.getBody();
|
||||
SmsEventMessage msg = (SmsEventMessage)redisTemplate.getValueSerializer().deserialize(body);
|
||||
switch (msg.getType()) {
|
||||
case ADD:
|
||||
BaseConfig config = smsJdbcReadConfig.getSupplierConfig(msg.getConfigId());
|
||||
if (config != null) {
|
||||
SmsFactory.createSmsBlend(config);
|
||||
}
|
||||
break;
|
||||
case UPDATE:
|
||||
BaseConfig updateConfig = smsJdbcReadConfig.getSupplierConfig(msg.getConfigId());
|
||||
// 若是存在该配置,则先删除
|
||||
if (SmsFactory.getSmsBlend(msg.getConfigId()) != null) {
|
||||
SmsFactory.unregister(msg.getConfigId());
|
||||
}
|
||||
|
||||
if (updateConfig != null) {
|
||||
SmsFactory.createSmsBlend(updateConfig);
|
||||
}
|
||||
break;
|
||||
case DELETE:
|
||||
SmsFactory.unregister(msg.getConfigId());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,94 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package top.continew.admin.system.config.sms.utils;
|
||||
|
||||
import org.dromara.sms4j.aliyun.config.AlibabaConfig;
|
||||
import org.dromara.sms4j.cloopen.config.CloopenConfig;
|
||||
import org.dromara.sms4j.comm.constant.SupplierConstant;
|
||||
import org.dromara.sms4j.ctyun.config.CtyunConfig;
|
||||
import org.dromara.sms4j.provider.config.BaseConfig;
|
||||
import top.continew.admin.system.model.resp.SmsConfigDetailResp;
|
||||
import top.continew.admin.system.model.resp.SmsConfigResp;
|
||||
|
||||
public class SmsConvertUtils {
|
||||
|
||||
public static BaseConfig smsConfig2BaseConfig(SmsConfigResp smsConfig) {
|
||||
switch (smsConfig.getSupplier()) {
|
||||
case SupplierConstant.ALIBABA: {
|
||||
AlibabaConfig alibabaConfig = new AlibabaConfig();
|
||||
alibabaConfig.setConfigId(smsConfig.getId().toString());
|
||||
alibabaConfig.setAccessKeyId(smsConfig.getAccessKeyId());
|
||||
alibabaConfig.setAccessKeySecret(smsConfig.getAccessKeySecret());
|
||||
alibabaConfig.setSignature(smsConfig.getSignature());
|
||||
alibabaConfig.setTemplateId(smsConfig.getTemplateId());
|
||||
return alibabaConfig;
|
||||
}
|
||||
case SupplierConstant.CLOOPEN: {
|
||||
CloopenConfig config = new CloopenConfig();
|
||||
config.setConfigId(smsConfig.getId().toString());
|
||||
config.setAccessKeyId(smsConfig.getAccessKeyId());
|
||||
config.setAccessKeySecret(smsConfig.getAccessKeySecret());
|
||||
config.setSignature(smsConfig.getSignature());
|
||||
config.setTemplateId(smsConfig.getTemplateId());
|
||||
return config;
|
||||
}
|
||||
case SupplierConstant.CTYUN: {
|
||||
CtyunConfig config = new CtyunConfig();
|
||||
config.setConfigId(smsConfig.getId().toString());
|
||||
config.setAccessKeyId(smsConfig.getAccessKeyId());
|
||||
config.setAccessKeySecret(smsConfig.getAccessKeySecret());
|
||||
config.setSignature(smsConfig.getSignature());
|
||||
config.setTemplateId(smsConfig.getTemplateId());
|
||||
return config;
|
||||
}
|
||||
}
|
||||
throw new RuntimeException("短信配置有错误,未知的供应商");
|
||||
}
|
||||
|
||||
public static BaseConfig smsConfig2BaseConfig(SmsConfigDetailResp smsConfig) {
|
||||
switch (smsConfig.getSupplier()) {
|
||||
case SupplierConstant.ALIBABA: {
|
||||
AlibabaConfig alibabaConfig = new AlibabaConfig();
|
||||
alibabaConfig.setConfigId(smsConfig.getId().toString());
|
||||
alibabaConfig.setAccessKeyId(smsConfig.getAccessKeyId());
|
||||
alibabaConfig.setAccessKeySecret(smsConfig.getAccessKeySecret());
|
||||
alibabaConfig.setSignature(smsConfig.getSignature());
|
||||
alibabaConfig.setTemplateId(smsConfig.getTemplateId());
|
||||
return alibabaConfig;
|
||||
}
|
||||
case SupplierConstant.CLOOPEN: {
|
||||
CloopenConfig config = new CloopenConfig();
|
||||
config.setConfigId(smsConfig.getId().toString());
|
||||
config.setAccessKeyId(smsConfig.getAccessKeyId());
|
||||
config.setAccessKeySecret(smsConfig.getAccessKeySecret());
|
||||
config.setSignature(smsConfig.getSignature());
|
||||
config.setTemplateId(smsConfig.getTemplateId());
|
||||
return config;
|
||||
}
|
||||
case SupplierConstant.CTYUN: {
|
||||
CtyunConfig config = new CtyunConfig();
|
||||
config.setConfigId(smsConfig.getId().toString());
|
||||
config.setAccessKeyId(smsConfig.getAccessKeyId());
|
||||
config.setAccessKeySecret(smsConfig.getAccessKeySecret());
|
||||
config.setSignature(smsConfig.getSignature());
|
||||
config.setTemplateId(smsConfig.getTemplateId());
|
||||
return config;
|
||||
}
|
||||
}
|
||||
throw new RuntimeException("短信配置有错误,未知的供应商");
|
||||
}
|
||||
}
|
@@ -18,21 +18,72 @@ package top.continew.admin.system.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.sms4j.aliyun.config.AlibabaConfig;
|
||||
import org.dromara.sms4j.cloopen.config.CloopenConfig;
|
||||
import org.dromara.sms4j.comm.constant.SupplierConstant;
|
||||
import org.dromara.sms4j.ctyun.config.CtyunConfig;
|
||||
import org.dromara.sms4j.provider.config.BaseConfig;
|
||||
import top.continew.admin.system.model.resp.SmsConfigResp;
|
||||
import top.continew.starter.core.enums.BaseEnum;
|
||||
|
||||
/**
|
||||
* 菜单类型枚举
|
||||
* 短信厂商枚举
|
||||
*
|
||||
* @author luoqiz
|
||||
* @author Charles7c
|
||||
* @since 2023/2/15 20:12
|
||||
* @since 2025/03/15 22:15
|
||||
*/
|
||||
@Getter
|
||||
@RequiredArgsConstructor
|
||||
public enum SmsSupplierEnum implements BaseEnum<String> {
|
||||
|
||||
ALIBABA(SupplierConstant.ALIBABA, "阿里云"), CLOOPEN(SupplierConstant.CLOOPEN, "容联云"),
|
||||
CTYUN(SupplierConstant.CTYUN, "天翼云"),
|
||||
/**
|
||||
* 阿里云
|
||||
*/
|
||||
ALIBABA(SupplierConstant.ALIBABA, "阿里云") {
|
||||
@Override
|
||||
public BaseConfig toBaseConfig(SmsConfigResp smsConfig) {
|
||||
AlibabaConfig config = new AlibabaConfig();
|
||||
config.setConfigId(smsConfig.getId().toString());
|
||||
config.setAccessKeyId(smsConfig.getAccessKey());
|
||||
config.setAccessKeySecret(smsConfig.getSecretKey());
|
||||
config.setSignature(smsConfig.getSignature());
|
||||
config.setTemplateId(smsConfig.getTemplateId());
|
||||
return config;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 容联云
|
||||
*/
|
||||
CLOOPEN(SupplierConstant.CLOOPEN, "容联云") {
|
||||
@Override
|
||||
public BaseConfig toBaseConfig(SmsConfigResp smsConfig) {
|
||||
CloopenConfig config = new CloopenConfig();
|
||||
config.setConfigId(smsConfig.getId().toString());
|
||||
config.setAccessKeyId(smsConfig.getAccessKey());
|
||||
config.setAccessKeySecret(smsConfig.getSecretKey());
|
||||
config.setSignature(smsConfig.getSignature());
|
||||
config.setTemplateId(smsConfig.getTemplateId());
|
||||
return config;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 天翼云
|
||||
*/
|
||||
CTYUN(SupplierConstant.CTYUN, "天翼云") {
|
||||
@Override
|
||||
public BaseConfig toBaseConfig(SmsConfigResp smsConfig) {
|
||||
CtyunConfig config = new CtyunConfig();
|
||||
config.setConfigId(smsConfig.getId().toString());
|
||||
config.setAccessKeyId(smsConfig.getAccessKey());
|
||||
config.setAccessKeySecret(smsConfig.getSecretKey());
|
||||
config.setSignature(smsConfig.getSignature());
|
||||
config.setTemplateId(smsConfig.getTemplateId());
|
||||
return config;
|
||||
}
|
||||
},
|
||||
// EMAY(SupplierConstant.EMAY, "亿美软通"), HUAWEI(SupplierConstant.HUAWEI, "华为云短信"),
|
||||
// JDCLOUD(SupplierConstant.JDCLOUD, "京东云短信"), NETEASE(SupplierConstant.NETEASE, "网易云信"),
|
||||
// TENCENT(SupplierConstant.TENCENT, "腾讯云短信"), UNISMS(SupplierConstant.UNISMS, "合一短信"),
|
||||
@@ -47,4 +98,12 @@ public enum SmsSupplierEnum implements BaseEnum<String> {
|
||||
|
||||
private final String value;
|
||||
private final String description;
|
||||
|
||||
/**
|
||||
* 转换为 BaseConfig
|
||||
*
|
||||
* @param smsConfig 短信配置
|
||||
* @return BaseConfig
|
||||
*/
|
||||
public abstract BaseConfig toBaseConfig(SmsConfigResp smsConfig);
|
||||
}
|
||||
|
@@ -20,7 +20,7 @@ import top.continew.starter.data.mp.base.BaseMapper;
|
||||
import top.continew.admin.system.model.entity.SmsConfigDO;
|
||||
|
||||
/**
|
||||
* 短信服务配置 Mapper
|
||||
* 短信配置 Mapper
|
||||
*
|
||||
* @author luoqiz
|
||||
* @since 2025/03/15 18:41
|
||||
|
@@ -17,12 +17,12 @@
|
||||
package top.continew.admin.system.mapper;
|
||||
|
||||
import top.continew.starter.data.mp.base.BaseMapper;
|
||||
import top.continew.admin.system.model.entity.SmsRecordDO;
|
||||
import top.continew.admin.system.model.entity.SmsLogDO;
|
||||
|
||||
/**
|
||||
* 短信记录 Mapper
|
||||
* 短信日志 Mapper
|
||||
*
|
||||
* @author luoqiz
|
||||
* @since 2025/03/15 22:15
|
||||
*/
|
||||
public interface SmsRecordMapper extends BaseMapper<SmsRecordDO> {}
|
||||
public interface SmsLogMapper extends BaseMapper<SmsLogDO> {}
|
@@ -18,15 +18,18 @@ package top.continew.admin.system.model.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import top.continew.admin.common.enums.DisEnableStatusEnum;
|
||||
import top.continew.admin.common.model.entity.BaseDO;
|
||||
import top.continew.admin.system.enums.SmsSupplierEnum;
|
||||
import top.continew.starter.security.crypto.annotation.FieldEncrypt;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 短信服务配置实体
|
||||
* 短信配置实体
|
||||
*
|
||||
* @author luoqiz
|
||||
* @author Charles7c
|
||||
* @since 2025/03/15 18:41
|
||||
*/
|
||||
@Data
|
||||
@@ -42,20 +45,20 @@ public class SmsConfigDO extends BaseDO {
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 厂商名称标识
|
||||
* 厂商
|
||||
*/
|
||||
private String supplier;
|
||||
private SmsSupplierEnum supplier;
|
||||
|
||||
/**
|
||||
* Access Key 或 API Key
|
||||
* Access Key
|
||||
*/
|
||||
private String accessKeyId;
|
||||
private String accessKey;
|
||||
|
||||
/**
|
||||
* Access Secret 或 API Secret
|
||||
* Secret Key
|
||||
*/
|
||||
@FieldEncrypt
|
||||
private String accessKeySecret;
|
||||
private String secretKey;
|
||||
|
||||
/**
|
||||
* 短信签名
|
||||
@@ -73,17 +76,17 @@ public class SmsConfigDO extends BaseDO {
|
||||
private Integer weight;
|
||||
|
||||
/**
|
||||
* 短信自动重试间隔时间(秒)
|
||||
* 重试间隔(单位:秒)
|
||||
*/
|
||||
private Integer retryInterval;
|
||||
|
||||
/**
|
||||
* 短信重试次数
|
||||
* 重试次数
|
||||
*/
|
||||
private Integer maxRetries;
|
||||
|
||||
/**
|
||||
* 当前厂商的发送数量上限
|
||||
* 发送上限
|
||||
*/
|
||||
private Integer maximum;
|
||||
|
||||
@@ -93,7 +96,7 @@ public class SmsConfigDO extends BaseDO {
|
||||
private String supplierConfig;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
* 状态
|
||||
*/
|
||||
private Boolean isEnable;
|
||||
private DisEnableStatusEnum status;
|
||||
}
|
@@ -16,29 +16,29 @@
|
||||
|
||||
package top.continew.admin.system.model.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import top.continew.admin.common.model.entity.BaseDO;
|
||||
import lombok.Data;
|
||||
import top.continew.admin.common.enums.SuccessFailureStatusEnum;
|
||||
import top.continew.admin.common.model.entity.BaseCreateDO;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 短信记录实体
|
||||
* 短信日志实体
|
||||
*
|
||||
* @author luoqiz
|
||||
* @author Charles7c
|
||||
* @since 2025/03/15 22:15
|
||||
*/
|
||||
@Data
|
||||
@TableName("sys_sms_record")
|
||||
public class SmsRecordDO extends BaseDO {
|
||||
@TableName("sys_sms_log")
|
||||
public class SmsLogDO extends BaseCreateDO {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 配置id
|
||||
* 配置 ID
|
||||
*/
|
||||
private Long configId;
|
||||
|
||||
@@ -55,7 +55,7 @@ public class SmsRecordDO extends BaseDO {
|
||||
/**
|
||||
* 发送状态
|
||||
*/
|
||||
private Boolean status;
|
||||
private SuccessFailureStatusEnum status;
|
||||
|
||||
/**
|
||||
* 返回数据
|
@@ -18,6 +18,8 @@ package top.continew.admin.system.model.query;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import top.continew.admin.common.enums.DisEnableStatusEnum;
|
||||
import top.continew.admin.system.enums.SmsSupplierEnum;
|
||||
import top.continew.starter.data.core.annotation.Query;
|
||||
import top.continew.starter.data.core.enums.QueryType;
|
||||
|
||||
@@ -25,13 +27,14 @@ import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 短信服务配置查询条件
|
||||
* 短信配置查询条件
|
||||
*
|
||||
* @author luoqiz
|
||||
* @author Charles7c
|
||||
* @since 2025/03/15 18:41
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "短信服务配置查询条件")
|
||||
@Schema(description = "短信配置查询条件")
|
||||
public class SmsConfigQuery implements Serializable {
|
||||
|
||||
@Serial
|
||||
@@ -40,42 +43,27 @@ public class SmsConfigQuery implements Serializable {
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@Schema(description = "名称")
|
||||
@Schema(description = "名称", example = "短信配置1")
|
||||
@Query(type = QueryType.LIKE)
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 厂商名称标识
|
||||
* 厂商
|
||||
*/
|
||||
@Schema(description = "厂商名称标识")
|
||||
@Query(type = QueryType.EQ)
|
||||
private String supplier;
|
||||
@Schema(description = "厂商", example = "cloopen")
|
||||
@Query
|
||||
private SmsSupplierEnum supplier;
|
||||
|
||||
/**
|
||||
* Access Key 或 API Key
|
||||
* Access Key
|
||||
*/
|
||||
@Schema(description = "Access Key 或 API Key")
|
||||
@Query(type = QueryType.EQ)
|
||||
private String accessKeyId;
|
||||
@Schema(description = "Access Key", example = "7aaf0708674db3ee05676ecbc2f31b7b")
|
||||
@Query
|
||||
private String accessKey;
|
||||
|
||||
/**
|
||||
* 短信签名
|
||||
* 状态
|
||||
*/
|
||||
@Schema(description = "短信签名")
|
||||
@Query(type = QueryType.EQ)
|
||||
private String signature;
|
||||
|
||||
/**
|
||||
* 模板 ID
|
||||
*/
|
||||
@Schema(description = "模板 ID")
|
||||
@Query(type = QueryType.EQ)
|
||||
private String templateId;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
@Schema(description = "是否启用")
|
||||
@Query(type = QueryType.EQ)
|
||||
private Boolean isEnable;
|
||||
@Schema(description = "状态", example = "1")
|
||||
private DisEnableStatusEnum status;
|
||||
}
|
@@ -18,43 +18,44 @@ package top.continew.admin.system.model.query;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import top.continew.admin.common.enums.SuccessFailureStatusEnum;
|
||||
import top.continew.starter.data.core.annotation.Query;
|
||||
import top.continew.starter.data.core.enums.QueryType;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 短信记录查询条件
|
||||
* 短信日志查询条件
|
||||
*
|
||||
* @author luoqiz
|
||||
* @author Charles7c
|
||||
* @since 2025/03/15 22:15
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "短信记录查询条件")
|
||||
public class SmsRecordQuery implements Serializable {
|
||||
@Schema(description = "短信日志查询条件")
|
||||
public class SmsLogQuery implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 配置id
|
||||
* 配置 ID
|
||||
*/
|
||||
@Schema(description = "配置id")
|
||||
@Query(type = QueryType.EQ)
|
||||
@Schema(description = "配置 ID", example = "1")
|
||||
@Query
|
||||
private Long configId;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Schema(description = "手机号")
|
||||
@Query(type = QueryType.EQ)
|
||||
@Schema(description = "手机号", example = "18888888888")
|
||||
@Query
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 发送状态
|
||||
*/
|
||||
@Schema(description = "发送状态")
|
||||
@Query(type = QueryType.EQ)
|
||||
private Boolean status;
|
||||
@Schema(description = "发送状态", example = "1")
|
||||
@Query
|
||||
private SuccessFailureStatusEnum status;
|
||||
}
|
@@ -23,18 +23,21 @@ import lombok.Data;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
import top.continew.admin.common.enums.DisEnableStatusEnum;
|
||||
import top.continew.admin.system.enums.SmsSupplierEnum;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 创建或修改短信服务配置参数
|
||||
* 创建或修改短信配置参数
|
||||
*
|
||||
* @author luoqiz
|
||||
* @author Charles7c
|
||||
* @since 2025/03/15 18:41
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "创建或修改短信服务配置参数")
|
||||
@Schema(description = "创建或修改短信配置参数")
|
||||
public class SmsConfigReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
@@ -43,86 +46,83 @@ public class SmsConfigReq implements Serializable {
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@Schema(description = "名称")
|
||||
@Schema(description = "名称", example = "短信配置1")
|
||||
@NotBlank(message = "名称不能为空")
|
||||
@Length(max = 255, message = "名称长度不能超过 {max} 个字符")
|
||||
@Length(max = 100, message = "名称长度不能超过 {max} 个字符")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 厂商名称标识
|
||||
* 厂商
|
||||
*/
|
||||
@Schema(description = "厂商名称标识")
|
||||
@NotBlank(message = "厂商名称标识不能为空")
|
||||
@Length(max = 50, message = "厂商名称标识长度不能超过 {max} 个字符")
|
||||
private String supplier;
|
||||
@Schema(description = "厂商", example = "cloopen")
|
||||
@NotNull(message = "厂商无效")
|
||||
private SmsSupplierEnum supplier;
|
||||
|
||||
/**
|
||||
* Access Key 或 API Key
|
||||
* Access Key
|
||||
*/
|
||||
@Schema(description = "Access Key 或 API Key")
|
||||
@NotBlank(message = "Access Key 或 API Key不能为空")
|
||||
@Length(max = 255, message = "Access Key 或 API Key长度不能超过 {max} 个字符")
|
||||
private String accessKeyId;
|
||||
@Schema(description = "Access Key", example = "7aaf0708674db3ee05676ecbc2f31b7b")
|
||||
@NotBlank(message = "Access Key 不能为空")
|
||||
@Length(max = 255, message = "Access Key 长度不能超过 {max} 个字符")
|
||||
private String accessKey;
|
||||
|
||||
/**
|
||||
* Access Secret 或 API Secret
|
||||
* Secret Key
|
||||
*/
|
||||
@Schema(description = "Access Secret 或 API Secret")
|
||||
@NotBlank(message = "Access Secret 或 API Secret不能为空")
|
||||
@Length(max = 255, message = "Access Secret 或 API Secret长度不能超过 {max} 个字符")
|
||||
private String accessKeySecret;
|
||||
@Schema(description = "Secret Key", example = "7fd47ade9ae54cddb222222sdsdss57be")
|
||||
@NotBlank(message = "Secret Key 不能为空")
|
||||
@Length(max = 255, message = "Secret Key 长度不能超过 {max} 个字符")
|
||||
private String secretKey;
|
||||
|
||||
/**
|
||||
* 短信签名
|
||||
*/
|
||||
@Schema(description = "短信签名")
|
||||
@NotBlank(message = "短信签名不能为空")
|
||||
@Schema(description = "短信签名", example = "")
|
||||
@Length(max = 100, message = "短信签名长度不能超过 {max} 个字符")
|
||||
private String signature;
|
||||
|
||||
/**
|
||||
* 模板 ID
|
||||
*/
|
||||
@Schema(description = "模板 ID")
|
||||
@NotBlank(message = "模板 ID不能为空")
|
||||
@Length(max = 50, message = "模板 ID长度不能超过 {max} 个字符")
|
||||
@Schema(description = "模板 ID", example = "1")
|
||||
@NotBlank(message = "模板 ID 不能为空")
|
||||
@Length(max = 50, message = "模板 ID 长度不能超过 {max} 个字符")
|
||||
private String templateId;
|
||||
|
||||
/**
|
||||
* 负载均衡权重
|
||||
*/
|
||||
@Schema(description = "负载均衡权重")
|
||||
@Schema(description = "负载均衡权重", example = "1")
|
||||
private Integer weight;
|
||||
|
||||
/**
|
||||
* 短信自动重试间隔时间(秒)
|
||||
* 重试间隔(单位:秒)
|
||||
*/
|
||||
@Schema(description = "短信自动重试间隔时间(秒)")
|
||||
@Schema(description = "重试间隔(单位:秒)", example = "5")
|
||||
private Integer retryInterval;
|
||||
|
||||
/**
|
||||
* 短信重试次数
|
||||
* 重试次数
|
||||
*/
|
||||
@Schema(description = "短信重试次数")
|
||||
@Schema(description = "重试次数", example = "0")
|
||||
private Integer maxRetries;
|
||||
|
||||
/**
|
||||
* 当前厂商的发送数量上限
|
||||
* 发送上限
|
||||
*/
|
||||
@Schema(description = "当前厂商的发送数量上限")
|
||||
@Schema(description = "发送上限")
|
||||
private Integer maximum;
|
||||
|
||||
/**
|
||||
* 各个厂商独立配置
|
||||
*/
|
||||
@Schema(description = "各个厂商独立配置")
|
||||
@Length(max = 10000, message = "各个厂商独立配置长度不能超过 {max} 个字符")
|
||||
@Schema(description = "各个厂商独立配置", example = "")
|
||||
@Length(max = 65535, message = "各个厂商独立配置长度不能超过 {max} 个字符")
|
||||
private String supplierConfig;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
* 状态
|
||||
*/
|
||||
@Schema(description = "是否启用")
|
||||
@NotNull(message = "是否启用不能为空")
|
||||
private Boolean isEnable;
|
||||
@Schema(description = "状态", example = "1")
|
||||
private DisEnableStatusEnum status;
|
||||
}
|
@@ -14,69 +14,49 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package top.continew.admin.system.model.resp;
|
||||
package top.continew.admin.system.model.req;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import top.continew.admin.common.model.resp.BaseResp;
|
||||
import top.continew.admin.common.enums.SuccessFailureStatusEnum;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.time.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 短信记录信息
|
||||
* 创建或修改短信日志参数
|
||||
*
|
||||
* @author luoqiz
|
||||
* @author Charles7c
|
||||
* @since 2025/03/15 22:15
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "短信记录信息")
|
||||
public class SmsRecordResp extends BaseResp {
|
||||
public class SmsLogReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 配置id
|
||||
* 配置 ID
|
||||
*/
|
||||
@Schema(description = "配置id")
|
||||
private Long configId;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Schema(description = "手机号")
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 参数配置
|
||||
*/
|
||||
@Schema(description = "参数配置")
|
||||
private String params;
|
||||
|
||||
/**
|
||||
* 发送状态
|
||||
*/
|
||||
@Schema(description = "发送状态")
|
||||
private Boolean status;
|
||||
private SuccessFailureStatusEnum status;
|
||||
|
||||
/**
|
||||
* 返回数据
|
||||
*/
|
||||
@Schema(description = "返回数据")
|
||||
private String resMsg;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
@Schema(description = "修改人")
|
||||
private Long updateUser;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@Schema(description = "修改时间")
|
||||
private LocalDateTime updateTime;
|
||||
}
|
@@ -1,76 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package top.continew.admin.system.model.req;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 创建或修改短信记录参数
|
||||
*
|
||||
* @author luoqiz
|
||||
* @since 2025/03/15 22:15
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "创建或修改短信记录参数")
|
||||
public class SmsRecordReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 配置id
|
||||
*/
|
||||
@Schema(description = "配置id")
|
||||
@NotNull(message = "配置id不能为空")
|
||||
private Long configId;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Schema(description = "手机号")
|
||||
@NotBlank(message = "手机号不能为空")
|
||||
@Length(max = 25, message = "手机号长度不能超过 {max} 个字符")
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 参数配置
|
||||
*/
|
||||
@Schema(description = "参数配置")
|
||||
private String params;
|
||||
|
||||
/**
|
||||
* 发送状态
|
||||
*/
|
||||
@Schema(description = "发送状态")
|
||||
@NotNull(message = "发送状态不能为空")
|
||||
private Boolean status;
|
||||
|
||||
/**
|
||||
* 返回数据
|
||||
*/
|
||||
@Schema(description = "返回数据")
|
||||
@NotBlank(message = "返回数据不能为空")
|
||||
@Length(max = 2048, message = "返回数据长度不能超过 {max} 个字符")
|
||||
private String resMsg;
|
||||
}
|
@@ -1,126 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package top.continew.admin.system.model.resp;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import top.continew.admin.common.model.resp.BaseDetailResp;
|
||||
import top.continew.starter.security.mask.annotation.JsonMask;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 短信服务配置详情信息
|
||||
*
|
||||
* @author luoqiz
|
||||
* @since 2025/03/15 18:41
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@Schema(description = "短信服务配置详情信息")
|
||||
public class SmsConfigDetailResp extends BaseDetailResp {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@Schema(description = "名称")
|
||||
@ExcelProperty(value = "名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 厂商名称标识
|
||||
*/
|
||||
@Schema(description = "厂商名称标识")
|
||||
@ExcelProperty(value = "厂商名称标识")
|
||||
private String supplier;
|
||||
|
||||
/**
|
||||
* Access Key 或 API Key
|
||||
*/
|
||||
@Schema(description = "Access Key 或 API Key")
|
||||
@ExcelProperty(value = "Access Key 或 API Key")
|
||||
private String accessKeyId;
|
||||
|
||||
/**
|
||||
* Access Secret 或 API Secret
|
||||
*/
|
||||
@Schema(description = "Access Secret 或 API Secret")
|
||||
@ExcelProperty(value = "Access Secret 或 API Secret")
|
||||
@JsonMask(left = 4, right = 4, character = '*')
|
||||
private String accessKeySecret;
|
||||
|
||||
/**
|
||||
* 短信签名
|
||||
*/
|
||||
@Schema(description = "短信签名")
|
||||
@ExcelProperty(value = "短信签名")
|
||||
private String signature;
|
||||
|
||||
/**
|
||||
* 模板 ID
|
||||
*/
|
||||
@Schema(description = "模板 ID")
|
||||
@ExcelProperty(value = "模板 ID")
|
||||
private String templateId;
|
||||
|
||||
/**
|
||||
* 负载均衡权重
|
||||
*/
|
||||
@Schema(description = "负载均衡权重")
|
||||
@ExcelProperty(value = "负载均衡权重")
|
||||
private Integer weight;
|
||||
|
||||
/**
|
||||
* 短信自动重试间隔时间(秒)
|
||||
*/
|
||||
@Schema(description = "短信自动重试间隔时间(秒)")
|
||||
@ExcelProperty(value = "短信自动重试间隔时间(秒)")
|
||||
private Integer retryInterval;
|
||||
|
||||
/**
|
||||
* 短信重试次数
|
||||
*/
|
||||
@Schema(description = "短信重试次数")
|
||||
@ExcelProperty(value = "短信重试次数")
|
||||
private Integer maxRetries;
|
||||
|
||||
/**
|
||||
* 当前厂商的发送数量上限
|
||||
*/
|
||||
@Schema(description = "当前厂商的发送数量上限")
|
||||
@ExcelProperty(value = "当前厂商的发送数量上限")
|
||||
private Integer maximum;
|
||||
|
||||
/**
|
||||
* 各个厂商独立配置
|
||||
*/
|
||||
@Schema(description = "各个厂商独立配置")
|
||||
@ExcelProperty(value = "各个厂商独立配置")
|
||||
private String supplierConfig;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
@Schema(description = "是否启用")
|
||||
@ExcelProperty(value = "是否启用")
|
||||
private Boolean isEnable;
|
||||
}
|
@@ -16,23 +16,29 @@
|
||||
|
||||
package top.continew.admin.system.model.resp;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import top.continew.admin.common.model.resp.BaseResp;
|
||||
import top.continew.admin.common.enums.DisEnableStatusEnum;
|
||||
import top.continew.admin.common.model.resp.BaseDetailResp;
|
||||
import top.continew.admin.system.enums.SmsSupplierEnum;
|
||||
import top.continew.starter.file.excel.converter.ExcelBaseEnumConverter;
|
||||
import top.continew.starter.security.mask.annotation.JsonMask;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 短信服务配置信息
|
||||
* 短信配置信息
|
||||
*
|
||||
* @author luoqiz
|
||||
* @author Charles7c
|
||||
* @since 2025/03/15 18:41
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "短信服务配置信息")
|
||||
public class SmsConfigResp extends BaseResp {
|
||||
@ExcelIgnoreUnannotated
|
||||
@Schema(description = "短信配置信息")
|
||||
public class SmsConfigResp extends BaseDetailResp {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -40,85 +46,85 @@ public class SmsConfigResp extends BaseResp {
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@Schema(description = "名称")
|
||||
@Schema(description = "名称", example = "短信配置1")
|
||||
@ExcelProperty(value = "名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 厂商名称标识
|
||||
* 厂商
|
||||
*/
|
||||
@Schema(description = "厂商名称标识")
|
||||
private String supplier;
|
||||
@Schema(description = "厂商", example = "cloopen")
|
||||
@ExcelProperty(value = "厂商")
|
||||
private SmsSupplierEnum supplier;
|
||||
|
||||
/**
|
||||
* Access Key 或 API Key
|
||||
* Access Key
|
||||
*/
|
||||
@Schema(description = "Access Key 或 API Key")
|
||||
private String accessKeyId;
|
||||
@Schema(description = "Access Key", example = "7aaf0708674db3ee05676ecbc2f31b7b")
|
||||
@ExcelProperty(value = "Access Key")
|
||||
private String accessKey;
|
||||
|
||||
/**
|
||||
* Access Secret 或 API Secret
|
||||
* Secret Key
|
||||
*/
|
||||
@Schema(description = "Access Secret 或 API Secret")
|
||||
@JsonMask(left = 4, right = 4, character = '*')
|
||||
private String accessKeySecret;
|
||||
@Schema(description = "Secret Key", example = "7fd4************************57be")
|
||||
@ExcelProperty(value = "Secret Key")
|
||||
@JsonMask(left = 4, right = 4)
|
||||
private String secretKey;
|
||||
|
||||
/**
|
||||
* 短信签名
|
||||
*/
|
||||
@Schema(description = "短信签名")
|
||||
@Schema(description = "短信签名", example = "")
|
||||
@ExcelProperty(value = "短信签名")
|
||||
private String signature;
|
||||
|
||||
/**
|
||||
* 模板 ID
|
||||
*/
|
||||
@Schema(description = "模板 ID")
|
||||
@Schema(description = "模板 ID", example = "1")
|
||||
@ExcelProperty(value = "模板 ID")
|
||||
private String templateId;
|
||||
|
||||
/**
|
||||
* 负载均衡权重
|
||||
*/
|
||||
@Schema(description = "负载均衡权重")
|
||||
@Schema(description = "负载均衡权重", example = "1")
|
||||
@ExcelProperty(value = "负载均衡权重")
|
||||
private Integer weight;
|
||||
|
||||
/**
|
||||
* 短信自动重试间隔时间(秒)
|
||||
* 重试间隔(单位:秒)
|
||||
*/
|
||||
@Schema(description = "短信自动重试间隔时间(秒)")
|
||||
@Schema(description = "重试间隔(单位:秒)", example = "5")
|
||||
@ExcelProperty(value = "重试间隔(单位:秒)")
|
||||
private Integer retryInterval;
|
||||
|
||||
/**
|
||||
* 短信重试次数
|
||||
* 重试次数
|
||||
*/
|
||||
@Schema(description = "短信重试次数")
|
||||
@Schema(description = "重试次数", example = "0")
|
||||
@ExcelProperty(value = "重试次数")
|
||||
private Integer maxRetries;
|
||||
|
||||
/**
|
||||
* 当前厂商的发送数量上限
|
||||
* 发送上限
|
||||
*/
|
||||
@Schema(description = "当前厂商的发送数量上限")
|
||||
@Schema(description = "发送上限")
|
||||
@ExcelProperty(value = "发送上限")
|
||||
private Integer maximum;
|
||||
|
||||
/**
|
||||
* 各个厂商独立配置
|
||||
*/
|
||||
@Schema(description = "各个厂商独立配置")
|
||||
@Schema(description = "各个厂商独立配置", example = "")
|
||||
@ExcelProperty(value = "各个厂商独立配置")
|
||||
private String supplierConfig;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
* 状态
|
||||
*/
|
||||
@Schema(description = "是否启用")
|
||||
private Boolean isEnable;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
@Schema(description = "修改人")
|
||||
private Long updateUser;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@Schema(description = "修改时间")
|
||||
private LocalDateTime updateTime;
|
||||
@Schema(description = "状态", example = "1")
|
||||
@ExcelProperty(value = "状态", converter = ExcelBaseEnumConverter.class)
|
||||
private DisEnableStatusEnum status;
|
||||
}
|
@@ -20,35 +20,38 @@ import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import top.continew.admin.common.model.resp.BaseDetailResp;
|
||||
import top.continew.admin.common.enums.SuccessFailureStatusEnum;
|
||||
import top.continew.admin.common.model.resp.BaseResp;
|
||||
import top.continew.starter.file.excel.converter.ExcelBaseEnumConverter;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 短信记录详情信息
|
||||
* 短信日志信息
|
||||
*
|
||||
* @author luoqiz
|
||||
* @author Charles7c
|
||||
* @since 2025/03/15 22:15
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@Schema(description = "短信记录详情信息")
|
||||
public class SmsRecordDetailResp extends BaseDetailResp {
|
||||
@Schema(description = "短信日志信息")
|
||||
public class SmsLogResp extends BaseResp {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 配置id
|
||||
* 配置 ID
|
||||
*/
|
||||
@Schema(description = "配置id")
|
||||
@ExcelProperty(value = "配置id")
|
||||
@Schema(description = "配置 ID", example = "")
|
||||
@ExcelProperty(value = "配置 ID")
|
||||
private Long configId;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Schema(description = "手机号")
|
||||
@Schema(description = "手机号", example = "18888888888")
|
||||
@ExcelProperty(value = "手机号")
|
||||
private String phone;
|
||||
|
||||
@@ -62,9 +65,9 @@ public class SmsRecordDetailResp extends BaseDetailResp {
|
||||
/**
|
||||
* 发送状态
|
||||
*/
|
||||
@Schema(description = "发送状态")
|
||||
@ExcelProperty(value = "发送状态")
|
||||
private Boolean status;
|
||||
@Schema(description = "发送状态", example = "1")
|
||||
@ExcelProperty(value = "发送状态", converter = ExcelBaseEnumConverter.class)
|
||||
private SuccessFailureStatusEnum status;
|
||||
|
||||
/**
|
||||
* 返回数据
|
@@ -16,16 +16,15 @@
|
||||
|
||||
package top.continew.admin.system.service;
|
||||
|
||||
import top.continew.starter.extension.crud.service.BaseService;
|
||||
import top.continew.admin.system.model.query.SmsConfigQuery;
|
||||
import top.continew.admin.system.model.req.SmsConfigReq;
|
||||
import top.continew.admin.system.model.resp.SmsConfigDetailResp;
|
||||
import top.continew.admin.system.model.resp.SmsConfigResp;
|
||||
import top.continew.starter.extension.crud.service.BaseService;
|
||||
|
||||
/**
|
||||
* 短信服务配置业务接口
|
||||
* 短信配置业务接口
|
||||
*
|
||||
* @author luoqiz
|
||||
* @since 2025/03/15 18:41
|
||||
*/
|
||||
public interface SmsConfigService extends BaseService<SmsConfigResp, SmsConfigDetailResp, SmsConfigQuery, SmsConfigReq> {}
|
||||
public interface SmsConfigService extends BaseService<SmsConfigResp, SmsConfigResp, SmsConfigQuery, SmsConfigReq> {}
|
@@ -16,16 +16,15 @@
|
||||
|
||||
package top.continew.admin.system.service;
|
||||
|
||||
import top.continew.admin.system.model.query.SmsLogQuery;
|
||||
import top.continew.admin.system.model.req.SmsLogReq;
|
||||
import top.continew.admin.system.model.resp.SmsLogResp;
|
||||
import top.continew.starter.extension.crud.service.BaseService;
|
||||
import top.continew.admin.system.model.query.SmsRecordQuery;
|
||||
import top.continew.admin.system.model.req.SmsRecordReq;
|
||||
import top.continew.admin.system.model.resp.SmsRecordDetailResp;
|
||||
import top.continew.admin.system.model.resp.SmsRecordResp;
|
||||
|
||||
/**
|
||||
* 短信记录业务接口
|
||||
* 短信日志业务接口
|
||||
*
|
||||
* @author luoqiz
|
||||
* @since 2025/03/15 22:15
|
||||
*/
|
||||
public interface SmsRecordService extends BaseService<SmsRecordResp, SmsRecordDetailResp, SmsRecordQuery, SmsRecordReq> {}
|
||||
public interface SmsLogService extends BaseService<SmsLogResp, SmsLogResp, SmsLogQuery, SmsLogReq> {}
|
@@ -16,18 +16,16 @@
|
||||
|
||||
package top.continew.admin.system.service.impl;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.sms4j.core.factory.SmsFactory;
|
||||
import org.dromara.sms4j.provider.config.BaseConfig;
|
||||
import org.springframework.stereotype.Service;
|
||||
import top.continew.admin.common.enums.MethodTypeEnum;
|
||||
import top.continew.admin.system.config.sms.event.SmsEventMessage;
|
||||
import top.continew.admin.system.config.sms.event.SmsRedisConfig;
|
||||
import top.continew.admin.system.config.sms.event.SmsRedisMessagePublisher;
|
||||
import top.continew.admin.system.enums.SmsSupplierEnum;
|
||||
import top.continew.admin.system.mapper.SmsConfigMapper;
|
||||
import top.continew.admin.system.model.entity.SmsConfigDO;
|
||||
import top.continew.admin.system.model.query.SmsConfigQuery;
|
||||
import top.continew.admin.system.model.req.SmsConfigReq;
|
||||
import top.continew.admin.system.model.resp.SmsConfigDetailResp;
|
||||
import top.continew.admin.system.model.resp.SmsConfigResp;
|
||||
import top.continew.admin.system.service.SmsConfigService;
|
||||
import top.continew.starter.extension.crud.service.BaseServiceImpl;
|
||||
@@ -35,39 +33,55 @@ import top.continew.starter.extension.crud.service.BaseServiceImpl;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 短信服务配置业务实现
|
||||
* 短信配置业务实现
|
||||
*
|
||||
* @author luoqiz
|
||||
* @since 2025/03/15 18:41
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class SmsConfigServiceImpl extends BaseServiceImpl<SmsConfigMapper, SmsConfigDO, SmsConfigResp, SmsConfigDetailResp, SmsConfigQuery, SmsConfigReq> implements SmsConfigService {
|
||||
@Resource
|
||||
private SmsRedisMessagePublisher smsRedisMessagePublisher;
|
||||
public class SmsConfigServiceImpl extends BaseServiceImpl<SmsConfigMapper, SmsConfigDO, SmsConfigResp, SmsConfigResp, SmsConfigQuery, SmsConfigReq> implements SmsConfigService {
|
||||
|
||||
@Override
|
||||
protected void afterAdd(SmsConfigReq req, SmsConfigDO entity) {
|
||||
super.afterAdd(req, entity);
|
||||
smsRedisMessagePublisher.publish(SmsRedisConfig.SysSmsChannel, new SmsEventMessage(MethodTypeEnum.ADD, entity
|
||||
.getId()
|
||||
.toString()));
|
||||
public void afterAdd(SmsConfigReq req, SmsConfigDO entity) {
|
||||
this.load(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void afterUpdate(SmsConfigReq req, SmsConfigDO entity) {
|
||||
super.afterUpdate(req, entity);
|
||||
smsRedisMessagePublisher.publish(SmsRedisConfig.SysSmsChannel, new SmsEventMessage(MethodTypeEnum.UPDATE, entity
|
||||
.getId()
|
||||
.toString()));
|
||||
public void afterUpdate(SmsConfigReq req, SmsConfigDO entity) {
|
||||
// 重新加载配置
|
||||
// 先卸载
|
||||
this.unload(entity.getId().toString());
|
||||
// 再加载
|
||||
this.load(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void afterDelete(List<Long> ids) {
|
||||
super.afterDelete(ids);
|
||||
public void afterDelete(List<Long> ids) {
|
||||
for (Long id : ids) {
|
||||
smsRedisMessagePublisher.publish(SmsRedisConfig.SysSmsChannel, new SmsEventMessage(MethodTypeEnum.DELETE, id
|
||||
.toString()));
|
||||
this.unload(id.toString());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载配置
|
||||
*
|
||||
* @param entity 配置信息
|
||||
*/
|
||||
private void load(SmsConfigDO entity) {
|
||||
SmsSupplierEnum supplier = entity.getSupplier();
|
||||
BaseConfig config = supplier.toBaseConfig(BeanUtil.toBean(entity, SmsConfigResp.class));
|
||||
SmsFactory.createSmsBlend(config);
|
||||
}
|
||||
|
||||
/**
|
||||
* 卸载配置
|
||||
*
|
||||
* @param configId 配置 ID
|
||||
*/
|
||||
private void unload(String configId) {
|
||||
if (SmsFactory.getSmsBlend(configId) != null) {
|
||||
SmsFactory.unregister(configId);
|
||||
}
|
||||
}
|
||||
}
|
@@ -16,25 +16,20 @@
|
||||
|
||||
package top.continew.admin.system.service.impl;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import top.continew.admin.system.mapper.SmsLogMapper;
|
||||
import top.continew.admin.system.model.entity.SmsLogDO;
|
||||
import top.continew.admin.system.model.query.SmsLogQuery;
|
||||
import top.continew.admin.system.model.req.SmsLogReq;
|
||||
import top.continew.admin.system.model.resp.SmsLogResp;
|
||||
import top.continew.admin.system.service.SmsLogService;
|
||||
import top.continew.starter.extension.crud.service.BaseServiceImpl;
|
||||
import top.continew.admin.system.mapper.SmsRecordMapper;
|
||||
import top.continew.admin.system.model.entity.SmsRecordDO;
|
||||
import top.continew.admin.system.model.query.SmsRecordQuery;
|
||||
import top.continew.admin.system.model.req.SmsRecordReq;
|
||||
import top.continew.admin.system.model.resp.SmsRecordDetailResp;
|
||||
import top.continew.admin.system.model.resp.SmsRecordResp;
|
||||
import top.continew.admin.system.service.SmsRecordService;
|
||||
|
||||
/**
|
||||
* 短信记录业务实现
|
||||
* 短信日志业务实现
|
||||
*
|
||||
* @author luoqiz
|
||||
* @since 2025/03/15 22:15
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class SmsRecordServiceImpl extends BaseServiceImpl<SmsRecordMapper, SmsRecordDO, SmsRecordResp, SmsRecordDetailResp, SmsRecordQuery, SmsRecordReq> implements SmsRecordService {}
|
||||
public class SmsLogServiceImpl extends BaseServiceImpl<SmsLogMapper, SmsLogDO, SmsLogResp, SmsLogResp, SmsLogQuery, SmsLogReq> implements SmsLogService {}
|
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="top.continew.admin.system.mapper.SmsRecordMapper">
|
||||
<mapper namespace="top.continew.admin.system.mapper.SmsLogMapper">
|
||||
</mapper>
|
@@ -20,7 +20,7 @@
|
||||
</modules>
|
||||
|
||||
<dependencies>
|
||||
<!-- 公共模块(存放公共工具类,公共配置等) -->
|
||||
<!-- 公共模块 -->
|
||||
<dependency>
|
||||
<groupId>top.continew</groupId>
|
||||
<artifactId>continew-common</artifactId>
|
||||
|
@@ -25,36 +25,36 @@
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- ContiNew Starter 日志模块 - 拦截器版(Spring Boot Actuator HttpTrace 增强版) -->
|
||||
<dependency>
|
||||
<groupId>top.continew</groupId>
|
||||
<artifactId>continew-starter-log-interceptor</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 系统管理模块(存放系统管理模块相关功能,例如:部门管理、角色管理、用户管理等) -->
|
||||
<!-- 系统管理模块 -->
|
||||
<dependency>
|
||||
<groupId>top.continew</groupId>
|
||||
<artifactId>continew-module-system</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 任务调度插件(后续会改造为独立插件) -->
|
||||
<!-- 任务调度插件 -->
|
||||
<dependency>
|
||||
<groupId>top.continew</groupId>
|
||||
<artifactId>continew-plugin-schedule</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 能力开放插件(后续会改造为独立插件) -->
|
||||
<!-- 能力开放插件 -->
|
||||
<dependency>
|
||||
<groupId>top.continew</groupId>
|
||||
<artifactId>continew-plugin-open</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 代码生成器插件(后续会改造为独立插件) -->
|
||||
<!-- 代码生成器插件 -->
|
||||
<dependency>
|
||||
<groupId>top.continew</groupId>
|
||||
<artifactId>continew-plugin-generator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- ContiNew Starter 日志模块 - 拦截器版(Spring Boot Actuator HttpTrace 增强版) -->
|
||||
<dependency>
|
||||
<groupId>top.continew</groupId>
|
||||
<artifactId>continew-starter-log-interceptor</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Liquibase(用于管理数据库版本,跟踪、管理和应用数据库变化) -->
|
||||
<dependency>
|
||||
<groupId>org.liquibase</groupId>
|
||||
|
@@ -16,28 +16,26 @@
|
||||
|
||||
package top.continew.admin.controller.system;
|
||||
|
||||
import top.continew.starter.extension.crud.enums.Api;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import top.continew.starter.extension.crud.annotation.CrudRequestMapping;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import top.continew.admin.common.controller.BaseController;
|
||||
import top.continew.admin.system.model.query.SmsConfigQuery;
|
||||
import top.continew.admin.system.model.req.SmsConfigReq;
|
||||
import top.continew.admin.system.model.resp.SmsConfigDetailResp;
|
||||
import top.continew.admin.system.model.resp.SmsConfigResp;
|
||||
import top.continew.admin.system.service.SmsConfigService;
|
||||
import top.continew.starter.extension.crud.annotation.CrudRequestMapping;
|
||||
import top.continew.starter.extension.crud.enums.Api;
|
||||
|
||||
/**
|
||||
* 短信服务配置管理 API
|
||||
* 短信配置管理 API
|
||||
*
|
||||
* @author luoqiz
|
||||
* @author Charles7c
|
||||
* @since 2025/03/15 18:41
|
||||
*/
|
||||
@Tag(name = "短信服务配置管理 API")
|
||||
@Tag(name = "短信配置管理 API")
|
||||
@Validated
|
||||
@RestController
|
||||
@CrudRequestMapping(value = "/system/smsConfig", api = {Api.PAGE, Api.DETAIL, Api.ADD, Api.UPDATE, Api.DELETE,
|
||||
Api.EXPORT})
|
||||
public class SmsConfigController extends BaseController<SmsConfigService, SmsConfigResp, SmsConfigDetailResp, SmsConfigQuery, SmsConfigReq> {}
|
||||
@CrudRequestMapping(value = "/system/smsConfig", api = {Api.PAGE, Api.DETAIL, Api.ADD, Api.UPDATE, Api.DELETE})
|
||||
public class SmsConfigController extends BaseController<SmsConfigService, SmsConfigResp, SmsConfigResp, SmsConfigQuery, SmsConfigReq> {}
|
@@ -17,25 +17,26 @@
|
||||
package top.continew.admin.controller.system;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import top.continew.admin.common.controller.BaseController;
|
||||
import top.continew.admin.system.model.query.SmsRecordQuery;
|
||||
import top.continew.admin.system.model.req.SmsRecordReq;
|
||||
import top.continew.admin.system.model.resp.SmsRecordDetailResp;
|
||||
import top.continew.admin.system.model.resp.SmsRecordResp;
|
||||
import top.continew.admin.system.service.SmsRecordService;
|
||||
import top.continew.admin.system.model.query.SmsLogQuery;
|
||||
import top.continew.admin.system.model.req.SmsLogReq;
|
||||
import top.continew.admin.system.model.resp.SmsLogResp;
|
||||
import top.continew.admin.system.service.SmsLogService;
|
||||
import top.continew.starter.extension.crud.annotation.CrudRequestMapping;
|
||||
import top.continew.starter.extension.crud.enums.Api;
|
||||
|
||||
/**
|
||||
* 短信记录管理 API
|
||||
* 短信日志管理 API
|
||||
*
|
||||
* @author luoqiz
|
||||
* @author Charles7c
|
||||
* @since 2025/03/15 22:15
|
||||
*/
|
||||
@Tag(name = "短信记录管理 API")
|
||||
@Tag(name = "短信日志管理 API")
|
||||
@Validated
|
||||
@RestController
|
||||
@CrudRequestMapping(value = "/system/smsRecord", api = {Api.PAGE, Api.DETAIL, Api.ADD, Api.UPDATE, Api.DELETE,
|
||||
Api.EXPORT})
|
||||
public class SmsRecordController extends BaseController<SmsRecordService, SmsRecordResp, SmsRecordDetailResp, SmsRecordQuery, SmsRecordReq> {
|
||||
@CrudRequestMapping(value = "/system/smsLog", api = {Api.PAGE, Api.DETAIL, Api.DELETE, Api.EXPORT})
|
||||
public class SmsLogController extends BaseController<SmsLogService, SmsLogResp, SmsLogResp, SmsLogQuery, SmsLogReq> {
|
||||
}
|
@@ -94,17 +94,19 @@ VALUES
|
||||
(1192, '修改', 1190, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'system:config:update', 2, 1, 1, NOW()),
|
||||
(1193, '重置', 1190, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'system:config:reset', 3, 1, 1, NOW()),
|
||||
|
||||
(1194, '短信配置', 1000, 2, '/system/sms/config', 'SmsConfig', 'system/sms/config/index', NULL, 'message', b'0', b'0', b'0', NULL, 6, 1, 1, NOW()),
|
||||
(1195, '列表', 1194, 3, NULL, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:smsConfig:list', 1, 1, 1, NOW()),
|
||||
(1196, '详情', 1194, 3, NULL, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:smsConfig:detail', 2, 1, 1, NOW()),
|
||||
(1197, '新增', 1194, 3, NULL, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:smsConfig:add', 3, 1, 1, NOW()),
|
||||
(1198, '修改', 1194, 3, NULL, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:smsConfig:update', 4, 1, 1, NOW()),
|
||||
(1199, '删除', 1194, 3, NULL, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:smsConfig:delete', 5, 1, 1, NOW()),
|
||||
(1200, '导出', 1194, 3, NULL, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:smsConfig:export', 6, 1, 1, NOW()),
|
||||
(1201, '短信记录', 1000, 2, '/system/sms/record', 'SmsRecord', 'system/sms/record/index', NULL, NULL, b'0', b'0', b'0', NULL, 1, 1, 1, NOW()),
|
||||
(1202, '列表', 1201, 3, NULL, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:smsRecord:list', 1, 1, 1, NOW()),
|
||||
(1203, '删除', 1201, 3, NULL, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:smsRecord:delete', 5, 1, 1, NOW()),
|
||||
(1204, '导出', 1201, 3, NULL, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:smsRecord:export', 6, 1, 1, NOW()),
|
||||
(1200, '短信配置', 1000, 1, '/system/sms', 'SystemSms', 'Layout', '/system/sms/config', 'message', b'0', b'0', b'0', NULL, 1000, 1, 1, NOW()),
|
||||
(1210, '短信配置', 1200, 2, '/system/sms/config', 'SystemSmsConfig', 'system/sms/config/index', NULL, 'message', b'0', b'0', b'0', NULL, 1, 1, 1, NOW()),
|
||||
(1211, '列表', 1210, 3, NULL, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:smsConfig:list', 1, 1, 1, NOW()),
|
||||
(1212, '详情', 1210, 3, NULL, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:smsConfig:detail', 2, 1, 1, NOW()),
|
||||
(1213, '新增', 1210, 3, NULL, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:smsConfig:add', 3, 1, 1, NOW()),
|
||||
(1214, '修改', 1210, 3, NULL, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:smsConfig:update', 4, 1, 1, NOW()),
|
||||
(1215, '删除', 1210, 3, NULL, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:smsConfig:delete', 5, 1, 1, NOW()),
|
||||
(1216, '导出', 1210, 3, NULL, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:smsConfig:export', 6, 1, 1, NOW()),
|
||||
|
||||
(1220, '短信日志', 1200, 2, '/system/sms/log', 'SystemSmsLog', 'system/sms/log/index', NULL, 'history', b'0', b'0', b'0', NULL, 2, 1, 1, NOW()),
|
||||
(1221, '列表', 1220, 3, NULL, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:smsLog:list', 1, 1, 1, NOW()),
|
||||
(1222, '删除', 1220, 3, NULL, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:smsLog:delete', 2, 1, 1, NOW()),
|
||||
(1223, '导出', 1220, 3, NULL, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:smsLog:export', 3, 1, 1, NOW()),
|
||||
|
||||
(2000, '系统监控', 0, 1, '/monitor', 'Monitor', 'Layout', '/monitor/online', 'computer', b'0', b'0', b'0', NULL, 2, 1, 1, NOW()),
|
||||
(2010, '在线用户', 2000, 2, '/monitor/online', 'MonitorOnline', 'monitor/online/index', NULL, 'user', b'0', b'0', b'0', NULL, 1, 1, 1, NOW()),
|
||||
|
@@ -300,6 +300,7 @@ CREATE TABLE IF NOT EXISTS `sys_file` (
|
||||
INDEX `idx_url`(`url`),
|
||||
INDEX `idx_md5`(`md5`),
|
||||
INDEX `idx_type`(`type`),
|
||||
INDEX `idx_storage_id`(`storage_id`),
|
||||
INDEX `idx_create_user`(`create_user`),
|
||||
INDEX `idx_update_user`(`update_user`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='文件表';
|
||||
@@ -319,44 +320,44 @@ CREATE TABLE IF NOT EXISTS `sys_client` (
|
||||
`update_user` bigint(20) DEFAULT NULL COMMENT '修改人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '修改时间',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE INDEX `uk_client_id`(`client_id`)
|
||||
UNIQUE INDEX `uk_client_id`(`client_id`),
|
||||
INDEX `idx_create_user`(`create_user`),
|
||||
INDEX `idx_update_user`(`update_user`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='终端表';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `sys_sms_config` (
|
||||
`id` bigint NOT NULL COMMENT 'ID',
|
||||
`name` varchar(255) NOT NULL COMMENT '名称',
|
||||
`supplier` varchar(50) NOT NULL COMMENT '厂商名称标识',
|
||||
`access_key_id` varchar(255) NOT NULL COMMENT 'Access Key 或 API Key',
|
||||
`access_key_secret` varchar(255) NOT NULL COMMENT 'Access Secret 或 API Secret',
|
||||
`signature` varchar(100) NOT NULL COMMENT '短信签名',
|
||||
`template_id` varchar(50) NULL DEFAULT NULL COMMENT '模板 ID',
|
||||
`weight` int NULL DEFAULT 1 COMMENT '负载均衡权重',
|
||||
`retry_interval` int NULL DEFAULT 5 COMMENT '短信自动重试间隔时间(秒)',
|
||||
`max_retries` int NULL DEFAULT 0 COMMENT '短信重试次数',
|
||||
`maximum` int NULL DEFAULT 10000 COMMENT '当前厂商的发送数量上限',
|
||||
`supplier_config` varchar(10000) NULL DEFAULT NULL COMMENT '各个厂商独立配置',
|
||||
`is_enable` bit(1) NOT NULL DEFAULT b'1' COMMENT '是否启用',
|
||||
`create_user` bigint NOT NULL COMMENT '创建人',
|
||||
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||
`update_user` bigint COMMENT '修改人',
|
||||
`update_time` datetime COMMENT '修改时间',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
INDEX `idx_sys_sms_config_create_user`(`create_user` ASC) USING BTREE,
|
||||
INDEX `idx_sys_sms_config_update_user`(`update_user` ASC) USING BTREE
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COMMENT = '短信服务配置表';
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||
`name` varchar(100) NOT NULL COMMENT '名称',
|
||||
`supplier` varchar(50) NOT NULL COMMENT '厂商',
|
||||
`access_key` varchar(255) NOT NULL COMMENT 'Access Key',
|
||||
`secret_key` varchar(255) NOT NULL COMMENT 'Secret Key',
|
||||
`signature` varchar(100) DEFAULT NULL COMMENT '短信签名',
|
||||
`template_id` varchar(50) DEFAULT NULL COMMENT '模板ID',
|
||||
`weight` int DEFAULT NULL COMMENT '负载均衡权重',
|
||||
`retry_interval` int DEFAULT NULL COMMENT '重试间隔(单位:秒)',
|
||||
`max_retries` int DEFAULT NULL COMMENT '重试次数',
|
||||
`maximum` int DEFAULT NULL COMMENT '发送上限',
|
||||
`supplier_config` text DEFAULT NULL COMMENT '各个厂商独立配置',
|
||||
`status` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态(1:启用;2:禁用)',
|
||||
`create_user` bigint(20) NOT NULL COMMENT '创建人',
|
||||
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||
`update_user` bigint(20) DEFAULT NULL COMMENT '修改人',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '修改时间',
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `idx_create_user`(`create_user`),
|
||||
INDEX `idx_update_user`(`update_user`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='短信配置表';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `sys_sms_record` (
|
||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||
`config_id` bigint NOT NULL COMMENT '配置id',
|
||||
`phone` varchar(25) NOT NULL COMMENT '手机号',
|
||||
`params` varchar(2048) NULL DEFAULT NULL COMMENT '参数配置',
|
||||
`status` bit(1) NOT NULL COMMENT '发送状态',
|
||||
`res_msg` varchar(2048) NOT NULL COMMENT '返回数据',
|
||||
`create_user` bigint NOT NULL COMMENT '创建人',
|
||||
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||
`update_user` bigint COMMENT '修改人',
|
||||
`update_time` datetime COMMENT '修改时间',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
INDEX `idx_sys_sms_record_create_user`(`create_user` ASC) USING BTREE,
|
||||
INDEX `idx_sys_sms_record_update_user`(`update_user` ASC) USING BTREE
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COMMENT = '短信记录表';
|
||||
CREATE TABLE IF NOT EXISTS `sys_sms_log` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||
`config_id` bigint(20) NOT NULL COMMENT '配置ID',
|
||||
`phone` varchar(25) NOT NULL COMMENT '手机号',
|
||||
`params` text DEFAULT NULL COMMENT '参数配置',
|
||||
`status` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '发送状态(1:成功;2:失败)',
|
||||
`res_msg` text DEFAULT NULL COMMENT '返回数据',
|
||||
`create_user` bigint(20) NOT NULL COMMENT '创建人',
|
||||
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `idx_config_id`(`config_id`),
|
||||
INDEX `idx_create_user`(`create_user`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='短信日志表';
|
@@ -94,17 +94,19 @@ VALUES
|
||||
(1192, '修改', 1190, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'system:config:update', 2, 1, 1, NOW()),
|
||||
(1193, '重置', 1190, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'system:config:reset', 3, 1, 1, NOW()),
|
||||
|
||||
(1194, '短信配置', 1000, 2, '/system/sms/config', 'SmsConfig', 'system/sms/config/index', NULL, 'message', false, false, false, NULL, 6, 1, 1, NOW()),
|
||||
(1195, '列表', 1194, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'system:smsConfig:list', 1, 1, 1, NOW()),
|
||||
(1196, '详情', 1194, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'system:smsConfig:detail', 2, 1, 1, NOW()),
|
||||
(1197, '新增', 1194, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'system:smsConfig:add', 3, 1, 1, NOW()),
|
||||
(1198, '修改', 1194, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'system:smsConfig:update', 4, 1, 1, NOW()),
|
||||
(1199, '删除', 1194, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'system:smsConfig:delete', 5, 1, 1, NOW()),
|
||||
(1200, '导出', 1194, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'system:smsConfig:export', 6, 1, 1, NOW()),
|
||||
(1201, '短信记录', 1000, 2, '/system/sms/record', 'SmsRecord', 'system/sms/record/index', NULL, NULL, false, false, false, NULL, 1, 1, 1, NOW()),
|
||||
(1202, '列表', 1201, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'system:smsRecord:list', 1, 1, 1, NOW()),
|
||||
(1203, '删除', 1201, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'system:smsRecord:delete', 5, 1, 1, NOW()),
|
||||
(1204, '导出', 1201, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'system:smsRecord:export', 6, 1, 1, NOW()),
|
||||
(1200, '短信配置', 1000, 1, '/system/sms', 'SystemSms', 'Layout', '/system/sms/config', 'message', false, false, false, NULL, 1000, 1, 1, NOW()),
|
||||
(1210, '短信配置', 1200, 2, '/system/sms/config', 'SystemSmsConfig', 'system/sms/config/index', NULL, 'message', false, false, false, NULL, 1, 1, 1, NOW()),
|
||||
(1211, '列表', 1210, 3, NULL, NULL, NULL, NULL, NULL, false, false, false, 'system:smsConfig:list', 1, 1, 1, NOW()),
|
||||
(1212, '详情', 1210, 3, NULL, NULL, NULL, NULL, NULL, false, false, false, 'system:smsConfig:detail', 2, 1, 1, NOW()),
|
||||
(1213, '新增', 1210, 3, NULL, NULL, NULL, NULL, NULL, false, false, false, 'system:smsConfig:add', 3, 1, 1, NOW()),
|
||||
(1214, '修改', 1210, 3, NULL, NULL, NULL, NULL, NULL, false, false, false, 'system:smsConfig:update', 4, 1, 1, NOW()),
|
||||
(1215, '删除', 1210, 3, NULL, NULL, NULL, NULL, NULL, false, false, false, 'system:smsConfig:delete', 5, 1, 1, NOW()),
|
||||
(1216, '导出', 1210, 3, NULL, NULL, NULL, NULL, NULL, false, false, false, 'system:smsConfig:export', 6, 1, 1, NOW()),
|
||||
|
||||
(1220, '短信日志', 1200, 2, '/system/sms/log', 'SystemSmsLog', 'system/sms/log/index', NULL, 'history', false, false, false, NULL, 2, 1, 1, NOW()),
|
||||
(1221, '列表', 1220, 3, NULL, NULL, NULL, NULL, NULL, false, false, false, 'system:smsLog:list', 1, 1, 1, NOW()),
|
||||
(1222, '删除', 1220, 3, NULL, NULL, NULL, NULL, NULL, false, false, false, 'system:smsLog:delete', 2, 1, 1, NOW()),
|
||||
(1223, '导出', 1220, 3, NULL, NULL, NULL, NULL, NULL, false, false, false, 'system:smsLog:export', 3, 1, 1, NOW()),
|
||||
|
||||
(2000, '系统监控', 0, 1, '/monitor', 'Monitor', 'Layout', '/monitor/online', 'computer', false, false, false, NULL, 2, 1, 1, NOW()),
|
||||
(2010, '在线用户', 2000, 2, '/monitor/online', 'MonitorOnline', 'monitor/online/index', NULL, 'user', false, false, false, NULL, 1, 1, 1, NOW()),
|
||||
|
@@ -487,6 +487,7 @@ CREATE TABLE IF NOT EXISTS "sys_file" (
|
||||
CREATE INDEX "idx_file_url" ON "sys_file" ("url");
|
||||
CREATE INDEX "idx_file_type" ON "sys_file" ("type");
|
||||
CREATE INDEX "idx_file_md5" ON "sys_file" ("md5");
|
||||
CREATE INDEX "idx_file_storage_id" ON "sys_file" ("storage_id");
|
||||
CREATE INDEX "idx_file_create_user" ON "sys_file" ("create_user");
|
||||
CREATE INDEX "idx_file_update_user" ON "sys_file" ("update_user");
|
||||
COMMENT ON COLUMN "sys_file"."id" IS 'ID';
|
||||
@@ -526,7 +527,9 @@ CREATE TABLE IF NOT EXISTS "sys_client" (
|
||||
"update_time" timestamp DEFAULT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
CREATE UNIQUE INDEX "uk_client_client_id" ON "sys_client" ("client_id");
|
||||
CREATE UNIQUE INDEX "uk_client_client_id" ON "sys_client" ("client_id");
|
||||
CREATE INDEX "idx_client_create_user" ON "sys_client" ("create_user");
|
||||
CREATE INDEX "idx_client_update_user" ON "sys_client" ("update_user");
|
||||
COMMENT ON COLUMN "sys_client"."id" IS 'ID';
|
||||
COMMENT ON COLUMN "sys_client"."client_id" IS '终端ID';
|
||||
COMMENT ON COLUMN "sys_client"."client_key" IS '终端Key';
|
||||
@@ -542,70 +545,66 @@ COMMENT ON COLUMN "sys_client"."update_user" IS '修改人';
|
||||
COMMENT ON COLUMN "sys_client"."update_time" IS '修改时间';
|
||||
COMMENT ON TABLE "sys_client" IS '终端表';
|
||||
|
||||
CREATE TABLE "sys_sms_config" (
|
||||
"id" int8 NOT NULL,
|
||||
"name" varchar(255) NOT NULL,
|
||||
"supplier" varchar(50) NOT NULL,
|
||||
"access_key_id" varchar(255) NOT NULL,
|
||||
"access_key_secret" varchar(255) NOT NULL,
|
||||
"signature" varchar(100) NOT NULL,
|
||||
"template_id" varchar(50) ,
|
||||
"weight" int4,
|
||||
"retry_interval" int4,
|
||||
"max_retries" int4,
|
||||
"maximum" int4,
|
||||
"supplier_config" varchar(10000) ,
|
||||
"is_enable" bool NOT NULL,
|
||||
"create_user" int8 NOT NULL,
|
||||
"create_time" timestamp(6) NOT NULL,
|
||||
"update_user" int8,
|
||||
"update_time" timestamp(6),
|
||||
CREATE TABLE IF NOT EXISTS "sys_sms_config" (
|
||||
"id" int8 NOT NULL,
|
||||
"name" varchar(100) NOT NULL,
|
||||
"supplier" varchar(50) NOT NULL,
|
||||
"access_key" varchar(255) NOT NULL,
|
||||
"secret_key" varchar(255) NOT NULL,
|
||||
"signature" varchar(100) DEFAULT NULL,
|
||||
"template_id" varchar(50) DEFAULT NULL,
|
||||
"weight" int4 DEFAULT NULL,
|
||||
"retry_interval" int4 DEFAULT NULL,
|
||||
"max_retries" int4 DEFAULT NULL,
|
||||
"maximum" int4 DEFAULT NULL,
|
||||
"supplier_config" text DEFAULT NULL ,
|
||||
"status" int2 NOT NULL DEFAULT 1,
|
||||
"create_user" int8 NOT NULL,
|
||||
"create_time" timestamp NOT NULL,
|
||||
"update_user" int8 DEFAULT NULL,
|
||||
"update_time" timestamp DEFAULT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
CREATE INDEX "idx_sys_sms_config_create_user" ON "sys_sms_config" USING btree ("create_user");
|
||||
CREATE INDEX "idx_sys_sms_config_update_user" ON "sys_sms_config" USING btree ("update_user");
|
||||
COMMENT ON COLUMN "sys_sms_config"."id" IS 'ID';
|
||||
COMMENT ON COLUMN "sys_sms_config"."name" IS '名称';
|
||||
COMMENT ON COLUMN "sys_sms_config"."supplier" IS '厂商名称标识';
|
||||
COMMENT ON COLUMN "sys_sms_config"."access_key_id" IS 'Access Key 或 API Key';
|
||||
COMMENT ON COLUMN "sys_sms_config"."access_key_secret" IS 'Access Secret 或 API Secret';
|
||||
COMMENT ON COLUMN "sys_sms_config"."signature" IS '短信签名';
|
||||
COMMENT ON COLUMN "sys_sms_config"."template_id" IS '模板 ID';
|
||||
COMMENT ON COLUMN "sys_sms_config"."weight" IS '负载均衡权重';
|
||||
COMMENT ON COLUMN "sys_sms_config"."retry_interval" IS '短信自动重试间隔时间(秒)';
|
||||
COMMENT ON COLUMN "sys_sms_config"."max_retries" IS '短信重试次数';
|
||||
COMMENT ON COLUMN "sys_sms_config"."maximum" IS '当前厂商的发送数量上限';
|
||||
CREATE INDEX "idx_sms_config_create_user" ON "sys_sms_config" ("create_user");
|
||||
CREATE INDEX "idx_sms_config_update_user" ON "sys_sms_config" ("update_user");
|
||||
COMMENT ON COLUMN "sys_sms_config"."id" IS 'ID';
|
||||
COMMENT ON COLUMN "sys_sms_config"."name" IS '名称';
|
||||
COMMENT ON COLUMN "sys_sms_config"."supplier" IS '厂商';
|
||||
COMMENT ON COLUMN "sys_sms_config"."access_key" IS 'Access Key';
|
||||
COMMENT ON COLUMN "sys_sms_config"."access_secret" IS 'Secret Key';
|
||||
COMMENT ON COLUMN "sys_sms_config"."signature" IS '短信签名';
|
||||
COMMENT ON COLUMN "sys_sms_config"."template_id" IS '模板ID';
|
||||
COMMENT ON COLUMN "sys_sms_config"."weight" IS '负载均衡权重';
|
||||
COMMENT ON COLUMN "sys_sms_config"."retry_interval" IS '重试间隔(单位:秒)';
|
||||
COMMENT ON COLUMN "sys_sms_config"."max_retries" IS '重试次数';
|
||||
COMMENT ON COLUMN "sys_sms_config"."maximum" IS '发送上限';
|
||||
COMMENT ON COLUMN "sys_sms_config"."supplier_config" IS '各个厂商独立配置';
|
||||
COMMENT ON COLUMN "sys_sms_config"."is_enable" IS '是否启用';
|
||||
COMMENT ON COLUMN "sys_sms_config"."create_user" IS '创建人';
|
||||
COMMENT ON COLUMN "sys_sms_config"."create_time" IS '创建时间';
|
||||
COMMENT ON COLUMN "sys_sms_config"."update_user" IS '修改人';
|
||||
COMMENT ON COLUMN "sys_sms_config"."update_time" IS '修改时间';
|
||||
COMMENT ON TABLE "sys_sms_config" IS '短信服务配置表';
|
||||
COMMENT ON COLUMN "sys_sms_config"."status" IS '状态(1:启用;2:禁用)';
|
||||
COMMENT ON COLUMN "sys_sms_config"."create_user" IS '创建人';
|
||||
COMMENT ON COLUMN "sys_sms_config"."create_time" IS '创建时间';
|
||||
COMMENT ON COLUMN "sys_sms_config"."update_user" IS '修改人';
|
||||
COMMENT ON COLUMN "sys_sms_config"."update_time" IS '修改时间';
|
||||
COMMENT ON TABLE "sys_sms_config" IS '短信配置表';
|
||||
|
||||
CREATE TABLE "sys_sms_record" (
|
||||
"id" int8 NOT NULL,
|
||||
"config_id" int8 NOT NULL,
|
||||
"phone" varchar(25) NOT NULL,
|
||||
"params" varchar(2048),
|
||||
"status" varchar(1),
|
||||
"res_msg" varchar(2048),
|
||||
"create_user" int8,
|
||||
"create_time" timestamp(6) NOT NULL,
|
||||
"update_user" int8,
|
||||
"update_time" timestamp(6),
|
||||
CREATE TABLE IF NOT EXISTS "sys_sms_log" (
|
||||
"id" int8 NOT NULL,
|
||||
"config_id" int8 NOT NULL,
|
||||
"phone" varchar(25) NOT NULL,
|
||||
"params" text DEFAULT NULL,
|
||||
"status" int2 NOT NULL DEFAULT 1,
|
||||
"res_msg" text DEFAULT NULL,
|
||||
"create_user" int8 NOT NULL,
|
||||
"create_time" timestamp NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
CREATE INDEX "idx_sys_sms_record_create_user" ON "sys_sms_record" USING btree ("create_user");
|
||||
CREATE INDEX "idx_sys_sms_record_update_user" ON "sys_sms_record" USING btree ( "update_user" );
|
||||
COMMENT ON COLUMN "sys_sms_record"."id" IS 'ID';
|
||||
COMMENT ON COLUMN "sys_sms_record"."config_id" IS '配置id';
|
||||
COMMENT ON COLUMN "sys_sms_record"."phone" IS '手机号';
|
||||
COMMENT ON COLUMN "sys_sms_record"."params" IS '参数配置';
|
||||
COMMENT ON COLUMN "sys_sms_record"."status" IS '发送状态';
|
||||
COMMENT ON COLUMN "sys_sms_record"."res_msg" IS '返回数据';
|
||||
COMMENT ON COLUMN "sys_sms_record"."create_user" IS '创建人';
|
||||
COMMENT ON COLUMN "sys_sms_record"."create_time" IS '创建时间';
|
||||
COMMENT ON COLUMN "sys_sms_record"."update_user" IS '修改人';
|
||||
COMMENT ON COLUMN "sys_sms_record"."update_time" IS '修改时间';
|
||||
COMMENT ON TABLE "sys_sms_record" IS '短信记录表';
|
||||
CREATE INDEX "idx_sms_log_config_id" ON "sys_sms_log" ("config_id");
|
||||
CREATE INDEX "idx_sms_log_create_user" ON "sys_sms_log" ("create_user");
|
||||
COMMENT ON COLUMN "sys_sms_log"."id" IS 'ID';
|
||||
COMMENT ON COLUMN "sys_sms_log"."config_id" IS '配置ID';
|
||||
COMMENT ON COLUMN "sys_sms_log"."phone" IS '手机号';
|
||||
COMMENT ON COLUMN "sys_sms_log"."params" IS '参数配置';
|
||||
COMMENT ON COLUMN "sys_sms_log"."status" IS '发送状态(1:成功;2:失败)';
|
||||
COMMENT ON COLUMN "sys_sms_log"."res_msg" IS '返回数据';
|
||||
COMMENT ON COLUMN "sys_sms_log"."create_user" IS '创建人';
|
||||
COMMENT ON COLUMN "sys_sms_log"."create_time" IS '创建时间';
|
||||
COMMENT ON TABLE "sys_sms_log" IS '短信日志表';
|
Reference in New Issue
Block a user