Sfoglia il codice sorgente

Merge remote-tracking branch 'origin/develop' into develop

# Conflicts:
#	adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/DiagramBuilder.java
liyang 2 anni fa
parent
commit
a2e4f15dc6

+ 0 - 41
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/DiagramBuilder.java

@@ -335,47 +335,6 @@ public class DiagramBuilder {
 			}
 		}
 
-		//test code TODO
-//		diagram.getLines().clear();
-		EquipmentNode n1 = null;
-		EquipmentNode n2 = null;
-		MainPipe mp2 = null;
-		for(Object o : equipMap.values()) {
-			if(o instanceof EquipmentNode){
-				String txt = DiagramBuilder.getName((ObjectNode) ((EquipmentNode) o).getDataObject());
-				if("1#进线柜".equals(txt)) {
-					n1 = (EquipmentNode) o;
-				} else if("2#变压器柜".equals(txt)) {
-					n2 = (EquipmentNode) o;
-				}
-			} else if(o instanceof MainPipe){
-				String txt = DiagramBuilder.getName((ObjectNode) ((MainPipe) o).getDataObject());
-				if("1#高压供电母线".equals(txt)) {
-					mp2 = (MainPipe) o;
-				}
-			}
-		}
-		if(n1 != null && n2 != null && mp2 != null) {
-			ConnectPoint p1 = new ConnectPoint();
-			p1.setHostType(EquipmentNode.TYPE);
-			p1.setHostId(n1.getId());
-			p1.setAnchorCode("B3");
-			p1.setHostObj(n1);
-
-			ConnectPoint p2 = new ConnectPoint();
-//			p2.setHostType(EquipmentNode.TYPE);
-//			p2.setHostId(n2.getId());
-//			p2.setAnchorCode("T3");
-//			p2.setHostObj(n2);
-			p2.setHostType(MainPipe.TYPE);
-			p2.setHostId(mp2.getId());
-			p2.setHostObj(mp2);
-
-			Line line = new Line();
-			line.setFrom(p1);
-			line.setTo(p2);
-			addLine(line);
-		}
 	}
 
 	private ConnectPoint getConnectPoint(Object obj, String  relType, Object theOtherEnd){

+ 1 - 0
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/ConnectPoint.java

@@ -40,6 +40,7 @@ public class ConnectPoint {
 	/**
 	 * 连接点绝对坐标
 	 */
+	@JsonIgnore
 	private XY location;
 
 	/**

+ 23 - 0
adm-business/adm-middleware/src/main/java/com/persagy/proxy/common/client/DmpRwdClient.java

@@ -214,4 +214,27 @@ public interface DmpRwdClient {
     @PostMapping(DmpUrlConstant.QUERY_OBJECT_CLASS_CODE)
     DmpResult<List<String>> queryObjectClassCode(@SpringQueryMap InstanceUrlParam objectUrlParam, @RequestBody JSONObject criteria);
 
+
+    /**
+     * @description: 查询交付类型
+     * @param: objectUrlParam 对象请求url通用参数
+     * @param: criteria post请求参数
+     * @return: com.persagy.dmp.common.DmpResult
+     */
+    @PostMapping(DmpUrlConstant.DEF_CLASS_COLLECT)
+    DmpResult<JSONArray> queryObjectClassCollect(@SpringQueryMap InstanceUrlParam objectUrlParam, @RequestBody JSONObject criteria);
+
+
+
+
+    /**
+     * @description: 查询交付关系
+     * @param: objectUrlParam 对象请求url通用参数
+     * @param: criteria post请求参数
+     * @return: com.persagy.dmp.common.DmpResult
+     */
+    @PostMapping(DmpUrlConstant.DEF_REL_COLLECT)
+    DmpResult<JSONArray> queryObjectRelCollect(@SpringQueryMap InstanceUrlParam objectUrlParam, @RequestBody JSONObject criteria);
+
+
 }

+ 11 - 0
adm-business/adm-middleware/src/main/java/com/persagy/proxy/common/constant/DmpUrlConstant.java

@@ -164,4 +164,15 @@ public class DmpUrlConstant {
      */
     public static final String QUERY_OBJECT_CLASS_CODE = "/rwd/instance/object/queryObjectClassCode";
 
+
+    /**
+     * 查询采集信息 类型
+     */
+    public final static String DEF_CLASS_COLLECT = "/rwd/def/class/collect/query";
+
+    /**
+     * 查询采集信息 关系
+     */
+    public final static String DEF_REL_COLLECT = "/rwd/def/rel/collect/query";
+
 }

+ 1 - 1
adm-business/adm-middleware/src/main/java/com/persagy/proxy/dictionary/controller/AdmDictController.java

@@ -269,7 +269,7 @@ public class AdmDictController {
         }
         Map<String, Set<String>> classCodeMap = classCodes.stream().collect(Collectors.groupingBy(item->item.substring(0,4),Collectors.toSet()));
         //查询系统设备类树
-        AdmDict admDict = new AdmDict(AdmDictCategoryEnum.SYSTEM_EQUIP.getValue());
+        AdmDict admDict = new AdmDict(AdmDictCategoryEnum.SYSTEM_EQUIP.getValue(), null);
         AdmResponse categoryResponse = service.queryCategory(context, admDict, clazz);
         List<AdmObjectType> objectTypes = (List<AdmObjectType>) categoryResponse.getContent();
         if(CollUtil.isEmpty(objectTypes)){

+ 2 - 0
adm-business/adm-middleware/src/main/java/com/persagy/proxy/dictionary/model/AdmDict.java

@@ -19,4 +19,6 @@ import lombok.NoArgsConstructor;
 public class AdmDict {
 
   private String type;
+  /** 交付内类型:0 项目交付(web),1 现场交付(app) **/
+  private Integer deliveryType;
 }

+ 5 - 0
adm-business/adm-middleware/src/main/java/com/persagy/proxy/dictionary/model/AdmObjectType.java

@@ -61,4 +61,9 @@ public class AdmObjectType {
 
     /** 更新时间 */
     private String lastUpdate;
+
+    /** 交付类型:0-项目交付 1-现场交付  */
+    private Integer deliveryType = -1;
+    /** 是否交付 0-否 1-是 */
+    private Integer isDelivery = -1;
 }

+ 5 - 0
adm-business/adm-middleware/src/main/java/com/persagy/proxy/dictionary/service/IAdmDictBaseService.java

@@ -1,9 +1,11 @@
 package com.persagy.proxy.dictionary.service;
 
 import com.persagy.dmp.basic.model.QueryCriteria;
+import com.persagy.dmp.delivery.entity.ObjectTypeCollect;
 import com.persagy.proxy.adm.request.AdmQueryCriteria;
 import com.persagy.proxy.adm.request.AdmResponse;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
+import com.persagy.proxy.dictionary.model.AdmObjectType;
 
 import java.util.List;
 
@@ -71,6 +73,8 @@ public interface IAdmDictBaseService<T>{
      */
     AdmResponse doQueryObjectInfoCollect(InstanceUrlParam context, AdmQueryCriteria request, String fieldName, Class<T> clazz);
 
+    AdmResponse doQueryObjectTypeCollect(InstanceUrlParam context, QueryCriteria queryCriteria);
+
     /**
      * 设置采集信息点
      * @param context
@@ -79,6 +83,7 @@ public interface IAdmDictBaseService<T>{
      * @return
      */
     List<T> doSetObjectInfoCollect(InstanceUrlParam context, Class<T> clazz, List<T> voList);
+    List<AdmObjectType> doSetObjectTypeCollect(List<AdmObjectType> typeList, List<ObjectTypeCollect> collectTypeList);
 
 
 }

+ 42 - 2
adm-business/adm-middleware/src/main/java/com/persagy/proxy/dictionary/service/impl/AbstractAdmDictBaseServiceImpl.java

@@ -12,6 +12,7 @@ import com.persagy.dmp.common.constant.ValidEnum;
 import com.persagy.dmp.common.context.AppContext;
 import com.persagy.dmp.common.utils.JsonHelper;
 import com.persagy.dmp.delivery.entity.ObjectInfoCollect;
+import com.persagy.dmp.delivery.entity.ObjectTypeCollect;
 import com.persagy.proxy.adm.constant.AdmCommonConstant;
 import com.persagy.proxy.adm.constant.AdmDictConstant;
 import com.persagy.proxy.adm.request.AdmQueryCriteria;
@@ -30,8 +31,7 @@ import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.*;
 
 /**
  * @ClassName AbstractAdmDictBaseServiceImpl
@@ -352,6 +352,26 @@ public class AbstractAdmDictBaseServiceImpl<T> implements IAdmDictBaseService<T>
         return response;
     }
 
+    @Override
+    public AdmResponse doQueryObjectTypeCollect(InstanceUrlParam context, QueryCriteria dmpRequest) {
+        // 转换为数据中台查询条件
+        // 转换参数
+        JSONObject para = null;
+        try {
+            para = JsonHelper.toJsonObject(dmpRequest);
+        } catch (IOException e) {
+            log.error(e.getMessage(), e);
+            return null;
+        }
+        // 调用中台查询
+        log.info(para.toString());
+        DmpResult<JSONArray> dmpResult = rwdClient.queryObjectClassCollect(context, para);
+        List<ObjectTypeCollect> admVOs = AdmEntityTransferUtil.toAdmMultiEntity(dmpResult.getData(), null, ObjectTypeCollect.class);
+        // 设置返回值
+        AdmResponse response = AdmResponse.success(admVOs);
+        return response;
+    }
+
     /**
      * 设置采集信息
      * @param context
@@ -374,4 +394,24 @@ public class AbstractAdmDictBaseServiceImpl<T> implements IAdmDictBaseService<T>
         return AdmEntityTransferUtil.toAdmMultiEntity(response.getData(), null, clazz);
     }
 
+    @Override
+    public List<AdmObjectType> doSetObjectTypeCollect(List<AdmObjectType> typeList, List<ObjectTypeCollect> collectTypeList) {
+        if(CollUtil.isEmpty(typeList)){
+            return Collections.emptyList();
+        }
+        if(CollUtil.isEmpty(collectTypeList)){
+            return typeList;
+        }
+
+        Map<String, ObjectTypeCollect> collectMap = CollUtil.fieldValueMap(collectTypeList, "defineTypeId");
+        for(AdmObjectType admObjectType : typeList){
+            if(collectMap.containsKey(admObjectType.getId())){
+                ObjectTypeCollect collect = collectMap.get(admObjectType.getId());
+                admObjectType.setDeliveryType(collect.getDeliveryType());
+                admObjectType.setIsDelivery(collect.getIsDelivery());
+            }
+        }
+        return typeList;
+    }
+
 }

+ 17 - 5
adm-business/adm-middleware/src/main/java/com/persagy/proxy/dictionary/service/impl/AdmDictServiceImpl.java

@@ -7,6 +7,7 @@ import com.fasterxml.jackson.databind.node.JsonNodeFactory;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.persagy.dmp.basic.model.QueryCriteria;
 import com.persagy.dmp.delivery.entity.ObjectInfoCollect;
+import com.persagy.dmp.delivery.entity.ObjectTypeCollect;
 import com.persagy.proxy.adm.constant.AdmDictConstant;
 import com.persagy.proxy.adm.constant.AdmDictCategoryEnum;
 import com.persagy.proxy.adm.request.AdmCreateRequest;
@@ -50,13 +51,14 @@ public class AdmDictServiceImpl<T> extends AbstractAdmDictBaseServiceImpl<T> imp
     @Override
     public AdmResponse queryCategory(InstanceUrlParam context , AdmDict request, Class<T> clazz) {
         String type = request.getType();
+        AdmResponse admResponse = new AdmResponse();
         QueryCriteria criteria = new QueryCriteria();
         ObjectNode node = JsonNodeFactory.instance.objectNode();
         if(AdmDictCategoryEnum.MAJOR.getValue().equals(type)){
             //查询专业分类
             node.put("type",AdmDictCategoryEnum.MAJOR.getValue());
             criteria.setCriteria(node);
-            return doQueryDictData(context, criteria, clazz);
+            admResponse = doQueryDictData(context, criteria, clazz);
         }
 
         List<String> baseCategory = getDictBaseCategory();
@@ -64,7 +66,7 @@ public class AdmDictServiceImpl<T> extends AbstractAdmDictBaseServiceImpl<T> imp
             //查询设备类型:equipment,部件类型:component,输入系统类型:system,输入专业类型:major,业务空间类型 space ,资产 property
             node.put("objType",type);
             criteria.setCriteria(node);
-            return doQueryObjectType(context, criteria, clazz);
+            admResponse = doQueryObjectType(context, criteria, clazz);
         }
 
         if(AdmDictCategoryEnum.EQUIPMENT_AND_COMPONENT.getValue().equals(type)){
@@ -73,15 +75,25 @@ public class AdmDictServiceImpl<T> extends AbstractAdmDictBaseServiceImpl<T> imp
             arrayNode.add(AdmDictCategoryEnum.COMPONENT.getValue());
             arrayNode.add(AdmDictCategoryEnum.EQUIPMENT.getValue());
             criteria.setCriteria(node);
-            return doQueryObjectType(context, criteria, clazz);
+            admResponse = doQueryObjectType(context, criteria, clazz);
         }
         List<String> dictTreeCategory = getDictTreeCategory();
         if(dictTreeCategory.contains(type)){
             //查询树形结构:专业和系统:majorSystem(树),设备类型要以及对应的部件equipmentComponent(树),专业下的设备类型 majorEquipment(树),
             //专业下的系统,系统下的设备majorSystemEquip (树),systemEquip 系统下的设备类(树)
-            return queryDictObjectTypeTree(context ,type,clazz);
+            admResponse = queryDictObjectTypeTree(context ,type,clazz);
         }
-        return null;
+
+        QueryCriteria criteriaCollect = new QueryCriteria();
+        ObjectNode nodeCol = JsonNodeFactory.instance.objectNode();
+        nodeCol.put("projectId", context.getProjectId());
+        criteriaCollect.setCriteria(nodeCol);
+
+        AdmResponse colType = doQueryObjectTypeCollect(context, criteriaCollect);
+        List<AdmObjectType> admObjectTypes = (List<AdmObjectType>) admResponse.getContent();
+        List<ObjectTypeCollect> collectList = (List<ObjectTypeCollect>) colType.getContent();
+        admResponse.setContent(doSetObjectTypeCollect(admObjectTypes, collectList));
+        return admResponse;
     }