Browse Source

修改jar坐标位置,解决相同全路径类加载失败的问题

lijie 3 years ago
parent
commit
39fed41c36

+ 1 - 1
src/main/java/com/persagy/proxy/adm/constant/AdmCommonConstant.java

@@ -20,7 +20,7 @@ public interface AdmCommonConstant {
     String APP_ID = "ADM";
     
     /** 默认的userId */
-    String USER_ID = "systemId";
+    String USER_ID = "0";
     
     /** 集团编码 header key*/
     String GROUP_CODE_HEADER = "groupCode";

+ 2 - 0
src/main/java/com/persagy/proxy/adm/constant/AdmObjectInfoConstant.java

@@ -22,6 +22,8 @@ public interface AdmObjectInfoConstant {
     String LOCAL_ID = "localId";
     /**本地名称*/
     String LOCAL_NAME = "localName";
+    /**模型id*/
+    String MODEL_ID = "modelId";
     /**是否检查classCode使用的classCodes列表*/
     Set<String> CHECK_CLASS_CODES= CollUtil.newHashSet("SETDLS","SETDHS");
     /**是否检查传感器使用的传感器类型*/

+ 2 - 0
src/main/java/com/persagy/proxy/adm/constant/ObjTypeMapping.java

@@ -26,6 +26,8 @@ public class ObjTypeMapping {
 	
 	/** example: Sp -> 空间 */
 	public static final Map<String, String> PREFIX_NAME = new HashMap<String, String>();
+	/**楼层-对象类型*/
+	public static final String FLOOR = "floor";
 	
 	static {
 	    

+ 78 - 0
src/main/java/com/persagy/proxy/adm/controller/AdmCalcSpecialController.java

@@ -0,0 +1,78 @@
+package com.persagy.proxy.adm.controller;
+
+import cn.hutool.core.util.StrUtil;
+import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.model.AdmMepSourceTypeEntity;
+import com.persagy.proxy.adm.request.AdmCreateRequest;
+import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.adm.service.AdmCalcSpecialService;
+import com.persagy.proxy.adm.service.AdmMepSystemCalcService;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.bind.annotation.*;
+
+import javax.ws.rs.QueryParam;
+
+/***
+ * Description: 机电管网系统关系计算
+ * @author : lijie
+ * @date :2021/9/14 23:15
+ * Update By lijie 2021/9/14 23:15
+ */
+@RestController
+@RequestMapping("/calc_special/")
+@RequiredArgsConstructor
+public class AdmCalcSpecialController {
+
+    private final AdmCalcSpecialService admCalcSpecialService;
+
+    @Value("${middleware.group.code}")
+    private String groupCode;
+
+    /***
+     * Description: 管网系统设备分块  +  计算流向
+     * @param projectId : 项目id
+     * @param relationType : 关系类型
+     * @return : com.persagy.proxy.adm.request.AdmResponse
+     * @author : lijie
+     * @date :2021/9/29 11:12
+     * Update By lijie 2021/9/29 11:12
+     */
+    @PostMapping("sys-block")
+    public AdmResponse sysBolck(@RequestParam("projectId") String projectId,
+                                @RequestParam("groupCode") String groupCode,
+                                @RequestParam("appId") String appId,
+                                @RequestParam("userId") String userId,
+                                @RequestParam("relationType ") String relationType) throws Exception {
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(StrUtil.isNotBlank(groupCode)?groupCode:this.groupCode,
+                null, projectId, StrUtil.isNotBlank(appId)?appId:AdmCommonConstant.APP_ID,
+                StrUtil.isNotBlank(userId)?userId:AdmCommonConstant.USER_ID);
+        return admCalcSpecialService.sysBolck(context, relationType);
+    }
+    /***
+     * Description: 管网计算
+     * @param projectId : 项目id
+     * @param groupCode : 集团编码
+     * @param appId : APP的id
+     * @param userId : 用户id
+     * @return : com.persagy.proxy.adm.request.AdmResponse
+     * @author : lijie
+     * @date :2021/9/29 11:58
+     * Update By lijie 2021/9/29 11:58
+     */
+    @GetMapping("calcNetworks")
+    public AdmResponse calcNetworks(@RequestParam("projectId") String projectId,
+                                    @RequestParam("groupCode") String groupCode,
+                                    @RequestParam("appId") String appId,
+                                    @RequestParam("userId") String userId) throws Exception {
+        // 组装上下文条件
+        InstanceUrlParam context = new InstanceUrlParam(StrUtil.isNotBlank(groupCode)?groupCode:this.groupCode,
+                null, projectId, StrUtil.isNotBlank(appId)?appId:AdmCommonConstant.APP_ID,
+                StrUtil.isNotBlank(userId)?userId:AdmCommonConstant.USER_ID);
+        return admCalcSpecialService.calcNetworks(context);
+    }
+
+
+}

+ 19 - 10
src/main/java/com/persagy/proxy/adm/controller/AdmRelCalController.java

@@ -1,6 +1,7 @@
 package com.persagy.proxy.adm.controller;
 
 import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
 import com.persagy.dmp.common.exception.BusinessException;
 import com.persagy.proxy.adm.constant.AdmCommonConstant;
 import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
@@ -136,10 +137,13 @@ public class AdmRelCalController {
     }
     /***
      * Description: 添加关系(图类型关系为ArchForArch)
-     * @param relType : 关系类型
-     * @param objectTypeStr : 参与计算的业务空间(为空表示所有业务空间类型),以英文逗号隔开 HeatingZone,CleanZone,
-     *                      DomesticWaterSupplyZone,NetworkZone,TenantZone,AirConditioningZone,FunctionZone,
-     *                      FireZone,SecurityZone,GeneralZone,PowerSupplyZone,LightingZone
+     * @param buildingId : 建筑id
+     * @param objectType : 对象分类
+     * @param type : 对象类型
+     * @param projectId : 项目id
+     * @param groupCode : 集团编码
+     * @param appId : APP的id
+     * @param userId : 账号id
      * sp2sp:空间服务于空间
      * @return : com.persagy.proxy.adm.request.AdmCreateResponse
      * @author : lijie
@@ -147,14 +151,19 @@ public class AdmRelCalController {
      * Update By lijie 2021/8/31 12:10
      */
     @PostMapping(value = {"sp2sp"})
-    public AdmResponse archForArchCalcRelation( @PathVariable("relType") String relType,
-                                     @QueryParam("projectId") String projectId,
-                                     @QueryParam("objectTypes") String objectTypeStr,
-                                     @QueryParam("relationType") String relationTypeStr) throws Exception {
+    public AdmResponse archForArchCalcRelation( @RequestParam("buildingId") String buildingId,
+                                                @RequestParam("objectType") String objectType,
+                                                @RequestParam("type") String type,
+                                                @RequestParam("projectId") String projectId,
+                                                @RequestParam("groupCode") String groupCode,
+                                                @RequestParam("appId") String appId,
+                                                @RequestParam("userId") String userId) throws Exception {
         // 资产暂时未引入,直接返回成功
         // 组装上下文条件
-        InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
-        // admRelCalService.calcRelation(context,relType,objectTypeStr,relationTypeStr);
+        InstanceUrlParam context = new InstanceUrlParam(StrUtil.isNotBlank(groupCode)?groupCode:this.groupCode,
+                null, projectId, StrUtil.isNotBlank(appId)?appId:AdmCommonConstant.APP_ID,
+                StrUtil.isNotBlank(userId)?userId:AdmCommonConstant.USER_ID);
+        admRelCalService.calcRelationForArchForArchSpToSp(context,buildingId,objectType,type,AdmRelationTypeEnum.SP2SP_ARCHFORARCH);
         return AdmResponse.success(new ArrayList<>());
     }
     /***

+ 1 - 1
src/main/java/com/persagy/proxy/adm/controller/AdmShaftController.java

@@ -14,8 +14,8 @@ import com.persagy.dmp.common.model.entity.BaseEntity;
 import com.persagy.dmp.define.client.DigitalObjectInfoFacade;
 import com.persagy.dmp.define.entity.ObjectInfoDefine;
 import com.persagy.dmp.digital.client.DigitalObjectFacade;
-import com.persagy.dmp.digital.client.DigitalObjectSimpleFacade;
 import com.persagy.dmp.digital.client.DigitalRelationFacade;
+import com.persagy.dmp.simple.client.DigitalObjectSimpleFacade;
 import com.persagy.proxy.adm.constant.AdmCommonConstant;
 import com.persagy.proxy.adm.model.*;
 import com.persagy.proxy.adm.request.AdmCreateRequest;

+ 16 - 0
src/main/java/com/persagy/proxy/adm/dto/TwicePointDTO.java

@@ -0,0 +1,16 @@
+package com.persagy.proxy.adm.dto;
+
+/***
+ * Description: 记录两组坐标的DTO类
+ * @author : lijie
+ * @date :2021/10/8 10:01
+ * Update By lijie 2021/10/8 10:01
+ */
+public class TwicePointDTO {
+
+    private Double x1;
+    private Double y1;
+    private Double x2;
+    private Double y2;
+
+}

+ 32 - 0
src/main/java/com/persagy/proxy/adm/service/AdmCalcSpecialService.java

@@ -0,0 +1,32 @@
+package com.persagy.proxy.adm.service;
+
+import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
+
+/***
+ * Description: 关系计算-管网计算逻辑处理类
+ * @author : lijie
+ * @date :2021/9/29 11:07
+ * Update By lijie 2021/9/29 11:07
+ */
+public interface AdmCalcSpecialService {
+    /***
+     * Description: 管网系统设备分块  +  计算流向
+     * @param context : 基本请求参数
+     * @param relationType : 关系类型
+     * @return : com.persagy.proxy.adm.request.AdmResponse
+     * @author : lijie
+     * @date :2021/9/29 11:12
+     * Update By lijie 2021/9/29 11:12
+     */
+    AdmResponse sysBolck(InstanceUrlParam context, String relationType);
+    /***
+     * Description: 管网计算
+     * @param context : 基本请求参数
+     * @return : com.persagy.proxy.adm.request.AdmResponse
+     * @author : lijie
+     * @date :2021/9/29 11:58
+     * Update By lijie 2021/9/29 11:58
+     */
+    AdmResponse calcNetworks(InstanceUrlParam context);
+}

+ 14 - 4
src/main/java/com/persagy/proxy/adm/service/AdmRelCalService.java

@@ -1,10 +1,6 @@
 package com.persagy.proxy.adm.service;
 
 import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
-import com.persagy.proxy.adm.model.AdmManualRelCalRequest;
-import com.persagy.proxy.adm.model.AdmManualRelationCalcDel;
-import com.persagy.proxy.adm.model.AdmRelationAddRequest;
-import com.persagy.proxy.adm.request.AdmCreateResponse;
 import com.persagy.proxy.adm.request.AdmResponse;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
 
@@ -30,4 +26,18 @@ public interface AdmRelCalService {
      * Update By lijie 2021/9/11 20:35
      */
     void calcRelation(InstanceUrlParam context, List<AdmRelationTypeEnum> admRelationTypeEnums, String objectTypeStr, String relationTypeStr);
+    /***
+     * Description: 计算空间服务于空间的关系
+     * @param context : 通用参数
+     * @param buildingId : 建筑id
+     * @param objectType : 对象分类
+     * @param type : 对象类型
+     * @param sp2spArchforarch : 空间服务关系
+     * @return : void
+     * @author : lijie
+     * @date :2021/9/30 14:49
+     * Update By lijie 2021/9/30 14:49
+     */
+    AdmResponse calcRelationForArchForArchSpToSp(InstanceUrlParam context, String buildingId, String objectType, String type,
+                                                 AdmRelationTypeEnum sp2spArchforarch);
 }

+ 64 - 0
src/main/java/com/persagy/proxy/adm/service/impl/AdmCalcSpecialServiceImpl.java

@@ -0,0 +1,64 @@
+package com.persagy.proxy.adm.service.impl;
+
+import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.adm.service.AdmCalcSpecialService;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+/***
+ * Description: 官网关系计算逻辑类
+ * @author : lijie
+ * @date :2021/9/29 11:09
+ * Update By lijie 2021/9/29 11:09
+ */
+@Service
+@RequiredArgsConstructor
+@Slf4j
+public class AdmCalcSpecialServiceImpl implements AdmCalcSpecialService {
+    /***
+     * Description: 管网系统设备分块  +  计算流向
+     * @param context : 基本请求参数
+     * @param relationType : 关系类型
+     * @return : com.persagy.proxy.adm.request.AdmResponse
+     * @author : lijie
+     * @date :2021/9/29 11:12
+     * Update By lijie 2021/9/29 11:12
+     */
+    @Override
+    public AdmResponse sysBolck(InstanceUrlParam context, String relationType) {
+        return null;
+    }
+    /***
+     * Description: 管网计算
+     * @param context : 基本请求参数
+     * @return : com.persagy.proxy.adm.request.AdmResponse
+     * @author : lijie
+     * date :2021/9/29 11:58
+     * Update By lijie 2021/9/29 11:58
+     */
+    @Override
+    public AdmResponse calcNetworks(InstanceUrlParam context) {
+        // 1.根据项目id查询项目下的所有建筑
+        // 2.遍历建筑列表
+        // 2.1 根据建筑id查询建筑下所有楼层
+        // 2.2 获得所有楼层的modelId
+        // 2.3 根据楼层的modelId查询所有modelId当前对应的模型id(currentModelId)
+        // 2.4 风管立管连接
+        // 2.4.1 根据modelId查询所有管道类型大于0的管道
+        // 2.4.2 根据modelId对查询结果进行分组形成一个二维数组
+        // 2.4.3 循环二维数组
+        // 2.4.3.1 从二维数组中筛选出管道类型为2或3的管道:低楼层管道
+        // 2.4.3.2 从二维数组中筛选出管道类型为1或3的管道:高楼层管道
+        // 2.4.3.3 遍历低楼层管道获得{低楼层管道id:[高楼层管道id,高楼层管道id]}
+        // 2.4.3.3.1 获取低楼层管道的直线范围:管道直径>0:管道直径>>1:min(管道宽度,管道高度)>>1
+        // 2.4.3.3.2 获取低楼层管道的x,y坐标:location.points.get(0)
+        // 2.4.3.3.3 获取高楼层管道的x,y坐标:location.points.get(0)
+        // 2.4.3.3.4 mepSystemType(管道系统类型名称)相等且高楼层管道x,y不为空
+        // 2.4.3.3.5 低楼层x,y与高楼层的x,y的勾股和小于直线范围则符合
+
+
+        return null;
+    }
+}

+ 119 - 0
src/main/java/com/persagy/proxy/adm/service/impl/AdmRelCalServiceImpl.java

@@ -1,15 +1,29 @@
 package com.persagy.proxy.adm.service.impl;
 
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
 import com.persagy.dmp.basic.dto.RequestData;
+import com.persagy.dmp.basic.model.QueryCriteria;
+import com.persagy.dmp.basic.utils.QueryCriteriaHelper;
 import com.persagy.dmp.common.constant.CommonConstant;
+import com.persagy.dmp.common.model.response.CommonResult;
+import com.persagy.dmp.digital.client.DigitalObjectFacade;
 import com.persagy.dmp.digital.client.DigitalRelationCaclFacade;
+import com.persagy.dmp.digital.entity.ObjectDigital;
+import com.persagy.proxy.adm.constant.AdmObjectInfoConstant;
+import com.persagy.proxy.adm.constant.AdmObjectType;
 import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
+import com.persagy.proxy.adm.constant.ObjTypeMapping;
+import com.persagy.proxy.adm.dto.TwicePointDTO;
+import com.persagy.proxy.adm.request.AdmResponse;
 import com.persagy.proxy.adm.service.AdmRelCalService;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
+import lombok.Data;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
 import java.util.List;
 
 @Service
@@ -41,4 +55,109 @@ public class AdmRelCalServiceImpl implements AdmRelCalService {
                             .build());
         }
     }
+    /***
+     * Description: 计算空间交通关系
+     * @param context : 通用参数
+     * @param buildingId : 建筑id
+     * @param objectType : 对象类型
+     * @param type : 类型
+     * @param relationTypeEnum : 关系枚举类
+     * @return : void
+     * @author : lijie
+     * @date :2021/9/30 14:49
+     * Update By lijie 2021/9/30 14:49
+     */
+    @Override
+    public AdmResponse calcRelationForArchForArchSpToSp(InstanceUrlParam context, String buildingId, String objectType,
+                                                        String type, AdmRelationTypeEnum relationTypeEnum) {
+        double distance = 100.00;
+        if (StrUtil.isBlank(buildingId)){
+            return AdmResponse.success(new ArrayList<>());
+        }
+        // 1.根据建筑id查询建筑下的所有楼层
+        CommonResult<List<ObjectDigital>> commonResult = DigitalObjectFacade
+                .queryObjectListSuperiorIdPrototype(context.getGroupCode(), context.getProjectId(),
+                context.getAppId(), context.getUserId(), RequestData
+                        .builder()
+                        .buildingId(buildingId)
+                        .objTypes(CollUtil.newHashSet(AdmObjectType.FLOOR.getIndex()))
+                        .build());
+        if (!"success".equals(commonResult.getResult())){
+            return AdmResponse.failure(commonResult.getMessage());
+        }
+        Long count = commonResult.getCount();
+        List<ObjectDigital> data = commonResult.getData();
+        handleFloorRelationCalc(data,context);
+
+        long skip = data.size();
+        while (skip<count){
+            // 有未处理完的楼层
+
+
+
+        }
+
+
+        return null;
+
+    }
+    /***
+     * Description: 处理楼层下的关系计算(BDTP平台已经限制查询数据量)
+     * @param data : 楼层数据
+     * @param context: 请求参数
+     * @return : void
+     * @author : lijie
+     * @date :2021/9/30 16:46
+     * Update By lijie 2021/9/30 16:46
+     */
+    private void handleFloorRelationCalc(List<ObjectDigital> data, InstanceUrlParam context) {
+        if (CollUtil.isEmpty(data)){
+            return;
+        }
+        // 2.循环所有楼层
+        for (ObjectDigital floor : data) {
+            if (!floor.getInfos().has(AdmObjectInfoConstant.MODEL_ID)
+                    || StrUtil.isBlank(floor.getInfos().get(AdmObjectInfoConstant.MODEL_ID).asText())){
+                continue;
+            }
+            // 2.1 根据楼层的modelId查询所有的门
+            List<TwicePointDTO> pointDTOS =
+                    queryAllDoorByFloorModelId(floor
+                            .getInfos()
+                            .get(AdmObjectInfoConstant.MODEL_ID)
+                            .asText(),context);
+            // 2.1 根据楼层id和classCode查询所有的空间
+
+
+            // 2.3 遍历所有的门,得到门拥有的两组x,y坐标
+            // 2.4 遍历坐标组,与空间进行对比,得到所有符合的空间id数组
+            // 2.5 创建空间服务关系的关系数据
+
+
+        }
+
+
+
+
+
+    }
+    /***
+     * Description: 根据楼层模型id查询所有门数据(BDTP限制了查询条数,需要做分页查询)
+     * @param floorModelId : 楼层模型id
+     * @param context: 请求参数上下文
+     * @return : java.util.List<com.persagy.proxy.adm.dto.TwicePointDTO>
+     * @author : lijie
+     * @date :2021/10/8 10:02
+     * Update By lijie 2021/10/8 10:02
+     */
+    private List<TwicePointDTO> queryAllDoorByFloorModelId(String floorModelId, InstanceUrlParam context) {
+        // 门的classCode:CFBEDR,obj_type为equipment
+        //new QueryCriteria();
+        //DigitalObjectFacade.query(context.getGroupCode(),context.getProjectId(),context.getAppId(),context.getUserId(),)
+
+        return null;
+
+
+
+    }
 }

+ 1 - 1
src/main/java/com/persagy/proxy/adm/service/impl/RelationReportService.java

@@ -4,6 +4,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import com.persagy.dmp.simple.client.DigitalObjectSimpleFacade;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
@@ -20,7 +21,6 @@ import com.persagy.dmp.define.client.DigitalRelationDefineFacade;
 import com.persagy.dmp.define.entity.GraphDefine;
 import com.persagy.dmp.define.entity.RelationDefine;
 import com.persagy.dmp.digital.client.DigitalObjectFacade;
-import com.persagy.dmp.digital.client.DigitalObjectSimpleFacade;
 import com.persagy.dmp.digital.client.DigitalRelationFacade;
 import com.persagy.dmp.digital.client.DigitalRelationProjectCalFacade;
 import com.persagy.dmp.digital.entity.ObjectRelation;

+ 11 - 0
src/main/java/com/persagy/proxy/common/entity/InstanceUrlParam.java

@@ -39,4 +39,15 @@ public class InstanceUrlParam implements Serializable {
      * 应用id
      */
     private String appId;
+    /**
+     * 用户id
+     */
+    private String userId;
+
+    public InstanceUrlParam(String groupCode, String schemeId, String projectId, String appId) {
+        this.groupCode = groupCode;
+        this.schemeId = schemeId;
+        this.projectId = projectId;
+        this.appId = appId;
+    }
 }