Commit 27fef32bb931d10d6e6e3705e6095a7800525779

Authored by 谭毅彬
1 parent 810864e9

代码细节修正(2)

Signed-off-by: TanYibin <5491541@qq.com>
huaheng-wms-core/src/main/java/org/jeecg/utils/aspect/TaskBuildAudienceAspect.java
1 package org.jeecg.utils.aspect; 1 package org.jeecg.utils.aspect;
2 2
3 -import java.lang.reflect.Method;  
4 -  
5 -import javax.servlet.http.HttpServletRequest;  
6 -  
7 import org.aspectj.lang.JoinPoint; 3 import org.aspectj.lang.JoinPoint;
8 import org.aspectj.lang.annotation.Aspect; 4 import org.aspectj.lang.annotation.Aspect;
9 import org.aspectj.lang.annotation.Before; 5 import org.aspectj.lang.annotation.Before;
10 import org.aspectj.lang.annotation.Pointcut; 6 import org.aspectj.lang.annotation.Pointcut;
11 -import org.aspectj.lang.reflect.MethodSignature;  
12 import org.jeecg.utils.HuahengJwtUtil; 7 import org.jeecg.utils.HuahengJwtUtil;
13 -import org.jeecg.utils.config.ApplicationConfig;  
14 import org.jeecg.utils.support.ApiAuthentication; 8 import org.jeecg.utils.support.ApiAuthentication;
15 -import org.jeecg.utils.support.PassApiAuthentication;  
16 -import org.jeecg.utils.support.RSA256Key;  
17 -import org.springframework.beans.factory.annotation.Autowired;  
18 import org.springframework.scheduling.annotation.EnableAsync; 9 import org.springframework.scheduling.annotation.EnableAsync;
19 import org.springframework.stereotype.Component; 10 import org.springframework.stereotype.Component;
20 -import org.springframework.web.context.request.RequestContextHolder;  
21 -import org.springframework.web.context.request.ServletRequestAttributes;  
22 -  
23 -import com.auth0.jwt.JWT;  
24 -import com.auth0.jwt.JWTVerifier;  
25 -import com.auth0.jwt.algorithms.Algorithm;  
26 -import com.auth0.jwt.exceptions.JWTVerificationException;  
27 -import com.auth0.jwt.interfaces.DecodedJWT;  
28 11
29 import lombok.extern.slf4j.Slf4j; 12 import lombok.extern.slf4j.Slf4j;
30 13
@@ -42,14 +25,6 @@ public class TaskBuildAudienceAspect { @@ -42,14 +25,6 @@ public class TaskBuildAudienceAspect {
42 @Pointcut("execution(* org.jeecg.modules.wms.monitor.job.*Task.execute(..))") 25 @Pointcut("execution(* org.jeecg.modules.wms.monitor.job.*Task.execute(..))")
43 public void executeTask() {} 26 public void executeTask() {}
44 27
45 - /**  
46 - * API Token 验证  
47 - * @author TanYibin  
48 - * @createDate 2023年2月14日  
49 - * @param joinPoint  
50 - * @throws NoSuchMethodException  
51 - * @throws Throwable  
52 - */  
53 @Before("executeTask()") 28 @Before("executeTask()")
54 public void doBefore(JoinPoint joinPoint) throws NoSuchMethodException, Throwable { 29 public void doBefore(JoinPoint joinPoint) throws NoSuchMethodException, Throwable {
55 new ApiAuthentication.ApiAuthenticationBuild().audience(HuahengJwtUtil.TASK_AUDIENCE_NAME).bulid(); 30 new ApiAuthentication.ApiAuthenticationBuild().audience(HuahengJwtUtil.TASK_AUDIENCE_NAME).bulid();
huaheng-wms-core/src/main/java/org/jeecg/utils/support/ExceptionHandlerAdvice.java
1 package org.jeecg.utils.support; 1 package org.jeecg.utils.support;
2 2
3 import java.util.HashMap; 3 import java.util.HashMap;
4 -import java.util.Map;  
5 4
6 import org.jeecg.common.api.vo.Result; 5 import org.jeecg.common.api.vo.Result;
7 import org.springframework.validation.FieldError; 6 import org.springframework.validation.FieldError;
@@ -19,7 +18,6 @@ public class ExceptionHandlerAdvice { @@ -19,7 +18,6 @@ public class ExceptionHandlerAdvice {
19 */ 18 */
20 @ExceptionHandler(value = MethodArgumentNotValidException.class) 19 @ExceptionHandler(value = MethodArgumentNotValidException.class)
21 public Object handerConstraintViolationException(MethodArgumentNotValidException exception) { 20 public Object handerConstraintViolationException(MethodArgumentNotValidException exception) {
22 - Result<Map> result = new Result<Map>();  
23 HashMap<String, Object> errors = new HashMap<>(); 21 HashMap<String, Object> errors = new HashMap<>();
24 exception.getBindingResult().getAllErrors().forEach(error -> { 22 exception.getBindingResult().getAllErrors().forEach(error -> {
25 FieldError fieldError = (FieldError)error; 23 FieldError fieldError = (FieldError)error;