短信发送日志的前端,部分完成

This commit is contained in:
YunaiV 2021-04-11 21:48:51 +08:00
parent e4a19f4929
commit 3dc36ecced
8 changed files with 130 additions and 49 deletions

View File

@ -19,6 +19,8 @@ export const DICT_TYPE = {
SYS_CONFIG_TYPE: 'sys_config_type', SYS_CONFIG_TYPE: 'sys_config_type',
SYS_SMS_CHANNEL_CODE: 'sys_sms_channel_code', SYS_SMS_CHANNEL_CODE: 'sys_sms_channel_code',
SYS_SMS_TEMPLATE_TYPE: 'sys_sms_template_type', SYS_SMS_TEMPLATE_TYPE: 'sys_sms_template_type',
SYS_SMS_SEND_STATUS: 'sys_sms_send_status',
SYS_SMS_RECEIVE_STATUS: 'sys_sms_receive_status',
INF_REDIS_TIMEOUT_TYPE: 'inf_redis_timeout_type', INF_REDIS_TIMEOUT_TYPE: 'inf_redis_timeout_type',
INF_JOB_STATUS: 'inf_job_status', INF_JOB_STATUS: 'inf_job_status',

View File

@ -163,7 +163,6 @@ export default {
businessType: undefined, businessType: undefined,
status: undefined status: undefined
}, },
}; };
}, },
created() { created() {

View File

@ -2,16 +2,20 @@
<div class="app-container"> <div class="app-container">
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="短信渠道编号" prop="channelId"> <el-form-item label="手机号" prop="mobile">
<el-input v-model="queryParams.channelId" placeholder="请输入短信渠道编号" clearable size="small" @keyup.enter.native="handleQuery"/> <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>
<el-form-item label="模板编号" prop="templateId"> <el-form-item label="模板编号" prop="templateId">
<el-input v-model="queryParams.templateId" placeholder="请输入模板编号" clearable size="small" @keyup.enter.native="handleQuery"/> <el-input v-model="queryParams.templateId" placeholder="请输入模板编号" clearable size="small" @keyup.enter.native="handleQuery"/>
</el-form-item> </el-form-item>
<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="sendStatus"> <el-form-item label="发送状态" prop="sendStatus">
<el-select v-model="queryParams.sendStatus" placeholder="请选择发送状态" clearable size="small"> <el-select v-model="queryParams.sendStatus" placeholder="请选择发送状态" clearable size="small">
<el-option label="请选择字典生成" value="" /> <el-option label="请选择字典生成" value="" />
@ -52,46 +56,51 @@
<!-- 列表 --> <!-- 列表 -->
<el-table v-loading="loading" :data="list"> <el-table v-loading="loading" :data="list">
<el-table-column label="编号" align="center" prop="id" /> <el-table-column label="编号" align="center" prop="id" />
<el-table-column label="短信渠道编号" align="center" prop="channelId" />
<el-table-column label="短信渠道编码" align="center" prop="channelCode" />
<el-table-column label="模板编号" align="center" prop="templateId" />
<el-table-column label="模板编码" align="center" prop="templateCode" />
<el-table-column label="短信类型" align="center" prop="templateType" />
<el-table-column label="短信内容" align="center" prop="templateContent" />
<el-table-column label="短信参数" align="center" prop="templateParams" />
<el-table-column label="短信 API 的模板编号" align="center" prop="apiTemplateId" />
<el-table-column label="手机号" align="center" prop="mobile" />
<el-table-column label="用户编号" align="center" prop="userId" />
<el-table-column label="用户类型" align="center" prop="userType" />
<el-table-column label="发送状态" align="center" prop="sendStatus" />
<el-table-column label="发送时间" align="center" prop="sendTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.sendTime) }}</span>
</template>
</el-table-column>
<el-table-column label="发送结果的编码" align="center" prop="sendCode" />
<el-table-column label="发送结果的提示" align="center" prop="sendMsg" />
<el-table-column label="短信 API 发送结果的编码" align="center" prop="apiSendCode" />
<el-table-column label="短信 API 发送失败的提示" align="center" prop="apiSendMsg" />
<el-table-column label="短信 API 发送返回的唯一请求 ID" align="center" prop="apiRequestId" />
<el-table-column label="短信 API 发送返回的序号" align="center" prop="apiSerialNo" />
<el-table-column label="接收状态" align="center" prop="receiveStatus" />
<el-table-column label="接收时间" align="center" prop="receiveTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.receiveTime) }}</span>
</template>
</el-table-column>
<el-table-column label="API 接收结果的编码" align="center" prop="apiReceiveCode" />
<el-table-column label="API 接收结果的说明" align="center" prop="apiReceiveMsg" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> <el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span> <span>{{ parseTime(scope.row.createTime) }}</span>
</template> </template>
</el-table-column> </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">
<template slot-scope="scope">
<span>{{ getDictDataLabel(DICT_TYPE.SYS_SMS_SEND_STATUS, scope.row.sendStatus) }}</span>
</template>
</el-table-column>
<el-table-column label="接收状态" align="center">
<template slot-scope="scope">
<span>{{ getDictDataLabel(DICT_TYPE.SYS_SMS_RECEIVE_STATUS, scope.row.receiveStatus) }}</span>
</template>
</el-table-column>
<el-table-column label="接收时间" align="center" prop="receiveTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.receiveTime) }}</span>
</template>
</el-table-column>
<el-table-column label="短信渠道" align="center">
<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"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" <el-button size="mini" type="text" icon="el-icon-view" @click="handleView(scope.row,scope.index)"
v-hasPermi="['system:sms-log:update']">修改</el-button> v-hasPermi="['system:sms-log:query']">详细</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -99,13 +108,59 @@
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/> @pagination="getList"/>
<!-- 对话框(添加 / 修改) --> <!-- 短信日志详细 -->
<el-dialog title="短信日志详细" :visible.sync="open" width="700px" append-to-body>
<el-form ref="form" :model="form" label-width="100px" 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="链路追踪:">{{ form.traceId }}</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="用户信息:">{{ form.userId }} | {{ form.userNickname }} | {{ form.userIp }} | {{ form.userAgent}} </el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="操作信息:">
{{ form.module }} | {{ form.name }} | {{ getDictDataLabel(DICT_TYPE.SYS_OPERATE_TYPE, form.type) }}
<br /> {{ form.content }}
<br /> {{ form.exts }}
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="请求信息:">{{ form.requestMethod }} | {{ form.requestUrl }} </el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="方法名:">{{ form.javaMethod }}</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="方法参数:">{{ form.javaMethodArgs }}</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="开始时间:">
{{ parseTime(form.startTime) }} | {{ form.duration }} ms
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="操作结果:">
<div v-if="form.resultCode === 0">正常 | {{ form.resultData}} </div>
<div v-else-if="form.resultCode > 0">失败 | {{ form.resultCode }} || {{ form.resultMsg}}</div>
</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> </div>
</template> </template>
<script> <script>
import { getSmsLogPage, exportSmsLogExcel } from "@/api/system/sms/smsLog"; import { getSmsLogPage, exportSmsLogExcel } from "@/api/system/sms/smsLog";
import { getSimpleSmsChannels } from "@/api/system/sms/smsChannel";
export default { export default {
name: "SmsLog", name: "SmsLog",
@ -127,6 +182,8 @@ export default {
open: false, open: false,
dateRangeSendTime: [], dateRangeSendTime: [],
dateRangeReceiveTime: [], dateRangeReceiveTime: [],
//
form: {},
// //
queryParams: { queryParams: {
pageNo: 1, pageNo: 1,
@ -137,10 +194,16 @@ export default {
sendStatus: null, sendStatus: null,
receiveStatus: null, receiveStatus: null,
}, },
//
channelOptions: [],
}; };
}, },
created() { created() {
this.getList(); this.getList();
//
getSimpleSmsChannels().then(response => {
this.channelOptions = response.data;
})
}, },
methods: { methods: {
/** 查询列表 */ /** 查询列表 */
@ -192,6 +255,20 @@ export default {
}).then(response => { }).then(response => {
this.downloadExcel(response, '短信日志.xls'); 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;
} }
} }
}; };

View File

@ -21,8 +21,8 @@
<el-form-item label="短信 API 的模板编号" prop="apiTemplateId"> <el-form-item label="短信 API 的模板编号" prop="apiTemplateId">
<el-input v-model="queryParams.apiTemplateId" placeholder="请输入短信 API 的模板编号" clearable size="small" @keyup.enter.native="handleQuery"/> <el-input v-model="queryParams.apiTemplateId" placeholder="请输入短信 API 的模板编号" clearable size="small" @keyup.enter.native="handleQuery"/>
</el-form-item> </el-form-item>
<el-form-item label="短信渠道编号" prop="channelId"> <el-form-item label="短信渠道" prop="channelId">
<el-select v-model="queryParams.channelId" placeholder="请选择短信渠道编号" clearable size="small"> <el-select v-model="queryParams.channelId" placeholder="请选择短信渠道" clearable size="small">
<el-option v-for="channel in channelOptions" <el-option v-for="channel in channelOptions"
:key="channel.id" :value="channel.id" :key="channel.id" :value="channel.id"
:label="channel.signature + '【' + getDictDataLabel(DICT_TYPE.SYS_SMS_CHANNEL_CODE, channel.code) + '】'" /> :label="channel.signature + '【' + getDictDataLabel(DICT_TYPE.SYS_SMS_CHANNEL_CODE, channel.code) + '】'" />
@ -60,12 +60,12 @@
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ getDictDataLabel(DICT_TYPE.SYS_SMS_TEMPLATE_TYPE, scope.row.type) }}</span> <span>{{ getDictDataLabel(DICT_TYPE.SYS_SMS_TEMPLATE_TYPE, scope.row.type) }}</span>
</template> </template>
</el-table-column>> </el-table-column>
<el-table-column label="开启状态" align="center" prop="status"> <el-table-column label="开启状态" align="center" prop="status">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ getDictDataLabel(DICT_TYPE.SYS_COMMON_STATUS, scope.row.status) }}</span> <span>{{ getDictDataLabel(DICT_TYPE.SYS_COMMON_STATUS, scope.row.status) }}</span>
</template> </template>
</el-table-column>> </el-table-column>
<el-table-column label="备注" align="center" prop="remark" /> <el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="短信 API 的模板编号" align="center" prop="apiTemplateId" width="180" /> <el-table-column label="短信 API 的模板编号" align="center" prop="apiTemplateId" width="180" />
<el-table-column label="短信渠道" align="center"> <el-table-column label="短信渠道" align="center">

View File

@ -28,10 +28,11 @@ public interface SmsClient {
* @param logId 日志编号 * @param logId 日志编号
* @param mobile 手机号 * @param mobile 手机号
* @param apiTemplateId 短信 API 的模板编号 * @param apiTemplateId 短信 API 的模板编号
* @param templateParams 短信模板参数 * @param templateParams 短信模板参数通过 List 数组保证参数的顺序
* @return 短信发送结果 * @return 短信发送结果
*/ */
SmsCommonResult<SmsSendRespDTO> sendSms(Long logId, String mobile, String apiTemplateId, List<KeyValue<String, Object>> templateParams); SmsCommonResult<SmsSendRespDTO> sendSms(Long logId, String mobile, String apiTemplateId,
List<KeyValue<String, Object>> templateParams);
/** /**
* 解析接收短信的接收结果 * 解析接收短信的接收结果

View File

@ -41,7 +41,7 @@ public class SysDictTypeController {
return success(dictTypeId); return success(dictTypeId);
} }
@PostMapping("update") @PutMapping("/update")
@ApiOperation("修改字典类型") @ApiOperation("修改字典类型")
@PreAuthorize("@ss.hasPermission('system:dict:update')") @PreAuthorize("@ss.hasPermission('system:dict:update')")
public CommonResult<Boolean> updateDictType(@Valid @RequestBody SysDictTypeUpdateReqVO reqVO) { public CommonResult<Boolean> updateDictType(@Valid @RequestBody SysDictTypeUpdateReqVO reqVO) {

View File

@ -20,6 +20,8 @@ public enum SysDictTypeEnum {
SYS_BOOLEAN_STRING("sys_boolean_string"), // Boolean 是否类型 SYS_BOOLEAN_STRING("sys_boolean_string"), // Boolean 是否类型
SYS_SMS_CHANNEL_CODE("sys_sms_channel_code"), // 短信渠道编码 SYS_SMS_CHANNEL_CODE("sys_sms_channel_code"), // 短信渠道编码
SYS_SMS_TEMPLATE_TYPE("sys_sms_template_type"), // 短信模板类型 SYS_SMS_TEMPLATE_TYPE("sys_sms_template_type"), // 短信模板类型
SYS_SMS_SEND_STATUS("sys_sms_send_status"), // 短信发送状态
SYS_SMS_RECEIVE_STATUS("sys_sms_receive_status"), // 短信接收状态
INF_REDIS_TIMEOUT_TYPE("inf_redis_timeout_type"), // Redis 超时类型 INF_REDIS_TIMEOUT_TYPE("inf_redis_timeout_type"), // Redis 超时类型
INF_JOB_STATUS("inf_job_status"), // 定时任务状态的枚举 INF_JOB_STATUS("inf_job_status"), // 定时任务状态的枚举

View File

@ -76,7 +76,7 @@
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ getDictDataLabel(DICT_TYPE.$dictType.toUpperCase(), scope.row.${column.javaField}) }}</span> <span>{{ getDictDataLabel(DICT_TYPE.$dictType.toUpperCase(), scope.row.${column.javaField}) }}</span>
</template> </template>
</el-table-column>> </el-table-column>
#else #else
<el-table-column label="${comment}" align="center" prop="${javaField}" /> <el-table-column label="${comment}" align="center" prop="${javaField}" />
#end #end