系统异常日志模块的迁移
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
package cn.iocoder.mall.managementweb.controller.systemlog;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.managementweb.controller.systemlog.dto.SystemExceptionLogPageDTO;
|
||||
import cn.iocoder.mall.managementweb.controller.systemlog.vo.SystemExceptionLogDetailVO;
|
||||
import cn.iocoder.mall.managementweb.controller.systemlog.vo.SystemExceptionLogVO;
|
||||
import cn.iocoder.mall.managementweb.manager.systemlog.SystemExceptionLogManager;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import static cn.iocoder.common.framework.vo.CommonResult.success;
|
||||
|
||||
/**
|
||||
* 系统异常日志 Controller
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system-exception-log")
|
||||
@Api(tags = "系统异常日志")
|
||||
@Validated
|
||||
public class SystemExceptionLogController {
|
||||
|
||||
@Autowired
|
||||
private SystemExceptionLogManager systemExceptionLogManager;
|
||||
|
||||
@GetMapping("/get")
|
||||
@ApiOperation("获得系统异常日志明细")
|
||||
@ApiImplicitParam(name = "logId", value = "系统异常日志编号", required = true)
|
||||
public CommonResult<SystemExceptionLogDetailVO> getSystemExceptionLogDetail(@RequestParam("logId") Integer logId) {
|
||||
return success(systemExceptionLogManager.getSystemExceptionLogDetail(logId));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("获得系统异常日志分页")
|
||||
public CommonResult<PageResult<SystemExceptionLogVO>> pageSystemExceptionLog(SystemExceptionLogPageDTO pageDTO) {
|
||||
return success(systemExceptionLogManager.pageSystemExceptionLog(pageDTO));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,11 +9,11 @@ import lombok.Data;
|
||||
@Data
|
||||
public class SystemAccessLogPageDTO extends PageParam {
|
||||
|
||||
@ApiModelProperty(value = "用户编号")
|
||||
@ApiModelProperty(value = "用户编号", example = "1")
|
||||
private Integer userId;
|
||||
@ApiModelProperty(value = "用户类型")
|
||||
@ApiModelProperty(value = "用户类型", example = "2")
|
||||
private Integer userType;
|
||||
@ApiModelProperty(value = "应用名", required = true)
|
||||
@ApiModelProperty(value = "应用名", example = "xxx-service-application")
|
||||
private String applicationName;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package cn.iocoder.mall.managementweb.controller.systemlog.dto;
|
||||
|
||||
import cn.iocoder.common.framework.vo.PageParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@ApiModel("系统异常日志分页 DTO")
|
||||
@Data
|
||||
public class SystemExceptionLogPageDTO extends PageParam {
|
||||
|
||||
@ApiModelProperty(value = "用户编号", example = "1")
|
||||
private Integer userId;
|
||||
@ApiModelProperty(value = "用户类型", example = "2")
|
||||
private Integer userType;
|
||||
@ApiModelProperty(value = "应用名", example = "xxx-service-application")
|
||||
private String applicationName;
|
||||
@ApiModelProperty(value = "处理状态", notes = "对应 SystemExceptionLogProcessStatusEnum 枚举类", example = "1")
|
||||
private Integer processStatus;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package cn.iocoder.mall.managementweb.controller.systemlog.vo;
|
||||
|
||||
public class SystemExceptionLogDetailVO {
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package cn.iocoder.mall.managementweb.controller.systemlog.vo;
|
||||
|
||||
import lombok.*;
|
||||
import io.swagger.annotations.*;
|
||||
import java.util.*;
|
||||
|
||||
@ApiModel("系统异常日志 VO")
|
||||
@Data
|
||||
public class SystemExceptionLogVO {
|
||||
|
||||
@ApiModelProperty(value = "编号", required = true)
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "用户编号")
|
||||
private Integer userId;
|
||||
@ApiModelProperty(value = "用户类型")
|
||||
private Integer userType;
|
||||
@ApiModelProperty(value = "链路追踪编", required = true)
|
||||
private String traceId;
|
||||
@ApiModelProperty(value = "应用名", required = true, example = "user-shop-application")
|
||||
private String applicationName;
|
||||
@ApiModelProperty(value = "访问地址", required = true, example = "/management-api/system-access-log/page")
|
||||
private String uri;
|
||||
@ApiModelProperty(value = "参数", required = true, example = "pageNo=1&pageSize=10")
|
||||
private String queryString;
|
||||
@ApiModelProperty(value = "http 方法", required = true, example = "GET")
|
||||
private String method;
|
||||
@ApiModelProperty(value = "userAgent", required = true, example = "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0")
|
||||
private String userAgent;
|
||||
@ApiModelProperty(value = "ip", required = true, example = "127.0.0.1")
|
||||
private String ip;
|
||||
@ApiModelProperty(value = "异常发生时间", required = true)
|
||||
private Date exceptionTime;
|
||||
@ApiModelProperty(value = "异常名, {@link Throwable#getClass()} 的类全名", required = true)
|
||||
private String exceptionName;
|
||||
@ApiModelProperty(value = "异常导致的消息, {@link cn.iocoder.common.framework.util.ExceptionUtil#getMessage(Throwable)}", required = true)
|
||||
private String exceptionMessage;
|
||||
@ApiModelProperty(value = "异常导致的根消息, {@link cn.iocoder.common.framework.util.ExceptionUtil#getRootCauseMessage(Throwable)}", required = true)
|
||||
private String exceptionRootCauseMessage;
|
||||
@ApiModelProperty(value = "异常的栈轨迹, {@link cn.iocoder.common.framework.util.ExceptionUtil#getServiceException(Exception)}", required = true)
|
||||
private String exceptionStackTrace;
|
||||
@ApiModelProperty(value = "异常发生的类全名, {@link StackTraceElement#getClassName()}", required = true)
|
||||
private String exceptionClassName;
|
||||
@ApiModelProperty(value = "异常发生的类文件, {@link StackTraceElement#getFileName()}", required = true)
|
||||
private String exceptionFileName;
|
||||
@ApiModelProperty(value = "异常发生的方法名, {@link StackTraceElement#getMethodName()}", required = true)
|
||||
private String exceptionMethodName;
|
||||
@ApiModelProperty(value = "异常发生的方法所在行, {@link StackTraceElement#getLineNumber()}", required = true)
|
||||
private Integer exceptionLineNumber;
|
||||
@ApiModelProperty(value = "处理状态", required = true, notes = "对应 SystemExceptionLogProcessStatusEnum 枚举类", example = "1")
|
||||
private Integer processStatus;
|
||||
@ApiModelProperty(value = "处理时间")
|
||||
private Date processTime;
|
||||
@ApiModelProperty(value = "处理管理员编号", example = "1024")
|
||||
private Integer processAdminId;
|
||||
@ApiModelProperty(value = "创建时间", required = true)
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package cn.iocoder.mall.managementweb.convert.systemlog;
|
||||
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.managementweb.controller.systemlog.vo.SystemExceptionLogVO;
|
||||
import cn.iocoder.mall.systemservice.rpc.systemlog.dto.SystemExceptionLogPageDTO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@Mapper
|
||||
public interface SystemExceptionLogConvert {
|
||||
|
||||
SystemExceptionLogConvert INSTANCE = Mappers.getMapper(SystemExceptionLogConvert.class);
|
||||
|
||||
SystemExceptionLogPageDTO convert(cn.iocoder.mall.managementweb.controller.systemlog.dto.SystemExceptionLogPageDTO bean);
|
||||
|
||||
PageResult<SystemExceptionLogVO> convertPage(PageResult<cn.iocoder.mall.systemservice.rpc.systemlog.vo.SystemExceptionLogVO> page);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package cn.iocoder.mall.managementweb.manager.systemlog;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.managementweb.controller.systemlog.dto.SystemExceptionLogPageDTO;
|
||||
import cn.iocoder.mall.managementweb.controller.systemlog.vo.SystemExceptionLogDetailVO;
|
||||
import cn.iocoder.mall.managementweb.controller.systemlog.vo.SystemExceptionLogVO;
|
||||
import cn.iocoder.mall.managementweb.convert.systemlog.SystemExceptionLogConvert;
|
||||
import cn.iocoder.mall.systemservice.rpc.systemlog.SystemExceptionLogRpc;
|
||||
import org.apache.dubbo.config.annotation.Reference;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 系统异常日志 Manager
|
||||
*/
|
||||
@Service
|
||||
public class SystemExceptionLogManager {
|
||||
|
||||
@Reference(version = "$ {dubbo.consumer.SystemExceptionLogRpc.version}", validation = "false")
|
||||
private SystemExceptionLogRpc systemExceptionLogRpc;
|
||||
|
||||
/**
|
||||
* 获得系统异常日志
|
||||
*
|
||||
* @param systemExceptionLogId 系统异常日志编号
|
||||
* @return 系统异常日志
|
||||
*/
|
||||
public SystemExceptionLogDetailVO getSystemExceptionLogDetail(Integer systemExceptionLogId) {
|
||||
CommonResult<cn.iocoder.mall.systemservice.rpc.systemlog.vo.SystemExceptionLogVO> getSystemExceptionLogResult
|
||||
= systemExceptionLogRpc.getSystemExceptionLog(systemExceptionLogId);
|
||||
getSystemExceptionLogResult.checkError();
|
||||
// return SystemExceptionLogConvert.INSTANCE.convert(getSystemExceptionLogResult.getData());
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得系统异常日志分页
|
||||
*
|
||||
* @param pageDTO 系统异常日志分页查询
|
||||
* @return 系统异常日志分页结果
|
||||
*/
|
||||
public PageResult<SystemExceptionLogVO> pageSystemExceptionLog(SystemExceptionLogPageDTO pageDTO) {
|
||||
CommonResult<PageResult<cn.iocoder.mall.systemservice.rpc.systemlog.vo.SystemExceptionLogVO>> pageSystemExceptionLogResult
|
||||
= systemExceptionLogRpc.pageSystemExceptionLog(SystemExceptionLogConvert.INSTANCE.convert(pageDTO));
|
||||
pageSystemExceptionLogResult.checkError();
|
||||
return SystemExceptionLogConvert.INSTANCE.convertPage(pageSystemExceptionLogResult.getData());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user