Commit 172574c3c84da1d68fb4c50ee72659ca80b63cd3
1 parent
1b3e665b
完成 API 异常日志
Showing
12 changed files
with
291 additions
and
31 deletions
README.md
| @@ -34,6 +34,7 @@ | @@ -34,6 +34,7 @@ | ||
| 34 | 34 | ||
| 35 | 1. 配置管理:对系统动态配置常用参数 | 35 | 1. 配置管理:对系统动态配置常用参数 |
| 36 | 1. 定时任务:在线(添加、修改、删除)任务调度包含执行结果日志 | 36 | 1. 定时任务:在线(添加、修改、删除)任务调度包含执行结果日志 |
| 37 | +1. API 日志:包括 RESTful API 访问日志、异常日志两部分,方便排查 API 相关的问题 | ||
| 37 | 1. MySQL 监控:监视当前系统数据库连接池状态,可进行分析SQL找出系统性能瓶颈 | 38 | 1. MySQL 监控:监视当前系统数据库连接池状态,可进行分析SQL找出系统性能瓶颈 |
| 38 | 1. Redis 监控:监控 Redis 数据库的使用情况,使用的 Redis Key 管理 | 39 | 1. Redis 监控:监控 Redis 数据库的使用情况,使用的 Redis Key 管理 |
| 39 | 1. Java 监控:基于 Spring Boot Admin 实现 Java 应用的监控 | 40 | 1. Java 监控:基于 Spring Boot Admin 实现 Java 应用的监控 |
ruoyi-ui/src/api/infra/apiErrorLog.js
0 → 100644
| 1 | +import request from '@/utils/request' | ||
| 2 | + | ||
| 3 | +// 更新 API 错误日志的处理状态 | ||
| 4 | +export function updateApiErrorLogProcess(id, processStatus) { | ||
| 5 | + return request({ | ||
| 6 | + url: '/infra/api-error-log/update-status?id=' + id + '&processStatus=' + processStatus, | ||
| 7 | + method: 'put', | ||
| 8 | + }) | ||
| 9 | +} | ||
| 10 | + | ||
| 11 | +// 获得API 错误日志分页 | ||
| 12 | +export function getApiErrorLogPage(query) { | ||
| 13 | + return request({ | ||
| 14 | + url: '/infra/api-error-log/page', | ||
| 15 | + method: 'get', | ||
| 16 | + params: query | ||
| 17 | + }) | ||
| 18 | +} | ||
| 19 | + | ||
| 20 | +// 导出API 错误日志 Excel | ||
| 21 | +export function exportApiErrorLogExcel(query) { | ||
| 22 | + return request({ | ||
| 23 | + url: '/infra/api-error-log/export-excel', | ||
| 24 | + method: 'get', | ||
| 25 | + params: query, | ||
| 26 | + responseType: 'blob' | ||
| 27 | + }) | ||
| 28 | +} |
ruoyi-ui/src/utils/constants.js
| @@ -57,3 +57,12 @@ export const InfJobStatusEnum = { | @@ -57,3 +57,12 @@ export const InfJobStatusEnum = { | ||
| 57 | NORMAL: 1, // 运行中 | 57 | NORMAL: 1, // 运行中 |
| 58 | STOP: 2, // 暂停运行 | 58 | STOP: 2, // 暂停运行 |
| 59 | } | 59 | } |
| 60 | + | ||
| 61 | +/** | ||
| 62 | + * API 异常数据的处理状态 | ||
| 63 | + */ | ||
| 64 | +export const InfApiErrorLogProcessStatusEnum = { | ||
| 65 | + INIT: 0, // 未处理 | ||
| 66 | + DONE: 1, // 已处理 | ||
| 67 | + IGNORE: 2, // 已忽略 | ||
| 68 | +} |
ruoyi-ui/src/utils/dict.js
| @@ -21,6 +21,7 @@ export const DICT_TYPE = { | @@ -21,6 +21,7 @@ export const DICT_TYPE = { | ||
| 21 | INF_REDIS_TIMEOUT_TYPE: 'inf_redis_timeout_type', | 21 | INF_REDIS_TIMEOUT_TYPE: 'inf_redis_timeout_type', |
| 22 | INF_JOB_STATUS: 'inf_job_status', | 22 | INF_JOB_STATUS: 'inf_job_status', |
| 23 | INF_JOB_LOG_STATUS: 'inf_job_log_status', | 23 | INF_JOB_LOG_STATUS: 'inf_job_log_status', |
| 24 | + INF_API_ERROR_LOG_PROCESS_STATUS: 'inf_api_error_log_process_status', | ||
| 24 | 25 | ||
| 25 | TOOL_CODEGEN_TEMPLATE_TYPE: 'tool_codegen_template_type', | 26 | TOOL_CODEGEN_TEMPLATE_TYPE: 'tool_codegen_template_type', |
| 26 | } | 27 | } |
ruoyi-ui/src/views/infra/apiAccessLog/index.vue
| @@ -81,14 +81,14 @@ | @@ -81,14 +81,14 @@ | ||
| 81 | <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" | 81 | <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" |
| 82 | @pagination="getList"/> | 82 | @pagination="getList"/> |
| 83 | 83 | ||
| 84 | - <!-- 操作日志详细 --> | ||
| 85 | - <el-dialog title="操作日志详细" :visible.sync="open" width="700px" append-to-body> | 84 | + <!-- 查看明细 --> |
| 85 | + <el-dialog title="API 访问日志详细" :visible.sync="open" width="700px" append-to-body> | ||
| 86 | <el-form ref="form" :model="form" label-width="100px" size="mini"> | 86 | <el-form ref="form" :model="form" label-width="100px" size="mini"> |
| 87 | <el-row> | 87 | <el-row> |
| 88 | <el-col :span="24"> | 88 | <el-col :span="24"> |
| 89 | <el-form-item label="日志主键:">{{ form.id }}</el-form-item> | 89 | <el-form-item label="日志主键:">{{ form.id }}</el-form-item> |
| 90 | <el-form-item label="链路追踪:">{{ form.traceId }}</el-form-item> | 90 | <el-form-item label="链路追踪:">{{ form.traceId }}</el-form-item> |
| 91 | - <el-form-item label="链路追踪:">{{ form.applicationName }}</el-form-item> | 91 | + <el-form-item label="应用名:">{{ form.applicationName }}</el-form-item> |
| 92 | <el-form-item label="用户信息:"> | 92 | <el-form-item label="用户信息:"> |
| 93 | {{ form.userId }} | {{ getDictDataLabel(DICT_TYPE.USER_TYPE, form.userType) }} | {{ form.userIp }} | {{ form.userAgent}} | 93 | {{ form.userId }} | {{ getDictDataLabel(DICT_TYPE.USER_TYPE, form.userType) }} | {{ form.userIp }} | {{ form.userAgent}} |
| 94 | </el-form-item> | 94 | </el-form-item> |
| @@ -173,23 +173,7 @@ export default { | @@ -173,23 +173,7 @@ export default { | ||
| 173 | }, | 173 | }, |
| 174 | /** 表单重置 */ | 174 | /** 表单重置 */ |
| 175 | reset() { | 175 | reset() { |
| 176 | - this.form = { | ||
| 177 | - id: undefined, | ||
| 178 | - traceId: undefined, | ||
| 179 | - userId: undefined, | ||
| 180 | - userType: undefined, | ||
| 181 | - applicationName: undefined, | ||
| 182 | - requestMethod: undefined, | ||
| 183 | - requestUrl: undefined, | ||
| 184 | - requestParams: undefined, | ||
| 185 | - userIp: undefined, | ||
| 186 | - userAgent: undefined, | ||
| 187 | - beginTime: undefined, | ||
| 188 | - endTime: undefined, | ||
| 189 | - duration: undefined, | ||
| 190 | - resultCode: undefined, | ||
| 191 | - resultMsg: undefined, | ||
| 192 | - }; | 176 | + this.form = {}; |
| 193 | this.resetForm("form"); | 177 | this.resetForm("form"); |
| 194 | }, | 178 | }, |
| 195 | /** 搜索按钮操作 */ | 179 | /** 搜索按钮操作 */ |
ruoyi-ui/src/views/infra/apiErrorLog/index.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <div class="app-container"> | ||
| 3 | + | ||
| 4 | + <!-- 搜索工作栏 --> | ||
| 5 | + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> | ||
| 6 | + <el-form-item label="用户编号" prop="userId"> | ||
| 7 | + <el-input v-model="queryParams.userId" placeholder="请输入用户编号" clearable size="small" @keyup.enter.native="handleQuery"/> | ||
| 8 | + </el-form-item> | ||
| 9 | + <el-form-item label="用户类型" prop="userType"> | ||
| 10 | + <el-select v-model="queryParams.userType" placeholder="请选择用户类型" clearable size="small"> | ||
| 11 | + <el-option v-for="dict in this.getDictDatas(DICT_TYPE.USER_TYPE)" | ||
| 12 | + :key="dict.value" :label="dict.label" :value="dict.value"/> | ||
| 13 | + </el-select> | ||
| 14 | + </el-form-item> | ||
| 15 | + <el-form-item label="应用名" prop="applicationName"> | ||
| 16 | + <el-input v-model="queryParams.applicationName" placeholder="请输入应用名" clearable size="small" @keyup.enter.native="handleQuery"/> | ||
| 17 | + </el-form-item> | ||
| 18 | + <el-form-item label="请求地址" prop="requestUrl"> | ||
| 19 | + <el-input v-model="queryParams.requestUrl" placeholder="请输入请求地址" clearable size="small" @keyup.enter.native="handleQuery"/> | ||
| 20 | + </el-form-item> | ||
| 21 | + <el-form-item label="异常时间"> | ||
| 22 | + <el-date-picker v-model="dateRangeExceptionTime" size="small" style="width: 240px" value-format="yyyy-MM-dd" | ||
| 23 | + type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" /> | ||
| 24 | + </el-form-item> | ||
| 25 | + <el-form-item label="处理状态" prop="processStatus"> | ||
| 26 | + <el-select v-model="queryParams.processStatus" placeholder="请选择处理状态" clearable size="small"> | ||
| 27 | + <el-option v-for="dict in this.getDictDatas(DICT_TYPE.INF_API_ERROR_LOG_PROCESS_STATUS)" | ||
| 28 | + :key="dict.value" :label="dict.label" :value="dict.value"/> | ||
| 29 | + </el-select> | ||
| 30 | + </el-form-item> | ||
| 31 | + <el-form-item> | ||
| 32 | + <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> | ||
| 33 | + <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> | ||
| 34 | + </el-form-item> | ||
| 35 | + </el-form> | ||
| 36 | + | ||
| 37 | + <!-- 操作工具栏 --> | ||
| 38 | + <el-row :gutter="10" class="mb8"> | ||
| 39 | + <el-col :span="1.5"> | ||
| 40 | + <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" | ||
| 41 | + v-hasPermi="['infra:api-error-log:export']">导出</el-button> | ||
| 42 | + </el-col> | ||
| 43 | + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> | ||
| 44 | + </el-row> | ||
| 45 | + | ||
| 46 | + <!-- 列表 --> | ||
| 47 | + <el-table v-loading="loading" :data="list"> | ||
| 48 | + <el-table-column label="日志编号" align="center" prop="id" /> | ||
| 49 | + <el-table-column label="用户编号" align="center" prop="userId" /> | ||
| 50 | + <el-table-column label="用户类型" align="center" prop="userType"> | ||
| 51 | + <template slot-scope="scope"> | ||
| 52 | + <span>{{ getDictDataLabel(DICT_TYPE.USER_TYPE, scope.row.userType) }}</span> | ||
| 53 | + </template> | ||
| 54 | + </el-table-column>> | ||
| 55 | + <el-table-column label="应用名" align="center" prop="applicationName" /> | ||
| 56 | + <el-table-column label="请求方法名" align="center" prop="requestMethod" /> | ||
| 57 | + <el-table-column label="请求地址" align="center" prop="requestUrl" width="250" /> | ||
| 58 | + <el-table-column label="异常发生时间" align="center" prop="exceptionTime" width="180"> | ||
| 59 | + <template slot-scope="scope"> | ||
| 60 | + <span>{{ parseTime(scope.row.exceptionTime) }}</span> | ||
| 61 | + </template> | ||
| 62 | + </el-table-column> | ||
| 63 | + <el-table-column label="异常名" align="center" prop="exceptionName" width="250" /> | ||
| 64 | + <el-table-column label="处理状态" align="center" prop="processStatus"> | ||
| 65 | + <template slot-scope="scope"> | ||
| 66 | + <span>{{ getDictDataLabel(DICT_TYPE.INF_API_ERROR_LOG_PROCESS_STATUS, scope.row.processStatus) }}</span> | ||
| 67 | + </template> | ||
| 68 | + </el-table-column> | ||
| 69 | + <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> | ||
| 70 | + <template slot-scope="scope"> | ||
| 71 | + <el-button size="mini" type="text" icon="el-icon-view" @click="handleView(scope.row,scope.index)" | ||
| 72 | + v-hasPermi="['infra:api-access-log:query']">详细</el-button> | ||
| 73 | + <el-button type="text" size="mini" icon="el-icon-check" | ||
| 74 | + v-if="scope.row.processStatus === InfApiErrorLogProcessStatusEnum.INIT" v-hasPermi="['infra:api-error-log:update-status']" | ||
| 75 | + @click="handleProcessClick(scope.row, InfApiErrorLogProcessStatusEnum.DONE)">已处理</el-button> | ||
| 76 | + <el-button type="text" size="mini" icon="el-icon-check" | ||
| 77 | + v-if="scope.row.processStatus === InfApiErrorLogProcessStatusEnum.INIT" v-hasPermi="['infra:api-error-log:update-status']" | ||
| 78 | + @click="handleProcessClick(scope.row, InfApiErrorLogProcessStatusEnum.IGNORE)">已忽略</el-button> | ||
| 79 | + </template> | ||
| 80 | + </el-table-column> | ||
| 81 | + </el-table> | ||
| 82 | + | ||
| 83 | + <!-- 分页组件 --> | ||
| 84 | + <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" | ||
| 85 | + @pagination="getList"/> | ||
| 86 | + | ||
| 87 | + <!-- 查看明细 --> | ||
| 88 | + <el-dialog title="API 异常日志详细" :visible.sync="open" width="1280px" append-to-body> | ||
| 89 | + <el-form ref="form" :model="form" label-width="100px" size="mini"> | ||
| 90 | + <el-row> | ||
| 91 | + <el-col :span="24"> | ||
| 92 | + <el-form-item label="日志主键:">{{ form.id }}</el-form-item> | ||
| 93 | + <el-form-item label="链路追踪:">{{ form.traceId }}</el-form-item> | ||
| 94 | + <el-form-item label="应用名:">{{ form.applicationName }}</el-form-item> | ||
| 95 | + <el-form-item label="用户信息:"> | ||
| 96 | + {{ form.userId }} | {{ getDictDataLabel(DICT_TYPE.USER_TYPE, form.userType) }} | {{ form.userIp }} | {{ form.userAgent}} | ||
| 97 | + </el-form-item> | ||
| 98 | + <el-form-item label="请求信息:">{{ form.requestMethod }} | {{ form.requestUrl }} </el-form-item> | ||
| 99 | + <el-form-item label="请求参数:">{{ form.requestParams }}</el-form-item> | ||
| 100 | + <el-form-item label="异常时间:">{{ parseTime(form.exceptionTime) }}</el-form-item> | ||
| 101 | + <el-form-item label="异常名">{{ form.exceptionName }}</el-form-item> | ||
| 102 | + <el-form-item label="异常名"> | ||
| 103 | + <el-input type="textarea" :readonly="true" :autosize="{ maxRows: 20}" v-model="form.exceptionStackTrace"></el-input> | ||
| 104 | + </el-form-item> | ||
| 105 | + <el-form-item label="处理状态"> | ||
| 106 | + {{ getDictDataLabel(DICT_TYPE.INF_API_ERROR_LOG_PROCESS_STATUS, form.processStatus) }} | ||
| 107 | + </el-form-item> | ||
| 108 | + <el-form-item label="处理人">{{ form.processUserId }}</el-form-item> | ||
| 109 | + <el-form-item label="处理时间">{{ parseTime(form.processTime) }}</el-form-item> | ||
| 110 | + </el-col> | ||
| 111 | + </el-row> | ||
| 112 | + </el-form> | ||
| 113 | + <div slot="footer" class="dialog-footer"> | ||
| 114 | + <el-button @click="open = false">关 闭</el-button> | ||
| 115 | + </div> | ||
| 116 | + </el-dialog> | ||
| 117 | + | ||
| 118 | + </div> | ||
| 119 | +</template> | ||
| 120 | + | ||
| 121 | +<script> | ||
| 122 | +import { updateApiErrorLogProcess, getApiErrorLogPage, exportApiErrorLogExcel } from "@/api/infra/apiErrorLog"; | ||
| 123 | +import { InfApiErrorLogProcessStatusEnum } from '@/utils/constants' | ||
| 124 | + | ||
| 125 | +export default { | ||
| 126 | + name: "ApiErrorLog", | ||
| 127 | + components: { | ||
| 128 | + }, | ||
| 129 | + data() { | ||
| 130 | + return { | ||
| 131 | + // 遮罩层 | ||
| 132 | + loading: true, | ||
| 133 | + // 显示搜索条件 | ||
| 134 | + showSearch: true, | ||
| 135 | + // 总条数 | ||
| 136 | + total: 0, | ||
| 137 | + // API 错误日志列表 | ||
| 138 | + list: [], | ||
| 139 | + // 弹出层标题 | ||
| 140 | + title: "", | ||
| 141 | + // 是否显示弹出层 | ||
| 142 | + open: false, | ||
| 143 | + dateRangeExceptionTime: [], | ||
| 144 | + // 查询参数 | ||
| 145 | + queryParams: { | ||
| 146 | + pageNo: 1, | ||
| 147 | + pageSize: 10, | ||
| 148 | + userId: null, | ||
| 149 | + userType: null, | ||
| 150 | + applicationName: null, | ||
| 151 | + requestUrl: null, | ||
| 152 | + processStatus: null, | ||
| 153 | + }, | ||
| 154 | + // 表单参数 | ||
| 155 | + form: {}, | ||
| 156 | + // 枚举 | ||
| 157 | + InfApiErrorLogProcessStatusEnum: InfApiErrorLogProcessStatusEnum, | ||
| 158 | + }; | ||
| 159 | + }, | ||
| 160 | + created() { | ||
| 161 | + this.getList(); | ||
| 162 | + }, | ||
| 163 | + methods: { | ||
| 164 | + /** 查询列表 */ | ||
| 165 | + getList() { | ||
| 166 | + this.loading = true; | ||
| 167 | + // 处理查询参数 | ||
| 168 | + let params = {...this.queryParams}; | ||
| 169 | + this.addBeginAndEndTime(params, this.dateRangeExceptionTime, 'exceptionTime'); | ||
| 170 | + // 执行查询 | ||
| 171 | + getApiErrorLogPage(params).then(response => { | ||
| 172 | + this.list = response.data.list; | ||
| 173 | + this.total = response.data.total; | ||
| 174 | + this.loading = false; | ||
| 175 | + }); | ||
| 176 | + }, | ||
| 177 | + /** 取消按钮 */ | ||
| 178 | + cancel() { | ||
| 179 | + this.open = false; | ||
| 180 | + this.reset(); | ||
| 181 | + }, | ||
| 182 | + /** 表单重置 */ | ||
| 183 | + reset() { | ||
| 184 | + this.form = {}; | ||
| 185 | + this.resetForm("form"); | ||
| 186 | + }, | ||
| 187 | + /** 搜索按钮操作 */ | ||
| 188 | + handleQuery() { | ||
| 189 | + this.queryParams.pageNo = 1; | ||
| 190 | + this.getList(); | ||
| 191 | + }, | ||
| 192 | + /** 重置按钮操作 */ | ||
| 193 | + resetQuery() { | ||
| 194 | + this.dateRangeExceptionTime = []; | ||
| 195 | + this.resetForm("queryForm"); | ||
| 196 | + this.handleQuery(); | ||
| 197 | + }, | ||
| 198 | + /** 详细按钮操作 */ | ||
| 199 | + handleView(row) { | ||
| 200 | + this.open = true; | ||
| 201 | + this.form = row; | ||
| 202 | + }, | ||
| 203 | + /** 处理已处理 / 已忽略的操作 **/ | ||
| 204 | + handleProcessClick(row, processStatus) { | ||
| 205 | + const processStatusText = this.getDictDataLabel(this.DICT_TYPE.INF_API_ERROR_LOG_PROCESS_STATUS, processStatus) | ||
| 206 | + this.$confirm('确认标记为' + processStatusText, '提示', { | ||
| 207 | + type: 'warning', | ||
| 208 | + confirmButtonText: '确定', | ||
| 209 | + cancelButtonText: '取消' | ||
| 210 | + }).then(() => { | ||
| 211 | + updateApiErrorLogProcess(row.id, processStatus).then(() => { | ||
| 212 | + this.msgSuccess("修改成功"); | ||
| 213 | + this.getList(); | ||
| 214 | + }); | ||
| 215 | + }) | ||
| 216 | + }, | ||
| 217 | + /** 导出按钮操作 */ | ||
| 218 | + handleExport() { | ||
| 219 | + // 处理查询参数 | ||
| 220 | + let params = {...this.queryParams}; | ||
| 221 | + params.pageNo = undefined; | ||
| 222 | + params.pageSize = undefined; | ||
| 223 | + this.addBeginAndEndTime(params, this.dateRangeExceptionTime, 'exceptionTime'); | ||
| 224 | + // 执行导出 | ||
| 225 | + this.$confirm('是否确认导出所有API 错误日志数据项?', "警告", { | ||
| 226 | + confirmButtonText: "确定", | ||
| 227 | + cancelButtonText: "取消", | ||
| 228 | + type: "warning" | ||
| 229 | + }).then(function() { | ||
| 230 | + return exportApiErrorLogExcel(params); | ||
| 231 | + }).then(response => { | ||
| 232 | + this.downloadExcel(response, 'API 错误日志.xls'); | ||
| 233 | + }) | ||
| 234 | + } | ||
| 235 | + } | ||
| 236 | +}; | ||
| 237 | +</script> |
src/main/java/cn/iocoder/dashboard/framework/web/core/handler/GlobalExceptionHandler.java
| @@ -48,7 +48,7 @@ import static cn.iocoder.dashboard.common.exception.enums.GlobalErrorCodeConstan | @@ -48,7 +48,7 @@ import static cn.iocoder.dashboard.common.exception.enums.GlobalErrorCodeConstan | ||
| 48 | @Slf4j | 48 | @Slf4j |
| 49 | public class GlobalExceptionHandler { | 49 | public class GlobalExceptionHandler { |
| 50 | 50 | ||
| 51 | - @Value("spring.application.name") | 51 | + @Value("${spring.application.name}") |
| 52 | private String applicationName; | 52 | private String applicationName; |
| 53 | 53 | ||
| 54 | @Resource | 54 | @Resource |
src/main/java/cn/iocoder/dashboard/modules/infra/dal/dataobject/logger/InfApiErrorLogDO.java
| @@ -2,7 +2,7 @@ package cn.iocoder.dashboard.modules.infra.dal.dataobject.logger; | @@ -2,7 +2,7 @@ package cn.iocoder.dashboard.modules.infra.dal.dataobject.logger; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.dashboard.common.enums.UserTypeEnum; | 3 | import cn.iocoder.dashboard.common.enums.UserTypeEnum; |
| 4 | import cn.iocoder.dashboard.framework.mybatis.core.dataobject.BaseDO; | 4 | import cn.iocoder.dashboard.framework.mybatis.core.dataobject.BaseDO; |
| 5 | -import cn.iocoder.dashboard.modules.infra.enums.logger.ApiErrorLogProcessStatusEnum; | 5 | +import cn.iocoder.dashboard.modules.infra.enums.logger.InfApiErrorLogProcessStatusEnum; |
| 6 | import cn.iocoder.dashboard.modules.system.dal.dataobject.user.SysUserDO; | 6 | import cn.iocoder.dashboard.modules.system.dal.dataobject.user.SysUserDO; |
| 7 | import com.baomidou.mybatisplus.annotation.TableName; | 7 | import com.baomidou.mybatisplus.annotation.TableName; |
| 8 | import lombok.*; | 8 | import lombok.*; |
| @@ -136,7 +136,7 @@ public class InfApiErrorLogDO extends BaseDO { | @@ -136,7 +136,7 @@ public class InfApiErrorLogDO extends BaseDO { | ||
| 136 | /** | 136 | /** |
| 137 | * 处理状态 | 137 | * 处理状态 |
| 138 | * | 138 | * |
| 139 | - * 枚举 {@link ApiErrorLogProcessStatusEnum} | 139 | + * 枚举 {@link InfApiErrorLogProcessStatusEnum} |
| 140 | */ | 140 | */ |
| 141 | private Integer processStatus; | 141 | private Integer processStatus; |
| 142 | /** | 142 | /** |
src/main/java/cn/iocoder/dashboard/modules/infra/enums/logger/ApiErrorLogProcessStatusEnum.java renamed to src/main/java/cn/iocoder/dashboard/modules/infra/enums/logger/InfApiErrorLogProcessStatusEnum.java
| @@ -10,7 +10,7 @@ import lombok.Getter; | @@ -10,7 +10,7 @@ import lombok.Getter; | ||
| 10 | */ | 10 | */ |
| 11 | @AllArgsConstructor | 11 | @AllArgsConstructor |
| 12 | @Getter | 12 | @Getter |
| 13 | -public enum ApiErrorLogProcessStatusEnum { | 13 | +public enum InfApiErrorLogProcessStatusEnum { |
| 14 | 14 | ||
| 15 | INIT(0, "未处理"), | 15 | INIT(0, "未处理"), |
| 16 | DONE(1, "已处理"), | 16 | DONE(1, "已处理"), |
src/main/java/cn/iocoder/dashboard/modules/infra/service/logger/impl/InfApiErrorLogServiceImpl.java
| @@ -7,13 +7,14 @@ import cn.iocoder.dashboard.modules.infra.controller.logger.vo.apierrorlog.InfAp | @@ -7,13 +7,14 @@ import cn.iocoder.dashboard.modules.infra.controller.logger.vo.apierrorlog.InfAp | ||
| 7 | import cn.iocoder.dashboard.modules.infra.convert.logger.InfApiErrorLogConvert; | 7 | import cn.iocoder.dashboard.modules.infra.convert.logger.InfApiErrorLogConvert; |
| 8 | import cn.iocoder.dashboard.modules.infra.dal.dataobject.logger.InfApiErrorLogDO; | 8 | import cn.iocoder.dashboard.modules.infra.dal.dataobject.logger.InfApiErrorLogDO; |
| 9 | import cn.iocoder.dashboard.modules.infra.dal.mysql.logger.InfApiErrorLogMapper; | 9 | import cn.iocoder.dashboard.modules.infra.dal.mysql.logger.InfApiErrorLogMapper; |
| 10 | -import cn.iocoder.dashboard.modules.infra.enums.logger.ApiErrorLogProcessStatusEnum; | 10 | +import cn.iocoder.dashboard.modules.infra.enums.logger.InfApiErrorLogProcessStatusEnum; |
| 11 | import cn.iocoder.dashboard.modules.infra.service.logger.InfApiErrorLogService; | 11 | import cn.iocoder.dashboard.modules.infra.service.logger.InfApiErrorLogService; |
| 12 | import org.springframework.scheduling.annotation.Async; | 12 | import org.springframework.scheduling.annotation.Async; |
| 13 | import org.springframework.stereotype.Service; | 13 | import org.springframework.stereotype.Service; |
| 14 | import org.springframework.validation.annotation.Validated; | 14 | import org.springframework.validation.annotation.Validated; |
| 15 | 15 | ||
| 16 | import javax.annotation.Resource; | 16 | import javax.annotation.Resource; |
| 17 | +import java.util.Date; | ||
| 17 | import java.util.List; | 18 | import java.util.List; |
| 18 | 19 | ||
| 19 | import static cn.iocoder.dashboard.common.exception.util.ServiceExceptionUtil.exception; | 20 | import static cn.iocoder.dashboard.common.exception.util.ServiceExceptionUtil.exception; |
| @@ -36,7 +37,7 @@ public class InfApiErrorLogServiceImpl implements InfApiErrorLogService { | @@ -36,7 +37,7 @@ public class InfApiErrorLogServiceImpl implements InfApiErrorLogService { | ||
| 36 | @Async | 37 | @Async |
| 37 | public void createApiErrorLogAsync(ApiErrorLogCreateDTO createDTO) { | 38 | public void createApiErrorLogAsync(ApiErrorLogCreateDTO createDTO) { |
| 38 | InfApiErrorLogDO apiErrorLog = InfApiErrorLogConvert.INSTANCE.convert(createDTO); | 39 | InfApiErrorLogDO apiErrorLog = InfApiErrorLogConvert.INSTANCE.convert(createDTO); |
| 39 | - apiErrorLog.setProcessStatus(ApiErrorLogProcessStatusEnum.INIT.getStatus()); | 40 | + apiErrorLog.setProcessStatus(InfApiErrorLogProcessStatusEnum.INIT.getStatus()); |
| 40 | apiErrorLogMapper.insert(apiErrorLog); | 41 | apiErrorLogMapper.insert(apiErrorLog); |
| 41 | } | 42 | } |
| 42 | 43 | ||
| @@ -56,12 +57,12 @@ public class InfApiErrorLogServiceImpl implements InfApiErrorLogService { | @@ -56,12 +57,12 @@ public class InfApiErrorLogServiceImpl implements InfApiErrorLogService { | ||
| 56 | if (errorLog == null) { | 57 | if (errorLog == null) { |
| 57 | throw exception(API_ERROR_LOG_NOT_FOUND); | 58 | throw exception(API_ERROR_LOG_NOT_FOUND); |
| 58 | } | 59 | } |
| 59 | - if (!ApiErrorLogProcessStatusEnum.INIT.getStatus().equals(errorLog.getProcessStatus())) { | 60 | + if (!InfApiErrorLogProcessStatusEnum.INIT.getStatus().equals(errorLog.getProcessStatus())) { |
| 60 | throw exception(API_ERROR_LOG_PROCESSED); | 61 | throw exception(API_ERROR_LOG_PROCESSED); |
| 61 | } | 62 | } |
| 62 | // 标记处理 | 63 | // 标记处理 |
| 63 | apiErrorLogMapper.updateById(InfApiErrorLogDO.builder().id(id).processStatus(processStatus) | 64 | apiErrorLogMapper.updateById(InfApiErrorLogDO.builder().id(id).processStatus(processStatus) |
| 64 | - .processUserId(processStatus).build()); | 65 | + .processUserId(processStatus).processTime(new Date()).build()); |
| 65 | } | 66 | } |
| 66 | 67 | ||
| 67 | } | 68 | } |
src/main/resources/codegen/sql/sql.vm
| @@ -5,7 +5,7 @@ INSERT INTO `sys_menu`( | @@ -5,7 +5,7 @@ INSERT INTO `sys_menu`( | ||
| 5 | ) | 5 | ) |
| 6 | VALUES ( | 6 | VALUES ( |
| 7 | '${table.classComment}管理', '${permissionPrefix}:query', 2, 0, ${table.parentMenuId}, | 7 | '${table.classComment}管理', '${permissionPrefix}:query', 2, 0, ${table.parentMenuId}, |
| 8 | - '${simpleClassName_strikeCase}', '', '${table.moduleName}/${classNameVar}/index', 1 | 8 | + '${simpleClassName_strikeCase}', '', '${table.moduleName}/${classNameVar}/index', 0 |
| 9 | ); | 9 | ); |
| 10 | 10 | ||
| 11 | -- 按钮父菜单ID | 11 | -- 按钮父菜单ID |
| @@ -22,6 +22,6 @@ INSERT INTO `sys_menu`( | @@ -22,6 +22,6 @@ INSERT INTO `sys_menu`( | ||
| 22 | ) | 22 | ) |
| 23 | VALUES ( | 23 | VALUES ( |
| 24 | '${table.tableComment}${functionName}', '${permissionPrefix}:${functionOps.get($index)}', 3, $foreach.count, @parentId, | 24 | '${table.tableComment}${functionName}', '${permissionPrefix}:${functionOps.get($index)}', 3, $foreach.count, @parentId, |
| 25 | - '', '', '', 1 | 25 | + '', '', '', 0 |
| 26 | ); | 26 | ); |
| 27 | #end | 27 | #end |
src/main/resources/codegen/vue/api/api.js.vm
| @@ -19,7 +19,6 @@ export function update${simpleClassName}(data) { | @@ -19,7 +19,6 @@ export function update${simpleClassName}(data) { | ||
| 19 | }) | 19 | }) |
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | - | ||
| 23 | // 删除${table.classComment} | 22 | // 删除${table.classComment} |
| 24 | export function delete${simpleClassName}(id) { | 23 | export function delete${simpleClassName}(id) { |
| 25 | return request({ | 24 | return request({ |