mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-22 15:21:53 +08:00
完成 API 异常日志
This commit is contained in:
parent
1b3e665be6
commit
172574c3c8
@ -34,6 +34,7 @@
|
|||||||
|
|
||||||
1. 配置管理:对系统动态配置常用参数
|
1. 配置管理:对系统动态配置常用参数
|
||||||
1. 定时任务:在线(添加、修改、删除)任务调度包含执行结果日志
|
1. 定时任务:在线(添加、修改、删除)任务调度包含执行结果日志
|
||||||
|
1. API 日志:包括 RESTful API 访问日志、异常日志两部分,方便排查 API 相关的问题
|
||||||
1. MySQL 监控:监视当前系统数据库连接池状态,可进行分析SQL找出系统性能瓶颈
|
1. MySQL 监控:监视当前系统数据库连接池状态,可进行分析SQL找出系统性能瓶颈
|
||||||
1. Redis 监控:监控 Redis 数据库的使用情况,使用的 Redis Key 管理
|
1. Redis 监控:监控 Redis 数据库的使用情况,使用的 Redis Key 管理
|
||||||
1. Java 监控:基于 Spring Boot Admin 实现 Java 应用的监控
|
1. Java 监控:基于 Spring Boot Admin 实现 Java 应用的监控
|
||||||
|
28
ruoyi-ui/src/api/infra/apiErrorLog.js
Normal file
28
ruoyi-ui/src/api/infra/apiErrorLog.js
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 更新 API 错误日志的处理状态
|
||||||
|
export function updateApiErrorLogProcess(id, processStatus) {
|
||||||
|
return request({
|
||||||
|
url: '/infra/api-error-log/update-status?id=' + id + '&processStatus=' + processStatus,
|
||||||
|
method: 'put',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获得API 错误日志分页
|
||||||
|
export function getApiErrorLogPage(query) {
|
||||||
|
return request({
|
||||||
|
url: '/infra/api-error-log/page',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导出API 错误日志 Excel
|
||||||
|
export function exportApiErrorLogExcel(query) {
|
||||||
|
return request({
|
||||||
|
url: '/infra/api-error-log/export-excel',
|
||||||
|
method: 'get',
|
||||||
|
params: query,
|
||||||
|
responseType: 'blob'
|
||||||
|
})
|
||||||
|
}
|
@ -57,3 +57,12 @@ export const InfJobStatusEnum = {
|
|||||||
NORMAL: 1, // 运行中
|
NORMAL: 1, // 运行中
|
||||||
STOP: 2, // 暂停运行
|
STOP: 2, // 暂停运行
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API 异常数据的处理状态
|
||||||
|
*/
|
||||||
|
export const InfApiErrorLogProcessStatusEnum = {
|
||||||
|
INIT: 0, // 未处理
|
||||||
|
DONE: 1, // 已处理
|
||||||
|
IGNORE: 2, // 已忽略
|
||||||
|
}
|
||||||
|
@ -21,6 +21,7 @@ export const DICT_TYPE = {
|
|||||||
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',
|
||||||
INF_JOB_LOG_STATUS: 'inf_job_log_status',
|
INF_JOB_LOG_STATUS: 'inf_job_log_status',
|
||||||
|
INF_API_ERROR_LOG_PROCESS_STATUS: 'inf_api_error_log_process_status',
|
||||||
|
|
||||||
TOOL_CODEGEN_TEMPLATE_TYPE: 'tool_codegen_template_type',
|
TOOL_CODEGEN_TEMPLATE_TYPE: 'tool_codegen_template_type',
|
||||||
}
|
}
|
||||||
|
@ -81,14 +81,14 @@
|
|||||||
<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-dialog title="API 访问日志详细" :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="100px" 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-form-item label="链路追踪:">{{ form.traceId }}</el-form-item>
|
<el-form-item label="链路追踪:">{{ form.traceId }}</el-form-item>
|
||||||
<el-form-item label="链路追踪:">{{ form.applicationName }}</el-form-item>
|
<el-form-item label="应用名:">{{ form.applicationName }}</el-form-item>
|
||||||
<el-form-item label="用户信息:">
|
<el-form-item label="用户信息:">
|
||||||
{{ form.userId }} | {{ getDictDataLabel(DICT_TYPE.USER_TYPE, form.userType) }} | {{ form.userIp }} | {{ form.userAgent}}
|
{{ form.userId }} | {{ getDictDataLabel(DICT_TYPE.USER_TYPE, form.userType) }} | {{ form.userIp }} | {{ form.userAgent}}
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -173,23 +173,7 @@ export default {
|
|||||||
},
|
},
|
||||||
/** 表单重置 */
|
/** 表单重置 */
|
||||||
reset() {
|
reset() {
|
||||||
this.form = {
|
this.form = {};
|
||||||
id: undefined,
|
|
||||||
traceId: undefined,
|
|
||||||
userId: undefined,
|
|
||||||
userType: undefined,
|
|
||||||
applicationName: undefined,
|
|
||||||
requestMethod: undefined,
|
|
||||||
requestUrl: undefined,
|
|
||||||
requestParams: undefined,
|
|
||||||
userIp: undefined,
|
|
||||||
userAgent: undefined,
|
|
||||||
beginTime: undefined,
|
|
||||||
endTime: undefined,
|
|
||||||
duration: undefined,
|
|
||||||
resultCode: undefined,
|
|
||||||
resultMsg: undefined,
|
|
||||||
};
|
|
||||||
this.resetForm("form");
|
this.resetForm("form");
|
||||||
},
|
},
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
|
237
ruoyi-ui/src/views/infra/apiErrorLog/index.vue
Normal file
237
ruoyi-ui/src/views/infra/apiErrorLog/index.vue
Normal file
@ -0,0 +1,237 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
|
||||||
|
<!-- 搜索工作栏 -->
|
||||||
|
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
|
<el-form-item label="用户编号" prop="userId">
|
||||||
|
<el-input v-model="queryParams.userId" placeholder="请输入用户编号" clearable size="small" @keyup.enter.native="handleQuery"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="用户类型" prop="userType">
|
||||||
|
<el-select v-model="queryParams.userType" placeholder="请选择用户类型" clearable size="small">
|
||||||
|
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.USER_TYPE)"
|
||||||
|
:key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="应用名" prop="applicationName">
|
||||||
|
<el-input v-model="queryParams.applicationName" placeholder="请输入应用名" clearable size="small" @keyup.enter.native="handleQuery"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="请求地址" prop="requestUrl">
|
||||||
|
<el-input v-model="queryParams.requestUrl" placeholder="请输入请求地址" clearable size="small" @keyup.enter.native="handleQuery"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="异常时间">
|
||||||
|
<el-date-picker v-model="dateRangeExceptionTime" size="small" style="width: 240px" value-format="yyyy-MM-dd"
|
||||||
|
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="处理状态" prop="processStatus">
|
||||||
|
<el-select v-model="queryParams.processStatus" placeholder="请选择处理状态" clearable size="small">
|
||||||
|
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.INF_API_ERROR_LOG_PROCESS_STATUS)"
|
||||||
|
:key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<!-- 操作工具栏 -->
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
|
||||||
|
v-hasPermi="['infra:api-error-log:export']">导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<!-- 列表 -->
|
||||||
|
<el-table v-loading="loading" :data="list">
|
||||||
|
<el-table-column label="日志编号" align="center" prop="id" />
|
||||||
|
<el-table-column label="用户编号" align="center" prop="userId" />
|
||||||
|
<el-table-column label="用户类型" align="center" prop="userType">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ getDictDataLabel(DICT_TYPE.USER_TYPE, scope.row.userType) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>>
|
||||||
|
<el-table-column label="应用名" align="center" prop="applicationName" />
|
||||||
|
<el-table-column label="请求方法名" align="center" prop="requestMethod" />
|
||||||
|
<el-table-column label="请求地址" align="center" prop="requestUrl" width="250" />
|
||||||
|
<el-table-column label="异常发生时间" align="center" prop="exceptionTime" width="180">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ parseTime(scope.row.exceptionTime) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="异常名" align="center" prop="exceptionName" width="250" />
|
||||||
|
<el-table-column label="处理状态" align="center" prop="processStatus">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ getDictDataLabel(DICT_TYPE.INF_API_ERROR_LOG_PROCESS_STATUS, scope.row.processStatus) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button size="mini" type="text" icon="el-icon-view" @click="handleView(scope.row,scope.index)"
|
||||||
|
v-hasPermi="['infra:api-access-log:query']">详细</el-button>
|
||||||
|
<el-button type="text" size="mini" icon="el-icon-check"
|
||||||
|
v-if="scope.row.processStatus === InfApiErrorLogProcessStatusEnum.INIT" v-hasPermi="['infra:api-error-log:update-status']"
|
||||||
|
@click="handleProcessClick(scope.row, InfApiErrorLogProcessStatusEnum.DONE)">已处理</el-button>
|
||||||
|
<el-button type="text" size="mini" icon="el-icon-check"
|
||||||
|
v-if="scope.row.processStatus === InfApiErrorLogProcessStatusEnum.INIT" v-hasPermi="['infra:api-error-log:update-status']"
|
||||||
|
@click="handleProcessClick(scope.row, InfApiErrorLogProcessStatusEnum.IGNORE)">已忽略</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<!-- 分页组件 -->
|
||||||
|
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"/>
|
||||||
|
|
||||||
|
<!-- 查看明细 -->
|
||||||
|
<el-dialog title="API 异常日志详细" :visible.sync="open" width="1280px" 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-form-item label="链路追踪:">{{ form.traceId }}</el-form-item>
|
||||||
|
<el-form-item label="应用名:">{{ form.applicationName }}</el-form-item>
|
||||||
|
<el-form-item label="用户信息:">
|
||||||
|
{{ form.userId }} | {{ getDictDataLabel(DICT_TYPE.USER_TYPE, form.userType) }} | {{ form.userIp }} | {{ form.userAgent}}
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="请求信息:">{{ form.requestMethod }} | {{ form.requestUrl }} </el-form-item>
|
||||||
|
<el-form-item label="请求参数:">{{ form.requestParams }}</el-form-item>
|
||||||
|
<el-form-item label="异常时间:">{{ parseTime(form.exceptionTime) }}</el-form-item>
|
||||||
|
<el-form-item label="异常名">{{ form.exceptionName }}</el-form-item>
|
||||||
|
<el-form-item label="异常名">
|
||||||
|
<el-input type="textarea" :readonly="true" :autosize="{ maxRows: 20}" v-model="form.exceptionStackTrace"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="处理状态">
|
||||||
|
{{ getDictDataLabel(DICT_TYPE.INF_API_ERROR_LOG_PROCESS_STATUS, form.processStatus) }}
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="处理人">{{ form.processUserId }}</el-form-item>
|
||||||
|
<el-form-item label="处理时间">{{ parseTime(form.processTime) }}</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>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { updateApiErrorLogProcess, getApiErrorLogPage, exportApiErrorLogExcel } from "@/api/infra/apiErrorLog";
|
||||||
|
import { InfApiErrorLogProcessStatusEnum } from '@/utils/constants'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "ApiErrorLog",
|
||||||
|
components: {
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// API 错误日志列表
|
||||||
|
list: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
dateRangeExceptionTime: [],
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
userId: null,
|
||||||
|
userType: null,
|
||||||
|
applicationName: null,
|
||||||
|
requestUrl: null,
|
||||||
|
processStatus: null,
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 枚举
|
||||||
|
InfApiErrorLogProcessStatusEnum: InfApiErrorLogProcessStatusEnum,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 查询列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
// 处理查询参数
|
||||||
|
let params = {...this.queryParams};
|
||||||
|
this.addBeginAndEndTime(params, this.dateRangeExceptionTime, 'exceptionTime');
|
||||||
|
// 执行查询
|
||||||
|
getApiErrorLogPage(params).then(response => {
|
||||||
|
this.list = response.data.list;
|
||||||
|
this.total = response.data.total;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 取消按钮 */
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
/** 表单重置 */
|
||||||
|
reset() {
|
||||||
|
this.form = {};
|
||||||
|
this.resetForm("form");
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNo = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.dateRangeExceptionTime = [];
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
/** 详细按钮操作 */
|
||||||
|
handleView(row) {
|
||||||
|
this.open = true;
|
||||||
|
this.form = row;
|
||||||
|
},
|
||||||
|
/** 处理已处理 / 已忽略的操作 **/
|
||||||
|
handleProcessClick(row, processStatus) {
|
||||||
|
const processStatusText = this.getDictDataLabel(this.DICT_TYPE.INF_API_ERROR_LOG_PROCESS_STATUS, processStatus)
|
||||||
|
this.$confirm('确认标记为' + processStatusText, '提示', {
|
||||||
|
type: 'warning',
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消'
|
||||||
|
}).then(() => {
|
||||||
|
updateApiErrorLogProcess(row.id, processStatus).then(() => {
|
||||||
|
this.msgSuccess("修改成功");
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
handleExport() {
|
||||||
|
// 处理查询参数
|
||||||
|
let params = {...this.queryParams};
|
||||||
|
params.pageNo = undefined;
|
||||||
|
params.pageSize = undefined;
|
||||||
|
this.addBeginAndEndTime(params, this.dateRangeExceptionTime, 'exceptionTime');
|
||||||
|
// 执行导出
|
||||||
|
this.$confirm('是否确认导出所有API 错误日志数据项?', "警告", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning"
|
||||||
|
}).then(function() {
|
||||||
|
return exportApiErrorLogExcel(params);
|
||||||
|
}).then(response => {
|
||||||
|
this.downloadExcel(response, 'API 错误日志.xls');
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
@ -48,7 +48,7 @@ import static cn.iocoder.dashboard.common.exception.enums.GlobalErrorCodeConstan
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class GlobalExceptionHandler {
|
public class GlobalExceptionHandler {
|
||||||
|
|
||||||
@Value("spring.application.name")
|
@Value("${spring.application.name}")
|
||||||
private String applicationName;
|
private String applicationName;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
|
@ -2,7 +2,7 @@ package cn.iocoder.dashboard.modules.infra.dal.dataobject.logger;
|
|||||||
|
|
||||||
import cn.iocoder.dashboard.common.enums.UserTypeEnum;
|
import cn.iocoder.dashboard.common.enums.UserTypeEnum;
|
||||||
import cn.iocoder.dashboard.framework.mybatis.core.dataobject.BaseDO;
|
import cn.iocoder.dashboard.framework.mybatis.core.dataobject.BaseDO;
|
||||||
import cn.iocoder.dashboard.modules.infra.enums.logger.ApiErrorLogProcessStatusEnum;
|
import cn.iocoder.dashboard.modules.infra.enums.logger.InfApiErrorLogProcessStatusEnum;
|
||||||
import cn.iocoder.dashboard.modules.system.dal.dataobject.user.SysUserDO;
|
import cn.iocoder.dashboard.modules.system.dal.dataobject.user.SysUserDO;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
@ -136,7 +136,7 @@ public class InfApiErrorLogDO extends BaseDO {
|
|||||||
/**
|
/**
|
||||||
* 处理状态
|
* 处理状态
|
||||||
*
|
*
|
||||||
* 枚举 {@link ApiErrorLogProcessStatusEnum}
|
* 枚举 {@link InfApiErrorLogProcessStatusEnum}
|
||||||
*/
|
*/
|
||||||
private Integer processStatus;
|
private Integer processStatus;
|
||||||
/**
|
/**
|
||||||
|
@ -10,7 +10,7 @@ import lombok.Getter;
|
|||||||
*/
|
*/
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Getter
|
@Getter
|
||||||
public enum ApiErrorLogProcessStatusEnum {
|
public enum InfApiErrorLogProcessStatusEnum {
|
||||||
|
|
||||||
INIT(0, "未处理"),
|
INIT(0, "未处理"),
|
||||||
DONE(1, "已处理"),
|
DONE(1, "已处理"),
|
@ -7,13 +7,14 @@ import cn.iocoder.dashboard.modules.infra.controller.logger.vo.apierrorlog.InfAp
|
|||||||
import cn.iocoder.dashboard.modules.infra.convert.logger.InfApiErrorLogConvert;
|
import cn.iocoder.dashboard.modules.infra.convert.logger.InfApiErrorLogConvert;
|
||||||
import cn.iocoder.dashboard.modules.infra.dal.dataobject.logger.InfApiErrorLogDO;
|
import cn.iocoder.dashboard.modules.infra.dal.dataobject.logger.InfApiErrorLogDO;
|
||||||
import cn.iocoder.dashboard.modules.infra.dal.mysql.logger.InfApiErrorLogMapper;
|
import cn.iocoder.dashboard.modules.infra.dal.mysql.logger.InfApiErrorLogMapper;
|
||||||
import cn.iocoder.dashboard.modules.infra.enums.logger.ApiErrorLogProcessStatusEnum;
|
import cn.iocoder.dashboard.modules.infra.enums.logger.InfApiErrorLogProcessStatusEnum;
|
||||||
import cn.iocoder.dashboard.modules.infra.service.logger.InfApiErrorLogService;
|
import cn.iocoder.dashboard.modules.infra.service.logger.InfApiErrorLogService;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static cn.iocoder.dashboard.common.exception.util.ServiceExceptionUtil.exception;
|
import static cn.iocoder.dashboard.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
@ -36,7 +37,7 @@ public class InfApiErrorLogServiceImpl implements InfApiErrorLogService {
|
|||||||
@Async
|
@Async
|
||||||
public void createApiErrorLogAsync(ApiErrorLogCreateDTO createDTO) {
|
public void createApiErrorLogAsync(ApiErrorLogCreateDTO createDTO) {
|
||||||
InfApiErrorLogDO apiErrorLog = InfApiErrorLogConvert.INSTANCE.convert(createDTO);
|
InfApiErrorLogDO apiErrorLog = InfApiErrorLogConvert.INSTANCE.convert(createDTO);
|
||||||
apiErrorLog.setProcessStatus(ApiErrorLogProcessStatusEnum.INIT.getStatus());
|
apiErrorLog.setProcessStatus(InfApiErrorLogProcessStatusEnum.INIT.getStatus());
|
||||||
apiErrorLogMapper.insert(apiErrorLog);
|
apiErrorLogMapper.insert(apiErrorLog);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,12 +57,12 @@ public class InfApiErrorLogServiceImpl implements InfApiErrorLogService {
|
|||||||
if (errorLog == null) {
|
if (errorLog == null) {
|
||||||
throw exception(API_ERROR_LOG_NOT_FOUND);
|
throw exception(API_ERROR_LOG_NOT_FOUND);
|
||||||
}
|
}
|
||||||
if (!ApiErrorLogProcessStatusEnum.INIT.getStatus().equals(errorLog.getProcessStatus())) {
|
if (!InfApiErrorLogProcessStatusEnum.INIT.getStatus().equals(errorLog.getProcessStatus())) {
|
||||||
throw exception(API_ERROR_LOG_PROCESSED);
|
throw exception(API_ERROR_LOG_PROCESSED);
|
||||||
}
|
}
|
||||||
// 标记处理
|
// 标记处理
|
||||||
apiErrorLogMapper.updateById(InfApiErrorLogDO.builder().id(id).processStatus(processStatus)
|
apiErrorLogMapper.updateById(InfApiErrorLogDO.builder().id(id).processStatus(processStatus)
|
||||||
.processUserId(processStatus).build());
|
.processUserId(processStatus).processTime(new Date()).build());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ INSERT INTO `sys_menu`(
|
|||||||
)
|
)
|
||||||
VALUES (
|
VALUES (
|
||||||
'${table.classComment}管理', '${permissionPrefix}:query', 2, 0, ${table.parentMenuId},
|
'${table.classComment}管理', '${permissionPrefix}:query', 2, 0, ${table.parentMenuId},
|
||||||
'${simpleClassName_strikeCase}', '', '${table.moduleName}/${classNameVar}/index', 1
|
'${simpleClassName_strikeCase}', '', '${table.moduleName}/${classNameVar}/index', 0
|
||||||
);
|
);
|
||||||
|
|
||||||
-- 按钮父菜单ID
|
-- 按钮父菜单ID
|
||||||
@ -22,6 +22,6 @@ INSERT INTO `sys_menu`(
|
|||||||
)
|
)
|
||||||
VALUES (
|
VALUES (
|
||||||
'${table.tableComment}${functionName}', '${permissionPrefix}:${functionOps.get($index)}', 3, $foreach.count, @parentId,
|
'${table.tableComment}${functionName}', '${permissionPrefix}:${functionOps.get($index)}', 3, $foreach.count, @parentId,
|
||||||
'', '', '', 1
|
'', '', '', 0
|
||||||
);
|
);
|
||||||
#end
|
#end
|
||||||
|
@ -19,7 +19,6 @@ export function update${simpleClassName}(data) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 删除${table.classComment}
|
// 删除${table.classComment}
|
||||||
export function delete${simpleClassName}(id) {
|
export function delete${simpleClassName}(id) {
|
||||||
return request({
|
return request({
|
||||||
|
Loading…
Reference in New Issue
Block a user