| | |
| | | return functionVOList.stream().sorted(Comparator.comparing(s -> s.getSort())).collect(Collectors.toList()); |
| | | } |
| | | |
| | | public List<MenuVO> findChildAuthFunctionVO(String parentId,MenuVO functionVO) throws PLException { |
| | | // List<FunctionInfo> menus = map.get(parentOid); |
| | | public void findChildAuthFunctionVO(MenuVO functionVO, boolean isAll) throws PLException { |
| | | //0表示没有模块也没有操作,1表示有模块,2表示有操作 |
| | | long l = platformClientUtil.getFrameworkService().checkChildObject(parentId); |
| | | |
| | | // funcObj.setFuncType(funcType); |
| | | // |
| | | // if(funcType == 1){ |
| | | // FunctionObject[] funcObjs = new FunctionClientDelegate().getModuleListByParentId(funcObj.getId(),false); |
| | | // for(int i=0;i<funcObjs.length;i++){ |
| | | // VCIBaseTreeNode curNode = new VCIBaseTreeNode(funcObjs[i].getName(), funcObjs[i]); |
| | | // treeModel.insertNodeInto(curNode, node,node.getChildCount()); |
| | | // setChildNode(curNode,funcObjs[i]); |
| | | // } |
| | | // }else if(funcType == 2){ |
| | | // FuncOperationObject[] funcOperateObjs = new FuncOperationClientDelegate().getFuncOperationByModuleId(funcObj.getId(), "", true); |
| | | // for (int j = 0; j < funcOperateObjs.length; j++) { |
| | | // VCIBaseTreeNode childNode = new VCIBaseTreeNode(funcOperateObjs[j].getOperAlias(),funcOperateObjs[j]); |
| | | // UserObject user = rightManagementClient.fetchUserInfoByName(PLTApplication.getUserEntityObject().getUserName()); |
| | | //// if(user.getUserType() == 0 || childNode.toString().equals("查看")){ |
| | | //// treeModel.insertNodeInto(childNode, node,node.getChildCount()); |
| | | //// childNode.setLeaf(true); |
| | | //// }else{ |
| | | //// boolean res = initRoleRightByType(childNode); |
| | | //// if(res){ |
| | | // treeModel.insertNodeInto(childNode, node,node.getChildCount()); |
| | | // childNode.setLeaf(true); |
| | | //// } |
| | | //// } |
| | | // } |
| | | // }else{ |
| | | // functionVO.setHasChildren(false); |
| | | // } |
| | | // |
| | | // |
| | | // |
| | | // |
| | | // |
| | | // int funcType = funcDel.checkChildObject(funcObj.getId()); |
| | | // funcObj.setFuncType(funcType); |
| | | // |
| | | // |
| | | List<MenuVO> functionVOList = new ArrayList<>(); |
| | | // if(menus == null){ |
| | | // return functionVOList; |
| | | // } |
| | | // for (FunctionInfo menu : menus) { |
| | | // if(!menu.isValid){ |
| | | // continue; |
| | | // } |
| | | // MenuVO functionVO = new MenuVO(); |
| | | // functionVO.setId(menu.id); |
| | | // functionVO.setSource(menu.image); |
| | | //// if(StringUtils.isBlank(menu.resourceB) ){ |
| | | //// continue; |
| | | //// } |
| | | // functionVO.setPath(menu.resourceB); |
| | | // functionVO.setCode(menu.aliasName); |
| | | // functionVO.setAlias(menu.aliasName); |
| | | // functionVO.setParentId(menu.parentId); |
| | | // functionVO.setName(menu.name); |
| | | // functionVO.getMeta().put("keepAlive",false); |
| | | // functionVO.setSort((int) menu.seq); |
| | | // functionVO.setChildren(findChildAuthFunctionVO(menu.id,functionVO)); |
| | | // if(functionVO.getChildren().size() > 0){ |
| | | // functionVO.setHasChildren(true); |
| | | // }else { |
| | | // functionVO.setHasChildren(false); |
| | | // } |
| | | // functionVOList.add(functionVO); |
| | | // } |
| | | return functionVOList.stream().sorted(Comparator.comparing(s -> s.getSort())).collect(Collectors.toList()); |
| | | long type = platformClientUtil.getFrameworkService().checkChildObject(functionVO.getId()); |
| | | if(type == 1){ |
| | | FunctionInfo[] funcObjs = platformClientUtil.getFrameworkService().getModuleListByParentId(functionVO.getId(), isAll); |
| | | for (FunctionInfo funcObj : funcObjs) { |
| | | MenuVO menuVO = new MenuVO(); |
| | | menuVO.setId(funcObj.id); |
| | | menuVO.setSource(funcObj.image); |
| | | menuVO.setPath(funcObj.resourceB); |
| | | menuVO.setCode(funcObj.aliasName); |
| | | menuVO.setAlias(funcObj.aliasName); |
| | | menuVO.setParentId(funcObj.parentId); |
| | | menuVO.setChildType((int) type); |
| | | menuVO.setName(funcObj.name); |
| | | menuVO.getMeta().put("keepAlive",false); |
| | | menuVO.setSort((int) funcObj.seq); |
| | | findChildAuthFunctionVO(menuVO, isAll); |
| | | functionVO.getChildren().add(menuVO); |
| | | } |
| | | }else if(type == 2){ |
| | | FuncOperationInfo[] infos = platformClientUtil.getFrameworkService().getFuncOperationByModule(functionVO.getId(), "", true); |
| | | for (FuncOperationInfo info : infos) { |
| | | MenuVO menuVO = new MenuVO(); |
| | | menuVO.setChildType((int) type); |
| | | menuVO.setId(info.id); |
| | | menuVO.setFuncId(info.funcId); |
| | | menuVO.setCode(info.operIndentify); |
| | | menuVO.setOperId(info.operId); |
| | | menuVO.setName(info.operName); |
| | | menuVO.setAlias(info.operAlias); |
| | | menuVO.setRemark(info.operDesc); |
| | | menuVO.setSort((int) info.number); |
| | | menuVO.setModeType("FunctionObject"); |
| | | menuVO.setIsValid(info.isValid); |
| | | menuVO.setHasChildren(false); |
| | | functionVO.getChildren().add(menuVO); |
| | | } |
| | | }else{ |
| | | functionVO.setHasChildren(false); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | public List<MenuVO> getSysModelAuthTreeMenuByPID(String parentId,String modeType,boolean isAll) throws VciBaseException, PLException { |
| | | List<MenuVO> menuVOList = new ArrayList<>(); |
| | | if(Func.isBlank(parentId)){ |
| | | return menuVOList; |
| | | } |
| | | // if(Func.isBlank(parentId)){ |
| | | // return menuVOList; |
| | | // } |
| | | SessionInfo sessionInfo = WebUtil.getCurrentUserSessionInfoNotException(); |
| | | boolean adminOrDeveloperOrRoot = rightControlUtil.isAdminOrDeveloperOrRoot(sessionInfo.getUserId()); |
| | | if (adminOrDeveloperOrRoot) { |
| | |
| | | functionVO.setName(menu.name); |
| | | functionVO.getMeta().put("keepAlive",false); |
| | | functionVO.setSort((int) menu.seq); |
| | | findChildAuthFunctionVO(functionVO, isAll); |
| | | // try { |
| | | // functionVO.setChildren(findChildAuthFunctionVO(menu.id)); |
| | | // } catch (PLException e) { |
| | |
| | | } |
| | | functionVOList.add(functionVO); |
| | | } |
| | | return functionVOList; |
| | | |
| | | |
| | | |
| | | |
| | | RoleRightInfo[] userRoleRights = rightControlUtil.getRoleRightByUserName(sessionInfo.getUserId()); |
| | | Map<String, List<FunctionInfo>> map = rightControlUtil.getAllChildrenFunctionsByUserName( |
| | | parentId, sessionInfo.getUserId(), userRoleRights); |
| | | |
| | | if(Func.isEmpty(map.get(parentId))) { |
| | | return functionVOList; |
| | | } |
| | | for (FunctionInfo menu : map.get(parentId)) { |
| | | if(!menu.isValid){ |
| | | continue; |
| | | } |
| | | MenuVO functionVO = new MenuVO(); |
| | | functionVO.setId(menu.id); |
| | | functionVO.setSource(menu.image); |
| | | //if(StringUtils.isBlank(menu.resourceB)){ |
| | | // continue; |
| | | //} |
| | | functionVO.setPath(menu.resourceB); |
| | | functionVO.setParentId(menu.parentId); |
| | | functionVO.setCode(menu.aliasName); |
| | | functionVO.setAlias(menu.aliasName); |
| | | functionVO.setName(menu.name); |
| | | functionVO.getMeta().put("keepAlive",false); |
| | | functionVO.setSort((int) menu.seq); |
| | | // try { |
| | | // functionVO.setChildren(findChildAuthFunctionVO(menu.id, map)); |
| | | // } catch (PLException e) { |
| | | // e.printStackTrace(); |
| | | // String errorMsg = "菜单查询时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e); |
| | | // logger.error(errorMsg); |
| | | // throw new VciBaseException(errorMsg); |
| | | // RoleRightInfo[] userRoleRights = rightControlUtil.getRoleRightByUserName(sessionInfo.getUserId()); |
| | | // Map<String, List<FunctionInfo>> map = rightControlUtil.getAllChildrenFunctionsByUserName( |
| | | // parentId, sessionInfo.getUserId(), userRoleRights); |
| | | // |
| | | // if(Func.isEmpty(map.get(parentId))) { |
| | | // return functionVOList; |
| | | // } |
| | | // for (FunctionInfo menu : map.get(parentId)) { |
| | | // if(!menu.isValid){ |
| | | // continue; |
| | | // } |
| | | if(functionVO.getChildren().size() > 0){ |
| | | functionVO.setHasChildren(true); |
| | | }else { |
| | | functionVO.setHasChildren(false); |
| | | } |
| | | functionVOList.add(functionVO); |
| | | } |
| | | //如果是开发或者测试用户,需哟获取系统模块配置菜单 |
| | | if(adminOrDeveloperOrRoot){ |
| | | //获取首页系统模块配置菜单 |
| | | MenuVO menuVO = JsonConfigReader.getSysModuleConf().getSysModuleNode(); |
| | | if(Func.isNotEmpty(menuVO)){ |
| | | functionVOList.add(menuVO); |
| | | } |
| | | } |
| | | return functionVOList.stream().sorted(Comparator.comparing(s -> s.getSort())).collect(Collectors.toList()); |
| | | // MenuVO functionVO = new MenuVO(); |
| | | // functionVO.setId(menu.id); |
| | | // functionVO.setSource(menu.image); |
| | | // //if(StringUtils.isBlank(menu.resourceB)){ |
| | | // // continue; |
| | | // //} |
| | | // functionVO.setPath(menu.resourceB); |
| | | // functionVO.setParentId(menu.parentId); |
| | | // functionVO.setCode(menu.aliasName); |
| | | // functionVO.setAlias(menu.aliasName); |
| | | // functionVO.setName(menu.name); |
| | | // functionVO.getMeta().put("keepAlive",false); |
| | | // functionVO.setSort((int) menu.seq); |
| | | //// try { |
| | | //// functionVO.setChildren(findChildAuthFunctionVO(menu.id, map)); |
| | | //// } catch (PLException e) { |
| | | //// e.printStackTrace(); |
| | | //// String errorMsg = "菜单查询时出现错误,原因:" + VciBaseUtil.getExceptionMessage(e); |
| | | //// logger.error(errorMsg); |
| | | //// throw new VciBaseException(errorMsg); |
| | | //// } |
| | | // if(functionVO.getChildren().size() > 0){ |
| | | // functionVO.setHasChildren(true); |
| | | // }else { |
| | | // functionVO.setHasChildren(false); |
| | | // } |
| | | // functionVOList.add(functionVO); |
| | | // } |
| | | // //如果是开发或者测试用户,需哟获取系统模块配置菜单 |
| | | // if(adminOrDeveloperOrRoot){ |
| | | // //获取首页系统模块配置菜单 |
| | | // MenuVO menuVO = JsonConfigReader.getSysModuleConf().getSysModuleNode(); |
| | | // if(Func.isNotEmpty(menuVO)){ |
| | | // functionVOList.add(menuVO); |
| | | // } |
| | | // } |
| | | // return functionVOList.stream().sorted(Comparator.comparing(s -> s.getSort())).collect(Collectors.toList()); |
| | | |
| | | |
| | | |