Merge branch 'master' of https://gitee.com/zhijiantianya/ruoyi-vue-pro into feature/multi-datasource
Conflicts: pom.xml src/main/resources/application-local.yamlplp
commit
fb2fbbffb8
@ -0,0 +1,7 @@
|
|||||||
|
NODE_ENV = production
|
||||||
|
|
||||||
|
# 测试环境配置
|
||||||
|
ENV = 'staging'
|
||||||
|
|
||||||
|
# 芋道管理系统/测试环境
|
||||||
|
VUE_APP_BASE_API = 'http://127.0.0.1:48080'
|
||||||
@ -0,0 +1,52 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 创建短信渠道
|
||||||
|
export function createSmsChannel(data) {
|
||||||
|
return request({
|
||||||
|
url: '/system/sms-channel/create',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新短信渠道
|
||||||
|
export function updateSmsChannel(data) {
|
||||||
|
return request({
|
||||||
|
url: '/system/sms-channel/update',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除短信渠道
|
||||||
|
export function deleteSmsChannel(id) {
|
||||||
|
return request({
|
||||||
|
url: '/system/sms-channel/delete?id=' + id,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获得短信渠道
|
||||||
|
export function getSmsChannel(id) {
|
||||||
|
return request({
|
||||||
|
url: '/system/sms-channel/get?id=' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获得短信渠道分页
|
||||||
|
export function getSmsChannelPage(query) {
|
||||||
|
return request({
|
||||||
|
url: '/system/sms-channel/page',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获得短信渠道精简列表
|
||||||
|
export function getSimpleSmsChannels() {
|
||||||
|
return request({
|
||||||
|
url: '/system/sms-channel/list-all-simple',
|
||||||
|
method: 'get',
|
||||||
|
})
|
||||||
|
}
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 获得短信日志分页
|
||||||
|
export function getSmsLogPage(query) {
|
||||||
|
return request({
|
||||||
|
url: '/system/sms-log/page',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导出短信日志 Excel
|
||||||
|
export function exportSmsLogExcel(query) {
|
||||||
|
return request({
|
||||||
|
url: '/system/sms-log/export-excel',
|
||||||
|
method: 'get',
|
||||||
|
params: query,
|
||||||
|
responseType: 'blob'
|
||||||
|
})
|
||||||
|
}
|
||||||
@ -0,0 +1,64 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 创建短信模板
|
||||||
|
export function createSmsTemplate(data) {
|
||||||
|
return request({
|
||||||
|
url: '/system/sms-template/create',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新短信模板
|
||||||
|
export function updateSmsTemplate(data) {
|
||||||
|
return request({
|
||||||
|
url: '/system/sms-template/update',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除短信模板
|
||||||
|
export function deleteSmsTemplate(id) {
|
||||||
|
return request({
|
||||||
|
url: '/system/sms-template/delete?id=' + id,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获得短信模板
|
||||||
|
export function getSmsTemplate(id) {
|
||||||
|
return request({
|
||||||
|
url: '/system/sms-template/get?id=' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获得短信模板分页
|
||||||
|
export function getSmsTemplatePage(query) {
|
||||||
|
return request({
|
||||||
|
url: '/system/sms-template/page',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建短信模板
|
||||||
|
export function sendSms(data) {
|
||||||
|
return request({
|
||||||
|
url: '/system/sms-template/send-sms',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导出短信模板 Excel
|
||||||
|
export function exportSmsTemplateExcel(query) {
|
||||||
|
return request({
|
||||||
|
url: '/system/sms-template/export-excel',
|
||||||
|
method: 'get',
|
||||||
|
params: query,
|
||||||
|
responseType: 'blob'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,542 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
|
||||||
|
<!-- 搜索工作栏 -->
|
||||||
|
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
|
<el-form-item label="短信签名" prop="signature">
|
||||||
|
<el-input v-model="queryParams.signature" placeholder="请输入短信签名" clearable size="small" @keyup.enter.native="handleQuery"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="启用状态" prop="status">
|
||||||
|
<el-select v-model="queryParams.status" placeholder="请选择启用状态" clearable size="small">
|
||||||
|
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.SYS_COMMON_STATUS)"
|
||||||
|
:key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="创建时间">
|
||||||
|
<el-date-picker v-model="dateRangeCreateTime" size="small" style="width: 240px" value-format="yyyy-MM-dd"
|
||||||
|
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<!-- 操作工具栏 -->
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
|
||||||
|
v-hasPermi="['system:sms-channel:create']">新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
|
||||||
|
v-hasPermi="['system:sms-channel:export']">导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<!-- 列表 -->
|
||||||
|
<el-table v-loading="loading" :data="list">
|
||||||
|
<el-table-column label="编号" align="center" prop="id" />
|
||||||
|
<el-table-column label="短信签名" align="center" prop="signature" />
|
||||||
|
<el-table-column label="渠道编码" align="center" prop="code">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ getDictDataLabel(DICT_TYPE.SYS_SMS_CHANNEL_CODE, scope.row.code) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>>
|
||||||
|
<el-table-column label="启用状态" align="center" prop="status">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ getDictDataLabel(DICT_TYPE.SYS_COMMON_STATUS, scope.row.status) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>>
|
||||||
|
<el-table-column label="备注" align="center" prop="remark" />
|
||||||
|
<el-table-column label="短信 API 的账号" align="center" prop="apiKey" />
|
||||||
|
<el-table-column label="短信 API 的秘钥" align="center" prop="apiSecret" />
|
||||||
|
<el-table-column label="短信发送回调 URL" align="center" prop="callbackUrl" />
|
||||||
|
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['system:sms-channel:update']">修改</el-button>
|
||||||
|
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['system:sms-channel:delete']">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<!-- 分页组件 -->
|
||||||
|
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"/>
|
||||||
|
|
||||||
|
<!-- 对话框(添加 / 修改) -->
|
||||||
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="短信签名" prop="signature">
|
||||||
|
<el-input v-model="form.signature" placeholder="请输入短信签名" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="渠道编码" prop="code">
|
||||||
|
<el-input v-model="form.code" placeholder="请输入渠道编码" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="启用状态">
|
||||||
|
<el-radio-group v-model="form.status">
|
||||||
|
<el-radio v-for="dict in this.getDictDatas(DICT_TYPE.SYS_COMMON_STATUS)"
|
||||||
|
:key="dict.value" :label="parseInt(dict.value)">{{dict.label}}</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="短信 API 的账号" prop="apiKey">
|
||||||
|
<el-input v-model="form.apiKey" placeholder="请输入短信 API 的账号" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="短信 API 的秘钥" prop="apiSecret">
|
||||||
|
<el-input v-model="form.apiSecret" placeholder="请输入短信 API 的秘钥" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="短信发送回调 URL" prop="callbackUrl">
|
||||||
|
<el-input v-model="form.callbackUrl" placeholder="请输入短信发送回调 URL" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { createSmsChannel, updateSmsChannel, deleteSmsChannel, getSmsChannel, getSmsChannelPage,
|
||||||
|
getSimpleSmsChannels } from "@/api/system/sms/smsChannel";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "SmsChannel",
|
||||||
|
components: {
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 短信渠道列表
|
||||||
|
list: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
dateRangeCreateTime: [],
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
signature: null,
|
||||||
|
status: null,
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
signature: [{ required: true, message: "短信签名不能为空", trigger: "blur" }],
|
||||||
|
code: [{ required: true, message: "渠道编码不能为空", trigger: "blur" }],
|
||||||
|
status: [{ required: true, message: "启用状态不能为空", trigger: "blur" }],
|
||||||
|
apiKey: [{ required: true, message: "短信 API 的账号不能为空", trigger: "blur" }],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 查询列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
// 处理查询参数
|
||||||
|
let params = {...this.queryParams};
|
||||||
|
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
|
||||||
|
// 执行查询
|
||||||
|
getSmsChannelPage(params).then(response => {
|
||||||
|
this.list = response.data.list;
|
||||||
|
this.total = response.data.total;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 取消按钮 */
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
/** 表单重置 */
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
id: undefined,
|
||||||
|
signature: undefined,
|
||||||
|
code: undefined,
|
||||||
|
status: undefined,
|
||||||
|
remark: undefined,
|
||||||
|
apiKey: undefined,
|
||||||
|
apiSecret: undefined,
|
||||||
|
callbackUrl: undefined,
|
||||||
|
};
|
||||||
|
this.resetForm("form");
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNo = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.dateRangeCreateTime = [];
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
handleAdd() {
|
||||||
|
this.reset();
|
||||||
|
this.open = true;
|
||||||
|
this.title = "添加短信渠道";
|
||||||
|
},
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
handleUpdate(row) {
|
||||||
|
this.reset();
|
||||||
|
const id = row.id;
|
||||||
|
getSmsChannel(id).then(response => {
|
||||||
|
this.form = response.data;
|
||||||
|
this.open = true;
|
||||||
|
this.title = "修改短信渠道";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm() {
|
||||||
|
this.$refs["form"].validate(valid => {
|
||||||
|
if (!valid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 修改的提交
|
||||||
|
if (this.form.id != null) {
|
||||||
|
updateSmsChannel(this.form).then(response => {
|
||||||
|
this.msgSuccess("修改成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 添加的提交
|
||||||
|
createSmsChannel(this.form).then(response => {
|
||||||
|
this.msgSuccess("新增成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(row) {
|
||||||
|
const id = row.id;
|
||||||
|
this.$confirm('是否确认删除短信渠道编号为"' + id + '"的数据项?', "警告", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning"
|
||||||
|
}).then(function() {
|
||||||
|
return deleteSmsChannel(id);
|
||||||
|
}).then(() => {
|
||||||
|
this.getList();
|
||||||
|
this.msgSuccess("删除成功");
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
handleExport() {
|
||||||
|
// 处理查询参数
|
||||||
|
let params = {...this.queryParams};
|
||||||
|
params.pageNo = undefined;
|
||||||
|
params.pageSize = undefined;
|
||||||
|
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
|
||||||
|
// 执行导出
|
||||||
|
this.$confirm('是否确认导出所有短信渠道数据项?', "警告", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning"
|
||||||
|
}).then(function() {
|
||||||
|
return exportSmsChannelExcel(params);
|
||||||
|
}).then(response => {
|
||||||
|
this.downloadExcel(response, '短信渠道.xls');
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script><template>
|
||||||
|
<div class="app-container">
|
||||||
|
|
||||||
|
<!-- 搜索工作栏 -->
|
||||||
|
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
|
<el-form-item label="短信签名" prop="signature">
|
||||||
|
<el-input v-model="queryParams.signature" placeholder="请输入短信签名" clearable size="small" @keyup.enter.native="handleQuery"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="启用状态" prop="status">
|
||||||
|
<el-select v-model="queryParams.status" placeholder="请选择启用状态" clearable size="small">
|
||||||
|
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.SYS_COMMON_STATUS)"
|
||||||
|
:key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="创建时间">
|
||||||
|
<el-date-picker v-model="dateRangeCreateTime" size="small" style="width: 240px" value-format="yyyy-MM-dd"
|
||||||
|
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<!-- 操作工具栏 -->
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
|
||||||
|
v-hasPermi="['system:sms-channel:create']">新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
|
||||||
|
v-hasPermi="['system:sms-channel:export']">导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<!-- 列表 -->
|
||||||
|
<el-table v-loading="loading" :data="list">
|
||||||
|
<el-table-column label="编号" align="center" prop="id" />
|
||||||
|
<el-table-column label="短信签名" align="center" prop="signature" />
|
||||||
|
<el-table-column label="渠道编码" align="center" prop="code">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ getDictDataLabel(DICT_TYPE.SYS_SMS_CHANNEL_CODE, scope.row.code) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>>
|
||||||
|
<el-table-column label="启用状态" align="center" prop="status">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ getDictDataLabel(DICT_TYPE.SYS_COMMON_STATUS, scope.row.status) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>>
|
||||||
|
<el-table-column label="备注" align="center" prop="remark" />
|
||||||
|
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['system:sms-channel:update']">修改</el-button>
|
||||||
|
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['system:sms-channel:delete']">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<!-- 分页组件 -->
|
||||||
|
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"/>
|
||||||
|
|
||||||
|
<!-- 对话框(添加 / 修改) -->
|
||||||
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="130px">
|
||||||
|
<el-form-item label="短信签名" prop="signature">
|
||||||
|
<el-input v-model="form.signature" placeholder="请输入短信签名" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="渠道编码" prop="code">
|
||||||
|
<el-select v-model="form.code" placeholder="请选择渠道编码" :disabled="form.id > 0">
|
||||||
|
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.SYS_SMS_CHANNEL_CODE)"
|
||||||
|
:key="dict.value" :label="dict.label" :value="dict.value" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="启用状态">
|
||||||
|
<el-radio-group v-model="form.status">
|
||||||
|
<el-radio v-for="dict in this.getDictDatas(DICT_TYPE.SYS_COMMON_STATUS)"
|
||||||
|
:key="dict.value" :label="parseInt(dict.value)">{{dict.label}}</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="短信 API 的账号" prop="apiKey">
|
||||||
|
<el-input v-model="form.apiKey" placeholder="请输入短信 API 的账号" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item v-if="form.code !== 'YUN_PIAN'" label="短信 API 的秘钥" prop="apiSecret">
|
||||||
|
<el-input v-model="form.apiSecret" placeholder="请输入短信 API 的秘钥" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="短信发送回调 URL" prop="callbackUrl">
|
||||||
|
<el-input v-model="form.callbackUrl" placeholder="请输入短信发送回调 URL" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { createSmsChannel, updateSmsChannel, deleteSmsChannel, getSmsChannel, getSmsChannelPage } from "@/api/system/sms/smsChannel";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "SmsChannel",
|
||||||
|
components: {
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 短信渠道列表
|
||||||
|
list: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
dateRangeCreateTime: [],
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
signature: null,
|
||||||
|
status: null,
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 表单校验
|
||||||
|
apiKeyEnableChannelCodes: ['YUN_PIAN'],
|
||||||
|
rules: {
|
||||||
|
signature: [{ required: true, message: "短信签名不能为空", trigger: "blur" }],
|
||||||
|
code: [{ required: true, message: "渠道编码不能为空", trigger: "blur" }],
|
||||||
|
status: [{ required: true, message: "启用状态不能为空", trigger: "blur" }],
|
||||||
|
apiKey: [{ required: true, message: "短信 API 的账号不能为空", trigger: "blur" }],
|
||||||
|
apiSecret: [{ required: true, message: "短信 API 的秘钥不能为空", trigger: "blur" }],
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 查询列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
// 处理查询参数
|
||||||
|
let params = {...this.queryParams};
|
||||||
|
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
|
||||||
|
// 执行查询
|
||||||
|
getSmsChannelPage(params).then(response => {
|
||||||
|
this.list = response.data.list;
|
||||||
|
this.total = response.data.total;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 取消按钮 */
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
/** 表单重置 */
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
id: undefined,
|
||||||
|
signature: undefined,
|
||||||
|
code: undefined,
|
||||||
|
status: undefined,
|
||||||
|
remark: undefined,
|
||||||
|
apiKey: undefined,
|
||||||
|
apiSecret: undefined,
|
||||||
|
callbackUrl: undefined,
|
||||||
|
};
|
||||||
|
this.resetForm("form");
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNo = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.dateRangeCreateTime = [];
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
handleAdd() {
|
||||||
|
this.reset();
|
||||||
|
this.open = true;
|
||||||
|
this.title = "添加短信渠道";
|
||||||
|
},
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
handleUpdate(row) {
|
||||||
|
this.reset();
|
||||||
|
const id = row.id;
|
||||||
|
getSmsChannel(id).then(response => {
|
||||||
|
this.form = response.data;
|
||||||
|
this.open = true;
|
||||||
|
this.title = "修改短信渠道";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm() {
|
||||||
|
this.$refs["form"].validate(valid => {
|
||||||
|
if (!valid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 修改的提交
|
||||||
|
if (this.form.id != null) {
|
||||||
|
updateSmsChannel(this.form).then(response => {
|
||||||
|
this.msgSuccess("修改成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 添加的提交
|
||||||
|
createSmsChannel(this.form).then(response => {
|
||||||
|
this.msgSuccess("新增成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(row) {
|
||||||
|
const id = row.id;
|
||||||
|
this.$confirm('是否确认删除短信渠道编号为"' + id + '"的数据项?', "警告", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning"
|
||||||
|
}).then(function() {
|
||||||
|
return deleteSmsChannel(id);
|
||||||
|
}).then(() => {
|
||||||
|
this.getList();
|
||||||
|
this.msgSuccess("删除成功");
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
handleExport() {
|
||||||
|
// 处理查询参数
|
||||||
|
let params = {...this.queryParams};
|
||||||
|
params.pageNo = undefined;
|
||||||
|
params.pageSize = undefined;
|
||||||
|
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
|
||||||
|
// 执行导出
|
||||||
|
this.$confirm('是否确认导出所有短信渠道数据项?', "警告", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning"
|
||||||
|
}).then(function() {
|
||||||
|
return exportSmsChannelExcel(params);
|
||||||
|
}).then(response => {
|
||||||
|
this.downloadExcel(response, '短信渠道.xls');
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
@ -0,0 +1,297 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
|
||||||
|
<!-- 搜索工作栏 -->
|
||||||
|
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
|
||||||
|
<el-form-item label="手机号" prop="mobile">
|
||||||
|
<el-input v-model="queryParams.mobile" placeholder="请输入手机号" clearable size="small" @keyup.enter.native="handleQuery"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="短信渠道" prop="channelId">
|
||||||
|
<el-select v-model="queryParams.channelId" placeholder="请选择短信渠道" clearable size="small">
|
||||||
|
<el-option v-for="channel in channelOptions"
|
||||||
|
:key="channel.id" :value="channel.id"
|
||||||
|
:label="channel.signature + '【' + getDictDataLabel(DICT_TYPE.SYS_SMS_CHANNEL_CODE, channel.code) + '】'" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="模板编号" prop="templateId">
|
||||||
|
<el-input v-model="queryParams.templateId" placeholder="请输入模板编号" clearable size="small" @keyup.enter.native="handleQuery"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="发送状态" prop="sendStatus">
|
||||||
|
<el-select v-model="queryParams.sendStatus" placeholder="请选择发送状态" clearable size="small">
|
||||||
|
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.SYS_SMS_SEND_STATUS)"
|
||||||
|
:key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="发送时间">
|
||||||
|
<el-date-picker v-model="dateRangeSendTime" size="small" style="width: 240px" value-format="yyyy-MM-dd"
|
||||||
|
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="接收状态" prop="receiveStatus">
|
||||||
|
<el-select v-model="queryParams.receiveStatus" placeholder="请选择接收状态" clearable size="small">
|
||||||
|
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.SYS_SMS_RECEIVE_STATUS)"
|
||||||
|
:key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="接收时间">
|
||||||
|
<el-date-picker v-model="dateRangeReceiveTime" size="small" style="width: 240px" value-format="yyyy-MM-dd"
|
||||||
|
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<!-- 操作工具栏 -->
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
|
||||||
|
v-hasPermi="['system:sms-log:create']">新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
|
||||||
|
v-hasPermi="['system:sms-log:export']">导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<!-- 列表 -->
|
||||||
|
<el-table v-loading="loading" :data="list">
|
||||||
|
<el-table-column label="编号" align="center" prop="id" />
|
||||||
|
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="手机号" align="center" prop="mobile" width="120">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<div>{{ scope.row.mobile }}</div>
|
||||||
|
<div v-if="scope.row.userType && scope.row.userId">
|
||||||
|
{{ getDictDataLabel(DICT_TYPE.USER_TYPE, scope.row.userType) + '(' + scope.row.userId + ')' }}
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="短信内容" align="center" prop="templateContent" width="300" />
|
||||||
|
<el-table-column label="发送状态" align="center" width="180">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<div>{{ getDictDataLabel(DICT_TYPE.SYS_SMS_SEND_STATUS, scope.row.sendStatus) }}</div>
|
||||||
|
<div>{{ parseTime(scope.row.sendTime) }}</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="接收状态" align="center" width="180">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<div>{{ getDictDataLabel(DICT_TYPE.SYS_SMS_RECEIVE_STATUS, scope.row.receiveStatus) }}</div>
|
||||||
|
<div>{{ parseTime(scope.row.receiveTime) }}</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="短信渠道" align="center" width="120">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<div>{{ formatChannelSignature(scope.row.channelId) }}</div>
|
||||||
|
<div>【{{ getDictDataLabel(DICT_TYPE.SYS_SMS_CHANNEL_CODE, scope.row.channelCode) }}】</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="模板编号" align="center" prop="templateId" />
|
||||||
|
<el-table-column label="短信类型" align="center" prop="templateType">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ getDictDataLabel(DICT_TYPE.SYS_SMS_TEMPLATE_TYPE, scope.row.templateType) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button size="mini" type="text" icon="el-icon-view" @click="handleView(scope.row,scope.index)"
|
||||||
|
v-hasPermi="['system:sms-log:query']">详细</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<!-- 分页组件 -->
|
||||||
|
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"/>
|
||||||
|
|
||||||
|
<!-- 短信日志详细 -->
|
||||||
|
<el-dialog title="短信日志详细" :visible.sync="open" width="700px" append-to-body>
|
||||||
|
<el-form ref="form" :model="form" label-width="140px" size="mini">
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="日志主键:">{{ form.id }}</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="短信渠道:">
|
||||||
|
{{ formatChannelSignature(form.channelId) }}【{{ getDictDataLabel(DICT_TYPE.SYS_SMS_CHANNEL_CODE, form.channelCode) }}】
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="短信模板:">
|
||||||
|
{{ form.templateId }} | {{ form.templateCode}} | {{ getDictDataLabel(DICT_TYPE.SYS_SMS_TEMPLATE_TYPE, form.templateType) }}
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="API 的模板编号:">{{ form.apiTemplateId }}</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="用户信息:">{{ form.mobile }}
|
||||||
|
<span v-if="form.userType && form.userId"> | {{ getDictDataLabel(DICT_TYPE.USER_TYPE, form.userType) }} | {{ form.userId }}</span>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="短信内容:">{{ form.templateContent }}</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="短信参数:">{{ form.templateParams }}</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="创建时间:">{{ parseTime(form.createTime) }}</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="发送状态:">{{ getDictDataLabel(DICT_TYPE.SYS_SMS_SEND_STATUS, form.sendStatus) }}</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="发送时间:">{{ parseTime(form.sendTime) }}</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="发送结果:">{{ form.sendCode }} | {{ form.sendMsg }}
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="API 发送结果:">{{ form.apiSendCode }} | {{ form.apiSendMsg }}</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="API 短信编号:">{{ form.apiSerialNo }}</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="API 请求编号:">{{ form.apiRequestId }}</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="接收状态:">{{ getDictDataLabel(DICT_TYPE.SYS_SMS_RECEIVE_STATUS, form.receiveStatus) }}</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="接收时间:">{{ parseTime(form.receiveTime) }}</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="API 接收结果:">{{ form.apiReceiveCode }} | {{ form.apiReceiveMsg }}
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="open = false">关 闭</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getSmsLogPage, exportSmsLogExcel } from "@/api/system/sms/smsLog";
|
||||||
|
import { getSimpleSmsChannels } from "@/api/system/sms/smsChannel";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "SmsLog",
|
||||||
|
components: {
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 短信日志列表
|
||||||
|
list: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
dateRangeSendTime: [],
|
||||||
|
dateRangeReceiveTime: [],
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
channelId: null,
|
||||||
|
templateId: null,
|
||||||
|
mobile: null,
|
||||||
|
sendStatus: null,
|
||||||
|
receiveStatus: null,
|
||||||
|
},
|
||||||
|
// 短信渠道
|
||||||
|
channelOptions: [],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
// 获得短信渠道
|
||||||
|
getSimpleSmsChannels().then(response => {
|
||||||
|
this.channelOptions = response.data;
|
||||||
|
})
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 查询列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
// 处理查询参数
|
||||||
|
let params = {...this.queryParams};
|
||||||
|
this.addBeginAndEndTime(params, this.dateRangeSendTime, 'sendTime');
|
||||||
|
this.addBeginAndEndTime(params, this.dateRangeReceiveTime, 'receiveTime');
|
||||||
|
// 执行查询
|
||||||
|
getSmsLogPage(params).then(response => {
|
||||||
|
this.list = response.data.list;
|
||||||
|
this.total = response.data.total;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 取消按钮 */
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNo = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.dateRangeSendTime = [];
|
||||||
|
this.dateRangeReceiveTime = [];
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
handleExport() {
|
||||||
|
// 处理查询参数
|
||||||
|
let params = {...this.queryParams};
|
||||||
|
params.pageNo = undefined;
|
||||||
|
params.pageSize = undefined;
|
||||||
|
this.addBeginAndEndTime(params, this.dateRangeSendTime, 'sendTime');
|
||||||
|
this.addBeginAndEndTime(params, this.dateRangeReceiveTime, 'receiveTime');
|
||||||
|
// 执行导出
|
||||||
|
this.$confirm('是否确认导出所有短信日志数据项?', "警告", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning"
|
||||||
|
}).then(function() {
|
||||||
|
return exportSmsLogExcel(params);
|
||||||
|
}).then(response => {
|
||||||
|
this.downloadExcel(response, '短信日志.xls');
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/** 详细按钮操作 */
|
||||||
|
handleView(row) {
|
||||||
|
this.open = true;
|
||||||
|
this.form = row;
|
||||||
|
},
|
||||||
|
/** 格式化短信渠道 */
|
||||||
|
formatChannelSignature(channelId) {
|
||||||
|
for (const channel of this.channelOptions) {
|
||||||
|
if (channel.id === channelId) {
|
||||||
|
return channel.signature;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return '找不到签名:' + channelId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
@ -0,0 +1,405 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
|
||||||
|
<!-- 搜索工作栏 -->
|
||||||
|
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="150px">
|
||||||
|
<el-form-item label="短信类型" prop="type">
|
||||||
|
<el-select v-model="queryParams.type" placeholder="请选择短信类型" clearable size="small">
|
||||||
|
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.SYS_SMS_TEMPLATE_TYPE)"
|
||||||
|
:key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="开启状态" prop="status">
|
||||||
|
<el-select v-model="queryParams.status" placeholder="请选择开启状态" clearable size="small">
|
||||||
|
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.SYS_COMMON_STATUS)"
|
||||||
|
:key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="模板编码" prop="code">
|
||||||
|
<el-input v-model="queryParams.code" placeholder="请输入模板编码" clearable size="small" @keyup.enter.native="handleQuery"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="短信 API 的模板编号" prop="apiTemplateId">
|
||||||
|
<el-input v-model="queryParams.apiTemplateId" placeholder="请输入短信 API 的模板编号" clearable size="small" @keyup.enter.native="handleQuery"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="短信渠道" prop="channelId">
|
||||||
|
<el-select v-model="queryParams.channelId" placeholder="请选择短信渠道" clearable size="small">
|
||||||
|
<el-option v-for="channel in channelOptions"
|
||||||
|
:key="channel.id" :value="channel.id"
|
||||||
|
:label="channel.signature + '【' + getDictDataLabel(DICT_TYPE.SYS_SMS_CHANNEL_CODE, channel.code) + '】'" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="创建时间">
|
||||||
|
<el-date-picker v-model="dateRangeCreateTime" size="small" style="width: 240px" value-format="yyyy-MM-dd"
|
||||||
|
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<!-- 操作工具栏 -->
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
|
||||||
|
v-hasPermi="['system:sms-template:create']">新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
|
||||||
|
v-hasPermi="['system:sms-template:export']">导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<!-- 列表 -->
|
||||||
|
<el-table v-loading="loading" :data="list">
|
||||||
|
<el-table-column label="模板编码" align="center" prop="code" />
|
||||||
|
<el-table-column label="模板名称" align="center" prop="name" />
|
||||||
|
<el-table-column label="模板内容" align="center" prop="content" width="300" />
|
||||||
|
<el-table-column label="短信类型" align="center" prop="type">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ getDictDataLabel(DICT_TYPE.SYS_SMS_TEMPLATE_TYPE, scope.row.type) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="开启状态" align="center" prop="status">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ getDictDataLabel(DICT_TYPE.SYS_COMMON_STATUS, scope.row.status) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="备注" align="center" prop="remark" />
|
||||||
|
<el-table-column label="短信 API 的模板编号" align="center" prop="apiTemplateId" width="180" />
|
||||||
|
<el-table-column label="短信渠道" align="center" width="120">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<div>{{ formatChannelSignature(scope.row.channelId) }}</div>
|
||||||
|
<div>【{{ getDictDataLabel(DICT_TYPE.SYS_SMS_CHANNEL_CODE, scope.row.channelCode) }}】</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button size="mini" type="text" icon="el-icon-share" @click="handleSendSms(scope.row)"
|
||||||
|
v-hasPermi="['system:sms-template:send-sms']">测试</el-button>
|
||||||
|
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['system:sms-template:update']">修改</el-button>
|
||||||
|
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['system:sms-template:delete']">删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<!-- 分页组件 -->
|
||||||
|
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"/>
|
||||||
|
|
||||||
|
<!-- 对话框(添加 / 修改) -->
|
||||||
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="140px">
|
||||||
|
<el-form-item label="短信渠道编号" prop="channelId">
|
||||||
|
<el-select v-model="form.channelId" placeholder="请选择短信渠道编号">
|
||||||
|
<el-option v-for="channel in channelOptions"
|
||||||
|
:key="channel.id" :value="channel.id"
|
||||||
|
:label="channel.signature + '【' + getDictDataLabel(DICT_TYPE.SYS_SMS_CHANNEL_CODE, channel.code) + '】'" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="短信类型" prop="type">
|
||||||
|
<el-select v-model="form.type" placeholder="请选择短信类型">
|
||||||
|
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.SYS_SMS_TEMPLATE_TYPE)"
|
||||||
|
:key="dict.value" :label="dict.label" :value="parseInt(dict.value)" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="模板编号" prop="code">
|
||||||
|
<el-input v-model="form.code" placeholder="请输入模板编号" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="模板名称" prop="name">
|
||||||
|
<el-input v-model="form.name" placeholder="请输入模板名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="模板内容" prop="content">
|
||||||
|
<el-input type="textarea" v-model="form.content" placeholder="请输入模板内容" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="开启状态" prop="status">
|
||||||
|
<el-radio-group v-model="form.status">
|
||||||
|
<el-radio v-for="dict in this.getDictDatas(DICT_TYPE.SYS_COMMON_STATUS)"
|
||||||
|
:key="dict.value" :label="parseInt(dict.value)">{{dict.label}}</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="短信 API 模板编号" prop="apiTemplateId">
|
||||||
|
<el-input v-model="form.apiTemplateId" placeholder="请输入短信 API 的模板编号" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
<!-- 对话框(发送短信) -->
|
||||||
|
<el-dialog title="测试发送短信" :visible.sync="sendSmsOpen" width="500px" append-to-body>
|
||||||
|
<el-form ref="sendSmsForm" :model="sendSmsForm" :rules="sendSmsRules" label-width="140px">
|
||||||
|
<el-form-item label="模板内容" prop="content">
|
||||||
|
<el-input v-model="sendSmsForm.content" type="textarea" placeholder="请输入模板内容" readonly />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="手机号" prop="mobile">
|
||||||
|
<el-input v-model="sendSmsForm.mobile" placeholder="请输入手机号" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item v-for="param in sendSmsForm.params" :label="'参数 {' + param + '}'" :prop="'templateParams.' + param">
|
||||||
|
<el-input v-model="sendSmsForm.templateParams[param]" :placeholder="'请输入 ' + param + ' 参数'" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitSendSmsForm">确 定</el-button>
|
||||||
|
<el-button @click="cancelSendSms">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { createSmsTemplate, updateSmsTemplate, deleteSmsTemplate, getSmsTemplate, getSmsTemplatePage,
|
||||||
|
exportSmsTemplateExcel, sendSms } from "@/api/system/sms/smsTemplate";
|
||||||
|
import { getSimpleSmsChannels } from "@/api/system/sms/smsChannel";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "SmsTemplate",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 短信模板列表
|
||||||
|
list: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
dateRangeCreateTime: [],
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
type: null,
|
||||||
|
status: null,
|
||||||
|
code: null,
|
||||||
|
content: null,
|
||||||
|
apiTemplateId: null,
|
||||||
|
channelId: null,
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
type: [{ required: true, message: "短信类型不能为空", trigger: "change" }],
|
||||||
|
status: [{ required: true, message: "开启状态不能为空", trigger: "blur" }],
|
||||||
|
code: [{ required: true, message: "模板编码不能为空", trigger: "blur" }],
|
||||||
|
name: [{ required: true, message: "模板名称不能为空", trigger: "blur" }],
|
||||||
|
content: [{ required: true, message: "模板内容不能为空", trigger: "blur" }],
|
||||||
|
apiTemplateId: [{ required: true, message: "短信 API 的模板编号不能为空", trigger: "blur" }],
|
||||||
|
channelId: [{ required: true, message: "短信渠道编号不能为空", trigger: "change" }],
|
||||||
|
},
|
||||||
|
// 短信渠道
|
||||||
|
channelOptions: [],
|
||||||
|
// 发送短信
|
||||||
|
sendSmsOpen: false,
|
||||||
|
sendSmsForm: {
|
||||||
|
params: [], // 模板的参数列表
|
||||||
|
},
|
||||||
|
sendSmsRules: {
|
||||||
|
mobile: [{ required: true, message: "手机不能为空", trigger: "blur" }],
|
||||||
|
templateCode: [{ required: true, message: "手机不能为空", trigger: "blur" }],
|
||||||
|
templateParams: { }
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
// 获得短信渠道
|
||||||
|
getSimpleSmsChannels().then(response => {
|
||||||
|
this.channelOptions = response.data;
|
||||||
|
})
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 查询列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
// 处理查询参数
|
||||||
|
let params = {...this.queryParams};
|
||||||
|
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
|
||||||
|
// 执行查询
|
||||||
|
getSmsTemplatePage(params).then(response => {
|
||||||
|
this.list = response.data.list;
|
||||||
|
this.total = response.data.total;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 取消按钮 */
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
/** 表单重置 */
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
id: undefined,
|
||||||
|
type: undefined,
|
||||||
|
status: undefined,
|
||||||
|
code: undefined,
|
||||||
|
name: undefined,
|
||||||
|
content: undefined,
|
||||||
|
remark: undefined,
|
||||||
|
apiTemplateId: undefined,
|
||||||
|
channelId: undefined,
|
||||||
|
};
|
||||||
|
this.resetForm("form");
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNo = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.dateRangeCreateTime = [];
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
handleAdd() {
|
||||||
|
this.reset();
|
||||||
|
this.open = true;
|
||||||
|
this.title = "添加短信模板";
|
||||||
|
},
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
handleUpdate(row) {
|
||||||
|
this.reset();
|
||||||
|
const id = row.id;
|
||||||
|
getSmsTemplate(id).then(response => {
|
||||||
|
this.form = response.data;
|
||||||
|
this.open = true;
|
||||||
|
this.title = "修改短信模板";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm() {
|
||||||
|
this.$refs["form"].validate(valid => {
|
||||||
|
if (!valid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 修改的提交
|
||||||
|
if (this.form.id != null) {
|
||||||
|
updateSmsTemplate(this.form).then(response => {
|
||||||
|
this.msgSuccess("修改成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 添加的提交
|
||||||
|
createSmsTemplate(this.form).then(response => {
|
||||||
|
this.msgSuccess("新增成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(row) {
|
||||||
|
const id = row.id;
|
||||||
|
this.$confirm('是否确认删除短信模板编号为"' + id + '"的数据项?', "警告", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning"
|
||||||
|
}).then(function() {
|
||||||
|
return deleteSmsTemplate(id);
|
||||||
|
}).then(() => {
|
||||||
|
this.getList();
|
||||||
|
this.msgSuccess("删除成功");
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
handleExport() {
|
||||||
|
// 处理查询参数
|
||||||
|
let params = {...this.queryParams};
|
||||||
|
params.pageNo = undefined;
|
||||||
|
params.pageSize = undefined;
|
||||||
|
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
|
||||||
|
// 执行导出
|
||||||
|
this.$confirm('是否确认导出所有短信模板数据项?', "警告", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning"
|
||||||
|
}).then(function() {
|
||||||
|
return exportSmsTemplateExcel(params);
|
||||||
|
}).then(response => {
|
||||||
|
this.downloadExcel(response, '短信模板.xls');
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/** 发送短息按钮 */
|
||||||
|
handleSendSms(row) {
|
||||||
|
this.resetSendSms(row);
|
||||||
|
// 设置参数
|
||||||
|
this.sendSmsForm.content = row.content;
|
||||||
|
this.sendSmsForm.params = row.params;
|
||||||
|
this.sendSmsForm.templateCode = row.code;
|
||||||
|
this.sendSmsForm.templateParams = row.params.reduce(function(obj, item) {
|
||||||
|
obj[item] = undefined;
|
||||||
|
return obj;
|
||||||
|
}, {});
|
||||||
|
// 根据 row 重置 rules
|
||||||
|
this.sendSmsRules.templateParams = row.params.reduce(function(obj, item) {
|
||||||
|
obj[item] = { required: true, message: '参数 ' + item + " 不能为空", trigger: "change" };
|
||||||
|
return obj;
|
||||||
|
}, {});
|
||||||
|
// 设置打开
|
||||||
|
this.sendSmsOpen = true;
|
||||||
|
},
|
||||||
|
/** 重置发送短信的表单 */
|
||||||
|
resetSendSms() {
|
||||||
|
// 根据 row 重置表单
|
||||||
|
this.sendSmsForm = {
|
||||||
|
content: undefined,
|
||||||
|
params: undefined,
|
||||||
|
mobile: undefined,
|
||||||
|
templateCode: undefined,
|
||||||
|
templateParams: {}
|
||||||
|
};
|
||||||
|
this.resetForm("sendSmsForm");
|
||||||
|
},
|
||||||
|
/** 取消发送短信 */
|
||||||
|
cancelSendSms() {
|
||||||
|
this.sendSmsOpen = false;
|
||||||
|
this.resetSendSms();
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitSendSmsForm() {
|
||||||
|
this.$refs["sendSmsForm"].validate(valid => {
|
||||||
|
if (!valid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 添加的提交
|
||||||
|
sendSms(this.sendSmsForm).then(response => {
|
||||||
|
this.msgSuccess("提交发送成功!发送结果,见发送日志编号:" + response.data);
|
||||||
|
this.sendSmsOpen = false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 格式化短信渠道 */
|
||||||
|
formatChannelSignature(channelId) {
|
||||||
|
for (const channel of this.channelOptions) {
|
||||||
|
if (channel.id === channelId) {
|
||||||
|
return channel.signature;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return '找不到签名:' + channelId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
package cn.iocoder.dashboard.common.core;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Key Value 的键值对
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class KeyValue<K, V> {
|
||||||
|
|
||||||
|
private K key;
|
||||||
|
private V value;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
package cn.iocoder.dashboard.common.enums;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用状态枚举
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum DefaultBitFieldEnum {
|
||||||
|
|
||||||
|
NO(0, "否"),
|
||||||
|
YES(1, "是");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态值
|
||||||
|
*/
|
||||||
|
private final Integer val;
|
||||||
|
/**
|
||||||
|
* 状态名
|
||||||
|
*/
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,39 @@
|
|||||||
|
package cn.iocoder.dashboard.framework.excel.core.convert;
|
||||||
|
|
||||||
|
import cn.iocoder.dashboard.util.json.JsonUtils;
|
||||||
|
import com.alibaba.excel.converters.Converter;
|
||||||
|
import com.alibaba.excel.enums.CellDataTypeEnum;
|
||||||
|
import com.alibaba.excel.metadata.CellData;
|
||||||
|
import com.alibaba.excel.metadata.GlobalConfiguration;
|
||||||
|
import com.alibaba.excel.metadata.property.ExcelContentProperty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Excel Json 转换器
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
public class JsonConvert implements Converter<Object> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<?> supportJavaTypeKey() {
|
||||||
|
throw new UnsupportedOperationException("暂不支持,也不需要");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CellDataTypeEnum supportExcelTypeKey() {
|
||||||
|
throw new UnsupportedOperationException("暂不支持,也不需要");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object convertToJavaData(CellData cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) {
|
||||||
|
throw new UnsupportedOperationException("暂不支持,也不需要");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CellData<String> convertToExcelData(Object value, ExcelContentProperty contentProperty,
|
||||||
|
GlobalConfiguration globalConfiguration) {
|
||||||
|
// 生成 Excel 小表格
|
||||||
|
return new CellData<>(JsonUtils.toJsonString(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
package cn.iocoder.dashboard.framework.sms.config;
|
||||||
|
|
||||||
|
import cn.iocoder.dashboard.framework.sms.core.client.SmsClientFactory;
|
||||||
|
import cn.iocoder.dashboard.framework.sms.core.client.impl.SmsClientFactoryImpl;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 短信配置类
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class SmsConfiguration {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public SmsClientFactory smsClientFactory() {
|
||||||
|
return new SmsClientFactoryImpl();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,36 @@
|
|||||||
|
package cn.iocoder.dashboard.framework.sms.core.client;
|
||||||
|
|
||||||
|
import cn.iocoder.dashboard.framework.sms.core.property.SmsChannelProperties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 短信客户端工厂接口
|
||||||
|
*
|
||||||
|
* @author zzf
|
||||||
|
* @date 2021/1/28 14:01
|
||||||
|
*/
|
||||||
|
public interface SmsClientFactory {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得短信 Client
|
||||||
|
*
|
||||||
|
* @param channelId 渠道编号
|
||||||
|
* @return 短信 Client
|
||||||
|
*/
|
||||||
|
SmsClient getSmsClient(Long channelId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得短信 Client
|
||||||
|
*
|
||||||
|
* @param channelCode 渠道编码
|
||||||
|
* @return 短信 Client
|
||||||
|
*/
|
||||||
|
SmsClient getSmsClient(String channelCode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建短信 Client
|
||||||
|
*
|
||||||
|
* @param properties 配置对象
|
||||||
|
*/
|
||||||
|
void createOrUpdateSmsClient(SmsChannelProperties properties);
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,48 @@
|
|||||||
|
package cn.iocoder.dashboard.framework.sms.core.client.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息接收 Response DTO
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SmsReceiveRespDTO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否接收成功
|
||||||
|
*/
|
||||||
|
private Boolean success;
|
||||||
|
/**
|
||||||
|
* API 接收结果的编码
|
||||||
|
*/
|
||||||
|
private String errorCode;
|
||||||
|
/**
|
||||||
|
* API 接收结果的说明
|
||||||
|
*/
|
||||||
|
private String errorMsg;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手机号
|
||||||
|
*/
|
||||||
|
private String mobile;
|
||||||
|
/**
|
||||||
|
* 用户接收时间
|
||||||
|
*/
|
||||||
|
private Date receiveTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 短信 API 发送返回的序号
|
||||||
|
*/
|
||||||
|
private String serialNo;
|
||||||
|
/**
|
||||||
|
* 短信日志编号
|
||||||
|
*
|
||||||
|
* 对应 SysSmsLogDO 的编号
|
||||||
|
*/
|
||||||
|
private Long logId;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
package cn.iocoder.dashboard.framework.sms.core.client.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 短信发送 Response DTO
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SmsSendRespDTO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 短信 API 发送返回的序号
|
||||||
|
*/
|
||||||
|
private String serialNo;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,33 @@
|
|||||||
|
package cn.iocoder.dashboard.framework.sms.core.client.dto;
|
||||||
|
|
||||||
|
import cn.iocoder.dashboard.framework.sms.core.enums.SmsTemplateAuditStatusEnum;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 短信模板 Response DTO
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SmsTemplateRespDTO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模板编号
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
/**
|
||||||
|
* 短信内容
|
||||||
|
*/
|
||||||
|
private String content;
|
||||||
|
/**
|
||||||
|
* 审核状态
|
||||||
|
*
|
||||||
|
* 枚举 {@link SmsTemplateAuditStatusEnum}
|
||||||
|
*/
|
||||||
|
private Integer auditStatus;
|
||||||
|
/**
|
||||||
|
* 审核未通过的理由
|
||||||
|
*/
|
||||||
|
private String auditReason;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
package cn.iocoder.dashboard.framework.sms.core.client.impl.aliyun;
|
||||||
|
|
||||||
|
import cn.iocoder.dashboard.common.exception.ErrorCode;
|
||||||
|
import cn.iocoder.dashboard.common.exception.enums.GlobalErrorCodeConstants;
|
||||||
|
import cn.iocoder.dashboard.framework.sms.core.client.SmsCodeMapping;
|
||||||
|
|
||||||
|
import static cn.iocoder.dashboard.framework.sms.core.enums.SmsFrameworkErrorCodeConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 阿里云的 SmsCodeMapping 实现类
|
||||||
|
*
|
||||||
|
* 参见 https://help.aliyun.com/document_detail/101346.htm 文档
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
public class AliyunSmsCodeMapping implements SmsCodeMapping {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ErrorCode apply(String apiCode) {
|
||||||
|
switch (apiCode) {
|
||||||
|
case "OK": return GlobalErrorCodeConstants.SUCCESS;
|
||||||
|
case "isv.ACCOUNT_NOT_EXISTS":
|
||||||
|
case "isv.ACCOUNT_ABNORMAL":
|
||||||
|
case "MissingAccessKeyId": return SMS_ACCOUNT_INVALID;
|
||||||
|
case "isp.RAM_PERMISSION_DENY": return SMS_PERMISSION_DENY;
|
||||||
|
case "isv.INVALID_JSON_PARAM":
|
||||||
|
case "isv.INVALID_PARAMETERS": return SMS_API_PARAM_ERROR;
|
||||||
|
case "isv.BUSINESS_LIMIT_CONTROL": return SMS_SEND_BUSINESS_LIMIT_CONTROL;
|
||||||
|
case "isv.DAY_LIMIT_CONTROL": return SMS_SEND_DAY_LIMIT_CONTROL;
|
||||||
|
case "isv.SMS_CONTENT_ILLEGAL": return SMS_SEND_CONTENT_INVALID;
|
||||||
|
case "isv.SMS_TEMPLATE_ILLEGAL": return SMS_TEMPLATE_INVALID;
|
||||||
|
case "isv.SMS_SIGNATURE_ILLEGAL":
|
||||||
|
case "isv.SIGN_NAME_ILLEGAL":
|
||||||
|
case "isv.SMS_SIGN_ILLEGAL": return SMS_SIGN_INVALID;
|
||||||
|
case "isv.AMOUNT_NOT_ENOUGH":
|
||||||
|
case "isv.OUT_OF_SERVICE": return SMS_ACCOUNT_MONEY_NOT_ENOUGH;
|
||||||
|
case "isv.MOBILE_NUMBER_ILLEGAL": return SMS_MOBILE_INVALID;
|
||||||
|
case "isv.TEMPLATE_MISSING_PARAMETERS": return SMS_TEMPLATE_PARAM_ERROR;
|
||||||
|
}
|
||||||
|
return SMS_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
package cn.iocoder.dashboard.framework.sms.core.client.impl.debug;
|
||||||
|
|
||||||
|
import cn.iocoder.dashboard.common.exception.ErrorCode;
|
||||||
|
import cn.iocoder.dashboard.common.exception.enums.GlobalErrorCodeConstants;
|
||||||
|
import cn.iocoder.dashboard.framework.sms.core.client.SmsCodeMapping;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import static cn.iocoder.dashboard.framework.sms.core.enums.SmsFrameworkErrorCodeConstants.SMS_UNKNOWN;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 钉钉的 SmsCodeMapping 实现类
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
public class DebugDingTalkCodeMapping implements SmsCodeMapping {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ErrorCode apply(String apiCode) {
|
||||||
|
return Objects.equals(apiCode, "0") ? GlobalErrorCodeConstants.SUCCESS : SMS_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,45 @@
|
|||||||
|
package cn.iocoder.dashboard.framework.sms.core.client.impl.yunpian;
|
||||||
|
|
||||||
|
import cn.iocoder.dashboard.common.exception.ErrorCode;
|
||||||
|
import cn.iocoder.dashboard.framework.sms.core.client.SmsCodeMapping;
|
||||||
|
|
||||||
|
import static cn.iocoder.dashboard.common.exception.enums.GlobalErrorCodeConstants.SUCCESS;
|
||||||
|
import static cn.iocoder.dashboard.framework.sms.core.enums.SmsFrameworkErrorCodeConstants.*;
|
||||||
|
import static com.yunpian.sdk.constant.Code.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 云片的 SmsCodeMapping 实现类
|
||||||
|
*
|
||||||
|
* 参见 https://www.yunpian.com/official/document/sms/zh_CN/returnvalue_common 文档
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
public class YunpianSmsCodeMapping implements SmsCodeMapping {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ErrorCode apply(String apiCode) {
|
||||||
|
int code = Integer.parseInt(apiCode);
|
||||||
|
switch (code) {
|
||||||
|
case OK: return SUCCESS;
|
||||||
|
case ARGUMENT_MISSING: return SMS_API_PARAM_ERROR;
|
||||||
|
case BAD_ARGUMENT_FORMAT: return SMS_TEMPLATE_PARAM_ERROR;
|
||||||
|
case TPL_NOT_FOUND:
|
||||||
|
case TPL_NOT_VALID: return SMS_TEMPLATE_INVALID;
|
||||||
|
case MONEY_NOT_ENOUGH: return SMS_ACCOUNT_MONEY_NOT_ENOUGH;
|
||||||
|
case BLACK_WORD: return SMS_SEND_CONTENT_INVALID;
|
||||||
|
case DUP_IN_SHORT_TIME:
|
||||||
|
case TOO_MANY_TIME_IN_5:
|
||||||
|
case DAY_LIMIT_PER_MOBILE:
|
||||||
|
case HOUR_LIMIT_PER_MOBILE: return SMS_SEND_BUSINESS_LIMIT_CONTROL;
|
||||||
|
case BLACK_PHONE_FILTER: return SMS_MOBILE_BLACK;
|
||||||
|
case SIGN_NOT_MATCH:
|
||||||
|
case BAD_SIGN_FORMAT:
|
||||||
|
case SIGN_NOT_VALID: return SMS_SIGN_INVALID;
|
||||||
|
case BAD_API_KEY: return SMS_ACCOUNT_INVALID;
|
||||||
|
case API_NOT_ALLOWED: return SMS_PERMISSION_DENY;
|
||||||
|
case IP_NOT_ALLOWED: return SMS_IP_DENY;
|
||||||
|
}
|
||||||
|
return SMS_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
package cn.iocoder.dashboard.framework.sms.core.enums;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 短信渠道枚举
|
||||||
|
*
|
||||||
|
* @author zzf
|
||||||
|
* @date 2021/1/25 10:56
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum SmsChannelEnum {
|
||||||
|
|
||||||
|
DEBUG_DING_TALK("DEBUG_DING_TALK", "调试(钉钉)"),
|
||||||
|
YUN_PIAN("YUN_PIAN", "云片"),
|
||||||
|
ALIYUN("ALIYUN", "阿里云"),
|
||||||
|
// TENCENT("TENCENT", "腾讯云"),
|
||||||
|
// HUA_WEI("HUA_WEI", "华为云"),
|
||||||
|
;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编码
|
||||||
|
*/
|
||||||
|
private final String code;
|
||||||
|
/**
|
||||||
|
* 名字
|
||||||
|
*/
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
public static SmsChannelEnum getByCode(String code) {
|
||||||
|
return ArrayUtil.firstMatch(o -> o.getCode().equals(code), values());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
package cn.iocoder.dashboard.framework.sms.core.enums;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 短信模板的审核状态枚举
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Getter
|
||||||
|
public enum SmsTemplateAuditStatusEnum {
|
||||||
|
|
||||||
|
CHECKING(1),
|
||||||
|
SUCCESS(2),
|
||||||
|
FAIL(3);
|
||||||
|
|
||||||
|
private final Integer status;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,52 @@
|
|||||||
|
package cn.iocoder.dashboard.framework.sms.core.property;
|
||||||
|
|
||||||
|
import cn.iocoder.dashboard.framework.sms.core.enums.SmsChannelEnum;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 短信渠道配置类
|
||||||
|
*
|
||||||
|
* @author zzf
|
||||||
|
* @date 2021/1/25 17:01
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Validated
|
||||||
|
public class SmsChannelProperties {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 渠道编号
|
||||||
|
*/
|
||||||
|
@NotNull(message = "短信渠道 ID 不能为空")
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 短信签名
|
||||||
|
*/
|
||||||
|
@NotEmpty(message = "短信签名不能为空")
|
||||||
|
private String signature;
|
||||||
|
/**
|
||||||
|
* 渠道编码
|
||||||
|
*
|
||||||
|
* 枚举 {@link SmsChannelEnum}
|
||||||
|
*/
|
||||||
|
@NotEmpty(message = "渠道编码不能为空")
|
||||||
|
private String code;
|
||||||
|
/**
|
||||||
|
* 短信 API 的账号
|
||||||
|
*/
|
||||||
|
@NotEmpty(message = "短信 API 的账号不能为空")
|
||||||
|
private String apiKey;
|
||||||
|
/**
|
||||||
|
* 短信 API 的秘钥
|
||||||
|
*/
|
||||||
|
@NotEmpty(message = "短信 API 的秘钥不能为空")
|
||||||
|
private String apiSecret;
|
||||||
|
/**
|
||||||
|
* 短信发送回调 URL
|
||||||
|
*/
|
||||||
|
private String callbackUrl;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,49 @@
|
|||||||
|
package cn.iocoder.dashboard.modules.system.controller.sms;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.URLUtil;
|
||||||
|
import cn.hutool.extra.servlet.ServletUtil;
|
||||||
|
import cn.iocoder.dashboard.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.dashboard.framework.logger.operatelog.core.annotations.OperateLog;
|
||||||
|
import cn.iocoder.dashboard.framework.sms.core.enums.SmsChannelEnum;
|
||||||
|
import cn.iocoder.dashboard.modules.system.service.sms.SysSmsService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
import static cn.iocoder.dashboard.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
@Api(tags = "短信回调")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/sms/callback")
|
||||||
|
public class SmsCallbackController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SysSmsService smsService;
|
||||||
|
|
||||||
|
@PostMapping("/sms/yunpian")
|
||||||
|
@ApiOperation(value = "云片短信的回调", notes = "参见 https://www.yunpian.com/official/document/sms/zh_cn/domestic_push_report 文档")
|
||||||
|
@ApiImplicitParam(name = "sms_status", value = "发送状态", required = true, example = "[{具体内容}]", dataTypeClass = Long.class)
|
||||||
|
@OperateLog(enable = false)
|
||||||
|
public String receiveYunpianSmsStatus(@RequestParam("sms_status") String smsStatus) throws Throwable {
|
||||||
|
String text = URLUtil.decode(smsStatus); // decode 解码参数,因为它被 encode
|
||||||
|
smsService.receiveSmsStatus(SmsChannelEnum.YUN_PIAN.getCode(), text);
|
||||||
|
return "SUCCESS"; // 约定返回 SUCCESS 为成功
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/sms/aliyun")
|
||||||
|
@ApiOperation(value = "阿里云短信的回调", notes = "参见 https://help.aliyun.com/document_detail/120998.html 文档")
|
||||||
|
@OperateLog(enable = false)
|
||||||
|
public CommonResult<Boolean> receiveAliyunSmsStatus(HttpServletRequest request) throws Throwable {
|
||||||
|
String text = ServletUtil.getBody(request);
|
||||||
|
smsService.receiveSmsStatus(SmsChannelEnum.ALIYUN.getCode(), text);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,80 @@
|
|||||||
|
package cn.iocoder.dashboard.modules.system.controller.sms;
|
||||||
|
|
||||||
|
import cn.iocoder.dashboard.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.dashboard.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.dashboard.modules.system.controller.sms.vo.channel.*;
|
||||||
|
import cn.iocoder.dashboard.modules.system.convert.sms.SysSmsChannelConvert;
|
||||||
|
import cn.iocoder.dashboard.modules.system.dal.dataobject.sms.SysSmsChannelDO;
|
||||||
|
import cn.iocoder.dashboard.modules.system.service.sms.SysSmsChannelService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.dashboard.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
@Api(tags = "短信渠道")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("system/sms-channel")
|
||||||
|
public class SysSmsChannelController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SysSmsChannelService smsChannelService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@ApiOperation("创建短信渠道")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:sms-channel:create')")
|
||||||
|
public CommonResult<Long> createSmsChannel(@Valid @RequestBody SysSmsChannelCreateReqVO createReqVO) {
|
||||||
|
return success(smsChannelService.createSmsChannel(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@ApiOperation("更新短信渠道")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:sms-channel:update')")
|
||||||
|
public CommonResult<Boolean> updateSmsChannel(@Valid @RequestBody SysSmsChannelUpdateReqVO updateReqVO) {
|
||||||
|
smsChannelService.updateSmsChannel(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@ApiOperation("删除短信渠道")
|
||||||
|
@ApiImplicitParam(name = "id", value = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:sms-channel:delete')")
|
||||||
|
public CommonResult<Boolean> deleteSmsChannel(@RequestParam("id") Long id) {
|
||||||
|
smsChannelService.deleteSmsChannel(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@ApiOperation("获得短信渠道")
|
||||||
|
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:sms-channel:query')")
|
||||||
|
public CommonResult<SysSmsChannelRespVO> getSmsChannel(@RequestParam("id") Long id) {
|
||||||
|
SysSmsChannelDO smsChannel = smsChannelService.getSmsChannel(id);
|
||||||
|
return success(SysSmsChannelConvert.INSTANCE.convert(smsChannel));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@ApiOperation("获得短信渠道分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:sms-channel:query')")
|
||||||
|
public CommonResult<PageResult<SysSmsChannelRespVO>> getSmsChannelPage(@Valid SysSmsChannelPageReqVO pageVO) {
|
||||||
|
PageResult<SysSmsChannelDO> pageResult = smsChannelService.getSmsChannelPage(pageVO);
|
||||||
|
return success(SysSmsChannelConvert.INSTANCE.convertPage(pageResult));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/list-all-simple")
|
||||||
|
@ApiOperation(value = "获得短信渠道精简列表", notes = "包含被禁用的短信渠道")
|
||||||
|
public CommonResult<List<SysSmsChannelSimpleRespVO>> getSimpleSmsChannels() {
|
||||||
|
List<SysSmsChannelDO> list = smsChannelService.getSmsChannelList();
|
||||||
|
// 排序后,返回给前端
|
||||||
|
list.sort(Comparator.comparing(SysSmsChannelDO::getId));
|
||||||
|
return success(SysSmsChannelConvert.INSTANCE.convertList03(list));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,60 @@
|
|||||||
|
package cn.iocoder.dashboard.modules.system.controller.sms;
|
||||||
|
|
||||||
|
import cn.iocoder.dashboard.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.dashboard.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.dashboard.framework.excel.core.util.ExcelUtils;
|
||||||
|
import cn.iocoder.dashboard.framework.logger.operatelog.core.annotations.OperateLog;
|
||||||
|
import cn.iocoder.dashboard.modules.system.controller.sms.vo.log.SysSmsLogExcelVO;
|
||||||
|
import cn.iocoder.dashboard.modules.system.controller.sms.vo.log.SysSmsLogExportReqVO;
|
||||||
|
import cn.iocoder.dashboard.modules.system.controller.sms.vo.log.SysSmsLogPageReqVO;
|
||||||
|
import cn.iocoder.dashboard.modules.system.controller.sms.vo.log.SysSmsLogRespVO;
|
||||||
|
import cn.iocoder.dashboard.modules.system.convert.sms.SysSmsLogConvert;
|
||||||
|
import cn.iocoder.dashboard.modules.system.dal.dataobject.sms.SysSmsLogDO;
|
||||||
|
import cn.iocoder.dashboard.modules.system.service.sms.SysSmsLogService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.dashboard.common.pojo.CommonResult.success;
|
||||||
|
import static cn.iocoder.dashboard.framework.logger.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||||
|
|
||||||
|
@Api(tags = "短信日志")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/sms-log")
|
||||||
|
@Validated
|
||||||
|
public class SysSmsLogController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SysSmsLogService smsLogService;
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@ApiOperation("获得短信日志分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:sms-log:query')")
|
||||||
|
public CommonResult<PageResult<SysSmsLogRespVO>> getSmsLogPage(@Valid SysSmsLogPageReqVO pageVO) {
|
||||||
|
PageResult<SysSmsLogDO> pageResult = smsLogService.getSmsLogPage(pageVO);
|
||||||
|
return success(SysSmsLogConvert.INSTANCE.convertPage(pageResult));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@ApiOperation("导出短信日志 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:sms-log:export')")
|
||||||
|
@OperateLog(type = EXPORT)
|
||||||
|
public void exportSmsLogExcel(@Valid SysSmsLogExportReqVO exportReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
List<SysSmsLogDO> list = smsLogService.getSmsLogList(exportReqVO);
|
||||||
|
// 导出 Excel
|
||||||
|
List<SysSmsLogExcelVO> datas = SysSmsLogConvert.INSTANCE.convertList02(list);
|
||||||
|
ExcelUtils.write(response, "短信日志.xls", "数据", SysSmsLogExcelVO.class, datas);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
### 请求 /menu/list 接口 => 成功
|
||||||
|
POST {{baseUrl}}/system/sms-template/send-sms
|
||||||
|
Authorization: Bearer {{token}}
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
{
|
||||||
|
"code": "test_01",
|
||||||
|
"params": {
|
||||||
|
"key01": "value01",
|
||||||
|
"key02": "value02"
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,98 @@
|
|||||||
|
package cn.iocoder.dashboard.modules.system.controller.sms;
|
||||||
|
|
||||||
|
import cn.iocoder.dashboard.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.dashboard.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.dashboard.framework.excel.core.util.ExcelUtils;
|
||||||
|
import cn.iocoder.dashboard.framework.logger.operatelog.core.annotations.OperateLog;
|
||||||
|
import cn.iocoder.dashboard.modules.system.controller.sms.vo.template.*;
|
||||||
|
import cn.iocoder.dashboard.modules.system.convert.sms.SysSmsTemplateConvert;
|
||||||
|
import cn.iocoder.dashboard.modules.system.dal.dataobject.sms.SysSmsTemplateDO;
|
||||||
|
import cn.iocoder.dashboard.modules.system.service.sms.SysSmsService;
|
||||||
|
import cn.iocoder.dashboard.modules.system.service.sms.SysSmsTemplateService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.dashboard.common.pojo.CommonResult.success;
|
||||||
|
import static cn.iocoder.dashboard.framework.logger.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||||
|
|
||||||
|
@Api("短信模板")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/sms-template")
|
||||||
|
public class SysSmsTemplateController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SysSmsTemplateService smsTemplateService;
|
||||||
|
@Resource
|
||||||
|
private SysSmsService smsService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@ApiOperation("创建短信模板")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:sms-template:create')")
|
||||||
|
public CommonResult<Long> createSmsTemplate(@Valid @RequestBody SysSmsTemplateCreateReqVO createReqVO) {
|
||||||
|
return success(smsTemplateService.createSmsTemplate(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@ApiOperation("更新短信模板")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:sms-template:update')")
|
||||||
|
public CommonResult<Boolean> updateSmsTemplate(@Valid @RequestBody SysSmsTemplateUpdateReqVO updateReqVO) {
|
||||||
|
smsTemplateService.updateSmsTemplate(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@ApiOperation("删除短信模板")
|
||||||
|
@ApiImplicitParam(name = "id", value = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:sms-template:delete')")
|
||||||
|
public CommonResult<Boolean> deleteSmsTemplate(@RequestParam("id") Long id) {
|
||||||
|
smsTemplateService.deleteSmsTemplate(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@ApiOperation("获得短信模板")
|
||||||
|
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:sms-template:query')")
|
||||||
|
public CommonResult<SysSmsTemplateRespVO> getSmsTemplate(@RequestParam("id") Long id) {
|
||||||
|
SysSmsTemplateDO smsTemplate = smsTemplateService.getSmsTemplate(id);
|
||||||
|
return success(SysSmsTemplateConvert.INSTANCE.convert(smsTemplate));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@ApiOperation("获得短信模板分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:sms-template:query')")
|
||||||
|
public CommonResult<PageResult<SysSmsTemplateRespVO>> getSmsTemplatePage(@Valid SysSmsTemplatePageReqVO pageVO) {
|
||||||
|
PageResult<SysSmsTemplateDO> pageResult = smsTemplateService.getSmsTemplatePage(pageVO);
|
||||||
|
return success(SysSmsTemplateConvert.INSTANCE.convertPage(pageResult));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@ApiOperation("导出短信模板 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:sms-template:export')")
|
||||||
|
@OperateLog(type = EXPORT)
|
||||||
|
public void exportSmsTemplateExcel(@Valid SysSmsTemplateExportReqVO exportReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
List<SysSmsTemplateDO> list = smsTemplateService.getSmsTemplateList(exportReqVO);
|
||||||
|
// 导出 Excel
|
||||||
|
List<SysSmsTemplateExcelVO> datas = SysSmsTemplateConvert.INSTANCE.convertList02(list);
|
||||||
|
ExcelUtils.write(response, "短信模板.xls", "数据", SysSmsTemplateExcelVO.class, datas);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/send-sms")
|
||||||
|
@ApiOperation("发送短信")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:sms-template:send-sms')")
|
||||||
|
public CommonResult<Long> sendSms(@Valid @RequestBody SysSmsTemplateSendReqVO sendReqVO) {
|
||||||
|
return success(smsService.sendSingleSms(sendReqVO.getMobile(), null, null,
|
||||||
|
sendReqVO.getTemplateCode(), sendReqVO.getTemplateParams()));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
package cn.iocoder.dashboard.modules.system.controller.sms.vo.channel;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
@ApiModel("短信渠道创建 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class SysSmsChannelCreateReqVO extends SysSmsChannelBaseVO {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "渠道编码", required = true, example = "YUN_PIAN", notes = "参见 SmsChannelEnum 枚举类")
|
||||||
|
@NotNull(message = "渠道编码不能为空")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,35 @@
|
|||||||
|
package cn.iocoder.dashboard.modules.system.controller.sms.vo.channel;
|
||||||
|
|
||||||
|
import cn.iocoder.dashboard.common.pojo.PageParam;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import static cn.iocoder.dashboard.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@ApiModel("短信渠道分页 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class SysSmsChannelPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "任务状态", example = "1")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "短信签名", example = "芋道源码", notes = "模糊匹配")
|
||||||
|
private String signature;
|
||||||
|
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
@ApiModelProperty(value = "开始创建时间")
|
||||||
|
private Date beginCreateTime;
|
||||||
|
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
@ApiModelProperty(value = "结束创建时间")
|
||||||
|
private Date endCreateTime;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
package cn.iocoder.dashboard.modules.system.controller.sms.vo.channel;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@ApiModel("短信渠道 Response VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class SysSmsChannelRespVO extends SysSmsChannelBaseVO {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "编号", required = true, example = "1024")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "渠道编码", required = true, example = "YUN_PIAN", notes = "参见 SmsChannelEnum 枚举类")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "创建时间", required = true)
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
package cn.iocoder.dashboard.modules.system.controller.sms.vo.channel;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
@ApiModel("短信渠道精简 Response VO")
|
||||||
|
@Data
|
||||||
|
public class SysSmsChannelSimpleRespVO {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "编号", required = true, example = "1024")
|
||||||
|
@NotNull(message = "编号不能为空")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "短信签名", required = true, example = "芋道源码")
|
||||||
|
@NotNull(message = "短信签名不能为空")
|
||||||
|
private String signature;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "渠道编码", required = true, example = "YUN_PIAN", notes = "参见 SmsChannelEnum 枚举类")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
package cn.iocoder.dashboard.modules.system.controller.sms.vo.channel;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
@ApiModel("短信渠道更新 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class SysSmsChannelUpdateReqVO extends SysSmsChannelBaseVO {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "编号", required = true, example = "1024")
|
||||||
|
@NotNull(message = "编号不能为空")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,101 @@
|
|||||||
|
package cn.iocoder.dashboard.modules.system.controller.sms.vo.log;
|
||||||
|
|
||||||
|
import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat;
|
||||||
|
import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert;
|
||||||
|
import cn.iocoder.dashboard.framework.excel.core.convert.JsonConvert;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 短信日志 Excel VO
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SysSmsLogExcelVO {
|
||||||
|
|
||||||
|
@ExcelProperty("编号")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@ExcelProperty("短信渠道编号")
|
||||||
|
private Long channelId;
|
||||||
|
|
||||||
|
@ExcelProperty("短信渠道编码")
|
||||||
|
private String channelCode;
|
||||||
|
|
||||||
|
@ExcelProperty("模板编号")
|
||||||
|
private Long templateId;
|
||||||
|
|
||||||
|
@ExcelProperty("模板编码")
|
||||||
|
private String templateCode;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "短信类型", converter = DictConvert.class)
|
||||||
|
@DictFormat(SYS_SMS_TEMPLATE_TYPE)
|
||||||
|
private Integer templateType;
|
||||||
|
|
||||||
|
@ExcelProperty("短信内容")
|
||||||
|
private String templateContent;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "短信参数", converter = JsonConvert.class)
|
||||||
|
private Map<String, Object> templateParams;
|
||||||
|
|
||||||
|
@ExcelProperty("短信 API 的模板编号")
|
||||||
|
private String apiTemplateId;
|
||||||
|
|
||||||
|
@ExcelProperty("手机号")
|
||||||
|
private String mobile;
|
||||||
|
|
||||||
|
@ExcelProperty("用户编号")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "用户类型", converter = DictConvert.class)
|
||||||
|
@DictFormat(USER_TYPE)
|
||||||
|
private Integer userType;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "发送状态", converter = DictConvert.class)
|
||||||
|
@DictFormat(SYS_SMS_SEND_STATUS)
|
||||||
|
private Integer sendStatus;
|
||||||
|
|
||||||
|
@ExcelProperty("发送时间")
|
||||||
|
private Date sendTime;
|
||||||
|
|
||||||
|
@ExcelProperty("发送结果的编码")
|
||||||
|
private Integer sendCode;
|
||||||
|
|
||||||
|
@ExcelProperty("发送结果的提示")
|
||||||
|
private String sendMsg;
|
||||||
|
|
||||||
|
@ExcelProperty("短信 API 发送结果的编码")
|
||||||
|
private String apiSendCode;
|
||||||
|
|
||||||
|
@ExcelProperty("短信 API 发送失败的提示")
|
||||||
|
private String apiSendMsg;
|
||||||
|
|
||||||
|
@ExcelProperty("短信 API 发送返回的唯一请求 ID")
|
||||||
|
private String apiRequestId;
|
||||||
|
|
||||||
|
@ExcelProperty("短信 API 发送返回的序号")
|
||||||
|
private String apiSerialNo;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "接收状态", converter = DictConvert.class)
|
||||||
|
@DictFormat(SYS_SMS_RECEIVE_STATUS)
|
||||||
|
private Integer receiveStatus;
|
||||||
|
|
||||||
|
@ExcelProperty("接收时间")
|
||||||
|
private Date receiveTime;
|
||||||
|
|
||||||
|
@ExcelProperty("API 接收结果的编码")
|
||||||
|
private String apiReceiveCode;
|
||||||
|
|
||||||
|
@ExcelProperty("API 接收结果的说明")
|
||||||
|
private String apiReceiveMsg;
|
||||||
|
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,47 @@
|
|||||||
|
package cn.iocoder.dashboard.modules.system.controller.sms.vo.log;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import static cn.iocoder.dashboard.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@ApiModel(value = "短信日志 Excel 导出 Request VO", description = "参数和 SysSmsLogPageReqVO 是一致的")
|
||||||
|
@Data
|
||||||
|
public class SysSmsLogExportReqVO {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "短信渠道编号", example = "10")
|
||||||
|
private Long channelId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "模板编号", example = "20")
|
||||||
|
private Long templateId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "手机号", example = "15601691300")
|
||||||
|
private String mobile;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "发送状态", example = "1")
|
||||||
|
private Integer sendStatus;
|
||||||
|
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
@ApiModelProperty(value = "开始发送时间")
|
||||||
|
private Date beginSendTime;
|
||||||
|
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
@ApiModelProperty(value = "结束发送时间")
|
||||||
|
private Date endSendTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "接收状态", example = "0")
|
||||||
|
private Integer receiveStatus;
|
||||||
|
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
@ApiModelProperty(value = "开始接收时间")
|
||||||
|
private Date beginReceiveTime;
|
||||||
|
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
@ApiModelProperty(value = "结束接收时间")
|
||||||
|
private Date endReceiveTime;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,52 @@
|
|||||||
|
package cn.iocoder.dashboard.modules.system.controller.sms.vo.log;
|
||||||
|
|
||||||
|
import cn.iocoder.dashboard.common.pojo.PageParam;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import static cn.iocoder.dashboard.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@ApiModel("短信日志分页 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class SysSmsLogPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "短信渠道编号", example = "10")
|
||||||
|
private Long channelId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "模板编号", example = "20")
|
||||||
|
private Long templateId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "手机号", example = "15601691300")
|
||||||
|
private String mobile;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "发送状态", example = "1", notes = "参见 SysSmsSendStatusEnum 枚举类")
|
||||||
|
private Integer sendStatus;
|
||||||
|
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
@ApiModelProperty(value = "开始发送时间")
|
||||||
|
private Date beginSendTime;
|
||||||
|
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
@ApiModelProperty(value = "结束发送时间")
|
||||||
|
private Date endSendTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "接收状态", example = "0", notes = "参见 SysSmsReceiveStatusEnum 枚举类")
|
||||||
|
private Integer receiveStatus;
|
||||||
|
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
@ApiModelProperty(value = "开始接收时间")
|
||||||
|
private Date beginReceiveTime;
|
||||||
|
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
@ApiModelProperty(value = "结束接收时间")
|
||||||
|
private Date endReceiveTime;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,89 @@
|
|||||||
|
package cn.iocoder.dashboard.modules.system.controller.sms.vo.log;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ApiModel("短信日志 Response VO")
|
||||||
|
@Data
|
||||||
|
public class SysSmsLogRespVO {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "编号", required = true, example = "1024")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "短信渠道编号", required = true, example = "10")
|
||||||
|
private Long channelId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "短信渠道编码", required = true, example = "ALIYUN")
|
||||||
|
private String channelCode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "模板编号", required = true, example = "20")
|
||||||
|
private Long templateId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "模板编码", required = true, example = "test-01")
|
||||||
|
private String templateCode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "短信类型", required = true, example = "1")
|
||||||
|
private Integer templateType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "短信内容", required = true, example = "你好,你的验证码是 1024")
|
||||||
|
private String templateContent;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "短信参数", required = true, example = "name,code")
|
||||||
|
private Map<String, Object> templateParams;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "短信 API 的模板编号", required = true, example = "SMS_207945135")
|
||||||
|
private String apiTemplateId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "手机号", required = true, example = "15601691300")
|
||||||
|
private String mobile;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "用户编号", example = "10")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "用户类型", example = "1")
|
||||||
|
private Integer userType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "发送状态", required = true, example = "1")
|
||||||
|
private Integer sendStatus;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "发送时间")
|
||||||
|
private Date sendTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "发送结果的编码", example = "0")
|
||||||
|
private Integer sendCode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "发送结果的提示", example = "成功")
|
||||||
|
private String sendMsg;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "短信 API 发送结果的编码", example = "SUCCESS")
|
||||||
|
private String apiSendCode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "短信 API 发送失败的提示", example = "成功")
|
||||||
|
private String apiSendMsg;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "短信 API 发送返回的唯一请求 ID", example = "3837C6D3-B96F-428C-BBB2-86135D4B5B99")
|
||||||
|
private String apiRequestId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "短信 API 发送返回的序号", example = "62923244790")
|
||||||
|
private String apiSerialNo;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "接收状态", required = true, example = "0")
|
||||||
|
private Integer receiveStatus;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "接收时间")
|
||||||
|
private Date receiveTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "API 接收结果的编码", example = "DELIVRD")
|
||||||
|
private String apiReceiveCode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "API 接收结果的说明", example = "用户接收成功")
|
||||||
|
private String apiReceiveMsg;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "创建时间", required = true)
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
package cn.iocoder.dashboard.modules.system.controller.sms.vo.template;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@ApiModel("短信模板创建 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class SysSmsTemplateCreateReqVO extends SysSmsTemplateBaseVO {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,56 @@
|
|||||||
|
package cn.iocoder.dashboard.modules.system.controller.sms.vo.template;
|
||||||
|
|
||||||
|
import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat;
|
||||||
|
import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import static cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 短信模板 Excel VO
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SysSmsTemplateExcelVO {
|
||||||
|
|
||||||
|
@ExcelProperty("编号")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "短信签名", converter = DictConvert.class)
|
||||||
|
@DictFormat(SYS_SMS_TEMPLATE_TYPE)
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "开启状态", converter = DictConvert.class)
|
||||||
|
@DictFormat(SYS_COMMON_STATUS)
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@ExcelProperty("模板编码")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
@ExcelProperty("模板名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ExcelProperty("模板内容")
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
@ExcelProperty("备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@ExcelProperty("短信 API 的模板编号")
|
||||||
|
private String apiTemplateId;
|
||||||
|
|
||||||
|
@ExcelProperty("短信渠道编号")
|
||||||
|
private Long channelId;
|
||||||
|
|
||||||
|
@ExcelProperty(value = "短信渠道编码", converter = DictConvert.class)
|
||||||
|
@DictFormat(SYS_SMS_CHANNEL_CODE)
|
||||||
|
private String channelCode;
|
||||||
|
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,42 @@
|
|||||||
|
package cn.iocoder.dashboard.modules.system.controller.sms.vo.template;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import static cn.iocoder.dashboard.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@ApiModel(value = "短信模板 Excel 导出 Request VO", description = "参数和 SysSmsTemplatePageReqVO 是一致的")
|
||||||
|
@Data
|
||||||
|
public class SysSmsTemplateExportReqVO {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "短信签名", example = "1")
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "开启状态", example = "1")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "模板编码", example = "test_01", notes = "模糊匹配")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "模板内容", example = "你好,{name}。你长的太{like}啦!", notes = "模糊匹配")
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "短信 API 的模板编号", example = "4383920", notes = "模糊匹配")
|
||||||
|
private String apiTemplateId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "短信渠道编号", example = "10")
|
||||||
|
private Long channelId;
|
||||||
|
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
@ApiModelProperty(value = "开始创建时间")
|
||||||
|
private Date beginCreateTime;
|
||||||
|
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
@ApiModelProperty(value = "结束创建时间")
|
||||||
|
private Date endCreateTime;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,47 @@
|
|||||||
|
package cn.iocoder.dashboard.modules.system.controller.sms.vo.template;
|
||||||
|
|
||||||
|
import cn.iocoder.dashboard.common.pojo.PageParam;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import static cn.iocoder.dashboard.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@ApiModel("短信模板分页 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class SysSmsTemplatePageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "短信签名", example = "1")
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "开启状态", example = "1")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "模板编码", example = "test_01", notes = "模糊匹配")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "模板内容", example = "你好,{name}。你长的太{like}啦!", notes = "模糊匹配")
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "短信 API 的模板编号", example = "4383920", notes = "模糊匹配")
|
||||||
|
private String apiTemplateId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "短信渠道编号", example = "10")
|
||||||
|
private Long channelId;
|
||||||
|
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
@ApiModelProperty(value = "开始创建时间")
|
||||||
|
private Date beginCreateTime;
|
||||||
|
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
@ApiModelProperty(value = "结束创建时间")
|
||||||
|
private Date endCreateTime;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
package cn.iocoder.dashboard.modules.system.controller.sms.vo.template;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@ApiModel("短信模板 Response VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class SysSmsTemplateRespVO extends SysSmsTemplateBaseVO {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "编号", required = true, example = "1024")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "短信渠道编码", required = true, example = "ALIYUN")
|
||||||
|
private String channelCode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "参数数组", example = "name,code")
|
||||||
|
private List<String> params;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "创建时间", required = true)
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
package cn.iocoder.dashboard.modules.system.controller.sms.vo.template;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ApiModel("短信模板的发送 Request VO")
|
||||||
|
@Data
|
||||||
|
public class SysSmsTemplateSendReqVO {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "手机号", required = true, example = "15601691300")
|
||||||
|
@NotNull(message = "手机号不能为空")
|
||||||
|
private String mobile;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "模板编码", required = true, example = "test_01")
|
||||||
|
@NotNull(message = "模板编码不能为空")
|
||||||
|
private String templateCode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "模板参数")
|
||||||
|
private Map<String, Object> templateParams;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
package cn.iocoder.dashboard.modules.system.controller.sms.vo.template;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
@ApiModel("短信模板更新 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class SysSmsTemplateUpdateReqVO extends SysSmsTemplateBaseVO {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "编号", required = true, example = "1024")
|
||||||
|
@NotNull(message = "编号不能为空")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,39 @@
|
|||||||
|
package cn.iocoder.dashboard.modules.system.convert.sms;
|
||||||
|
|
||||||
|
import cn.iocoder.dashboard.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.dashboard.framework.sms.core.property.SmsChannelProperties;
|
||||||
|
import cn.iocoder.dashboard.modules.system.controller.sms.vo.channel.SysSmsChannelCreateReqVO;
|
||||||
|
import cn.iocoder.dashboard.modules.system.controller.sms.vo.channel.SysSmsChannelRespVO;
|
||||||
|
import cn.iocoder.dashboard.modules.system.controller.sms.vo.channel.SysSmsChannelSimpleRespVO;
|
||||||
|
import cn.iocoder.dashboard.modules.system.controller.sms.vo.channel.SysSmsChannelUpdateReqVO;
|
||||||
|
import cn.iocoder.dashboard.modules.system.dal.dataobject.sms.SysSmsChannelDO;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 短信渠道 Convert
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface SysSmsChannelConvert {
|
||||||
|
|
||||||
|
SysSmsChannelConvert INSTANCE = Mappers.getMapper(SysSmsChannelConvert.class);
|
||||||
|
|
||||||
|
SysSmsChannelDO convert(SysSmsChannelCreateReqVO bean);
|
||||||
|
|
||||||
|
SysSmsChannelDO convert(SysSmsChannelUpdateReqVO bean);
|
||||||
|
|
||||||
|
SysSmsChannelRespVO convert(SysSmsChannelDO bean);
|
||||||
|
|
||||||
|
List<SysSmsChannelRespVO> convertList(List<SysSmsChannelDO> list);
|
||||||
|
|
||||||
|
PageResult<SysSmsChannelRespVO> convertPage(PageResult<SysSmsChannelDO> page);
|
||||||
|
|
||||||
|
List<SmsChannelProperties> convertList02(List<SysSmsChannelDO> list);
|
||||||
|
|
||||||
|
List<SysSmsChannelSimpleRespVO> convertList03(List<SysSmsChannelDO> list);
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
package cn.iocoder.dashboard.modules.system.convert.sms;
|
||||||
|
|
||||||
|
import cn.iocoder.dashboard.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.dashboard.modules.system.controller.sms.vo.log.SysSmsLogExcelVO;
|
||||||
|
import cn.iocoder.dashboard.modules.system.controller.sms.vo.log.SysSmsLogRespVO;
|
||||||
|
import cn.iocoder.dashboard.modules.system.dal.dataobject.sms.SysSmsLogDO;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 短信日志 Convert
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface SysSmsLogConvert {
|
||||||
|
|
||||||
|
SysSmsLogConvert INSTANCE = Mappers.getMapper(SysSmsLogConvert.class);
|
||||||
|
|
||||||
|
SysSmsLogRespVO convert(SysSmsLogDO bean);
|
||||||
|
|
||||||
|
List<SysSmsLogRespVO> convertList(List<SysSmsLogDO> list);
|
||||||
|
|
||||||
|
PageResult<SysSmsLogRespVO> convertPage(PageResult<SysSmsLogDO> page);
|
||||||
|
|
||||||
|
List<SysSmsLogExcelVO> convertList02(List<SysSmsLogDO> list);
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
package cn.iocoder.dashboard.modules.system.convert.sms;
|
||||||
|
|
||||||
|
import cn.iocoder.dashboard.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.dashboard.modules.system.controller.sms.vo.template.SysSmsTemplateCreateReqVO;
|
||||||
|
import cn.iocoder.dashboard.modules.system.controller.sms.vo.template.SysSmsTemplateExcelVO;
|
||||||
|
import cn.iocoder.dashboard.modules.system.controller.sms.vo.template.SysSmsTemplateRespVO;
|
||||||
|
import cn.iocoder.dashboard.modules.system.controller.sms.vo.template.SysSmsTemplateUpdateReqVO;
|
||||||
|
import cn.iocoder.dashboard.modules.system.dal.dataobject.sms.SysSmsTemplateDO;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface SysSmsTemplateConvert {
|
||||||
|
|
||||||
|
SysSmsTemplateConvert INSTANCE = Mappers.getMapper(SysSmsTemplateConvert.class);
|
||||||
|
|
||||||
|
SysSmsTemplateDO convert(SysSmsTemplateCreateReqVO bean);
|
||||||
|
|
||||||
|
SysSmsTemplateDO convert(SysSmsTemplateUpdateReqVO bean);
|
||||||
|
|
||||||
|
SysSmsTemplateRespVO convert(SysSmsTemplateDO bean);
|
||||||
|
|
||||||
|
List<SysSmsTemplateRespVO> convertList(List<SysSmsTemplateDO> list);
|
||||||
|
|
||||||
|
PageResult<SysSmsTemplateRespVO> convertPage(PageResult<SysSmsTemplateDO> page);
|
||||||
|
|
||||||
|
List<SysSmsTemplateExcelVO> convertList02(List<SysSmsTemplateDO> list);
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,60 @@
|
|||||||
|
package cn.iocoder.dashboard.modules.system.dal.dataobject.sms;
|
||||||
|
|
||||||
|
import cn.iocoder.dashboard.common.enums.CommonStatusEnum;
|
||||||
|
import cn.iocoder.dashboard.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
import cn.iocoder.dashboard.framework.sms.core.enums.SmsChannelEnum;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 短信渠道 DO
|
||||||
|
*
|
||||||
|
* @author zzf
|
||||||
|
* @since 2021-01-25
|
||||||
|
*/
|
||||||
|
@TableName(value = "sys_sms_channel", autoResultMap = true)
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class SysSmsChannelDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 渠道编号
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 短信签名
|
||||||
|
*/
|
||||||
|
private String signature;
|
||||||
|
/**
|
||||||
|
* 渠道编码
|
||||||
|
*
|
||||||
|
* 枚举 {@link SmsChannelEnum}
|
||||||
|
*/
|
||||||
|
private String code;
|
||||||
|
/**
|
||||||
|
* 启用状态
|
||||||
|
*
|
||||||
|
* 枚举 {@link CommonStatusEnum}
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
/**
|
||||||
|
* 短信 API 的账号
|
||||||
|
*/
|
||||||
|
private String apiKey;
|
||||||
|
/**
|
||||||
|
* 短信 API 的秘钥
|
||||||
|
*/
|
||||||
|
private String apiSecret;
|
||||||
|
/**
|
||||||
|
* 短信发送回调 URL
|
||||||
|
*/
|
||||||
|
private String callbackUrl;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
package cn.iocoder.dashboard.modules.system.dal.mysql.sms;
|
||||||
|
|
||||||
|
import cn.iocoder.dashboard.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.dashboard.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import cn.iocoder.dashboard.framework.mybatis.core.query.QueryWrapperX;
|
||||||
|
import cn.iocoder.dashboard.modules.system.controller.sms.vo.channel.SysSmsChannelPageReqVO;
|
||||||
|
import cn.iocoder.dashboard.modules.system.dal.dataobject.sms.SysSmsChannelDO;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface SysSmsChannelMapper extends BaseMapperX<SysSmsChannelDO> {
|
||||||
|
|
||||||
|
default PageResult<SysSmsChannelDO> selectPage(SysSmsChannelPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new QueryWrapperX<SysSmsChannelDO>()
|
||||||
|
.likeIfPresent("signature", reqVO.getSignature())
|
||||||
|
.eqIfPresent("status", reqVO.getStatus())
|
||||||
|
.betweenIfPresent("create_time", reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
|
||||||
|
.orderByDesc("id"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Select("SELECT id FROM sys_sms_channel WHERE update_time > #{maxUpdateTime} LIMIT 1")
|
||||||
|
Long selectExistsByUpdateTimeAfter(Date maxUpdateTime);
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,40 @@
|
|||||||
|
package cn.iocoder.dashboard.modules.system.dal.mysql.sms;
|
||||||
|
|
||||||
|
import cn.iocoder.dashboard.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.dashboard.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import cn.iocoder.dashboard.framework.mybatis.core.query.QueryWrapperX;
|
||||||
|
import cn.iocoder.dashboard.modules.system.controller.sms.vo.log.SysSmsLogExportReqVO;
|
||||||
|
import cn.iocoder.dashboard.modules.system.controller.sms.vo.log.SysSmsLogPageReqVO;
|
||||||
|
import cn.iocoder.dashboard.modules.system.dal.dataobject.sms.SysSmsLogDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface SysSmsLogMapper extends BaseMapperX<SysSmsLogDO> {
|
||||||
|
|
||||||
|
default PageResult<SysSmsLogDO> selectPage(SysSmsLogPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new QueryWrapperX<SysSmsLogDO>()
|
||||||
|
.eqIfPresent("channel_id", reqVO.getChannelId())
|
||||||
|
.eqIfPresent("template_id", reqVO.getTemplateId())
|
||||||
|
.likeIfPresent("mobile", reqVO.getMobile())
|
||||||
|
.eqIfPresent("send_status", reqVO.getSendStatus())
|
||||||
|
.betweenIfPresent("send_time", reqVO.getBeginSendTime(), reqVO.getEndSendTime())
|
||||||
|
.eqIfPresent("receive_status", reqVO.getReceiveStatus())
|
||||||
|
.betweenIfPresent("receive_time", reqVO.getBeginReceiveTime(), reqVO.getEndReceiveTime())
|
||||||
|
.orderByDesc("id"));
|
||||||
|
}
|
||||||
|
|
||||||
|
default List<SysSmsLogDO> selectList(SysSmsLogExportReqVO reqVO) {
|
||||||
|
return selectList(new QueryWrapperX<SysSmsLogDO>()
|
||||||
|
.eqIfPresent("channel_id", reqVO.getChannelId())
|
||||||
|
.eqIfPresent("template_id", reqVO.getTemplateId())
|
||||||
|
.likeIfPresent("mobile", reqVO.getMobile())
|
||||||
|
.eqIfPresent("send_status", reqVO.getSendStatus())
|
||||||
|
.betweenIfPresent("send_time", reqVO.getBeginSendTime(), reqVO.getEndSendTime())
|
||||||
|
.eqIfPresent("receive_status", reqVO.getReceiveStatus())
|
||||||
|
.betweenIfPresent("receive_time", reqVO.getBeginReceiveTime(), reqVO.getEndReceiveTime())
|
||||||
|
.orderByDesc("id"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,53 @@
|
|||||||
|
package cn.iocoder.dashboard.modules.system.dal.mysql.sms;
|
||||||
|
|
||||||
|
import cn.iocoder.dashboard.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.dashboard.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import cn.iocoder.dashboard.framework.mybatis.core.query.QueryWrapperX;
|
||||||
|
import cn.iocoder.dashboard.modules.system.controller.sms.vo.template.SysSmsTemplateExportReqVO;
|
||||||
|
import cn.iocoder.dashboard.modules.system.controller.sms.vo.template.SysSmsTemplatePageReqVO;
|
||||||
|
import cn.iocoder.dashboard.modules.system.dal.dataobject.sms.SysSmsTemplateDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface SysSmsTemplateMapper extends BaseMapperX<SysSmsTemplateDO> {
|
||||||
|
|
||||||
|
default SysSmsTemplateDO selectByCode(String code) {
|
||||||
|
return selectOne("code", code);
|
||||||
|
}
|
||||||
|
|
||||||
|
default PageResult<SysSmsTemplateDO> selectPage(SysSmsTemplatePageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new QueryWrapperX<SysSmsTemplateDO>()
|
||||||
|
.eqIfPresent("type", reqVO.getType())
|
||||||
|
.eqIfPresent("status", reqVO.getStatus())
|
||||||
|
.likeIfPresent("code", reqVO.getCode())
|
||||||
|
.likeIfPresent("content", reqVO.getContent())
|
||||||
|
.likeIfPresent("api_template_id", reqVO.getApiTemplateId())
|
||||||
|
.eqIfPresent("channel_id", reqVO.getChannelId())
|
||||||
|
.betweenIfPresent("create_time", reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
|
||||||
|
.orderByDesc("id"));
|
||||||
|
}
|
||||||
|
|
||||||
|
default List<SysSmsTemplateDO> selectList(SysSmsTemplateExportReqVO reqVO) {
|
||||||
|
return selectList(new QueryWrapperX<SysSmsTemplateDO>()
|
||||||
|
.eqIfPresent("type", reqVO.getType())
|
||||||
|
.eqIfPresent("status", reqVO.getStatus())
|
||||||
|
.likeIfPresent("code", reqVO.getCode())
|
||||||
|
.likeIfPresent("content", reqVO.getContent())
|
||||||
|
.likeIfPresent("api_template_id", reqVO.getApiTemplateId())
|
||||||
|
.eqIfPresent("channel_id", reqVO.getChannelId())
|
||||||
|
.betweenIfPresent("create_time", reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
|
||||||
|
.orderByDesc("id"));
|
||||||
|
}
|
||||||
|
|
||||||
|
default Integer selectCountByChannelId(Long channelId) {
|
||||||
|
return selectCount("channel_id", channelId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Select("SELECT id FROM sys_sms_template WHERE update_time > #{maxUpdateTime} LIMIT 1")
|
||||||
|
Long selectExistsByUpdateTimeAfter(Date maxUpdateTime);
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
package cn.iocoder.dashboard.modules.system.enums.sms;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 短信的接收状态枚举
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
* @date 2021/2/1 13:39
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum SysSmsReceiveStatusEnum {
|
||||||
|
|
||||||
|
INIT(0), // 初始化
|
||||||
|
SUCCESS(10), // 接收成功
|
||||||
|
FAILURE(20), // 接收失败
|
||||||
|
;
|
||||||
|
|
||||||
|
private final int status;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
package cn.iocoder.dashboard.modules.system.enums.sms;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 短信的发送状态枚举
|
||||||
|
*
|
||||||
|
* @author zzf
|
||||||
|
* @date 2021/2/1 13:39
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum SysSmsSendStatusEnum {
|
||||||
|
|
||||||
|
INIT(0), // 初始化
|
||||||
|
SUCCESS(10), // 发送成功
|
||||||
|
FAILURE(20), // 发送失败
|
||||||
|
IGNORE(30), // 忽略,即不发送
|
||||||
|
;
|
||||||
|
|
||||||
|
private final int status;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
package cn.iocoder.dashboard.modules.system.enums.sms;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 短信的模板类型枚举
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum SysSmsTemplateTypeEnum {
|
||||||
|
|
||||||
|
VERIFICATION_CODE(1), // 验证码
|
||||||
|
NOTICE(2), // 通知
|
||||||
|
PROMOTION(3), // 营销
|
||||||
|
;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型
|
||||||
|
*/
|
||||||
|
private final int type;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
package cn.iocoder.dashboard.modules.system.mq.consumer.sms;
|
||||||
|
|
||||||
|
import cn.iocoder.dashboard.framework.redis.core.pubsub.AbstractChannelMessageListener;
|
||||||
|
import cn.iocoder.dashboard.modules.system.mq.message.sms.SysSmsChannelRefreshMessage;
|
||||||
|
import cn.iocoder.dashboard.modules.system.service.sms.SysSmsChannelService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 针对 {@link SysSmsChannelRefreshMessage} 的消费者
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class SysSmsChannelRefreshConsumer extends AbstractChannelMessageListener<SysSmsChannelRefreshMessage> {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SysSmsChannelService smsChannelService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMessage(SysSmsChannelRefreshMessage message) {
|
||||||
|
log.info("[onMessage][收到 SmsChannel 刷新消息]");
|
||||||
|
smsChannelService.initSmsClients();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
package cn.iocoder.dashboard.modules.system.mq.consumer.sms;
|
||||||
|
|
||||||
|
import cn.iocoder.dashboard.framework.redis.core.pubsub.AbstractChannelMessageListener;
|
||||||
|
import cn.iocoder.dashboard.modules.system.mq.message.sms.SysSmsTemplateRefreshMessage;
|
||||||
|
import cn.iocoder.dashboard.modules.system.service.sms.SysSmsTemplateService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 针对 {@link SysSmsTemplateRefreshMessage} 的消费者
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class SysSmsTemplateRefreshConsumer extends AbstractChannelMessageListener<SysSmsTemplateRefreshMessage> {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SysSmsTemplateService smsTemplateService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMessage(SysSmsTemplateRefreshMessage message) {
|
||||||
|
log.info("[onMessage][收到 SmsTemplate 刷新消息]");
|
||||||
|
smsTemplateService.initLocalCache();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue