mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-10-31 18:28:43 +08:00 
			
		
		
		
	【功能修复】全局:请求租户不存在时,记录访问日志、操作日志异常的问题
This commit is contained in:
		| @@ -3,6 +3,7 @@ package cn.iocoder.yudao.framework.apilog.core.service; | ||||
| import cn.iocoder.yudao.module.infra.api.logger.ApiAccessLogApi; | ||||
| import cn.iocoder.yudao.module.infra.api.logger.dto.ApiAccessLogCreateReqDTO; | ||||
| import lombok.RequiredArgsConstructor; | ||||
| import lombok.extern.slf4j.Slf4j; | ||||
| import org.springframework.scheduling.annotation.Async; | ||||
|  | ||||
| /** | ||||
| @@ -13,6 +14,7 @@ import org.springframework.scheduling.annotation.Async; | ||||
|  * @author 芋道源码 | ||||
|  */ | ||||
| @RequiredArgsConstructor | ||||
| @Slf4j | ||||
| public class ApiAccessLogFrameworkServiceImpl implements ApiAccessLogFrameworkService { | ||||
|  | ||||
|     private final ApiAccessLogApi apiAccessLogApi; | ||||
| @@ -20,7 +22,12 @@ public class ApiAccessLogFrameworkServiceImpl implements ApiAccessLogFrameworkSe | ||||
|     @Override | ||||
|     @Async | ||||
|     public void createApiAccessLog(ApiAccessLogCreateReqDTO reqDTO) { | ||||
|         apiAccessLogApi.createApiAccessLog(reqDTO); | ||||
|         try { | ||||
|             apiAccessLogApi.createApiAccessLog(reqDTO); | ||||
|         } catch (Throwable ex) { | ||||
|             // 由于 @Async 异步调用,这里打印下日志,更容易跟进 | ||||
|             log.error("[createApiAccessLog][url({}) log({}) 发生异常]", reqDTO.getRequestUrl(), reqDTO, ex); | ||||
|         } | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -3,6 +3,7 @@ package cn.iocoder.yudao.framework.apilog.core.service; | ||||
| import cn.iocoder.yudao.module.infra.api.logger.ApiErrorLogApi; | ||||
| import cn.iocoder.yudao.module.infra.api.logger.dto.ApiErrorLogCreateReqDTO; | ||||
| import lombok.RequiredArgsConstructor; | ||||
| import lombok.extern.slf4j.Slf4j; | ||||
| import org.springframework.scheduling.annotation.Async; | ||||
|  | ||||
| /** | ||||
| @@ -13,6 +14,7 @@ import org.springframework.scheduling.annotation.Async; | ||||
|  * @author 芋道源码 | ||||
|  */ | ||||
| @RequiredArgsConstructor | ||||
| @Slf4j | ||||
| public class ApiErrorLogFrameworkServiceImpl implements ApiErrorLogFrameworkService { | ||||
|  | ||||
|     private final ApiErrorLogApi apiErrorLogApi; | ||||
| @@ -20,7 +22,12 @@ public class ApiErrorLogFrameworkServiceImpl implements ApiErrorLogFrameworkServ | ||||
|     @Override | ||||
|     @Async | ||||
|     public void createApiErrorLog(ApiErrorLogCreateReqDTO reqDTO) { | ||||
|         apiErrorLogApi.createApiErrorLog(reqDTO); | ||||
|         try { | ||||
|             apiErrorLogApi.createApiErrorLog(reqDTO); | ||||
|         } catch (Throwable ex) { | ||||
|             // 由于 @Async 异步调用,这里打印下日志,更容易跟进 | ||||
|             log.error("[createApiErrorLog][url({}) log({}) 发生异常]", reqDTO.getRequestUrl(), reqDTO, ex); | ||||
|         } | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -328,6 +328,12 @@ public class GlobalExceptionHandler { | ||||
|             return CommonResult.error(NOT_IMPLEMENTED.getCode(), | ||||
|                     "[支付模块 yudao-module-pay - 表结构未导入][参考 https://doc.iocoder.cn/pay/build/ 开启]"); | ||||
|         } | ||||
|         // 8. AI 大模型 | ||||
|         if (message.contains("ai_")) { | ||||
|             log.error("[AI 大模型 yudao-module-ai - 表结构未导入][参考 https://doc.iocoder.cn/ai/build/ 开启]"); | ||||
|             return CommonResult.error(NOT_IMPLEMENTED.getCode(), | ||||
|                     "[AI 大模型 yudao-module-ai - 表结构未导入][参考 https://doc.iocoder.cn/ai/build/ 开启]"); | ||||
|         } | ||||
|         return null; | ||||
|     } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 YunaiV
					YunaiV