Browse Source

Merge branch 'develop' of http://39.106.8.246:3003/BDTP/digital-delivery into develop

 Conflicts:
	adm-business/adm-middleware/src/main/java/com/persagy/proxy/calculation/service/impl/AdmManualRelCalServiceImpl.java
lijie 3 years ago
parent
commit
c62afa38f2
59 changed files with 1467 additions and 616 deletions
  1. 6 0
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/config/InterceptorAdapterConfig.java
  2. 38 39
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/controller/CommonController.java
  3. 80 70
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/controller/DemoDiagramController.java
  4. 0 2
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/controller/DiagramController.java
  5. 0 2
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/controller/IconController.java
  6. 26 22
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/controller/LegendController.java
  7. 3 4
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/controller/TemplateController.java
  8. 59 91
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/DiagramBuilder.java
  9. 22 24
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/DiagramDataLoader.java
  10. 0 55
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/DiagramView.java
  11. 9 9
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/line/LineLayoutManager.java
  12. 13 0
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/line/PathBuilder.java
  13. 11 1
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/AbstractLine.java
  14. 7 1
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/ConnectPoint.java
  15. 50 23
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/Diagram.java
  16. 27 12
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/EquipmentNode.java
  17. 7 0
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/Line.java
  18. 9 0
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/base/AbstractComponent.java
  19. 22 1
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/base/Container.java
  20. 2 0
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/base/IComponent.java
  21. 1 1
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/base/IContainer.java
  22. 17 0
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/base/IDataBind.java
  23. 4 0
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/base/XY.java
  24. 5 5
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/legend/Anchor.java
  25. 2 2
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/logic/AndFilter.java
  26. 123 0
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/logic/CalcContext.java
  27. 5 3
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/logic/DataFilter.java
  28. 1 1
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/logic/MatchFilter.java
  29. 2 2
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/logic/OrFilter.java
  30. 126 0
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/logic/RelationFilter.java
  31. 2 2
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/template/ContainerRefPoint.java
  32. 17 0
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/template/DiagramTemplate.java
  33. 172 32
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/template/MainPipe.java
  34. 8 0
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/virtual/PackNode.java
  35. 3 4
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/util/GsonUtil.java
  36. 64 15
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/util/MyObjectMapper.java
  37. 2 0
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/frame/EditRequest.java
  38. 15 25
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/manage/DemoDiagramManager.java
  39. 47 69
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/manage/TemplateManager.java
  40. 2 2
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/calculation/model/AdmRelationAddRequest.java
  41. 82 6
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/calculation/service/impl/AdmManualRelCalServiceImpl.java
  42. 7 6
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/common/client/DmpRwdClient.java
  43. 2 2
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/dictionary/model/AdmObjectType.java
  44. 10 6
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/dictionary/service/impl/AbstractAdmDictBaseServiceImpl.java
  45. 5 1
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/dictionary/service/impl/AdmDictServiceImpl.java
  46. 19 1
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/object/controller/AdmProjectController.java
  47. 3 12
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/object/model/AdmProject.java
  48. 10 1
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/report/service/IRelationReportService.java
  49. 26 8
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/report/service/impl/RelationReportService.java
  50. 18 15
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/client/RwdClient.java
  51. 60 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/dto/ObjectInfoCollectDTO.java
  52. 38 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/dto/ObjectTypeCollectDTO.java
  53. 65 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/dto/RelationDefineCollectDTO.java
  54. 7 4
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/entity/Dict.java
  55. 1 1
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/entity/db/ObjectInfoCollect.java
  56. 1 1
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/entity/db/RelationDefineCollect.java
  57. 13 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/enums/DeliveryTypeEnum.java
  58. 19 7
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/SyncAppImpl.java
  59. 72 26
      adm-business/adm-server/src/main/resources/db/init/data.sql

+ 6 - 0
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/config/InterceptorAdapterConfig.java

@@ -4,6 +4,7 @@ package com.persagy.adm.diagram.config;
 import com.persagy.adm.diagram.frame.BdtpInterceptor;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.CorsRegistry;
 import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
 import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
 
@@ -24,4 +25,9 @@ public class InterceptorAdapterConfig implements WebMvcConfigurer {
 		registry.addInterceptor(bdtpInterceptor());
 	}
 
+//	@Override
+//	public void addCorsMappings(CorsRegistry registry) {
+//		registry.addMapping("/**");
+//	}
+
 }

+ 38 - 39
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/controller/CommonController.java

@@ -11,7 +11,6 @@ import com.persagy.dmp.common.utils.ResultHelper;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.web.bind.annotation.CrossOrigin;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -21,55 +20,55 @@ import java.util.Map;
 
 /**
  * 公共接口
+ *
  * @author zhaoyk
  * @date 2021-12-27
  */
 @RestController
-@CrossOrigin
 public class CommonController {
 
-	@Autowired
-	private BdtpDataService bdtpDataService;
+    @Autowired
+    private BdtpDataService bdtpDataService;
 
-	@Autowired
-	@Qualifier(DataStrategy.IMPL_QUALIFIER)
-	private DataStrategy dataStrategy;
+    @Autowired
+    @Qualifier(DataStrategy.IMPL_QUALIFIER)
+    private DataStrategy dataStrategy;
 
-	@GetMapping("equipTypes")
-	public CommonResult<List<ObjectNode>> equipTypes(){
-		return ResultHelper.single(bdtpDataService.getEquipTypeList(BdtpRequest.getCurrent(), null));
-	}
+    @GetMapping("equipTypes")
+    public CommonResult<List<ObjectNode>> equipTypes() {
+        return ResultHelper.single(bdtpDataService.getEquipTypeList(BdtpRequest.getCurrent(), null));
+    }
 
-	@GetMapping("relTypes")
-	public CommonResult<List<Map<String, Object>>> relTypes(){
-		return ResultHelper.single(bdtpDataService.getRelTypeTree(BdtpRequest.getCurrent()));
-	}
+    @GetMapping("relTypes")
+    public CommonResult<List<Map<String, Object>>> relTypes() {
+        return ResultHelper.single(bdtpDataService.getRelTypeTree(BdtpRequest.getCurrent()));
+    }
 
-	@GetMapping("majSys")
-	public CommonResult<List<ObjectNode>> majSys(){
-		BdtpRequest req = BdtpRequest.getCurrent();
-		List<ObjectNode> majList = bdtpDataService.getMajorList(req);
-		List<ObjectNode> sysList = bdtpDataService.getSystemList(req);
+    @GetMapping("majSys")
+    public CommonResult<List<ObjectNode>> majSys() {
+        BdtpRequest req = BdtpRequest.getCurrent();
+        List<ObjectNode> majList = bdtpDataService.getMajorList(req);
+        List<ObjectNode> sysList = bdtpDataService.getSystemList(req);
 
-		for(ObjectNode maj : majList){
-			ArrayNode childrenSys = maj.putArray("children");
-			String majorCode = maj.get("code").asText();
-			maj.put("name", maj.get("label").asText());
-			for(Iterator<ObjectNode> sysIter = sysList.iterator(); sysIter.hasNext();){
-				ObjectNode sys = sysIter.next();
-				if(sys.get("majorCode") != null && sys.get("majorCode").asText().equals(majorCode)){
-					childrenSys.add(sys);
-					sysIter.remove();
-				}
-			}
-		}
-		return ResultHelper.single(majList);
-	}
+        for (ObjectNode maj : majList) {
+            ArrayNode childrenSys = maj.putArray("children");
+            String majorCode = maj.get("code").asText();
+            maj.put("name", maj.get("label").asText());
+            for (Iterator<ObjectNode> sysIter = sysList.iterator(); sysIter.hasNext(); ) {
+                ObjectNode sys = sysIter.next();
+                if (sys.get("majorCode") != null && sys.get("majorCode").asText().equals(majorCode)) {
+                    childrenSys.add(sys);
+                    sysIter.remove();
+                }
+            }
+        }
+        return ResultHelper.single(majList);
+    }
 
-	@ApiOperation("查询系统图类型列表")
-	@GetMapping("diagramTypes")
-	public CommonResult<List<DiagramType>> diagramTypes(){
-		return ResultHelper.single(dataStrategy.getDiagramTypes());
-	}
+    @ApiOperation("查询系统图类型列表")
+    @GetMapping("diagramTypes")
+    public CommonResult<List<DiagramType>> diagramTypes() {
+        return ResultHelper.single(dataStrategy.getDiagramTypes());
+    }
 
 }

+ 80 - 70
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/controller/DemoDiagramController.java

@@ -1,95 +1,105 @@
 package com.persagy.adm.diagram.controller;
 
+import com.persagy.adm.diagram.core.model.Diagram;
 import com.persagy.adm.diagram.frame.EditRequest;
 import com.persagy.adm.diagram.manage.DemoDiagramManager;
 import com.persagy.adm.diagram.manage.Folder;
-import com.persagy.adm.diagram.core.model.Diagram;
 import com.persagy.dmp.common.model.response.CommonResult;
 import com.persagy.dmp.common.utils.ResultHelper;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
 
 import java.util.List;
 import java.util.Map;
 
 @RestController
-@CrossOrigin
 @RequestMapping("diagram0")
 public class DemoDiagramController {
 
-	@Autowired
-	private DemoDiagramManager diagramManager;
+    @Autowired
+    private DemoDiagramManager diagramManager;
 
-	/**
-	 * 查询系统图
-	 * @param projectId 项目id
-	 * @param systemId 系统实例id
-	 * @param groupCode 集团编码
-	 * @return 树形结构数据(专业-系统-类型-图)
-	 */
-	@ApiOperation("查询系统图,返回树形结构")
-	@GetMapping("getDiagrams")
-	public CommonResult<List<Folder>> getDiagrams(@RequestParam String projectId,
-												  @RequestParam(required = false) String systemId,
-												  @RequestParam(required = false) String groupCode){
-		return ResultHelper.single(diagramManager.getDiagrams(projectId, systemId, groupCode));
-	}
+    /**
+     * 查询系统图
+     *
+     * @param projectId 项目id
+     * @param systemId  系统实例id
+     * @param groupCode 集团编码
+     * @return 树形结构数据(专业 - 系统 - 类型 - 图)
+     */
+    @ApiOperation("查询系统图,返回树形结构")
+    @GetMapping("getDiagrams")
+    public CommonResult<List<Folder>> getDiagrams(@RequestParam String projectId,
+                                                  @RequestParam(required = false) String systemId,
+                                                  @RequestParam(required = false) String groupCode) {
+        return ResultHelper.single(diagramManager.getDiagrams(projectId, systemId, groupCode));
+    }
 
-	/**
-	 * 新建系统图
-	 * @param params 新建参数,对象类型,包含字段 name:名称, type:系统图类型编码
-	 * @param projectId 项目id
-	 * @param systemId 系统实例id
-	 * @param groupCode 集团编码
-	 * @return 新建的系统图对象
-	 */
-	@PostMapping("newDiagram")
-	public CommonResult<Diagram> newDiagram(@RequestBody Map<String, String> params,
-											@RequestParam String projectId,
-											@RequestParam(required = false) String systemId,
-											@RequestParam(required = false) String groupCode){
-		return ResultHelper.single(diagramManager.createDiagram(params.get("name"), params.get("type"), projectId, systemId, groupCode));
-	}
+    /**
+     * 新建系统图
+     *
+     * @param params    新建参数,对象类型,包含字段 name:名称, type:系统图类型编码
+     * @param projectId 项目id
+     * @param systemId  系统实例id
+     * @param groupCode 集团编码
+     * @return 新建的系统图对象
+     */
+    @PostMapping("newDiagram")
+    public CommonResult<Diagram> newDiagram(@RequestBody Map<String, String> params,
+                                            @RequestParam String projectId,
+                                            @RequestParam(required = false) String systemId,
+                                            @RequestParam(required = false) String groupCode) {
+        return ResultHelper.single(diagramManager.createDiagram(params.get("name"), params.get("type"), projectId, systemId, groupCode));
+    }
 
-	/**
-	 * 删除系统图
-	 * @param params 删除参数,对象类型,包含字段 id:系统图id
-	 * @return
-	 */
-	@PostMapping("delDiagram")
-	public CommonResult<Boolean> delDiagram(@RequestBody Map<String, String> params){
-		return ResultHelper.single(diagramManager.deleteDiagram(params.get("id")));
-	}
+    /**
+     * 删除系统图
+     *
+     * @param params 删除参数,对象类型,包含字段 id:系统图id
+     * @return
+     */
+    @PostMapping("delDiagram")
+    public CommonResult<Boolean> delDiagram(@RequestBody Map<String, String> params) {
+        return ResultHelper.single(diagramManager.deleteDiagram(params.get("id")));
+    }
 
-	/**
-	 * 设置(修改)系统图使用的模板
-	 * @param req 编辑参数,对象类型,包含字段 diagramId:系统图id, templateId:使用的模板id
-	 * @return 系统图对象
-	 */
-	@PostMapping("setTemplate")
-	public CommonResult<Diagram> setTemplate(@RequestBody EditRequest req){
-		return ResultHelper.single(diagramManager.setTemplate(req.getDiagramId(), req.getTemplateId()));
-	}
+    /**
+     * 设置(修改)系统图使用的模板
+     *
+     * @param req 编辑参数,对象类型,包含字段 diagramId:系统图id, templateId:使用的模板id
+     * @return 系统图对象
+     */
+    @PostMapping("setTemplate")
+    public CommonResult<Diagram> setTemplate(@RequestBody EditRequest req) {
+        return ResultHelper.single(diagramManager.setTemplate(req.getDiagramId(), req.getTemplateId()));
+    }
 
-	/**
-	 * 自动加载数据
-	 * @param req 编辑参数,对象类型,包含字段 diagramId:系统图id
-	 * @return 系统图对象
-	 */
-	@PostMapping("loadData")
-	public CommonResult<Diagram> loadData(@RequestBody EditRequest req) {
-		return ResultHelper.single(diagramManager.loadData(req.getDiagramId(), true));
-	}
+    /**
+     * 自动加载数据
+     *
+     * @param req 编辑参数,对象类型,包含字段 diagramId:系统图id
+     * @return 系统图对象
+     */
+    @PostMapping("loadData")
+    public CommonResult<Diagram> loadData(@RequestBody EditRequest req) {
+        return ResultHelper.single(diagramManager.loadData(req.getDiagramId(), true));
+    }
 
-	/**
-	 * 保存系统图
-	 * @param req 编辑参数,对象类型,包含字段 diagram:系统图对象
-	 * @return 保存后的系统图对象
-	 */
-	@PostMapping("saveDiagram")
-	public CommonResult<Diagram> saveDiagram(@RequestBody EditRequest req) {
-		return ResultHelper.single(diagramManager.saveDiagram(req.getDiagram()));
-	}
+    /**
+     * 保存系统图
+     *
+     * @param req 编辑参数,对象类型,包含字段 diagram:系统图对象
+     * @return 保存后的系统图对象
+     */
+    @PostMapping("saveDiagram")
+    public CommonResult<Diagram> saveDiagram(@RequestBody EditRequest req) {
+        return ResultHelper.single(diagramManager.saveDiagram(req.getDiagram()));
+    }
 
 }

+ 0 - 2
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/controller/DiagramController.java

@@ -21,7 +21,6 @@ import com.persagy.dmp.common.utils.ResultHelper;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.web.bind.annotation.CrossOrigin;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -42,7 +41,6 @@ import java.util.Optional;
  * @date 2022-01-04
  */
 @RestController
-@CrossOrigin
 @RequestMapping("/diagram")
 public class DiagramController {
 

+ 0 - 2
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/controller/IconController.java

@@ -14,7 +14,6 @@ import com.persagy.dmp.file.model.FileInfoCreator;
 import com.persagy.dmp.file.utils.FileStorageHelper;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.CrossOrigin;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -37,7 +36,6 @@ import java.util.Optional;
  * @date 2022-01-06
  */
 @RestController
-@CrossOrigin
 @RequestMapping("/icon")
 public class IconController {
 

+ 26 - 22
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/controller/LegendController.java

@@ -1,48 +1,52 @@
 package com.persagy.adm.diagram.controller;
 
-import com.persagy.adm.diagram.frame.EditRequest;
 import com.persagy.adm.diagram.core.model.legend.Legend;
+import com.persagy.adm.diagram.frame.EditRequest;
 import com.persagy.adm.diagram.manage.LegendManager;
 import com.persagy.dmp.common.model.response.CommonResult;
 import com.persagy.dmp.common.utils.ResultHelper;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
 
 import java.util.List;
 
 @RestController
-@CrossOrigin
 @RequestMapping("legend")
 public class LegendController {
 
-	@Autowired
-	private LegendManager legendManager;
+    @Autowired
+    private LegendManager legendManager;
 
-	@ApiOperation("按照系统代码,查询图例列表")
-	@GetMapping("getLegends")
-	public CommonResult<List<Legend>> getLegends(@RequestParam String sys){
-		return ResultHelper.single(legendManager.getLegends(sys));
-	}
+    @ApiOperation("按照系统代码,查询图例列表")
+    @GetMapping("getLegends")
+    public CommonResult<List<Legend>> getLegends(@RequestParam String sys) {
+        return ResultHelper.single(legendManager.getLegends(sys));
+    }
 
-	@PostMapping("saveLegend")
-	public CommonResult<Legend> saveLegend(@RequestBody EditRequest req){
-		return ResultHelper.single(legendManager.saveLegend(req.getLegend(), req.getSys()));
-	}
+    @PostMapping("saveLegend")
+    public CommonResult<Legend> saveLegend(@RequestBody EditRequest req) {
+        return ResultHelper.single(legendManager.saveLegend(req.getLegend(), req.getSys()));
+    }
 
-	@PostMapping("delLegend")
-	public CommonResult<Boolean> delLegend(@RequestBody EditRequest req){
-		return ResultHelper.single(legendManager.deleteLegend(req.getCurrentCompId(), req.getSys()));
-	}
+    @PostMapping("delLegend")
+    public CommonResult<Boolean> delLegend(@RequestBody EditRequest req) {
+        return ResultHelper.single(legendManager.deleteLegend(req.getCurrentCompId(), req.getSys()));
+    }
 
 //	@RequestMapping("fixRel")
 //	public CommonResult<Boolean> fixRel(){
 //		return ResultHelper.single(legendManager.fixRel());
 //	}
 
-	@RequestMapping("fixDiagramType")
-	public CommonResult<Boolean> fixDiagramType(){
-		return ResultHelper.single(legendManager.fixDiagramType());
-	}
+    @RequestMapping("fixDiagramType")
+    public CommonResult<Boolean> fixDiagramType() {
+        return ResultHelper.single(legendManager.fixDiagramType());
+    }
 
 }

+ 3 - 4
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/controller/TemplateController.java

@@ -14,7 +14,6 @@ import java.util.List;
 import java.util.Map;
 
 @RestController
-@CrossOrigin
 @RequestMapping("template")
 public class TemplateController {
 
@@ -63,9 +62,9 @@ public class TemplateController {
         return ResultHelper.single(templateManager.moveCon(params.getCurrentCompId(), params.getTemplateId(), params.getMoveOffset()));
     }
 
-    @PostMapping("addMainPipe")
-    public CommonResult<DiagramTemplate> addMainPipe(@RequestBody EditRequest params){
-        return ResultHelper.single(templateManager.addMainPipe(params.getLines(), params.getTemplateId()));
+    @PostMapping("drawMainPipe")
+    public CommonResult<DiagramTemplate> drawMainPipe(@RequestBody EditRequest params){
+        return ResultHelper.single(templateManager.drawMainPipe(params.getLines(), params.getCurrentCompId(), params.getTemplateId()));
     }
 
     @PostMapping("delLine")

+ 59 - 91
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/DiagramBuilder.java

@@ -7,9 +7,11 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.persagy.adm.diagram.core.model.*;
 import com.persagy.adm.diagram.core.model.base.Container;
 import com.persagy.adm.diagram.core.model.base.IComponent;
+import com.persagy.adm.diagram.core.model.base.IDataBind;
 import com.persagy.adm.diagram.core.model.base.IEquipHolder;
 import com.persagy.adm.diagram.core.model.legend.Anchor;
 import com.persagy.adm.diagram.core.model.legend.Legend;
+import com.persagy.adm.diagram.core.model.logic.CalcContext;
 import com.persagy.adm.diagram.core.model.logic.DataFilter;
 import com.persagy.adm.diagram.core.model.template.DiagramTemplate;
 import com.persagy.adm.diagram.core.model.template.MainPipe;
@@ -17,6 +19,7 @@ import com.persagy.adm.diagram.core.model.virtual.PackNode;
 import com.persagy.dmp.digital.entity.ObjectRelation;
 
 import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * 处理系统图的计算逻辑
@@ -29,6 +32,8 @@ public class DiagramBuilder {
 	 */
 	public static int equipLimit = 50;
 
+	private CalcContext context;
+
 	private Diagram diagram;
 
 	private DiagramTemplate template;
@@ -39,66 +44,24 @@ public class DiagramBuilder {
 
 	private HashSet<String> refRelTypes = new HashSet<>();
 
-	/**
-	 * 记录已经使用的数据id和对应的组件
-	 */
-	private HashMap<String, Object> equipMap = new HashMap<>();
-
-	/**
-	 * 记录已经使用的关系id和对应的连线
-	 */
-	private HashMap<String, Line> lineMap = new HashMap<>();
-
-	public DiagramBuilder(Diagram diagram, DataStrategy dataStrategy) {
-		this.diagram = diagram;
-		this.template = diagram.getTemplate();
+	public DiagramBuilder(CalcContext context, DataStrategy dataStrategy) {
+		this.context = context;
+		this.diagram = context.getDiagram();
+		this.template = context.getTemplate();
 		this.dataStrategy = dataStrategy;
 
-		init();
-	}
-
-	private void init(){
-		//记录节点中已使用的数据id
-		diagram.getNodes().forEach(node -> {
-			if (EquipmentNode.TYPE.equals(node.getCompType())) {
-				equipMap.put(((EquipmentNode) node).getObjId(), node);
-			}
-		});
-		//记录干管中已使用的数据id
-		if(template != null && template.getMainPipes() != null) {
-			template.getMainPipes().forEach(mainPipe -> {
-				if(StrUtil.isNotBlank(mainPipe.getDataObjectId())) {
-					equipMap.put(mainPipe.getDataObjectId(), mainPipe);
-				}
-			});
-		}
-
-		diagram.getLines().forEach(line -> {
-			if (StrUtil.isNotBlank(line.getDataObjectId())){
-				lineMap.put(line.getDataObjectId(), line);
-			}
-		});
+		this.context.setDataStrategy(dataStrategy);
 	}
 
 	//加载设备数据,并进行计算处理
 	public void buildEquipNodeAndContainer(List<Container> containers, List<ObjectNode> optionalObjs){
-		for(Container con : containers) {
-			if(con.isEquipmentBox()) {
-				Iterator<ObjectNode> iter = optionalObjs.iterator();
-				while (iter.hasNext()) {
-					ObjectNode obj = iter.next();
-					if (match(obj, con)) {
-						if(con.getEquipPack() != null) {
-							addPackData(con, obj);
-						} else {
-							addEquipNode(con, obj);
-						}
-
-						iter.remove();
-					}
-				}
-			}
+		//去掉已经使用的数据项
+		if(context.getEquipMap().size() > 0) {
+			optionalObjs = optionalObjs.stream().filter(obj -> !context.getEquipMap().containsKey(obj.get("id").asText())).collect(Collectors.toList());
+		} else {
+			optionalObjs = new ArrayList<>(optionalObjs);
 		}
+
 		if(template.getMainPipes() != null) {
 			for(MainPipe mainPipe : template.getMainPipes()) {
 				if (mainPipe.isBindEquipment() && mainPipe.getDataObject() == null){
@@ -109,7 +72,7 @@ public class DiagramBuilder {
 							mainPipe.setDataObject(obj);
 							mainPipe.setDataObjectId(obj.get("id").asText());
 
-							equipMap.put(mainPipe.getDataObjectId(), mainPipe);
+							context.getEquipMap().put(mainPipe.getDataObjectId(), mainPipe);
 
 							iter.remove();
 							break;
@@ -118,10 +81,27 @@ public class DiagramBuilder {
 				}
 			}
 		}
+		for(Container con : containers) {
+			if(con.isEquipmentBox()) {
+				Iterator<ObjectNode> iter = optionalObjs.iterator();
+				while (iter.hasNext()) {
+					ObjectNode obj = iter.next();
+					if (match(obj, con)) {
+						if(con.getEquipPack() != null) {
+							addPackData(con, obj);
+						} else {
+							addEquipNode(con, obj);
+						}
+
+						iter.remove();
+					}
+				}
+			}
+		}
 
 		handleNodes();
 
-		buildContainers(containers);
+		handleContainers(containers);
 	}
 
 	private void addEquipNode(Container con, ObjectNode obj){
@@ -131,7 +111,7 @@ public class DiagramBuilder {
 
 		EquipmentNode node = new EquipmentNode();
 		node.setId(IdUtil.simpleUUID());
-		node.setObjId(obj.get("id").asText());
+		node.setDataObjectId(obj.get("id").asText());
 		node.setObjClassCode(DiagramBuilder.getClassCode(obj));
 		node.setDataObject(obj);
 
@@ -140,8 +120,6 @@ public class DiagramBuilder {
 		Legend legend = findLegend(node.getObjClassCode(), obj);
 		node.setLegendId(legend.getId());
 		node.setLegend(legend);
-
-		equipMap.put(node.getObjId(), node);
 	}
 
 	private void initNode(EquipmentNode node, String name, Container con){
@@ -154,6 +132,7 @@ public class DiagramBuilder {
 		node.setLabel(label);
 
 		diagram.getNodes().add(node);
+		context.getEquipMap().put(node.getDataObjectId(), node);
 	}
 
 	private void addPackData(Container con, ObjectNode obj){
@@ -171,9 +150,6 @@ public class DiagramBuilder {
 			} else {
 				pn = (PackNode) con.getChildren().get(0);
 			}
-			if(con.getEquipPack().getLegendId() != null) {
-				legend = dataStrategy.getLegend(con.getEquipPack().getLegendId(), classCode.substring(0, 4));
-			}
 		} else { //group
 			for(IComponent comp : con.getChildren()) {
 				PackNode item = (PackNode) comp;
@@ -217,23 +193,13 @@ public class DiagramBuilder {
 		if(equipHolder.getEquipmentTypes() != null && equipHolder.getEquipmentTypes().contains(classCode)) {
 			DataFilter filter = equipHolder.getDataFilter();
 			if(filter != null) {
-				return filter.filter(obj);
+				return filter.filter(obj, context);
 			}
 			return true;
 		}
 		return false;
 	}
 
-	private void buildContainers(List<Container> containers) {
-		for(Container con : containers) {
-			if(con.isEquipmentBox()) {
-				if(Boolean.TRUE.equals(con.getProp(Container.PROP_AUTO_HIDDEN)) && CollUtil.isEmpty(con.getChildren())) {
-					con.setHidden(true);
-				}
-			}
-		}
-	}
-
 	/**
 	 * 对节点进行处理,并返回图例锚点会使用到的关系类型
 	 */
@@ -260,6 +226,16 @@ public class DiagramBuilder {
 		}
 	}
 
+	private void handleContainers(List<Container> containers) {
+		for(Container con : containers) {
+			if(con.isEquipmentBox()) {
+				if(Boolean.TRUE.equals(con.getProp(Container.PROP_AUTO_HIDDEN)) && CollUtil.isEmpty(con.getChildren())) {
+					con.setHidden(true);
+				}
+			}
+		}
+	}
+
 	private String getTypeName(String classCode){
 		//TODO
 		return classCode;
@@ -282,7 +258,7 @@ public class DiagramBuilder {
 				//过滤条件匹配
 				boolean filterMatch;
 				if(obj != null && legend.getDataFilter() != null) {
-					filterMatch = legend.getDataFilter().filter(obj);
+					filterMatch = legend.getDataFilter().filter(obj, context);
 				} else {
 					filterMatch = true;
 				}
@@ -313,9 +289,14 @@ public class DiagramBuilder {
 	}
 	
 	public void buildLines(List<ObjectNode> optionalRels){
+		//去掉已经使用的关系项
+		if(context.getLineMap().size() > 0) {
+			optionalRels = optionalRels.stream().filter(obj -> !context.getLineMap().containsKey(obj.get("id").asText())).collect(Collectors.toList());
+		}
+
 		for(ObjectNode rel : optionalRels) {
-			Object fromObj = equipMap.get(rel.get(ObjectRelation.OBJ_FROM_HUM).asText());
-			Object toObj = equipMap.get(rel.get(ObjectRelation.OBJ_TO_HUM).asText());
+			IDataBind fromObj = context.getEquipMap().get(rel.get(ObjectRelation.OBJ_FROM_HUM).asText());
+			IDataBind toObj = context.getEquipMap().get(rel.get(ObjectRelation.OBJ_TO_HUM).asText());
 
 			if(fromObj != null && toObj != null) {
 				String relType = rel.get(ObjectRelation.GRAPH_CODE_HUM).asText() + '/' + rel.get(ObjectRelation.REL_CODE_HUM).asText();
@@ -338,13 +319,8 @@ public class DiagramBuilder {
 
 	}
 
-	private ConnectPoint getConnectPoint(Object obj, String  relType, Object theOtherEnd){
-		ObjectNode theOtherData = null;
-		if(theOtherEnd instanceof EquipmentNode) {
-			theOtherData = (ObjectNode) ((EquipmentNode) theOtherEnd).getDataObject();
-		} else if(theOtherEnd instanceof MainPipe) {
-			theOtherData = (ObjectNode) ((MainPipe) theOtherEnd).getDataObject();
-		}
+	private ConnectPoint getConnectPoint(IDataBind obj, String  relType, IDataBind theOtherEnd){
+		ObjectNode theOtherData = (ObjectNode) theOtherEnd.getDataObject();
 		String theOtherType = getClassCode(theOtherData);
 
 		if(obj instanceof EquipmentNode) {
@@ -366,7 +342,7 @@ public class DiagramBuilder {
 							equipMatch = a.getToEquipmentTypes().contains(theOtherType);
 						}
 						if(!Boolean.FALSE.equals(equipMatch) && a.getToDataFilter() != null) {
-							equipMatch = a.getToDataFilter().filter(theOtherData);
+							equipMatch = a.getToDataFilter().filter(theOtherData, context);
 						}
 					}
 
@@ -429,14 +405,6 @@ public class DiagramBuilder {
 		}
 	}
 
-	public HashMap<String, Object> getEquipMap() {
-		return equipMap;
-	}
-
-	public HashMap<String, Line> getLineMap() {
-		return lineMap;
-	}
-
 	public HashSet<String> getRefRelTypes() {
 		return refRelTypes;
 	}

+ 22 - 24
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/DiagramDataLoader.java

@@ -1,11 +1,13 @@
 package com.persagy.adm.diagram.core;
 
+import cn.hutool.core.collection.CollUtil;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.persagy.adm.diagram.core.model.Diagram;
 import com.persagy.adm.diagram.core.model.DiagramNode;
 import com.persagy.adm.diagram.core.model.EquipmentNode;
 import com.persagy.adm.diagram.core.model.Line;
 import com.persagy.adm.diagram.core.model.base.Container;
+import com.persagy.adm.diagram.core.model.logic.CalcContext;
 import com.persagy.adm.diagram.core.model.template.MainPipe;
 import com.persagy.dmp.common.constant.ValidEnum;
 import com.persagy.dmp.digital.entity.ObjectRelation;
@@ -26,10 +28,6 @@ public class DiagramDataLoader {
 
 	private DataStrategy dataStrategy;
 
-	private List<ObjectNode> optionalObjs;
-
-	private List<ObjectNode> optionalRels;
-
 	public DiagramDataLoader(Diagram diagram, DataStrategy dataStrategy) {
 		this.diagram = diagram;
 		this.dataStrategy = dataStrategy;
@@ -63,13 +61,16 @@ public class DiagramDataLoader {
 
 			if(EquipmentNode.TYPE.equals(node.getCompType())) { //设备节点
 				EquipmentNode en = (EquipmentNode) node;
-				obj = objMap.get(en.getObjId());
+				obj = objMap.get(en.getDataObjectId());
 
 				if(en.getLegendId() != null) {
 					en.setLegend(dataStrategy.getLegend(en.getLegendId(), en.getObjSystemCode())); //TODO 批量查询优化
 				} else {
 					en.setLegend(DiagramBuilder.emptyLegend());
 				}
+
+				//设置anchorLocations
+				en.getAnchorLocations();
 			}
 
 			if(obj != null) {
@@ -110,7 +111,10 @@ public class DiagramDataLoader {
 	/**
 	 * 搜索数据并自动加载
 	 */
-	public void autoLoad(DiagramBuilder builder) {
+	public void autoLoad(CalcContext context) {
+		List<ObjectNode> optionalObjs = null;
+		List<ObjectNode> optionalRels = null;
+
 		//查询备选数据
 		HashSet<String> equipTypes = new HashSet<>();
 		List<Container> containers = diagram.getTemplate().getContainers();
@@ -121,7 +125,7 @@ public class DiagramDataLoader {
 		}
 		if(diagram.getTemplate().getMainPipes() != null) {
 			for(MainPipe mainPipe : diagram.getTemplate().getMainPipes()) {
-				if(mainPipe.getEquipmentTypes() != null) { //TODO 过滤已经初始化加载数据的干管
+				if(mainPipe.getEquipmentTypes() != null) {
 					equipTypes.addAll(mainPipe.getEquipmentTypes());
 				}
 			}
@@ -131,41 +135,35 @@ public class DiagramDataLoader {
 		if(equipTypes.size() > 0) {
 			optionalObjs = dataStrategy.loadObjectsByType(new ArrayList<>(equipTypes), diagram.getProjectId(), diagram.getSystemId(), diagram.getGroupCode());
 			optionalObjs = filterValid(optionalObjs);
-		} else {
-			optionalObjs = new ArrayList<>();
 		}
-		//记录备选对象id列表
-		List<String> objIds = optionalObjs.stream().map(obj -> obj.get("id").asText()).collect(Collectors.toList());
-
-		//去掉已经使用的数据项
-		HashMap<String, Object> equipMap = builder.getEquipMap();
-		if(equipMap.size() > 0) {
-			optionalObjs = optionalObjs.stream().filter(obj -> !equipMap.containsKey(obj.get("id").asText())).collect(Collectors.toList());
+		if(optionalObjs == null){
+			optionalObjs = new ArrayList<>();
 		}
 
+		DiagramBuilder builder = new DiagramBuilder(context, dataStrategy);
 		builder.buildEquipNodeAndContainer(containers, optionalObjs);
 		List<String[]> relTypes = builder.getRefRelTypes().stream().map(type -> type.split("/")).collect(Collectors.toList());
 
+		List<String> objIds = optionalObjs.stream().map(obj -> obj.get("id").asText()).collect(Collectors.toList());
 		//TODO 关系查询,需要区分打包设备
 		if(objIds.size() > 0 && relTypes.size() > 0) {
 			optionalRels = dataStrategy.loadRelationsByType(relTypes, objIds, diagram.getProjectId(), diagram.getGroupCode());
 			optionalRels = filterValid(optionalRels);
-		} else {
-			optionalRels = new ArrayList<>();
 		}
-
-		//去掉已经使用的关系项
-		HashMap<String, Line> lineMap = builder.getLineMap();
-		if(lineMap.size() > 0) {
-			optionalRels = optionalRels.stream().filter(obj -> !lineMap.containsKey(obj.get("id").asText())).collect(Collectors.toList());
+		if(optionalRels == null){
+			optionalRels = new ArrayList<>();
 		}
 
 		builder.buildLines(optionalRels);
 	}
 
 	private List<ObjectNode> filterValid(List<ObjectNode> list){
+		if(CollUtil.isEmpty(list))
+			return list;
+
 		return list.stream().filter(obj ->
-				obj.get(ObjectRelation.PROP_VALID) == null || obj.get(ObjectRelation.PROP_VALID).asInt() == ValidEnum.TRUE.getType()).collect(Collectors.toList());
+				obj.get(ObjectRelation.PROP_VALID) == null || obj.get(ObjectRelation.PROP_VALID).asInt() == ValidEnum.TRUE.getType())
+				.collect(Collectors.toList());
 	}
 
 }

+ 0 - 55
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/DiagramView.java

@@ -1,55 +0,0 @@
-package com.persagy.adm.diagram.core;
-
-import com.persagy.adm.diagram.core.model.Diagram;
-import com.persagy.adm.diagram.core.model.base.XY;
-import com.persagy.adm.diagram.core.model.template.MainPipe;
-import com.persagy.adm.diagram.core.model.DiagramNode;
-import lombok.Data;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * 系统图展现层结构
- * @author zhaoyk
- */
-@Data
-public class DiagramView {
-
-	private String id;
-
-	private String name;
-
-	private String type;
-
-	private String system;
-
-	private String templateId;
-
-	private List<DiagramNode> nodes = new ArrayList<>();
-
-	private List lines = new ArrayList();
-
-	private List<MainPipe> mainPipes = new ArrayList<>();
-
-	private String projectId;
-
-	private String systemId;
-
-	private XY size;
-
-	public DiagramView(Diagram diagram) {
-		this.id = diagram.getId();
-		this.name = diagram.getName();
-		this.type = diagram.getType();
-		this.system = diagram.getSystem();
-		this.templateId = diagram.getTemplateId();
-		this.nodes = diagram.getNodes();
-		this.lines = diagram.getLines();
-		this.mainPipes = diagram.getTemplate().getMainPipes();
-		this.projectId = diagram.getProjectId();
-		this.systemId = diagram.getSystemId();
-		this.size = diagram.getTemplate().getFrame().getSize();
-	}
-
-}

+ 9 - 9
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/line/LineLayoutManager.java

@@ -1,11 +1,11 @@
 package com.persagy.adm.diagram.core.line;
 
-import com.persagy.adm.diagram.core.DiagramBuilder;
 import com.persagy.adm.diagram.core.model.ConnectPoint;
 import com.persagy.adm.diagram.core.model.DiagramNode;
 import com.persagy.adm.diagram.core.model.EquipmentNode;
 import com.persagy.adm.diagram.core.model.Line;
 import com.persagy.adm.diagram.core.model.base.XY;
+import com.persagy.adm.diagram.core.model.logic.CalcContext;
 import com.persagy.adm.diagram.core.model.template.MainPipe;
 import com.persagy.adm.diagram.core.util.GeomUtil;
 import org.locationtech.jts.geom.Point;
@@ -21,19 +21,19 @@ import java.util.Map;
  */
 public class LineLayoutManager {
 
-	private DiagramBuilder diagramBuilder;
+	private CalcContext context;
 
 	private List<Block> blocks = new ArrayList<>();
 
 	private Map<Line, ConnectPoint[]> lines = new HashMap<>();
 
-	public LineLayoutManager(DiagramBuilder diagramBuilder) {
-		this.diagramBuilder = diagramBuilder;
+	public LineLayoutManager(CalcContext context) {
+		this.context = context;
 		initBlocks();
 	}
 
 	private void initBlocks(){
-		for(Object o : diagramBuilder.getEquipMap().values()){
+		for(Object o : context.getEquipMap().values()){
 			if (o instanceof DiagramNode) {
 				blocks.add(new Block((DiagramNode)o));
 			}
@@ -44,8 +44,8 @@ public class LineLayoutManager {
 		ConnectPoint p1 = line.getFrom();
 		ConnectPoint p2 = line.getTo();
 
-		p1.layout();
-		p2.layout();
+		p1.layout(context);
+		p2.layout(context);
 
 		boolean exchange = false;
 		//先计算点模型的终点
@@ -172,8 +172,8 @@ public class LineLayoutManager {
 		return blocks;
 	}
 
-	public DiagramBuilder getDiagramBuilder() {
-		return diagramBuilder;
+	public CalcContext getContext() {
+		return context;
 	}
 
 }

+ 13 - 0
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/line/PathBuilder.java

@@ -526,6 +526,19 @@ public class PathBuilder {
 
             if (vDirection == vEndNbr) { //当前方向与终点通道方向相同
                 if (vEndNbr == hLine) { //endLine与通道垂直
+                    //当前点和线有偏差时,先做调整
+                    int[] targetScope = new int[]{Math.max(lineScope[0], endNbr[0]), Math.min(lineScope[1], endNbr[1])};
+                    int pos = vEndNbr ? currentPoint.x : currentPoint.y;
+                    if(!(pos > targetScope[0] && pos < targetScope[1])){
+                        int safeOffset = 5;//临时避免和节点边线重合
+                        int target0 = targetScope[0] + safeOffset + random.nextInt(targetScope[1] - targetScope[0] - safeOffset * 2);
+                        if (vEndNbr) {
+                            currentPoint.x = target0;
+                        } else {
+                            currentPoint.y = target0;
+                        }
+                    }
+
                     moveTo(lineTrackPos, hLine); //线横向时做纵向移动
                 } else { //endLine与通道平行
                     //TODO 可能需要调整,避免和线水平连接

+ 11 - 1
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/AbstractLine.java

@@ -1,13 +1,14 @@
 package com.persagy.adm.diagram.core.model;
 
 import com.google.gson.annotations.Expose;
+import com.persagy.adm.diagram.core.model.base.IDataBind;
 import com.persagy.adm.diagram.core.model.style.LineStyle;
 
 /**
  * 线的基类
  * @author zhaoyk
  */
-abstract public class AbstractLine {
+abstract public class AbstractLine implements IDataBind {
 
 	@Expose
 	protected String id;
@@ -39,6 +40,11 @@ abstract public class AbstractLine {
 	 */
 	abstract public void layout(Object layoutContext);
 
+	/**
+	 * 清除布局信息
+	 */
+	abstract public void clearLayout();
+
 	public String getId() {
 		return id;
 	}
@@ -79,18 +85,22 @@ abstract public class AbstractLine {
 		this.label = label;
 	}
 
+	@Override
 	public Object getDataObject() {
 		return dataObject;
 	}
 
+	@Override
 	public void setDataObject(Object dataObject) {
 		this.dataObject = dataObject;
 	}
 
+	@Override
 	public String getDataObjectId() {
 		return dataObjectId;
 	}
 
+	@Override
 	public void setDataObjectId(String dataObjectId) {
 		this.dataObjectId = dataObjectId;
 	}

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

@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.google.gson.annotations.Expose;
 import com.persagy.adm.diagram.core.model.base.XY;
 import com.persagy.adm.diagram.core.model.legend.Anchor;
+import com.persagy.adm.diagram.core.model.logic.CalcContext;
 import com.persagy.adm.diagram.core.model.template.MainPipe;
 
 import java.util.Objects;
@@ -74,8 +75,13 @@ public class ConnectPoint {
 		return null;
 	}
 
-	public void layout() {
+	public void layout(CalcContext context) {
 		if(!layoutFlag) {
+			//重新执行layout时,需要初始化hostObj
+			if(hostObj == null) {
+				hostObj = context.getComp(hostId, hostType);
+			}
+
 			if(hostObj instanceof EquipmentNode) {
 				EquipmentNode en = (EquipmentNode)hostObj;
 				location = en.locationToRoot();

+ 50 - 23
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/Diagram.java

@@ -2,10 +2,11 @@ package com.persagy.adm.diagram.core.model;
 
 import cn.hutool.core.util.StrUtil;
 import com.google.gson.annotations.Expose;
-import com.persagy.adm.diagram.core.DiagramBuilder;
 import com.persagy.adm.diagram.core.line.LineLayoutManager;
 import com.persagy.adm.diagram.core.model.base.Container;
+import com.persagy.adm.diagram.core.model.base.IComponent;
 import com.persagy.adm.diagram.core.model.base.XY;
+import com.persagy.adm.diagram.core.model.logic.CalcContext;
 import com.persagy.adm.diagram.core.model.template.DiagramTemplate;
 import com.persagy.adm.diagram.core.model.template.MainPipe;
 
@@ -75,50 +76,76 @@ public class Diagram {
 	private Map<String, Object> extraProps;
 
 	/**
-	 * 节点列表
-	 */
-	@Expose
-	private List<DiagramNode> nodes = new ArrayList<>();
-
-	/**
 	 * 连线列表
 	 */
 	@Expose
 	private List<Line> lines = new ArrayList();
 
-	//运行时
-	@Expose(serialize = false)
+	@Expose
 	private DiagramTemplate template;
 
+	@Expose
+	private XY size;
+
+
+	/**
+	 * 节点列表,运行时&显示态数据结构
+	 */
+	private List<DiagramNode> nodes = new ArrayList<>();
 
 	public void init(){
 		if (template != null) {
 			template.init();
-		}
 
-		nodes.sort(new Comparator<DiagramNode>() {
-			@Override
-			public int compare(DiagramNode o1, DiagramNode o2) {
-				return o1.getLayoutIndex() - o2.getLayoutIndex();
-			}
-		});
-		for (DiagramNode node : nodes) {
-			Container con = template.getContainerById(node.getContainerId());
-			if (con != null) {
-				con.addComp(node);
+			List<Container> containers = template.getContainers();
+			for(Container con : containers) {
+				if(con.isEquipmentBox()) {
+					for(IComponent comp : con.getChildren()) {
+						if(comp instanceof DiagramNode){
+							nodes.add((DiagramNode) comp);
+						}
+					}
+				}
 			}
 		}
+
+//		nodes.sort(new Comparator<DiagramNode>() {
+//			@Override
+//			public int compare(DiagramNode o1, DiagramNode o2) {
+//				return o1.getLayoutIndex() - o2.getLayoutIndex();
+//			}
+//		});
+//		for (DiagramNode node : nodes) {
+//			Container con = template.getContainerById(node.getContainerId());
+//			if (con != null) {
+//				con.addComp(node);
+//			}
+//		}
 	}
 
-	public void layout(DiagramBuilder builder){
+	public void layout(CalcContext context){
 		if(template != null) {
 			template.layout(new XY(0, 0));
 		}
 
-		LineLayoutManager lineLayoutManager = new LineLayoutManager(builder);
+		LineLayoutManager lineLayoutManager = new LineLayoutManager(context);
 		for(Line line : lines) {
 			line.layout(lineLayoutManager);
 		}
+
+		this.size = template.getFrame().getSize();
+	}
+
+	public void clearLayout(){
+		if(template != null) {
+			template.clearLayout();
+		}
+
+		for(Line line : lines) {
+			line.clearLayout();
+		}
+
+		this.size = null;
 	}
 
 	public void toAbsoluteLocation(){
@@ -145,7 +172,7 @@ public class Diagram {
 		List<String> ids = new ArrayList<>();
 		for(DiagramNode node : nodes) {
 			if(EquipmentNode.TYPE.equals(node.getCompType())) {
-				ids.add(((EquipmentNode) node).getObjId());
+				ids.add(((EquipmentNode) node).getDataObjectId());
 			}
 		}
 		if(template != null && template.getMainPipes() != null) {

+ 27 - 12
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/EquipmentNode.java

@@ -2,6 +2,7 @@ package com.persagy.adm.diagram.core.model;
 
 import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.google.gson.annotations.Expose;
+import com.persagy.adm.diagram.core.model.base.IDataBind;
 import com.persagy.adm.diagram.core.model.base.XY;
 import com.persagy.adm.diagram.core.model.legend.Anchor;
 import com.persagy.adm.diagram.core.model.legend.Legend;
@@ -13,7 +14,7 @@ import java.util.Map;
  * 设备节点
  * @author zhaoyk
  */
-public class EquipmentNode extends DiagramNode {
+public class EquipmentNode extends DiagramNode implements IDataBind {
 
 	public static final String TYPE = "equipmentNode";
 
@@ -21,7 +22,7 @@ public class EquipmentNode extends DiagramNode {
 	 * 绑定的数据对象id
 	 */
 	@Expose
-	private String objId;
+	private String dataObjectId;
 
 	/**
 	 * 数据对象的classCode
@@ -50,12 +51,6 @@ public class EquipmentNode extends DiagramNode {
 	@Override
 	public void layout() {
 		setSize(new XY(legend.getWidth(), legend.getHeight()));
-		if(legend.getAnchors() != null) {
-			anchorLocations = new HashMap<>();
-			for(Anchor anchor : legend.getAnchors()) {
-				anchorLocations.put(anchor.getCode(), anchor.calcLocation(size));
-			}
-		}
 
 		if(label != null) {
 			label.setLocation(new XY(10, 10)); //TODO
@@ -64,12 +59,24 @@ public class EquipmentNode extends DiagramNode {
 		//TODO anchors
 	}
 
-	public String getObjId() {
-		return objId;
+	@Override
+	public String getDataObjectId() {
+		return dataObjectId;
+	}
+
+	@Override
+	public void setDataObjectId(String dataObjectId) {
+		this.dataObjectId = dataObjectId;
+	}
+
+	@Override
+	public Object getDataObject() {
+		return super.getDataObject();
 	}
 
-	public void setObjId(String objId) {
-		this.objId = objId;
+	@Override
+	public void setDataObject(Object dataObject) {
+		super.setDataObject(dataObject);
 	}
 
 	public String getObjClassCode() {
@@ -109,6 +116,14 @@ public class EquipmentNode extends DiagramNode {
 	}
 
 	public Map<String, XY> getAnchorLocations() {
+		if (anchorLocations == null) {
+			if (legend.getAnchors() != null) {
+				anchorLocations = new HashMap<>();
+				for (Anchor anchor : legend.getAnchors()) {
+					anchorLocations.put(anchor.getCode(), anchor.calcLocation(size));
+				}
+			}
+		}
 		return anchorLocations;
 	}
 

+ 7 - 0
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/Line.java

@@ -58,11 +58,13 @@ public class Line extends AbstractLine {
 	/**
 	 * 连线的坐标点序列(包含from,to连接点坐标)
 	 */
+	@Expose
 	private List<XY> locationPath;
 
 	/**
 	 * 连线的状态标记
 	 */
+	@Expose
 	private String flag;
 
 	public Line() {
@@ -75,6 +77,11 @@ public class Line extends AbstractLine {
 		locationPath = layoutManager.layout(this);
 	}
 
+	@Override
+	public void clearLayout() {
+		locationPath = null;
+	}
+
 	public int getDirection() {
 		return direction;
 	}

+ 9 - 0
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/base/AbstractComponent.java

@@ -36,16 +36,19 @@ abstract public class AbstractComponent implements IComponent {
 	/**
 	 * 布局定位
 	 */
+	@Expose
 	protected XY location;
 
 	/**
 	 * 布局尺寸
 	 */
+	@Expose
 	protected XY size;
 
 	/**
 	 * 组件的显示/隐藏状态
 	 */
+	@Expose
 	protected boolean hidden;
 
 	/**
@@ -165,6 +168,12 @@ abstract public class AbstractComponent implements IComponent {
 		this.props = props;
 	}
 
+	@Override
+	public void clearLayout() {
+		location = null;
+		size = null;
+	}
+
 	/**
 	 * 相对根容器的坐标位置
 	 */

+ 22 - 1
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/base/Container.java

@@ -1,11 +1,13 @@
 package com.persagy.adm.diagram.core.model.base;
 
 import cn.hutool.core.collection.CollUtil;
+import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.google.gson.annotations.Expose;
 import com.persagy.adm.diagram.core.model.Label;
 import com.persagy.adm.diagram.core.model.logic.DataFilter;
 import com.persagy.adm.diagram.core.model.logic.DynGroup;
 import com.persagy.adm.diagram.core.model.logic.EquipPack;
+import com.persagy.adm.diagram.core.model.template.MainPipe;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -15,7 +17,7 @@ import java.util.stream.Collectors;
  * 布局容器
  * @author zhaoyk
  */
-public class Container extends AbstractComponent implements IContainer {
+public class Container extends AbstractComponent implements IContainer, IEquipHolder {
 
 	public static final String TYPE = "container";
 
@@ -59,6 +61,12 @@ public class Container extends AbstractComponent implements IContainer {
 	 */
 	private Label groupLabel;
 
+	/**
+	 * 直接包含的干管
+	 */
+	@JsonIgnore
+	private List<MainPipe> childMainPipes;
+
 	public Container() {
 		this.compType = TYPE;
 	}
@@ -271,6 +279,19 @@ public class Container extends AbstractComponent implements IContainer {
 		return null;
 	}
 
+	public void addChildMainPipe(MainPipe mainPipe) {
+		if(childMainPipes == null) {
+			childMainPipes = new ArrayList<>();
+		}
+		childMainPipes.add(mainPipe);
+	}
+
+	public void removeChildMainPipe(MainPipe mainPipe) {
+		if(childMainPipes != null) {
+			childMainPipes.remove(mainPipe);
+		}
+	}
+
 	@Override
 	public PositionData defaultPosition() {
 		PositionData data = new PositionData();

+ 2 - 0
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/base/IComponent.java

@@ -22,6 +22,8 @@ public interface IComponent {
 
     void layout();
 
+    void clearLayout();
+
     XY getLocation();
 
     void setLocation(XY xy);

+ 1 - 1
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/base/IContainer.java

@@ -6,7 +6,7 @@ import java.util.List;
  * 容器接口
  * @author zhaoyk
  */
-public interface IContainer extends IComponent, IEquipHolder {
+public interface IContainer extends IComponent {
 
     Layout getLayout();
 

+ 17 - 0
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/base/IDataBind.java

@@ -0,0 +1,17 @@
+package com.persagy.adm.diagram.core.model.base;
+
+/**
+ * 数据绑定接口
+ * @author zhaoyk
+ */
+public interface IDataBind {
+
+	String getDataObjectId();
+
+	void setDataObjectId(String dataObjectId);
+
+	Object getDataObject();
+
+	void setDataObject(Object dataObject);
+
+}

+ 4 - 0
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/base/XY.java

@@ -14,6 +14,10 @@ public class XY {
 	@Expose
 	public int y;
 
+	public XY() {
+
+	}
+
 	public XY(int x, int y) {
 		this.x = x;
 		this.y = y;

+ 5 - 5
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/legend/Anchor.java

@@ -157,7 +157,7 @@ public class Anchor {
 		char c1 = code.charAt(0);
 		char c2 = code.charAt(1);
 		int idx = (int)c2 - 48;
-		int part = 6;
+		float part = 6;
 		switch (c1){
 			case 'T':
 				if(c2 == 'L') {
@@ -166,7 +166,7 @@ public class Anchor {
 				if(c2 == 'R') {
 					return new XY(legendLocation.x + legendSize.x, legendLocation.y);
 				}
-				return new XY(legendLocation.x + legendSize.x / part * idx, legendLocation.y);
+				return new XY(legendLocation.x + Math.round(legendSize.x / part * idx), legendLocation.y);
 			case 'B':
 				if(c2 == 'L') {
 					return new XY(legendLocation.x, legendLocation.y + legendSize.y);
@@ -174,11 +174,11 @@ public class Anchor {
 				if(c2 == 'R') {
 					return new XY(legendLocation.x + legendSize.x, legendLocation.y + legendSize.y);
 				}
-				return new XY(legendLocation.x + legendSize.x / part * idx, legendLocation.y + legendSize.y);
+				return new XY(legendLocation.x + Math.round(legendSize.x / part * idx), legendLocation.y + legendSize.y);
 			case 'L':
-				return new XY(legendLocation.x, legendLocation.y + legendSize.y / part * idx);
+				return new XY(legendLocation.x, legendLocation.y + Math.round(legendSize.y / part * idx));
 			case 'R':
-				return new XY(legendLocation.x + legendSize.x, legendLocation.y + legendSize.y / part * idx);
+				return new XY(legendLocation.x + legendSize.x, legendLocation.y + Math.round(legendSize.y / part * idx));
 			default:
 				return null;
 		}

+ 2 - 2
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/logic/AndFilter.java

@@ -11,9 +11,9 @@ public class AndFilter extends LogicFilter {
 	}
 
 	@Override
-	protected boolean judge(Object data) {
+	protected boolean judge(Object data, CalcContext context) {
 		for(DataFilter item : items) {
-			if(!item.filter(data)) {
+			if(!item.filter(data, context)) {
 				return false;
 			}
 		}

+ 123 - 0
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/logic/CalcContext.java

@@ -0,0 +1,123 @@
+package com.persagy.adm.diagram.core.model.logic;
+
+import cn.hutool.core.util.StrUtil;
+import com.persagy.adm.diagram.core.DataStrategy;
+import com.persagy.adm.diagram.core.model.Diagram;
+import com.persagy.adm.diagram.core.model.DiagramNode;
+import com.persagy.adm.diagram.core.model.EquipmentNode;
+import com.persagy.adm.diagram.core.model.Line;
+import com.persagy.adm.diagram.core.model.base.Container;
+import com.persagy.adm.diagram.core.model.base.IDataBind;
+import com.persagy.adm.diagram.core.model.template.DiagramTemplate;
+import com.persagy.adm.diagram.core.model.template.MainPipe;
+
+import java.util.HashMap;
+
+/**
+ * 系统图计算上下文
+ * @author zhaoyk
+ */
+public class CalcContext {
+
+	private Diagram diagram;
+
+	private DiagramTemplate template;
+
+	private DataStrategy dataStrategy;
+
+	/**
+	 * 当前动态组
+	 */
+	private Object currentGroup;
+
+	/**
+	 * 记录已经使用的数据id和对应的组件
+	 */
+	private HashMap<String, IDataBind> equipMap = new HashMap<>();
+
+	/**
+	 * 记录已经使用的关系id和对应的连线
+	 */
+	private HashMap<String, Line> lineMap = new HashMap<>();
+
+	public CalcContext(Diagram diagram) {
+		this.diagram = diagram;
+		this.template = diagram.getTemplate();
+
+		init();
+	}
+
+	private void init() {
+		//记录节点中已使用的数据id
+		diagram.getNodes().forEach(node -> {
+			if (EquipmentNode.TYPE.equals(node.getCompType())) {
+				equipMap.put(((EquipmentNode) node).getDataObjectId(), (EquipmentNode)node);
+			}
+		});
+		//记录干管中已使用的数据id
+		if(template != null && template.getMainPipes() != null) {
+			template.getMainPipes().forEach(mainPipe -> {
+				if(StrUtil.isNotBlank(mainPipe.getDataObjectId())) {
+					equipMap.put(mainPipe.getDataObjectId(), mainPipe);
+				}
+			});
+		}
+
+		diagram.getLines().forEach(line -> {
+			if (StrUtil.isNotBlank(line.getDataObjectId())){
+				lineMap.put(line.getDataObjectId(), line);
+			}
+		});
+	}
+
+	public <T> T getComp(String id, String type) {
+		//TODO 按动态组获取
+		if(MainPipe.TYPE.equals(type)) {
+			return (T)template.getMainPipeById(id);
+		} else if(EquipmentNode.TYPE.equals(type)) {
+			for(DiagramNode node : diagram.getNodes()) {
+				if(node.getId().equals(id)){
+					return (T)node;
+				}
+			}
+		} else if(Container.TYPE.equals(type)) {
+			return (T)template.getContainerById(id);
+		} else {
+			//TODO 其他类型
+		}
+		return null;
+	}
+
+	public DataStrategy getDataStrategy() {
+		return dataStrategy;
+	}
+
+	public void setDataStrategy(DataStrategy dataStrategy) {
+		this.dataStrategy = dataStrategy;
+	}
+
+	public Diagram getDiagram() {
+		return diagram;
+	}
+
+	public DiagramTemplate getTemplate() {
+		return template;
+	}
+
+	public HashMap<String, IDataBind> getEquipMap() {
+		return equipMap;
+	}
+
+	public HashMap<String, Line> getLineMap() {
+		return lineMap;
+	}
+
+	public String getProjectId() {
+		return diagram.getProjectId();
+	}
+
+	public String getGroupCode() {
+		return diagram.getGroupCode();
+	}
+
+}

+ 5 - 3
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/logic/DataFilter.java

@@ -14,6 +14,8 @@ abstract public class DataFilter {
 
 	public static final int TYPE_OR = 3;
 
+	public static final int TYPE_RELATION = 9;
+
 	/**
 	 * 过滤器类型
 	 */
@@ -45,14 +47,14 @@ abstract public class DataFilter {
 	/**
 	 * 过滤操作,返回true时通过
 	 */
-	public boolean filter(Object data) {
-		boolean rtn = judge(data);
+	public boolean filter(Object data, CalcContext context) {
+		boolean rtn = judge(data, context);
 		return not ? !rtn : rtn;
 	}
 
 	/**
 	 * 子类实现具体的判断逻辑
 	 */
-	abstract protected boolean judge(Object data);
+	abstract protected boolean judge(Object data, CalcContext context);
 
 }

+ 1 - 1
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/logic/MatchFilter.java

@@ -37,7 +37,7 @@ public class MatchFilter extends DataFilter {
 	}
 
 	@Override
-	protected boolean judge(Object data) {
+	protected boolean judge(Object data, CalcContext context) {
 		Object param = null;
 		if (data instanceof ObjectNode) {
 			if(object.equals(MatchFilter.OBJ_NAME)) {

+ 2 - 2
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/logic/OrFilter.java

@@ -11,9 +11,9 @@ public class OrFilter extends LogicFilter {
 	}
 
 	@Override
-	protected boolean judge(Object data) {
+	protected boolean judge(Object data, CalcContext context) {
 		for(DataFilter item : items) {
-			if(!item.filter(data)) {
+			if(!item.filter(data, context)) {
 				return true;
 			}
 		}

+ 126 - 0
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/logic/RelationFilter.java

@@ -0,0 +1,126 @@
+package com.persagy.adm.diagram.core.model.logic;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.google.gson.annotations.Expose;
+import com.persagy.adm.diagram.core.model.EquipmentNode;
+import com.persagy.adm.diagram.core.model.base.Container;
+import com.persagy.adm.diagram.core.model.base.IComponent;
+import com.persagy.adm.diagram.core.model.template.MainPipe;
+import com.persagy.dmp.digital.entity.ObjectRelation;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 关系过滤器
+ * @author zhaoyk
+ */
+public class RelationFilter extends DataFilter {
+
+	@Expose
+	private String relObjType; //关联对象类型
+
+	@Expose
+	private String relObjId; //关联对象id
+
+	@Expose
+	private List<String> relTypes; //关联关系类型,格式: graphCode/relCode
+
+	/**
+	 * 关系列表,运行时
+	 */
+	@JsonIgnore
+	private List<ObjectNode> relations;
+
+	public RelationFilter(){
+		this.type = TYPE_RELATION;
+	}
+
+	@Override
+	protected boolean judge(Object data, CalcContext context) {
+		if(relations == null) {
+			initRelations(context);
+		}
+
+		String paramDataId = getDataId(data);
+		if(paramDataId != null) {
+			for(ObjectNode rel : relations) {
+				if(paramDataId.equals(rel.get(ObjectRelation.OBJ_FROM_HUM).asText()) || paramDataId.equals(rel.get(ObjectRelation.OBJ_TO_HUM).asText())){
+					return true;
+				}
+			}
+		}
+		return false;
+	}
+
+	private void initRelations(CalcContext context) {
+		List<String> dataIds = new ArrayList<>();
+		Object o = context.getComp(relObjId, relObjType);
+		if(o instanceof MainPipe) {
+			String dataId = getDataId(((MainPipe) o).getDataObject());
+			if(dataId != null) {
+				dataIds.add(dataId);
+			}
+		} else if(o instanceof Container) {
+			Container con = (Container) o;
+			if(con.isEquipmentBox()) {
+				for(IComponent comp : con.getChildren()) {
+					if(comp instanceof EquipmentNode) {
+						String dataId = getDataId(((EquipmentNode) comp).getDataObject());
+						if(dataId != null) {
+							dataIds.add(dataId);
+						}
+					}
+				}
+			}
+		}
+
+		if(dataIds.size() > 0) {
+			List<String[]> types;
+			if (relTypes != null) {
+				types = relTypes.stream().map(type -> type.split("/")).collect(Collectors.toList());
+			} else {
+				types = new ArrayList<>();
+			}
+			relations = context.getDataStrategy().loadRelationsByType(types, dataIds, context.getProjectId(), context.getGroupCode());
+		}
+
+		if(relations == null){
+			relations = new ArrayList<>();
+		}
+	}
+
+	private String getDataId(Object obj){
+		if(obj instanceof ObjectNode){
+			return ((ObjectNode) obj).get("id").asText();
+		}
+		return null;
+	}
+
+	public String getRelObjType() {
+		return relObjType;
+	}
+
+	public void setRelObjType(String relObjType) {
+		this.relObjType = relObjType;
+	}
+
+	public String getRelObjId() {
+		return relObjId;
+	}
+
+	public void setRelObjId(String relObjId) {
+		this.relObjId = relObjId;
+	}
+
+	public List<String> getRelTypes() {
+		return relTypes;
+	}
+
+	public void setRelTypes(List<String> relTypes) {
+		this.relTypes = relTypes;
+	}
+
+}

+ 2 - 2
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/template/ContainerRefPoint.java

@@ -56,12 +56,12 @@ public class ContainerRefPoint {
 		addPoint(container.getId(), BR, new XY(conLocation.x + size.x, conLocation.y + size.y), points);
 		addPoint(container.getId(), BL, new XY(conLocation.x, conLocation.y + size.y), points);
 
-		int len = size.x / 4;
+		int len = Math.round(size.x / 4f);
 		for (int i = 1; i <= 3; i++) {
 			addPoint(container.getId(), "T" + i, new XY(conLocation.x + len * i, conLocation.y), points);
 			addPoint(container.getId(), "B" + i, new XY(conLocation.x + len * i, conLocation.y + size.y), points);
 		}
-		len = size.y / 4;
+		len = Math.round(size.y / 4f);
 		for (int i = 1; i <= 3; i++) {
 			addPoint(container.getId(), "L" + i, new XY(conLocation.x, conLocation.y + len * i), points);
 			addPoint(container.getId(), "R" + i, new XY(conLocation.x + size.x, conLocation.y + len * i), points);

+ 17 - 0
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/template/DiagramTemplate.java

@@ -133,6 +133,12 @@ public class DiagramTemplate {
 	public void init() {
 		frame.initParent();
 		initScattered(frame);
+
+		if(mainPipes != null) {
+			for (MainPipe mainPipe : mainPipes) {
+				mainPipe.init(this);
+			}
+		}
 	}
 
 	private void initScattered(Container con){
@@ -218,6 +224,17 @@ public class DiagramTemplate {
 		}
 	}
 
+	public void clearLayout(){
+		for(Container con : getContainers()) {
+			con.clearLayout();
+		}
+		if(mainPipes != null) {
+			for (MainPipe mainPipe : mainPipes){
+				mainPipe.clearLayout();
+			}
+		}
+	}
+
 	public List<Container> getContainers() {
 		List<Container> list = new ArrayList<>();
 		getContainers(frame, list);

+ 172 - 32
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/template/MainPipe.java

@@ -1,8 +1,11 @@
 package com.persagy.adm.diagram.core.model.template;
 
+import cn.hutool.core.collection.CollUtil;
+import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.google.gson.annotations.Expose;
-import com.persagy.adm.diagram.core.model.base.Container;
 import com.persagy.adm.diagram.core.model.AbstractLine;
+import com.persagy.adm.diagram.core.model.base.Container;
+import com.persagy.adm.diagram.core.model.base.IContainer;
 import com.persagy.adm.diagram.core.model.base.IEquipHolder;
 import com.persagy.adm.diagram.core.model.base.XY;
 import com.persagy.adm.diagram.core.model.logic.DataFilter;
@@ -43,17 +46,168 @@ public class MainPipe extends AbstractLine implements IEquipHolder {
 	private DataFilter dataFilter;
 
 	@Expose
-	private List<List<MainPipePoint>> path = new ArrayList<>();
+	private List<List<MainPipePoint>> path;
+
+	/**
+	 * 关联的容器id
+	 */
+	@Expose
+	private List<String> relatedContainers;
 
 	/**
 	 * 连线的坐标点序列,多条线
 	 */
+	@Expose
 	private List<List<XY>> locationPath;
 
+	/**
+	 * 关联的容器对象,运行时
+	 */
+	@JsonIgnore
+	private List<Container> relatedContainerList;
+
+	@JsonIgnore
+	private Container parentContainer;
+
 	public MainPipe() {
 		this.compType = TYPE;
 	}
 
+	public void init(DiagramTemplate template) {
+		if(CollUtil.isNotEmpty(relatedContainers)) {
+			relatedContainerList = new ArrayList<>(relatedContainers.size());
+			for(String conId : relatedContainers) {
+				Container con = template.getContainerById(conId);
+				if(con != null)
+					relatedContainerList.add(con);
+			}
+
+			calcParentContainer();
+		}
+	}
+
+	private void calcParentContainer(){
+		IContainer p = null;
+		for(Container con : relatedContainerList) {
+			if (p == null) {
+				p = con.getParent();
+			} else {
+				p = getCommonParent(p, con.getParent());
+				if(p == null){
+					break;
+				}
+			}
+		}
+		if(p instanceof Container && !DiagramTemplate.FRAME_ID.equals(p.getId())) {
+			parentContainer = (Container) p;
+			parentContainer.addChildMainPipe(this);
+		}
+	}
+
+	private IContainer getCommonParent(IContainer p1, IContainer p2){
+		IContainer cp = p1;
+		while (true){
+			IContainer tmp = p2;
+			while (true) {
+				if(cp == tmp){
+					return cp;
+				}
+				tmp = tmp.getParent();
+				if(tmp == null){
+					break;
+				}
+			}
+			cp = cp.getParent();
+			if(cp == null){
+				break;
+			}
+		}
+		return null;
+	}
+
+	public void resetRelatedCons() {
+		if(parentContainer != null) {
+			parentContainer.removeChildMainPipe(this);
+		}
+		parentContainer = null;
+		relatedContainerList = null;
+	}
+
+	public void parseLines(List<List<XY>> lines, DiagramTemplate template) {
+		List<Container> refContainers = relatedContainerList;
+		if(CollUtil.isEmpty(refContainers)) {
+			refContainers = template.getContainers();
+		}
+		List<ContainerRefPoint> allRefPoints = new ArrayList<>();
+		for(Container con : refContainers) {
+			if (!DiagramTemplate.FRAME_ID.equals(con.getId()) && !con.isAbsolutePosition()) {
+				allRefPoints.addAll(ContainerRefPoint.getRefPoints(con, con.locationToRoot()));
+			}
+		}
+
+		path = new ArrayList<>();
+		for (List<XY> line : lines) {
+			List<MainPipePoint> ps = new ArrayList<>();
+			path.add(ps);
+
+			for (XY point : line) {
+				double min = Double.MAX_VALUE;
+				ContainerRefPoint targetRp = null;
+				for (ContainerRefPoint rp : allRefPoints) {
+					double d = distance(point, rp.getLocation());
+					if (d < min) {
+						min = d;
+						targetRp = rp;
+					}
+				}
+				MainPipePoint mp = new MainPipePoint();
+				mp.setContainerId(targetRp.getContainerId());
+				mp.setRefPointName(targetRp.getName());
+				mp.setOffset(new XY(point.x - targetRp.getLocation().x, point.y - targetRp.getLocation().y));
+				ps.add(mp);
+			}
+		}
+	}
+
+	private double distance(XY p1, XY p2) {
+		return Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2));
+	}
+
+	@Override
+	public void layout(Object layoutContext) {
+		DiagramTemplate template = (DiagramTemplate)layoutContext;
+		locationPath = new ArrayList<>(path.size());
+		for (List<MainPipePoint> line : path) {
+			ArrayList<XY> list = new ArrayList<>();
+			locationPath.add(list);
+
+			for(MainPipePoint p : line) {
+				Container container = template.getContainerById(p.getContainerId());
+				if(container != null && !container.isAbsolutePosition()) {
+					ContainerRefPoint rp = ContainerRefPoint.getRefPoint(container, p.getRefPointName(), container.locationToRoot());
+					list.add(new XY(rp.getLocation().x + p.getOffset().x , rp.getLocation().y + p.getOffset().y));
+				} else {
+					//参考点丢失,给出指示线
+					if(list.size() > 0) {
+						XY mark = new XY(list.get(list.size() - 1));
+						if(mark.y != -10) {
+							mark.y = -10;
+						} else {
+							mark.x += 50;
+						}
+						list.add(mark);
+					} else
+						list.add(new XY(-10, -10));
+				}
+			}
+		}
+	}
+
+	@Override
+	public void clearLayout() {
+		locationPath = null;
+	}
+
 	@Override
 	public String getId() {
 		return id;
@@ -140,6 +294,22 @@ public class MainPipe extends AbstractLine implements IEquipHolder {
 		this.path = path;
 	}
 
+	public List<String> getRelatedContainers() {
+		return relatedContainers;
+	}
+
+	public void setRelatedContainers(List<String> relatedContainers) {
+		this.relatedContainers = relatedContainers;
+	}
+
+	public List<Container> getRelatedContainerList() {
+		return relatedContainerList;
+	}
+
+	public Container getParentContainer() {
+		return parentContainer;
+	}
+
 	public List<List<XY>> getLocationPath() {
 		return locationPath;
 	}
@@ -148,34 +318,4 @@ public class MainPipe extends AbstractLine implements IEquipHolder {
 		this.locationPath = locationPath;
 	}
 
-	@Override
-	public void layout(Object layoutContext) {
-		DiagramTemplate template = (DiagramTemplate)layoutContext;
-		locationPath = new ArrayList<>(path.size());
-		for (List<MainPipePoint> line : path) {
-			ArrayList<XY> list = new ArrayList<>();
-			locationPath.add(list);
-
-			for(MainPipePoint p : line) {
-				Container container = template.getContainerById(p.getContainerId());
-				if(container != null && !container.isAbsolutePosition()) {
-					ContainerRefPoint rp = ContainerRefPoint.getRefPoint(container, p.getRefPointName(), container.locationToRoot());
-					list.add(new XY(rp.getLocation().x + p.getOffset().x , rp.getLocation().y + p.getOffset().y));
-				} else {
-					//参考点丢失,给出指示线
-					if(list.size() > 0) {
-						XY mark = new XY(list.get(list.size() - 1));
-						if(mark.y != -10) {
-							mark.y = -10;
-						} else {
-							mark.x += 50;
-						}
-						list.add(mark);
-					} else
-						list.add(new XY(-10, -10));
-				}
-			}
-		}
-	}
-
 }

+ 8 - 0
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/virtual/PackNode.java

@@ -26,6 +26,14 @@ public class PackNode extends EquipmentNode {
 		this.compType = TYPE;
 	}
 
+	/**
+	 * 重写getObjId方法,返回节点id
+	 */
+	@Override
+	public String getDataObjectId() {
+		return id;
+	}
+
 	public Map<String, Integer> getStatInfo() {
 		return statInfo;
 	}

+ 3 - 4
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/util/GsonUtil.java

@@ -7,10 +7,7 @@ import com.persagy.adm.diagram.core.model.EquipmentNode;
 import com.persagy.adm.diagram.core.model.Label;
 import com.persagy.adm.diagram.core.model.base.Container;
 import com.persagy.adm.diagram.core.model.base.IComponent;
-import com.persagy.adm.diagram.core.model.logic.AndFilter;
-import com.persagy.adm.diagram.core.model.logic.DataFilter;
-import com.persagy.adm.diagram.core.model.logic.MatchFilter;
-import com.persagy.adm.diagram.core.model.logic.OrFilter;
+import com.persagy.adm.diagram.core.model.logic.*;
 import com.persagy.adm.diagram.core.model.virtual.PackNode;
 import org.springframework.stereotype.Component;
 
@@ -87,6 +84,8 @@ public class GsonUtil {
 				target = AndFilter.class;
 			} else if(fType == OrFilter.TYPE_OR) {
 				target = OrFilter.class;
+			} else if(fType == OrFilter.TYPE_RELATION) {
+				target = RelationFilter.class;
 			} else {
 				//TODO 其他类型
 			}

+ 64 - 15
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/util/MyObjectMapper.java

@@ -5,12 +5,16 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
 import com.fasterxml.jackson.annotation.PropertyAccessor;
 import com.fasterxml.jackson.databind.DeserializationFeature;
 import com.fasterxml.jackson.databind.ObjectMapper;
+import com.persagy.adm.diagram.core.model.Diagram;
+import com.persagy.adm.diagram.core.model.Line;
 import com.persagy.adm.diagram.core.model.template.DiagramTemplate;
+import com.persagy.adm.diagram.core.model.template.MainPipe;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 /**
  * 自定义ObjectMapper,为jackson定义不同场景下的处理逻辑
+ *
  * @author zhaoyk
  */
 @Component
@@ -18,36 +22,81 @@ public class MyObjectMapper {
 
 	private final ObjectMapper objectMapper;
 
-	private ObjectMapper mapper4Save;
+	private ObjectMapper mapper4Edit;
+
+	private ObjectMapper mapper4View;
 
 	@Autowired
 	public MyObjectMapper(ObjectMapper objectMapper) {
-		this.objectMapper = objectMapper;
-		configCommonMapper();
+		this.objectMapper = getCommonMapper(objectMapper);
+
+		this.mapper4Edit = buildMapper4Edit();
+		this.mapper4View = buildMapper4View();
+	}
 
-		this.mapper4Save = buildMapper4Save();
+	public ObjectMapper mapper4Edit() {
+		return mapper4Edit;
 	}
 
-	private void configCommonMapper(){
+	public ObjectMapper mapper4View() {
+		return mapper4View;
+	}
+
+	private ObjectMapper getCommonMapper(ObjectMapper mapper) {
 		//objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
-		objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
-		objectMapper.setVisibility(PropertyAccessor.SETTER, JsonAutoDetect.Visibility.NONE);
-		objectMapper.setVisibility(PropertyAccessor.GETTER, JsonAutoDetect.Visibility.NONE);
-		objectMapper.setVisibility(PropertyAccessor.IS_GETTER, JsonAutoDetect.Visibility.NONE);
-		objectMapper.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY);
+		mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+		mapper.setVisibility(PropertyAccessor.SETTER, JsonAutoDetect.Visibility.NONE);
+		mapper.setVisibility(PropertyAccessor.GETTER, JsonAutoDetect.Visibility.NONE);
+		mapper.setVisibility(PropertyAccessor.IS_GETTER, JsonAutoDetect.Visibility.NONE);
+		mapper.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY);
+
+		return mapper;
+	}
+
+	private ObjectMapper buildMapper4Edit() {
+		ObjectMapper mapper = getCommonMapper(new ObjectMapper());
+		mapper.addMixIn(Diagram.class, Diagram4Edit.class);
+		mapper.addMixIn(DiagramTemplate.class, Template4Edit.class);
+
+		return mapper;
 	}
 
-	private ObjectMapper buildMapper4Save(){
-		ObjectMapper mapper = new ObjectMapper();
-		mapper.addMixIn(DiagramTemplate.class, Template4Save.class);
-		//TODO
+	private ObjectMapper buildMapper4View() {
+		ObjectMapper mapper = getCommonMapper(new ObjectMapper());
+		mapper.addMixIn(Diagram.class, Diagram4View.class);
+		mapper.addMixIn(DiagramTemplate.class, Template4View.class);
+		mapper.addMixIn(MainPipe.class, MainPipe4View.class);
+		mapper.addMixIn(Line.class, Line4View.class);
+
 		return mapper;
 	}
 
 
+	/** 编辑态数据结构 */
+	@JsonIgnoreProperties({"nodes"})
+	public interface Diagram4Edit {
+	}
+
+	@JsonIgnoreProperties({})
+	public interface Template4Edit {
+	}
+
+
+	/** 显示态数据结构 */
 	@JsonIgnoreProperties({})
-	public interface Template4Save {
+	public interface Diagram4View {
+	}
+
+	@JsonIgnoreProperties({"diagramType", "id", "frame", "scatteredContainers"})
+	public interface Template4View {
+	}
+
+	@JsonIgnoreProperties({"passbyRels", "connectEquips", "equipmentTypes", "dataFilter", "path", "relatedContainers"})
+	public interface MainPipe4View {
+	}
 
+	@JsonIgnoreProperties({"passingPoints"})
+	public interface Line4View {
 	}
 
 }

+ 2 - 0
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/frame/EditRequest.java

@@ -72,6 +72,8 @@ public class EditRequest {
 
 		private List<String> connectEquips;
 
+		private List<String> relatedContainers;
+
 		private Map<String, Object> props;
 
 	}

+ 15 - 25
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/manage/DemoDiagramManager.java

@@ -1,13 +1,13 @@
 package com.persagy.adm.diagram.manage;
 
 import cn.hutool.core.util.IdUtil;
-import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.persagy.adm.diagram.core.ContentParser;
 import com.persagy.adm.diagram.core.DataStrategy;
-import com.persagy.adm.diagram.core.DiagramBuilder;
 import com.persagy.adm.diagram.core.DiagramDataLoader;
 import com.persagy.adm.diagram.core.model.Diagram;
+import com.persagy.adm.diagram.core.model.logic.CalcContext;
+import com.persagy.adm.diagram.core.util.MyObjectMapper;
 import com.persagy.adm.diagram.entity.DiagramType;
 import com.persagy.adm.diagram.frame.BdtpRequest;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -85,7 +85,7 @@ public class DemoDiagramManager {
 		new DiagramDataLoader(diagram, dataStrategy).initLoad();
 
 		if(layout) {
-			diagram.layout(new DiagramBuilder(diagram, dataStrategy));
+			diagram.layout(new CalcContext(diagram));
 		}
 	}
 
@@ -135,7 +135,7 @@ public class DemoDiagramManager {
 	}
 
 	@Autowired
-	private ObjectMapper objectMapper;
+	private MyObjectMapper myObjectMapper;
 	/**
 	 * 加载数据
 	 */
@@ -143,31 +143,21 @@ public class DemoDiagramManager {
 		Diagram diagram = dataStrategy.getDiagram(diagramId);
 		buildDiagram(diagram, false);
 
-		DiagramBuilder builder = new DiagramBuilder(diagram, dataStrategy);
-		new DiagramDataLoader(diagram, dataStrategy).autoLoad(builder);
+		CalcContext context = new CalcContext(diagram);
+		new DiagramDataLoader(diagram, dataStrategy).autoLoad(context);
 
-		diagram.layout(builder);
+		diagram.layout(context);
 
-//		//test 输出数据结构
+		//test 输出数据结构
 //		try {
-//			Diagram d = dataStrategy.getDiagram(diagramId);
-//			buildDiagram(d, false);
-//			loadData(d, autoLoad);
-//			d.layout(new XY(0, 0), true);
-//			if(d.getLines().size() == 0) {
-//				Line line = new Line();
-//				line.setFrom(new ConnectPoint());
-//				line.setTo(new ConnectPoint());
-//				line.setLineStyle(new LineStyle());
-//				Label label = new Label();
-//				label.setStyle(new BaseStyle());
-//				line.setLabel(label);
-//				d.getLines().add(line);
-//			}
-//			DiagramView dv = new DiagramView(d);
+//			System.out.println("----------------------------------------------");
+//			System.out.println("edit json : ");
+//			System.out.println(myObjectMapper.mapper4Edit().writeValueAsString(diagram));
 //
-//			System.out.println("-----------------------------------------------------");
-//			System.out.println(objectMapper.writeValueAsString(dv));
+//			System.out.println("----------------------------------------------");
+//			System.out.println("view json : ");
+//			diagram.toAbsoluteLocation();
+//			System.out.println(myObjectMapper.mapper4View().writeValueAsString(diagram));
 //		}catch (Exception e){
 //			e.printStackTrace();
 //		}

+ 47 - 69
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/manage/TemplateManager.java

@@ -4,25 +4,24 @@ import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.IdUtil;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.persagy.adm.diagram.core.ContentParser;
+import com.persagy.adm.diagram.core.DataStrategy;
 import com.persagy.adm.diagram.core.model.base.*;
-import com.persagy.adm.diagram.core.model.logic.*;
+import com.persagy.adm.diagram.core.model.logic.DataFilter;
+import com.persagy.adm.diagram.core.model.logic.DynGroup;
+import com.persagy.adm.diagram.core.model.logic.EquipPack;
+import com.persagy.adm.diagram.core.model.template.DiagramTemplate;
+import com.persagy.adm.diagram.core.model.template.MainPipe;
 import com.persagy.adm.diagram.dao.TemplateMapper;
 import com.persagy.adm.diagram.entity.DiagramType;
 import com.persagy.adm.diagram.entity.TemplateEntity;
-import com.persagy.adm.diagram.frame.EditRequest;
-import com.persagy.adm.diagram.core.DataStrategy;
-import com.persagy.adm.diagram.core.model.template.ContainerRefPoint;
-import com.persagy.adm.diagram.core.model.template.DiagramTemplate;
-import com.persagy.adm.diagram.core.model.template.MainPipe;
-import com.persagy.adm.diagram.core.model.template.MainPipePoint;
 import com.persagy.adm.diagram.frame.BdtpRequest;
+import com.persagy.adm.diagram.frame.EditRequest;
 import com.persagy.adm.diagram.service.BdtpDataService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Service;
 
 import java.util.ArrayList;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 
@@ -143,9 +142,10 @@ public class TemplateManager {
      * 保存模板
      */
     public DiagramTemplate saveTemplate(DiagramTemplate template) {
-        template = dataStrategy.saveTemplate(template);
-        buildTemplate(template);
-        return template;
+        template.clearLayout(); //保存模板之前,清除布局数据
+        DiagramTemplate rtn = dataStrategy.saveTemplate(template);
+        buildTemplate(rtn);
+        return rtn;
     }
 
     private void buildTemplate(DiagramTemplate template) {
@@ -244,7 +244,35 @@ public class TemplateManager {
     /**
      * 绘制新的干管
      */
-    public DiagramTemplate addMainPipe(List<List<XY>> lines, String templateId) {
+    public DiagramTemplate drawMainPipe(List<List<XY>> lines, String mainPipeId, String templateId) {
+        lines = fixMainPipePath(lines);
+
+        DiagramTemplate template = dataStrategy.getTemplate(templateId);
+        buildTemplate(template);
+
+        MainPipe mainPipe = null;
+        if(mainPipeId != null){
+            mainPipe = template.getMainPipeById(mainPipeId);
+        }
+        if (mainPipe == null) {
+            mainPipe = new MainPipe();
+            mainPipe.setId(IdUtil.simpleUUID());
+
+            if (template.getMainPipes() == null) {
+                template.setMainPipes(new ArrayList<>());
+            }
+            template.getMainPipes().add(mainPipe);
+        }
+
+        mainPipe.parseLines(lines, template);
+
+        return saveTemplate(template);
+    }
+
+    /**
+     * 对前端传入的路径进行修正处理
+     */
+    private List<List<XY>> fixMainPipePath(List<List<XY>> lines){
         //合并同一条线上的多个点
         List<List<XY>> fixed = new ArrayList<>();
         for (List<XY> line : lines) {
@@ -271,63 +299,7 @@ public class TemplateManager {
                 fixedLine.add(point);
             }
         }
-
-        DiagramTemplate template = dataStrategy.getTemplate(templateId);
-        buildTemplate(template);
-
-        List<ContainerRefPoint> allRefPoints = new ArrayList<>();
-
-        LinkedList<Container> cons = new LinkedList<>();
-        cons.add(template.getFrame());
-        while (cons.size() > 0) {
-            Container con = cons.removeFirst();
-            //不使用frame和自由定位容器做定位
-            if (con.getParent() != null && !con.isAbsolutePosition()) {
-                allRefPoints.addAll(ContainerRefPoint.getRefPoints(con, con.locationToRoot()));
-            }
-
-            for (IComponent comp : con.getChildren()) {
-                if (comp instanceof Container) {
-                    cons.add((Container) comp);
-                }
-            }
-        }
-
-        MainPipe mainPipe = new MainPipe();
-        //TODO
-        mainPipe.setId(IdUtil.simpleUUID());
-
-        for (List<XY> line : fixed) {
-            List<MainPipePoint> ps = new ArrayList<>();
-            mainPipe.getPath().add(ps);
-
-            for (XY point : line) {
-                double min = Double.MAX_VALUE;
-                ContainerRefPoint targetRp = null;
-                for (ContainerRefPoint rp : allRefPoints) {
-                    double d = distance(point, rp.getLocation());
-                    if (d < min) {
-                        min = d;
-                        targetRp = rp;
-                    }
-                }
-                MainPipePoint mp = new MainPipePoint();
-                mp.setContainerId(targetRp.getContainerId());
-                mp.setRefPointName(targetRp.getName());
-                mp.setOffset(new XY(point.x - targetRp.getLocation().x, point.y - targetRp.getLocation().y));
-                ps.add(mp);
-            }
-        }
-        if (template.getMainPipes() == null) {
-            template.setMainPipes(new ArrayList<>());
-        }
-        template.getMainPipes().add(mainPipe);
-
-        return saveTemplate(template);
-    }
-
-    private double distance(XY p1, XY p2) {
-        return Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2));
+        return fixed;
     }
 
     /**
@@ -353,6 +325,7 @@ public class TemplateManager {
      */
     public DiagramTemplate modifyMainPipe(EditRequest.TemplatePropsData propsData, String mainPipeId, String templateId) {
         DiagramTemplate template = dataStrategy.getTemplate(templateId);
+        buildTemplate(template);
 
         MainPipe mainPipe = template.getMainPipeById(mainPipeId);
         if (mainPipe != null) {
@@ -364,8 +337,13 @@ public class TemplateManager {
             mainPipe.setEquipmentTypes(propsData.getEquipTypes());
             mainPipe.setPassbyRels(propsData.getPassbyRels());
             mainPipe.setConnectEquips(propsData.getConnectEquips());
+            mainPipe.setRelatedContainers(propsData.getRelatedContainers());
         }
 
+        mainPipe.resetRelatedCons();
+        mainPipe.init(template);
+        mainPipe.parseLines(mainPipe.getLocationPath(), template);
+
         return saveTemplate(template);
     }
 

+ 2 - 2
adm-business/adm-middleware/src/main/java/com/persagy/proxy/calculation/model/AdmRelationAddRequest.java

@@ -9,8 +9,6 @@ import lombok.Data;
 import lombok.NoArgsConstructor;
 
 import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
 import java.util.Set;
 
 @Data
@@ -36,5 +34,7 @@ public class AdmRelationAddRequest implements Serializable {
     @JSONField(name = "graphicType",alternateNames = {"parentCode","graphic_type"})
     private String graphicType;
 
+    /** 交付范围 0项目交付,1现场交付**/
+    private Integer deliveryType;
 
 }

+ 82 - 6
adm-business/adm-middleware/src/main/java/com/persagy/proxy/calculation/service/impl/AdmManualRelCalServiceImpl.java

@@ -1,5 +1,9 @@
 package com.persagy.proxy.calculation.service.impl;
 
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.extra.spring.SpringUtil;
 import java.util.*;
 
 import com.persagy.dmp.basic.model.QueryCriteria;
@@ -10,12 +14,18 @@ import org.springframework.stereotype.Service;
 
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.JsonNodeFactory;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.persagy.dmp.basic.dto.RequestData;
+import com.persagy.dmp.basic.model.QueryCriteria;
+import com.persagy.dmp.common.constant.CommonConstant;
 import com.persagy.dmp.common.constant.ResponseCode;
 import com.persagy.dmp.common.context.AppContext;
+import com.persagy.dmp.common.helper.SpringHelper;
 import com.persagy.dmp.common.model.response.CommonResult;
+import com.persagy.dmp.delivery.entity.RelationDefineCollect;
 import com.persagy.dmp.digital.client.DigitalObjectClient;
+import com.persagy.dmp.digital.client.DigitalObjectFacade;
 import com.persagy.dmp.digital.client.DigitalRelationCaclClient;
 import com.persagy.dmp.digital.entity.ObjectDigital;
 import com.persagy.dmp.digital.entity.ObjectRelation;
@@ -31,13 +41,12 @@ import com.persagy.proxy.calculation.model.AdmManualRelationCalcDel;
 import com.persagy.proxy.calculation.model.AdmRelationAddRequest;
 import com.persagy.proxy.calculation.service.AdmManualRelCalService;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
-
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.date.DateUtil;
-import cn.hutool.core.util.StrUtil;
-import cn.hutool.extra.spring.SpringUtil;
+import com.persagy.proxy.report.service.IRelationReportService;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import java.util.*;
 
 /***
  * Description: 手动计算逻辑处理类
@@ -52,6 +61,7 @@ public class AdmManualRelCalServiceImpl implements AdmManualRelCalService {
 
     private final DigitalRelationCaclClient digitalRelationCaclClient;
     private final DigitalObjectClient digitalObjectClient;
+    private final IRelationReportService relationReportService;
 
 
 
@@ -96,6 +106,7 @@ public class AdmManualRelCalServiceImpl implements AdmManualRelCalService {
         if (relationTypeEnum == null){
             return AdmCreateResponse.failure("不存在的关系类型");
         }
+
         // type为cadId直接提示从对象不存在CADID编码并且errorType=2
         if (AdmObjectInfoConstant.CADID.equals(request.getType()) && relationTypeEnum.getHasCheckCadId()){
             return AdmCreateResponse.failure("从对象不存在CADID编码","2");
@@ -143,7 +154,14 @@ public class AdmManualRelCalServiceImpl implements AdmManualRelCalService {
             if (fromMap.get(fromContent).size()>1){
                 return AdmCreateResponse.failure(fromContent +":存在多个实例","2");
             }
-
+        }
+        //验证 项目交付范围
+        Integer flag = validRelCollect(context, relationTypeEnum, request.getDeliveryType(), mainResultData, fromResultData);
+        switch (flag){
+            case 1 : return AdmCreateResponse.failure(mainResultData +":不存在","1");
+            case 2 : return AdmCreateResponse.failure(fromResultData +":不存在","2");
+            case 3 : return AdmCreateResponse.failure("不在项目交付范围内");
+            default:
         }
         RequestData requestData = RequestData.builder()
                 .graphCode(relationTypeEnum.getGraphCode())
@@ -492,4 +510,62 @@ public class AdmManualRelCalServiceImpl implements AdmManualRelCalService {
         temp.put("projectId", objectDigital.getProjectId());
         temp.putObject("statistics");
     }
+
+
+    /**
+     * 验证关系交付范围
+     * @param mainResultData 主对象
+     * @param fromResultData 从对象
+     * @return 0 成功; 1 主对象为空; 2 从对象为空; 3 不在项目交付范围内
+     **/
+    private Integer validRelCollect(InstanceUrlParam context, AdmRelationTypeEnum relationTypeEnum , Integer deliveryType, List<ObjectNode> mainResultData, List<ObjectNode> fromResultData){
+        if(CollUtil.isEmpty(mainResultData)){
+            return 1;
+        }
+        if(CollUtil.isEmpty(fromResultData)){
+            return 2;
+        }
+        if(deliveryType != null){
+            QueryCriteria queryCriteria = new QueryCriteria();
+            ObjectNode objectNode = JsonNodeFactory.instance.objectNode();
+            objectNode.put("projectId", context.getProjectId());
+            objectNode.put("relCode", relationTypeEnum.getRelCode());
+            objectNode.put("graphCode", relationTypeEnum.getGraphCode());
+            objectNode.put("deliveryType",deliveryType);
+            queryCriteria.setCriteria(objectNode);
+            List<RelationDefineCollect> relationDefineCollects = relationReportService.doQueryRelationDefineCollectList(context, queryCriteria);
+            if(CollUtil.isEmpty(relationDefineCollects)){
+                return 3;
+            }
+            Set<String> fromSet = new HashSet<>();
+            fromResultData.forEach(obj -> {
+                if(obj.get("classCode") != null && obj.get("classCode").isTextual()){
+                    fromSet.add(obj.get("classCode").asText());
+                }
+            });
+
+            Set<String> mainSet = new HashSet<>();
+            mainResultData.forEach(obj -> {
+                if(obj.get("classCode") != null && obj.get("classCode").isTextual()){
+                    mainSet.add(obj.get("classCode").asText());
+                }
+            });
+            //关系无方向性
+            for(RelationDefineCollect collect : relationDefineCollects){
+                ArrayNode sourceTypeCodes = collect.getSourceTypeCodes();
+                Set<String> sourceTypeCodeSet = CollUtil.newHashSet();
+                sourceTypeCodes.forEach(classCode -> sourceTypeCodeSet.add(classCode.isTextual() ? classCode.asText() : ""));
+                ArrayNode endTypeCodes = collect.getEndTypeCodes();
+                Set<String> endTypeCodeSet = CollUtil.newHashSet();
+                endTypeCodes.forEach(classCode -> endTypeCodeSet.add(classCode.isTextual() ? classCode.asText() : ""));
+                if(sourceTypeCodeSet.contains(mainSet) && endTypeCodeSet.contains(endTypeCodeSet)){
+                    return 0;
+                }
+                if(sourceTypeCodeSet.contains(endTypeCodes) && endTypeCodeSet.contains(mainSet)){
+                    return 0;
+                }
+            }
+        }
+        return 3;
+    }
 }

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

@@ -4,6 +4,10 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.persagy.dmp.basic.config.DigitalFeignConfig;
 import com.persagy.dmp.basic.model.QueryCriteria;
+import com.persagy.dmp.common.model.response.CommonResult;
+import com.persagy.dmp.delivery.dto.ObjectInfoCollectDTO;
+import com.persagy.dmp.delivery.entity.ObjectTypeCollect;
+import com.persagy.dmp.delivery.entity.RelationDefineCollect;
 import com.persagy.proxy.common.constant.DmpUrlConstant;
 import com.persagy.proxy.common.entity.DmpResult;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
@@ -192,7 +196,7 @@ public interface DmpRwdClient {
      * @return: com.persagy.dmp.common.DmpResult
      */
     @PostMapping(DmpUrlConstant.DEF_FUNCID_COLLECT)
-    DmpResult<JSONArray> queryObjectInfoCollect(@SpringQueryMap InstanceUrlParam objectUrlParam, @RequestBody JSONObject criteria);
+    CommonResult<List<ObjectInfoCollectDTO>> queryObjectInfoCollect(@SpringQueryMap InstanceUrlParam objectUrlParam, @RequestBody JSONObject criteria);
 
 
     /**
@@ -222,10 +226,7 @@ public interface DmpRwdClient {
      * @return: com.persagy.dmp.common.DmpResult
      */
     @PostMapping(DmpUrlConstant.DEF_CLASS_COLLECT)
-    DmpResult<JSONArray> queryObjectClassCollect(@SpringQueryMap InstanceUrlParam objectUrlParam, @RequestBody JSONObject criteria);
-
-
-
+    DmpResult<List<ObjectTypeCollect>> queryObjectClassCollect(@SpringQueryMap InstanceUrlParam objectUrlParam, @RequestBody JSONObject criteria);
 
     /**
      * @description: 查询交付关系
@@ -234,7 +235,7 @@ public interface DmpRwdClient {
      * @return: com.persagy.dmp.common.DmpResult
      */
     @PostMapping(DmpUrlConstant.DEF_REL_COLLECT)
-    DmpResult<JSONArray> queryObjectRelCollect(@SpringQueryMap InstanceUrlParam objectUrlParam, @RequestBody JSONObject criteria);
+    DmpResult<List<RelationDefineCollect>> queryObjectRelCollect(@SpringQueryMap InstanceUrlParam objectUrlParam, @RequestBody JSONObject criteria);
 
 
 }

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

@@ -63,7 +63,7 @@ public class AdmObjectType {
     private String lastUpdate;
 
     /** 交付类型:0-项目交付 1-现场交付  */
-    private Integer deliveryType = -1;
+    private Integer deliveryType ;
     /** 是否交付 0-否 1-是 */
-    private Integer isDelivery = -1;
+    private Integer isDelivery ;
 }

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

@@ -10,8 +10,9 @@ import com.persagy.dmp.basic.model.QueryCriteria;
 import com.persagy.dmp.basic.utils.JsonNodeUtils;
 import com.persagy.dmp.common.constant.ValidEnum;
 import com.persagy.dmp.common.context.AppContext;
+import com.persagy.dmp.common.model.response.CommonResult;
 import com.persagy.dmp.common.utils.JsonHelper;
-import com.persagy.dmp.delivery.entity.ObjectInfoCollect;
+import com.persagy.dmp.delivery.dto.ObjectInfoCollectDTO;
 import com.persagy.dmp.delivery.entity.ObjectTypeCollect;
 import com.persagy.proxy.adm.constant.AdmCommonConstant;
 import com.persagy.proxy.adm.constant.AdmDictConstant;
@@ -31,7 +32,10 @@ import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 
 import java.io.IOException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
 
 /**
  * @ClassName AbstractAdmDictBaseServiceImpl
@@ -341,8 +345,8 @@ public class AbstractAdmDictBaseServiceImpl<T> implements IAdmDictBaseService<T>
         }
         // 调用中台查询
         log.info(para.toString());
-        DmpResult<JSONArray> dmpResult = rwdClient.queryObjectInfoCollect(context, para);
-        List<ObjectInfoCollect> admVOs = AdmEntityTransferUtil.toAdmMultiEntity(dmpResult.getData(), request.getProjection(), ObjectInfoCollect.class);
+        CommonResult<List<ObjectInfoCollectDTO>> dmpResult = rwdClient.queryObjectInfoCollect(context, para);
+        List<ObjectInfoCollectDTO> admVOs = dmpResult.getData();
         // 设置返回值
         AdmResponse response = AdmResponse.success(admVOs);
         Long total = dmpResult.getCount() == null ? null : dmpResult.getCount().longValue();
@@ -365,8 +369,8 @@ public class AbstractAdmDictBaseServiceImpl<T> implements IAdmDictBaseService<T>
         }
         // 调用中台查询
         log.info(para.toString());
-        DmpResult<JSONArray> dmpResult = rwdClient.queryObjectClassCollect(context, para);
-        List<ObjectTypeCollect> admVOs = AdmEntityTransferUtil.toAdmMultiEntity(dmpResult.getData(), null, ObjectTypeCollect.class);
+        DmpResult<List<ObjectTypeCollect>> dmpResult = rwdClient.queryObjectClassCollect(context, para);
+        List<ObjectTypeCollect> admVOs = dmpResult.getData();
         // 设置返回值
         AdmResponse response = AdmResponse.success(admVOs);
         return response;

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

@@ -88,14 +88,17 @@ public class AdmDictServiceImpl<T> extends AbstractAdmDictBaseServiceImpl<T> imp
             admResponse = queryDictObjectTypeTree(context ,type,clazz);
         }
 
+        //获取交付范围内的设备
         QueryCriteria criteriaCollect = new QueryCriteria();
         ObjectNode nodeCol = JsonNodeFactory.instance.objectNode();
         nodeCol.put("objType", type);
+        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;
     }
@@ -597,7 +600,8 @@ public class AdmDictServiceImpl<T> extends AbstractAdmDictBaseServiceImpl<T> imp
         if("common".equals(dictType)){
             criteria.setFilters("groupCode = '0' and projectId = '0'");
         }else{
-            criteria.setFilters("groupCode = '"+context.getGroupCode()+"' and projectId = '"+context.getProjectId()+"'");
+            //criteria.setFilters("groupCode = '"+context.getGroupCode()+"' and projectId = '"+context.getProjectId()+"'");
+            criteria.setFilters(" projectId = '"+context.getProjectId()+"'");
         }
         criteria.setName(classCode);
         AdmResponse admResponse = doQueryObjectInfoCollect(context, criteria, "classCode", clazz);

+ 19 - 1
adm-business/adm-middleware/src/main/java/com/persagy/proxy/object/controller/AdmProjectController.java

@@ -1,5 +1,7 @@
 package com.persagy.proxy.object.controller;
 
+import cn.hutool.core.collection.CollUtil;
+import com.persagy.proxy.adm.request.AdmCreateRequest;
 import com.persagy.proxy.adm.request.AdmQueryCriteria;
 import com.persagy.proxy.adm.request.AdmResponse;
 import com.persagy.proxy.adm.utils.AdmContextUtil;
@@ -8,8 +10,10 @@ import com.persagy.proxy.object.service.IAdmProjectService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.List;
+
 /**
- * ADM 项目 API
+ * 项目管理
  * @author Charlie Yu
  * @date 2021-08-16
  */
@@ -43,4 +47,18 @@ public class AdmProjectController {
     public AdmResponse queryObj(@RequestBody AdmQueryCriteria request) throws Exception {
         return query(null, request);
     }
+
+
+    /**
+     * 更新项目信息
+     * @param createRequest
+     * @return
+     * @throws Exception
+     */
+    @PostMapping("/update")
+    public AdmResponse update(@RequestBody AdmCreateRequest<AdmProject> createRequest) throws Exception {
+        List<AdmProject> vos = CollUtil.newArrayList(createRequest.getContent());
+        vos = service.doUpdate(AdmContextUtil.toDmpContext(), AdmProject.class, vos);
+        return AdmResponse.success(vos);
+    }
 }

+ 3 - 12
adm-business/adm-middleware/src/main/java/com/persagy/proxy/object/model/AdmProject.java

@@ -1,5 +1,6 @@
 package com.persagy.proxy.object.model;
 
+import com.persagy.proxy.adm.model.AdmBaseEntity;
 import lombok.Data;
 
 import java.util.Date;
@@ -11,7 +12,7 @@ import java.util.Map;
  * @date 2021-08-16
  */
 @Data
-public class AdmProject {
+public class AdmProject extends AdmBaseEntity<AdmProject> {
     public static final String OBJ_TYPE = "project";
     /** 项目ID */
     private String id;
@@ -21,18 +22,8 @@ public class AdmProject {
     private String localId;
     /** 项目本地名称 */
     private String localName;
-    /** 项目介绍 */
-    private String introduction;
-    /** 集团编码 */
-    private String groupCode;
-    /** 商业层数 */
-    private String businessFloorNum;
-    /** 办公层数 */
-    private String officeFloorNum;
     /** 对象类型 */
-    private String objectType;
-    /** 信息点 */
-    private Map<String, Object> infos;
+    private String objectType = OBJ_TYPE;
     /** 创建时间 */
     private Date createTime;
     /** 最后更新日期 */

+ 10 - 1
adm-business/adm-middleware/src/main/java/com/persagy/proxy/report/service/IRelationReportService.java

@@ -4,6 +4,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.metadata.OrderItem;
 import com.fasterxml.jackson.core.JsonProcessingException;
@@ -15,6 +16,7 @@ import com.persagy.dmp.define.entity.ObjectTypeDefine;
 import com.persagy.dmp.define.entity.RelationDefine;
 import com.persagy.dmp.delivery.entity.RelationDefineCollect;
 import com.persagy.dmp.digital.entity.ObjectRelation;
+import com.persagy.proxy.common.entity.DmpResult;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
 
 /**
@@ -274,6 +276,13 @@ public interface IRelationReportService {
 	 */
 	Map<String, List<ObjectNode>> findObjectNodesByPage(String groupCode, String projectId, Set<String> objTypes, String infoKey, Set<String> codes);
 
+	/**
+	 * 查询采集 范围
+	 * @param context
+	 * @param queryCriteria
+	 * @return
+	 */
+	DmpResult<List<RelationDefineCollect>> doQueryRelationDefineCollect(InstanceUrlParam context, QueryCriteria queryCriteria);
 
 	/**
 	 * 查询采集 范围
@@ -281,7 +290,7 @@ public interface IRelationReportService {
 	 * @param queryCriteria
 	 * @return
 	 */
-	List<RelationDefineCollect> doQueryRelationDefineCollect(InstanceUrlParam context, QueryCriteria queryCriteria);
+	List<RelationDefineCollect> doQueryRelationDefineCollectList(InstanceUrlParam context, QueryCriteria queryCriteria);
 
 	/**
 	 * 设置采集 范围

+ 26 - 8
adm-business/adm-middleware/src/main/java/com/persagy/proxy/report/service/impl/RelationReportService.java

@@ -13,6 +13,7 @@ import com.baomidou.mybatisplus.core.metadata.OrderItem;
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.JsonNodeFactory;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.persagy.dmp.basic.dto.GraphParentMes;
 import com.persagy.dmp.basic.dto.RequestData;
@@ -43,7 +44,6 @@ import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
 import com.persagy.proxy.adm.constant.SpaceTypeEnum;
 import com.persagy.proxy.adm.strategy.relationdata.RelationObjectStrategy;
 import com.persagy.proxy.adm.utils.AdmContextUtil;
-import com.persagy.proxy.adm.utils.AdmEntityTransferUtil;
 import com.persagy.proxy.common.client.DmpRwdClient;
 import com.persagy.proxy.common.entity.DmpResult;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
@@ -413,7 +413,7 @@ public class RelationReportService implements IRelationReportService {
 	 * @return
 	 */
 	@Override
-	public List<RelationDefineCollect> doQueryRelationDefineCollect(InstanceUrlParam context, QueryCriteria queryCriteria) {
+	public DmpResult<List<RelationDefineCollect>> doQueryRelationDefineCollect(InstanceUrlParam context, QueryCriteria queryCriteria) {
 		// 转换参数
 		JSONObject para = null;
 		try {
@@ -422,8 +422,21 @@ public class RelationReportService implements IRelationReportService {
 			return null;
 		}
 		// 调用中台查询
-		DmpResult<JSONArray> dmpResult = rwdClient.queryObjectRelCollect(context, para);
-		List<RelationDefineCollect> admVOs = AdmEntityTransferUtil.toAdmMultiEntity(dmpResult.getData(), null, RelationDefineCollect.class);
+		DmpResult<List<RelationDefineCollect>> dmpResult = rwdClient.queryObjectRelCollect(context, para);
+		return dmpResult;
+	}
+
+	/**
+	 * 查询采集 范围
+	 *
+	 * @param context
+	 * @param queryCriteria
+	 * @return
+	 */
+	@Override
+	public List<RelationDefineCollect> doQueryRelationDefineCollectList(InstanceUrlParam context, QueryCriteria queryCriteria) {
+		DmpResult<List<RelationDefineCollect>> dmpResult = doQueryRelationDefineCollect(context, queryCriteria);
+		List<RelationDefineCollect> admVOs = dmpResult.getData();
 		return  admVOs;
 	}
 
@@ -805,9 +818,6 @@ public class RelationReportService implements IRelationReportService {
 	 */
 	private List<JSONObject> getGraphRelationProjectTree(String groupCode, String projectId, String content) {
 		List<JSONObject> resultList = new ArrayList<>();
-
-		//获取交付范围
-		List<RelationDefineCollect> relationDefineCollects = doQueryRelationDefineCollect(AdmContextUtil.toDmpContext(), new QueryCriteria());
 		// 1.获取所有的一级,二级图类型定义
 		QueryCriteria parentCriteria = new QueryCriteria();
 		List<GraphDefine> graphDefines = DigitalGraphDefineFacade.query(groupCode, projectId,
@@ -867,6 +877,12 @@ public class RelationReportService implements IRelationReportService {
 		}
 
 		// 组装&排序
+		// 获取交付范围
+		QueryCriteria relationCollect = new QueryCriteria();
+		ObjectNode criteria = JsonNodeFactory.instance.objectNode();
+		criteria.put("projectId", projectId);
+		relationCollect.setCriteria(criteria);
+		List<RelationDefineCollect> relationDefineCollects = doQueryRelationDefineCollectList(AdmContextUtil.toDmpContext(), relationCollect);
 		resultList = CollUtil.sort(typeMap.values(), Comparator.comparing(b -> b.getIntValue("sort")));
 		for(JSONObject result:resultList) {
 			String typeId = result.getString("graphTypeId");
@@ -993,7 +1009,7 @@ public class RelationReportService implements IRelationReportService {
 								Map<String, AdmRelationTypeEnum> graphRelTypeMap,
 								Map<String, RelationDefine> relationDefineMap,Map<String, Integer> relCountMap) {
 		String key = graphicId + StrUtil.UNDERLINE + relCode;
-		AdmRelationTypeEnum typeEnum = MapUtil.get(graphRelTypeMap, key, AdmRelationTypeEnum.class);
+ 		AdmRelationTypeEnum typeEnum = MapUtil.get(graphRelTypeMap, key, AdmRelationTypeEnum.class);
 		RelationDefine relationDefine = relationDefineMap.getOrDefault(key,new RelationDefine());
 		JSONObject result = new JSONObject();
 		result.put("count", relCountMap.getOrDefault(key,0));
@@ -1035,6 +1051,8 @@ public class RelationReportService implements IRelationReportService {
 			String valKey = key+StrUtil.UNDERLINE+zoneType;
 			result.put("count",relCountMap.getOrDefault(valKey,0));
 		}
+		//关系采集范围 默认全部,不做限制 0 项目交付 1现场交付
+		result.put("deliveryType", -1);
 		return result;
 	}
 

+ 18 - 15
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/client/RwdClient.java

@@ -1,6 +1,9 @@
 package com.persagy.adm.server.custom.client;
 
 import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.persagy.adm.server.custom.dto.ObjectInfoCollectDTO;
+import com.persagy.adm.server.custom.dto.ObjectTypeCollectDTO;
+import com.persagy.adm.server.custom.dto.RelationDefineCollectDTO;
 import com.persagy.adm.server.custom.entity.InfoDef;
 import com.persagy.adm.server.custom.entity.TypeDef;
 import com.persagy.adm.server.custom.entity.db.ObjectInfoCollect;
@@ -26,31 +29,31 @@ public interface RwdClient {
 	 * 查询交付范围内类型定义
 	 */
 	@PostMapping("/rwd/def/class/collect/query")
-	CommonResult<List<ObjectTypeCollect>> queryDefineTypeCollect(@RequestParam("groupCode") String groupCode,
-												@RequestParam("projectId") String projectId,
-												@RequestParam("appId") String appId,
-												@RequestParam("userId") String userId,
-												@RequestBody QueryCriteria criteria);
+	CommonResult<List<ObjectTypeCollectDTO>> queryDefineTypeCollect(@RequestParam("groupCode") String groupCode,
+																	@RequestParam("projectId") String projectId,
+																	@RequestParam("appId") String appId,
+																	@RequestParam("userId") String userId,
+																	@RequestBody QueryCriteria criteria);
 
 	/**
 	 * 查询交付范围内关系定义
 	 */
 	@PostMapping("/rwd/def/rel/collect/query")
-	CommonResult<List<RelationDefineCollect>> queryDefineRelCollect(@RequestParam("groupCode") String groupCode,
-															 @RequestParam("projectId") String projectId,
-															 @RequestParam("appId") String appId,
-															 @RequestParam("userId") String userId,
-															 @RequestBody QueryCriteria criteria);
+	CommonResult<List<RelationDefineCollectDTO>> queryDefineRelCollect(@RequestParam("groupCode") String groupCode,
+																	   @RequestParam("projectId") String projectId,
+																	   @RequestParam("appId") String appId,
+																	   @RequestParam("userId") String userId,
+																	   @RequestBody QueryCriteria criteria);
 
 	/**
 	 * 查询交付范围内信息点定义
 	 */
 	@PostMapping("/rwd/def/funcid/collect/query")
-	CommonResult<List<ObjectInfoCollect>> queryDefineInfoCollect(@RequestParam("groupCode") String groupCode,
-												@RequestParam("projectId") String projectId,
-												@RequestParam("appId") String appId,
-												@RequestParam("userId") String userId,
-												@RequestBody QueryCriteria criteria);
+	CommonResult<List<ObjectInfoCollectDTO>> queryDefineInfoCollect(@RequestParam("groupCode") String groupCode,
+																	@RequestParam("projectId") String projectId,
+																	@RequestParam("appId") String appId,
+																	@RequestParam("userId") String userId,
+																	@RequestBody QueryCriteria criteria);
 
 	/**
 	 * 查询类型定义

+ 60 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/dto/ObjectInfoCollectDTO.java

@@ -0,0 +1,60 @@
+package com.persagy.adm.server.custom.dto;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.persagy.adm.server.custom.entity.db.ObjectInfoCollect;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 平台/项目级采集的信息点定义
+ * @author linhuili
+ * @date 2021-10-13
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ObjectInfoCollectDTO extends ObjectInfoCollect {
+    /** 别名称 */
+    private String name;
+    /** 别编码 */
+    private String aliasCode;
+    /** 别名名称 */
+    private String aliasName;
+    /** 类型编码 */
+    private String classCode;
+    private String category;
+    /** 一级标签 */
+    private String firstTag;
+    /** 二级标签 */
+    private String secondTag;
+    /** 优先级 */
+    private String priority;
+    /** 输入方式 */
+    private String inputMode;
+    /** 单位 */
+    private String unit;
+    /** 数据类型 */
+    private String dataType;
+    /** 复数标识 */
+    private Boolean isMultiple = false;
+    /** 区间标识 */
+    private Boolean isRegion = false;
+    /** 数据格式 */
+    private String formater;
+    /** 取值范围 */
+    @TableField(typeHandler = JacksonTypeHandler.class)
+    private ArrayNode dataSource;
+    /** 备注 */
+    private String remark;
+    /** 子分类标记 */
+    private Boolean subFlag;
+    /** 虚点 */
+    private Boolean weakPoint;
+    /** 显示顺序 */
+    private Long showOrder;
+    /** 版本 */
+    private String version;
+    /** 信息点来源  0-common */
+    private Integer sourceFrom;
+}

+ 38 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/dto/ObjectTypeCollectDTO.java

@@ -0,0 +1,38 @@
+package com.persagy.adm.server.custom.dto;
+
+import com.persagy.adm.server.custom.entity.db.ObjectTypeCollect;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 平台/项目级采集的信息点定义
+ * @author linhuili
+ * @date 2021-10-13
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ObjectTypeCollectDTO extends ObjectTypeCollect {
+    /** 类型名称 */
+    private String name;
+    private String aliasCode;
+    /** 别名名称 */
+    private String aliasName;
+    /** 对象类型 */
+    private String objType;
+    /** 项目ID */
+    private String projectId;
+    /** 集团编码 */
+    private String groupCode;
+    /** 专业编码:上级类型是系统/设备时该字段有值 */
+    private String majorCode;
+    /** 系统编码:上级类型是设备时该字段有值,值为系统类型的code */
+    private String systemCode;
+    /** 设备编码:上级类型是部件时该字段有值,值为设备类型的code */
+    private String equipmentCode;
+    /** 上级类型编码 */
+    private String parentCode;
+    /** 版本 */
+    private String version;
+    /** 类型来源  0-common */
+    private Integer sourceFrom;
+}

+ 65 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/dto/RelationDefineCollectDTO.java

@@ -0,0 +1,65 @@
+package com.persagy.adm.server.custom.dto;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.persagy.adm.server.custom.entity.db.RelationDefineCollect;
+import com.persagy.dmp.basic.dto.RelationCalDTO;
+import com.persagy.dmp.basic.dto.RelationCalRuleDTO;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.List;
+import java.util.Set;
+
+/**
+ * 平台/项目级采集的信息点定义
+ * @author linhuili
+ * @date 2021-10-13
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class RelationDefineCollectDTO extends RelationDefineCollect {
+
+    /** 图类型名称*/
+    private String graphName;
+    /** 边类型名称 */
+    private String relName;
+    /** 边方向性 */
+    private Integer directional;
+    /** 边属性 */
+    private String attribute;
+    /** 主要连接对象 */
+    private String targetObjs;
+    /** 关系处理模块提示信息,兼容数据中心而存在 */
+    private String prompting;
+    /** 备注 */
+    private String remark;
+    /** 计算关系之前需要计算的关系 */
+    private List<RelationCalDTO> beforeCalRels;
+    /** 计算器,就是计算规则 */
+    private RelationCalRuleDTO calRules;
+    /** 关系左侧的对象分类 */
+    private String fromObjType;
+    /** 关系右侧的对象分类 */
+    private String toObjType;
+    /** 自动计算类型,0-手动计算,1-自动计算,0-手动计算,1-自动计算 */
+    private Boolean automaticFlag;
+    /** 是否需要配置源末端 */
+    @TableField(value = "source_flag")
+    private Boolean sourceFlag;
+    /** 手动计算类型 1 禁用  2提示引导 3手动维护 */
+    @TableField(value = "manual")
+    private Integer manual;
+    /** 系统类型,风系统1,水系统0 */
+    @TableField(value = "system_type")
+    private Integer systemType;
+    /** 机电系统类型 */
+    private Set<String> mepSystemType;
+    /** 分区类型code集合 */
+    private Set<String> zoneTypes;
+    /** 是否参与计算 */
+    @TableField(value = "cal_flag")
+    private Boolean calFlag;
+
+
+
+}

+ 7 - 4
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/entity/Dict.java

@@ -1,5 +1,8 @@
 package com.persagy.adm.server.custom.entity;
 
+import com.persagy.adm.server.custom.dto.ObjectInfoCollectDTO;
+import com.persagy.adm.server.custom.dto.ObjectTypeCollectDTO;
+import com.persagy.adm.server.custom.dto.RelationDefineCollectDTO;
 import com.persagy.adm.server.custom.entity.db.ObjectInfoCollect;
 import com.persagy.adm.server.custom.entity.db.ObjectTypeCollect;
 import lombok.Data;
@@ -15,12 +18,12 @@ public class Dict {
 
 	private List<Map<String, Object>> major;
 
-	private List<ObjectTypeCollect> system;
+	private List<ObjectTypeCollectDTO> system;
 
-	private List<ObjectTypeCollect> equipment;
+	private List<ObjectTypeCollectDTO> equipment;
 
-	private List<? extends Object> relation;
+	private List<RelationDefineCollectDTO> relation;
 
-	private List<ObjectInfoCollect> infos;
+	private List<ObjectInfoCollectDTO> infos;
 
 }

+ 1 - 1
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/entity/db/ObjectInfoCollect.java

@@ -36,7 +36,7 @@ public class ObjectInfoCollect extends AuditableEntity {
     /** 交付实例范围 */
     private String instanceScope;
     /** 交付数据来源 */
-    private String dataSource;
+    private String dataFrom;
     /** 现场收集信息 */
     private String collectInfo;
     /** 备注 */

+ 1 - 1
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/entity/db/RelationDefineCollect.java

@@ -34,7 +34,7 @@ public class RelationDefineCollect extends AuditableEntity {
     /** 边类型编码  */
     private String relCode;
     /** 计算方式:0-手动计算 1-自动计算 */
-    private Integer automaticFlag;
+    private Boolean deliveryCalFlag;
     /** 管道用途 */
     private String pipeUse;
     /** 备注 */

+ 13 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/enums/DeliveryTypeEnum.java

@@ -0,0 +1,13 @@
+package com.persagy.adm.server.custom.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+@AllArgsConstructor
+@Getter
+public enum DeliveryTypeEnum{
+    PROJECT(0,"项目交付"),SCENE(1,"现场交付");
+    int code;
+    String message;
+
+}

+ 19 - 7
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/SyncAppImpl.java

@@ -17,8 +17,12 @@ import com.persagy.adm.server.custom.client.RwdClient;
 import com.persagy.adm.server.custom.common.AdmConst;
 import com.persagy.adm.server.custom.dao.*;
 import com.persagy.adm.server.custom.datatx.ObjectMapper4Tx;
+import com.persagy.adm.server.custom.dto.ObjectInfoCollectDTO;
+import com.persagy.adm.server.custom.dto.ObjectTypeCollectDTO;
+import com.persagy.adm.server.custom.dto.RelationDefineCollectDTO;
 import com.persagy.adm.server.custom.entity.*;
 import com.persagy.adm.server.custom.entity.db.*;
+import com.persagy.adm.server.custom.enums.DeliveryTypeEnum;
 import com.persagy.adm.server.custom.service.*;
 import com.persagy.adm.server.custom.util.DataExtrasUtil;
 import com.persagy.dmp.basic.model.QueryCriteria;
@@ -121,12 +125,14 @@ public class SyncAppImpl implements ISyncApp {
 
 		// 查询基于交付范围的系统和设备定义
 		QueryCriteria criteria = ServiceUtil.getQueryCriteria(objectMapper,AdmConst.OBJ_TYPE_SYSTEM, AdmConst.OBJ_TYPE_EQUIPMENT);
-		List<ObjectTypeCollect> typeList = ServiceUtil.queryAllPage(() -> rwdClient.queryDefineTypeCollect(groupCode, projectId, AdmConst.APP_ID, userId, criteria), criteria, new Pagination(500));
+		// 增加现场交付查询条件
+		criteria.getCriteria().put("deliveryType", DeliveryTypeEnum.SCENE.getCode());
+		List<ObjectTypeCollectDTO> typeList = ServiceUtil.queryAllPage(() -> rwdClient.queryDefineTypeCollect(groupCode, projectId, AdmConst.APP_ID, userId, criteria), criteria, new Pagination(500));
 
 
-		LinkedList<ObjectTypeCollect> sysList = new LinkedList<>();
-		LinkedList<ObjectTypeCollect> equipList = new LinkedList<>();
-		for(ObjectTypeCollect def : typeList){
+		LinkedList<ObjectTypeCollectDTO> sysList = new LinkedList<>();
+		LinkedList<ObjectTypeCollectDTO> equipList = new LinkedList<>();
+		for(ObjectTypeCollectDTO def : typeList){
 			if(def.getObjType().equals(AdmConst.OBJ_TYPE_SYSTEM))
 				sysList.add(def);
 			else if(def.getObjType().equals(AdmConst.OBJ_TYPE_EQUIPMENT))
@@ -140,15 +146,21 @@ public class SyncAppImpl implements ISyncApp {
 
 //		查询基于交付范围的关系定义
 		if(includeRel) {
-			List<RelationDefineCollect> relList = ServiceUtil.call(() -> rwdClient.queryDefineRelCollect(groupCode, projectId, AdmConst.APP_ID, userId, new QueryCriteria()));
+			QueryCriteria queryCriteria = new QueryCriteria();
+			ObjectNode objectNode = objectMapper.createObjectNode();
+			objectNode.put("deliveryType",DeliveryTypeEnum.SCENE.getCode());
+			queryCriteria.setCriteria(objectNode);
+			List<RelationDefineCollectDTO> relList = ServiceUtil.call(() -> rwdClient.queryDefineRelCollect(groupCode, projectId, AdmConst.APP_ID, userId, queryCriteria));
 			data.setRelation(relList);
 		}
 
 		//查询基于交付范围的信息点定义
 		if(includeInfos) {
 			QueryCriteria qc = new QueryCriteria();
-			qc.setCriteria(objectMapper.createObjectNode());
-			List<ObjectInfoCollect> funcList = ServiceUtil.call(() -> rwdClient.queryDefineInfoCollect(groupCode, projectId, AdmConst.APP_ID, userId, qc));
+			ObjectNode objectNode = objectMapper.createObjectNode();
+			objectNode.put("deliveryType",DeliveryTypeEnum.SCENE.getCode());
+			qc.setCriteria(objectNode);
+			List<ObjectInfoCollectDTO> funcList = ServiceUtil.call(() -> rwdClient.queryDefineInfoCollect(groupCode, projectId, AdmConst.APP_ID, userId, qc));
 			data.setInfos(funcList);
 		}
 

+ 72 - 26
adm-business/adm-server/src/main/resources/db/init/data.sql

@@ -1,5 +1,4 @@
 SHOW TABLES;
-
 truncate table `adm_define_problem_type`;
 #墙
 INSERT INTO `adm_define_problem_type`(`id`, `obj_type_code`, `obj_type_name`, `problem_type_code`, `problem_type_name`) VALUES (UUID(), 'CFCSWL', '墙', 'CFCSWL_LESS', '墙体缺少');
@@ -43,31 +42,43 @@ INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`,
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'wallHeight', '墙体高度', 'CFCSWL_LESS', 'mm', 'DOUBLE', 0, NULL);
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'materialType', '材质', 'CFCSWL_LESS', NULL, 'ENUM', 0, '[{"code": "1", "name": "钢筋混凝土结构"}, {"code": "2", "name": "砌体结构"}, {"code": "99", "name": "其他"}]');
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'wallThick', '墙厚', 'CFCSWL_LESS', 'mm', 'DOUBLE', 0, NULL);
-INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'senceImg', '拍摄照片', 'CFCSWL_LESS', NULL, 'STRING', 0, NULL);
+INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'senceImg', '拍摄照片', 'CFCSWL_LESS', NULL, 'PHOTO', 0, NULL);
+INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'remark', '备注', 'CFCSWL_LESS', NULL, 'STRING', 0, NULL);
+
 
 #墙体多余
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'coordinate', '墙体路由', 'CFCSWL_MORE', NULL, 'STRING', 0, NULL);
-INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'senceImg', '拍摄照片', 'CFCSWL_MORE', NULL, 'STRING', 0, NULL);
+INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'senceImg', '拍摄照片', 'CFCSWL_MORE', NULL, 'PHOTO', 0, NULL);
+INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'remark', '备注', 'CFCSWL_MORE', NULL, 'STRING', 0, NULL);
+
 
 #墙体材质错误
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'coordinate', '墙体路由', 'CFCSWL_MATERIAL_ERROR', NULL, 'STRING', 0, NULL);
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'materialType', '材质', 'CFCSWL_MATERIAL_ERROR', NULL, 'ENUM', 0, '[{"code": "1", "name": "钢筋混凝土结构"}, {"code": "2", "name": "砌体结构"}, {"code": "99", "name": "其他"}]');
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'wallThick', '墙厚', 'CFCSWL_MATERIAL_ERROR', 'mm', 'DOUBLE', 0, NULL);
-INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'senceImg', '拍摄照片', 'CFCSWL_MATERIAL_ERROR', NULL, 'STRING', 0, NULL);
+INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'senceImg', '拍摄照片', 'CFCSWL_MATERIAL_ERROR', NULL, 'PHOTO', 0, NULL);
+INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'remark', '备注', 'CFCSWL_MATERIAL_ERROR', NULL, 'STRING', 0, NULL);
+
 
 #楼板缺少
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'coordinate', '板轮廓', 'CFCSFL_LESS', NULL, 'STRING', 0, NULL);
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'height', '板高度(距本层标高的相对高度)', 'CFCSFL_LESS', 'mm', 'DOUBLE', 0, NULL);
-INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'senceImg', '拍摄照片', 'CFCSFL_LESS', NULL, 'STRING', 0, NULL);
+INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'senceImg', '拍摄照片', 'CFCSFL_LESS', NULL, 'PHOTO', 0, NULL);
+INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'remark', '备注', 'CFCSFL_LESS', NULL, 'STRING', 0, NULL);
+
 
 #板洞缺少
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'coordinate', '洞口轮廓', 'CFCSFL_HOLE_LESS', NULL, 'STRING', 0, NULL);
-INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'senceImg', '拍摄照片', 'CFCSFL_HOLE_LESS', NULL, 'STRING', 0, NULL);
+INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'senceImg', '拍摄照片', 'CFCSFL_HOLE_LESS', NULL, 'PHOTO', 0, NULL);
+INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'remark', '备注', 'CFCSFL_HOLE_LESS', NULL, 'STRING', 0, NULL);
+
 
 #楼板标高错误
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'coordinate', '板轮廓', 'CFCSFL_ELEVATION_ERROR', NULL, 'STRING', 0, NULL);
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'height', '正确的板标高(距本层标高的相对高度)', 'CFCSFL_ELEVATION_ERROR', 'mm', 'DOUBLE', 0, NULL);
-INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'senceImg', '拍摄照片', 'CFCSFL_ELEVATION_ERROR', NULL, 'STRING', 0, NULL);
+INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'senceImg', '拍摄照片', 'CFCSFL_ELEVATION_ERROR', NULL, 'PHOTO', 0, NULL);
+INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'remark', '备注', 'CFCSFL_ELEVATION_ERROR', NULL, 'STRING', 0, NULL);
+
 
 #柱缺少
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'coordinate', '标记缺少柱点', 'CFCSCL_LESS', NULL, 'STRING', 0, NULL);
@@ -76,11 +87,15 @@ INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`,
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'rectangleCrossWidth', '宽', 'CFCSCL_LESS', 'mm', 'DOUBLE', 0, NULL);
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'circularCrossDiameter', '直径', 'CFCSCL_LESS', 'mm', 'DOUBLE', 0, NULL);
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'columnLength', '柱高度', 'CFCSCL_LESS', 'mm', 'DOUBLE', 0, NULL);
-INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'senceImg', '拍摄照片', 'CFCSCL_LESS', NULL, 'STRING', 0, NULL);
+INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'senceImg', '拍摄照片', 'CFCSCL_LESS', NULL, 'PHOTO', 0, NULL);
+INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'remark', '备注', 'CFCSCL_LESS', NULL, 'STRING', 0, NULL);
+
 
 #柱多余
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'objectId', '标记多余柱点', 'CFCSCL_MORE', NULL, 'STRING', 0, NULL);
-INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'senceImg', '拍摄照片', 'CFCSCL_MORE', NULL, 'STRING', 0, NULL);
+INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'senceImg', '拍摄照片', 'CFCSCL_MORE', NULL, 'PHOTO', 0, NULL);
+INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'remark', '备注', 'CFCSCL_MORE', NULL, 'STRING', 0, NULL);
+
 
 #柱截面形状错误
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'objectId', '标记错误柱子', 'CFCSCL_SECTION_SHAPE_ERROR', NULL, 'STRING', 0, NULL);
@@ -88,19 +103,25 @@ INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`,
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'rectangleCrossLength', '长', 'CFCSCL_SECTION_SHAPE_ERROR', 'mm', 'DOUBLE', 0, NULL);
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'rectangleCrossWidth', '宽', 'CFCSCL_SECTION_SHAPE_ERROR', 'mm', 'DOUBLE', 0, NULL);
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'circularCrossDiameter', '直径', 'CFCSCL_SECTION_SHAPE_ERROR', 'mm', 'DOUBLE', 0, NULL);
-INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'senceImg', '拍摄照片', 'CFCSCL_SECTION_SHAPE_ERROR', NULL, 'STRING', 0, NULL);
+INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'senceImg', '拍摄照片', 'CFCSCL_SECTION_SHAPE_ERROR', NULL, 'PHOTO', 0, NULL);
+INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'remark', '备注', 'CFCSCL_SECTION_SHAPE_ERROR', NULL, 'STRING', 0, NULL);
+
 
 #柱尺寸错误
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'objectId', '标记错误柱子', 'CFCSCL_SIZE_ERROR', NULL, 'STRING', 0, NULL);
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'rectangleCrossLength', '长', 'CFCSCL_SIZE_ERROR', 'mm', 'DOUBLE', 0, NULL);
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'rectangleCrossWidth', '宽', 'CFCSCL_SIZE_ERROR', 'mm', 'DOUBLE', 0, NULL);
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'circularCrossDiameter', '直径', 'CFCSCL_SIZE_ERROR', 'mm', 'DOUBLE', 0, NULL);
-INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'senceImg', '拍摄照片', 'CFCSCL_SIZE_ERROR', NULL, 'STRING', 0, NULL);
+INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'senceImg', '拍摄照片', 'CFCSCL_SIZE_ERROR', NULL, 'PHOTO', 0, NULL);
+INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'remark', '备注', 'CFCSCL_SIZE_ERROR', NULL, 'STRING', 0, NULL);
+
 
 #重新绘制物业空间
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'coordinate', '标记物业空间', 'GeneralZone_OUTLINE_ERROR', NULL, 'STRING', 0, NULL);
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'RoomLocalName', '正确的空间名称', 'GeneralZone_OUTLINE_ERROR', NULL, 'STRING', 0, NULL);
-INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'senceImg', '拍摄照片', 'GeneralZone_OUTLINE_ERROR', NULL, 'STRING', 0, NULL);
+INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'senceImg', '拍摄照片', 'GeneralZone_OUTLINE_ERROR', NULL, 'PHOTO', 0, NULL);
+INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'remark', '备注', 'GeneralZone_OUTLINE_ERROR', NULL, 'STRING', 0, NULL);
+
 
 #门缺少
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'coordinate', '标记缺少门位置', 'CFBEDR_LESS', NULL, 'STRING', 0, NULL);
@@ -110,11 +131,15 @@ INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`,
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'doorLeafType', '门扇类型', 'CFBEDR_LESS', NULL, 'ENUM', 0, '[{"code": "1", "name": "单开"},{"code": "2", "name": "双开"},{"code": "99", "name": "其他"}]');
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'doorWidth ', '宽', 'CFBEDR_LESS', 'mm', 'STRING', 0, NULL);
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'doorHeight ', '高', 'CFBEDR_LESS', 'mm', 'STRING', 0, NULL);
-INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'senceImg', '拍摄照片', 'CFBEDR_LESS', NULL, 'STRING', 0, NULL);
+INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'senceImg', '拍摄照片', 'CFBEDR_LESS', NULL, 'PHOTO', 0, NULL);
+INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'remark', '备注', 'CFBEDR_LESS', NULL, 'STRING', 0, NULL);
+
 
 #门多余
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'objectId', '标记多余门位置', 'CFBEDR_MORE', NULL, 'STRING', 0, NULL);
-INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'senceImg', '拍摄照片', 'CFBEDR_MORE', NULL, 'STRING', 0, NULL);
+INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'senceImg', '拍摄照片', 'CFBEDR_MORE', NULL, 'PHOTO', 0, NULL);
+INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'remark', '备注', 'CFBEDR_MORE', NULL, 'STRING', 0, NULL);
+
 
 #门属性错误
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'objectId', '标记错误门', 'CFBEDR_PROPERTY_ERROR', NULL, 'STRING', 0, NULL);
@@ -123,23 +148,31 @@ INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`,
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'openType', '开启方式', 'CFBEDR_PROPERTY_ERROR', NULL, 'ENUM', 0, '[{"code": "1", "name": "卷帘门"},{"code": "2", "name": "平开门"}, {"code": "3", "name": "弹簧门"},{"code": "4", "name": "折叠门"},{"code": "5", "name": "推拉门"},{"code": "6", "name": "旋转门"},{"code": "99", "name": "其他"}]');
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'doorWidth ', '宽', 'CFBEDR_PROPERTY_ERROR', 'mm', 'STRING', 0, NULL);
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'doorHeight ', '高', 'CFBEDR_PROPERTY_ERROR', 'mm', 'STRING', 0, NULL);
-INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'senceImg', '拍摄照片', 'CFBEDR_PROPERTY_ERROR', NULL, 'STRING', 0, NULL);
+INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'senceImg', '拍摄照片', 'CFBEDR_PROPERTY_ERROR', NULL, 'PHOTO', 0, NULL);
+INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'remark', '备注', 'CFBEDR_PROPERTY_ERROR', NULL, 'STRING', 0, NULL);
+
 
 # 门位置错误
-INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'moveDirection', '移动方向', 'CFBEDR_POSITION_ERROR', NULL, 'ENUM', 0, '[{"code": "1", "name": "左"},{"code": "2", "name": "右"}, {"code": "3", "name": "上"},{"code": "4", "name": "下"}]');
-INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'moveDistance ', '移动距离', 'CFBEDR_POSITION_ERROR', 'mm', 'STRING', 0, NULL);
-INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'senceImg', '拍摄照片', 'CFBEDR_POSITION_ERROR', NULL, 'STRING', 0, NULL);
+INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'moveDirection', '移动方向', 'CFBEDR_POSITION_ERROR', NULL, 'POSITION', 0, '[{"code": "1", "name": "左"},{"code": "2", "name": "右"}, {"code": "3", "name": "上"},{"code": "4", "name": "下"}]');
+-- INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'moveDistance ', '移动距离', 'CFBEDR_POSITION_ERROR', 'mm', 'STRING', 0, NULL);
+INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'senceImg', '拍摄照片', 'CFBEDR_POSITION_ERROR', NULL, 'PHOTO', 0, NULL);
+INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'remark', '备注', 'CFBEDR_POSITION_ERROR', NULL, 'STRING', 0, NULL);
+
 
 #窗缺少
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'coordinate', '标记缺少窗位置', 'CFBEWN_LESS', NULL, 'STRING', 0, NULL);
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'equipmentType', '正确的设备类', 'CFBEWN_LESS', NULL, 'ENUM', 0, '[{"code": "1", "name": "窗"},{"code": "2", "name": "防火窗"}]');
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'windowWidth', '宽', 'CFBEWN_LESS', 'mm', 'STRING', 0, NULL);
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'windowHeight ', '高', 'CFBEWN_LESS', 'mm', 'STRING', 0, NULL);
-INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'senceImg', '拍摄照片', 'CFBEWN_LESS', NULL, 'STRING', 0, NULL);
+INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'senceImg', '拍摄照片', 'CFBEWN_LESS', NULL, 'PHOTO', 0, NULL);
+INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'remark', '备注', 'CFBEWN_LESS', NULL, 'STRING', 0, NULL);
+
 
 #窗多余
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'objectId', '标记多余窗位置', 'CFBEWN_MORE', NULL, 'STRING', 0, NULL);
-INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'senceImg', '拍摄照片', 'CFBEWN_MORE', NULL, 'STRING', 0, NULL);
+INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'senceImg', '拍摄照片', 'CFBEWN_MORE', NULL, 'PHOTO', 0, NULL);
+INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'remark', '备注', 'CFBEWN_MORE', NULL, 'STRING', 0, NULL);
+
 
 #窗属性错误
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'objectId', '标记错误窗', 'CFBEWN_PROPERTY_ERROR', NULL, 'STRING', 0, NULL);
@@ -147,17 +180,30 @@ INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`,
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'windowType', '正确的窗样式', 'CFBEWN_PROPERTY_ERROR', NULL, 'ENUM', 0, '[{"code": "0", "name": "保持"},{"code": "1", "name": "平开(推拉)窗"},{"code": "2", "name": "飘窗"},{"code": "3", "name": "百叶窗"}]');
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'windowWidth', '宽', 'CFBEWN_PROPERTY_ERROR', 'mm', 'STRING', 0, NULL);
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'windowHeight ', '高', 'CFBEWN_PROPERTY_ERROR', 'mm', 'STRING', 0, NULL);
-INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'senceImg', '拍摄照片', 'CFBEWN_PROPERTY_ERROR', NULL, 'STRING', 0, NULL);
+INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'senceImg', '拍摄照片', 'CFBEWN_PROPERTY_ERROR', NULL, 'PHOTO', 0, NULL);
+INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'remark', '备注', 'CFBEWN_PROPERTY_ERROR', NULL, 'STRING', 0, NULL);
+
 
 #窗位置错误
-INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'moveDirection', '移动方向', 'CFBEWN_POSITION_ERROR', NULL, 'ENUM', 0, '[{"code": "1", "name": "左"},{"code": "2", "name": "右"}, {"code": "3", "name": "上"},{"code": "4", "name": "下"}]');
-INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'moveDistance ', '移动距离', 'CFBEWN_POSITION_ERROR', 'mm', 'STRING', 0, NULL);
-INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'senceImg', '拍摄照片', 'CFBEWN_POSITION_ERROR', NULL, 'STRING', 0, NULL);
+INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'moveDirection', '移动方向', 'CFBEWN_POSITION_ERROR', NULL, 'POSITION', 0, '[{"code": "1", "name": "左"},{"code": "2", "name": "右"}, {"code": "3", "name": "上"},{"code": "4", "name": "下"}]');
+-- INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'moveDistance ', '移动距离', 'CFBEWN_POSITION_ERROR', 'mm', 'STRING', 0, NULL);
+INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'senceImg', '拍摄照片', 'CFBEWN_POSITION_ERROR', NULL, 'PHOTO', 0, NULL);
+INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'remark', '备注', 'CFBEWN_POSITION_ERROR', NULL, 'STRING', 0, NULL);
+
 
 #停车位缺少
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'coordinate', '标记车位位置', 'CFPKPS_LESS', NULL, 'STRING', 0, NULL);
-INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'senceImg', '拍摄照片', 'CFPKPS_LESS', NULL, 'STRING', 0, NULL);
+INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'senceImg', '拍摄照片', 'CFPKPS_LESS', NULL, 'PHOTO', 0, NULL);
+INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'remark', '备注', 'CFPKPS_LESS', NULL, 'STRING', 0, NULL);
+
 
 #停车位多余
 INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'objectId', '标记车位', 'CFPKPS_MORE', NULL, 'STRING', 0, NULL);
-INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'senceImg', '拍摄照片', 'CFPKPS_MORE', NULL, 'STRING', 0, NULL);
+INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'senceImg', '拍摄照片', 'CFPKPS_MORE', NULL, 'PHOTO', 0, NULL);
+INSERT INTO `adm_define_problem_info`(`id`, `code`, `name`, `problem_type_code`, `unit`, `data_type`, `is_multiple`, `data_source`) VALUES (UUID(), 'remark', '备注', 'CFPKPS_MORE', NULL, 'STRING', 0, NULL);
+
+
+
+
+
+