|
@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.infra.service.logger;
|
|
|
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
+import cn.net.redstone.framework.common.util.string.StrUtils;
|
|
|
import cn.iocoder.yudao.module.infra.api.logger.dto.ApiAccessLogCreateReqDTO;
|
|
|
import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogPageReqVO;
|
|
|
import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiAccessLogDO;
|
|
@@ -13,6 +14,9 @@ import org.springframework.validation.annotation.Validated;
|
|
|
import jakarta.annotation.Resource;
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
|
+import static cn.net.redstone.module.infra.dal.dataobject.logger.ApiAccessLogDO.REQUEST_PARAMS_MAX_LENGTH;
|
|
|
+import static cn.net.redstone.module.infra.dal.dataobject.logger.ApiAccessLogDO.RESULT_MSG_MAX_LENGTH;
|
|
|
+
|
|
|
/**
|
|
|
* API 访问日志 Service 实现类
|
|
|
*
|
|
@@ -29,6 +33,8 @@ public class ApiAccessLogServiceImpl implements ApiAccessLogService {
|
|
|
@Override
|
|
|
public void createApiAccessLog(ApiAccessLogCreateReqDTO createDTO) {
|
|
|
ApiAccessLogDO apiAccessLog = BeanUtils.toBean(createDTO, ApiAccessLogDO.class);
|
|
|
+ apiAccessLog.setRequestParams(StrUtils.maxLength(apiAccessLog.getRequestParams(), REQUEST_PARAMS_MAX_LENGTH));
|
|
|
+ apiAccessLog.setResultMsg(StrUtils.maxLength(apiAccessLog.getResultMsg(), RESULT_MSG_MAX_LENGTH));
|
|
|
apiAccessLogMapper.insert(apiAccessLog);
|
|
|
}
|
|
|
|