Browse Source

Merge branch 'develop' of http://39.106.8.246:3003/BDTP/adm-middleware into develop

lvxianyun 3 years ago
parent
commit
cf873a6bd7

+ 5 - 0
docker/k8sfiles/adm-middleware-dev.yml

@@ -53,6 +53,11 @@ spec:
         - name: adm-middleware
           image: labisenlin.persagy.com/library/adm-middleware:latest
           imagePullPolicy: Always
+          resources:
+            limits:
+              memory: 2Gi
+            requests:
+              memory: 512Mi
           volumeMounts:
             - name: springcloud
               mountPath: /data/SpringCloud/bootstarp.yml

+ 5 - 3
src/main/java/com/persagy/proxy/adm/controller/AdmDictController.java

@@ -3,6 +3,7 @@ package com.persagy.proxy.adm.controller;
 import cn.hutool.core.collection.CollUtil;
 import com.persagy.proxy.adm.constant.AdmCommonConstant;
 import com.persagy.proxy.adm.constant.AdmDictConstant;
+import com.persagy.proxy.adm.constant.enums.AdmDictCategoryEnum;
 import com.persagy.proxy.adm.model.*;
 import com.persagy.proxy.adm.request.AdmCreateRequest;
 import com.persagy.proxy.adm.request.AdmQueryCriteria;
@@ -159,7 +160,7 @@ public class AdmDictController {
     }
 
     /**
-     * 查询项目下已有的设备类型带系统(废弃:数据中心无此接口)
+     * 查询项目下已有的设备类型带系统
      * @param projectId
      * @param request
      * @return
@@ -168,10 +169,11 @@ public class AdmDictController {
     @PostMapping("/system/equip/category")
     @Deprecated
     public AdmResponse querySystemEquipCategory(@QueryParam("projectId") String projectId,
-                                 @RequestBody AdmDictQueryCriteria request) throws Exception {
+                                 @RequestBody AdmDict request) throws Exception {
         // 组装上下文条件
         InstanceUrlParam context = new InstanceUrlParam(groupCode, null, projectId, AdmCommonConstant.APP_ID);
-        return AdmResponse.success(new ArrayList<>());
+        request.setType(AdmDictCategoryEnum.SYSTEM_EQUIP.getValue());
+        return service.queryCategory(context,request,AdmObjectType.class);
     }
 
     /**

+ 3 - 0
src/main/java/com/persagy/proxy/adm/controller/AdmLocationPointController.java

@@ -169,6 +169,9 @@ public class AdmLocationPointController {
             return;
         }
         List<AdmLocationPoint> points = (List<AdmLocationPoint>) admResponse.getContent();
+        if(CollUtil.isEmpty(points)){
+            return;
+        }
         for (AdmLocationPoint point : points) {
             ArrayList<AdmPointImage> imageList = point.getImageList();
             if(CollUtil.isEmpty(imageList)){

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

@@ -310,10 +310,6 @@ public class AdmRelCalController {
     }
     /***
      * Description: 添加关系(图类型关系为ThroughRelationship)
-     * @param relType : 关系类型
-     * @param objectTypeStr : 参与计算的业务空间(为空表示所有业务空间类型),以英文逗号隔开 HeatingZone,CleanZone,
-     *                      DomesticWaterSupplyZone,NetworkZone,TenantZone,AirConditioningZone,FunctionZone,
-     *                      FireZone,SecurityZone,GeneralZone,PowerSupplyZone,LightingZone
      * fl2fl:楼层贯通关系
      * sh2sh:竖井贯通关系
      * @return : com.persagy.proxy.adm.request.AdmCreateResponse
@@ -322,14 +318,17 @@ public class AdmRelCalController {
      * Update By lijie 2021/8/31 12:10
      */
     @PostMapping(value = {"fl2fl","sh2sh"})
-    public AdmResponse throughRelationshipCalcRelation( @PathVariable("relType") String relType,
-                                     @QueryParam("projectId") String projectId,
-                                     @QueryParam("objectTypes") String objectTypeStr,
-                                     @QueryParam("relationType") String relationTypeStr) throws Exception {
+    public AdmResponse throughRelationshipCalcRelation(@RequestParam("projectId") String projectId,
+                                                       @RequestParam("groupCode") String groupCode,
+                                                       @RequestParam("appId") String appId,
+                                                       @RequestParam("userId") String userId,
+                                                       HttpServletRequest request) 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.calcRelation(context,CollUtil.newArrayList(getAdmRelationTypeEnum(request)),null);
         return AdmResponse.success(new ArrayList<>());
     }
 
@@ -384,7 +383,7 @@ public class AdmRelCalController {
      */
     private String getSuffixRequestUrl(HttpServletRequest request) {
         String requestURI = request.getRequestURI();
-        return requestURI.substring(requestURI.lastIndexOf("/"));
+        return requestURI.substring(requestURI.lastIndexOf("/")+1);
     }
 
 

+ 6 - 2
src/main/java/com/persagy/proxy/adm/controller/ComponentBuildingController.java

@@ -115,8 +115,9 @@ public class ComponentBuildingController {
 			result.put("objectType", master.getObjType());
 			result.put("projectId", master.getProjectId());
 			result.put("infos", master.getInfos());
-			result.put("createTime", master.getCreationTime() == null ? null : master.getCreationTime().toString("yyyy-DD-MM 24HH:mm:ss"));
-			result.put("lastUpdate", master.getModifiedTime() == null ? null : master.getModifiedTime().toString("yyyy-DD-MM 24HH:mm:ss"));
+
+			result.put("createTime", master.getCreationTime() == null ? null : master.getCreationTime().toString("yyyy-MM-dd HH:mm:ss"));
+			result.put("lastUpdate", master.getModifiedTime() == null ? null : master.getModifiedTime().toString("yyyy-MM-dd HH:mm:ss"));
 			result.put("statistics", new JSONObject());
 			
 			List<ObjectDigital> slaveObjs = master.getRelObjs();
@@ -124,6 +125,9 @@ public class ComponentBuildingController {
 				// 遍历所有的从对象
 				for (ObjectDigital slave : slaveObjs) {
 					ObjectNode infos = slave.getInfos();
+					if(infos == null){
+						continue;
+					}
 					String outline = infos.get("outline") == null ? null : infos.get("outline").asText();
 					String modelFile = infos.get("modelFile") == null ? null : infos.get("modelFile").asText();
 					if (StrUtil.isEmpty(outline) && StrUtil.isNotBlank(modelFile)) {

+ 2 - 2
src/main/java/com/persagy/proxy/adm/service/impl/AbstractAdmBaseServiceImpl.java

@@ -59,7 +59,7 @@ public class AbstractAdmBaseServiceImpl<T> implements IAdmBaseService<T> {
         // 转换参数
         JSONObject para = null;
         try {
-            para = JsonHelper.toJSONObject(dmpRequest);
+            para = JsonHelper.toJsonObject(dmpRequest);
         } catch (IOException e) {
             log.error(e.getMessage(), e);
             return null;
@@ -383,7 +383,7 @@ public class AbstractAdmBaseServiceImpl<T> implements IAdmBaseService<T> {
         // 转换参数
         JSONObject para = null;
         try {
-            para = JsonHelper.toJSONObject(dmpRequest);
+            para = JsonHelper.toJsonObject(dmpRequest);
         } catch (IOException e) {
             log.error(e.getMessage(), e);
             return null;

+ 8 - 4
src/main/java/com/persagy/proxy/adm/service/impl/AbstractAdmDictBaseServiceImpl.java

@@ -26,7 +26,7 @@ import com.persagy.proxy.common.entity.InstanceUrlParam;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
+import org.springframework.beans.factory.annotation.Value;
 
 import java.io.IOException;
 import java.util.ArrayList;
@@ -48,6 +48,9 @@ public class AbstractAdmDictBaseServiceImpl<T> implements IAdmDictBaseService<T>
     @Autowired
     private DmpDicClient dicClient;
 
+    @Value("${middleware.group.code}")
+    private String groupCode;
+
     /**
      * 查询DMP字典数据
      * @param context
@@ -60,7 +63,7 @@ public class AbstractAdmDictBaseServiceImpl<T> implements IAdmDictBaseService<T>
         // 转换参数
         JSONObject para = null;
         try {
-            para = JsonHelper.toJSONObject(dmpRequest);
+            para = JsonHelper.toJsonObject(dmpRequest);
         } catch (IOException e) {
             log.error(e.getMessage(), e);
             return null;
@@ -88,7 +91,7 @@ public class AbstractAdmDictBaseServiceImpl<T> implements IAdmDictBaseService<T>
         // 转换参数
         JSONObject para = null;
         try {
-            para = JsonHelper.toJSONObject(dmpRequest);
+            para = JsonHelper.toJsonObject(dmpRequest);
         } catch (IOException e) {
             log.error(e.getMessage(), e);
             return null;
@@ -119,7 +122,7 @@ public class AbstractAdmDictBaseServiceImpl<T> implements IAdmDictBaseService<T>
         // 转换参数
         JSONObject para = null;
         try {
-            para = JsonHelper.toJSONObject(dmpRequest);
+            para = JsonHelper.toJsonObject(dmpRequest);
         } catch (IOException e) {
             log.error(e.getMessage(), e);
             return null;
@@ -192,6 +195,7 @@ public class AbstractAdmDictBaseServiceImpl<T> implements IAdmDictBaseService<T>
             admVO.setSecondName(admVO.getSecondTag());
             admVO.setMultiple(admVO.getIsMultiple());
             admVO.setRegion(admVO.getIsRegion());
+            admVO.setGroupCode(groupCode);
 
             //path路径处理
             if(StringUtils.isEmpty(admVO.getFirstName()) || AdmDictConstant.FIRST_BASE_TAG.equals(admVO.getFirstName())

+ 3 - 2
src/main/java/com/persagy/proxy/adm/service/impl/AdmDictServiceImpl.java

@@ -118,7 +118,7 @@ public class AdmDictServiceImpl<T> extends AbstractAdmDictBaseServiceImpl<T> imp
             //查询专业下的系统
             content = buildDictTree(allMajor,majorSystemMap,null);
         }
-        if(AdmDictCategoryEnum.SYSTEM_EQUIP.getValue().equals(type)){
+        if(AdmDictCategoryEnum.SYSTEM_EQUIP.getValue().equals(type) || AdmDictCategoryEnum.EQUIPMENT.getValue().equals(type)){
             //查询系统下的设备类
             content = buildDictTree(systems,systemEquipMap,null);
         }
@@ -194,7 +194,7 @@ public class AdmDictServiceImpl<T> extends AbstractAdmDictBaseServiceImpl<T> imp
      */
     private List<String> getDictBaseCategory(){
         List<String> category = new ArrayList<>();
-        category.add(AdmDictCategoryEnum.EQUIPMENT.getValue());
+        //category.add(AdmDictCategoryEnum.EQUIPMENT.getValue());
         category.add(AdmDictCategoryEnum.COMPONENT.getValue());
         category.add(AdmDictCategoryEnum.SYSTEM.getValue());
         category.add(AdmDictCategoryEnum.SPACE.getValue());
@@ -213,6 +213,7 @@ public class AdmDictServiceImpl<T> extends AbstractAdmDictBaseServiceImpl<T> imp
         category.add(AdmDictCategoryEnum.MAJOR_SYSTEM_EQUIP.getValue());
         category.add(AdmDictCategoryEnum.EQUIPMENT_COMPONENT.getValue());
         category.add(AdmDictCategoryEnum.SYSTEM_EQUIP.getValue());
+        category.add(AdmDictCategoryEnum.EQUIPMENT.getValue());
         return category;
     }