1、统一抛出ServiceException带占位符的填充方式,不再使用ServiceExceptionUtils;2、新增System服务ErrorCode的国际化;3、Webcad异步导入移除分布式锁,导入解析事务完善;

This commit is contained in:
gaoqr
2025-11-20 11:12:21 +08:00
parent f051e6466b
commit ab4ec08078
139 changed files with 1005 additions and 1193 deletions
@@ -1,5 +1,6 @@
package com.cf.imes.framework.security.core.aop;
import com.cf.imes.framework.common.exception.ServiceException;
import com.cf.imes.framework.security.core.annotations.PreAuthenticated;
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
import lombok.extern.slf4j.Slf4j;
@@ -8,7 +9,6 @@ import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.UNAUTHORIZED;
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
@Aspect
@Slf4j
@@ -17,7 +17,7 @@ public class PreAuthenticatedAspect {
@Around("@annotation(preAuthenticated)")
public Object around(ProceedingJoinPoint joinPoint, PreAuthenticated preAuthenticated) throws Throwable {
if (SecurityFrameworkUtils.getLoginUser() == null) {
throw exception(UNAUTHORIZED);
throw new ServiceException(UNAUTHORIZED);
}
return joinPoint.proceed();
}
@@ -2,7 +2,9 @@ package com.cf.imes.framework.security.core.handler;
import com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants;
import com.cf.imes.framework.common.pojo.CommonResult;
import com.cf.imes.framework.common.util.i18n.core.util.I18nUtils;
import com.cf.imes.framework.common.util.servlet.ServletUtils;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.AuthenticationEntryPoint;
@@ -25,11 +27,13 @@ import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConsta
@SuppressWarnings("JavadocReference") // 忽略文档引用报错
public class AuthenticationEntryPointImpl implements AuthenticationEntryPoint {
@Resource
private I18nUtils i18nUtils;
@Override
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException e) {
log.debug("[commence][访问 URL({}) 时,没有登录]", request.getRequestURI(), e);
// 返回 401
ServletUtils.writeJSON(response, CommonResult.error(UNAUTHORIZED));
ServletUtils.writeJSON(response, CommonResult.error(UNAUTHORIZED.getCode(), i18nUtils.getMessage(UNAUTHORIZED.getMsg())));
}
}