From f1c3c5f0b840df7fa5fe08a69186c9f2b52ce243 Mon Sep 17 00:00:00 2001
From: lizijie <lzjiiie@163.com>
Date: Thu, 18 Mar 2021 15:37:15 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev

---
 screen-manage/src/main/java/com/moral/api/pojo/vo/login/AccountInfoVO.java |   43 ++++++++++++++++++++++++-------------------
 1 files changed, 24 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..dbd42ca 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,36 @@
     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) {
+                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);
+                }
             }
         }
         vo.setAccountId(account.getId());

--
Gitblit v1.8.0