Browse Source

fix: 增加关系计算调用

lvxianyun 3 years ago
parent
commit
65f619bfa3

+ 7 - 3
src/main/java/com/persagy/proxy/object/controller/AdmSpaceController.java

@@ -37,6 +37,7 @@ import java.util.*;
 
 @RestController
 @RequestMapping("/object/zone")
+
 public class AdmSpaceController {
     @Autowired
     private IAdmSpaceService service;
@@ -49,6 +50,7 @@ public class AdmSpaceController {
     @Autowired
     private SpaceRelationInfoHandler spaceRelationInfoHandler;
 
+
     /**
      * 统计
      *
@@ -364,9 +366,11 @@ public class AdmSpaceController {
     @PostMapping("/update-outline")
     public AdmResponse updateOutLine(@RequestBody AdmCreateRequest<AdmSpace> createRequest) throws Exception {
         List<AdmSpace> vos = CollUtil.newArrayList(createRequest.getContent());
-        vos = service.doUpdate( AdmContextUtil.toDmpContext(), AdmSpace.class, vos);
-        //TODO 更新计算关系ZoneSpaceBaseService.upDateOutline
-        return AdmResponse.success(vos);
+        /*vos = service.doUpdate( AdmContextUtil.toDmpContext(), AdmSpace.class, vos);
+        //更新计算关系ZoneSpaceBaseService.upDateOutline
+        service.processRelationType(vos);
+        return AdmResponse.success(vos);*/
+        return service.updateOutLine(vos);
     }
 
     /**

+ 12 - 2
src/main/java/com/persagy/proxy/object/service/IAdmSpaceService.java

@@ -3,10 +3,10 @@ package com.persagy.proxy.object.service;
 import com.alibaba.fastjson.JSONObject;
 import com.persagy.proxy.adm.request.AdmDCSQueryRequest;
 import com.persagy.proxy.adm.request.AdmQueryCriteria;
-import com.persagy.proxy.adm.service.IAdmBaseService;
-import com.persagy.proxy.object.model.AdmSpace;
 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.AdmSpace;
 
 import javax.servlet.http.HttpServletRequest;
 import java.util.List;
@@ -101,4 +101,14 @@ public interface IAdmSpaceService extends IAdmBaseService<AdmSpace> {
      * Update By lijie 2021/10/28 21:07
      */
     AdmResponse query(AdmQueryCriteria request);
+
+    /**
+     * 修改空间轮廓线
+     */
+    AdmResponse updateOutLine(List<AdmSpace> vos);
+
+    /**
+     * 处理关系计算
+     */
+    void processRelationType(List<AdmSpace> vos);
 }

+ 37 - 5
src/main/java/com/persagy/proxy/object/service/impl/AdmSpaceServiceImpl.java

@@ -22,6 +22,7 @@ import com.persagy.dmp.digital.client.DigitalObjectFacade;
 import com.persagy.dmp.digital.entity.ObjectRelation;
 import com.persagy.dmp.simple.client.DigitalObjectSimpleFacade;
 import com.persagy.proxy.adm.constant.AdmCommonConstant;
+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.AdmDCSQueryRequest;
@@ -32,16 +33,14 @@ import com.persagy.proxy.adm.service.impl.AbstractAdmBaseServiceImpl;
 import com.persagy.proxy.adm.utils.AdmContextUtil;
 import com.persagy.proxy.adm.utils.AdmEntityTransferUtil;
 import com.persagy.proxy.adm.utils.AdmQueryCriteriaHelper;
+import com.persagy.proxy.calculation.service.AdmRelCalService;
 import com.persagy.proxy.common.client.DmpRwdClient;
 import com.persagy.proxy.common.entity.DmpResult;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
 import com.persagy.proxy.common.entity.RelationDTO;
-import com.persagy.proxy.dictionary.model.AdmDict;
-import com.persagy.proxy.dictionary.model.AdmObjectType;
 import com.persagy.proxy.object.model.AdmEquipment;
 import com.persagy.proxy.object.model.AdmSpace;
 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.IAdmSpaceService;
 import com.persagy.proxy.object.service.IAdmSystemService;
@@ -75,6 +74,8 @@ public class AdmSpaceServiceImpl extends AbstractAdmBaseServiceImpl<AdmSpace> im
     private IAdmSystemService systemService;
     @Autowired
     private IRelationReportService relationReportService;
+    @Autowired
+    private AdmRelCalService admRelCalService;
 
     @Override
     public AdmResponse doQuery(InstanceUrlParam context, AdmQueryCriteria request, Class<AdmSpace> clazz) {
@@ -101,8 +102,7 @@ public class AdmSpaceServiceImpl extends AbstractAdmBaseServiceImpl<AdmSpace> im
         //添加绑定关系
         processRelations(vosR);
         //处理关系标记
-        //TODO 处理关系标记
-        //processRelationType();
+        processRelationType(vosR);
         return vosR;
     }
 
@@ -329,6 +329,38 @@ public class AdmSpaceServiceImpl extends AbstractAdmBaseServiceImpl<AdmSpace> im
         return response;
     }
 
+    /**
+     * 更新轮廓线
+     * @param vos
+     * @return
+     */
+    @Override
+    public AdmResponse updateOutLine(List<AdmSpace> vos) {
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
+        vos = super.doUpdate(context,  AdmSpace.class, vos);
+        processRelationType(vos);
+        return AdmResponse.success(vos);
+    }
+
+    /**
+     * 触发关系计算
+     * @param vos
+     */
+    @Override
+    public void processRelationType(List<AdmSpace> vos) {
+        admRelCalService.calcRelation(AdmContextUtil.toDmpContext(),
+                CollUtil.newArrayList(
+                        AdmRelationTypeEnum.SP2SP_SPACENEIGHBORHOOD_5,
+                        AdmRelationTypeEnum.SP2SP_TRAFFICNETWORK_3,
+                        AdmRelationTypeEnum.SP2SP_CONVECTIONNETWORK_1,
+                        AdmRelationTypeEnum.SP2SP_RADIATIONNETWORK_1),null);
+
+        vos.forEach(admSpace -> {
+            admRelCalService.calcRelation(AdmContextUtil.toDmpContext(),
+                    CollUtil.newArrayList(AdmRelationTypeEnum.EQ2SP_IN),admSpace.getClassCode());
+        });
+    }
+
     /***
      * Description: 根据查询条件查询空间统计数据,定制接口,后续可优化口
      * @param request : 请求参数