From af99adcdd1198af865d091204b8566e2b81e389d Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期二, 22 十月 2024 09:50:19 +0800
Subject: [PATCH] UI授权相关更改

---
 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIManagerServiceImpl.java |   59 ++++++++++++++++++++++++++++++-----------------------------
 1 files changed, 30 insertions(+), 29 deletions(-)

diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIManagerServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIManagerServiceImpl.java
index 2301d4a..3f4e4fe 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIManagerServiceImpl.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIManagerServiceImpl.java
@@ -39,6 +39,7 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import javax.annotation.Resource;
+import javax.swing.tree.TreePath;
 import java.io.File;
 import java.util.*;
 import java.util.concurrent.TimeUnit;
@@ -1700,11 +1701,11 @@
         Map<String,RoleRightVO> roleRightVOMap = new HashMap<>();
         if(StringUtils.isNotBlank(roleId)){
             String userName = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId();
-            RoleRightInfo[] rightInfos= platformClientUtil.getFrameworkService().getRoleRightList(roleId,userName);
+            RoleRightInfo[] rightInfos = platformClientUtil.getFrameworkService().getRoleRightList(roleId,userName);
             List<RoleRightVO> roleRightVOList = roleRightDOO2VOS(Arrays.asList(rightInfos));
             roleRightVOMap = roleRightVOList.stream().collect(Collectors.toMap(RoleRightVO::getFuncId,roleRightVO ->roleRightVO,(oldValue,newOldValue)->oldValue));
         }
-        BizType[] bizTypes=osBtmServiceI.getBizTypes(type);
+        BizType[] bizTypes = osBtmServiceI.getBizTypes(type);
         List<Tree> treeList=new ArrayList<>();
         Tree rootNode =new Tree("root","鍔熻兘妯″潡","root");
         rootNode.setLevel(0);
@@ -1721,9 +1722,8 @@
             bizTypeTree.setParentId(rootNode.getOid());
             bizTypeTree.setParentName(rootNode.getText());
             bizTypeTree.setParentBtmName(bizTypes[i].name);
-
             //long startTime1 = System.currentTimeMillis();
-            List<PLUILayout> contextList = uiDataFetcher.getContext(bizTypes[i].name);
+            List<PLUILayout> contextList = uiDataFetcher.getContext(bizTypes[i].name/*+context*/);
             //long endTime1 = System.currentTimeMillis();
             //System.out.println("============================================鑾峰彇UI瀹氫箟鏁版嵁寮曟搸鑰楁椂锛�"+((endTime1-startTime1)/1000)+"s");
 
@@ -1774,31 +1774,31 @@
         conditionMap.put("context",uiAuthorDTO.getContext());
         conditionMap.put("showCheckBox","true");
         treeQueryObject.setConditionMap(conditionMap);
-        List<Tree> treeList=this.getUIAuthor(treeQueryObject);
-        HashMap<String,Tree> allTreeMap=new HashMap<>();
-        Map<String,RoleRightDTO> roleRightVOMap=new HashMap<>();
+        List<Tree> treeList = this.getUIAuthor(treeQueryObject);
+        HashMap<String,Tree> allTreeMap = new HashMap<>();
+        Map<String,RoleRightDTO> roleRightVOMap = new HashMap<>();
         if(!CollectionUtil.isEmpty(treeList)){
             if(StringUtils.isNotBlank(uiAuthorDTO.getRoleId())){
-                String userName= WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId();
-                RoleRightInfo[] rightInfos= platformClientUtil.getFrameworkService().getRoleRightList(uiAuthorDTO.getRoleId(),userName);
-                List<RoleRightVO>  roleRightVOList=roleRightDOO2VOS(Arrays.asList(rightInfos));
-                roleRightVOMap=roleRightVOList.stream().collect(Collectors.toMap(RoleRightVO::getFuncId,roleRightVO ->roleRightVOO2DTO(roleRightVO),(oldValue,newValue)->oldValue));
+                String userName = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId();
+                RoleRightInfo[] rightInfos = platformClientUtil.getFrameworkService().getRoleRightList(uiAuthorDTO.getRoleId(),userName);
+                List<RoleRightVO> roleRightVOList = roleRightDOO2VOS(Arrays.asList(rightInfos));
+                roleRightVOMap = roleRightVOList.stream().collect(Collectors.toMap(RoleRightVO::getFuncId,roleRightVO ->roleRightVOO2DTO(roleRightVO),(oldValue,newValue)->oldValue));
             }
             convertTreeDOO2Map(treeList,allTreeMap);
-            List<RoleRightDTO> roleRightDTOList=new ArrayList<>();
-            List<Tree>  selectTreeList= uiAuthorDTO.getSelectTreeList();
+            List<RoleRightDTO> roleRightDTOList = new ArrayList<>();
+            List<Tree> selectTreeList = uiAuthorDTO.getSelectTreeList();
             getSelectedRoleRightObjs(uiAuthorDTO.getRoleId(),selectTreeList,allTreeMap,roleRightVOMap,roleRightDTOList);
             SessionInfo sessionInfo = WebThreadLocalUtil.getCurrentUserSessionInfoInThread();
             String currentUserName = sessionInfo.getUserId();
-            boolean isDeveloper= rightControlUtil.isDeveloper(currentUserName);
-            List<RoleRightInfo>  roleRightInfoList= roleRightDTOO2InfoS(roleRightDTOList);
-            UserEntityInfo info=new UserEntityInfo();
+            //boolean isDeveloper = rightControlUtil.isDeveloper(currentUserName);
+            List<RoleRightInfo> roleRightInfoList = roleRightDTOO2InfoS(roleRightDTOList);
+            UserEntityInfo info = new UserEntityInfo();
             info.modules="UI鎺堟潈";
-            info.userName=currentUserName;
+            info.userName = currentUserName;
             try {
-             res= platformClientUtil.getFrameworkService().saveRoleRight(roleRightInfoList.toArray(new RoleRightInfo[]{}),uiAuthorDTO.getRoleId(),currentUserName,info);
+                res = platformClientUtil.getFrameworkService().saveRoleRight(roleRightInfoList.toArray(new RoleRightInfo[]{}),uiAuthorDTO.getRoleId(),currentUserName,info);
             }catch (PLException e){
-                throw  new Exception("淇濆瓨澶辫触锛�"+e.getMessage());
+                throw  new Exception("淇濆瓨澶辫触锛�" + e.getMessage());
             }
         }
         return res;
@@ -1811,15 +1811,15 @@
      * @param allTreeMap
      * @param roleRightDTOList
      */
-    private void getSelectedRoleRightObjs(String roleOid,List<Tree>  selectTreeList,HashMap<String,Tree> allTreeMap,Map<String,RoleRightDTO> allRoleRightDTOMap,  List<RoleRightDTO> roleRightDTOList){
-        Date date=new Date();
-        Map<String,RoleRightDTO> roleRightDTOMap=new HashMap<>();
+    private void getSelectedRoleRightObjs(String roleOid, List<Tree> selectTreeList, HashMap<String,Tree> allTreeMap, Map<String,RoleRightDTO> allRoleRightDTOMap, List<RoleRightDTO> roleRightDTOList){
+        //Date date=new Date();
+        Map<String,RoleRightDTO> roleRightDTOMap = new HashMap<>();
         if(!CollectionUtil.isEmpty(selectTreeList)){
             selectTreeList.stream().forEach(tree -> {
-                String oid=tree.getOid();
+                String oid = tree.getOid();
                 if(allTreeMap.containsKey(oid)){
-                    tree=   allTreeMap.get(oid);
-                   Object data= tree.getData();
+                    tree = allTreeMap.get(oid);
+                   Object data = tree.getData();
                     if (data instanceof String) {
                         getRightValue(roleOid, tree, allTreeMap, false, roleRightDTOMap);//鍚戜笅鑾峰彇鎵�鏈夋ā鍧楃殑鏉冮檺鍊�
                     } else if (!(data instanceof PLTabButton)) {//涓氬姟绫诲瀷
@@ -1830,16 +1830,17 @@
                         if(allTreeMap.containsKey(parrentId)){
                             SessionInfo sessionInfo = WebThreadLocalUtil.getCurrentUserSessionInfoInThread();
                             String currentUserName = sessionInfo.getUserId();
-                            boolean isDeveloper= rightControlUtil.isDeveloper(currentUserName);
+                            boolean isDeveloper = rightControlUtil.isDeveloper(currentUserName);
                             Tree parentNode= allTreeMap.get(parrentId);
                             String funcId = parentNode.getOid();
-                            getRightValue(roleOid,tree, allTreeMap, true, roleRightDTOMap);//鍚戜笂澶勭悊璇ユ搷浣滅埗绾х殑涓婄骇妯″潡鏉冮檺(涓嶅寘鍚埗鑺傜偣)
+                            getRightValue(roleOid, tree, allTreeMap, true, roleRightDTOMap);//鍚戜笂澶勭悊璇ユ搷浣滅埗绾х殑涓婄骇妯″潡鏉冮檺(涓嶅寘鍚埗鑺傜偣)
                             if(!roleRightDTOMap.containsKey(funcId)){
                                 RoleRightDTO roleRightDTO = new RoleRightDTO();
                                 roleRightDTO.setId(ObjectUtility.getNewObjectID36());//涓婚敭
                                 roleRightDTO.setFuncId(funcId);
                                 if(isDeveloper) {
-                                    roleRightDTO.setRightType((short) 1);//鏉冮檺绫诲瀷 鏉冮檺绫诲瀷锛岃秴绾х鐞嗗憳缁欑鐞嗗憳鎺堟潈涓�1锛岀鐞嗗憳缁欐櫘閫氱敤鎴锋巿鏉冧负2
+                                    //鏉冮檺绫诲瀷 鏉冮檺绫诲瀷锛岃秴绾х鐞嗗憳缁欑鐞嗗憳鎺堟潈涓�1锛岀鐞嗗憳缁欐櫘閫氱敤鎴锋巿鏉冧负2
+                                    roleRightDTO.setRightType((short) 1);
                                 }else{
                                     roleRightDTO.setRightType((short) 2);
                                 }
@@ -1863,7 +1864,7 @@
             });
           /*  allRoleRightDTOMap.putAll(roleRightDTOMap.entrySet().stream()
                     .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::  getValue)));*/
-         List<RoleRightDTO>    newRoleRightDTOList=Optional.ofNullable(roleRightDTOMap).orElseGet(()->new HashMap<String,RoleRightDTO>()).values().stream().collect(Collectors.toList());
+         List<RoleRightDTO> newRoleRightDTOList = Optional.ofNullable(roleRightDTOMap).orElseGet(()->new HashMap<String,RoleRightDTO>()).values().stream().collect(Collectors.toList());
             roleRightDTOList.addAll(newRoleRightDTOList);
         }
     }

--
Gitblit v1.9.3