mirror of https://gitee.com/stylefeng/roses
【log】更新日志模块
parent
d00f963142
commit
5319db5560
|
@ -48,10 +48,8 @@ public interface LogManagerApi {
|
||||||
void del(LogManagerRequest logManagerRequest);
|
void del(LogManagerRequest logManagerRequest);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 详情
|
* 查询日志详情
|
||||||
*
|
*
|
||||||
* @param
|
|
||||||
* @return
|
|
||||||
* @author chenjinlong
|
* @author chenjinlong
|
||||||
* @date 2021/2/1 19:47
|
* @date 2021/2/1 19:47
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -40,5 +40,4 @@ public interface LogRecordApi {
|
||||||
*/
|
*/
|
||||||
void addBatch(List<LogRecordDTO> logRecords);
|
void addBatch(List<LogRecordDTO> logRecords);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
package cn.stylefeng.roses.kernel.log.api.exception;
|
package cn.stylefeng.roses.kernel.log.api.exception;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.stylefeng.roses.kernel.log.api.constants.LogConstants;
|
import cn.stylefeng.roses.kernel.log.api.constants.LogConstants;
|
||||||
import cn.stylefeng.roses.kernel.rule.exception.AbstractExceptionEnum;
|
import cn.stylefeng.roses.kernel.rule.exception.AbstractExceptionEnum;
|
||||||
import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException;
|
import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException;
|
||||||
|
@ -12,6 +13,10 @@ import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException;
|
||||||
*/
|
*/
|
||||||
public class LogException extends ServiceException {
|
public class LogException extends ServiceException {
|
||||||
|
|
||||||
|
public LogException(AbstractExceptionEnum exception, Object... params) {
|
||||||
|
super(LogConstants.LOG_MODULE_NAME, exception.getErrorCode(), StrUtil.format(exception.getUserTip(), params));
|
||||||
|
}
|
||||||
|
|
||||||
public LogException(AbstractExceptionEnum exception) {
|
public LogException(AbstractExceptionEnum exception) {
|
||||||
super(LogConstants.LOG_MODULE_NAME, exception);
|
super(LogConstants.LOG_MODULE_NAME, exception);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,12 @@ public enum LogExceptionEnum implements AbstractExceptionEnum {
|
||||||
/**
|
/**
|
||||||
* 初始化日志记录表失败,执行查询语句失败
|
* 初始化日志记录表失败,执行查询语句失败
|
||||||
*/
|
*/
|
||||||
LOG_SQL_EXE_ERROR(RuleConstants.BUSINESS_ERROR_TYPE_CODE + LogConstants.LOG_EXCEPTION_STEP_CODE + "04", "初始化日志记录表失败,执行查询语句失败");
|
LOG_SQL_EXE_ERROR(RuleConstants.BUSINESS_ERROR_TYPE_CODE + LogConstants.LOG_EXCEPTION_STEP_CODE + "04", "初始化日志记录表失败,执行查询语句失败"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 被查询日志不存在
|
||||||
|
*/
|
||||||
|
LOG_NOT_EXISTED(RuleConstants.BUSINESS_ERROR_TYPE_CODE + LogConstants.LOG_EXCEPTION_STEP_CODE + "05", "被查询日志不存在,日志id:{}");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 错误编码
|
* 错误编码
|
||||||
|
|
|
@ -22,9 +22,6 @@ import java.util.List;
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class DbLogManagerServiceImpl implements LogManagerApi {
|
public class DbLogManagerServiceImpl implements LogManagerApi {
|
||||||
|
|
||||||
/**
|
|
||||||
* 日志记录 service接口
|
|
||||||
*/
|
|
||||||
@Resource
|
@Resource
|
||||||
private SysLogService sysLogService;
|
private SysLogService sysLogService;
|
||||||
|
|
||||||
|
@ -59,5 +56,4 @@ public class DbLogManagerServiceImpl implements LogManagerApi {
|
||||||
return logRecordDTO;
|
return logRecordDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,6 @@ public interface SysLogService extends IService<SysLog> {
|
||||||
*/
|
*/
|
||||||
SysLog detail(LogManagerRequest logManagerParam);
|
SysLog detail(LogManagerRequest logManagerParam);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询-列表-按实体对象
|
* 查询-列表-按实体对象
|
||||||
*
|
*
|
||||||
|
|
|
@ -6,6 +6,7 @@ import cn.hutool.core.util.StrUtil;
|
||||||
import cn.stylefeng.roses.kernel.db.api.factory.PageFactory;
|
import cn.stylefeng.roses.kernel.db.api.factory.PageFactory;
|
||||||
import cn.stylefeng.roses.kernel.db.api.factory.PageResultFactory;
|
import cn.stylefeng.roses.kernel.db.api.factory.PageResultFactory;
|
||||||
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
|
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
|
||||||
|
import cn.stylefeng.roses.kernel.log.api.exception.LogException;
|
||||||
import cn.stylefeng.roses.kernel.log.api.pojo.manage.LogManagerRequest;
|
import cn.stylefeng.roses.kernel.log.api.pojo.manage.LogManagerRequest;
|
||||||
import cn.stylefeng.roses.kernel.log.db.entity.SysLog;
|
import cn.stylefeng.roses.kernel.log.db.entity.SysLog;
|
||||||
import cn.stylefeng.roses.kernel.log.db.mapper.SysLogMapper;
|
import cn.stylefeng.roses.kernel.log.db.mapper.SysLogMapper;
|
||||||
|
@ -17,6 +18,8 @@ import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.stylefeng.roses.kernel.log.api.exception.enums.LogExceptionEnum.LOG_NOT_EXISTED;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 日志记录 service接口实现类
|
* 日志记录 service接口实现类
|
||||||
*
|
*
|
||||||
|
@ -51,7 +54,6 @@ public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> impleme
|
||||||
return this.getOne(queryWrapper, false);
|
return this.getOne(queryWrapper, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SysLog> findList(LogManagerRequest logManagerRequest) {
|
public List<SysLog> findList(LogManagerRequest logManagerRequest) {
|
||||||
LambdaQueryWrapper<SysLog> wrapper = this.createWrapper(logManagerRequest);
|
LambdaQueryWrapper<SysLog> wrapper = this.createWrapper(logManagerRequest);
|
||||||
|
@ -65,7 +67,6 @@ public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> impleme
|
||||||
return PageResultFactory.createPageResult(page);
|
return PageResultFactory.createPageResult(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据主键id获取对象
|
* 根据主键id获取对象
|
||||||
*
|
*
|
||||||
|
@ -74,6 +75,9 @@ public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> impleme
|
||||||
*/
|
*/
|
||||||
private SysLog querySysLogById(LogManagerRequest logManagerRequest) {
|
private SysLog querySysLogById(LogManagerRequest logManagerRequest) {
|
||||||
SysLog sysLog = this.getById(logManagerRequest.getLogId());
|
SysLog sysLog = this.getById(logManagerRequest.getLogId());
|
||||||
|
if (sysLog == null) {
|
||||||
|
throw new LogException(LOG_NOT_EXISTED, logManagerRequest.getLogId());
|
||||||
|
}
|
||||||
return sysLog;
|
return sysLog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,6 +92,7 @@ public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> impleme
|
||||||
|
|
||||||
String beginDateTime = logManagerRequest.getBeginDateTime();
|
String beginDateTime = logManagerRequest.getBeginDateTime();
|
||||||
String endDateTime = logManagerRequest.getEndDateTime();
|
String endDateTime = logManagerRequest.getEndDateTime();
|
||||||
|
|
||||||
// SQL条件拼接
|
// SQL条件拼接
|
||||||
String name = logManagerRequest.getLogName();
|
String name = logManagerRequest.getLogName();
|
||||||
String appName = logManagerRequest.getAppName();
|
String appName = logManagerRequest.getAppName();
|
||||||
|
|
|
@ -172,8 +172,6 @@ public class FileLogManagerServiceImpl implements LogManagerApi {
|
||||||
/**
|
/**
|
||||||
* 根据id获取日志记录
|
* 根据id获取日志记录
|
||||||
*
|
*
|
||||||
* @param
|
|
||||||
* @return
|
|
||||||
* @author chenjinlong
|
* @author chenjinlong
|
||||||
* @date 2021/2/1 19:54
|
* @date 2021/2/1 19:54
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue