|  | @@ -758,47 +758,45 @@ public class AdmDictServiceImpl<T> extends AbstractAdmDictBaseServiceImpl<T> imp
 | 
												
													
														
															|  |      public AdmResponse querySystemEquipTree(InstanceUrlParam context, AdmDictQueryCriteria request, Class<T> clazz) throws Exception {
 |  |      public AdmResponse querySystemEquipTree(InstanceUrlParam context, AdmDictQueryCriteria request, Class<T> clazz) throws Exception {
 | 
												
													
														
															|  |          //查询项目下已有的设备类型
 |  |          //查询项目下已有的设备类型
 | 
												
													
														
															|  |          request.setName("equipment");
 |  |          request.setName("equipment");
 | 
												
													
														
															|  | -        AdmResponse dictResponse = queryObjectClassCode(context, request, clazz);
 |  | 
 | 
												
													
														
															|  | 
 |  | +        AdmResponse dictResponse = equipmentService.queryEquipClassCode(context, request, AdmEquipment.class);
 | 
												
													
														
															|  |          List<String> classCodes = (List<String>)dictResponse.getContent();
 |  |          List<String> classCodes = (List<String>)dictResponse.getContent();
 | 
												
													
														
															|  |          if(CollUtil.isEmpty(classCodes)){
 |  |          if(CollUtil.isEmpty(classCodes)){
 | 
												
													
														
															|  |              return AdmResponse.success(new ArrayList<>());
 |  |              return AdmResponse.success(new ArrayList<>());
 | 
												
													
														
															|  |          }
 |  |          }
 | 
												
													
														
															|  |          Map<String, List<String>> classCodeMap = classCodes.stream().collect(Collectors.groupingBy(item->item.substring(0,4),Collectors.toList()));
 |  |          Map<String, List<String>> classCodeMap = classCodes.stream().collect(Collectors.groupingBy(item->item.substring(0,4),Collectors.toList()));
 | 
												
													
														
															|  | -        //查询所有的对象类型
 |  | 
 | 
												
													
														
															|  | -        AdmResponse allDictResponse = doQueryObjectType(context, new QueryCriteria(), clazz);
 |  | 
 | 
												
													
														
															|  | -        List<AdmObjectType> objectTypes = (List<AdmObjectType>) allDictResponse.getContent();
 |  | 
 | 
												
													
														
															|  | -        Map<String, AdmObjectType> allObjTypeMap = objectTypes.stream().collect(Collectors.toMap(AdmObjectType::getCode, admObjectType -> admObjectType, (k1, k2) -> k1));
 |  | 
 | 
												
													
														
															|  | -        if(CollUtil.isEmpty(allObjTypeMap)){
 |  | 
 | 
												
													
														
															|  | 
 |  | +        //查询系统设备类树
 | 
												
													
														
															|  | 
 |  | +        AdmDict admDict = new AdmDict();
 | 
												
													
														
															|  | 
 |  | +        admDict.setType(AdmDictCategoryEnum.SYSTEM_EQUIP.getValue());
 | 
												
													
														
															|  | 
 |  | +        AdmResponse categoryResponse = queryCategory(context, admDict, clazz);
 | 
												
													
														
															|  | 
 |  | +        List<AdmObjectType> objectTypes = (List<AdmObjectType>) categoryResponse.getContent();
 | 
												
													
														
															|  | 
 |  | +        if(CollUtil.isEmpty(objectTypes)){
 | 
												
													
														
															|  |              return AdmResponse.success(new ArrayList<>());
 |  |              return AdmResponse.success(new ArrayList<>());
 | 
												
													
														
															|  |          }
 |  |          }
 | 
												
													
														
															|  | -        //结果集封装
 |  | 
 | 
												
													
														
															|  | -        List<AdmObjectType> admObjectTypeList = new ArrayList<>();
 |  | 
 | 
												
													
														
															|  | -        for (Map.Entry<String, List<String>> map : classCodeMap.entrySet()) {
 |  | 
 | 
												
													
														
															|  | -            String systemCode = map.getKey();
 |  | 
 | 
												
													
														
															|  | -            List<String> classCodeList = map.getValue();
 |  | 
 | 
												
													
														
															|  | -            if(CollUtil.isEmpty(classCodeList)){
 |  | 
 | 
												
													
														
															|  | -                continue;
 |  | 
 | 
												
													
														
															|  | -            }
 |  | 
 | 
												
													
														
															|  | -            //设置系统类型
 |  | 
 | 
												
													
														
															|  | -            AdmObjectType systemType = allObjTypeMap.get(systemCode);
 |  | 
 | 
												
													
														
															|  | -            if(systemType == null){
 |  | 
 | 
												
													
														
															|  | 
 |  | +        //过滤设备实体中不存在的类型
 | 
												
													
														
															|  | 
 |  | +        Iterator<AdmObjectType> it = objectTypes.iterator();
 | 
												
													
														
															|  | 
 |  | +        while(it.hasNext()){
 | 
												
													
														
															|  | 
 |  | +            //过滤系统
 | 
												
													
														
															|  | 
 |  | +            AdmObjectType objectType = it.next();
 | 
												
													
														
															|  | 
 |  | +            List<String> objTypes = classCodeMap.get(objectType.getCode());
 | 
												
													
														
															|  | 
 |  | +            if(CollUtil.isEmpty(objTypes)){
 | 
												
													
														
															|  | 
 |  | +               it.remove();
 | 
												
													
														
															|  | 
 |  | +               continue;
 | 
												
													
														
															|  | 
 |  | +            }
 | 
												
													
														
															|  | 
 |  | +            //过滤子级:设备类型
 | 
												
													
														
															|  | 
 |  | +            List<AdmObjectType> children = objectType.getChildren();
 | 
												
													
														
															|  | 
 |  | +            if(CollUtil.isEmpty(children)){
 | 
												
													
														
															|  | 
 |  | +                it.remove();
 | 
												
													
														
															|  |                  continue;
 |  |                  continue;
 | 
												
													
														
															|  |              }
 |  |              }
 | 
												
													
														
															|  | -            //设置系统子级:设备类型
 |  | 
 | 
												
													
														
															|  | -            List<AdmObjectType> children = new ArrayList<>();
 |  | 
 | 
												
													
														
															|  | -            for (String classCode: classCodeList) {
 |  | 
 | 
												
													
														
															|  | -                AdmObjectType admObjectType = allObjTypeMap.get(classCode);
 |  | 
 | 
												
													
														
															|  | -                if(admObjectType!=null){
 |  | 
 | 
												
													
														
															|  | -                    children.add(admObjectType);
 |  | 
 | 
												
													
														
															|  | 
 |  | +            Iterator<AdmObjectType> chidIterator = children.iterator();
 | 
												
													
														
															|  | 
 |  | +            while (chidIterator.hasNext()){
 | 
												
													
														
															|  | 
 |  | +                AdmObjectType next = chidIterator.next();
 | 
												
													
														
															|  | 
 |  | +                if(!objTypes.contains(next.getCode())){
 | 
												
													
														
															|  | 
 |  | +                    chidIterator.remove();
 | 
												
													
														
															|  |                  }
 |  |                  }
 | 
												
													
														
															|  |              }
 |  |              }
 | 
												
													
														
															|  | -            if(CollUtil.isEmpty(children)){
 |  | 
 | 
												
													
														
															|  | -                continue;
 |  | 
 | 
												
													
														
															|  | -            }
 |  | 
 | 
												
													
														
															|  | -            systemType.setChildren(children);
 |  | 
 | 
												
													
														
															|  | -            admObjectTypeList.add(systemType);
 |  | 
 | 
												
													
														
															|  |          }
 |  |          }
 | 
												
													
														
															|  | -        return AdmResponse.success(admObjectTypeList);
 |  | 
 | 
												
													
														
															|  | 
 |  | +        return AdmResponse.success(objectTypes);
 | 
												
													
														
															|  |      }
 |  |      }
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  |  
 |  |  
 |