From ce97969fce786a9a1dc0bc18acad6261bee73a21 Mon Sep 17 00:00:00 2001
From: 李林 <z1292839451@163.com>
Date: 星期二, 02 一月 2024 00:39:12 +0800
Subject: [PATCH] 导出功能

---
 framework/src/main/java/com/yuanchu/mom/config/FiferConfig.java |   21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/framework/src/main/java/com/yuanchu/mom/config/FiferConfig.java b/framework/src/main/java/com/yuanchu/mom/config/FiferConfig.java
index 525bec0..3e41ffd 100644
--- a/framework/src/main/java/com/yuanchu/mom/config/FiferConfig.java
+++ b/framework/src/main/java/com/yuanchu/mom/config/FiferConfig.java
@@ -1,5 +1,6 @@
 package com.yuanchu.mom.config;
 
+import com.yuanchu.mom.annotation.ValueAuth;
 import com.yuanchu.mom.utils.JackSonUtil;
 import com.yuanchu.mom.utils.Jwt;
 import com.yuanchu.mom.utils.RedisUtil;
@@ -8,6 +9,7 @@
 import org.springframework.http.HttpMethod;
 import org.springframework.http.MediaType;
 import org.springframework.stereotype.Component;
+import org.springframework.web.method.HandlerMethod;
 import org.springframework.web.servlet.HandlerInterceptor;
 import org.springframework.web.servlet.ModelAndView;
 
@@ -31,19 +33,24 @@
             response.setStatus(HttpServletResponse.SC_OK);
             return true;
         }
+        HandlerMethod h = (HandlerMethod)handler;
+        ValueAuth annotation = h.getMethodAnnotation(ValueAuth.class);
+        if(annotation!=null){
+            return true;
+        }
         String[] strs = request.getRequestURL().toString().split(serverPort);
         AtomicBoolean judge = new AtomicBoolean(false);
-        list.forEach(a -> {
-            if (strs[1].equals(a)) {
+        for (String s : list) {
+            if (strs[1].equals(s)) {
                 judge.set(true);
-                return;
-            } else if (a.indexOf("/**") > -1) {
-                if (strs[1].indexOf(a.replace("/**", "")) == 0) {
+                break;
+            } else if (s.indexOf("/**") > -1) {
+                if (strs[1].indexOf(s.replace("/**", "")) == 0) {
                     judge.set(true);
-                    return;
+                    break;
                 }
             }
-        });
+        }
         if (judge.get()) return true;
         response.setContentType(MediaType.APPLICATION_JSON_VALUE);
         response.setCharacterEncoding("UTF-8");

--
Gitblit v1.9.3