Browse Source

日志模块 时间转换

zhongwei
段飞宇 2 years ago
parent
commit
43f9d5d336
  1. 9
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/controller/StatisticsController.java
  2. 8
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/controller/SysLogController.java
  3. 2
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/entity/Statistics.java
  4. 35
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/entity/SysLog.java
  5. 4
      hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/vo/StatisticsVo.java

9
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/controller/StatisticsController.java

@ -7,10 +7,13 @@ import com.hnac.hzims.common.logs.annotation.OperationAnnotation;
import com.hnac.hzims.common.logs.enums.BusinessType; import com.hnac.hzims.common.logs.enums.BusinessType;
import com.hnac.hzims.common.logs.enums.OperatorType; import com.hnac.hzims.common.logs.enums.OperatorType;
import com.hnac.hzims.middle.systemlog.entity.Statistics; import com.hnac.hzims.middle.systemlog.entity.Statistics;
import com.hnac.hzims.middle.systemlog.entity.SysLog;
import com.hnac.hzims.middle.systemlog.service.StatisticsService; import com.hnac.hzims.middle.systemlog.service.StatisticsService;
import com.hnac.hzims.middle.systemlog.vo.StatisticsVo; import com.hnac.hzims.middle.systemlog.vo.StatisticsVo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -46,6 +49,9 @@ public class StatisticsController {
operatorType = OperatorType.MANAGE, operatorType = OperatorType.MANAGE,
businessType = BusinessType.INSERT businessType = BusinessType.INSERT
, title = "操作日志统计数据", action = "操作日志统计数据分页查询") , title = "操作日志统计数据", action = "操作日志统计数据分页查询")
@ApiResponses({
@ApiResponse(code = 200,message = "OK",response = Statistics.class),
})
@GetMapping("/selectPage/{page}/{size}") @GetMapping("/selectPage/{page}/{size}")
public R selectPage( public R selectPage(
@PathVariable Long page, @PathVariable Long page,
@ -63,6 +69,9 @@ public class StatisticsController {
* @param id * @param id
* @return * @return
*/ */
@ApiResponses({
@ApiResponse(code = 200,message = "OK",response = Statistics.class),
})
@ApiOperation("根据Id查询日志") @ApiOperation("根据Id查询日志")
@OperationAnnotation(moduleName = "操作日志", @OperationAnnotation(moduleName = "操作日志",
operatorType = OperatorType.MANAGE, operatorType = OperatorType.MANAGE,

8
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/controller/SysLogController.java

@ -15,6 +15,8 @@ import com.hnac.hzims.middle.systemlog.vo.StatisticsVo;
import com.hnac.hzims.middle.systemlog.vo.SysLogVo; import com.hnac.hzims.middle.systemlog.vo.SysLogVo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
@ -82,6 +84,9 @@ public class SysLogController {
,title = "系统日志",action = "日志分页查询") ,title = "系统日志",action = "日志分页查询")
@ApiOperation("日志分页查询") @ApiOperation("日志分页查询")
@GetMapping("/selectPage/{page}/{size}") @GetMapping("/selectPage/{page}/{size}")
@ApiResponses({
@ApiResponse(code = 200,message = "OK",response = SysLog.class),
})
public R selectPage( public R selectPage(
@PathVariable Long page, @PathVariable Long page,
@PathVariable Long size, @PathVariable Long size,
@ -96,6 +101,9 @@ public class SysLogController {
* 根据Id获取日志数据 * 根据Id获取日志数据
* @return * @return
*/ */
@ApiResponses({
@ApiResponse(code = 200,message = "OK",response = SysLog.class),
})
@OperationAnnotation(moduleName = "操作日志", @OperationAnnotation(moduleName = "操作日志",
operatorType = OperatorType.MANAGE, operatorType = OperatorType.MANAGE,
businessType = BusinessType.INSERT businessType = BusinessType.INSERT

2
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/entity/Statistics.java

@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable; import java.io.Serializable;
import java.time.YearMonth; import java.time.YearMonth;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -23,6 +24,7 @@ import lombok.experimental.Accessors;
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Accessors(chain = true) @Accessors(chain = true)
@TableName("hzims_statistics") @TableName("hzims_statistics")
@ApiModel("操作日志统计对象")
public class Statistics implements Serializable { public class Statistics implements Serializable {
private static final long serialVersionUID=1L; private static final long serialVersionUID=1L;

35
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/entity/SysLog.java

@ -1,10 +1,16 @@
package com.hnac.hzims.middle.systemlog.entity; package com.hnac.hzims.middle.systemlog.entity;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.sql.Blob; import java.sql.Blob;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable; import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
@ -21,6 +27,7 @@ import lombok.experimental.Accessors;
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
@Accessors(chain = true) @Accessors(chain = true)
@TableName("hzims_sys_log") @TableName("hzims_sys_log")
@ApiModel("系统日志统计对象")
public class SysLog implements Serializable { public class SysLog implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -35,165 +42,191 @@ public class SysLog implements Serializable {
/** /**
* 功能模块 * 功能模块
*/ */
@ApiModelProperty("功能模块")
@TableField("module_name") @TableField("module_name")
private String moduleName; private String moduleName;
/** /**
* 租户ID * 租户ID
*/ */
@ApiModelProperty("租户ID")
@TableField("tenant_id") @TableField("tenant_id")
private String tenantId; private String tenantId;
/** /**
* 服务器ip * 服务器ip
*/ */
@ApiModelProperty("服务器ip")
@TableField("server_ip") @TableField("server_ip")
private String serverIp; private String serverIp;
/** /**
* 服务器地址 * 服务器地址
*/ */
@ApiModelProperty("服务器地址")
@TableField("server_host") @TableField("server_host")
private String serverHost; private String serverHost;
/** /**
* 服务名称 * 服务名称
*/ */
@ApiModelProperty("服务名称")
@TableField("server_name") @TableField("server_name")
private String serverName; private String serverName;
/** /**
* 环境 * 环境
*/ */
@ApiModelProperty("环境")
@TableField("env") @TableField("env")
private String env; private String env;
/** /**
* 操作人Id * 操作人Id
*/ */
@ApiModelProperty("操作人Id")
@TableField("operation_user_id") @TableField("operation_user_id")
private Long operationUserId; private Long operationUserId;
/** /**
* 操作人名称 * 操作人名称
*/ */
@ApiModelProperty("操作人名称")
@TableField("operation_user_name") @TableField("operation_user_name")
private String operationUserName; private String operationUserName;
/** /**
* 请求路径 操作地址 * 请求路径 操作地址
*/ */
@ApiModelProperty(" 请求路径 (操作地址)")
@TableField("path") @TableField("path")
private String path; private String path;
/** /**
* 用户代理 * 用户代理
*/ */
@ApiModelProperty("用户代理")
@TableField("user_agent") @TableField("user_agent")
private String userAgent; private String userAgent;
/** /**
* 操作方式 * 操作方式
*/ */
@ApiModelProperty("操作方式")
@TableField("method") @TableField("method")
private String method; private String method;
/** /**
* 方法类 * 方法类
*/ */
@ApiModelProperty("方法类")
@TableField("method_class") @TableField("method_class")
private String methodClass; private String methodClass;
/** /**
* 方法名 * 方法名
*/ */
@ApiModelProperty("方法名")
@TableField("method_name") @TableField("method_name")
private String methodName; private String methodName;
/** /**
* 方法执行时间 消耗时间 毫秒 * 方法执行时间 消耗时间 毫秒
*/ */
@ApiModelProperty("方法执行时间 消耗时间 毫秒")
@TableField("cost_time") @TableField("cost_time")
private String costTime; private String costTime;
/** /**
* 方法入参 * 方法入参
*/ */
@ApiModelProperty("方法入参")
@TableField("parameter") @TableField("parameter")
private String parameter; private String parameter;
/** /**
* 操作方法 * 操作方法
*/ */
@ApiModelProperty("操作方法")
@TableField("title") @TableField("title")
private String title; private String title;
/** /**
* 方法描述 * 方法描述
*/ */
@ApiModelProperty("方法描述")
@TableField("action") @TableField("action")
private String action; private String action;
/** /**
* 系统类型 * 系统类型
*/ */
@ApiModelProperty("系统类型")
@TableField("operator_type") @TableField("operator_type")
private String operatorType; private String operatorType;
/** /**
* 操作人类别 * 操作人类别
*/ */
@ApiModelProperty("操作人类别")
@TableField("business_type") @TableField("business_type")
private String businessType; private String businessType;
/** /**
* 返回结果 * 返回结果
*/ */
@ApiModelProperty("返回结果")
@TableField("json_result") @TableField("json_result")
private String jsonResult; private String jsonResult;
/** /**
* 请求的Ip * 请求的Ip
*/ */
@ApiModelProperty("请求的Ip")
@TableField("local_ip") @TableField("local_ip")
private String localIp; private String localIp;
/** /**
* 错误消息 * 错误消息
*/ */
@ApiModelProperty("错误消息")
@TableField("error_msg") @TableField("error_msg")
private String errorMsg; private String errorMsg;
/** /**
* 操作时间 * 操作时间
*/ */
@ApiModelProperty("操作时间")
@TableField("operation_time") @TableField("operation_time")
private LocalDateTime operationTime; private LocalDateTime operationTime;
/** /**
* 操作状态0 正常 1 异常 * 操作状态0 正常 1 异常
*/ */
@ApiModelProperty("操作状态")
@TableField("status") @TableField("status")
private Integer status; private Integer status;
/** /**
* 创建时间 * 创建时间
*/ */
@ApiModelProperty("创建时间")
@TableField("create_time") @TableField("create_time")
private LocalDateTime createTime; private LocalDateTime createTime;
/** /**
* 更新时间 * 更新时间
*/ */
@ApiModelProperty("更新时间")
@TableField("update_time") @TableField("update_time")
private LocalDateTime updateTime; private LocalDateTime updateTime;
/** /**
* 逻辑删除 0 可用 1 删除 * 逻辑删除 0 可用 1 删除
*/ */
@ApiModelProperty("逻辑删除")
@TableField("is_deleted") @TableField("is_deleted")
private Integer isDeleted; private Integer isDeleted;
} }

4
hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/systemlog/vo/StatisticsVo.java

@ -1,5 +1,6 @@
package com.hnac.hzims.middle.systemlog.vo; package com.hnac.hzims.middle.systemlog.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import java.time.LocalDate; import java.time.LocalDate;
@ -24,11 +25,14 @@ public class StatisticsVo {
/** /**
* 开始时间 * 开始时间
*/ */
@JsonFormat(pattern="yyyy-MM-dd ",timezone = "GMT+8",shape = JsonFormat.Shape.STRING)
private LocalDate createTime; private LocalDate createTime;
/** /**
* 结束时间 * 结束时间
*
*/ */
@JsonFormat(pattern="yyyy-MM-dd ",timezone = "GMT+8",shape = JsonFormat.Shape.STRING)
private LocalDate endTime; private LocalDate endTime;
} }

Loading…
Cancel
Save