From 29fc12b38133fd1361dd4d368b29719c2bfca161 Mon Sep 17 00:00:00 2001 From: zyx <zyx123456> Date: 星期五, 08 三月 2024 15:38:37 +0800 Subject: [PATCH] 修复入库产生重复工作档 --- src/main/java/com/zy/common/config/AdminInterceptor.java | 19 ++++++++++++++++++- 1 files changed, 18 insertions(+), 1 deletions(-) diff --git a/src/main/java/com/zy/common/config/AdminInterceptor.java b/src/main/java/com/zy/common/config/AdminInterceptor.java index 80e61c5..a7888eb 100644 --- a/src/main/java/com/zy/common/config/AdminInterceptor.java +++ b/src/main/java/com/zy/common/config/AdminInterceptor.java @@ -2,6 +2,7 @@ import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.core.annotations.AppAuth; import com.core.annotations.ManagerAuth; import com.core.common.BaseRes; import com.core.common.Cools; @@ -64,10 +65,21 @@ } } } + // 鐧藉悕鍗� +// if (IpTools.gainRealIp(request).equals("127.0.0.1")) { +// request.setAttribute("userId", 9527); +// return true; +// } // 璺ㄥ煙璁剧疆 // response.setHeader("Access-Control-Allow-Origin", "*"); HandlerMethod handlerMethod = (HandlerMethod) handler; Method method = handlerMethod.getMethod(); + if (method.isAnnotationPresent(AppAuth.class)){ + AppAuth annotation = method.getAnnotation(AppAuth.class); + if (annotation.value().equals(AppAuth.Auth.CHECK)){ + request.setAttribute("appAuth", annotation.memo()); + } + } if (method.isAnnotationPresent(ManagerAuth.class)){ ManagerAuth annotation = method.getAnnotation(ManagerAuth.class); if (annotation.value().equals(ManagerAuth.Auth.CHECK)){ @@ -87,10 +99,15 @@ } } + @Override + public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, @Nullable Exception ex) throws Exception { +// Object r = request.getAttribute("cool-response"); + } + private boolean check(HttpServletRequest request, HttpServletResponse response, String memo) { try { String token = request.getHeader("token"); - UserLogin userLogin = userLoginService.selectOne(new EntityWrapper<UserLogin>().eq("token", token)); + UserLogin userLogin = userLoginService.selectOne(new EntityWrapper<UserLogin>().eq("token", token).eq("system", "WMS")); if (null == userLogin){ Http.response(response, BaseRes.DENIED); return false; -- Gitblit v1.9.1