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 | 338 +++++++++++++++++++++++++++++++++++-------------------- 1 files changed, 215 insertions(+), 123 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 dd92d2d..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 @@ -27,6 +27,7 @@ import com.vci.web.service.UIManagerServiceI; import com.vci.web.util.*; import com.vci.web.util.BeanUtil; +import com.vci.web.utility.UIDataFetcher; import org.apache.commons.lang3.StringUtils; import com.vci.web.util.Func; import com.vci.web.util.PlatformClientUtil; @@ -38,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; @@ -89,9 +91,9 @@ private final String IMPORTUIKEY = "importUIKey:"; /** - * 褰撳墠鐧诲綍鐢ㄦ埛鐨勪俊鎭� + * ui瀹氫箟鏁版嵁寮曟搸 */ - private SessionInfo sessionInfo = null; + private UIDataFetcher uiDataFetcher = null; /** * 鎺掑簭姣旇緝鍣� @@ -100,16 +102,6 @@ @Override public int compare(PLUILayout o1, PLUILayout o2) { return o1.plCode.compareTo(o2.plCode); - } - }; - - /** - * 鎺掑簭姣旇緝鍣� - */ - private Comparator<PLDefinationVO> pageDefinationComparator = new Comparator<PLDefinationVO>() { - @Override - public int compare(PLDefinationVO o1, PLDefinationVO o2) { - return new Integer(o1.getSeq()).compareTo(new Integer(o2.getSeq())); } }; @@ -162,7 +154,7 @@ contextList.add(""); } contextList.stream().forEach(code->{ - PLUILayout[] pluiLayouts= new PLUILayout[0]; + PLUILayout[] pluiLayouts= new PLUILayout[0]; try { pluiLayouts = platformClientUtil.getUIService().getPLUILayoutEntityByTypeAndCode(btemName,code); } catch (PLException e) { @@ -1453,6 +1445,7 @@ */ private void saveButtonParams(LinkedHashMap<String, String> buttonParams,String tabButtonOid) throws VciBaseException{ if(Func.isNotEmpty(buttonParams)) { + SessionInfo sessionInfo = WebThreadLocalUtil.getCurrentUserSessionInfoInThread(); Iterator<Map.Entry<String, String>> iterator = buttonParams.entrySet().iterator(); while(iterator.hasNext()){ Map.Entry<String, String> next = iterator.next(); @@ -1705,38 +1698,62 @@ String type = StringUtils.isBlank(conditionMap.get("type")) ? "" : conditionMap.get("type"); String context = StringUtils.isBlank(conditionMap.get("context")) ? "" : conditionMap.get("context"); boolean showCheckBox = Boolean.parseBoolean(conditionMap.get("showCheckBox")); - Map<String,RoleRightVO> roleRightVOMap=new HashMap<>(); + Map<String,RoleRightVO> roleRightVOMap = new HashMap<>(); if(StringUtils.isNotBlank(roleId)){ - String userName= WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(); - 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)); + String userName = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(); + 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); rootNode.setShowCheckbox(true); rootNode.setExpanded(true); List<Tree> childList=new ArrayList<>(); + + //long startTime = System.currentTimeMillis(); + uiDataFetcher = new UIDataFetcher(); for (int i = 0; i < bizTypes.length; i++) { Tree bizTypeTree = new Tree(bizTypes[i].oid,bizTypes[i].name,bizTypes[i]);//(btmItems[i].label+" ["+ btmItems[i].name+"]", btmItems[i]); bizTypeTree.setLevel(1); bizTypeTree.setShowCheckbox(true); bizTypeTree.setParentId(rootNode.getOid()); bizTypeTree.setParentName(rootNode.getText()); - bizTypeTree.setShowCheckbox(true); bizTypeTree.setParentBtmName(bizTypes[i].name); - childList.add(bizTypeTree); - List<PLUILayout>contextList=getUIContextDataByBtName(bizTypes[i].name,context); - List<Tree> btmChildList=new ArrayList<>(); + //long startTime1 = System.currentTimeMillis(); + List<PLUILayout> contextList = uiDataFetcher.getContext(bizTypes[i].name/*+context*/); + //long endTime1 = System.currentTimeMillis(); + //System.out.println("============================================鑾峰彇UI瀹氫箟鏁版嵁寮曟搸鑰楁椂锛�"+((endTime1-startTime1)/1000)+"s"); + + List<Tree> btmChildList = new ArrayList<>(); btmChildList.add(bizTypeTree); setChildNode(btmChildList,contextList,roleRightVOMap,showCheckBox); + childList.add(bizTypeTree); } + //long endTime = System.currentTimeMillis(); + //System.out.println("============================================UI瀹氫箟鏍戣绠楀畬姣曡�楁椂锛�"+((endTime-startTime)/1000)+"s"); rootNode.setChildren(childList); treeList.add(rootNode); return treeList; } + + /** + * 鏍规嵁瑙掕壊涓婚敭鑾峰彇宸叉巿鏉冪殑淇℃伅 + * @param roleId + * @return + * @throws PLException + */ + /* @Override + public Map<String,RoleRightVO> getRightListByRoleId(String roleId) throws PLException { + VciBaseUtil.alertNotNull(roleId,"鏌ヨ鏉′欢瑙掕壊涓婚敭"); + String userName = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(); + RoleRightInfo[] rightInfos= platformClientUtil.getFrameworkService().getRoleRightList(roleId,userName); + List<RoleRightVO> roleRightVOList = roleRightDOO2VOS(Arrays.asList(rightInfos)); + Map<String,RoleRightVO> roleRightVOMap = roleRightVOList.stream().collect(Collectors.toMap(RoleRightVO::getFuncId,roleRightVO ->roleRightVO,(oldValue,newOldValue)->oldValue)); + return roleRightVOMap; + }*/ /*** * UI鎺堟潈 @@ -1757,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; @@ -1794,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)) {//涓氬姟绫诲瀷 @@ -1813,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); } @@ -1846,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); } } @@ -2001,22 +2019,21 @@ }); } - /*** + /** * 閬嶅巻瀛愯妭鐐� * @param parentTree * @param contextList * @param roleRightVOMap * @param isShowCheckBox */ - private void setChildNode(List<Tree> parentTree, List<PLUILayout>contextList,Map<String,RoleRightVO> roleRightVOMap,boolean isShowCheckBox){ - Optional.ofNullable(parentTree).orElseGet(()->new ArrayList<Tree>()).stream().forEach(pTree -> { - Object funcObj= pTree.getData(); - List<Tree> chiledTreeList=new ArrayList<>(); + private void setChildNode_old(List<Tree> parentTree, List<PLUILayout>contextList,Map<String,RoleRightVO> roleRightVOMap,boolean isShowCheckBox){ + Optional.ofNullable(parentTree).orElseGet(()->new ArrayList<>()).stream().forEach(pTree -> { + Object funcObj = pTree.getData(); + List<Tree> chiledTreeList = new ArrayList<>(); if (funcObj instanceof BizType) {//涓氬姟绫诲瀷 - BizType bizType = (BizType) funcObj; if(!CollectionUtil.isEmpty(contextList)) { contextList.stream().forEach(context->{ - Tree childTree=new Tree(context.plOId,context.plName+"("+context.plCode+")",context); + Tree childTree = new Tree(context.plOId,context.plName+"("+context.plCode+")",context); childTree.setParentName(pTree.getText()); childTree.setParentBtmName(pTree.getParentBtmName()); childTree.setParentId(pTree.getOid()); @@ -2027,19 +2044,13 @@ pTree.setChildren(chiledTreeList); } if(!CollectionUtil.isEmpty(chiledTreeList)) { - setChildNode(chiledTreeList, contextList, roleRightVOMap, isShowCheckBox); + setChildNode_old(chiledTreeList, contextList, roleRightVOMap, isShowCheckBox); } }else if (funcObj instanceof PLUILayout){//UI PLUILayout context = (PLUILayout) funcObj; - PLTabPage[] pages = new PLTabPage[0]; - try { - pages = platformClientUtil.getUIService().getPLTabPagesByPageDefinationOId(context.plOId); - } catch (PLException e) { - e.printStackTrace(); - } - if(pages!=null&&pages.length>0){ - List<PLTabPage> plTabPageList= Arrays.stream(pages).collect(Collectors.toList()); - plTabPageList.stream().forEach(plTabPage -> { + List<PLTabPage> pageList = uiDataFetcher.getTabs(context.plOId); + if(Func.isNotEmpty(pageList)){ + pageList.stream().forEach(plTabPage -> { Tree childTree=new Tree(plTabPage.plOId,plTabPage.plName,plTabPage); childTree.setParentName(pTree.getText()); childTree.setParentId(pTree.getOid()); @@ -2048,66 +2059,152 @@ childTree.setShowCheckbox(isShowCheckBox); chiledTreeList.add(childTree); }); + } + if(!CollectionUtil.isEmpty(chiledTreeList)) { + setChildNode_old(chiledTreeList, contextList, roleRightVOMap, isShowCheckBox); + } + pTree.setChildren(chiledTreeList); + }else if (funcObj instanceof PLTabPage) {//涓婁笅鏂� + PLTabPage plTabPage = (PLTabPage) funcObj; + List<PLPageDefination> pageDefinationList = uiDataFetcher.getComopnent(plTabPage.plOId); + if(Func.isNotEmpty(pageDefinationList)){ + pageDefinationList.stream().forEach(plPageDefination -> { + Tree childTree=new Tree(plPageDefination.plOId,plPageDefination.name,plPageDefination); + childTree.setParentName(pTree.getText()); + childTree.setParentId(pTree.getOid()); + childTree.setParentBtmName(pTree.getParentBtmName()); + childTree.setLevel(pTree.getLevel()+1); + childTree.setShowCheckbox(isShowCheckBox); + chiledTreeList.add(childTree); + }); pTree.setChildren(chiledTreeList); } if(!CollectionUtil.isEmpty(chiledTreeList)) { - setChildNode(chiledTreeList, contextList, roleRightVOMap, isShowCheckBox); + setChildNode_old(chiledTreeList, contextList, roleRightVOMap, isShowCheckBox); } + }else if (funcObj instanceof PLPageDefination) { + PLPageDefination plPageDefination = (PLPageDefination) funcObj; + List<PLTabButton> pLTabButtonList = uiDataFetcher.getButtons(plPageDefination.plOId); + if(Func.isNotEmpty(pLTabButtonList)){ + pLTabButtonList.stream().forEach(plTabButton -> { + Tree childTree=new Tree(plTabButton.plOId,plTabButton.plLabel,plTabButton); + childTree.setParentName(pTree.getText()); + childTree.setParentId(pTree.getOid()); + childTree.setParentBtmName(pTree.getParentBtmName()); + childTree.setLevel(pTree.getLevel()+1); + childTree.setShowCheckbox(isShowCheckBox); + childTree.setLeaf(true); + chiledTreeList.add(childTree); + }); + pTree.setChildren(chiledTreeList); + } + if(!CollectionUtil.isEmpty(chiledTreeList)) { + setChildNode_old(chiledTreeList, contextList, roleRightVOMap, isShowCheckBox); + } + }else if (funcObj instanceof PLTabButton) {//鎸夐挳 + PLTabButton plTabButton = (PLTabButton) funcObj; + String id = plTabButton.plTableOId; + if(roleRightVOMap.containsKey(id)){ + RoleRightVO roleRightVO = roleRightVOMap.get(id); + Long rightValue = roleRightVO.getRightValue(); + int nodeValue = plTabButton.plSeq; + if (nodeValue >= 0 && nodeValue <= 63) { + long preValue = (rightValue >> nodeValue) & 1; + if (preValue == 1) { + pTree.setChecked(true); + } + } + }else{ + pTree.setChecked(false); + } + } + }); + } + /** + * 閬嶅巻瀛愯妭鐐� + * @param parentTree + * @param contextList + * @param isShowCheckBox + */ + private void setChildNode(List<Tree> parentTree, List<PLUILayout>contextList,Map<String,RoleRightVO> roleRightVOMap, boolean isShowCheckBox){ + Optional.ofNullable(parentTree).orElseGet(()->new ArrayList<>()).stream().forEach(pTree -> { + Object funcObj = pTree.getData(); + List<Tree> chiledTreeList = new ArrayList<>(); + if (funcObj instanceof BizType) {//涓氬姟绫诲瀷 + if(!CollectionUtil.isEmpty(contextList)) { + contextList.stream().forEach(context->{ + Tree childTree = new Tree(context.plOId,context.plName+"("+context.plCode+")",context); + childTree.setParentName(pTree.getText()); + childTree.setParentBtmName(pTree.getParentBtmName()); + childTree.setParentId(pTree.getOid()); + childTree.setLevel(pTree.getLevel()+1); + childTree.setShowCheckbox(isShowCheckBox); + chiledTreeList.add(childTree); + }); + pTree.setChildren(chiledTreeList); + } + if(!CollectionUtil.isEmpty(chiledTreeList)) { + setChildNode(chiledTreeList, contextList,roleRightVOMap, isShowCheckBox); + } + }else if (funcObj instanceof PLUILayout){//UI + PLUILayout context = (PLUILayout) funcObj; + List<PLTabPage> pageList = uiDataFetcher.getTabs(context.plOId); + if(Func.isNotEmpty(pageList)){ + pageList.stream().forEach(plTabPage -> { + Tree childTree=new Tree(plTabPage.plOId,plTabPage.plName,plTabPage); + childTree.setParentName(pTree.getText()); + childTree.setParentId(pTree.getOid()); + childTree.setParentBtmName(pTree.getParentBtmName()); + childTree.setLevel(pTree.getLevel()+1); + childTree.setShowCheckbox(isShowCheckBox); + chiledTreeList.add(childTree); + }); + } + if(!CollectionUtil.isEmpty(chiledTreeList)) { + setChildNode(chiledTreeList, contextList,roleRightVOMap, isShowCheckBox); + } + pTree.setChildren(chiledTreeList); }else if (funcObj instanceof PLTabPage) {//涓婁笅鏂� PLTabPage plTabPage = (PLTabPage) funcObj; - List<PLPageDefination>plPageDefinationList=new ArrayList<>(); - try { - PLPageDefination[] pLPageDefinations = platformClientUtil.getUIService().getPLPageDefinationsByPageContextOId(plTabPage.plOId); - if(pLPageDefinations!=null&&pLPageDefinations.length>0){ - plPageDefinationList= Arrays.stream(pLPageDefinations).collect(Collectors.toList()); - plPageDefinationList.stream().forEach(plPageDefination -> { - Tree childTree=new Tree(plPageDefination.plOId,plPageDefination.name,plPageDefination); - childTree.setParentName(pTree.getText()); - childTree.setParentId(pTree.getOid()); - childTree.setParentBtmName(pTree.getParentBtmName()); - childTree.setLevel(pTree.getLevel()+1); - childTree.setShowCheckbox(isShowCheckBox); - chiledTreeList.add(childTree); - }); - pTree.setChildren(chiledTreeList); - } - if(!CollectionUtil.isEmpty(chiledTreeList)) { - setChildNode(chiledTreeList, contextList, roleRightVOMap, isShowCheckBox); - } - } catch (PLException e) { - e.printStackTrace(); + List<PLPageDefination> pageDefinationList = uiDataFetcher.getComopnent(plTabPage.plOId); + if(Func.isNotEmpty(pageDefinationList)){ + pageDefinationList.stream().forEach(plPageDefination -> { + Tree childTree=new Tree(plPageDefination.plOId,plPageDefination.name,plPageDefination); + childTree.setParentName(pTree.getText()); + childTree.setParentId(pTree.getOid()); + childTree.setParentBtmName(pTree.getParentBtmName()); + childTree.setLevel(pTree.getLevel()+1); + childTree.setShowCheckbox(isShowCheckBox); + chiledTreeList.add(childTree); + }); + pTree.setChildren(chiledTreeList); } - - }else if (funcObj instanceof PLPageDefination) {// + if(!CollectionUtil.isEmpty(chiledTreeList)) { + setChildNode(chiledTreeList, contextList,roleRightVOMap, isShowCheckBox); + } + }else if (funcObj instanceof PLPageDefination) { PLPageDefination plPageDefination = (PLPageDefination) funcObj; - try { - List<PLTabButton>plTabButtonList=new ArrayList<>(); - PLTabButton[] pLTabButtons = platformClientUtil.getUIService().getPLTabButtonsByTableOId(plPageDefination.plOId); - if(pLTabButtons!=null&&pLTabButtons.length>0){ - plTabButtonList= Arrays.stream(pLTabButtons).collect(Collectors.toList()); - plTabButtonList.stream().forEach(plTabButton -> { - Tree childTree=new Tree(plTabButton.plOId,plTabButton.plLabel,plTabButton); - childTree.setParentName(pTree.getText()); - childTree.setParentId(pTree.getOid()); - childTree.setParentBtmName(pTree.getParentBtmName()); - childTree.setLevel(pTree.getLevel()+1); - childTree.setShowCheckbox(isShowCheckBox); - childTree.setLeaf(true); - chiledTreeList.add(childTree); - }); - pTree.setChildren(chiledTreeList); - } - if(!CollectionUtil.isEmpty(chiledTreeList)) { - setChildNode(chiledTreeList, contextList, roleRightVOMap, isShowCheckBox); - } - } catch (PLException e) { - e.printStackTrace(); + List<PLTabButton> pLTabButtonList = uiDataFetcher.getButtons(plPageDefination.plOId); + if(Func.isNotEmpty(pLTabButtonList)){ + pLTabButtonList.stream().forEach(plTabButton -> { + Tree childTree=new Tree(plTabButton.plOId,plTabButton.plLabel,plTabButton); + childTree.setParentName(pTree.getText()); + childTree.setParentId(pTree.getOid()); + childTree.setParentBtmName(pTree.getParentBtmName()); + childTree.setLevel(pTree.getLevel()+1); + childTree.setShowCheckbox(isShowCheckBox); + childTree.setLeaf(true); + chiledTreeList.add(childTree); + }); + pTree.setChildren(chiledTreeList); } - + if(!CollectionUtil.isEmpty(chiledTreeList)) { + setChildNode(chiledTreeList, contextList,roleRightVOMap, isShowCheckBox); + } }else if (funcObj instanceof PLTabButton) {//鎸夐挳 - PLTabButton plTabButton= (PLTabButton) funcObj; - String id =plTabButton.plTableOId; + PLTabButton plTabButton = (PLTabButton) funcObj; + String id = plTabButton.plTableOId; if(roleRightVOMap.containsKey(id)){ RoleRightVO roleRightVO = roleRightVOMap.get(id); Long rightValue = roleRightVO.getRightValue(); @@ -2759,9 +2856,7 @@ tabPage.plName = copyObjName; tabPage.plCode = copyObjCode; tabPage.plSeq = Short.parseShort(copyObjSeq); - if(Func.isEmpty(sessionInfo)){ - sessionInfo = WebThreadLocalUtil.getCurrentUserSessionInfoInThread(); - } + SessionInfo sessionInfo = WebThreadLocalUtil.getCurrentUserSessionInfoInThread(); tabPage.plCreateUser = sessionInfo.getUserId(); tabPage.plModifyUser = sessionInfo.getUserId(); long currentTimeMillis = System.currentTimeMillis(); @@ -2888,9 +2983,7 @@ return BaseResult.success("椤甸潰瀹氫箟鍏嬮殕鎴愬姛锛侊紒"); } //鍒濆鍖杝essionInfo灞炴�� - if(Func.isEmpty(sessionInfo)){ - sessionInfo = WebThreadLocalUtil.getCurrentUserSessionInfoInThread(); - } + SessionInfo sessionInfo = WebThreadLocalUtil.getCurrentUserSessionInfoInThread(); //寰幆鍏嬮殕鎸夐挳锛堝悓鏃朵細瀵规寜閽殑鐖跺瓙绾у叧绯诲拰鎸夐挳涓嬬殑鍙傛暟杩涜淇濆瓨锛� tabButtonVOS.stream().forEach(buttonVO->{ try { @@ -2934,9 +3027,7 @@ if(Func.isEmpty(filterTabButton)){ return BaseResult.fail("鏍规嵁婧愬璞′富閿湭鏌ヨ鍒版簮瀵硅薄锛岃鍒锋柊鍚庨噸璇曪紒锛�"); } - if(Func.isEmpty(sessionInfo)){ - sessionInfo = WebThreadLocalUtil.getCurrentUserSessionInfoInThread(); - } + SessionInfo sessionInfo = WebThreadLocalUtil.getCurrentUserSessionInfoInThread(); //鏀瑰彉button瀵硅薄鐨刼id鍜宲arentOId this.modifyButtonOIdsAndCopy(filterTabButton,toOId,ObjectUtility.getNewObjectID36()); @@ -2958,6 +3049,7 @@ // 淇敼褰撳墠鑺傜偣鐨刼Id button.setOId(newOId); + SessionInfo sessionInfo = WebThreadLocalUtil.getCurrentUserSessionInfoInThread(); //寮�濮嬩繚瀛樻寜閽拰鍙傛暟 button.setCreateUser(sessionInfo.getUserId()); button.setModifyUser(sessionInfo.getUserId()); -- Gitblit v1.9.3