Browse Source

fix: 增加关系计算调用

lvxianyun 3 năm trước cách đây
mục cha
commit
3ed7015c65

+ 2 - 17
src/main/java/com/persagy/proxy/object/controller/AdmFloorController.java

@@ -218,24 +218,9 @@ public class AdmFloorController {
     public AdmResponse updateOutline(@RequestBody AdmCreateRequest<AdmFloor> admFloor) throws Exception {
         // 组装上下文条件
         AdmResponse admResponse = update(admFloor);
-        //TODO 处理关系
+
         /** 处理关系标记 */
-       /* val listtype = ArrayList<String>()
-        listtype.add("sh2bd")
-        listtype.add("bd2sp")
-        listtype.add("fl2sp")
-        listtype.add("syeq2bd")
-        listtype.add("sy2fl")
-        listtype.add("eq2fl")
-        listtype.add("pe2bd")
-        listtype.add("pe2fl")
-        for (type in listtype){
-            val entity = EquipmentService.relationTypeProjectservice.select(SFilter.eq("projectId", Opt.projectId!!), SFilter.eq("relationType", type)).entity()
-            if (entity!=null){
-                entity.computationalState = 2
-                EquipmentService.relationTypeProjectservice.update(entity)
-            }
-        }*/
+        service.processRelationType((List<AdmFloor>) admResponse.getContent());
         return admResponse;
     }
 

+ 8 - 2
src/main/java/com/persagy/proxy/object/service/IAdmFloorService.java

@@ -1,10 +1,10 @@
 package com.persagy.proxy.object.service;
 
-import com.persagy.proxy.adm.service.IAdmBaseService;
-import com.persagy.proxy.object.model.AdmFloor;
 import com.persagy.proxy.adm.request.AdmQueryCriteria;
 import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.adm.service.IAdmBaseService;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
+import com.persagy.proxy.object.model.AdmFloor;
 
 import java.util.List;
 
@@ -46,4 +46,10 @@ public interface IAdmFloorService extends IAdmBaseService<AdmFloor> {
      * Update By lijie 2021/10/28 20:13
      */
     AdmResponse query(AdmQueryCriteria criteria);
+
+    /**
+     * 关系计算处理
+     * @param vos
+     */
+    void processRelationType(List<AdmFloor> vos);
 }

+ 34 - 4
src/main/java/com/persagy/proxy/object/service/impl/AdmFloorServiceImpl.java

@@ -10,17 +10,18 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.persagy.dmp.basic.model.QueryCriteria;
 import com.persagy.dmp.common.helper.SpringHelper;
+import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
 import com.persagy.proxy.adm.constant.GraphCodeEnum;
 import com.persagy.proxy.adm.constant.RelCodeEnum;
+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.adm.utils.AdmContextUtil;
+import com.persagy.proxy.calculation.service.AdmRelCalService;
 import com.persagy.proxy.common.entity.DmpResult;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
 import com.persagy.proxy.object.model.AdmFloor;
-import com.persagy.proxy.adm.request.AdmQueryCriteria;
-import com.persagy.proxy.adm.request.AdmResponse;
-import com.persagy.proxy.object.model.AdmSpace;
 import com.persagy.proxy.object.service.IAdmFloorService;
-import com.persagy.proxy.common.entity.InstanceUrlParam;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -39,6 +40,8 @@ import java.util.Map;
 public class AdmFloorServiceImpl extends AbstractAdmBaseServiceImpl<AdmFloor> implements IAdmFloorService {
     @Autowired
     private ObjectMapper objectMapper;
+    @Autowired
+    private AdmRelCalService admRelCalService;
 
     public static final Boolean QUERY = true;
     public static final Boolean CREAT_UPDATE = false;
@@ -77,6 +80,33 @@ public class AdmFloorServiceImpl extends AbstractAdmBaseServiceImpl<AdmFloor> im
         ensureSpecialValues(context, admFloors, QUERY);
         return response;
     }
+
+    @Override
+    public void processRelationType(List<AdmFloor> vos) {
+        /**
+         isttype.add("sh2bd")
+         listtype.add("bd2sp")
+         listtype.add("fl2sp")
+         listtype.add("syeq2bd")
+         listtype.add("sy2fl")
+         listtype.add("eq2fl")
+         listtype.add("pe2bd")
+         listtype.add("pe2fl")
+         */
+        admRelCalService.calcRelation(AdmContextUtil.toDmpContext(),
+                CollUtil.newArrayList(
+                        AdmRelationTypeEnum.SH2BD,
+                        AdmRelationTypeEnum.BD2SP,
+                        AdmRelationTypeEnum.FL2SP,
+                        AdmRelationTypeEnum.SYEQ2BD,
+                        AdmRelationTypeEnum.SY2FL,
+                        AdmRelationTypeEnum.EQ2FL,
+                        AdmRelationTypeEnum.PE2BD,
+                        AdmRelationTypeEnum.PE2FL
+                ),
+                null);
+    }
+
     /***
      * Description: 子类重写,以便处理带buildingId
      * @param dmpRequest : 中台查询参数