mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-09-13 02:57:13 +08:00
refactor(system): 重构短信配置功能模块
This commit is contained in:
@@ -23,12 +23,6 @@
|
|||||||
<artifactId>cosid-spring-redis</artifactId>
|
<artifactId>cosid-spring-redis</artifactId>
|
||||||
</dependency>
|
</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 协议的存储平台) -->
|
<!-- X File Storage(一行代码将文件存储到本地、FTP、SFTP、WebDAV、阿里云 OSS、华为云 OBS...等其它兼容 S3 协议的存储平台) -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.dromara.x-file-storage</groupId>
|
<groupId>org.dromara.x-file-storage</groupId>
|
||||||
@@ -54,11 +48,11 @@
|
|||||||
<artifactId>mysql-connector-j</artifactId>
|
<artifactId>mysql-connector-j</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- postgresql Java 驱动 -->
|
<!-- PostgreSQL Java 驱动 -->
|
||||||
<!-- <dependency>-->
|
<!--<dependency>
|
||||||
<!-- <groupId>org.postgresql</groupId>-->
|
<groupId>org.postgresql</groupId>
|
||||||
<!-- <artifactId>postgresql</artifactId>-->
|
<artifactId>postgresql</artifactId>
|
||||||
<!-- </dependency>-->
|
</dependency>-->
|
||||||
|
|
||||||
<!-- ContiNew Starter 扩展模块 - CURD(增删改查) -->
|
<!-- ContiNew Starter 扩展模块 - CURD(增删改查) -->
|
||||||
<dependency>
|
<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>
|
<description>系统管理模块(存放系统管理相关业务功能,例如:部门管理、角色管理、用户管理等)</description>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<!-- 公共模块(存放公共工具类,公共配置等) -->
|
<!-- 公共模块 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>top.continew</groupId>
|
<groupId>top.continew</groupId>
|
||||||
<artifactId>continew-common</artifactId>
|
<artifactId>continew-common</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SMS4J(短信聚合框架,轻松集成多家短信服务,解决接入多个短信 SDK 的繁琐流程) -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.dromara.sms4j</groupId>
|
<groupId>org.dromara.sms4j</groupId>
|
||||||
<artifactId>sms4j-spring-boot-starter</artifactId>
|
<artifactId>sms4j-spring-boot-starter</artifactId>
|
||||||
<version>3.3.4</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
@@ -16,30 +16,33 @@
|
|||||||
|
|
||||||
package top.continew.admin.system.config.sms;
|
package top.continew.admin.system.config.sms;
|
||||||
|
|
||||||
import jakarta.annotation.Resource;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.dromara.sms4j.core.factory.SmsFactory;
|
import org.dromara.sms4j.core.factory.SmsFactory;
|
||||||
import org.dromara.sms4j.core.proxy.SmsProxyFactory;
|
import org.dromara.sms4j.core.proxy.SmsProxyFactory;
|
||||||
import org.springframework.context.event.ContextRefreshedEvent;
|
import org.springframework.boot.ApplicationArguments;
|
||||||
import org.springframework.context.event.EventListener;
|
import org.springframework.boot.ApplicationRunner;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 短信配置加载器
|
||||||
|
*
|
||||||
|
* @author luoqiz
|
||||||
|
* @author Charles7c
|
||||||
|
* @since 2025/03/15 22:15
|
||||||
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
public class SmsBlendConfig {
|
@RequiredArgsConstructor
|
||||||
|
public class SmsConfigLoader implements ApplicationRunner {
|
||||||
|
|
||||||
@Resource
|
private final SmsReadConfigDatabaseImpl smsReadConfig;
|
||||||
SmsJdbcReadConfig config;
|
private final SmsLogProcessor smsLogProcessor;
|
||||||
|
|
||||||
@Resource
|
@Override
|
||||||
private SmsRecordProcessor smsRecordProcessor;
|
public void run(ApplicationArguments args) {
|
||||||
|
SmsFactory.createSmsBlend(smsReadConfig);
|
||||||
@EventListener
|
SmsProxyFactory.addPreProcessor(smsLogProcessor);
|
||||||
public void init(ContextRefreshedEvent event) {
|
log.debug("短信配置初始化完成");
|
||||||
log.info("初始化短信配置");
|
|
||||||
// 创建SmsBlend 短信实例
|
|
||||||
SmsFactory.createSmsBlend(config);
|
|
||||||
SmsProxyFactory.addPreProcessor(smsRecordProcessor);
|
|
||||||
log.info("初始化短信配置完成");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -16,73 +16,67 @@
|
|||||||
|
|
||||||
package top.continew.admin.system.config.sms;
|
package top.continew.admin.system.config.sms;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.NumberUtil;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import jakarta.annotation.Resource;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.dromara.sms4j.api.entity.SmsResponse;
|
import org.dromara.sms4j.api.entity.SmsResponse;
|
||||||
import org.dromara.sms4j.api.proxy.CoreMethodProcessor;
|
import org.dromara.sms4j.api.proxy.CoreMethodProcessor;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import top.continew.admin.system.model.req.SmsRecordReq;
|
import top.continew.admin.common.enums.SuccessFailureStatusEnum;
|
||||||
import top.continew.admin.system.service.SmsRecordService;
|
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.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Slf4j
|
/**
|
||||||
|
* 短信日志处理器
|
||||||
|
*
|
||||||
|
* @author luoqiz
|
||||||
|
* @author Charles7c
|
||||||
|
* @since 2025/03/15 22:15
|
||||||
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class SmsRecordProcessor implements CoreMethodProcessor {
|
@RequiredArgsConstructor
|
||||||
|
public class SmsLogProcessor implements CoreMethodProcessor {
|
||||||
|
|
||||||
@Resource
|
private final SmsLogService smsLogService;
|
||||||
private SmsRecordService smsRecordService;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object[] preProcessor(Method method, Object source, Object[] param) {
|
public Object postProcessor(SmsResponse result, Object[] param) {
|
||||||
return CoreMethodProcessor.super.preProcessor(method, source, 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
|
@Override
|
||||||
public void sendMessagePreProcess(String phone, Object message) {
|
public void sendMessagePreProcess(String phone, Object message) {
|
||||||
System.out.println("发送短信前处理" + phone + message);
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendMessageByTemplatePreProcess(String phone,
|
public void sendMessageByTemplatePreProcess(String phone,
|
||||||
String templateId,
|
String templateId,
|
||||||
LinkedHashMap<String, String> messages) {
|
LinkedHashMap<String, String> messages) {
|
||||||
log.debug("发送短信前处理 sendMessageByTemplatePreProcess " + phone + templateId + JSONUtil.toJsonPrettyStr(messages));
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void massTextingPreProcess(List<String> phones, String message) {
|
public void massTextingPreProcess(List<String> phones, String message) {
|
||||||
log.debug("发送短信前处理 massTextingPreProcess " + JSONUtil.toJsonPrettyStr(phones) + message);
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void massTextingByTemplatePreProcess(List<String> phones,
|
public void massTextingByTemplatePreProcess(List<String> phones,
|
||||||
String templateId,
|
String templateId,
|
||||||
LinkedHashMap<String, String> messages) {
|
LinkedHashMap<String, String> messages) {
|
||||||
log.debug("发送短信前处理 massTextingByTemplatePreProcess " + JSONUtil.toJsonPrettyStr(phones) + JSONUtil
|
// do nothing
|
||||||
.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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -16,48 +16,49 @@
|
|||||||
|
|
||||||
package top.continew.admin.system.config.sms;
|
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.core.datainterface.SmsReadConfig;
|
||||||
import org.dromara.sms4j.provider.config.BaseConfig;
|
import org.dromara.sms4j.provider.config.BaseConfig;
|
||||||
import org.springframework.stereotype.Component;
|
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.query.SmsConfigQuery;
|
||||||
import top.continew.admin.system.model.resp.SmsConfigDetailResp;
|
|
||||||
import top.continew.admin.system.model.resp.SmsConfigResp;
|
import top.continew.admin.system.model.resp.SmsConfigResp;
|
||||||
import top.continew.admin.system.service.SmsConfigService;
|
import top.continew.admin.system.service.SmsConfigService;
|
||||||
import top.continew.starter.extension.crud.model.query.SortQuery;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 短信配置读取-数据源实现
|
||||||
|
*
|
||||||
|
* @author luoqiz
|
||||||
|
* @author Charles7c
|
||||||
|
* @since 2025/03/15 22:15
|
||||||
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class SmsJdbcReadConfig implements SmsReadConfig {
|
@RequiredArgsConstructor
|
||||||
|
public class SmsReadConfigDatabaseImpl implements SmsReadConfig {
|
||||||
|
|
||||||
@Resource
|
private final SmsConfigService smsConfigService;
|
||||||
private SmsConfigService smsConfigService;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseConfig getSupplierConfig(String configId) {
|
public BaseConfig getSupplierConfig(String configId) {
|
||||||
Long id = Long.parseLong(configId);
|
Long id = Long.parseLong(configId);
|
||||||
SmsConfigDetailResp smsConfig = smsConfigService.get(id);
|
SmsConfigResp smsConfig = smsConfigService.get(id);
|
||||||
if (smsConfig == null || !smsConfig.getIsEnable()) {
|
if (DisEnableStatusEnum.DISABLE.equals(smsConfig.getStatus())) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return SmsConvertUtils.smsConfig2BaseConfig(smsConfig);
|
return smsConfig.getSupplier().toBaseConfig(smsConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<BaseConfig> getSupplierConfigList() {
|
public List<BaseConfig> getSupplierConfigList() {
|
||||||
SmsConfigQuery smsConfigQuery = new SmsConfigQuery();
|
SmsConfigQuery query = new SmsConfigQuery();
|
||||||
smsConfigQuery.setIsEnable(true);
|
query.setStatus(DisEnableStatusEnum.ENABLE);
|
||||||
SortQuery sortQuery = new SortQuery();
|
List<SmsConfigResp> list = smsConfigService.list(query, null);
|
||||||
sortQuery.setSort(new String[] {"id", "desc"});
|
if (CollUtil.isEmpty(list)) {
|
||||||
List<SmsConfigResp> smsConfigList = smsConfigService.list(smsConfigQuery, sortQuery);
|
return List.of();
|
||||||
List<BaseConfig> baseConfigList = new ArrayList<>();
|
|
||||||
for (SmsConfigResp smsConfigResp : smsConfigList) {
|
|
||||||
baseConfigList.add(SmsConvertUtils.smsConfig2BaseConfig(smsConfigResp));
|
|
||||||
}
|
}
|
||||||
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.Getter;
|
||||||
import lombok.RequiredArgsConstructor;
|
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.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;
|
import top.continew.starter.core.enums.BaseEnum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 菜单类型枚举
|
* 短信厂商枚举
|
||||||
*
|
*
|
||||||
|
* @author luoqiz
|
||||||
* @author Charles7c
|
* @author Charles7c
|
||||||
* @since 2023/2/15 20:12
|
* @since 2025/03/15 22:15
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public enum SmsSupplierEnum implements BaseEnum<String> {
|
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, "华为云短信"),
|
// EMAY(SupplierConstant.EMAY, "亿美软通"), HUAWEI(SupplierConstant.HUAWEI, "华为云短信"),
|
||||||
// JDCLOUD(SupplierConstant.JDCLOUD, "京东云短信"), NETEASE(SupplierConstant.NETEASE, "网易云信"),
|
// JDCLOUD(SupplierConstant.JDCLOUD, "京东云短信"), NETEASE(SupplierConstant.NETEASE, "网易云信"),
|
||||||
// TENCENT(SupplierConstant.TENCENT, "腾讯云短信"), UNISMS(SupplierConstant.UNISMS, "合一短信"),
|
// TENCENT(SupplierConstant.TENCENT, "腾讯云短信"), UNISMS(SupplierConstant.UNISMS, "合一短信"),
|
||||||
@@ -47,4 +98,12 @@ public enum SmsSupplierEnum implements BaseEnum<String> {
|
|||||||
|
|
||||||
private final String value;
|
private final String value;
|
||||||
private final String description;
|
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;
|
import top.continew.admin.system.model.entity.SmsConfigDO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 短信服务配置 Mapper
|
* 短信配置 Mapper
|
||||||
*
|
*
|
||||||
* @author luoqiz
|
* @author luoqiz
|
||||||
* @since 2025/03/15 18:41
|
* @since 2025/03/15 18:41
|
||||||
|
@@ -17,12 +17,12 @@
|
|||||||
package top.continew.admin.system.mapper;
|
package top.continew.admin.system.mapper;
|
||||||
|
|
||||||
import top.continew.starter.data.mp.base.BaseMapper;
|
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
|
* @author luoqiz
|
||||||
* @since 2025/03/15 22:15
|
* @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 com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import top.continew.admin.common.enums.DisEnableStatusEnum;
|
||||||
import top.continew.admin.common.model.entity.BaseDO;
|
import top.continew.admin.common.model.entity.BaseDO;
|
||||||
|
import top.continew.admin.system.enums.SmsSupplierEnum;
|
||||||
import top.continew.starter.security.crypto.annotation.FieldEncrypt;
|
import top.continew.starter.security.crypto.annotation.FieldEncrypt;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 短信服务配置实体
|
* 短信配置实体
|
||||||
*
|
*
|
||||||
* @author luoqiz
|
* @author luoqiz
|
||||||
|
* @author Charles7c
|
||||||
* @since 2025/03/15 18:41
|
* @since 2025/03/15 18:41
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@@ -42,20 +45,20 @@ public class SmsConfigDO extends BaseDO {
|
|||||||
private String name;
|
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
|
@FieldEncrypt
|
||||||
private String accessKeySecret;
|
private String secretKey;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 短信签名
|
* 短信签名
|
||||||
@@ -73,17 +76,17 @@ public class SmsConfigDO extends BaseDO {
|
|||||||
private Integer weight;
|
private Integer weight;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 短信自动重试间隔时间(秒)
|
* 重试间隔(单位:秒)
|
||||||
*/
|
*/
|
||||||
private Integer retryInterval;
|
private Integer retryInterval;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 短信重试次数
|
* 重试次数
|
||||||
*/
|
*/
|
||||||
private Integer maxRetries;
|
private Integer maxRetries;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 当前厂商的发送数量上限
|
* 发送上限
|
||||||
*/
|
*/
|
||||||
private Integer maximum;
|
private Integer maximum;
|
||||||
|
|
||||||
@@ -93,7 +96,7 @@ public class SmsConfigDO extends BaseDO {
|
|||||||
private String supplierConfig;
|
private String supplierConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否启用
|
* 状态
|
||||||
*/
|
*/
|
||||||
private Boolean isEnable;
|
private DisEnableStatusEnum status;
|
||||||
}
|
}
|
@@ -16,29 +16,29 @@
|
|||||||
|
|
||||||
package top.continew.admin.system.model.entity;
|
package top.continew.admin.system.model.entity;
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
import top.continew.admin.common.model.entity.BaseDO;
|
import top.continew.admin.common.enums.SuccessFailureStatusEnum;
|
||||||
|
import top.continew.admin.common.model.entity.BaseCreateDO;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 短信记录实体
|
* 短信日志实体
|
||||||
*
|
*
|
||||||
* @author luoqiz
|
* @author luoqiz
|
||||||
|
* @author Charles7c
|
||||||
* @since 2025/03/15 22:15
|
* @since 2025/03/15 22:15
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@TableName("sys_sms_record")
|
@TableName("sys_sms_log")
|
||||||
public class SmsRecordDO extends BaseDO {
|
public class SmsLogDO extends BaseCreateDO {
|
||||||
|
|
||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 配置id
|
* 配置 ID
|
||||||
*/
|
*/
|
||||||
private Long configId;
|
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 io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
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.annotation.Query;
|
||||||
import top.continew.starter.data.core.enums.QueryType;
|
import top.continew.starter.data.core.enums.QueryType;
|
||||||
|
|
||||||
@@ -25,13 +27,14 @@ import java.io.Serial;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 短信服务配置查询条件
|
* 短信配置查询条件
|
||||||
*
|
*
|
||||||
* @author luoqiz
|
* @author luoqiz
|
||||||
|
* @author Charles7c
|
||||||
* @since 2025/03/15 18:41
|
* @since 2025/03/15 18:41
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Schema(description = "短信服务配置查询条件")
|
@Schema(description = "短信配置查询条件")
|
||||||
public class SmsConfigQuery implements Serializable {
|
public class SmsConfigQuery implements Serializable {
|
||||||
|
|
||||||
@Serial
|
@Serial
|
||||||
@@ -40,42 +43,27 @@ public class SmsConfigQuery implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 名称
|
* 名称
|
||||||
*/
|
*/
|
||||||
@Schema(description = "名称")
|
@Schema(description = "名称", example = "短信配置1")
|
||||||
@Query(type = QueryType.LIKE)
|
@Query(type = QueryType.LIKE)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 厂商名称标识
|
* 厂商
|
||||||
*/
|
*/
|
||||||
@Schema(description = "厂商名称标识")
|
@Schema(description = "厂商", example = "cloopen")
|
||||||
@Query(type = QueryType.EQ)
|
@Query
|
||||||
private String supplier;
|
private SmsSupplierEnum supplier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Access Key 或 API Key
|
* Access Key
|
||||||
*/
|
*/
|
||||||
@Schema(description = "Access Key 或 API Key")
|
@Schema(description = "Access Key", example = "7aaf0708674db3ee05676ecbc2f31b7b")
|
||||||
@Query(type = QueryType.EQ)
|
@Query
|
||||||
private String accessKeyId;
|
private String accessKey;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 短信签名
|
* 状态
|
||||||
*/
|
*/
|
||||||
@Schema(description = "短信签名")
|
@Schema(description = "状态", example = "1")
|
||||||
@Query(type = QueryType.EQ)
|
private DisEnableStatusEnum status;
|
||||||
private String signature;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 模板 ID
|
|
||||||
*/
|
|
||||||
@Schema(description = "模板 ID")
|
|
||||||
@Query(type = QueryType.EQ)
|
|
||||||
private String templateId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否启用
|
|
||||||
*/
|
|
||||||
@Schema(description = "是否启用")
|
|
||||||
@Query(type = QueryType.EQ)
|
|
||||||
private Boolean isEnable;
|
|
||||||
}
|
}
|
@@ -18,43 +18,44 @@ package top.continew.admin.system.model.query;
|
|||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import top.continew.admin.common.enums.SuccessFailureStatusEnum;
|
||||||
import top.continew.starter.data.core.annotation.Query;
|
import top.continew.starter.data.core.annotation.Query;
|
||||||
import top.continew.starter.data.core.enums.QueryType;
|
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 短信记录查询条件
|
* 短信日志查询条件
|
||||||
*
|
*
|
||||||
* @author luoqiz
|
* @author luoqiz
|
||||||
|
* @author Charles7c
|
||||||
* @since 2025/03/15 22:15
|
* @since 2025/03/15 22:15
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Schema(description = "短信记录查询条件")
|
@Schema(description = "短信日志查询条件")
|
||||||
public class SmsRecordQuery implements Serializable {
|
public class SmsLogQuery implements Serializable {
|
||||||
|
|
||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 配置id
|
* 配置 ID
|
||||||
*/
|
*/
|
||||||
@Schema(description = "配置id")
|
@Schema(description = "配置 ID", example = "1")
|
||||||
@Query(type = QueryType.EQ)
|
@Query
|
||||||
private Long configId;
|
private Long configId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 手机号
|
* 手机号
|
||||||
*/
|
*/
|
||||||
@Schema(description = "手机号")
|
@Schema(description = "手机号", example = "18888888888")
|
||||||
@Query(type = QueryType.EQ)
|
@Query
|
||||||
private String phone;
|
private String phone;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送状态
|
* 发送状态
|
||||||
*/
|
*/
|
||||||
@Schema(description = "发送状态")
|
@Schema(description = "发送状态", example = "1")
|
||||||
@Query(type = QueryType.EQ)
|
@Query
|
||||||
private Boolean status;
|
private SuccessFailureStatusEnum status;
|
||||||
}
|
}
|
@@ -23,18 +23,21 @@ import lombok.Data;
|
|||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
|
||||||
import org.hibernate.validator.constraints.Length;
|
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.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建或修改短信服务配置参数
|
* 创建或修改短信配置参数
|
||||||
*
|
*
|
||||||
* @author luoqiz
|
* @author luoqiz
|
||||||
|
* @author Charles7c
|
||||||
* @since 2025/03/15 18:41
|
* @since 2025/03/15 18:41
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Schema(description = "创建或修改短信服务配置参数")
|
@Schema(description = "创建或修改短信配置参数")
|
||||||
public class SmsConfigReq implements Serializable {
|
public class SmsConfigReq implements Serializable {
|
||||||
|
|
||||||
@Serial
|
@Serial
|
||||||
@@ -43,86 +46,83 @@ public class SmsConfigReq implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 名称
|
* 名称
|
||||||
*/
|
*/
|
||||||
@Schema(description = "名称")
|
@Schema(description = "名称", example = "短信配置1")
|
||||||
@NotBlank(message = "名称不能为空")
|
@NotBlank(message = "名称不能为空")
|
||||||
@Length(max = 255, message = "名称长度不能超过 {max} 个字符")
|
@Length(max = 100, message = "名称长度不能超过 {max} 个字符")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 厂商名称标识
|
* 厂商
|
||||||
*/
|
*/
|
||||||
@Schema(description = "厂商名称标识")
|
@Schema(description = "厂商", example = "cloopen")
|
||||||
@NotBlank(message = "厂商名称标识不能为空")
|
@NotNull(message = "厂商无效")
|
||||||
@Length(max = 50, message = "厂商名称标识长度不能超过 {max} 个字符")
|
private SmsSupplierEnum supplier;
|
||||||
private String supplier;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Access Key 或 API Key
|
* Access Key
|
||||||
*/
|
*/
|
||||||
@Schema(description = "Access Key 或 API Key")
|
@Schema(description = "Access Key", example = "7aaf0708674db3ee05676ecbc2f31b7b")
|
||||||
@NotBlank(message = "Access Key 或 API Key不能为空")
|
@NotBlank(message = "Access Key 不能为空")
|
||||||
@Length(max = 255, message = "Access Key 或 API Key长度不能超过 {max} 个字符")
|
@Length(max = 255, message = "Access Key 长度不能超过 {max} 个字符")
|
||||||
private String accessKeyId;
|
private String accessKey;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Access Secret 或 API Secret
|
* Secret Key
|
||||||
*/
|
*/
|
||||||
@Schema(description = "Access Secret 或 API Secret")
|
@Schema(description = "Secret Key", example = "7fd47ade9ae54cddb222222sdsdss57be")
|
||||||
@NotBlank(message = "Access Secret 或 API Secret不能为空")
|
@NotBlank(message = "Secret Key 不能为空")
|
||||||
@Length(max = 255, message = "Access Secret 或 API Secret长度不能超过 {max} 个字符")
|
@Length(max = 255, message = "Secret Key 长度不能超过 {max} 个字符")
|
||||||
private String accessKeySecret;
|
private String secretKey;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 短信签名
|
* 短信签名
|
||||||
*/
|
*/
|
||||||
@Schema(description = "短信签名")
|
@Schema(description = "短信签名", example = "")
|
||||||
@NotBlank(message = "短信签名不能为空")
|
|
||||||
@Length(max = 100, message = "短信签名长度不能超过 {max} 个字符")
|
@Length(max = 100, message = "短信签名长度不能超过 {max} 个字符")
|
||||||
private String signature;
|
private String signature;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模板 ID
|
* 模板 ID
|
||||||
*/
|
*/
|
||||||
@Schema(description = "模板 ID")
|
@Schema(description = "模板 ID", example = "1")
|
||||||
@NotBlank(message = "模板 ID不能为空")
|
@NotBlank(message = "模板 ID 不能为空")
|
||||||
@Length(max = 50, message = "模板 ID长度不能超过 {max} 个字符")
|
@Length(max = 50, message = "模板 ID 长度不能超过 {max} 个字符")
|
||||||
private String templateId;
|
private String templateId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 负载均衡权重
|
* 负载均衡权重
|
||||||
*/
|
*/
|
||||||
@Schema(description = "负载均衡权重")
|
@Schema(description = "负载均衡权重", example = "1")
|
||||||
private Integer weight;
|
private Integer weight;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 短信自动重试间隔时间(秒)
|
* 重试间隔(单位:秒)
|
||||||
*/
|
*/
|
||||||
@Schema(description = "短信自动重试间隔时间(秒)")
|
@Schema(description = "重试间隔(单位:秒)", example = "5")
|
||||||
private Integer retryInterval;
|
private Integer retryInterval;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 短信重试次数
|
* 重试次数
|
||||||
*/
|
*/
|
||||||
@Schema(description = "短信重试次数")
|
@Schema(description = "重试次数", example = "0")
|
||||||
private Integer maxRetries;
|
private Integer maxRetries;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 当前厂商的发送数量上限
|
* 发送上限
|
||||||
*/
|
*/
|
||||||
@Schema(description = "当前厂商的发送数量上限")
|
@Schema(description = "发送上限")
|
||||||
private Integer maximum;
|
private Integer maximum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 各个厂商独立配置
|
* 各个厂商独立配置
|
||||||
*/
|
*/
|
||||||
@Schema(description = "各个厂商独立配置")
|
@Schema(description = "各个厂商独立配置", example = "")
|
||||||
@Length(max = 10000, message = "各个厂商独立配置长度不能超过 {max} 个字符")
|
@Length(max = 65535, message = "各个厂商独立配置长度不能超过 {max} 个字符")
|
||||||
private String supplierConfig;
|
private String supplierConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否启用
|
* 状态
|
||||||
*/
|
*/
|
||||||
@Schema(description = "是否启用")
|
@Schema(description = "状态", example = "1")
|
||||||
@NotNull(message = "是否启用不能为空")
|
private DisEnableStatusEnum status;
|
||||||
private Boolean isEnable;
|
|
||||||
}
|
}
|
@@ -14,69 +14,49 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package top.continew.admin.system.model.resp;
|
package top.continew.admin.system.model.req;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import top.continew.admin.common.enums.SuccessFailureStatusEnum;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
|
|
||||||
import top.continew.admin.common.model.resp.BaseResp;
|
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.time.*;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 短信记录信息
|
* 创建或修改短信日志参数
|
||||||
*
|
*
|
||||||
* @author luoqiz
|
* @author luoqiz
|
||||||
|
* @author Charles7c
|
||||||
* @since 2025/03/15 22:15
|
* @since 2025/03/15 22:15
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Schema(description = "短信记录信息")
|
public class SmsLogReq implements Serializable {
|
||||||
public class SmsRecordResp extends BaseResp {
|
|
||||||
|
|
||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 配置id
|
* 配置 ID
|
||||||
*/
|
*/
|
||||||
@Schema(description = "配置id")
|
|
||||||
private Long configId;
|
private Long configId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 手机号
|
* 手机号
|
||||||
*/
|
*/
|
||||||
@Schema(description = "手机号")
|
|
||||||
private String phone;
|
private String phone;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 参数配置
|
* 参数配置
|
||||||
*/
|
*/
|
||||||
@Schema(description = "参数配置")
|
|
||||||
private String params;
|
private String params;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送状态
|
* 发送状态
|
||||||
*/
|
*/
|
||||||
@Schema(description = "发送状态")
|
private SuccessFailureStatusEnum status;
|
||||||
private Boolean status;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回数据
|
* 返回数据
|
||||||
*/
|
*/
|
||||||
@Schema(description = "返回数据")
|
|
||||||
private String resMsg;
|
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;
|
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 io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
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 top.continew.starter.security.mask.annotation.JsonMask;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 短信服务配置信息
|
* 短信配置信息
|
||||||
*
|
*
|
||||||
* @author luoqiz
|
* @author luoqiz
|
||||||
|
* @author Charles7c
|
||||||
* @since 2025/03/15 18:41
|
* @since 2025/03/15 18:41
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Schema(description = "短信服务配置信息")
|
@ExcelIgnoreUnannotated
|
||||||
public class SmsConfigResp extends BaseResp {
|
@Schema(description = "短信配置信息")
|
||||||
|
public class SmsConfigResp extends BaseDetailResp {
|
||||||
|
|
||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
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;
|
private String name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 厂商名称标识
|
* 厂商
|
||||||
*/
|
*/
|
||||||
@Schema(description = "厂商名称标识")
|
@Schema(description = "厂商", example = "cloopen")
|
||||||
private String supplier;
|
@ExcelProperty(value = "厂商")
|
||||||
|
private SmsSupplierEnum supplier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Access Key 或 API Key
|
* Access Key
|
||||||
*/
|
*/
|
||||||
@Schema(description = "Access Key 或 API Key")
|
@Schema(description = "Access Key", example = "7aaf0708674db3ee05676ecbc2f31b7b")
|
||||||
private String accessKeyId;
|
@ExcelProperty(value = "Access Key")
|
||||||
|
private String accessKey;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Access Secret 或 API Secret
|
* Secret Key
|
||||||
*/
|
*/
|
||||||
@Schema(description = "Access Secret 或 API Secret")
|
@Schema(description = "Secret Key", example = "7fd4************************57be")
|
||||||
@JsonMask(left = 4, right = 4, character = '*')
|
@ExcelProperty(value = "Secret Key")
|
||||||
private String accessKeySecret;
|
@JsonMask(left = 4, right = 4)
|
||||||
|
private String secretKey;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 短信签名
|
* 短信签名
|
||||||
*/
|
*/
|
||||||
@Schema(description = "短信签名")
|
@Schema(description = "短信签名", example = "")
|
||||||
|
@ExcelProperty(value = "短信签名")
|
||||||
private String signature;
|
private String signature;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模板 ID
|
* 模板 ID
|
||||||
*/
|
*/
|
||||||
@Schema(description = "模板 ID")
|
@Schema(description = "模板 ID", example = "1")
|
||||||
|
@ExcelProperty(value = "模板 ID")
|
||||||
private String templateId;
|
private String templateId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 负载均衡权重
|
* 负载均衡权重
|
||||||
*/
|
*/
|
||||||
@Schema(description = "负载均衡权重")
|
@Schema(description = "负载均衡权重", example = "1")
|
||||||
|
@ExcelProperty(value = "负载均衡权重")
|
||||||
private Integer weight;
|
private Integer weight;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 短信自动重试间隔时间(秒)
|
* 重试间隔(单位:秒)
|
||||||
*/
|
*/
|
||||||
@Schema(description = "短信自动重试间隔时间(秒)")
|
@Schema(description = "重试间隔(单位:秒)", example = "5")
|
||||||
|
@ExcelProperty(value = "重试间隔(单位:秒)")
|
||||||
private Integer retryInterval;
|
private Integer retryInterval;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 短信重试次数
|
* 重试次数
|
||||||
*/
|
*/
|
||||||
@Schema(description = "短信重试次数")
|
@Schema(description = "重试次数", example = "0")
|
||||||
|
@ExcelProperty(value = "重试次数")
|
||||||
private Integer maxRetries;
|
private Integer maxRetries;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 当前厂商的发送数量上限
|
* 发送上限
|
||||||
*/
|
*/
|
||||||
@Schema(description = "当前厂商的发送数量上限")
|
@Schema(description = "发送上限")
|
||||||
|
@ExcelProperty(value = "发送上限")
|
||||||
private Integer maximum;
|
private Integer maximum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 各个厂商独立配置
|
* 各个厂商独立配置
|
||||||
*/
|
*/
|
||||||
@Schema(description = "各个厂商独立配置")
|
@Schema(description = "各个厂商独立配置", example = "")
|
||||||
|
@ExcelProperty(value = "各个厂商独立配置")
|
||||||
private String supplierConfig;
|
private String supplierConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否启用
|
* 状态
|
||||||
*/
|
*/
|
||||||
@Schema(description = "是否启用")
|
@Schema(description = "状态", example = "1")
|
||||||
private Boolean isEnable;
|
@ExcelProperty(value = "状态", converter = ExcelBaseEnumConverter.class)
|
||||||
|
private DisEnableStatusEnum status;
|
||||||
/**
|
|
||||||
* 修改人
|
|
||||||
*/
|
|
||||||
@Schema(description = "修改人")
|
|
||||||
private Long updateUser;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改时间
|
|
||||||
*/
|
|
||||||
@Schema(description = "修改时间")
|
|
||||||
private LocalDateTime updateTime;
|
|
||||||
}
|
}
|
@@ -20,35 +20,38 @@ import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
|||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
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;
|
import java.io.Serial;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 短信记录详情信息
|
* 短信日志信息
|
||||||
*
|
*
|
||||||
* @author luoqiz
|
* @author luoqiz
|
||||||
|
* @author Charles7c
|
||||||
* @since 2025/03/15 22:15
|
* @since 2025/03/15 22:15
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@ExcelIgnoreUnannotated
|
@ExcelIgnoreUnannotated
|
||||||
@Schema(description = "短信记录详情信息")
|
@Schema(description = "短信日志信息")
|
||||||
public class SmsRecordDetailResp extends BaseDetailResp {
|
public class SmsLogResp extends BaseResp {
|
||||||
|
|
||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 配置id
|
* 配置 ID
|
||||||
*/
|
*/
|
||||||
@Schema(description = "配置id")
|
@Schema(description = "配置 ID", example = "")
|
||||||
@ExcelProperty(value = "配置id")
|
@ExcelProperty(value = "配置 ID")
|
||||||
private Long configId;
|
private Long configId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 手机号
|
* 手机号
|
||||||
*/
|
*/
|
||||||
@Schema(description = "手机号")
|
@Schema(description = "手机号", example = "18888888888")
|
||||||
@ExcelProperty(value = "手机号")
|
@ExcelProperty(value = "手机号")
|
||||||
private String phone;
|
private String phone;
|
||||||
|
|
||||||
@@ -62,9 +65,9 @@ public class SmsRecordDetailResp extends BaseDetailResp {
|
|||||||
/**
|
/**
|
||||||
* 发送状态
|
* 发送状态
|
||||||
*/
|
*/
|
||||||
@Schema(description = "发送状态")
|
@Schema(description = "发送状态", example = "1")
|
||||||
@ExcelProperty(value = "发送状态")
|
@ExcelProperty(value = "发送状态", converter = ExcelBaseEnumConverter.class)
|
||||||
private Boolean status;
|
private SuccessFailureStatusEnum status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回数据
|
* 返回数据
|
@@ -16,16 +16,15 @@
|
|||||||
|
|
||||||
package top.continew.admin.system.service;
|
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.query.SmsConfigQuery;
|
||||||
import top.continew.admin.system.model.req.SmsConfigReq;
|
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.model.resp.SmsConfigResp;
|
||||||
|
import top.continew.starter.extension.crud.service.BaseService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 短信服务配置业务接口
|
* 短信配置业务接口
|
||||||
*
|
*
|
||||||
* @author luoqiz
|
* @author luoqiz
|
||||||
* @since 2025/03/15 18:41
|
* @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;
|
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.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
|
* @author luoqiz
|
||||||
* @since 2025/03/15 22:15
|
* @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;
|
package top.continew.admin.system.service.impl;
|
||||||
|
|
||||||
import jakarta.annotation.Resource;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.dromara.sms4j.core.factory.SmsFactory;
|
||||||
|
import org.dromara.sms4j.provider.config.BaseConfig;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import top.continew.admin.common.enums.MethodTypeEnum;
|
import top.continew.admin.system.enums.SmsSupplierEnum;
|
||||||
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.mapper.SmsConfigMapper;
|
import top.continew.admin.system.mapper.SmsConfigMapper;
|
||||||
import top.continew.admin.system.model.entity.SmsConfigDO;
|
import top.continew.admin.system.model.entity.SmsConfigDO;
|
||||||
import top.continew.admin.system.model.query.SmsConfigQuery;
|
import top.continew.admin.system.model.query.SmsConfigQuery;
|
||||||
import top.continew.admin.system.model.req.SmsConfigReq;
|
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.model.resp.SmsConfigResp;
|
||||||
import top.continew.admin.system.service.SmsConfigService;
|
import top.continew.admin.system.service.SmsConfigService;
|
||||||
import top.continew.starter.extension.crud.service.BaseServiceImpl;
|
import top.continew.starter.extension.crud.service.BaseServiceImpl;
|
||||||
@@ -35,39 +33,55 @@ import top.continew.starter.extension.crud.service.BaseServiceImpl;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 短信服务配置业务实现
|
* 短信配置业务实现
|
||||||
*
|
*
|
||||||
* @author luoqiz
|
* @author luoqiz
|
||||||
* @since 2025/03/15 18:41
|
* @since 2025/03/15 18:41
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class SmsConfigServiceImpl extends BaseServiceImpl<SmsConfigMapper, SmsConfigDO, SmsConfigResp, SmsConfigDetailResp, SmsConfigQuery, SmsConfigReq> implements SmsConfigService {
|
public class SmsConfigServiceImpl extends BaseServiceImpl<SmsConfigMapper, SmsConfigDO, SmsConfigResp, SmsConfigResp, SmsConfigQuery, SmsConfigReq> implements SmsConfigService {
|
||||||
@Resource
|
|
||||||
private SmsRedisMessagePublisher smsRedisMessagePublisher;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void afterAdd(SmsConfigReq req, SmsConfigDO entity) {
|
public void afterAdd(SmsConfigReq req, SmsConfigDO entity) {
|
||||||
super.afterAdd(req, entity);
|
this.load(entity);
|
||||||
smsRedisMessagePublisher.publish(SmsRedisConfig.SysSmsChannel, new SmsEventMessage(MethodTypeEnum.ADD, entity
|
|
||||||
.getId()
|
|
||||||
.toString()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void afterUpdate(SmsConfigReq req, SmsConfigDO entity) {
|
public void afterUpdate(SmsConfigReq req, SmsConfigDO entity) {
|
||||||
super.afterUpdate(req, entity);
|
// 重新加载配置
|
||||||
smsRedisMessagePublisher.publish(SmsRedisConfig.SysSmsChannel, new SmsEventMessage(MethodTypeEnum.UPDATE, entity
|
// 先卸载
|
||||||
.getId()
|
this.unload(entity.getId().toString());
|
||||||
.toString()));
|
// 再加载
|
||||||
|
this.load(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void afterDelete(List<Long> ids) {
|
public void afterDelete(List<Long> ids) {
|
||||||
super.afterDelete(ids);
|
|
||||||
for (Long id : ids) {
|
for (Long id : ids) {
|
||||||
smsRedisMessagePublisher.publish(SmsRedisConfig.SysSmsChannel, new SmsEventMessage(MethodTypeEnum.DELETE, id
|
this.unload(id.toString());
|
||||||
.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;
|
package top.continew.admin.system.service.impl;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
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.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
|
* @author luoqiz
|
||||||
* @since 2025/03/15 22:15
|
* @since 2025/03/15 22:15
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
public class SmsLogServiceImpl extends BaseServiceImpl<SmsLogMapper, SmsLogDO, SmsLogResp, SmsLogResp, SmsLogQuery, SmsLogReq> implements SmsLogService {}
|
||||||
public class SmsRecordServiceImpl extends BaseServiceImpl<SmsRecordMapper, SmsRecordDO, SmsRecordResp, SmsRecordDetailResp, SmsRecordQuery, SmsRecordReq> implements SmsRecordService {}
|
|
@@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?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" >
|
<!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>
|
</mapper>
|
@@ -20,7 +20,7 @@
|
|||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<!-- 公共模块(存放公共工具类,公共配置等) -->
|
<!-- 公共模块 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>top.continew</groupId>
|
<groupId>top.continew</groupId>
|
||||||
<artifactId>continew-common</artifactId>
|
<artifactId>continew-common</artifactId>
|
||||||
|
@@ -25,36 +25,36 @@
|
|||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<!-- ContiNew Starter 日志模块 - 拦截器版(Spring Boot Actuator HttpTrace 增强版) -->
|
<!-- 系统管理模块 -->
|
||||||
<dependency>
|
|
||||||
<groupId>top.continew</groupId>
|
|
||||||
<artifactId>continew-starter-log-interceptor</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- 系统管理模块(存放系统管理模块相关功能,例如:部门管理、角色管理、用户管理等) -->
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>top.continew</groupId>
|
<groupId>top.continew</groupId>
|
||||||
<artifactId>continew-module-system</artifactId>
|
<artifactId>continew-module-system</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- 任务调度插件(后续会改造为独立插件) -->
|
<!-- 任务调度插件 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>top.continew</groupId>
|
<groupId>top.continew</groupId>
|
||||||
<artifactId>continew-plugin-schedule</artifactId>
|
<artifactId>continew-plugin-schedule</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- 能力开放插件(后续会改造为独立插件) -->
|
<!-- 能力开放插件 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>top.continew</groupId>
|
<groupId>top.continew</groupId>
|
||||||
<artifactId>continew-plugin-open</artifactId>
|
<artifactId>continew-plugin-open</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- 代码生成器插件(后续会改造为独立插件) -->
|
<!-- 代码生成器插件 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>top.continew</groupId>
|
<groupId>top.continew</groupId>
|
||||||
<artifactId>continew-plugin-generator</artifactId>
|
<artifactId>continew-plugin-generator</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- ContiNew Starter 日志模块 - 拦截器版(Spring Boot Actuator HttpTrace 增强版) -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>top.continew</groupId>
|
||||||
|
<artifactId>continew-starter-log-interceptor</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- Liquibase(用于管理数据库版本,跟踪、管理和应用数据库变化) -->
|
<!-- Liquibase(用于管理数据库版本,跟踪、管理和应用数据库变化) -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.liquibase</groupId>
|
<groupId>org.liquibase</groupId>
|
||||||
|
@@ -16,28 +16,26 @@
|
|||||||
|
|
||||||
package top.continew.admin.controller.system;
|
package top.continew.admin.controller.system;
|
||||||
|
|
||||||
import top.continew.starter.extension.crud.enums.Api;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import top.continew.starter.extension.crud.annotation.CrudRequestMapping;
|
|
||||||
import top.continew.admin.common.controller.BaseController;
|
import top.continew.admin.common.controller.BaseController;
|
||||||
import top.continew.admin.system.model.query.SmsConfigQuery;
|
import top.continew.admin.system.model.query.SmsConfigQuery;
|
||||||
import top.continew.admin.system.model.req.SmsConfigReq;
|
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.model.resp.SmsConfigResp;
|
||||||
import top.continew.admin.system.service.SmsConfigService;
|
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 luoqiz
|
||||||
|
* @author Charles7c
|
||||||
* @since 2025/03/15 18:41
|
* @since 2025/03/15 18:41
|
||||||
*/
|
*/
|
||||||
@Tag(name = "短信服务配置管理 API")
|
@Tag(name = "短信配置管理 API")
|
||||||
|
@Validated
|
||||||
@RestController
|
@RestController
|
||||||
@CrudRequestMapping(value = "/system/smsConfig", api = {Api.PAGE, Api.DETAIL, Api.ADD, Api.UPDATE, Api.DELETE,
|
@CrudRequestMapping(value = "/system/smsConfig", api = {Api.PAGE, Api.DETAIL, Api.ADD, Api.UPDATE, Api.DELETE})
|
||||||
Api.EXPORT})
|
public class SmsConfigController extends BaseController<SmsConfigService, SmsConfigResp, SmsConfigResp, SmsConfigQuery, SmsConfigReq> {}
|
||||||
public class SmsConfigController extends BaseController<SmsConfigService, SmsConfigResp, SmsConfigDetailResp, SmsConfigQuery, SmsConfigReq> {}
|
|
@@ -17,25 +17,26 @@
|
|||||||
package top.continew.admin.controller.system;
|
package top.continew.admin.controller.system;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import top.continew.admin.common.controller.BaseController;
|
import top.continew.admin.common.controller.BaseController;
|
||||||
import top.continew.admin.system.model.query.SmsRecordQuery;
|
import top.continew.admin.system.model.query.SmsLogQuery;
|
||||||
import top.continew.admin.system.model.req.SmsRecordReq;
|
import top.continew.admin.system.model.req.SmsLogReq;
|
||||||
import top.continew.admin.system.model.resp.SmsRecordDetailResp;
|
import top.continew.admin.system.model.resp.SmsLogResp;
|
||||||
import top.continew.admin.system.model.resp.SmsRecordResp;
|
import top.continew.admin.system.service.SmsLogService;
|
||||||
import top.continew.admin.system.service.SmsRecordService;
|
|
||||||
import top.continew.starter.extension.crud.annotation.CrudRequestMapping;
|
import top.continew.starter.extension.crud.annotation.CrudRequestMapping;
|
||||||
import top.continew.starter.extension.crud.enums.Api;
|
import top.continew.starter.extension.crud.enums.Api;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 短信记录管理 API
|
* 短信日志管理 API
|
||||||
*
|
*
|
||||||
* @author luoqiz
|
* @author luoqiz
|
||||||
|
* @author Charles7c
|
||||||
* @since 2025/03/15 22:15
|
* @since 2025/03/15 22:15
|
||||||
*/
|
*/
|
||||||
@Tag(name = "短信记录管理 API")
|
@Tag(name = "短信日志管理 API")
|
||||||
|
@Validated
|
||||||
@RestController
|
@RestController
|
||||||
@CrudRequestMapping(value = "/system/smsRecord", api = {Api.PAGE, Api.DETAIL, Api.ADD, Api.UPDATE, Api.DELETE,
|
@CrudRequestMapping(value = "/system/smsLog", api = {Api.PAGE, Api.DETAIL, Api.DELETE, Api.EXPORT})
|
||||||
Api.EXPORT})
|
public class SmsLogController extends BaseController<SmsLogService, SmsLogResp, SmsLogResp, SmsLogQuery, SmsLogReq> {
|
||||||
public class SmsRecordController extends BaseController<SmsRecordService, SmsRecordResp, SmsRecordDetailResp, SmsRecordQuery, SmsRecordReq> {
|
|
||||||
}
|
}
|
@@ -94,17 +94,19 @@ VALUES
|
|||||||
(1192, '修改', 1190, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'system:config:update', 2, 1, 1, NOW()),
|
(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()),
|
(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()),
|
(1200, '短信配置', 1000, 1, '/system/sms', 'SystemSms', 'Layout', '/system/sms/config', 'message', b'0', b'0', b'0', NULL, 1000, 1, 1, NOW()),
|
||||||
(1195, '列表', 1194, 3, NULL, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:smsConfig:list', 1, 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()),
|
||||||
(1196, '详情', 1194, 3, NULL, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:smsConfig:detail', 2, 1, 1, NOW()),
|
(1211, '列表', 1210, 3, NULL, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:smsConfig:list', 1, 1, 1, NOW()),
|
||||||
(1197, '新增', 1194, 3, NULL, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:smsConfig:add', 3, 1, 1, NOW()),
|
(1212, '详情', 1210, 3, NULL, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:smsConfig:detail', 2, 1, 1, NOW()),
|
||||||
(1198, '修改', 1194, 3, NULL, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:smsConfig:update', 4, 1, 1, NOW()),
|
(1213, '新增', 1210, 3, NULL, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:smsConfig:add', 3, 1, 1, NOW()),
|
||||||
(1199, '删除', 1194, 3, NULL, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:smsConfig:delete', 5, 1, 1, NOW()),
|
(1214, '修改', 1210, 3, NULL, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:smsConfig:update', 4, 1, 1, NOW()),
|
||||||
(1200, '导出', 1194, 3, NULL, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:smsConfig:export', 6, 1, 1, NOW()),
|
(1215, '删除', 1210, 3, NULL, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:smsConfig:delete', 5, 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()),
|
(1216, '导出', 1210, 3, NULL, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:smsConfig:export', 6, 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()),
|
(1220, '短信日志', 1200, 2, '/system/sms/log', 'SystemSmsLog', 'system/sms/log/index', NULL, 'history', b'0', b'0', b'0', NULL, 2, 1, 1, NOW()),
|
||||||
(1204, '导出', 1201, 3, NULL, NULL, NULL, NULL, NULL, b'0', b'0', b'0', 'system:smsRecord:export', 6, 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()),
|
(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()),
|
(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_url`(`url`),
|
||||||
INDEX `idx_md5`(`md5`),
|
INDEX `idx_md5`(`md5`),
|
||||||
INDEX `idx_type`(`type`),
|
INDEX `idx_type`(`type`),
|
||||||
|
INDEX `idx_storage_id`(`storage_id`),
|
||||||
INDEX `idx_create_user`(`create_user`),
|
INDEX `idx_create_user`(`create_user`),
|
||||||
INDEX `idx_update_user`(`update_user`)
|
INDEX `idx_update_user`(`update_user`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='文件表';
|
) 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_user` bigint(20) DEFAULT NULL COMMENT '修改人',
|
||||||
`update_time` datetime DEFAULT NULL COMMENT '修改时间',
|
`update_time` datetime DEFAULT NULL COMMENT '修改时间',
|
||||||
PRIMARY KEY (`id`),
|
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='终端表';
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='终端表';
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `sys_sms_config` (
|
CREATE TABLE IF NOT EXISTS `sys_sms_config` (
|
||||||
`id` bigint NOT NULL COMMENT 'ID',
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||||
`name` varchar(255) NOT NULL COMMENT '名称',
|
`name` varchar(100) NOT NULL COMMENT '名称',
|
||||||
`supplier` varchar(50) NOT NULL COMMENT '厂商名称标识',
|
`supplier` varchar(50) NOT NULL COMMENT '厂商',
|
||||||
`access_key_id` varchar(255) NOT NULL COMMENT 'Access Key 或 API Key',
|
`access_key` varchar(255) NOT NULL COMMENT 'Access Key',
|
||||||
`access_key_secret` varchar(255) NOT NULL COMMENT 'Access Secret 或 API Secret',
|
`secret_key` varchar(255) NOT NULL COMMENT 'Secret Key',
|
||||||
`signature` varchar(100) NOT NULL COMMENT '短信签名',
|
`signature` varchar(100) DEFAULT NULL COMMENT '短信签名',
|
||||||
`template_id` varchar(50) NULL DEFAULT NULL COMMENT '模板 ID',
|
`template_id` varchar(50) DEFAULT NULL COMMENT '模板ID',
|
||||||
`weight` int NULL DEFAULT 1 COMMENT '负载均衡权重',
|
`weight` int DEFAULT NULL COMMENT '负载均衡权重',
|
||||||
`retry_interval` int NULL DEFAULT 5 COMMENT '短信自动重试间隔时间(秒)',
|
`retry_interval` int DEFAULT NULL COMMENT '重试间隔(单位:秒)',
|
||||||
`max_retries` int NULL DEFAULT 0 COMMENT '短信重试次数',
|
`max_retries` int DEFAULT NULL COMMENT '重试次数',
|
||||||
`maximum` int NULL DEFAULT 10000 COMMENT '当前厂商的发送数量上限',
|
`maximum` int DEFAULT NULL COMMENT '发送上限',
|
||||||
`supplier_config` varchar(10000) NULL DEFAULT NULL COMMENT '各个厂商独立配置',
|
`supplier_config` text DEFAULT NULL COMMENT '各个厂商独立配置',
|
||||||
`is_enable` bit(1) NOT NULL DEFAULT b'1' COMMENT '是否启用',
|
`status` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '状态(1:启用;2:禁用)',
|
||||||
`create_user` bigint NOT NULL COMMENT '创建人',
|
`create_user` bigint(20) NOT NULL COMMENT '创建人',
|
||||||
`create_time` datetime NOT NULL COMMENT '创建时间',
|
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||||
`update_user` bigint COMMENT '修改人',
|
`update_user` bigint(20) DEFAULT NULL COMMENT '修改人',
|
||||||
`update_time` datetime COMMENT '修改时间',
|
`update_time` datetime DEFAULT NULL COMMENT '修改时间',
|
||||||
PRIMARY KEY (`id`) USING BTREE,
|
PRIMARY KEY (`id`),
|
||||||
INDEX `idx_sys_sms_config_create_user`(`create_user` ASC) USING BTREE,
|
INDEX `idx_create_user`(`create_user`),
|
||||||
INDEX `idx_sys_sms_config_update_user`(`update_user` ASC) USING BTREE
|
INDEX `idx_update_user`(`update_user`)
|
||||||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COMMENT = '短信服务配置表';
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='短信配置表';
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `sys_sms_record` (
|
CREATE TABLE IF NOT EXISTS `sys_sms_log` (
|
||||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||||
`config_id` bigint NOT NULL COMMENT '配置id',
|
`config_id` bigint(20) NOT NULL COMMENT '配置ID',
|
||||||
`phone` varchar(25) NOT NULL COMMENT '手机号',
|
`phone` varchar(25) NOT NULL COMMENT '手机号',
|
||||||
`params` varchar(2048) NULL DEFAULT NULL COMMENT '参数配置',
|
`params` text DEFAULT NULL COMMENT '参数配置',
|
||||||
`status` bit(1) NOT NULL COMMENT '发送状态',
|
`status` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '发送状态(1:成功;2:失败)',
|
||||||
`res_msg` varchar(2048) NOT NULL COMMENT '返回数据',
|
`res_msg` text DEFAULT NULL COMMENT '返回数据',
|
||||||
`create_user` bigint NOT NULL COMMENT '创建人',
|
`create_user` bigint(20) NOT NULL COMMENT '创建人',
|
||||||
`create_time` datetime NOT NULL COMMENT '创建时间',
|
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||||
`update_user` bigint COMMENT '修改人',
|
PRIMARY KEY (`id`),
|
||||||
`update_time` datetime COMMENT '修改时间',
|
INDEX `idx_config_id`(`config_id`),
|
||||||
PRIMARY KEY (`id`) USING BTREE,
|
INDEX `idx_create_user`(`create_user`)
|
||||||
INDEX `idx_sys_sms_record_create_user`(`create_user` ASC) USING BTREE,
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='短信日志表';
|
||||||
INDEX `idx_sys_sms_record_update_user`(`update_user` ASC) USING BTREE
|
|
||||||
) ENGINE = InnoDB CHARACTER SET = 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()),
|
(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()),
|
(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()),
|
(1200, '短信配置', 1000, 1, '/system/sms', 'SystemSms', 'Layout', '/system/sms/config', 'message', false, false, false, NULL, 1000, 1, 1, NOW()),
|
||||||
(1195, '列表', 1194, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'system:smsConfig:list', 1, 1, 1, NOW()),
|
(1210, '短信配置', 1200, 2, '/system/sms/config', 'SystemSmsConfig', 'system/sms/config/index', NULL, 'message', false, false, false, NULL, 1, 1, 1, NOW()),
|
||||||
(1196, '详情', 1194, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'system:smsConfig:detail', 2, 1, 1, NOW()),
|
(1211, '列表', 1210, 3, NULL, NULL, NULL, NULL, NULL, false, false, false, 'system:smsConfig:list', 1, 1, 1, NOW()),
|
||||||
(1197, '新增', 1194, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'system:smsConfig:add', 3, 1, 1, NOW()),
|
(1212, '详情', 1210, 3, NULL, NULL, NULL, NULL, NULL, false, false, false, 'system:smsConfig:detail', 2, 1, 1, NOW()),
|
||||||
(1198, '修改', 1194, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'system:smsConfig:update', 4, 1, 1, NOW()),
|
(1213, '新增', 1210, 3, NULL, NULL, NULL, NULL, NULL, false, false, false, 'system:smsConfig:add', 3, 1, 1, NOW()),
|
||||||
(1199, '删除', 1194, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'system:smsConfig:delete', 5, 1, 1, NOW()),
|
(1214, '修改', 1210, 3, NULL, NULL, NULL, NULL, NULL, false, false, false, 'system:smsConfig:update', 4, 1, 1, NOW()),
|
||||||
(1200, '导出', 1194, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'system:smsConfig:export', 6, 1, 1, NOW()),
|
(1215, '删除', 1210, 3, NULL, NULL, NULL, NULL, NULL, false, false, false, 'system:smsConfig:delete', 5, 1, 1, NOW()),
|
||||||
(1201, '短信记录', 1000, 2, '/system/sms/record', 'SmsRecord', 'system/sms/record/index', NULL, NULL, false, false, false, NULL, 1, 1, 1, NOW()),
|
(1216, '导出', 1210, 3, NULL, NULL, NULL, NULL, NULL, false, false, false, 'system:smsConfig:export', 6, 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()),
|
(1220, '短信日志', 1200, 2, '/system/sms/log', 'SystemSmsLog', 'system/sms/log/index', NULL, 'history', false, false, false, NULL, 2, 1, 1, NOW()),
|
||||||
(1204, '导出', 1201, 3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'system:smsRecord:export', 6, 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()),
|
(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()),
|
(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_url" ON "sys_file" ("url");
|
||||||
CREATE INDEX "idx_file_type" ON "sys_file" ("type");
|
CREATE INDEX "idx_file_type" ON "sys_file" ("type");
|
||||||
CREATE INDEX "idx_file_md5" ON "sys_file" ("md5");
|
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_create_user" ON "sys_file" ("create_user");
|
||||||
CREATE INDEX "idx_file_update_user" ON "sys_file" ("update_user");
|
CREATE INDEX "idx_file_update_user" ON "sys_file" ("update_user");
|
||||||
COMMENT ON COLUMN "sys_file"."id" IS 'ID';
|
COMMENT ON COLUMN "sys_file"."id" IS 'ID';
|
||||||
@@ -526,7 +527,9 @@ CREATE TABLE IF NOT EXISTS "sys_client" (
|
|||||||
"update_time" timestamp DEFAULT NULL,
|
"update_time" timestamp DEFAULT NULL,
|
||||||
PRIMARY KEY ("id")
|
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"."id" IS 'ID';
|
||||||
COMMENT ON COLUMN "sys_client"."client_id" IS '终端ID';
|
COMMENT ON COLUMN "sys_client"."client_id" IS '终端ID';
|
||||||
COMMENT ON COLUMN "sys_client"."client_key" IS '终端Key';
|
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 COLUMN "sys_client"."update_time" IS '修改时间';
|
||||||
COMMENT ON TABLE "sys_client" IS '终端表';
|
COMMENT ON TABLE "sys_client" IS '终端表';
|
||||||
|
|
||||||
CREATE TABLE "sys_sms_config" (
|
CREATE TABLE IF NOT EXISTS "sys_sms_config" (
|
||||||
"id" int8 NOT NULL,
|
"id" int8 NOT NULL,
|
||||||
"name" varchar(255) NOT NULL,
|
"name" varchar(100) NOT NULL,
|
||||||
"supplier" varchar(50) NOT NULL,
|
"supplier" varchar(50) NOT NULL,
|
||||||
"access_key_id" varchar(255) NOT NULL,
|
"access_key" varchar(255) NOT NULL,
|
||||||
"access_key_secret" varchar(255) NOT NULL,
|
"secret_key" varchar(255) NOT NULL,
|
||||||
"signature" varchar(100) NOT NULL,
|
"signature" varchar(100) DEFAULT NULL,
|
||||||
"template_id" varchar(50) ,
|
"template_id" varchar(50) DEFAULT NULL,
|
||||||
"weight" int4,
|
"weight" int4 DEFAULT NULL,
|
||||||
"retry_interval" int4,
|
"retry_interval" int4 DEFAULT NULL,
|
||||||
"max_retries" int4,
|
"max_retries" int4 DEFAULT NULL,
|
||||||
"maximum" int4,
|
"maximum" int4 DEFAULT NULL,
|
||||||
"supplier_config" varchar(10000) ,
|
"supplier_config" text DEFAULT NULL ,
|
||||||
"is_enable" bool NOT NULL,
|
"status" int2 NOT NULL DEFAULT 1,
|
||||||
"create_user" int8 NOT NULL,
|
"create_user" int8 NOT NULL,
|
||||||
"create_time" timestamp(6) NOT NULL,
|
"create_time" timestamp NOT NULL,
|
||||||
"update_user" int8,
|
"update_user" int8 DEFAULT NULL,
|
||||||
"update_time" timestamp(6),
|
"update_time" timestamp DEFAULT NULL,
|
||||||
PRIMARY KEY ("id")
|
PRIMARY KEY ("id")
|
||||||
);
|
);
|
||||||
CREATE INDEX "idx_sys_sms_config_create_user" ON "sys_sms_config" USING btree ("create_user");
|
CREATE INDEX "idx_sms_config_create_user" ON "sys_sms_config" ("create_user");
|
||||||
CREATE INDEX "idx_sys_sms_config_update_user" ON "sys_sms_config" USING btree ("update_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"."id" IS 'ID';
|
||||||
COMMENT ON COLUMN "sys_sms_config"."name" IS '名称';
|
COMMENT ON COLUMN "sys_sms_config"."name" IS '名称';
|
||||||
COMMENT ON COLUMN "sys_sms_config"."supplier" 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" IS 'Access Key';
|
||||||
COMMENT ON COLUMN "sys_sms_config"."access_key_secret" IS 'Access Secret 或 API Secret';
|
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"."signature" IS '短信签名';
|
||||||
COMMENT ON COLUMN "sys_sms_config"."template_id" IS '模板 ID';
|
COMMENT ON COLUMN "sys_sms_config"."template_id" IS '模板ID';
|
||||||
COMMENT ON COLUMN "sys_sms_config"."weight" IS '负载均衡权重';
|
COMMENT ON COLUMN "sys_sms_config"."weight" IS '负载均衡权重';
|
||||||
COMMENT ON COLUMN "sys_sms_config"."retry_interval" 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"."max_retries" IS '重试次数';
|
||||||
COMMENT ON COLUMN "sys_sms_config"."maximum" IS '当前厂商的发送数量上限';
|
COMMENT ON COLUMN "sys_sms_config"."maximum" IS '发送上限';
|
||||||
COMMENT ON COLUMN "sys_sms_config"."supplier_config" 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"."status" IS '状态(1:启用;2:禁用)';
|
||||||
COMMENT ON COLUMN "sys_sms_config"."create_user" 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"."create_time" IS '创建时间';
|
||||||
COMMENT ON COLUMN "sys_sms_config"."update_user" IS '修改人';
|
COMMENT ON COLUMN "sys_sms_config"."update_user" IS '修改人';
|
||||||
COMMENT ON COLUMN "sys_sms_config"."update_time" IS '修改时间';
|
COMMENT ON COLUMN "sys_sms_config"."update_time" IS '修改时间';
|
||||||
COMMENT ON TABLE "sys_sms_config" IS '短信服务配置表';
|
COMMENT ON TABLE "sys_sms_config" IS '短信配置表';
|
||||||
|
|
||||||
CREATE TABLE "sys_sms_record" (
|
CREATE TABLE IF NOT EXISTS "sys_sms_log" (
|
||||||
"id" int8 NOT NULL,
|
"id" int8 NOT NULL,
|
||||||
"config_id" int8 NOT NULL,
|
"config_id" int8 NOT NULL,
|
||||||
"phone" varchar(25) NOT NULL,
|
"phone" varchar(25) NOT NULL,
|
||||||
"params" varchar(2048),
|
"params" text DEFAULT NULL,
|
||||||
"status" varchar(1),
|
"status" int2 NOT NULL DEFAULT 1,
|
||||||
"res_msg" varchar(2048),
|
"res_msg" text DEFAULT NULL,
|
||||||
"create_user" int8,
|
"create_user" int8 NOT NULL,
|
||||||
"create_time" timestamp(6) NOT NULL,
|
"create_time" timestamp NOT NULL,
|
||||||
"update_user" int8,
|
|
||||||
"update_time" timestamp(6),
|
|
||||||
PRIMARY KEY ("id")
|
PRIMARY KEY ("id")
|
||||||
);
|
);
|
||||||
CREATE INDEX "idx_sys_sms_record_create_user" ON "sys_sms_record" USING btree ("create_user");
|
CREATE INDEX "idx_sms_log_config_id" ON "sys_sms_log" ("config_id");
|
||||||
CREATE INDEX "idx_sys_sms_record_update_user" ON "sys_sms_record" USING btree ( "update_user" );
|
CREATE INDEX "idx_sms_log_create_user" ON "sys_sms_log" ("create_user");
|
||||||
COMMENT ON COLUMN "sys_sms_record"."id" IS 'ID';
|
COMMENT ON COLUMN "sys_sms_log"."id" IS 'ID';
|
||||||
COMMENT ON COLUMN "sys_sms_record"."config_id" IS '配置id';
|
COMMENT ON COLUMN "sys_sms_log"."config_id" IS '配置ID';
|
||||||
COMMENT ON COLUMN "sys_sms_record"."phone" IS '手机号';
|
COMMENT ON COLUMN "sys_sms_log"."phone" IS '手机号';
|
||||||
COMMENT ON COLUMN "sys_sms_record"."params" IS '参数配置';
|
COMMENT ON COLUMN "sys_sms_log"."params" IS '参数配置';
|
||||||
COMMENT ON COLUMN "sys_sms_record"."status" IS '发送状态';
|
COMMENT ON COLUMN "sys_sms_log"."status" IS '发送状态(1:成功;2:失败)';
|
||||||
COMMENT ON COLUMN "sys_sms_record"."res_msg" IS '返回数据';
|
COMMENT ON COLUMN "sys_sms_log"."res_msg" IS '返回数据';
|
||||||
COMMENT ON COLUMN "sys_sms_record"."create_user" IS '创建人';
|
COMMENT ON COLUMN "sys_sms_log"."create_user" IS '创建人';
|
||||||
COMMENT ON COLUMN "sys_sms_record"."create_time" IS '创建时间';
|
COMMENT ON COLUMN "sys_sms_log"."create_time" IS '创建时间';
|
||||||
COMMENT ON COLUMN "sys_sms_record"."update_user" IS '修改人';
|
COMMENT ON TABLE "sys_sms_log" IS '短信日志表';
|
||||||
COMMENT ON COLUMN "sys_sms_record"."update_time" IS '修改时间';
|
|
||||||
COMMENT ON TABLE "sys_sms_record" IS '短信记录表';
|
|
Reference in New Issue
Block a user