【log】更新日志模块

pull/3/head
fengshuonan 2021-02-08 10:30:25 +08:00
parent d00f963142
commit 5319db5560
8 changed files with 21 additions and 16 deletions

View File

@ -48,13 +48,11 @@ public interface LogManagerApi {
void del(LogManagerRequest logManagerRequest);
/**
*
*
*
* @param
* @return
* @author chenjinlong
* @date 2021/2/1 19:47
*/
LogRecordDTO detail(LogManagerRequest logManagerRequest);
}
}

View File

@ -40,5 +40,4 @@ public interface LogRecordApi {
*/
void addBatch(List<LogRecordDTO> logRecords);
}
}

View File

@ -1,5 +1,6 @@
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.rule.exception.AbstractExceptionEnum;
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 LogException(AbstractExceptionEnum exception, Object... params) {
super(LogConstants.LOG_MODULE_NAME, exception.getErrorCode(), StrUtil.format(exception.getUserTip(), params));
}
public LogException(AbstractExceptionEnum exception) {
super(LogConstants.LOG_MODULE_NAME, exception);
}

View File

@ -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{}");
/**
*

View File

@ -22,9 +22,6 @@ import java.util.List;
@Slf4j
public class DbLogManagerServiceImpl implements LogManagerApi {
/**
* service
*/
@Resource
private SysLogService sysLogService;
@ -59,5 +56,4 @@ public class DbLogManagerServiceImpl implements LogManagerApi {
return logRecordDTO;
}
}

View File

@ -50,7 +50,6 @@ public interface SysLogService extends IService<SysLog> {
*/
SysLog detail(LogManagerRequest logManagerParam);
/**
* --
*

View File

@ -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.PageResultFactory;
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.db.entity.SysLog;
import cn.stylefeng.roses.kernel.log.db.mapper.SysLogMapper;
@ -17,6 +18,8 @@ import org.springframework.stereotype.Service;
import java.util.List;
import static cn.stylefeng.roses.kernel.log.api.exception.enums.LogExceptionEnum.LOG_NOT_EXISTED;
/**
* service
*
@ -51,7 +54,6 @@ public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> impleme
return this.getOne(queryWrapper, false);
}
@Override
public List<SysLog> findList(LogManagerRequest logManagerRequest) {
LambdaQueryWrapper<SysLog> wrapper = this.createWrapper(logManagerRequest);
@ -65,7 +67,6 @@ public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> impleme
return PageResultFactory.createPageResult(page);
}
/**
* id
*
@ -74,6 +75,9 @@ public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> impleme
*/
private SysLog querySysLogById(LogManagerRequest logManagerRequest) {
SysLog sysLog = this.getById(logManagerRequest.getLogId());
if (sysLog == null) {
throw new LogException(LOG_NOT_EXISTED, logManagerRequest.getLogId());
}
return sysLog;
}
@ -88,6 +92,7 @@ public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> impleme
String beginDateTime = logManagerRequest.getBeginDateTime();
String endDateTime = logManagerRequest.getEndDateTime();
// SQL条件拼接
String name = logManagerRequest.getLogName();
String appName = logManagerRequest.getAppName();

View File

@ -172,8 +172,6 @@ public class FileLogManagerServiceImpl implements LogManagerApi {
/**
* id
*
* @param
* @return
* @author chenjinlong
* @date 2021/2/1 19:54
*/