| | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.util.object.BeanUtils; |
| | | import com.iailab.framework.tenant.core.context.TenantContextHolder; |
| | | import com.iailab.framework.tenant.core.util.TenantUtils; |
| | | import com.iailab.module.infra.api.logger.dto.ApiErrorLogCreateReqDTO; |
| | | import com.iailab.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogPageReqVO; |
| | | import com.iailab.module.infra.dal.dataobject.logger.ApiErrorLogDO; |
| | |
| | | * |
| | | * @author iailab |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | @Validated |
| | | @Slf4j |
| | | public class ApiErrorLogServiceImpl implements ApiErrorLogService { |
| | | |
| | | @Resource |
| | |
| | | ApiErrorLogDO apiErrorLog = BeanUtils.toBean(createDTO, ApiErrorLogDO.class) |
| | | .setProcessStatus(ApiErrorLogProcessStatusEnum.INIT.getStatus()); |
| | | apiErrorLog.setRequestParams(StrUtil.maxLength(apiErrorLog.getRequestParams(), REQUEST_PARAMS_MAX_LENGTH)); |
| | | apiErrorLogMapper.insert(apiErrorLog); |
| | | if (TenantContextHolder.getTenantId() != null) { |
| | | apiErrorLogMapper.insert(apiErrorLog); |
| | | } else { |
| | | // 极端情况下,上下文中没有租户时,此时忽略租户上下文,避免插入失败! |
| | | TenantUtils.executeIgnore(() -> apiErrorLogMapper.insert(apiErrorLog)); |
| | | } |
| | | } |
| | | |
| | | @Override |