Commit 2f75a716c6d039aa652d5a533d8a3c83c38a2722

Authored by YunaiV
1 parent 3dc36ecc

完成发送日志模块

ruoyi-ui/src/views/system/sms/smsLog.vue
... ... @@ -18,7 +18,8 @@
18 18 </el-form-item>
19 19 <el-form-item label="发送状态" prop="sendStatus">
20 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 23 </el-select>
23 24 </el-form-item>
24 25 <el-form-item label="发送时间">
... ... @@ -27,7 +28,8 @@
27 28 </el-form-item>
28 29 <el-form-item label="接收状态" prop="receiveStatus">
29 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 33 </el-select>
32 34 </el-form-item>
33 35 <el-form-item label="接收时间">
... ... @@ -70,22 +72,19 @@
70 72 </template>
71 73 </el-table-column>
72 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 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 79 </template>
77 80 </el-table-column>
78   - <el-table-column label="接收状态" align="center">
  81 + <el-table-column label="接收状态" align="center" width="180">
79 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 85 </template>
82 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 88 <template slot-scope="scope">
90 89 <div>{{ formatChannelSignature(scope.row.channelId) }}</div>
91 90 <div>【{{ getDictDataLabel(DICT_TYPE.SYS_SMS_CHANNEL_CODE, scope.row.channelCode) }}】</div>
... ... @@ -110,42 +109,65 @@
110 109  
111 110 <!-- 短信日志详细 -->
112 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 113 <el-row>
115 114 <el-col :span="24">
116 115 <el-form-item label="日志主键:">{{ form.id }}</el-form-item>
117 116 </el-col>
118 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 121 </el-col>
121 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 126 </el-col>
124 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 133 </el-form-item>
130 134 </el-col>
131 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 143 </el-col>
134 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 146 </el-col>
137 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 149 </el-col>
140 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 152 </el-form-item>
144 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 171 </el-form-item>
150 172 </el-col>
151 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 13 import com.alibaba.excel.metadata.property.ExcelContentProperty;
14 14 import lombok.extern.slf4j.Slf4j;
15 15  
  16 +/**
  17 + * Excel {@link SysDictDataDO} 数据字典转换器
  18 + *
  19 + * @author 芋道源码
  20 + */
16 21 @Slf4j
17 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 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 6 import com.alibaba.excel.annotation.ExcelProperty;
4 7 import lombok.Data;
5 8  
6 9 import java.util.Date;
7 10 import java.util.Map;
8 11  
  12 +import static cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum.*;
  13 +
9 14 /**
10 15 * 短信日志 Excel VO
11 16 *
... ... @@ -21,7 +26,6 @@ public class SysSmsLogExcelVO {
21 26 private Long channelId;
22 27  
23 28 @ExcelProperty("短信渠道编码")
24   - // TODO 导出枚举
25 29 private String channelCode;
26 30  
27 31 @ExcelProperty("模板编号")
... ... @@ -30,13 +34,14 @@ public class SysSmsLogExcelVO {
30 34 @ExcelProperty("模板编码")
31 35 private String templateCode;
32 36  
33   - @ExcelProperty("短信类型")
  37 + @ExcelProperty(value = "短信类型", converter = DictConvert.class)
  38 + @DictFormat(SYS_SMS_TEMPLATE_TYPE)
34 39 private Integer templateType;
35 40  
36 41 @ExcelProperty("短信内容")
37 42 private String templateContent;
38 43  
39   - @ExcelProperty("短信参数")
  44 + @ExcelProperty(value = "短信参数", converter = JsonConvert.class)
40 45 private Map<String, Object> templateParams;
41 46  
42 47 @ExcelProperty("短信 API 的模板编号")
... ... @@ -48,12 +53,12 @@ public class SysSmsLogExcelVO {
48 53 @ExcelProperty("用户编号")
49 54 private Long userId;
50 55  
51   - @ExcelProperty("用户类型")
52   - // TODO 导出枚举
  56 + @ExcelProperty(value = "用户类型", converter = DictConvert.class)
  57 + @DictFormat(USER_TYPE)
53 58 private Integer userType;
54 59  
55   - @ExcelProperty("发送状态")
56   - // TODO 导出枚举
  60 + @ExcelProperty(value = "发送状态", converter = DictConvert.class)
  61 + @DictFormat(SYS_SMS_SEND_STATUS)
57 62 private Integer sendStatus;
58 63  
59 64 @ExcelProperty("发送时间")
... ... @@ -77,8 +82,8 @@ public class SysSmsLogExcelVO {
77 82 @ExcelProperty("短信 API 发送返回的序号")
78 83 private String apiSerialNo;
79 84  
80   - @ExcelProperty("接收状态")
81   - // TODO 导出枚举
  85 + @ExcelProperty(value = "接收状态", converter = DictConvert.class)
  86 + @DictFormat(SYS_SMS_RECEIVE_STATUS)
82 87 private Integer receiveStatus;
83 88  
84 89 @ExcelProperty("接收时间")
... ...