| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | private final String IMPORTUIKEY = "importUIKey:"; |
| | | |
| | | /** |
| | | * 当前登录用户的信息 |
| | | * ui定义数据引擎 |
| | | */ |
| | | private SessionInfo sessionInfo = null; |
| | | private UIDataFetcher uiDataFetcher = null; |
| | | |
| | | /** |
| | | * 排序比较器 |
| | |
| | | @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())); |
| | | } |
| | | }; |
| | | |
| | |
| | | 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) { |
| | |
| | | */ |
| | | 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(); |
| | |
| | | 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授权 |
| | |
| | | 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; |
| | |
| | | * @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)) {//业务类型 |
| | |
| | | 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); |
| | | } |
| | |
| | | }); |
| | | /* 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); |
| | | } |
| | | } |
| | |
| | | }); |
| | | } |
| | | |
| | | /*** |
| | | /** |
| | | * 遍历子节点 |
| | | * @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()); |
| | |
| | | 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()); |
| | |
| | | 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(); |
| | |
| | | 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(); |
| | |
| | | return BaseResult.success("页面定义克隆成功!!"); |
| | | } |
| | | //初始化sessionInfo属性 |
| | | if(Func.isEmpty(sessionInfo)){ |
| | | sessionInfo = WebThreadLocalUtil.getCurrentUserSessionInfoInThread(); |
| | | } |
| | | SessionInfo sessionInfo = WebThreadLocalUtil.getCurrentUserSessionInfoInThread(); |
| | | //循环克隆按钮(同时会对按钮的父子级关系和按钮下的参数进行保存) |
| | | tabButtonVOS.stream().forEach(buttonVO->{ |
| | | try { |
| | |
| | | if(Func.isEmpty(filterTabButton)){ |
| | | return BaseResult.fail("根据源对象主键未查询到源对象,请刷新后重试!!"); |
| | | } |
| | | if(Func.isEmpty(sessionInfo)){ |
| | | sessionInfo = WebThreadLocalUtil.getCurrentUserSessionInfoInThread(); |
| | | } |
| | | SessionInfo sessionInfo = WebThreadLocalUtil.getCurrentUserSessionInfoInThread(); |
| | | |
| | | //改变button对象的oid和parentOId |
| | | this.modifyButtonOIdsAndCopy(filterTabButton,toOId,ObjectUtility.getNewObjectID36()); |
| | |
| | | |
| | | // 修改当前节点的oId |
| | | button.setOId(newOId); |
| | | SessionInfo sessionInfo = WebThreadLocalUtil.getCurrentUserSessionInfoInThread(); |
| | | //开始保存按钮和参数 |
| | | button.setCreateUser(sessionInfo.getUserId()); |
| | | button.setModifyUser(sessionInfo.getUserId()); |