Forráskód Böngészése

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

# Conflicts:
#	adm-business/adm-server/src/main/java/com/persagy/adm/server/algorithm/domain/DeliverPlanVo.java
linhuili 2 éve
szülő
commit
503215a325
70 módosított fájl, 1473 hozzáadás és 469 törlés
  1. 58 1
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/controller/DiagramController.java
  2. 10 0
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/controller/TemplateController.java
  3. 9 0
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/DataStrategy.java
  4. 21 2
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/DiagramBuilder.java
  5. 1 1
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/DiagramDataLoader.java
  6. 29 1
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/impl/DataStrategyImpl.java
  7. 26 0
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/Diagram.java
  8. 9 8
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/EquipmentNode.java
  9. 24 0
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/base/Container.java
  10. 15 1
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/logic/DynGroup.java
  11. 40 0
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/template/DiagramTemplate.java
  12. 16 0
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/template/MainPipe.java
  13. 56 0
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/template/TemplateChecker.java
  14. 7 0
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/dao/IconMapper.java
  15. 5 0
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/demo/DemoDataStrategy.java
  16. 2 0
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/frame/EditRequest.java
  17. 0 2
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/manage/DemoDiagramManager.java
  18. 11 7
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/manage/DiagramManager.java
  19. 74 1
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/manage/TemplateManager.java
  20. 9 0
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/service/IconService.java
  21. 20 0
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/service/impl/IconServiceImpl.java
  22. 3 33
      adm-business/adm-diagram/src/main/resources/bootstrap.yml
  23. 11 0
      adm-business/adm-diagram/src/main/resources/mapper/DiagramIcon.xml
  24. 2 2
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/calculation/model/AdmRelationAddRequest.java
  25. 10 7
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/calculation/service/impl/AdmManualRelCalServiceImpl.java
  26. 1 2
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/dictionary/service/impl/AbstractAdmDictBaseServiceImpl.java
  27. 24 0
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/dictionary/service/impl/AdmDictServiceImpl.java
  28. 2 1
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/migration/constant/MiGrationRelCode.java
  29. 1 1
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/migration/constant/MigrationConstant.java
  30. 0 29
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/migration/constant/MigrationObjType.java
  31. 2 3
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/migration/controller/DataMigrationController.java
  32. 17 0
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/migration/service/Impl/MigrationAbstractServiceImpl.java
  33. 58 30
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/migration/service/Impl/ObjectDigitalMigration.java
  34. 2 2
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/object/controller/AdmProjectController.java
  35. 2 0
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/object/model/AdmObjectInfo.java
  36. 22 1
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/object/service/IAdmProjectService.java
  37. 61 0
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/object/service/impl/AdmProjectServiceImpl.java
  38. 6 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/algorithm/constant/AdmServerConstant.java
  39. 35 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/algorithm/constant/DeliveryWayEnum.java
  40. 26 6
      adm-business/adm-server/src/main/java/com/persagy/adm/server/algorithm/controller/AdmModelController.java
  41. 25 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/algorithm/domain/QueryScopeOfDeliverVo.java
  42. 21 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/algorithm/domain/ScopeOfDeliverVo.java
  43. 10 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/algorithm/service/AdmModelService.java
  44. 41 14
      adm-business/adm-server/src/main/java/com/persagy/adm/server/algorithm/service/impl/AdmModelServiceImpl.java
  45. 4 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/auth/domain/LoginVo.java
  46. 5 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/common/AdmRequest.java
  47. 24 2
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/controller/AdmFileController.java
  48. 19 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/controller/AppController.java
  49. 26 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/dto/CadFiles.java
  50. 6 9
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/entity/CadFileInfo.java
  51. 0 4
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/entity/CadFileQueryParam.java
  52. 6 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/entity/db/AdmCad.java
  53. 16 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/interceptor/AppContextConfig.java
  54. 24 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/interceptor/AppContextInterceptor.java
  55. 14 92
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/SyncAppImpl.java
  56. 23 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/AdmCadCheckUpdate.java
  57. 23 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/AdmFileCheckUpdate.java
  58. 24 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/AdmJobSpaceCheckUpdate.java
  59. 25 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/AdmPipeCheckUpdate.java
  60. 30 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/AdmProblemCheckUpdate.java
  61. 23 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/AdmQrCodeCheckUpdate.java
  62. 23 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/AdmServerAreaCheckUpdate.java
  63. 45 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/BdtpObjRelCreateByAppCheckUpdate.java
  64. 43 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/BdtpObjectCheckUpdate.java
  65. 5 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/CheckUpdate.java
  66. 68 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/CheckUpdateChain.java
  67. 9 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/CheckUpdateContext.java
  68. 39 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/MetaSpaceObjRelCheckUpdate.java
  69. 124 207
      adm-business/adm-server/src/main/resources/db/init/data.sql
  70. 1 0
      adm-business/adm-server/src/main/resources/db/init/schema.sql

+ 58 - 1
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/controller/DiagramController.java

@@ -1,5 +1,6 @@
 package com.persagy.adm.diagram.controller;
 
+import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.util.StrUtil;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.persagy.adm.diagram.core.ContentParser;
@@ -8,6 +9,7 @@ import com.persagy.adm.diagram.core.model.Diagram;
 import com.persagy.adm.diagram.core.model.template.DiagramTemplate;
 import com.persagy.adm.diagram.frame.BdtpRequest;
 import com.persagy.adm.diagram.manage.DiagramManager;
+import com.persagy.adm.diagram.service.IconService;
 import com.persagy.dmp.common.constant.ResponseCode;
 import com.persagy.dmp.common.exception.BusinessException;
 import com.persagy.dmp.common.model.response.CommonResult;
@@ -22,6 +24,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
 
@@ -42,6 +45,8 @@ public class DiagramController {
     private DiagramManager diagramManager;
     @Autowired
     private ContentParser parser;
+    @Autowired
+    private IconService iconService;
 
     /**
      * 系统图列表接口
@@ -77,10 +82,19 @@ public class DiagramController {
 
         List<Diagram> diagramList = dataStrategy.getDiagrams(null, projectId,
                 (String) diagram.get("systemId"), groupCode, null, false);
-        if (diagramList != null) { //TODO 批量处理会导致接口响应慢,优化为列表和内容拆分的方式
+        //TODO 批量处理会导致接口响应慢,优化为列表和内容拆分的方式
+        if (diagramList != null) {
             diagramList.forEach(d -> {
                 diagramManager.buildDiagram(d);
                 d.toAbsoluteLocation();
+
+                //TODO 批量处理会导致接口响应慢,优化为列表和内容拆分的方式
+                //没有nodes的话就不去查询了
+                if (CollectionUtil.isNotEmpty(d.getNodes())) {
+                    String[] legendIds = d.getLegendIds();
+                    Map<String, String> map = iconService.getIconsByLegendIds(Arrays.asList(legendIds));
+                    d.setExtraProp("legendIcons", map);
+                }
             });
         }
 
@@ -101,6 +115,12 @@ public class DiagramController {
                                             @RequestParam String projectId,
                                             @RequestParam String groupCode) {
         Diagram diagram = diagramManager.fromMapData(params);
+
+        if (diagram.getName() == null || diagram.getName().length() < 3
+                || diagram.getName().length() > 15) {
+            throw new BusinessException(ResponseCode.A0400.getCode(), "名称长度不能小于3,不能超过15");
+        }
+
         diagram.setGroupCode(groupCode);
         diagram.setProjectId(projectId);
 
@@ -226,6 +246,25 @@ public class DiagramController {
     }
 
     /**
+     * 重置模板、图数据
+     *
+     * @return 重置后的系统图数据
+     */
+    @ApiOperation("重置模板、图数据")
+    @PostMapping("/reset")
+    public CommonResult<Diagram> reset(@RequestBody Diagram diagram) {
+        if (diagram == null || StrUtil.isBlank(diagram.getId())) {
+            throw new BusinessException(ResponseCode.A0400.getCode(), "系统图id不存在");
+        }
+        diagram = dataStrategy.getDiagram(diagram.getId());
+        if (diagram == null) {
+            throw new BusinessException(ResponseCode.A0400.getCode(), "数据不存在");
+        }
+        diagramManager.resetDiagram(diagram);
+        return ResultHelper.single(diagramManager.loadData(diagram));
+    }
+
+    /**
      * 系统图状态变更
      *
      * @return 是否成功
@@ -237,6 +276,24 @@ public class DiagramController {
     }
 
     /**
+     * 系统图名称变更
+     *
+     * @return 是否成功
+     */
+    @ApiOperation("系统图状态变更")
+    @PostMapping("/update/name")
+    public CommonResult<Boolean> updateName(@RequestBody Map<String, String> params) {
+        if (params == null) {
+            throw new BusinessException(ResponseCode.A0400.getCode(), "请求参数为空");
+        }
+        String name = params.get("name");
+        if (StrUtil.isBlank(name) || name.length() < 3 || name.length() > 15) {
+            throw new BusinessException(ResponseCode.A0400.getCode(), "名称长度不能小于3,不能超过15");
+        }
+        return ResultHelper.single(dataStrategy.updateName(params.get("name"), params.get("id")));
+    }
+
+    /**
      * 查看系统实例是否有发布状态的系统图
      *
      * @return 是否成功

+ 10 - 0
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/controller/TemplateController.java

@@ -106,4 +106,14 @@ public class TemplateController {
         return ResultHelper.single(templateManager.modifyDynGroup(params.getDynGroup(), params.getCurrentCompId(), params.getTemplateId()));
     }
 
+    @PostMapping("copyContent")
+    public CommonResult<String> copyContent(@RequestBody EditRequest params){
+        return ResultHelper.single(templateManager.getCopyContent(params.getCurrentCompId(), params.getTemplateId()));
+    }
+
+    @PostMapping("pasteContent")
+    public CommonResult<DiagramTemplate> pasteContent(@RequestBody EditRequest params){
+        return ResultHelper.single(templateManager.setPasteContent(params.getContent(), params.getCurrentCompId(), params.getTemplateId()));
+    }
+
 }

+ 9 - 0
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/DataStrategy.java

@@ -239,4 +239,13 @@ public interface DataStrategy {
      * @return 例如: {"系统图实例id1":true,"系统图实例id2":false}
      */
     Map<String, Boolean> querySystemInstanceDiagramList();
+
+    /**
+     * 修改系统图名称
+     *
+     * @param name 名称
+     * @param id   系统图id
+     * @return 是否成功
+     */
+    boolean updateName(String name, String id);
 }

+ 21 - 2
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/DiagramBuilder.java

@@ -53,6 +53,15 @@ public class DiagramBuilder {
 		this.context.setDataStrategy(dataStrategy);
 	}
 
+	private boolean hasDynGroup(List<Container> containers) {
+		for(Container con : containers) {
+			if(con.getDynGroup() != null){
+				return true;
+			}
+		}
+		return false;
+	}
+
 	//加载设备数据,并进行计算处理
 	public void buildEquipNodeAndContainer(List<Container> containers, List<ObjectNode> optionalObjs){
 		//去掉已经使用的数据项
@@ -62,6 +71,10 @@ public class DiagramBuilder {
 			optionalObjs = new ArrayList<>(optionalObjs);
 		}
 
+		if(hasDynGroup(containers)) {
+			//TODO 动态组计算
+		}
+
 		if(template.getMainPipes() != null) {
 			for(MainPipe mainPipe : template.getMainPipes()) {
 				if (mainPipe.isBindEquipment() && mainPipe.getDataObject() == null){
@@ -104,13 +117,17 @@ public class DiagramBuilder {
 		handleContainers(containers);
 	}
 
+	private void buildMainPipe(){
+
+	}
+
 	private void addEquipNode(Container con, ObjectNode obj){
 		if(con.getChildren().size() > equipLimit) {
 			return;
 		}
 
 		EquipmentNode node = new EquipmentNode();
-		node.setId(IdUtil.simpleUUID());
+		node.setId(IdUtil.fastSimpleUUID());
 		node.setDataObjectId(obj.get("id").asText());
 		node.setObjClassCode(DiagramBuilder.getClassCode(obj));
 		node.setDataObject(obj);
@@ -128,6 +145,7 @@ public class DiagramBuilder {
 		node.setLayoutIndex(con.getChildren().size() - 1);
 
 		Label label = new Label();
+		label.setId(IdUtil.fastSimpleUUID());
 		label.setContent(name);
 		node.setLabel(label);
 
@@ -180,7 +198,7 @@ public class DiagramBuilder {
 
 	private PackNode newPackNode(String objClsCode, Container con, String packName){
 		PackNode pn = new PackNode();
-		pn.setId(IdUtil.simpleUUID());
+		pn.setId(IdUtil.fastSimpleUUID());
 		pn.setObjClassCode(objClsCode);
 
 		initNode(pn, packName, con);
@@ -392,6 +410,7 @@ public class DiagramBuilder {
 	}
 
 	private void addLine(Line line) {
+		line.setId(IdUtil.fastSimpleUUID());
 		markAnchorLine(line.getFrom(), line);
 		markAnchorLine(line.getTo(), line);
 		diagram.getLines().add(line);

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

@@ -70,7 +70,7 @@ public class DiagramDataLoader {
 				}
 
 				//设置anchorLocations
-				en.getAnchorLocations();
+				en.setAnchorLocations();
 			}
 
 			if(obj != null) {

+ 29 - 1
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/impl/DataStrategyImpl.java

@@ -283,7 +283,7 @@ public class DataStrategyImpl implements DataStrategy {
      */
     @Override
     public List<Diagram> getDiagrams(String diagramType, String projectId,
-                                     String systemId, String groupCode, String name,Boolean flag) {
+                                     String systemId, String groupCode, String name, Boolean flag) {
 
         Set<DiagramEntity> result = new HashSet<>();
         //所有系统实例
@@ -656,6 +656,14 @@ public class DataStrategyImpl implements DataStrategy {
         return objectNodes;
     }
 
+    /**
+     * 修改状态
+     * TODO 后期可以和修改名称方法合并  甚至修改其他信息合并
+     *
+     * @param state 状态
+     * @param id
+     * @return
+     */
     @Override
     public boolean updateState(String state, String id) {
         if (StrUtil.isBlank(state) || StrUtil.isBlank(id)) {
@@ -687,4 +695,24 @@ public class DataStrategyImpl implements DataStrategy {
         }
         return result;
     }
+
+    /**
+     * 系统图名称变更
+     * TODO 后期可以和修改状态方法合并  甚至修改其他信息合并
+     *
+     * @param name 名称
+     * @param id   系统图id
+     * @return 是否成功
+     */
+    @Override
+    public boolean updateName(String name, String id) {
+        if (StrUtil.isBlank(name) || StrUtil.isBlank(id)) {
+            throw new BusinessException(ResponseCode.A0400.getCode(), "主键id或名称参数为空");
+        }
+        DiagramEntity entity = new DiagramEntity();
+        entity.setId(id);
+        entity.setName(name);
+        diagramMapper.updateById(entity);
+        return true;
+    }
 }

+ 26 - 0
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/Diagram.java

@@ -129,12 +129,25 @@ public class Diagram {
 			size = template.getFrame().getSize();
 		}
 
+		layoutLines(context);
+	}
+
+	public void layoutLines(CalcContext context) {
 		LineLayoutManager lineLayoutManager = new LineLayoutManager(context);
 		for(Line line : lines) {
 			line.layout(lineLayoutManager);
 		}
 	}
 
+	public void layoutLine(String lineId, CalcContext context){
+		for(Line line : lines) {
+			if(lineId.equals(line.getId())) {
+				line.layout(new LineLayoutManager(context));
+				break;
+			}
+		}
+	}
+
 	public void clearLayout(){
 		if(template != null) {
 			template.clearLayout();
@@ -306,4 +319,17 @@ public class Diagram {
 		this.template = template;
 	}
 
+	public String[] getLegendIds() {
+		HashSet<String> ids = new HashSet<>();
+		nodes.forEach(node -> {
+			if(node instanceof EquipmentNode) {
+				String legendId = ((EquipmentNode) node).getLegendId();
+				if(StrUtil.isNotBlank(legendId)){
+					ids.add(legendId);
+				}
+			}
+		});
+		return ids.toArray(new String[ids.size()]);
+	}
+
 }

+ 9 - 8
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/model/EquipmentNode.java

@@ -56,7 +56,7 @@ public class EquipmentNode extends DiagramNode implements IDataBind {
 			label.setLocation(new XY(10, 10)); //TODO
 		}
 
-		//TODO anchors
+		setAnchorLocations();
 	}
 
 	@Override
@@ -115,15 +115,16 @@ public class EquipmentNode extends DiagramNode implements IDataBind {
 		return legend;
 	}
 
-	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));
-				}
+	public void setAnchorLocations() {
+		if (legend.getAnchors() != null) {
+			anchorLocations = new HashMap<>();
+			for (Anchor anchor : legend.getAnchors()) {
+				anchorLocations.put(anchor.getCode(), anchor.calcLocation(size));
 			}
 		}
+	}
+
+	public Map<String, XY> getAnchorLocations() {
 		return anchorLocations;
 	}
 

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

@@ -62,6 +62,11 @@ public class Container extends AbstractComponent implements IContainer, IEquipHo
 	private Label groupLabel;
 
 	/**
+	 * 该容器为动态源时,驱动的目标组件id
+	 */
+	private String dynTarget;
+
+	/**
 	 * 直接包含的干管
 	 */
 	@JsonIgnore
@@ -279,6 +284,25 @@ public class Container extends AbstractComponent implements IContainer, IEquipHo
 		return null;
 	}
 
+	public boolean isParentOf(IComponent comp){
+		IContainer p = comp.getParent();
+		while (p != null) {
+			if(p == this){
+				return true;
+			}
+			p = p.getParent();
+		}
+		return false;
+	}
+
+	public String getDynTarget() {
+		return dynTarget;
+	}
+
+	public void setDynTarget(String dynTarget) {
+		this.dynTarget = dynTarget;
+	}
+
 	public void addChildMainPipe(MainPipe mainPipe) {
 		if(childMainPipes == null) {
 			childMainPipes = new ArrayList<>();

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

@@ -9,12 +9,18 @@ import com.google.gson.annotations.Expose;
 public class DynGroup {
 
 	/**
-	 * 动态源,可选值:floor | building | mainPipe:id | containerElement:id
+	 * 动态源(floor | building | mainPipe.id | container.id)
 	 */
 	@Expose
 	private String dynSource;
 
 	/**
+	 * 动态源类型,可选值: data | group | mainPipe | container
+	 */
+	@Expose
+	private String dynSourceType;
+
+	/**
 	 * 分组标签的位置, top | bottom | left | right
 	 */
 	@Expose
@@ -28,6 +34,14 @@ public class DynGroup {
 		this.dynSource = dynSource;
 	}
 
+	public String getDynSourceType() {
+		return dynSourceType;
+	}
+
+	public void setDynSourceType(String dynSourceType) {
+		this.dynSourceType = dynSourceType;
+	}
+
 	public String getLabelPosition() {
 		return labelPosition;
 	}

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

@@ -1,10 +1,12 @@
 package com.persagy.adm.diagram.core.model.template;
 
+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.base.IComponent;
 import com.persagy.adm.diagram.core.model.base.Layout;
 import com.persagy.adm.diagram.core.model.base.XY;
+import com.persagy.adm.diagram.core.model.logic.DynGroup;
 
 import java.util.ArrayList;
 import java.util.Iterator;
@@ -66,6 +68,12 @@ public class DiagramTemplate {
 	@Expose
 	private List<MainPipe> mainPipes;
 
+	/**
+	 * 初始化状态
+	 */
+	@JsonIgnore
+	private boolean initialized;
+
 	public String getDiagramType() {
 		return diagramType;
 	}
@@ -131,6 +139,9 @@ public class DiagramTemplate {
 	}
 
 	public void init() {
+		if(initialized)
+			return;
+
 		frame.initParent();
 		initScattered(frame);
 
@@ -139,6 +150,35 @@ public class DiagramTemplate {
 				mainPipe.init(this);
 			}
 		}
+
+		setDynTarget();
+
+		initialized = true;
+	}
+
+	public void setDynTarget(){
+		List<Container> containers = getContainers();
+		containers.forEach(container -> container.setDynTarget(null));
+		if(mainPipes != null){
+			mainPipes.forEach(mainPipe -> mainPipe.setDynTarget(null));
+		}
+
+		for(Container con : containers) {
+			DynGroup dynGroup = con.getDynGroup();
+			if(dynGroup != null) {
+				if(Container.TYPE.equals(dynGroup.getDynSourceType())) {
+					Container conSrc = getContainerById(dynGroup.getDynSource());
+					if(conSrc != null){
+						conSrc.setDynTarget(con.getId());
+					}
+				} else if(MainPipe.TYPE.equals(dynGroup.getDynSourceType())) {
+					MainPipe mpSrc = getMainPipeById(dynGroup.getDynSource());
+					if(mpSrc != null){
+						mpSrc.setDynTarget(con.getId());
+					}
+				}
+			}
+		}
 	}
 
 	private void initScattered(Container con){

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

@@ -61,11 +61,19 @@ public class MainPipe extends AbstractLine implements IEquipHolder {
 	private List<List<XY>> locationPath;
 
 	/**
+	 * 该干管为动态源时,驱动的目标组件id
+	 */
+	private String dynTarget;
+
+	/**
 	 * 关联的容器对象,运行时
 	 */
 	@JsonIgnore
 	private List<Container> relatedContainerList;
 
+	/**
+	 * 父容器对象,运行时
+	 */
 	@JsonIgnore
 	private Container parentContainer;
 
@@ -318,4 +326,12 @@ public class MainPipe extends AbstractLine implements IEquipHolder {
 		this.locationPath = locationPath;
 	}
 
+	public String getDynTarget() {
+		return dynTarget;
+	}
+
+	public void setDynTarget(String dynTarget) {
+		this.dynTarget = dynTarget;
+	}
+
 }

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

@@ -0,0 +1,56 @@
+package com.persagy.adm.diagram.core.model.template;
+
+import cn.hutool.core.collection.CollUtil;
+import com.persagy.adm.diagram.core.model.base.Container;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 模板检查修正
+ * @author zhaoyk
+ */
+public class TemplateChecker {
+
+	private DiagramTemplate template;
+
+	public TemplateChecker(DiagramTemplate template) {
+		this.template = template;
+	}
+
+	public void checkAndFix(){
+		template.init();
+
+		if(template.getMainPipes() != null){
+			for(MainPipe mainPipe : template.getMainPipes()) {
+				fixMainPipeRelCons(mainPipe);
+			}
+		}
+
+		//TODO 动态组设置检查,关系过滤条件检查
+	}
+
+	private void fixMainPipeRelCons(MainPipe mainPipe){
+		List<Container> relCons = mainPipe.getRelatedContainerList();
+		if(CollUtil.isNotEmpty(relCons)){
+			for (int i = 0; i < relCons.size(); i++) {
+				Container c1 = relCons.get(i);
+				for (int j = i + 1; j < relCons.size(); j++) {
+					Container c2 = relCons.get(j);
+					if(c1.isParentOf(c2)){
+						relCons.remove(j);
+						j--;
+					} else if(c2.isParentOf(c1)){
+						relCons.remove(i);
+						i--;
+						break;
+					}
+				}
+			}
+			mainPipe.setRelatedContainers(relCons.stream().map(con -> con.getId()).collect(Collectors.toList()));
+		} else {
+			mainPipe.setRelatedContainers(null);
+		}
+	}
+
+}

+ 7 - 0
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/dao/IconMapper.java

@@ -37,4 +37,11 @@ public interface IconMapper extends BaseMapper<IconEntity> {
      * @return
      */
     List<IconEntity> getIconsBySystemType(String systemType);
+
+    /**
+     * 根据图例id列表获取图标
+     * @param legendIds 图例id列表
+     * @return 图标列表
+     */
+    List<IconEntity> getIconsByLegendIds(List<String> legendIds);
 }

+ 5 - 0
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/demo/DemoDataStrategy.java

@@ -418,4 +418,9 @@ public class DemoDataStrategy implements DataStrategy {
     public Map<String, Boolean> querySystemInstanceDiagramList() {
         return null;
     }
+
+    @Override
+    public boolean updateName(String name, String id) {
+        return false;
+    }
 }

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

@@ -40,6 +40,8 @@ public class EditRequest {
 
 	private DynGroup dynGroup;
 
+	private String content;
+
 	@Data
 	public static class TemplatePropsData {
 

+ 0 - 2
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/manage/DemoDiagramManager.java

@@ -143,9 +143,7 @@ public class DemoDiagramManager {
 		Diagram diagram = dataStrategy.getDiagram(diagramId);
 		manager.resetDiagram(diagram);
 
-		dataStrategy.saveDiagram(diagram);
 		manager.buildDiagram(diagram);
-
 		return diagram;
 	}
 

+ 11 - 7
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/manage/DiagramManager.java

@@ -35,9 +35,10 @@ public class DiagramManager {
 
 	/**
 	 * 对系统图进行初始化构建操作
+	 * @param autoLayout 是否自动执行布局计算
 	 */
-	public void buildDiagram(Diagram diagram){
-		boolean autoLayout = diagram.getTemplate() == null;
+	public void buildDiagram(Diagram diagram, boolean autoLayout){
+		autoLayout = autoLayout && diagram.getTemplate() == null;
 
 		if(diagram.getTemplate() == null){
 			loadTemplate(diagram);
@@ -51,6 +52,13 @@ public class DiagramManager {
 		}
 	}
 
+	/**
+	 * 对系统图进行初始化构建操作,并根据需要自动执行布局计算
+	 */
+	public void buildDiagram(Diagram diagram){
+		buildDiagram(diagram, true);
+	}
+
 	private void loadTemplate(Diagram diagram){
 		if (diagram.getTemplateId() != null) {
 			diagram.setTemplate(dataStrategy.getTemplate(diagram.getTemplateId()));
@@ -78,11 +86,7 @@ public class DiagramManager {
 	 * 自动加载数据(设备、关系)
 	 */
 	public Diagram loadData(Diagram diagram){
-		if(diagram.getTemplate() == null){
-			loadTemplate(diagram);//先加载template,避免buildDiagram时执行layout
-		}
-
-		buildDiagram(diagram);
+		buildDiagram(diagram, false);
 
 		CalcContext context = new CalcContext(diagram);
 		new DiagramDataLoader(diagram, dataStrategy).autoLoad(context);

+ 74 - 1
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/manage/TemplateManager.java

@@ -2,6 +2,7 @@ package com.persagy.adm.diagram.manage;
 
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.IdUtil;
+import cn.hutool.core.util.StrUtil;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.persagy.adm.diagram.core.ContentParser;
 import com.persagy.adm.diagram.core.DataStrategy;
@@ -11,6 +12,7 @@ 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.core.model.template.TemplateChecker;
 import com.persagy.adm.diagram.dao.TemplateMapper;
 import com.persagy.adm.diagram.entity.DiagramType;
 import com.persagy.adm.diagram.entity.TemplateEntity;
@@ -142,7 +144,12 @@ public class TemplateManager {
      * 保存模板
      */
     public DiagramTemplate saveTemplate(DiagramTemplate template) {
-        template.clearLayout(); //保存模板之前,清除布局数据
+        //保存模板之前,清除布局数据
+        template.clearLayout();
+
+        //执行模板检查和修正
+        new TemplateChecker(template).checkAndFix();
+
         DiagramTemplate rtn = dataStrategy.saveTemplate(template);
         buildTemplate(rtn);
         return rtn;
@@ -398,6 +405,72 @@ public class TemplateManager {
         Container con = template.getContainerById(containerId);
         con.setDynGroup(dynGroup);
 
+        template.setDynTarget();
+
+        return saveTemplate(template);
+    }
+
+    public String getCopyContent(String compId, String templateId){
+        DiagramTemplate template = dataStrategy.getTemplate(templateId);
+        template.init();
+
+        Object obj;
+        if(StrUtil.isNotBlank(compId)) {
+            obj = template.getContainerById(compId);
+            if(obj == null){
+                obj = template.getMainPipeById(compId);
+            }
+        } else {
+            obj = template;
+        }
+        return obj != null ? contentParser.toJson(obj) : "";
+    }
+
+    public DiagramTemplate setPasteContent(String content, String compId, String templateId){
+        DiagramTemplate template = dataStrategy.getTemplate(templateId);
+        template.init();
+
+        if(StrUtil.isNotBlank(content)) {
+            Map<String, Object> map = contentParser.parseContent(content, Map.class);
+            Object o = null;
+            if(Container.TYPE.equals(map.get("compType"))){
+                o = contentParser.parseContent(content, Container.class);
+            } else if(MainPipe.TYPE.equals(map.get("compType"))) {
+                o = contentParser.parseContent(content, MainPipe.class);
+            } else if(map.containsKey("frame")) {
+                o = contentParser.parseContent(content, DiagramTemplate.class);
+            }
+
+            if(o != null) {
+                if(o instanceof DiagramTemplate){
+                    DiagramTemplate other = (DiagramTemplate)o;
+                    if(StrUtil.isBlank(compId)) {
+                        template.setFrame(other.getFrame());
+                        template.setMainPipes(other.getMainPipes());
+                        template.setScatteredContainers(other.getScatteredContainers());
+                    }
+                } else if(o instanceof Container) {
+                    Container target = null;
+                    if(StrUtil.isNotBlank(compId)) {
+                        Container c = template.getContainerById(compId);
+                        if(c != null){
+                            target = c;
+                        }
+                    } else {
+                      target = template.getFrame();
+                    }
+                    if(target != null && !target.isEquipmentBox()){
+                        Container con = (Container)o;
+                        if(template.getContainerById(con.getId()) != null){
+                            con.setId(IdUtil.simpleUUID());
+                        }
+                        target.addComp(con);
+                    }
+                } else {
+                    //暂不支持干管粘贴
+                }
+            }
+        }
         return saveTemplate(template);
     }
 

+ 9 - 0
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/service/IconService.java

@@ -3,6 +3,7 @@ package com.persagy.adm.diagram.service;
 import com.persagy.adm.diagram.entity.IconEntity;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * 图标服务
@@ -51,4 +52,12 @@ public interface IconService {
      * @return
      */
     List<IconEntity> getIconsBySystemType(String system);
+
+    /**
+     * 根据图例id列表获取图标
+     *
+     * @param legendIds 图例id列表
+     * @return 图标列表
+     */
+    Map<String,String> getIconsByLegendIds(List<String> legendIds);
 }

+ 20 - 0
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/service/impl/IconServiceImpl.java

@@ -1,5 +1,6 @@
 package com.persagy.adm.diagram.service.impl;
 
+import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.util.IdUtil;
 import cn.hutool.core.util.StrUtil;
 import com.persagy.adm.diagram.dao.IconMapper;
@@ -8,7 +9,10 @@ import com.persagy.adm.diagram.service.IconService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 @Service
 public class IconServiceImpl implements IconService {
@@ -61,4 +65,20 @@ public class IconServiceImpl implements IconService {
     public List<IconEntity> getIconsBySystemType(String systemType) {
         return iconMapper.getIconsBySystemType(systemType);
     }
+
+    /**
+     * 根据图例id列表获取图标
+     *
+     * @param legendIds 图例id列表
+     * @return 图例id : icon id
+     */
+    @Override
+    public Map<String, String> getIconsByLegendIds(List<String> legendIds) {
+        List<IconEntity> icons = iconMapper.getIconsByLegendIds(legendIds);
+        if (CollectionUtil.isNotEmpty(icons)) {
+            return icons.stream().collect(
+                    Collectors.toMap(IconEntity::getLegendId, IconEntity::getId));
+        }
+        return new HashMap<>();
+    }
 }

+ 3 - 33
adm-business/adm-diagram/src/main/resources/bootstrap.yml

@@ -4,6 +4,8 @@ spring:
   application:
     # 应用名称
     name: adm-diagram
+  main:
+    allow-bean-definition-overriding: true
   datasource:
     dynamic:
       datasource:
@@ -22,36 +24,4 @@ persagy:
     dic:
       service: http://develop.ysbdtp.com/dmp-dic
     file:
-      service: http://develop.ysbdtp.com/dmp-file
-
-#    driver-class-name: com.mysql.cj.jdbc.Driver
-#  datasource:
-#    druid:
-#      filters: stat,slf4j
-#      filter:
-#        wall:
-#          config:
-#            #允许一次执行多条语句
-#            multi-statement-allow: true
-#            #允许非基本语句的其他语句,开启后可以执行DDL语句
-#            none-base-statement-allow: true
-#          enabled: false
-#        slf4j:
-#          enabled: true
-
-config:
-  file:
-    absolute:
-      path: ${CONFIG_FILE_PATH:D:\SpringCloud}
-#feign:
-#  compression:
-#    request:
-#      # 开启请求压缩
-#      enabled: true
-#      # 配置压缩的 MIME TYPE
-#      mime-types: text/xml,application/xml,application/json
-#      # 配置压缩数据大小的下限
-#      min-request-size: 2048
-#    response:
-#      # 开启响应压缩
-#      enabled: true
+      service: http://develop.ysbdtp.com/dmp-file

+ 11 - 0
adm-business/adm-diagram/src/main/resources/mapper/DiagramIcon.xml

@@ -46,6 +46,17 @@
         FROM diagram_icon
         WHERE valid = 1 AND system_type=#{systemType}
     </select>
+    <select id="getIconsByLegendIds" resultMap="iconBaseMap">
+        SELECT
+        <include refid="baseSql"/>
+        FROM diagram_icon
+        WHERE valid = 1
+        <if test="legendIds !=null and legendIds.size()>0">
+            <foreach collection="legendIds" open="AND legend_id IN(" close=")" separator="," item="item">
+                #{item}
+            </foreach>
+        </if>
+    </select>
 </mapper>
 
 

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

@@ -34,7 +34,7 @@ public class AdmRelationAddRequest implements Serializable {
     @JSONField(name = "graphicType",alternateNames = {"parentCode","graphic_type"})
     private String graphicType;
 
-    /** 交付范围 0项目交付,1现场交付**/
-    private Integer deliveryType;
+    /** 是否仅查看项目交付范围内数据:0/null-否 1-是 **/
+    private Integer isDelivery;
 
 }

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

@@ -156,7 +156,7 @@ public class AdmManualRelCalServiceImpl implements AdmManualRelCalService {
             }
         }
         //验证 项目交付范围
-        Integer flag = validRelCollect(context, relationTypeEnum, request.getDeliveryType(), mainResultData, fromResultData);
+        Integer flag = validRelCollect(context, relationTypeEnum, request.getIsDelivery(), mainResultData, fromResultData);
         switch (flag){
             case 1 : return AdmCreateResponse.failure(mainResultData +":不存在","1");
             case 2 : return AdmCreateResponse.failure(fromResultData +":不存在","2");
@@ -518,22 +518,23 @@ public class AdmManualRelCalServiceImpl implements AdmManualRelCalService {
      * @param fromResultData 从对象
      * @return 0 成功; 1 主对象为空; 2 从对象为空; 3 不在项目交付范围内
      **/
-    private Integer validRelCollect(InstanceUrlParam context, AdmRelationTypeEnum relationTypeEnum , Integer deliveryType, List<ObjectNode> mainResultData, List<ObjectNode> fromResultData){
+    private Integer validRelCollect(InstanceUrlParam context, AdmRelationTypeEnum relationTypeEnum , Integer isDelivery, List<ObjectNode> mainResultData, List<ObjectNode> fromResultData){
         if(CollUtil.isEmpty(mainResultData)){
             return 1;
         }
         if(CollUtil.isEmpty(fromResultData)){
             return 2;
         }
-        if(deliveryType != null){
+        if(isDelivery != null && isDelivery == 1){
             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);
+            objectNode.put("deliveryType",0);
+            objectNode.put("valid",1);
             queryCriteria.setCriteria(objectNode);
-            List<RelationDefineCollect> relationDefineCollects = relationReportService.doQueryRelationDefineCollectList(context, queryCriteria);
+             List<RelationDefineCollect> relationDefineCollects = relationReportService.doQueryRelationDefineCollectList(context, queryCriteria);
             if(CollUtil.isEmpty(relationDefineCollects)){
                 return 3;
             }
@@ -558,13 +559,15 @@ public class AdmManualRelCalServiceImpl implements AdmManualRelCalService {
                 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)){
+                if(sourceTypeCodeSet.containsAll(mainSet) && endTypeCodeSet.containsAll(fromSet)){
                     return 0;
                 }
-                if(sourceTypeCodeSet.contains(endTypeCodes) && endTypeCodeSet.contains(mainSet)){
+                if(sourceTypeCodeSet.containsAll(fromSet) && endTypeCodeSet.containsAll(mainSet)){
                     return 0;
                 }
             }
+        }else{
+            return 0;
         }
         return 3;
     }

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

@@ -208,7 +208,7 @@ public class AbstractAdmDictBaseServiceImpl<T> implements IAdmDictBaseService<T>
             admVO.setRegion(admVO.getIsRegion());
             admVO.setGroupCode(AppContext.getContext().getGroupCode());
             admVO.setSort(admVO.getShowOrder());
-
+            admVO.setNote(admVO.getRemark() == null ? "" :admVO.getRemark());
             //path路径处理
             handleObjectInfoPath(admVO);
             //信息点是否可见设置默认值
@@ -411,7 +411,6 @@ public class AbstractAdmDictBaseServiceImpl<T> implements IAdmDictBaseService<T>
         for(AdmObjectType admObjectType : typeList){
             if(collectMap.containsKey(admObjectType.getId())){
                 ObjectTypeCollect collect = collectMap.get(admObjectType.getId());
-                admObjectType.setDeliveryType(collect.getDeliveryType());
                 admObjectType.setIsDelivery(collect.getIsDelivery());
             }
         }

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

@@ -91,6 +91,7 @@ public class AdmDictServiceImpl<T> extends AbstractAdmDictBaseServiceImpl<T> imp
         //获取交付范围内的设备
         QueryCriteria criteriaCollect = new QueryCriteria();
         ObjectNode nodeCol = JsonNodeFactory.instance.objectNode();
+        nodeCol.put("deliveryType", 0);
         nodeCol.put("objType", type);
         nodeCol.put("projectId", context.getProjectId());
         criteriaCollect.setCriteria(nodeCol);
@@ -403,6 +404,11 @@ public class AdmDictServiceImpl<T> extends AbstractAdmDictBaseServiceImpl<T> imp
         //查询类型下的所有信息点信息
         AdmResponse admResponse = doQueryObjectInfo(context, request, AdmDictConstant.CLASS_CODE, clazz);
         List<AdmObjectInfo> admObjectInfos = (List<AdmObjectInfo>) admResponse.getContent();
+        //项目信息点 进行定制过滤
+        if(request.getType().equals(AdmProject.OBJ_TYPE)){
+            admObjectInfos = filterInfosForProject(admObjectInfos);
+            admResponse.setTotal(admObjectInfos.size()*1L);
+        }
         admObjectInfos = sortFuncidForEdit(admObjectInfos);
         //查询平台级信息点采集信息
         List<ObjectInfoCollect> commonObjectInfoCollect = queryObjectInfoCollect(context, "common", request.getType(), clazz);
@@ -624,6 +630,24 @@ public class AdmDictServiceImpl<T> extends AbstractAdmDictBaseServiceImpl<T> imp
         return resultOrders;
     }
 
+    /** 项目需要展示的信息点**/
+    private List<AdmObjectInfo> filterInfosForProject(List<AdmObjectInfo> list){
+        if(CollUtil.isEmpty(list)){
+            return Collections.emptyList();
+        }
+        List<String> projectCodes = Arrays.asList("businessOpeningTime","owner","property","designer","constructor","contractor","longitude",
+                "latitude","sFI","address","projUnderfloorNum","fireResistanceLev","projNeighborLocationMap","projLogo","projIntro",
+                "projHeight","projFuncType","projCoverArea","projCityLocationMap","projArea","assetManager");
+
+        list.forEach(code -> {
+            if(code.getCode().equals("constructor")){
+                code.setCode("contractor");
+                code.setAliasCode("Contractor");
+                code.setPath("infos.contractor");
+            }
+        });
+        return list.stream().filter(info -> projectCodes.contains(info.getCode())).collect(Collectors.toList());
+    }
     /**
      * 统计类型下的非静态信息点
      * @param context

+ 2 - 1
adm-business/adm-middleware/src/main/java/com/persagy/proxy/migration/constant/MiGrationRelCode.java

@@ -66,7 +66,8 @@ public enum MiGrationRelCode {
 	Pe2Bd("Pe2Bd"),
 	Pe2Fl("Pe2Fl"),
 	Pe2Sh("Pe2Sh"),
-	Pe2Sp("Pe2Sp");
+	Pe2Sp("Pe2Sp"),
+	Sp2Si("Sp2Si");
 
 	private String code;
 	public String getCode(){

+ 1 - 1
adm-business/adm-middleware/src/main/java/com/persagy/proxy/migration/constant/MigrationConstant.java

@@ -10,7 +10,7 @@ public class MigrationConstant {
 
     public final static String ERROR = "目标地址错误不能正常访问!";
 
-    public final static int BATCH_SUBMIT_DATA_COUNT = 500;
+    public final static int BATCH_SUBMIT_DATA_COUNT = 5000;
 
     /** 数据拼接 用于list->map 时key和value拼接 **/
     public final static String SPLITER = "_";

+ 0 - 29
adm-business/adm-middleware/src/main/java/com/persagy/proxy/migration/constant/MigrationObjType.java

@@ -1,29 +0,0 @@
-package com.persagy.proxy.migration.constant;
-
-/**
- * @author lvxianyun
- * @title: MigrationObjType
- * @projectName adm-middleware
- * @description: 
- * @date 2021/12/9 21:04
- */
-public enum MigrationObjType {
-
-     project("project") ,building("building") , floor("floor") ,component("component") , equipment("equipment") , shaft("shaft") , system("system") ,  /*ispace ,*/ space("space") ;
-
-     private String code;
-
-     public String getCode() {
-          return code;
-     }
-
-     MigrationObjType(String code) {
-          this.code = code;
-     }
-
-     @Override
-     public String toString() {
-          return this.code;
-     }
-
-}

+ 2 - 3
adm-business/adm-middleware/src/main/java/com/persagy/proxy/migration/controller/DataMigrationController.java

@@ -20,7 +20,6 @@ import com.persagy.proxy.adm.utils.AdmContextUtil;
 import com.persagy.proxy.common.entity.DmpResult;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
 import com.persagy.proxy.migration.constant.MigrationConstant;
-import com.persagy.proxy.migration.constant.MigrationObjType;
 import com.persagy.proxy.migration.handler.DataMigrationHandler;
 import com.persagy.proxy.migration.model.DataMigrationExcel;
 import com.persagy.proxy.migration.model.MigrationInfo;
@@ -161,7 +160,7 @@ public class DataMigrationController {
         String encode = StandardCharsets.UTF_8.name();
         response.setCharacterEncoding(encode);
         // 防止中文乱码
-        String fileName = context.getProjectId()+"_迁移sql";
+        String fileName = context.getProjectId()+"_迁移sql脚本";
 
         try {
             fileName = URLEncoder.encode(fileName, encode);
@@ -245,7 +244,7 @@ public class DataMigrationController {
         queryCriteria.setOnlyCount(true);
         ObjectNode criteria = JsonNodeFactory.instance.objectNode();
         criteria.put("valid", 1);
-        criteria.put("objType", MigrationObjType.project.getCode());
+        criteria.put("objType", "project");
         queryCriteria.setCriteria(criteria);
 
         String requestBody = JsonHelper.toJsonStr(queryCriteria);

+ 17 - 0
adm-business/adm-middleware/src/main/java/com/persagy/proxy/migration/service/Impl/MigrationAbstractServiceImpl.java

@@ -6,6 +6,7 @@ import cn.hutool.http.HttpException;
 import cn.hutool.http.HttpUtil;
 import cn.hutool.json.JSONUtil;
 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.model.QueryCriteria;
 import com.persagy.dmp.basic.utils.JsonNodeUtils;
@@ -13,6 +14,8 @@ import com.persagy.dmp.common.constant.ResponseCode;
 import com.persagy.dmp.common.model.entity.AuditableEntity;
 import com.persagy.dmp.common.model.response.CommonResult;
 import com.persagy.dmp.common.utils.JsonHelper;
+import com.persagy.dmp.define.client.DigitalDefineFacade;
+import com.persagy.dmp.define.entity.ObjectTypeDefine;
 import com.persagy.dmp.migrate.client.DigitalMigrateLogFacade;
 import com.persagy.dmp.rwd.migrate.entity.SyncData;
 import com.persagy.proxy.common.entity.DmpResult;
@@ -468,4 +471,18 @@ public class MigrationAbstractServiceImpl<T> implements IMigrationAbstractServic
         }
         return targetsMap;
     }
+
+
+    public List<String> getObjTypes(InstanceUrlParam context){
+        QueryCriteria queryCriteria = new QueryCriteria();
+        ObjectNode criteria = JsonNodeFactory.instance.objectNode();
+        criteria.put("valid", 1);
+        queryCriteria.setCriteria(criteria);
+        List<ObjectTypeDefine> types = DigitalDefineFacade.queryObjectType(context.getGroupCode(),context.getProjectId(),context.getUserId(),context.getUserId(),queryCriteria);
+        if(CollUtil.isEmpty(types)){
+            return null;
+        }
+        Map<String,List<ObjectTypeDefine>> objType = types.stream().collect(Collectors.groupingBy(ObjectTypeDefine::getObjType));
+        return objType.keySet().stream().collect(Collectors.toList());
+    }
 }

+ 58 - 30
adm-business/adm-middleware/src/main/java/com/persagy/proxy/migration/service/Impl/ObjectDigitalMigration.java

@@ -8,16 +8,13 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.persagy.dmp.basic.model.QueryCriteria;
 import com.persagy.dmp.basic.utils.JsonNodeUtils;
 import com.persagy.dmp.common.constant.ResponseCode;
-import com.persagy.dmp.common.model.entity.AuditableEntity;
-import com.persagy.dmp.common.model.entity.BaseEntity;
-import com.persagy.dmp.define.entity.ObjectTypeDefine;
+import com.persagy.dmp.common.model.response.CommonResult;
 import com.persagy.dmp.digital.client.DigitalObjectFacade;
 import com.persagy.dmp.digital.entity.ObjectDigital;
 import com.persagy.dmp.rwd.migrate.entity.SyncData;
 import com.persagy.proxy.adm.request.AdmResponse;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
 import com.persagy.proxy.migration.constant.MigrationConstant;
-import com.persagy.proxy.migration.constant.MigrationObjType;
 import com.persagy.proxy.migration.constant.MigrationTable;
 import com.persagy.proxy.migration.constant.MigrationType;
 import com.persagy.proxy.migration.model.DataMigrationExcel;
@@ -25,7 +22,6 @@ import com.persagy.proxy.migration.model.DataMigrationResponse;
 import com.persagy.proxy.migration.model.MigrationInfo;
 import com.persagy.proxy.migration.service.IDataMigration;
 import com.persagy.proxy.migration.service.IDataMigrationProcess;
-import com.persagy.proxy.migration.service.Impl.MigrationAbstractServiceImpl;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 
@@ -55,14 +51,14 @@ public class ObjectDigitalMigration extends MigrationAbstractServiceImpl<ObjectD
         log.info("######################### dt_object 数据迁移内容获取开始 #########################");
         long start = System.currentTimeMillis();
         List<DataMigrationExcel> dataMigrationExcels = new ArrayList<>();
+        List<String> objTypes = getObjTypes(context);
+        for(String objType : objTypes){
+            log.info("######################### dt_object "+objType+"数据迁移内容获取开始 #########################");
 
-        for(MigrationObjType objType : MigrationObjType.values()){
-            log.info("######################### dt_object "+objType.getCode()+"数据迁移内容获取开始 #########################");
-
-            QueryCriteria queryCriteria = getQueryCriteria(objType.getCode());
+            QueryCriteria queryCriteria = getQueryCriteria(objType);
             dataMigrationExcels.addAll(startMigrateForExcel(context,migrationInfo,queryCriteria));
 
-            log.info("######################### dt_object "+objType.getCode()+"数据迁移内容获取结束 #########################");
+            log.info("######################### dt_object "+objType+"数据迁移内容获取结束 #########################");
         }
 
         long end = System.currentTimeMillis();
@@ -80,13 +76,14 @@ public class ObjectDigitalMigration extends MigrationAbstractServiceImpl<ObjectD
     public AdmResponse migrateForLog(InstanceUrlParam context, MigrationInfo migrationInfo) {
         log.info("######################### dt_object 同步开始 #########################");
         long start = System.currentTimeMillis();
-        for(MigrationObjType objType : MigrationObjType.values()){
-            log.info("######################### dt_object "+objType.getCode()+"同步开始 #########################");
+        List<String> objTypes = getObjTypes(context);
+        for(String objType : objTypes){
+            log.info("######################### dt_object "+objType+"同步开始 #########################");
 
-            QueryCriteria queryCriteria = getQueryCriteria(objType.getCode());
+            QueryCriteria queryCriteria = getQueryCriteria(objType);
             startMigrateForLog(context,migrationInfo,queryCriteria);
 
-            log.info("######################### dt_object "+objType.getCode()+"同步结束 #########################");
+            log.info("######################### dt_object "+objType+"同步结束 #########################");
         }
         long end = System.currentTimeMillis();
         log.info("######################### dt_object 数据迁移已结束 时间:"+(end-start)+" #########################");
@@ -101,29 +98,50 @@ public class ObjectDigitalMigration extends MigrationAbstractServiceImpl<ObjectD
      */
     @Override
     public String migrateForSql(InstanceUrlParam context) {
-        StringBuffer sqls = new StringBuffer(" \n -- 数据迁移  dt_object ------ \n");
         //获取已经采集的数据
-        String sqls_temp = "";
-        for(MigrationObjType objType : MigrationObjType.values()){
-            QueryCriteria queryCriteria = getQueryCriteria(objType.getCode());
-            List<ObjectNode> admData = getAdmData(context,queryCriteria);
+        String sqls_temp = "\n -- 数据迁移  dt_object ------ \n  ";
+        //List<String> objTypes = getObjTypes(context);
+        List<String> objTypes = Arrays.asList("equipment");
+        for(String objType : objTypes){
+            QueryCriteria queryCriteria = getQueryCriteria(objType);
+            queryCriteria.setSize(MigrationConstant.BATCH_SUBMIT_DATA_COUNT*1L);
+            CommonResult<List<ObjectNode>> result = getAdmDataPage(context,queryCriteria);
+            List<ObjectNode> admData = result.getData();
             if(CollUtil.isEmpty(admData)){
                 continue;
             }
-            sqls_temp += appendValues(admData).toString();
+            sqls_temp += processSqlStr(appendValues(admData).toString());
+
+            if(result.getCount() > MigrationConstant.BATCH_SUBMIT_DATA_COUNT){
+                long page = result.getCount() / MigrationConstant.BATCH_SUBMIT_DATA_COUNT + 1;
+                for(long i = 2; i<=page; i++){
+                    queryCriteria.setPage(i);
+                    result = getAdmDataPage(context,queryCriteria);
+                    admData = result.getData();
+                    if(CollUtil.isEmpty(admData)){
+                        continue;
+                    }
+                    sqls_temp += processSqlStr(appendValues(admData).toString());
+                }
+            }
         }
         if(sqls_temp.length() == 0){
             return "";
         }
-        sqls.append(MigrationConstant.DT_OBJECT_SQL_PRE);
-        sqls.append(sqls_temp);
-        String sql = sqls.toString();
+        return sqls_temp;
+    }
+
+    private String processSqlStr(String sql){
         sql = sql.substring(0, sql.lastIndexOf(","));
         sql += ";";
         sql = sql.replaceAll("\"","\\\\\"");
-        return sql;
+        sql = sql.replaceAll("\n","\\n");
+        sql = sql.replaceAll("\r","\\r");
+        StringBuffer sqls = new StringBuffer("\r");
+        sqls.append(MigrationConstant.DT_OBJECT_SQL_PRE);
+        sqls.append(sql);
+        return  sqls.toString();
     }
-
     private StringBuffer appendValues(List<ObjectNode> admData){
         StringBuffer sqls = new StringBuffer();
         admData.forEach(obj -> {
@@ -133,18 +151,18 @@ public class ObjectDigitalMigration extends MigrationAbstractServiceImpl<ObjectD
             if (objectDigital.getName() == null) {
                 sqls.append(objectDigital.getName()).append(",");
             } else {
-                sqls.append("'").append(objectDigital.getName()).append("',");
+                sqls.append("'").append(objectDigital.getName().replaceAll("\\'","\\\\'")).append("',");
             }
 
             if (objectDigital.getLocalId() == null) {
                 sqls.append(objectDigital.getLocalId()).append(",");
             } else {
-                sqls.append("'").append(objectDigital.getLocalId()).append("',");
+                sqls.append("'").append(objectDigital.getLocalId().replaceAll("\\'","\\\\'")).append("',");
             }
             if (objectDigital.getLocalName() == null) {
                 sqls.append(objectDigital.getLocalName()).append(",");
             } else {
-                sqls.append("'").append(objectDigital.getLocalName()).append("',");
+                sqls.append("'").append(objectDigital.getLocalName().replaceAll("\\'","\\\\'")).append("',");
             }
             sqls.append("'").append(objectDigital.getGroupCode()).append("',");
             sqls.append("'").append(objectDigital.getProjectId()).append("',");
@@ -155,7 +173,9 @@ public class ObjectDigitalMigration extends MigrationAbstractServiceImpl<ObjectD
             if (objectDigital.getVirtualCodes() == null) {
                 sqls.append(objectDigital.getVirtualCodes()).append(",");
             } else {
-                sqls.append("'").append(objectDigital.getVirtualCodes()).append("',");
+                StringBuilder temp = new StringBuilder();
+                objectDigital.getVirtualCodes().forEach(str -> temp.append("\"").append(str).append("\"").append(","));
+                sqls.append("'[").append(StrUtil.sub(temp.toString(),0,-1)).append("]',");
             }
             if (objectDigital.getCreateApp() == null) {
                 sqls.append(objectDigital.getCreateApp()).append(",");
@@ -172,7 +192,7 @@ public class ObjectDigitalMigration extends MigrationAbstractServiceImpl<ObjectD
             sqls.append("'").append(objectDigital.getModifier()).append("',");
             sqls.append("'").append(objectDigital.getModifiedTime()).append("',");
             sqls.append(objectDigital.getValid());
-            sqls.append(")\n ,");
+            sqls.append(") ,");
         });
         return sqls;
     }
@@ -337,6 +357,14 @@ public class ObjectDigitalMigration extends MigrationAbstractServiceImpl<ObjectD
         return digitalList;
     }
 
+    public CommonResult<List<ObjectNode>> getAdmDataPage(InstanceUrlParam context, QueryCriteria queryCriteria) {
+        CommonResult<List<ObjectNode>> digitalList = DigitalObjectFacade.queryPrototype(context.getGroupCode(),context.getProjectId(),context.getUserId(),context.getUserId(),queryCriteria);
+        if(CollUtil.isEmpty(digitalList.getData())){
+            return null;
+        }
+        return digitalList;
+    }
+
     /**
      * 根据map转为需要处理的对象集合
      * @param fromMap

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

@@ -34,7 +34,7 @@ public class AdmProjectController {
     public AdmResponse query(@RequestParam(value = "projectId",required = false) String projectId,
                              @RequestBody AdmQueryCriteria request) throws Exception {
         request.setName(AdmProject.OBJ_TYPE);
-        return service.doQuery(AdmContextUtil.toDmpContext(), request, AdmProject.class);
+        return service.doQuery(AdmContextUtil.toDmpContext(), request);
     }
 
     /**
@@ -58,7 +58,7 @@ public class AdmProjectController {
     @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);
+        vos = service.doUpdate(AdmContextUtil.toDmpContext(), vos);
         return AdmResponse.success(vos);
     }
 }

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

@@ -68,6 +68,8 @@ public class AdmObjectInfo {
 
     /** 备注 */
     private String note;
+    /** 备注 */
+    private String remark;
 
     /** 输入类型 */
     private String origDataType;

+ 22 - 1
adm-business/adm-middleware/src/main/java/com/persagy/proxy/object/service/IAdmProjectService.java

@@ -1,7 +1,13 @@
 package com.persagy.proxy.object.service;
 
+import com.persagy.proxy.adm.request.AdmQueryCriteria;
+import com.persagy.proxy.adm.request.AdmResponse;
 import com.persagy.proxy.adm.service.IAdmBaseService;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
 import com.persagy.proxy.object.model.AdmProject;
+import org.apache.poi.ss.formula.functions.T;
+
+import java.util.List;
 
 /**
  * ADM 项目 接口类
@@ -9,5 +15,20 @@ import com.persagy.proxy.object.model.AdmProject;
  * @date 2021-08-16
  */
 public interface IAdmProjectService extends IAdmBaseService<AdmProject> {
-
+    /**
+     * 查询
+     * @param context
+     * @param request
+     * @return
+     */
+    AdmResponse doQuery(InstanceUrlParam context, AdmQueryCriteria request);
+    /**
+     * 修改
+     * @param context
+     * @param voList
+     * @return
+     */
+    List<AdmProject> doUpdate(InstanceUrlParam context, List<AdmProject> voList);
+    List<AdmProject> processDataEdit(List<AdmProject> vos);
+    List<AdmProject> processDataQuery(List<AdmProject> vos);
 }

+ 61 - 0
adm-business/adm-middleware/src/main/java/com/persagy/proxy/object/service/impl/AdmProjectServiceImpl.java

@@ -1,10 +1,16 @@
 package com.persagy.proxy.object.service.impl;
 
+import cn.hutool.core.collection.CollUtil;
+import com.persagy.proxy.adm.request.AdmQueryCriteria;
+import com.persagy.proxy.adm.request.AdmResponse;
 import com.persagy.proxy.adm.service.impl.AbstractAdmBaseServiceImpl;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
 import com.persagy.proxy.object.model.AdmProject;
 import com.persagy.proxy.object.service.IAdmProjectService;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * ADM 项目 实现类
  * @author Charlie Yu
@@ -13,4 +19,59 @@ import org.springframework.stereotype.Service;
 @Service
 public class AdmProjectServiceImpl extends AbstractAdmBaseServiceImpl<AdmProject> implements IAdmProjectService {
 
+    /**
+     * 查询
+     *
+     * @param context
+     * @param request
+     * @return
+     */
+    @Override
+    public AdmResponse doQuery(InstanceUrlParam context, AdmQueryCriteria request) {
+        AdmResponse response = super.doQuery(context,request,AdmProject.class);
+        List<AdmProject> vos = (List<AdmProject>) response.getContent();
+        response.setContent(processDataQuery(vos));
+        return response;
+    }
+
+    /**
+     * 修改
+     *
+     * @param context
+     * @param voList
+     * @return
+     */
+    @Override
+    public List<AdmProject> doUpdate(InstanceUrlParam context, List<AdmProject> voList) {
+        List<AdmProject> admProjects = super.doUpdate(context, AdmProject.class, processDataEdit(voList));
+        return processDataQuery(admProjects);
+    }
+
+    @Override
+    public List<AdmProject> processDataEdit(List<AdmProject> vos) {
+        for(AdmProject admProject : vos){
+            if(CollUtil.isEmpty(admProject.getInfos())){
+                continue;
+            }
+            if(admProject.getInfos().containsKey("contractor")){
+                admProject.getInfos().put("constructor",admProject.getInfos().get("contractor"));
+                admProject.getInfos().remove("contractor");
+            }
+        }
+        return vos;
+    }
+
+    @Override
+    public List<AdmProject> processDataQuery(List<AdmProject> vos) {
+        for(AdmProject admProject : vos){
+            if(CollUtil.isEmpty(admProject.getInfos())){
+                continue;
+            }
+            if(admProject.getInfos().containsKey("constructor")){
+                admProject.getInfos().put("contractor",admProject.getInfos().get("constructor"));
+                admProject.getInfos().remove("constructor");
+            }
+        }
+        return vos;
+    }
 }

+ 6 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/algorithm/constant/AdmServerConstant.java

@@ -11,6 +11,12 @@ public interface AdmServerConstant {
     String BUILD_SEQUENCE_ID="buildSequenceID";
     /**建筑id的信息点key值*/
     String BUILDING_ID="buildingId";
+    /**正逆向交付方式,0-逆向,1-正向*/
+    String DELIVERY_WAY="deliveryWay";
+    /**交付类型:0-项目交付 1-现场交付*/
+    String DELIVERY_TYPE="deliveryType";
+    /**是否交付 0-否 1-是*/
+    String IS_DELIVERY="isDelivery";
 
 
 }

+ 35 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/algorithm/constant/DeliveryWayEnum.java

@@ -0,0 +1,35 @@
+package com.persagy.adm.server.algorithm.constant;
+
+import lombok.Getter;
+
+/**
+ * 正逆向交付方式枚举类
+ * @author : lijie
+ * Update By 2022/1/20 16:05
+ */
+@Getter
+public enum DeliveryWayEnum {
+
+    /**逆向*/
+    REVERSE("0", "逆向"),
+    /**正向*/
+    POSITIVE("1", "正向");
+
+    private String value;
+    private String desc;
+
+    DeliveryWayEnum(String value, String desc) {
+        this.value = value;
+        this.desc = desc;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public String getDesc() {
+        return desc;
+    }
+
+
+}

+ 26 - 6
adm-business/adm-server/src/main/java/com/persagy/adm/server/algorithm/controller/AdmModelController.java

@@ -4,15 +4,15 @@ import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.StrUtil;
 import com.persagy.adm.server.algorithm.constant.AdmServerConstant;
-import com.persagy.adm.server.algorithm.domain.BuildingVo;
-import com.persagy.adm.server.algorithm.domain.ModelFileVo;
-import com.persagy.adm.server.algorithm.domain.QueryModelFileVo;
+import com.persagy.adm.server.algorithm.domain.*;
 import com.persagy.adm.server.algorithm.entity.AdmModelFile;
 import com.persagy.adm.server.algorithm.service.AdmModelService;
 import com.persagy.dmp.common.constant.DigitalObjectType;
 import com.persagy.dmp.common.context.AppContext;
 import com.persagy.dmp.common.model.response.CommonResult;
 import com.persagy.dmp.common.utils.ResultHelper;
+import com.persagy.dmp.delivery.dto.ObjectTypeCollectDTO;
+import com.persagy.dmp.delivery.entity.ObjectTypeCollect;
 import com.persagy.dmp.digital.entity.ObjectDigital;
 import lombok.RequiredArgsConstructor;
 import org.springframework.validation.annotation.Validated;
@@ -135,16 +135,36 @@ public class AdmModelController {
      */
     @PostMapping(value = "/saveModelFile")
     public CommonResult<List<Void>> saveModelFile(@Validated @RequestBody ModelFileVo modelFileVo) {
-        Map<String, AdmModelFile> modelFileMap = admModelService.queryCurrentModelFileByFloorIds(CollUtil.newArrayList(modelFileVo.getFloorId()));
-        AdmModelFile admModelFile = modelFileMap.get(modelFileVo.getFloorId());
         AdmModelFile modelFile = BeanUtil.copyProperties(modelFileVo, AdmModelFile.class);
         modelFile.setGroupCode(AppContext.getContext().getGroupCode());
         modelFile.setProjectId(AppContext.getContext().getProjectId());
         modelFile.setCreator(AppContext.getContext().getAccountId());
         modelFile.setModifier(AppContext.getContext().getAccountId());
         admModelService.saveModelFile(modelFile);
-
         return ResultHelper.multi(new ArrayList<>());
     }
+    /**
+     * 010103-模型文件-查询正向/逆向交付范围
+     * @param queryVo : 查询条件
+     * @return : com.persagy.dmp.common.model.response.CommonResult<java.lang.Void>
+     * @author : lijie
+     * Update By 2022/1/12 16:54
+     * @undone
+     */
+    @PostMapping(value = "/queryScopeOfDeliver")
+    public CommonResult<List<ScopeOfDeliverVo>> queryScopeOfDeliver(@Validated @RequestBody QueryScopeOfDeliverVo queryVo) {
+        // 1.查询对象类型交付范围
+        List<ObjectTypeCollect> typeCollects = admModelService.queryObjectTypeCollectByDeliveryWay(queryVo.getDeliveryWay());
+        if (CollUtil.isEmpty(typeCollects)){
+            return ResultHelper.multi(new ArrayList<>());
+        }
+        List<ScopeOfDeliverVo> result = new ArrayList<>();
+        for (ObjectTypeCollect typeCollect : typeCollects) {
+            result.add(BeanUtil.toBean(typeCollect,ScopeOfDeliverVo.class));
+        }
+        // 2.查询对象信息点交付范围
+        // 3.查询对象关系交付范围
+        return ResultHelper.multi(result);
+    }
 
 }

+ 25 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/algorithm/domain/QueryScopeOfDeliverVo.java

@@ -0,0 +1,25 @@
+package com.persagy.adm.server.algorithm.domain;
+
+import com.persagy.adm.server.algorithm.constant.DeliveryWayEnum;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * 查询交付范围VO类
+ * @author : lijie
+ * Update By 2022/1/20 15:58
+ */
+@Data
+public class QueryScopeOfDeliverVo {
+    /**
+     * 正逆向交付方式
+     * @see DeliveryWayEnum#value
+     * @mock 1
+     */
+    @NotNull
+    private Integer deliveryWay;
+
+
+
+}

+ 21 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/algorithm/domain/ScopeOfDeliverVo.java

@@ -0,0 +1,21 @@
+package com.persagy.adm.server.algorithm.domain;
+
+import com.persagy.dmp.delivery.dto.ObjectInfoCollectDTO;
+import com.persagy.dmp.delivery.dto.ObjectTypeCollectDTO;
+import com.persagy.dmp.delivery.dto.RelationDefineCollectDTO;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 交付范围VO类
+ * @author : lijie
+ * Update By 2022/1/14 16:26
+ */
+@Data
+public class ScopeOfDeliverVo extends ObjectTypeCollectDTO{
+    /**对象类型下需交付的信息点.暂无,后续根据业务再调整*/
+    List<ObjectInfoCollectDTO> objectInfoDefines;
+    /**对象类型下需交付的关系数据.暂无,后续根据业务再调整*/
+    List<RelationDefineCollectDTO> relationDefines;
+}

+ 10 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/algorithm/service/AdmModelService.java

@@ -2,6 +2,8 @@ package com.persagy.adm.server.algorithm.service;
 
 import com.persagy.adm.server.algorithm.domain.DeliverPlanVo;
 import com.persagy.adm.server.algorithm.entity.AdmModelFile;
+import com.persagy.dmp.delivery.dto.ObjectTypeCollectDTO;
+import com.persagy.dmp.delivery.entity.ObjectTypeCollect;
 import com.persagy.dmp.digital.entity.ObjectDigital;
 
 import java.util.List;
@@ -37,4 +39,12 @@ public interface AdmModelService {
      * Update By 2022/1/19 17:54
      */
     void saveModelFile(AdmModelFile modelFile);
+    /**
+     * 根据正逆向交付查询对象类型交付范围
+     * @param deliveryWay : 正逆向交付方式,0-逆向,1-正向
+     * @return : java.util.List<com.persagy.dmp.delivery.dto.ObjectTypeCollectDTO>
+     * @author : lijie
+     * Update By 2022/1/20 18:26
+     */
+    List<ObjectTypeCollect> queryObjectTypeCollectByDeliveryWay(Integer deliveryWay);
 }

+ 41 - 14
adm-business/adm-server/src/main/java/com/persagy/adm/server/algorithm/service/impl/AdmModelServiceImpl.java

@@ -18,7 +18,11 @@ import com.persagy.dmp.common.constant.RelCodeEnum;
 import com.persagy.dmp.common.context.AppContext;
 import com.persagy.dmp.common.exception.BusinessException;
 import com.persagy.dmp.common.helper.SpringHelper;
+import com.persagy.dmp.common.model.entity.AuditableEntity;
 import com.persagy.dmp.common.model.response.CommonResult;
+import com.persagy.dmp.delivery.client.DigitalObjectTypeCollectFacade;
+import com.persagy.dmp.delivery.dto.ObjectTypeCollectDTO;
+import com.persagy.dmp.delivery.entity.ObjectTypeCollect;
 import com.persagy.dmp.digital.client.DigitalObjectFacade;
 import com.persagy.dmp.digital.entity.ObjectDigital;
 import com.persagy.dmp.digital.entity.ObjectRelation;
@@ -101,23 +105,46 @@ public class AdmModelServiceImpl implements AdmModelService {
     public void saveModelFile(AdmModelFile modelFile) {
         admModelFileMapper.insertEntity(modelFile);
     }
-
     /**
-     * 创建关系查询对象
-     * @param objectMapper : objectMapper
-     * @param graphCode : 图类型编码
-     * @param relCode : 边类型编码
-     * @param buildingIds : 建筑id
-     * @return : com.fasterxml.jackson.databind.node.ObjectNode
+     * 根据正逆向交付查询对象类型交付范围
+     * @param deliveryWay : 正逆向交付方式,0-逆向,1-正向
+     * @return : java.util.List<com.persagy.dmp.delivery.dto.ObjectTypeCollectDTO>
      * @author : lijie
-     * Update By 2022/1/19 14:18
+     * Update By 2022/1/20 18:26
      */
-    private ObjectNode createRelationQueryNode(ObjectMapper objectMapper, String graphCode, String relCode,
-                                               Set<String> buildingIds) {
+    @Override
+    public List<ObjectTypeCollect> queryObjectTypeCollectByDeliveryWay(Integer deliveryWay) {
+        if (null==deliveryWay){
+            return new ArrayList<>();
+        }
+        QueryCriteria queryCriteria = new QueryCriteria();
+        ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
         ObjectNode objectNode = objectMapper.createObjectNode();
-        objectNode.put(ObjectRelation.GRAPH_CODE_HUM,graphCode);
-        objectNode.put(ObjectRelation.REL_CODE_HUM,relCode);
-        objectNode.putPOJO(ObjectRelation.OBJ_FROM_HUM,buildingIds);
-        return objectNode;
+        objectNode.put(AuditableEntity.PROP_VALID,Boolean.TRUE);
+        objectNode.put(CommonConstant.QUERY_PROJECTID,AppContext.getContext().getProjectId());
+        objectNode.put(CommonConstant.QUERY_GROUPCODE,AppContext.getContext().getGroupCode());
+        objectNode.put(AdmServerConstant.DELIVERY_WAY,deliveryWay);
+        objectNode.put(AdmServerConstant.DELIVERY_TYPE,"0");
+        objectNode.put(AdmServerConstant.IS_DELIVERY,"1");
+        queryCriteria.setCriteria(objectNode);
+        CommonResult<List<ObjectTypeCollect>> commonResult = DigitalObjectTypeCollectFacade
+                .queryPrototype(AppContext.getContext().getGroupCode(), AppContext.getContext().getProjectId(),
+                        AppContext.getContext().getAppId(), AppContext.getContext().getAccountId(), queryCriteria);
+        if (!CommonConstant.QUERY_SUCCESS.equals(commonResult.getResult())){
+            throw new BusinessException(commonResult.getResult(),commonResult.getMessage());
+        }
+        if (CollUtil.isNotEmpty(commonResult.getData())){
+            return commonResult.getData();
+        }
+        // 暂时加个逻辑,如果没有就查询0
+        objectNode.put(CommonConstant.QUERY_PROJECTID,CommonConstant.DEFAULT_ID);
+        objectNode.put(CommonConstant.QUERY_GROUPCODE,CommonConstant.DEFAULT_ID);
+        CommonResult<List<ObjectTypeCollect>> zeroCommonResult = DigitalObjectTypeCollectFacade
+                .queryPrototype(AppContext.getContext().getGroupCode(), AppContext.getContext().getProjectId(),
+                        AppContext.getContext().getAppId(), AppContext.getContext().getAccountId(), queryCriteria);
+        if (!CommonConstant.QUERY_SUCCESS.equals(zeroCommonResult.getResult())){
+            throw new BusinessException(zeroCommonResult.getResult(),zeroCommonResult.getMessage());
+        }
+        return zeroCommonResult.getData();
     }
 }

+ 4 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/auth/domain/LoginVo.java

@@ -18,15 +18,18 @@ public class LoginVo {
     /**
      * 登录设备类型
      * @see DeviceTypeEnum#type
+     * @mock 1
      */
     private String loginDeviceType;
     /**
      * 登录方式
      * @see LoginTypeEnum#type
+     * @mock 2
      */
     private String loginType;
     /**
      * 登录密码
+     * @mock 123456
      */
     private String passWord;
     /**
@@ -35,6 +38,7 @@ public class LoginVo {
     private String dingdingCode;
     /**
      * 手机号
+     * @mock 17337681032
      */
     private String phone;
     /**

+ 5 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/common/AdmRequest.java

@@ -1,5 +1,6 @@
 package com.persagy.adm.server.custom.common;
 
+import com.alibaba.fastjson.JSON;
 import com.persagy.adm.server.custom.entity.UploadData;
 import lombok.Data;
 
@@ -34,4 +35,8 @@ public class AdmRequest {
 	/** 待废弃 */
 	private String uploadFlag;
 
+	@Override
+	public String toString() {
+		return JSON.toJSONString(this);
+	}
 }

+ 24 - 2
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/controller/AdmFileController.java

@@ -3,15 +3,20 @@ package com.persagy.adm.server.custom.controller;
 
 import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.persagy.adm.server.custom.dto.CadFiles;
 import com.persagy.adm.server.custom.entity.CadFileQueryParam;
 import com.persagy.adm.server.custom.entity.db.AdmCad;
 import com.persagy.adm.server.custom.service.IAdmCadService;
+import com.persagy.dmp.common.context.AppContext;
 import com.persagy.dmp.common.model.response.CommonResult;
 import com.persagy.dmp.common.utils.ResultHelper;
 import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -32,8 +37,10 @@ public class AdmFileController {
 
     @PostMapping("/queryCadFiles")
     public CommonResult<List<AdmCad>> queryCadFiles(@RequestBody CadFileQueryParam queryParam){
+        AppContext context = AppContext.getContext();
         Wrapper<AdmCad> eq = new LambdaQueryWrapper<AdmCad>()
-                .eq(StringUtils.isNotBlank(queryParam.getProjectId()), AdmCad::getProjectId, queryParam.getProjectId())
+                .eq(StringUtils.isNotBlank(context.getGroupCode()), AdmCad::getGroupCode, context.getProjectId())
+                .eq(StringUtils.isNotBlank(context.getProjectId()), AdmCad::getProjectId, context.getProjectId())
                 .eq(StringUtils.isNotBlank(queryParam.getBuildingId()),AdmCad::getBuildingId,queryParam.getBuildingId())
                 .eq(StringUtils.isNotBlank(queryParam.getFloorId()),AdmCad::getFloorId,queryParam.getFloorId())
                 .eq(StringUtils.isNotBlank(queryParam.getFileKey()),AdmCad::getFileKey,queryParam.getFileKey())
@@ -45,7 +52,22 @@ public class AdmFileController {
      * 保存CAD文件信息
      */
     @PostMapping("/saveCadFileInfo")
-    public CommonResult<Void> saveCadFileInfo(@RequestBody List<AdmCad> admFiles){
+    public CommonResult<Void> saveCadFileInfo(@RequestBody @Validated CadFiles cadFiles){
+        List<AdmCad> admFiles = new ArrayList<>();
+        AppContext context = AppContext.getContext();
+        cadFiles.getFiles().forEach(file -> {
+            AdmCad admCad = new AdmCad();
+            admCad.setGroupCode(context.getGroupCode());
+            admCad.setProjectId(context.getProjectId());
+            admCad.setBuildingId(cadFiles.getBuildingId());
+            admCad.setFloorId(cadFiles.getFloorId());
+            admCad.setMajorCode(cadFiles.getMajorCode());
+            admCad.setMajorName(cadFiles.getMajorName());
+            admCad.setCheckStatus(false);
+            admCad.setFileKey(file.getFileKey());
+            admCad.setFileName(file.getFileName());
+            admFiles.add(admCad);
+        });
         iAdmCadService.saveOrUpdateBatch(admFiles);
         return ResultHelper.success();
     }

+ 19 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/controller/AppController.java

@@ -1,6 +1,7 @@
 package com.persagy.adm.server.custom.controller;
 
 import cn.hutool.core.util.StrUtil;
+import com.persagy.adm.server.auth.service.AdmAuthService;
 import com.persagy.adm.server.custom.common.AdmRequest;
 import com.persagy.adm.server.custom.datatx.DataTxHandler;
 import com.persagy.adm.server.custom.dto.HasUpdateReq;
@@ -10,10 +11,12 @@ import com.persagy.adm.server.custom.entity.DownLoadData;
 import com.persagy.adm.server.custom.entity.UploadRtn;
 import com.persagy.adm.server.custom.service.ISyncApp;
 import com.persagy.adm.server.custom.service.ServiceUtil;
+import com.persagy.dmp.auth.domain.BossAuthUser;
 import com.persagy.dmp.common.constant.ResponseCode;
 import com.persagy.dmp.common.exception.BusinessException;
 import com.persagy.dmp.common.model.response.CommonResult;
 import com.persagy.dmp.common.utils.ResultHelper;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -30,6 +33,7 @@ import java.util.Map;
  */
 @RestController
 @RequestMapping("/adm")
+@Slf4j
 public class AppController {
 
 	@Autowired
@@ -39,6 +43,9 @@ public class AppController {
 	@Autowired
 	private DataTxHandler dataTxHandler;
 
+	@Autowired
+	private AdmAuthService admAuthService;
+
 	@RequestMapping("/clientId")
 	public CommonResult<Map<String, Object>> clientId(@RequestBody AdmRequest req){
 		HashMap<String, Object> rtn = new HashMap<>();
@@ -48,21 +55,25 @@ public class AppController {
 
 	@RequestMapping("/dict")
 	public CommonResult<Dict> dict(@RequestBody AdmRequest req){
+		req.setUserId(admAuthService.loginInfo().getId());
 		return ResultHelper.single(syncApp.downloadDict(req.getGroupCode(), req.getProjectId(), req.getUserId()));
 	}
 
 	@RequestMapping("/config")
 	public CommonResult<ConfigData> config(@RequestBody AdmRequest req){
+		req.setUserId(admAuthService.loginInfo().getId());
 		return ResultHelper.single(syncApp.downloadConfig(req.getGroupCode(), req.getProjectId(), req.getUserId()));
 	}
 
 	@RequestMapping("/frame")
 	public CommonResult<Map<String, Object>> frame(@RequestBody AdmRequest req){
+		req.setUserId(admAuthService.loginInfo().getId());
 		return ResultHelper.single(syncApp.downloadFrameData(req.getGroupCode(), req.getProjectId(), req.getUserId()));
 	}
 
 	@RequestMapping("/download")
 	public CommonResult<DownLoadData> download(@RequestBody AdmRequest req){
+		req.setUserId(admAuthService.loginInfo().getId());
 		DownLoadData data;
 		if(StrUtil.isNotBlank(req.getBuildingId())) {
 			data = syncApp.downloadBuildingData(req.getGroupCode(), req.getProjectId(), req.getUserId(), req.getClientId(), req.getBuildingId(), req.getBdtpDownloadTs(), req.getAdmDownloadTs());
@@ -77,12 +88,20 @@ public class AppController {
 	 */
 	@RequestMapping("/downloadObjRel")
 	public CommonResult<DownLoadData> downloadObjRel(@RequestBody AdmRequest req){
+		req.setUserId(admAuthService.loginInfo().getId());
 		return ResultHelper.single(syncApp.downloadProjectData(req.getGroupCode(), req.getProjectId(), req.getUserId(), req.getClientId(), req.getBdtpDownloadTs(), req.getAdmDownloadTs()));
 	}
 
+	/**
+	 * 上传离线数据
+	 * @param request
+	 * @return
+	 */
 	@RequestMapping("/upload")
 	public CommonResult<UploadRtn> upload(HttpServletRequest request){
 		AdmRequest admRequest = dataTxHandler.handleRequest(request);
+		BossAuthUser bossAuthUser = admAuthService.loginInfo();
+		log.info("用户:{},上传数据:{}",bossAuthUser,admRequest);
 		return ResultHelper.single(syncApp.uploadData(admRequest.getUploadData(), admRequest.getGroupCode(), admRequest.getProjectId(), admRequest.getUserId(), admRequest.getClientId()));
 	}
 

+ 26 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/dto/CadFiles.java

@@ -0,0 +1,26 @@
+package com.persagy.adm.server.custom.dto;
+
+
+import com.persagy.adm.server.custom.entity.CadFileInfo;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+import java.util.List;
+
+@Data
+public class CadFiles {
+    @NotBlank(message = "floorId不能为空")
+   private String floorId;
+    @NotBlank(message = "buildingId不能为空")
+    private String buildingId;
+    @NotBlank(message = "majorCode不能为空")
+    private String majorCode;
+    @NotBlank(message = "majorName不能为空")
+    private String majorName;
+
+    @NotNull(message = "文件列表不能为空")
+    @Size(min = 0,max = 1000)
+    private List<CadFileInfo> files;
+}

+ 6 - 9
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/entity/CadFileInfo.java

@@ -2,15 +2,12 @@ package com.persagy.adm.server.custom.entity;
 
 import lombok.Data;
 
+import javax.validation.constraints.NotBlank;
+
 @Data
 public class CadFileInfo {
-    private String id;
-    private String fileId;
-    private String projectId;
-    private String buildingId;
-    private String floorId;
-    private String bizType;
-    private String fileType;
-    private String remark;
-    private int orderNum;
+    @NotBlank(message = "fileKey不能为空")
+    private String fileKey;
+    @NotBlank(message = "fileName不能为空")
+    private String fileName;
 }

+ 0 - 4
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/entity/CadFileQueryParam.java

@@ -8,10 +8,6 @@ import lombok.Data;
 @Data
 public class CadFileQueryParam {
     /**
-     * 项目ID
-     */
-    private String projectId;
-    /**
      * 建筑ID
      */
     private String buildingId;

+ 6 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/entity/db/AdmCad.java

@@ -69,6 +69,12 @@ public class AdmCad extends AuditableEntity<AdmCad> implements Serializable {
     private String projectId;
 
     /**
+     * 集团编码
+     */
+    @TableField("group_code")
+    private String groupCode;
+
+    /**
      * 乐观锁时间戳
      */
     @TableField("ts")

+ 16 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/interceptor/AppContextConfig.java

@@ -0,0 +1,16 @@
+package com.persagy.adm.server.custom.interceptor;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
+import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+@Configuration
+public class AppContextConfig implements WebMvcConfigurer {
+
+    @Override
+    public void addInterceptors(InterceptorRegistry registry) {
+        InterceptorRegistration registration = registry.addInterceptor(new AppContextInterceptor());
+        registration.addPathPatterns("/adm/adm-file/**");
+    }
+}

+ 24 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/interceptor/AppContextInterceptor.java

@@ -0,0 +1,24 @@
+package com.persagy.adm.server.custom.interceptor;
+
+import com.persagy.dmp.common.constant.ResponseCode;
+import com.persagy.dmp.common.exception.BusinessException;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.stereotype.Component;
+import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+@Component
+public class AppContextInterceptor extends HandlerInterceptorAdapter {
+
+    @Override
+    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
+        String groupCode = request.getParameter("groupCode");
+        String projectId = request.getParameter("projectId");
+        if(StringUtils.isBlank(groupCode) || StringUtils.isBlank(projectId)){
+            throw new BusinessException(ResponseCode.A0402.getCode(),"groupCode或者projectId为null");
+        }
+        return true;
+    }
+}

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

@@ -1,5 +1,6 @@
 package com.persagy.adm.server.custom.service.impl;
 
+import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.date.DatePattern;
 import cn.hutool.core.date.DateUtil;
@@ -26,12 +27,15 @@ 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.service.impl.check_update.CheckUpdateChain;
+import com.persagy.adm.server.custom.service.impl.check_update.CheckUpdateContext;
 import com.persagy.adm.server.custom.util.DataExtrasUtil;
+import com.persagy.dmp.auth.domain.BossAuthUser;
 import com.persagy.dmp.basic.model.QueryCriteria;
 import com.persagy.dmp.common.constant.ValidEnum;
-import com.persagy.dmp.common.model.response.CommonResult;
 import com.persagy.dmp.digital.client.DigitalObjectClient;
 import com.persagy.dmp.digital.client.DigitalRelationClient;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -40,6 +44,7 @@ import java.sql.Timestamp;
 import java.util.*;
 
 @Service
+@Slf4j
 public class SyncAppImpl implements ISyncApp {
 
 	@Autowired
@@ -446,98 +451,15 @@ public class SyncAppImpl implements ISyncApp {
 	 */
 	@Override
 	public boolean hasUpdate(HasUpdateReq hasUpdateReq) {
-
-		// downloadAdmTs
-		// 1.问题数据最容易变化,优先检查 adm库
-		LambdaQueryWrapper<AdmProblem> hasProblemUpdated = new LambdaQueryWrapper<AdmProblem>().select(AdmProblem::getId)
-				.gt(AdmProblem::getTs, hasUpdateReq.getDownloadAdmTs())
-				.eq(AdmProblem::getGroupCode,hasUpdateReq.getGroupCode())
-				.eq(AdmProblem::getProjectId,hasUpdateReq.getProjectId())
-				.last("limit 1");
-		AdmProblem admProblem = problemMapper.selectOne(hasProblemUpdated);
-		if (admProblem != null){
-			return true;
-		}
-
-		// downloadAdmTs
-		//管道数据,实验方案
-		AdmPipe admPipe = pipeMapper.selectOne(new LambdaQueryWrapper<AdmPipe>().select(AdmPipe::getId).eq(AdmPipe::getProjectId, hasUpdateReq.getProjectId()).gt(AdmPipe::getTs, hasUpdateReq.getDownloadAdmTs()).last("limit 1"));
-		if (admPipe != null){
-			return true;
-		}
-
-		//任务相关数据查询
-		AdmJobSpace jobSpace = jobSpaceMapper.selectOne(new LambdaQueryWrapper<AdmJobSpace>().select(AdmJobSpace::getId).eq(AdmJobSpace::getProjectId,hasUpdateReq.getProjectId()).gt(AdmJobSpace::getTs,hasUpdateReq.getDownloadAdmTs()).last("limit 1"));
-		if (jobSpace != null){
-			return true;
-		}
-
-		// 下载ADM图纸
-		AdmCad admCad = admCadMapper.selectOne(new LambdaQueryWrapper<AdmCad>().select(AdmCad::getId).eq(AdmCad::getProjectId,hasUpdateReq.getProjectId()).gt(AdmCad::getTs,hasUpdateReq.getDownloadAdmTs()).last("limit 1"));
-		if(admCad != null){
-			return true;
-		}
-
-		// 文件附件
-		AdmFile file = fileMapper.selectOne(new LambdaQueryWrapper<AdmFile>().select(AdmFile::getId).eq(AdmFile::getProjectId,hasUpdateReq.getProjectId()).gt(AdmFile::getTs,hasUpdateReq.getDownloadAdmTs()).last("limit 1"));
-		if (file != null){
-			return true;
-		}
-
-		// 二维码
-		AdmQrCode qrCode = qrCodeMapper.selectOne(new LambdaQueryWrapper<AdmQrCode>().select(AdmQrCode::getId).eq(AdmQrCode::getProjectId,hasUpdateReq.getProjectId()).gt(AdmQrCode::getTs,hasUpdateReq.getDownloadAdmTs()).last("limit 1"));
-		if (qrCode != null){
-			return true;
-		}
-
-		// 服务区域
-		AdmServeArea serveArea = serveAreaMapper.selectOne(new LambdaQueryWrapper<AdmServeArea>().select(AdmServeArea::getId).eq(AdmServeArea::getProjectId,hasUpdateReq.getProjectId()).gt(AdmServeArea::getTs,hasUpdateReq.getDownloadAdmTs()).last("limit 1"));
-		if (serveArea != null){
-			return true;
-		}
-
-//		String userId = admAuthService.loginInfo().getId();
-		String userId = "1";
-
-		// downloadBdtpTs
-		// 2.检查对象 bdtp库
-		QueryCriteria criteria = ServiceUtil.getQueryCriteria(objectMapper, AdmConst.OBJ_TYPE_BUILDING, AdmConst.OBJ_TYPE_FLOOR,AdmConst.OBJ_TYPE_SPACE, AdmConst.OBJ_TYPE_SHAFT, AdmConst.OBJ_TYPE_SYSTEM, AdmConst.OBJ_TYPE_EQUIPMENT, "ispace");
-		criteria.setOnlyCount(true);
-		criteria.setWithoutCount(true);
-		criteria.getCriteria().putObject("ts").put("$gt", hasUpdateReq.getDownloadBdtpTs());
-		CommonResult<List<ObjectNode>> query = objectClient.query(hasUpdateReq.getGroupCode(), hasUpdateReq.getProjectId(), AdmConst.APP_ID, userId, criteria);
-		if(query.getCount() > 0){
-			return true;
-		}
-
-		// downloadObjRelTs
-		// 3.检查对象关系
-		// 3.1 app端创建的关系 bdtp库
-		QueryCriteria objRelCriteria = ServiceUtil.getQueryCriteria(objectMapper);
-		objRelCriteria.getCriteria().putObject("ts").put("$gt", hasUpdateReq.getDownLoadObjRelTs());
-		objRelCriteria.getCriteria().put("createApp", AdmConst.CREATOR_APP);
-		objRelCriteria.setOnlyCount(true);
-		objRelCriteria.setWithoutCount(true);
-		CommonResult<List<ObjectNode>> objRelResult = rwdClient.queryRelation(hasUpdateReq.getGroupCode(), hasUpdateReq.getProjectId(), AdmConst.APP_ID, userId, objRelCriteria);
-		if (objRelResult.getCount() > 0){
-			return true;
-		}
-
-		// 3.2 元空间和空间的对应关系 bdtp库
-		QueryCriteria objRelCriteria2 = ServiceUtil.getQueryCriteria(objectMapper);
-		objRelCriteria2.setOnlyCount(true);
-		objRelCriteria2.setWithoutCount(true);
-		objRelCriteria2.getCriteria().put("graphCode", "MechInArch").put("relCode", "Sp2Si").put("relValue", "GeneralZone").putObject("ts").put("$gt",hasUpdateReq.getDownLoadObjRelTs());
-		CommonResult<List<ObjectNode>> objRelResult2 = rwdClient.queryRelation(hasUpdateReq.getGroupCode(), hasUpdateReq.getProjectId(), AdmConst.APP_ID, userId, objRelCriteria2);
-		if (objRelResult2.getCount() > 0){
-			return true;
-		}
-
-		return false;
+		CheckUpdateContext context = new CheckUpdateContext();
+		BeanUtil.copyProperties(hasUpdateReq,context);
+		BossAuthUser bossAuthUser = admAuthService.loginInfo();
+		log.info("获取到用户信息:{}",bossAuthUser);
+		context.setUserId(bossAuthUser.getId());
+		return checkUpdateChain.doCheck(context);
 	}
-
-	private AdmM2dEquipMapper m2dEquipMapper;
-
+	@Autowired
+	CheckUpdateChain checkUpdateChain;
 	private void autoRelations(List<ObjectNode> newObjs, List<ObjectNode> relations, UploadParams ps){
 		for(ObjectNode obj : newObjs) {
 			if (obj.get("objType") != null && AdmConst.OBJ_TYPE_EQUIPMENT.equals(obj.get("objType").asText())) {

+ 23 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/AdmCadCheckUpdate.java

@@ -0,0 +1,23 @@
+package com.persagy.adm.server.custom.service.impl.check_update;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.persagy.adm.server.custom.dao.AdmCadMapper;
+import com.persagy.adm.server.custom.entity.db.AdmCad;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * 检查CAD图纸数据有无更新
+ */
+@Component
+@Slf4j
+public class AdmCadCheckUpdate implements CheckUpdate{
+    @Autowired
+    AdmCadMapper admCadMapper;
+    @Override
+    public boolean doCheck(CheckUpdateContext hasUpdateReq) {
+        log.info("开始检查CAD图纸是否有更新");
+        return admCadMapper.selectOne(new LambdaQueryWrapper<AdmCad>().select(AdmCad::getId).eq(AdmCad::getProjectId, hasUpdateReq.getProjectId()).gt(AdmCad::getTs, hasUpdateReq.getDownloadAdmTs()).last("limit 1")) != null;
+    }
+}

+ 23 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/AdmFileCheckUpdate.java

@@ -0,0 +1,23 @@
+package com.persagy.adm.server.custom.service.impl.check_update;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.persagy.adm.server.custom.dao.AdmFileMapper;
+import com.persagy.adm.server.custom.entity.db.AdmFile;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * 检查文件附件数据是否有更新
+ */
+@Component
+@Slf4j
+public class AdmFileCheckUpdate implements CheckUpdate{
+    @Autowired
+    AdmFileMapper fileMapper;
+    @Override
+    public boolean doCheck(CheckUpdateContext hasUpdateReq) {
+        log.info("开始检查文件附件数据是否有更新");
+        return fileMapper.selectOne(new LambdaQueryWrapper<AdmFile>().select(AdmFile::getId).eq(AdmFile::getProjectId, hasUpdateReq.getProjectId()).gt(AdmFile::getTs, hasUpdateReq.getDownloadAdmTs()).last("limit 1")) != null;
+    }
+}

+ 24 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/AdmJobSpaceCheckUpdate.java

@@ -0,0 +1,24 @@
+package com.persagy.adm.server.custom.service.impl.check_update;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.persagy.adm.server.custom.dao.AdmJobSpaceMapper;
+import com.persagy.adm.server.custom.entity.db.AdmJobSpace;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * 检查任务数据是否有更新
+ */
+@Component
+@Slf4j
+public class AdmJobSpaceCheckUpdate implements CheckUpdate{
+    @Autowired
+    private AdmJobSpaceMapper jobSpaceMapper;
+
+    @Override
+    public boolean doCheck(CheckUpdateContext hasUpdateReq) {
+        log.info("开始检查任务数据是否有更新");
+        return jobSpaceMapper.selectOne(new LambdaQueryWrapper<AdmJobSpace>().select(AdmJobSpace::getId).eq(AdmJobSpace::getProjectId, hasUpdateReq.getProjectId()).gt(AdmJobSpace::getTs, hasUpdateReq.getDownloadAdmTs()).last("limit 1")) != null;
+    }
+}

+ 25 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/AdmPipeCheckUpdate.java

@@ -0,0 +1,25 @@
+package com.persagy.adm.server.custom.service.impl.check_update;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.persagy.adm.server.custom.dao.AdmPipeMapper;
+import com.persagy.adm.server.custom.entity.db.AdmPipe;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * 检查管道数据是否有更新
+ */
+@Component
+@Slf4j
+public class AdmPipeCheckUpdate implements CheckUpdate{
+
+    @Autowired
+    private AdmPipeMapper pipeMapper;
+
+    @Override
+    public boolean doCheck(CheckUpdateContext hasUpdateReq) {
+        log.info("检查管道数据是否有更新");
+        return pipeMapper.selectOne(new LambdaQueryWrapper<AdmPipe>().select(AdmPipe::getId).eq(AdmPipe::getProjectId, hasUpdateReq.getProjectId()).gt(AdmPipe::getTs, hasUpdateReq.getDownloadAdmTs()).last("limit 1")) != null;
+    }
+}

+ 30 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/AdmProblemCheckUpdate.java

@@ -0,0 +1,30 @@
+package com.persagy.adm.server.custom.service.impl.check_update;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.persagy.adm.server.custom.dao.AdmProblemMapper;
+import com.persagy.adm.server.custom.entity.db.AdmProblem;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * 检查核查问题数据是否有更新
+ */
+@Component
+@Slf4j
+public class AdmProblemCheckUpdate implements CheckUpdate{
+
+    @Autowired
+    AdmProblemMapper problemMapper;
+
+    @Override
+    public boolean doCheck(CheckUpdateContext hasUpdateReq) {
+        log.info("检查核查问题数据是否有更新");
+        LambdaQueryWrapper<AdmProblem> hasProblemUpdated = new LambdaQueryWrapper<AdmProblem>().select(AdmProblem::getId)
+                .gt(AdmProblem::getTs, hasUpdateReq.getDownloadAdmTs())
+                .eq(AdmProblem::getGroupCode, hasUpdateReq.getGroupCode())
+                .eq(AdmProblem::getProjectId, hasUpdateReq.getProjectId())
+                .last("limit 1");
+        return problemMapper.selectOne(hasProblemUpdated) != null;
+    }
+}

+ 23 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/AdmQrCodeCheckUpdate.java

@@ -0,0 +1,23 @@
+package com.persagy.adm.server.custom.service.impl.check_update;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.persagy.adm.server.custom.dao.AdmQrCodeMapper;
+import com.persagy.adm.server.custom.entity.db.AdmQrCode;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * 检查二维码数据是否有更新
+ */
+@Component
+@Slf4j
+public class AdmQrCodeCheckUpdate implements CheckUpdate {
+    @Autowired
+    AdmQrCodeMapper qrCodeMapper;
+    @Override
+    public boolean doCheck(CheckUpdateContext hasUpdateReq) {
+        log.info("开始检查二维码数据是否有更新");
+        return qrCodeMapper.selectOne(new LambdaQueryWrapper<AdmQrCode>().select(AdmQrCode::getId).eq(AdmQrCode::getProjectId, hasUpdateReq.getProjectId()).gt(AdmQrCode::getTs, hasUpdateReq.getDownloadAdmTs()).last("limit 1")) != null;
+    }
+}

+ 23 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/AdmServerAreaCheckUpdate.java

@@ -0,0 +1,23 @@
+package com.persagy.adm.server.custom.service.impl.check_update;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.persagy.adm.server.custom.dao.AdmServeAreaMapper;
+import com.persagy.adm.server.custom.entity.db.AdmServeArea;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * 检查服务区域是否有数据更新
+ */
+@Component
+@Slf4j
+public class AdmServerAreaCheckUpdate implements CheckUpdate{
+    @Autowired
+    AdmServeAreaMapper serverAreaMapper;
+    @Override
+    public boolean doCheck(CheckUpdateContext hasUpdateReq) {
+        log.info("开始检查检查服务区域是否有数据更新");
+        return serverAreaMapper.selectOne(new LambdaQueryWrapper<AdmServeArea>().select(AdmServeArea::getId).eq(AdmServeArea::getProjectId, hasUpdateReq.getProjectId()).gt(AdmServeArea::getTs, hasUpdateReq.getDownloadAdmTs()).last("limit 1")) != null;
+    }
+}

+ 45 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/BdtpObjRelCreateByAppCheckUpdate.java

@@ -0,0 +1,45 @@
+package com.persagy.adm.server.custom.service.impl.check_update;
+
+import com.esotericsoftware.kryo.util.ObjectMap;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.persagy.adm.server.custom.client.RwdClient;
+import com.persagy.adm.server.custom.common.AdmConst;
+import com.persagy.adm.server.custom.service.ServiceUtil;
+import com.persagy.dmp.basic.model.QueryCriteria;
+import com.persagy.dmp.common.constant.ResponseCode;
+import com.persagy.dmp.common.model.response.CommonResult;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * 检查app端创建的关系有无更新
+ */
+@Component
+@Slf4j
+public class BdtpObjRelCreateByAppCheckUpdate implements CheckUpdate{
+    @Autowired
+    ObjectMapper objectMapper;
+    @Autowired
+    RwdClient rwdClient;
+    @Override
+    public boolean doCheck(CheckUpdateContext hasUpdateReq) {
+        try{
+            log.info("开始检查app端创建的关系有无更新");
+            QueryCriteria objRelCriteria = ServiceUtil.getQueryCriteria(objectMapper);
+            objRelCriteria.getCriteria().putObject("ts").put("$gt", hasUpdateReq.getDownLoadObjRelTs());
+            objRelCriteria.getCriteria().put("createApp", AdmConst.CREATOR_APP);
+            objRelCriteria.setOnlyCount(true);
+            objRelCriteria.setWithoutCount(true);
+            CommonResult<List<ObjectNode>> query = rwdClient.queryRelation(hasUpdateReq.getGroupCode(), hasUpdateReq.getProjectId(), AdmConst.APP_ID, hasUpdateReq.getUserId(), objRelCriteria);
+            return query != null && ResponseCode.A00000.getCode().equals(query.getResult()) && query.getCount() > 0;
+        }catch (Exception e){
+            log.error("检查app端创建的关系数据时异常",e);
+            return false;
+        }
+
+    }
+}

+ 43 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/BdtpObjectCheckUpdate.java

@@ -0,0 +1,43 @@
+package com.persagy.adm.server.custom.service.impl.check_update;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.persagy.adm.server.custom.common.AdmConst;
+import com.persagy.adm.server.custom.service.ServiceUtil;
+import com.persagy.dmp.basic.model.QueryCriteria;
+import com.persagy.dmp.common.constant.ResponseCode;
+import com.persagy.dmp.common.model.response.CommonResult;
+import com.persagy.dmp.digital.client.DigitalObjectClient;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * 检查对象数据是否有更新
+ */
+@Component
+@Slf4j
+public class BdtpObjectCheckUpdate implements CheckUpdate{
+    @Autowired
+    ObjectMapper objectMapper;
+    @Autowired
+    private DigitalObjectClient objectClient;
+    @Override
+    public boolean doCheck(CheckUpdateContext hasUpdateReq) {
+        try{
+            log.info("检查对象数据是否有更新");
+            QueryCriteria criteria = ServiceUtil.getQueryCriteria(objectMapper, AdmConst.OBJ_TYPE_BUILDING, AdmConst.OBJ_TYPE_FLOOR,AdmConst.OBJ_TYPE_SPACE, AdmConst.OBJ_TYPE_SHAFT, AdmConst.OBJ_TYPE_SYSTEM, AdmConst.OBJ_TYPE_EQUIPMENT, "ispace");
+            criteria.setOnlyCount(true);
+            criteria.setWithoutCount(true);
+            criteria.getCriteria().putObject("ts").put("$gt", hasUpdateReq.getDownloadBdtpTs());
+            CommonResult<List<ObjectNode>> query = objectClient.query(hasUpdateReq.getGroupCode(), hasUpdateReq.getProjectId(), AdmConst.APP_ID, hasUpdateReq.getUserId(), criteria);
+            return query != null && ResponseCode.A00000.getCode().equals(query.getResult()) && query.getCount() > 0;
+        }catch (Exception e){
+            log.error("检查对象数据是否有更新时异常",e);
+            return false;
+        }
+
+    }
+}

+ 5 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/CheckUpdate.java

@@ -0,0 +1,5 @@
+package com.persagy.adm.server.custom.service.impl.check_update;
+
+public interface CheckUpdate {
+    boolean doCheck(CheckUpdateContext hasUpdateReq);
+}

+ 68 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/CheckUpdateChain.java

@@ -0,0 +1,68 @@
+package com.persagy.adm.server.custom.service.impl.check_update;
+
+import org.apache.commons.compress.utils.Lists;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.PostConstruct;
+import java.util.List;
+@Component
+public class CheckUpdateChain{
+    @Autowired
+    AdmProblemCheckUpdate admProblemCheck;
+    @Autowired
+    AdmPipeCheckUpdate admPipeCheckUpdate;
+    @Autowired
+    AdmJobSpaceCheckUpdate admJobSpaceCheckUpdate;
+    @Autowired
+    AdmCadCheckUpdate admCadCheckUpdate;
+    @Autowired
+    AdmFileCheckUpdate admFileCheckUpdate;
+    @Autowired
+    AdmQrCodeCheckUpdate admQrCodeCheckUpdate;
+    @Autowired
+    AdmServerAreaCheckUpdate admServerAreaCheckUpdate;
+    @Autowired
+    BdtpObjectCheckUpdate bdtpObjectCheckUpdate;
+    @Autowired
+    BdtpObjRelCreateByAppCheckUpdate bdtpObjRelCreateByAppCheckUpdate;
+    @Autowired
+    MetaSpaceObjRelCheckUpdate metaSpaceObjRelCheckUpdate;
+
+
+    static List<CheckUpdate> checkUpdates;
+
+    @PostConstruct
+    public void init(){
+        checkUpdates = Lists.newArrayList();
+        // 核查问题
+        checkUpdates.add(admProblemCheck);
+        // 管道数据
+        checkUpdates.add(admPipeCheckUpdate);
+        // 任务数据
+        checkUpdates.add(admJobSpaceCheckUpdate);
+        // cad图纸
+        checkUpdates.add(admCadCheckUpdate);
+        // 文件附件
+        checkUpdates.add(admFileCheckUpdate);
+        // 二维码
+        checkUpdates.add(admQrCodeCheckUpdate);
+        // 服务区域
+        checkUpdates.add(admServerAreaCheckUpdate);
+        // 对象数据
+        checkUpdates.add(bdtpObjectCheckUpdate);
+        // app端创建关系数据
+        checkUpdates.add(bdtpObjRelCreateByAppCheckUpdate);
+        // 元空间关系数据
+        checkUpdates.add(metaSpaceObjRelCheckUpdate);
+    }
+
+    public boolean doCheck(CheckUpdateContext hasUpdateReq) {
+        for (CheckUpdate checkUpdate : checkUpdates){
+            if (checkUpdate.doCheck(hasUpdateReq)){
+                return true;
+            }
+        }
+        return false;
+    }
+}

+ 9 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/CheckUpdateContext.java

@@ -0,0 +1,9 @@
+package com.persagy.adm.server.custom.service.impl.check_update;
+
+import com.persagy.adm.server.custom.dto.HasUpdateReq;
+import lombok.Data;
+
+@Data
+public class CheckUpdateContext extends HasUpdateReq {
+    private String userId;
+}

+ 39 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/MetaSpaceObjRelCheckUpdate.java

@@ -0,0 +1,39 @@
+package com.persagy.adm.server.custom.service.impl.check_update;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.persagy.adm.server.custom.client.RwdClient;
+import com.persagy.adm.server.custom.common.AdmConst;
+import com.persagy.adm.server.custom.service.ServiceUtil;
+import com.persagy.dmp.basic.model.QueryCriteria;
+import com.persagy.dmp.common.constant.ResponseCode;
+import com.persagy.dmp.common.model.response.CommonResult;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * 检查更新:元空间和空间的对应关系 bdtp库
+ */
+@Component
+@Slf4j
+public class MetaSpaceObjRelCheckUpdate implements CheckUpdate{
+    @Autowired
+    RwdClient rwdClient;
+
+    @Autowired
+    ObjectMapper objectMapper;
+
+    @Override
+    public boolean doCheck(CheckUpdateContext hasUpdateReq) {
+        log.info("开始检查元空间和空间的对应关系是否有更新");
+        QueryCriteria objRelCriteria2 = ServiceUtil.getQueryCriteria(objectMapper);
+        objRelCriteria2.setOnlyCount(true);
+        objRelCriteria2.setWithoutCount(true);
+        objRelCriteria2.getCriteria().put("graphCode", "MechInArch").put("relCode", "Sp2Si").put("relValue", "GeneralZone").putObject("ts").put("$gt", hasUpdateReq.getDownLoadObjRelTs());
+        CommonResult<List<ObjectNode>> query = rwdClient.queryRelation(hasUpdateReq.getGroupCode(), hasUpdateReq.getProjectId(), AdmConst.APP_ID, hasUpdateReq.getUserId(), objRelCriteria2);
+        return query != null && ResponseCode.A00000.getCode().equals(query.getResult()) && query.getCount() > 0;
+    }
+}

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 124 - 207
adm-business/adm-server/src/main/resources/db/init/data.sql


+ 1 - 0
adm-business/adm-server/src/main/resources/db/init/schema.sql

@@ -8,6 +8,7 @@ CREATE TABLE IF NOT EXISTS `adm_cad`  (
   `floor_id` varchar(255) NOT NULL COMMENT '楼层ID',
   `building_id` varchar(255) NOT NULL COMMENT '建筑ID',
   `project_id` varchar(255) NOT NULL COMMENT '项目ID',
+  `group_code` varchar(255) NOT NULL COMMENT '集团编码',
   `creator` varchar(32) NULL DEFAULT NULL COMMENT '创建人',
   `creation_time` char(14) NULL DEFAULT NULL COMMENT '创建时间',
   `modifier` varchar(32) NULL DEFAULT NULL COMMENT '最后修改人',