From 4d5eff3b824dac8e50400b2ec1114cba4ed6a87c Mon Sep 17 00:00:00 2001
From: kaiyu <404897439@qq.com>
Date: Wed, 07 Apr 2021 17:05:43 +0800
Subject: [PATCH] screen-manage     完成sysarea模块查询     拦截器逻辑代码完成     修改organization和accountBug

---
 screen-manage/src/main/java/com/moral/api/pojo/vo/login/AccountInfoVO.java |   46 +++++++++++++++++++++++++++-------------------
 1 files changed, 27 insertions(+), 19 deletions(-)

diff --git a/screen-manage/src/main/java/com/moral/api/pojo/vo/login/AccountInfoVO.java b/screen-manage/src/main/java/com/moral/api/pojo/vo/login/AccountInfoVO.java
index 4edf55a..5267d67 100644
--- a/screen-manage/src/main/java/com/moral/api/pojo/vo/login/AccountInfoVO.java
+++ b/screen-manage/src/main/java/com/moral/api/pojo/vo/login/AccountInfoVO.java
@@ -6,6 +6,7 @@
 import com.moral.api.entity.ManageRole;
 import com.moral.api.pojo.dto.login.AccountInfoDTO;
 import lombok.Data;
+import org.springframework.util.ObjectUtils;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -42,32 +43,26 @@
     private List<ManageMenu> menus;
 
     /**
-    * @Description: DTO������VO
-            * @Param: [dto]
-            * @return: com.moral.api.pojo.vo.login.AccountInfoVO
-            * @Author: ���������
-            * @Date: 2021/3/13
-            */
-    public static AccountInfoVO convert(AccountInfoDTO dto){
+     * @Description: DTO������VO
+     * @Param: [dto]
+     * @return: com.moral.api.pojo.vo.login.AccountInfoVO
+     * @Author: ���������
+     * @Date: 2021/3/13
+     */
+    public static AccountInfoVO convert(AccountInfoDTO dto) {
         AccountInfoVO vo = new AccountInfoVO();
         ManageAccount account = dto.getAccount();
         List<ManageMenu> menus = dto.getMenus();
         List<ManageRole> roles = dto.getRoles();
         //������roleNames
         ArrayList<String> roleNames = new ArrayList<>();
-        roles.forEach(role->roleNames.add(role.getName()));
+        if (!ObjectUtils.isEmpty(roles)) {
+            roles.forEach(role -> roleNames.add(role.getName()));
+        }
         /*������menu������������*/
-        for (ManageMenu menu : menus) {
-            menu.setCreateTime(null);
-            menu.setIsDelete(null);
-            menu.setUpdateTime(null);
-            menu.setParentId(null);
-            List<ManageMenu> children = menu.getChildren();
-            for (ManageMenu child : children) {
-                child.setCreateTime(null);
-                child.setIsDelete(null);
-                child.setUpdateTime(null);
-                child.setParentId(null);
+        if (!ObjectUtils.isEmpty(menus)) {
+            for (ManageMenu menu : menus) {
+                removeAttribute(menu);
             }
         }
         vo.setAccountId(account.getId());
@@ -77,4 +72,17 @@
         return vo;
     }
 
+    public static void removeAttribute(ManageMenu menu) {
+        menu.setCreateTime(null);
+        menu.setIsDelete(null);
+        menu.setUpdateTime(null);
+        menu.setParentId(null);
+        if (ObjectUtils.isEmpty(menu.getChildren()))
+            return;
+        List<ManageMenu> children = menu.getChildren();
+        for (ManageMenu child : children) {
+            removeAttribute(child);
+        }
+    }
+
 }

--
Gitblit v1.8.0