| | |
| | | import java.awt.event.ItemEvent; |
| | | import java.io.File; |
| | | import java.util.*; |
| | | import java.util.concurrent.ForkJoinPool; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | |
| | |
| | | |
| | | @Resource |
| | | private CodeBasicSecMapper codeBasicSecMapper; |
| | | |
| | | /** |
| | | * 自定义并发ForkJoinPool |
| | | */ |
| | | private static final ForkJoinPool customForkJoinPool = new ForkJoinPool(Runtime.getRuntime().availableProcessors()-1); |
| | | |
| | | /** |
| | | * 上级节点的属性名称 |
| | | */ |
| | |
| | | return s.getId() + " " + s.getName() + (FrameworkDataLCStatus.DISABLED.getValue().equalsIgnoreCase(s |
| | | .getLcStatus()) ? (" 【停用】 ") : ""); |
| | | }); |
| | | //超管显示所有分类 |
| | | if(VciBaseUtil.checkAdminTenant()){ |
| | | Iterator var6 = tree.listIterator(); |
| | | while(var6.hasNext()){ |
| | | Tree trees = (Tree) var6.next(); |
| | | boolean checkHasChild=codeClassifyMapper.checkHasChild(trees.getOid()); |
| | | if(checkHasChild){ |
| | | trees.setLeaf(false); |
| | | }else{ |
| | | trees.setLeaf(true); |
| | | } |
| | | } |
| | | }else { |
| | | // 非超管过滤未授权的分类 |
| | | if(!VciBaseUtil.checkAdminTenant()){ |
| | | // 那些分类具备查看权限 |
| | | R<List<String>> viewClassByRoleIds = sysClient.getViewClassByRoleIds(Arrays.asList(AuthUtil.getUser().getRoleId().split(",")),treeQueryObject.getConditionMap().getOrDefault("authType","classify_auth"),treeQueryObject.getConditionMap().getOrDefault("menuCode","classify_view")); |
| | | // 请求失败或者请求得到的具备查看权限的分类id集合为空 |
| | | if(!viewClassByRoleIds.isSuccess() && viewClassByRoleIds.getData().isEmpty()){ |
| | | throw new ServiceException("主数据查看权限未配置,或配置有误!"); |
| | | } |
| | | long startTime = System.currentTimeMillis(); |
| | | // 过滤 |
| | | filterTreeNodes(tree,viewClassByRoleIds.getData()); |
| | | long endTime = System.currentTimeMillis(); |
| | | System.out.println(("执行时间:"+(endTime-startTime)/1000)+"s"); |
| | | } |
| | | // 加载分类是否具有子分类 |
| | | tree.parallelStream().forEach(item -> { |
| | | boolean checkHasChild = checkHasChild(item.getOid()); |
| | | item.setLeaf(!checkHasChild); |
| | | }); |
| | | return tree; |
| | | } |
| | | |
| | |
| | | Iterator<Tree> iterator = trees.iterator(); |
| | | while (iterator.hasNext()) { |
| | | Tree tree = iterator.next(); |
| | | Boolean checkHasChild = codeClassifyMapper.checkHasChild(tree.getOid()); |
| | | tree.setLeaf(!checkHasChild); |
| | | /*Boolean checkHasChild = checkHasChild(tree.getOid()); |
| | | tree.setLeaf(!checkHasChild);*/ |
| | | if (classifyIds.contains(tree.getOid())) { |
| | | // 如果顶层节点存在于 classifyIds 中,直接保留其子节点集合 |
| | | continue; |