Commit 197c4ad9bf159f6f3f08bf07cbdd14001f1e8b16

Authored by YunaiV
1 parent 48c976cf

【功能修复】INFRA:错误日志、访问日志,params 过长的问题

yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiAccessLogServiceImpl.java
1 package cn.iocoder.yudao.module.infra.service.logger; 1 package cn.iocoder.yudao.module.infra.service.logger;
2 2
3 -import cn.hutool.core.util.StrUtil;  
4 import cn.iocoder.yudao.framework.common.pojo.PageResult; 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
5 import cn.iocoder.yudao.framework.common.util.object.BeanUtils; 4 import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
  5 +import cn.iocoder.yudao.framework.common.util.string.StrUtils;
6 import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder; 6 import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
7 import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils; 7 import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils;
8 import cn.iocoder.yudao.module.infra.api.logger.dto.ApiAccessLogCreateReqDTO; 8 import cn.iocoder.yudao.module.infra.api.logger.dto.ApiAccessLogCreateReqDTO;
@@ -35,8 +35,8 @@ public class ApiAccessLogServiceImpl implements ApiAccessLogService { @@ -35,8 +35,8 @@ public class ApiAccessLogServiceImpl implements ApiAccessLogService {
35 @Override 35 @Override
36 public void createApiAccessLog(ApiAccessLogCreateReqDTO createDTO) { 36 public void createApiAccessLog(ApiAccessLogCreateReqDTO createDTO) {
37 ApiAccessLogDO apiAccessLog = BeanUtils.toBean(createDTO, ApiAccessLogDO.class); 37 ApiAccessLogDO apiAccessLog = BeanUtils.toBean(createDTO, ApiAccessLogDO.class);
38 - apiAccessLog.setRequestParams(StrUtil.maxLength(apiAccessLog.getRequestParams(), REQUEST_PARAMS_MAX_LENGTH));  
39 - apiAccessLog.setResultMsg(StrUtil.maxLength(apiAccessLog.getResultMsg(), RESULT_MSG_MAX_LENGTH)); 38 + apiAccessLog.setRequestParams(StrUtils.maxLength(apiAccessLog.getRequestParams(), REQUEST_PARAMS_MAX_LENGTH));
  39 + apiAccessLog.setResultMsg(StrUtils.maxLength(apiAccessLog.getResultMsg(), RESULT_MSG_MAX_LENGTH));
40 if (TenantContextHolder.getTenantId() != null) { 40 if (TenantContextHolder.getTenantId() != null) {
41 apiAccessLogMapper.insert(apiAccessLog); 41 apiAccessLogMapper.insert(apiAccessLog);
42 } else { 42 } else {
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogServiceImpl.java
1 package cn.iocoder.yudao.module.infra.service.logger; 1 package cn.iocoder.yudao.module.infra.service.logger;
2 2
3 -import cn.hutool.core.util.StrUtil;  
4 import cn.iocoder.yudao.framework.common.pojo.PageResult; 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
5 import cn.iocoder.yudao.framework.common.util.object.BeanUtils; 4 import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
  5 +import cn.iocoder.yudao.framework.common.util.string.StrUtils;
6 import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder; 6 import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
7 import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils; 7 import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils;
8 import cn.iocoder.yudao.module.infra.api.logger.dto.ApiErrorLogCreateReqDTO; 8 import cn.iocoder.yudao.module.infra.api.logger.dto.ApiErrorLogCreateReqDTO;
@@ -39,7 +39,7 @@ public class ApiErrorLogServiceImpl implements ApiErrorLogService { @@ -39,7 +39,7 @@ public class ApiErrorLogServiceImpl implements ApiErrorLogService {
39 public void createApiErrorLog(ApiErrorLogCreateReqDTO createDTO) { 39 public void createApiErrorLog(ApiErrorLogCreateReqDTO createDTO) {
40 ApiErrorLogDO apiErrorLog = BeanUtils.toBean(createDTO, ApiErrorLogDO.class) 40 ApiErrorLogDO apiErrorLog = BeanUtils.toBean(createDTO, ApiErrorLogDO.class)
41 .setProcessStatus(ApiErrorLogProcessStatusEnum.INIT.getStatus()); 41 .setProcessStatus(ApiErrorLogProcessStatusEnum.INIT.getStatus());
42 - apiErrorLog.setRequestParams(StrUtil.maxLength(apiErrorLog.getRequestParams(), REQUEST_PARAMS_MAX_LENGTH)); 42 + apiErrorLog.setRequestParams(StrUtils.maxLength(apiErrorLog.getRequestParams(), REQUEST_PARAMS_MAX_LENGTH));
43 if (TenantContextHolder.getTenantId() != null) { 43 if (TenantContextHolder.getTenantId() != null) {
44 apiErrorLogMapper.insert(apiErrorLog); 44 apiErrorLogMapper.insert(apiErrorLog);
45 } else { 45 } else {