完成发送日志模块

This commit is contained in:
YunaiV 2021-04-12 00:10:52 +08:00
parent 3dc36ecced
commit 2f75a716c6
4 changed files with 118 additions and 47 deletions

View File

@ -18,7 +18,8 @@
</el-form-item> </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 v-for="dict in this.getDictDatas(DICT_TYPE.SYS_SMS_SEND_STATUS)"
:key="dict.value" :label="dict.label" :value="dict.value"/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="发送时间"> <el-form-item label="发送时间">
@ -27,7 +28,8 @@
</el-form-item> </el-form-item>
<el-form-item label="接收状态" prop="receiveStatus"> <el-form-item label="接收状态" prop="receiveStatus">
<el-select v-model="queryParams.receiveStatus" placeholder="请选择接收状态" clearable size="small"> <el-select v-model="queryParams.receiveStatus" placeholder="请选择接收状态" clearable size="small">
<el-option label="请选择字典生成" value="" /> <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-select>
</el-form-item> </el-form-item>
<el-form-item label="接收时间"> <el-form-item label="接收时间">
@ -70,22 +72,19 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="短信内容" align="center" prop="templateContent" width="300" /> <el-table-column label="短信内容" align="center" prop="templateContent" width="300" />
<el-table-column label="发送状态" align="center"> <el-table-column label="发送状态" align="center" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ getDictDataLabel(DICT_TYPE.SYS_SMS_SEND_STATUS, scope.row.sendStatus) }}</span> <div>{{ getDictDataLabel(DICT_TYPE.SYS_SMS_SEND_STATUS, scope.row.sendStatus) }}</div>
<div>{{ parseTime(scope.row.sendTime) }}</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="接收状态" align="center"> <el-table-column label="接收状态" align="center" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ getDictDataLabel(DICT_TYPE.SYS_SMS_RECEIVE_STATUS, scope.row.receiveStatus) }}</span> <div>{{ getDictDataLabel(DICT_TYPE.SYS_SMS_RECEIVE_STATUS, scope.row.receiveStatus) }}</div>
<div>{{ parseTime(scope.row.receiveTime) }}</div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="接收时间" align="center" prop="receiveTime" width="180"> <el-table-column label="短信渠道" align="center" width="100">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.receiveTime) }}</span>
</template>
</el-table-column>
<el-table-column label="短信渠道" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<div>{{ formatChannelSignature(scope.row.channelId) }}</div> <div>{{ formatChannelSignature(scope.row.channelId) }}</div>
<div>{{ getDictDataLabel(DICT_TYPE.SYS_SMS_CHANNEL_CODE, scope.row.channelCode) }}</div> <div>{{ getDictDataLabel(DICT_TYPE.SYS_SMS_CHANNEL_CODE, scope.row.channelCode) }}</div>
@ -110,42 +109,65 @@
<!-- 短信日志详细 --> <!-- 短信日志详细 -->
<el-dialog title="短信日志详细" :visible.sync="open" width="700px" append-to-body> <el-dialog title="短信日志详细" :visible.sync="open" width="700px" append-to-body>
<el-form ref="form" :model="form" label-width="100px" size="mini"> <el-form ref="form" :model="form" label-width="140px" size="mini">
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="日志主键:">{{ form.id }}</el-form-item> <el-form-item label="日志主键:">{{ form.id }}</el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="链路追踪:">{{ form.traceId }}</el-form-item> <el-form-item label="短信渠道:">
</el-col> {{ formatChannelSignature(form.channelId) }}{{ getDictDataLabel(DICT_TYPE.SYS_SMS_CHANNEL_CODE, form.channelCode) }}
<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-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="请求信息:">{{ form.requestMethod }} | {{ form.requestUrl }} </el-form-item> <el-form-item label="短信模板:">
</el-col> {{ form.templateId }} | {{ form.templateCode}} | {{ getDictDataLabel(DICT_TYPE.SYS_SMS_TEMPLATE_TYPE, form.templateType) }}
<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-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="24">
<el-form-item label="操作结果:"> <el-form-item label="API 的模板编号:">{{ form.apiTemplateId }}</el-form-item>
<div v-if="form.resultCode === 0">正常 | {{ form.resultData}} </div> </el-col>
<div v-else-if="form.resultCode > 0">失败 | {{ form.resultCode }} || {{ form.resultMsg}}</div> <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-form-item>
</el-col> </el-col>
</el-row> </el-row>

View File

@ -13,6 +13,11 @@ import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.property.ExcelContentProperty; import com.alibaba.excel.metadata.property.ExcelContentProperty;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
/**
* Excel {@link SysDictDataDO} 数据字典转换器
*
* @author 芋道源码
*/
@Slf4j @Slf4j
public class DictConvert implements Converter<Object> { public class DictConvert implements Converter<Object> {

View File

@ -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));
}
}

View File

@ -1,11 +1,16 @@
package cn.iocoder.dashboard.modules.system.controller.sms.vo.log; 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 com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.Date;
import java.util.Map; import java.util.Map;
import static cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum.*;
/** /**
* 短信日志 Excel VO * 短信日志 Excel VO
* *
@ -21,7 +26,6 @@ public class SysSmsLogExcelVO {
private Long channelId; private Long channelId;
@ExcelProperty("短信渠道编码") @ExcelProperty("短信渠道编码")
// TODO 导出枚举
private String channelCode; private String channelCode;
@ExcelProperty("模板编号") @ExcelProperty("模板编号")
@ -30,13 +34,14 @@ public class SysSmsLogExcelVO {
@ExcelProperty("模板编码") @ExcelProperty("模板编码")
private String templateCode; private String templateCode;
@ExcelProperty("短信类型") @ExcelProperty(value = "短信类型", converter = DictConvert.class)
@DictFormat(SYS_SMS_TEMPLATE_TYPE)
private Integer templateType; private Integer templateType;
@ExcelProperty("短信内容") @ExcelProperty("短信内容")
private String templateContent; private String templateContent;
@ExcelProperty("短信参数") @ExcelProperty(value = "短信参数", converter = JsonConvert.class)
private Map<String, Object> templateParams; private Map<String, Object> templateParams;
@ExcelProperty("短信 API 的模板编号") @ExcelProperty("短信 API 的模板编号")
@ -48,12 +53,12 @@ public class SysSmsLogExcelVO {
@ExcelProperty("用户编号") @ExcelProperty("用户编号")
private Long userId; private Long userId;
@ExcelProperty("用户类型") @ExcelProperty(value = "用户类型", converter = DictConvert.class)
// TODO 导出枚举 @DictFormat(USER_TYPE)
private Integer userType; private Integer userType;
@ExcelProperty("发送状态") @ExcelProperty(value = "发送状态", converter = DictConvert.class)
// TODO 导出枚举 @DictFormat(SYS_SMS_SEND_STATUS)
private Integer sendStatus; private Integer sendStatus;
@ExcelProperty("发送时间") @ExcelProperty("发送时间")
@ -77,8 +82,8 @@ public class SysSmsLogExcelVO {
@ExcelProperty("短信 API 发送返回的序号") @ExcelProperty("短信 API 发送返回的序号")
private String apiSerialNo; private String apiSerialNo;
@ExcelProperty("接收状态") @ExcelProperty(value = "接收状态", converter = DictConvert.class)
// TODO 导出枚举 @DictFormat(SYS_SMS_RECEIVE_STATUS)
private Integer receiveStatus; private Integer receiveStatus;
@ExcelProperty("接收时间") @ExcelProperty("接收时间")