Browse Source

fix : 级联查询

lvxianyun 3 years ago
parent
commit
25657202bf

+ 10 - 1
src/main/java/com/persagy/proxy/object/service/impl/AdmShaftServiceImpl.java

@@ -6,10 +6,12 @@ import com.persagy.proxy.object.model.AdmEquipment;
 import com.persagy.proxy.object.model.AdmShaft;
 import com.persagy.proxy.adm.request.AdmQueryCriteria;
 import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.object.model.AdmSystem;
 import com.persagy.proxy.object.service.IAdmEquipmentService;
 import com.persagy.proxy.object.service.IAdmShaftService;
 import com.persagy.proxy.adm.utils.AdmContextUtil;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
+import com.persagy.proxy.object.service.IAdmSystemService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -25,20 +27,27 @@ import java.util.List;
 public class AdmShaftServiceImpl extends AbstractAdmBaseServiceImpl<AdmShaft> implements IAdmShaftService {
     @Autowired
     private IAdmEquipmentService equipmentService;
+    @Autowired
+    private IAdmSystemService systemService;
 
     @Override
     public void ensureSpecialValues(InstanceUrlParam context, List<AdmShaft> vos) {
         if(CollUtil.isEmpty(vos)) {
             return;
         }
-        //收集设备对象
+        //收集设备对象、系统对象
         List<AdmEquipment> equipmentList = new ArrayList<>();
+        List<AdmSystem> systemList = new ArrayList<>();
         vos.stream().forEach(admShaft -> {
             if(CollUtil.isNotEmpty(admShaft.getEquipmentList())){
                 equipmentList.addAll(admShaft.getEquipmentList());
             }
+            if(CollUtil.isNotEmpty(admShaft.getSystemList())){
+                systemList.addAll(admShaft.getSystemList());
+            }
         });
         equipmentService.ensureSpecialValues(AdmContextUtil.toDmpContext(), equipmentList);
+        systemService.ensureSpecialValues(AdmContextUtil.toDmpContext(), systemList);
     }
     @Override
     public AdmResponse doQuery(InstanceUrlParam context, AdmQueryCriteria request, Class<AdmShaft> clazz) {

+ 12 - 5
src/main/java/com/persagy/proxy/object/service/impl/AdmSystemServiceImpl.java

@@ -1,17 +1,18 @@
 package com.persagy.proxy.object.service.impl;
 
 import cn.hutool.core.collection.CollUtil;
+import com.persagy.proxy.adm.request.AdmQueryCriteria;
+import com.persagy.proxy.adm.request.AdmResponse;
 import com.persagy.proxy.adm.service.impl.AbstractAdmBaseServiceImpl;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
 import com.persagy.proxy.dictionary.model.AdmDict;
-import com.persagy.proxy.object.model.AdmEquipment;
 import com.persagy.proxy.dictionary.model.AdmObjectType;
-import com.persagy.proxy.object.model.AdmSystem;
-import com.persagy.proxy.adm.request.AdmQueryCriteria;
-import com.persagy.proxy.adm.request.AdmResponse;
 import com.persagy.proxy.dictionary.service.IAdmDictService;
+import com.persagy.proxy.object.model.AdmEquipment;
+import com.persagy.proxy.object.model.AdmSystem;
+import com.persagy.proxy.object.model.AdmSystemCategory;
 import com.persagy.proxy.object.service.IAdmEquipmentService;
 import com.persagy.proxy.object.service.IAdmSystemService;
-import com.persagy.proxy.common.entity.InstanceUrlParam;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -54,10 +55,16 @@ public class AdmSystemServiceImpl extends AbstractAdmBaseServiceImpl<AdmSystem>
         }
         // 转换为编码名称Map
         Map<String, String> codeNameMap = CollUtil.fieldValueAsMap(dicList, "code", "name");
+        Map<String, AdmObjectType> codeNameMaps = CollUtil.fieldValueMap(dicList, "code");
         // 给系统赋值 - 同时收集设备对象,扩展设备对象赋值
         List<AdmEquipment> equipmentList = new ArrayList<>();
         for(AdmSystem vo:vos) {
             vo.setCategoryName(codeNameMap.get(vo.getClassCode()));
+            AdmSystemCategory admSystemCategory = new AdmSystemCategory();
+            admSystemCategory.setCategoryName(codeNameMaps.get(vo.getClassCode()).getName());
+            admSystemCategory.setCode(codeNameMaps.get(vo.getClassCode()).getCode());
+            admSystemCategory.setProjectI(codeNameMaps.get(vo.getClassCode()).getProjectId());
+            vo.setCategoryNames(admSystemCategory);
             // 收集设备对象
             if(CollUtil.isEmpty(vo.getEquipmentList())) {
                 continue;