|
@@ -55,6 +55,7 @@ public class AdmDictServiceImpl<T> extends AbstractAdmDictBaseServiceImpl<T> imp
|
|
|
@Autowired
|
|
|
private IAdmShaftService shaftService;
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 字典类型查询:所有设备类型、部件类型、系统类型、专业类型
|
|
|
* 查询类型:输入设备类型:equipment,输入部件类型:component,输入系统类型:system,输入专业类型:major,业务空间类型 space ,资产 property,
|
|
@@ -745,6 +746,61 @@ public class AdmDictServiceImpl<T> extends AbstractAdmDictBaseServiceImpl<T> imp
|
|
|
return AdmResponse.success(deliveredInfos);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 查询项目下已有的系统设备类型树
|
|
|
+ * @param context
|
|
|
+ * @param request
|
|
|
+ * @param clazz
|
|
|
+ * @return
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public AdmResponse querySystemEquipTree(InstanceUrlParam context, AdmDictQueryCriteria request, Class<T> clazz) throws Exception {
|
|
|
+ //查询项目下已有的设备类型
|
|
|
+ request.setName("equipment");
|
|
|
+ AdmResponse dictResponse = queryObjectClassCode(context, request, clazz);
|
|
|
+ List<String> classCodes = (List<String>)dictResponse.getContent();
|
|
|
+ if(CollUtil.isEmpty(classCodes)){
|
|
|
+ return AdmResponse.success(new ArrayList<>());
|
|
|
+ }
|
|
|
+ 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)){
|
|
|
+ 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){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ //设置系统子级:设备类型
|
|
|
+ List<AdmObjectType> children = new ArrayList<>();
|
|
|
+ for (String classCode: classCodeList) {
|
|
|
+ AdmObjectType admObjectType = allObjTypeMap.get(classCode);
|
|
|
+ if(admObjectType!=null){
|
|
|
+ children.add(admObjectType);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(CollUtil.isEmpty(children)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ systemType.setChildren(children);
|
|
|
+ admObjectTypeList.add(systemType);
|
|
|
+ }
|
|
|
+ return AdmResponse.success(admObjectTypeList);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 组装通用对象查询条件
|