Commit 2f75a716c6d039aa652d5a533d8a3c83c38a2722
1 parent
3dc36ecc
完成发送日志模块
Showing
4 changed files
with
108 additions
and
37 deletions
ruoyi-ui/src/views/system/sms/smsLog.vue
| @@ -18,7 +18,8 @@ | @@ -18,7 +18,8 @@ | ||
| 18 | </el-form-item> | 18 | </el-form-item> |
| 19 | <el-form-item label="发送状态" prop="sendStatus"> | 19 | <el-form-item label="发送状态" prop="sendStatus"> |
| 20 | <el-select v-model="queryParams.sendStatus" placeholder="请选择发送状态" clearable size="small"> | 20 | <el-select v-model="queryParams.sendStatus" placeholder="请选择发送状态" clearable size="small"> |
| 21 | - <el-option label="请选择字典生成" value="" /> | 21 | + <el-option v-for="dict in this.getDictDatas(DICT_TYPE.SYS_SMS_SEND_STATUS)" |
| 22 | + :key="dict.value" :label="dict.label" :value="dict.value"/> | ||
| 22 | </el-select> | 23 | </el-select> |
| 23 | </el-form-item> | 24 | </el-form-item> |
| 24 | <el-form-item label="发送时间"> | 25 | <el-form-item label="发送时间"> |
| @@ -27,7 +28,8 @@ | @@ -27,7 +28,8 @@ | ||
| 27 | </el-form-item> | 28 | </el-form-item> |
| 28 | <el-form-item label="接收状态" prop="receiveStatus"> | 29 | <el-form-item label="接收状态" prop="receiveStatus"> |
| 29 | <el-select v-model="queryParams.receiveStatus" placeholder="请选择接收状态" clearable size="small"> | 30 | <el-select v-model="queryParams.receiveStatus" placeholder="请选择接收状态" clearable size="small"> |
| 30 | - <el-option label="请选择字典生成" value="" /> | 31 | + <el-option v-for="dict in this.getDictDatas(DICT_TYPE.SYS_SMS_RECEIVE_STATUS)" |
| 32 | + :key="dict.value" :label="dict.label" :value="dict.value"/> | ||
| 31 | </el-select> | 33 | </el-select> |
| 32 | </el-form-item> | 34 | </el-form-item> |
| 33 | <el-form-item label="接收时间"> | 35 | <el-form-item label="接收时间"> |
| @@ -70,22 +72,19 @@ | @@ -70,22 +72,19 @@ | ||
| 70 | </template> | 72 | </template> |
| 71 | </el-table-column> | 73 | </el-table-column> |
| 72 | <el-table-column label="短信内容" align="center" prop="templateContent" width="300" /> | 74 | <el-table-column label="短信内容" align="center" prop="templateContent" width="300" /> |
| 73 | - <el-table-column label="发送状态" align="center"> | 75 | + <el-table-column label="发送状态" align="center" width="180"> |
| 74 | <template slot-scope="scope"> | 76 | <template slot-scope="scope"> |
| 75 | - <span>{{ getDictDataLabel(DICT_TYPE.SYS_SMS_SEND_STATUS, scope.row.sendStatus) }}</span> | 77 | + <div>{{ getDictDataLabel(DICT_TYPE.SYS_SMS_SEND_STATUS, scope.row.sendStatus) }}</div> |
| 78 | + <div>{{ parseTime(scope.row.sendTime) }}</div> | ||
| 76 | </template> | 79 | </template> |
| 77 | </el-table-column> | 80 | </el-table-column> |
| 78 | - <el-table-column label="接收状态" align="center"> | 81 | + <el-table-column label="接收状态" align="center" width="180"> |
| 79 | <template slot-scope="scope"> | 82 | <template slot-scope="scope"> |
| 80 | - <span>{{ getDictDataLabel(DICT_TYPE.SYS_SMS_RECEIVE_STATUS, scope.row.receiveStatus) }}</span> | 83 | + <div>{{ getDictDataLabel(DICT_TYPE.SYS_SMS_RECEIVE_STATUS, scope.row.receiveStatus) }}</div> |
| 84 | + <div>{{ parseTime(scope.row.receiveTime) }}</div> | ||
| 81 | </template> | 85 | </template> |
| 82 | </el-table-column> | 86 | </el-table-column> |
| 83 | - <el-table-column label="接收时间" align="center" prop="receiveTime" width="180"> | ||
| 84 | - <template slot-scope="scope"> | ||
| 85 | - <span>{{ parseTime(scope.row.receiveTime) }}</span> | ||
| 86 | - </template> | ||
| 87 | - </el-table-column> | ||
| 88 | - <el-table-column label="短信渠道" align="center"> | 87 | + <el-table-column label="短信渠道" align="center" width="100"> |
| 89 | <template slot-scope="scope"> | 88 | <template slot-scope="scope"> |
| 90 | <div>{{ formatChannelSignature(scope.row.channelId) }}</div> | 89 | <div>{{ formatChannelSignature(scope.row.channelId) }}</div> |
| 91 | <div>【{{ getDictDataLabel(DICT_TYPE.SYS_SMS_CHANNEL_CODE, scope.row.channelCode) }}】</div> | 90 | <div>【{{ getDictDataLabel(DICT_TYPE.SYS_SMS_CHANNEL_CODE, scope.row.channelCode) }}】</div> |
| @@ -110,42 +109,65 @@ | @@ -110,42 +109,65 @@ | ||
| 110 | 109 | ||
| 111 | <!-- 短信日志详细 --> | 110 | <!-- 短信日志详细 --> |
| 112 | <el-dialog title="短信日志详细" :visible.sync="open" width="700px" append-to-body> | 111 | <el-dialog title="短信日志详细" :visible.sync="open" width="700px" append-to-body> |
| 113 | - <el-form ref="form" :model="form" label-width="100px" size="mini"> | 112 | + <el-form ref="form" :model="form" label-width="140px" size="mini"> |
| 114 | <el-row> | 113 | <el-row> |
| 115 | <el-col :span="24"> | 114 | <el-col :span="24"> |
| 116 | <el-form-item label="日志主键:">{{ form.id }}</el-form-item> | 115 | <el-form-item label="日志主键:">{{ form.id }}</el-form-item> |
| 117 | </el-col> | 116 | </el-col> |
| 118 | <el-col :span="24"> | 117 | <el-col :span="24"> |
| 119 | - <el-form-item label="链路追踪:">{{ form.traceId }}</el-form-item> | 118 | + <el-form-item label="短信渠道:"> |
| 119 | + {{ formatChannelSignature(form.channelId) }}【{{ getDictDataLabel(DICT_TYPE.SYS_SMS_CHANNEL_CODE, form.channelCode) }}】 | ||
| 120 | + </el-form-item> | ||
| 120 | </el-col> | 121 | </el-col> |
| 121 | <el-col :span="24"> | 122 | <el-col :span="24"> |
| 122 | - <el-form-item label="用户信息:">{{ form.userId }} | {{ form.userNickname }} | {{ form.userIp }} | {{ form.userAgent}} </el-form-item> | 123 | + <el-form-item label="短信模板:"> |
| 124 | + {{ form.templateId }} | {{ form.templateCode}} | {{ getDictDataLabel(DICT_TYPE.SYS_SMS_TEMPLATE_TYPE, form.templateType) }} | ||
| 125 | + </el-form-item> | ||
| 123 | </el-col> | 126 | </el-col> |
| 124 | <el-col :span="24"> | 127 | <el-col :span="24"> |
| 125 | - <el-form-item label="操作信息:"> | ||
| 126 | - {{ form.module }} | {{ form.name }} | {{ getDictDataLabel(DICT_TYPE.SYS_OPERATE_TYPE, form.type) }} | ||
| 127 | - <br /> {{ form.content }} | ||
| 128 | - <br /> {{ form.exts }} | 128 | + <el-form-item label="API 的模板编号:">{{ form.apiTemplateId }}</el-form-item> |
| 129 | + </el-col> | ||
| 130 | + <el-col :span="24"> | ||
| 131 | + <el-form-item label="用户信息:">{{ form.mobile }} | ||
| 132 | + <span v-if="form.userType && form.userId"> | {{ getDictDataLabel(DICT_TYPE.USER_TYPE, form.userType) }} | {{ form.userId }}</span> | ||
| 129 | </el-form-item> | 133 | </el-form-item> |
| 130 | </el-col> | 134 | </el-col> |
| 131 | <el-col :span="24"> | 135 | <el-col :span="24"> |
| 132 | - <el-form-item label="请求信息:">{{ form.requestMethod }} | {{ form.requestUrl }} </el-form-item> | 136 | + <el-form-item label="短信内容:">{{ form.templateContent }}</el-form-item> |
| 137 | + </el-col> | ||
| 138 | + <el-col :span="24"> | ||
| 139 | + <el-form-item label="短信参数:">{{ form.templateParams }}</el-form-item> | ||
| 140 | + </el-col> | ||
| 141 | + <el-col :span="24"> | ||
| 142 | + <el-form-item label="创建时间:">{{ parseTime(form.createTime) }}</el-form-item> | ||
| 133 | </el-col> | 143 | </el-col> |
| 134 | <el-col :span="24"> | 144 | <el-col :span="24"> |
| 135 | - <el-form-item label="方法名:">{{ form.javaMethod }}</el-form-item> | 145 | + <el-form-item label="发送状态:">{{ getDictDataLabel(DICT_TYPE.SYS_SMS_SEND_STATUS, form.sendStatus) }}</el-form-item> |
| 136 | </el-col> | 146 | </el-col> |
| 137 | <el-col :span="24"> | 147 | <el-col :span="24"> |
| 138 | - <el-form-item label="方法参数:">{{ form.javaMethodArgs }}</el-form-item> | 148 | + <el-form-item label="发送时间:">{{ parseTime(form.sendTime) }}</el-form-item> |
| 139 | </el-col> | 149 | </el-col> |
| 140 | <el-col :span="24"> | 150 | <el-col :span="24"> |
| 141 | - <el-form-item label="开始时间:"> | ||
| 142 | - {{ parseTime(form.startTime) }} | {{ form.duration }} ms | 151 | + <el-form-item label="发送结果:">{{ form.sendCode }} | {{ form.sendMsg }} |
| 143 | </el-form-item> | 152 | </el-form-item> |
| 144 | </el-col> | 153 | </el-col> |
| 145 | - <el-col :span="12"> | ||
| 146 | - <el-form-item label="操作结果:"> | ||
| 147 | - <div v-if="form.resultCode === 0">正常 | {{ form.resultData}} </div> | ||
| 148 | - <div v-else-if="form.resultCode > 0">失败 | {{ form.resultCode }} || {{ form.resultMsg}}</div> | 154 | + <el-col :span="24"> |
| 155 | + <el-form-item label="API 发送结果:">{{ form.apiSendCode }} | {{ form.apiSendMsg }}</el-form-item> | ||
| 156 | + </el-col> | ||
| 157 | + <el-col :span="24"> | ||
| 158 | + <el-form-item label="API 短信编号:">{{ form.apiSerialNo }}</el-form-item> | ||
| 159 | + </el-col> | ||
| 160 | + <el-col :span="24"> | ||
| 161 | + <el-form-item label="API 请求编号:">{{ form.apiRequestId }}</el-form-item> | ||
| 162 | + </el-col> | ||
| 163 | + <el-col :span="24"> | ||
| 164 | + <el-form-item label="接收状态:">{{ getDictDataLabel(DICT_TYPE.SYS_SMS_RECEIVE_STATUS, form.receiveStatus) }}</el-form-item> | ||
| 165 | + </el-col> | ||
| 166 | + <el-col :span="24"> | ||
| 167 | + <el-form-item label="接收时间:">{{ parseTime(form.receiveTime) }}</el-form-item> | ||
| 168 | + </el-col> | ||
| 169 | + <el-col :span="24"> | ||
| 170 | + <el-form-item label="API 接收结果:">{{ form.apiReceiveCode }} | {{ form.apiReceiveMsg }} | ||
| 149 | </el-form-item> | 171 | </el-form-item> |
| 150 | </el-col> | 172 | </el-col> |
| 151 | </el-row> | 173 | </el-row> |
src/main/java/cn/iocoder/dashboard/framework/excel/core/convert/DictConvert.java
| @@ -13,6 +13,11 @@ import com.alibaba.excel.metadata.GlobalConfiguration; | @@ -13,6 +13,11 @@ import com.alibaba.excel.metadata.GlobalConfiguration; | ||
| 13 | import com.alibaba.excel.metadata.property.ExcelContentProperty; | 13 | import com.alibaba.excel.metadata.property.ExcelContentProperty; |
| 14 | import lombok.extern.slf4j.Slf4j; | 14 | import lombok.extern.slf4j.Slf4j; |
| 15 | 15 | ||
| 16 | +/** | ||
| 17 | + * Excel {@link SysDictDataDO} 数据字典转换器 | ||
| 18 | + * | ||
| 19 | + * @author 芋道源码 | ||
| 20 | + */ | ||
| 16 | @Slf4j | 21 | @Slf4j |
| 17 | public class DictConvert implements Converter<Object> { | 22 | public class DictConvert implements Converter<Object> { |
| 18 | 23 |
src/main/java/cn/iocoder/dashboard/framework/excel/core/convert/JsonConvert.java
0 → 100644
| 1 | +package cn.iocoder.dashboard.framework.excel.core.convert; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.dashboard.util.json.JsonUtils; | ||
| 4 | +import com.alibaba.excel.converters.Converter; | ||
| 5 | +import com.alibaba.excel.enums.CellDataTypeEnum; | ||
| 6 | +import com.alibaba.excel.metadata.CellData; | ||
| 7 | +import com.alibaba.excel.metadata.GlobalConfiguration; | ||
| 8 | +import com.alibaba.excel.metadata.property.ExcelContentProperty; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * Excel Json 转换器 | ||
| 12 | + * | ||
| 13 | + * @author 芋道源码 | ||
| 14 | + */ | ||
| 15 | +public class JsonConvert implements Converter<Object> { | ||
| 16 | + | ||
| 17 | + @Override | ||
| 18 | + public Class<?> supportJavaTypeKey() { | ||
| 19 | + throw new UnsupportedOperationException("暂不支持,也不需要"); | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + @Override | ||
| 23 | + public CellDataTypeEnum supportExcelTypeKey() { | ||
| 24 | + throw new UnsupportedOperationException("暂不支持,也不需要"); | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + @Override | ||
| 28 | + public Object convertToJavaData(CellData cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) { | ||
| 29 | + throw new UnsupportedOperationException("暂不支持,也不需要"); | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + @Override | ||
| 33 | + public CellData<String> convertToExcelData(Object value, ExcelContentProperty contentProperty, | ||
| 34 | + GlobalConfiguration globalConfiguration) { | ||
| 35 | + // 生成 Excel 小表格 | ||
| 36 | + return new CellData<>(JsonUtils.toJsonString(value)); | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | +} |
src/main/java/cn/iocoder/dashboard/modules/system/controller/sms/vo/log/SysSmsLogExcelVO.java
| 1 | package cn.iocoder.dashboard.modules.system.controller.sms.vo.log; | 1 | package cn.iocoder.dashboard.modules.system.controller.sms.vo.log; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat; | ||
| 4 | +import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert; | ||
| 5 | +import cn.iocoder.dashboard.framework.excel.core.convert.JsonConvert; | ||
| 3 | import com.alibaba.excel.annotation.ExcelProperty; | 6 | import com.alibaba.excel.annotation.ExcelProperty; |
| 4 | import lombok.Data; | 7 | import lombok.Data; |
| 5 | 8 | ||
| 6 | import java.util.Date; | 9 | import java.util.Date; |
| 7 | import java.util.Map; | 10 | import java.util.Map; |
| 8 | 11 | ||
| 12 | +import static cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum.*; | ||
| 13 | + | ||
| 9 | /** | 14 | /** |
| 10 | * 短信日志 Excel VO | 15 | * 短信日志 Excel VO |
| 11 | * | 16 | * |
| @@ -21,7 +26,6 @@ public class SysSmsLogExcelVO { | @@ -21,7 +26,6 @@ public class SysSmsLogExcelVO { | ||
| 21 | private Long channelId; | 26 | private Long channelId; |
| 22 | 27 | ||
| 23 | @ExcelProperty("短信渠道编码") | 28 | @ExcelProperty("短信渠道编码") |
| 24 | - // TODO 导出枚举 | ||
| 25 | private String channelCode; | 29 | private String channelCode; |
| 26 | 30 | ||
| 27 | @ExcelProperty("模板编号") | 31 | @ExcelProperty("模板编号") |
| @@ -30,13 +34,14 @@ public class SysSmsLogExcelVO { | @@ -30,13 +34,14 @@ public class SysSmsLogExcelVO { | ||
| 30 | @ExcelProperty("模板编码") | 34 | @ExcelProperty("模板编码") |
| 31 | private String templateCode; | 35 | private String templateCode; |
| 32 | 36 | ||
| 33 | - @ExcelProperty("短信类型") | 37 | + @ExcelProperty(value = "短信类型", converter = DictConvert.class) |
| 38 | + @DictFormat(SYS_SMS_TEMPLATE_TYPE) | ||
| 34 | private Integer templateType; | 39 | private Integer templateType; |
| 35 | 40 | ||
| 36 | @ExcelProperty("短信内容") | 41 | @ExcelProperty("短信内容") |
| 37 | private String templateContent; | 42 | private String templateContent; |
| 38 | 43 | ||
| 39 | - @ExcelProperty("短信参数") | 44 | + @ExcelProperty(value = "短信参数", converter = JsonConvert.class) |
| 40 | private Map<String, Object> templateParams; | 45 | private Map<String, Object> templateParams; |
| 41 | 46 | ||
| 42 | @ExcelProperty("短信 API 的模板编号") | 47 | @ExcelProperty("短信 API 的模板编号") |
| @@ -48,12 +53,12 @@ public class SysSmsLogExcelVO { | @@ -48,12 +53,12 @@ public class SysSmsLogExcelVO { | ||
| 48 | @ExcelProperty("用户编号") | 53 | @ExcelProperty("用户编号") |
| 49 | private Long userId; | 54 | private Long userId; |
| 50 | 55 | ||
| 51 | - @ExcelProperty("用户类型") | ||
| 52 | - // TODO 导出枚举 | 56 | + @ExcelProperty(value = "用户类型", converter = DictConvert.class) |
| 57 | + @DictFormat(USER_TYPE) | ||
| 53 | private Integer userType; | 58 | private Integer userType; |
| 54 | 59 | ||
| 55 | - @ExcelProperty("发送状态") | ||
| 56 | - // TODO 导出枚举 | 60 | + @ExcelProperty(value = "发送状态", converter = DictConvert.class) |
| 61 | + @DictFormat(SYS_SMS_SEND_STATUS) | ||
| 57 | private Integer sendStatus; | 62 | private Integer sendStatus; |
| 58 | 63 | ||
| 59 | @ExcelProperty("发送时间") | 64 | @ExcelProperty("发送时间") |
| @@ -77,8 +82,8 @@ public class SysSmsLogExcelVO { | @@ -77,8 +82,8 @@ public class SysSmsLogExcelVO { | ||
| 77 | @ExcelProperty("短信 API 发送返回的序号") | 82 | @ExcelProperty("短信 API 发送返回的序号") |
| 78 | private String apiSerialNo; | 83 | private String apiSerialNo; |
| 79 | 84 | ||
| 80 | - @ExcelProperty("接收状态") | ||
| 81 | - // TODO 导出枚举 | 85 | + @ExcelProperty(value = "接收状态", converter = DictConvert.class) |
| 86 | + @DictFormat(SYS_SMS_RECEIVE_STATUS) | ||
| 82 | private Integer receiveStatus; | 87 | private Integer receiveStatus; |
| 83 | 88 | ||
| 84 | @ExcelProperty("接收时间") | 89 | @ExcelProperty("接收时间") |