From 7d3040d4c742af5e13f7327e7397a0524c1ffdec Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期三, 21 二月 2024 16:06:31 +0800
Subject: [PATCH] #

---
 zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/utils/Utils.java |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/utils/Utils.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/utils/Utils.java
index 0398a98..fe7d834 100644
--- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/utils/Utils.java
+++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/utils/Utils.java
@@ -2,6 +2,7 @@
 
 
 import com.zy.asrs.framework.common.Cools;
+import com.zy.asrs.wcs.common.constant.Constants;
 
 import javax.servlet.http.HttpServletResponse;
 import java.util.ArrayList;
@@ -27,7 +28,8 @@
      * @param <R>            parentId鐨勭被鍨�
      * @return List<T>
      */
-    public static <T, R> List<T> toTreeData(List<T> data, R parentId,
+    public static <T, R> List<T> toTreeData(List<T> data,
+                                            R parentId,
                                             Function<? super T, ? extends R> parentIdMapper,
                                             Function<? super T, ? extends R> idMapper,
                                             BiConsumer<T, List<T>> consumer) {
@@ -37,7 +39,9 @@
             if (parentId.equals(dParentId)) {
                 R dId = idMapper.apply(d);
                 List<T> children = toTreeData(data, dId, parentIdMapper, idMapper, consumer);
-                consumer.accept(d, children);
+                if(children.size() > 0) {
+                    consumer.accept(d, children);
+                }
                 result.add(d);
             }
         }
@@ -257,11 +261,11 @@
 
     public static void cors(HttpServletResponse response){
         // 璺ㄥ煙璁剧疆
+        response.setHeader("Access-Control-Max-Age", "3600");
         response.setHeader("Access-Control-Allow-Origin", "*");
-        response.setHeader("Access-Control-Allow-Credentials", "true");
         response.setHeader("Access-Control-Allow-Methods", "*");
-        response.setHeader("Access-Control-Allow-Headers", "Content-Type,Access-Token,Authorization");
-        response.setHeader("Access-Control-Expose-Headers", "*");
+        response.setHeader("Access-Control-Allow-Headers", "*");
+        response.setHeader("Access-Control-Expose-Headers", Constants.TOKEN_HEADER_NAME);
     }
 
 }

--
Gitblit v1.9.1