feat(REQ-2300):增加异常处理

This commit is contained in:
李昆鹏 2024-07-12 15:44:38 +08:00
parent d31f3feca8
commit 346c951c48

View File

@ -15,10 +15,7 @@ import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.*;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.core.annotation.Order; import org.springframework.core.annotation.Order;
@ -95,6 +92,12 @@ public class DataPermissionInterceptor {
return pjp.proceed(pjp.getArgs()); return pjp.proceed(pjp.getArgs());
} }
@AfterThrowing(value = "(@within(cn.axzo.framework.datapermission.annotation.DataPermission) && @within(org.springframework.web.bind.annotation.RestController)) " +
"|| (@annotation(cn.axzo.framework.datapermission.annotation.DataPermission) && mappingAnnotations())", throwing = "e")
public void handleException(Exception e) {
DataPermissionContextHolder.remove();
}
public void handle(DataPermission dataPermission) { public void handle(DataPermission dataPermission) {
HttpServletRequest httpRequest = null; HttpServletRequest httpRequest = null;