Procházet zdrojové kódy

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

lijie před 3 roky
rodič
revize
6881853498
92 změnil soubory, kde provedl 2358 přidání a 564 odebrání
  1. 63 0
      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. 5 0
      adm-business/adm-server/pom.xml
  39. 0 70
      adm-business/adm-server/src/main/java/com/persagy/adm/server/algorithm/domain/DeliverPlanVo.java
  40. 0 32
      adm-business/adm-server/src/main/java/com/persagy/adm/server/algorithm/service/impl/AdmDeliverPlanServiceImpl.java
  41. 5 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/common/AdmRequest.java
  42. 24 2
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/controller/AdmFileController.java
  43. 19 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/controller/AppController.java
  44. 25 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/dto/CadFiles.java
  45. 6 9
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/entity/CadFileInfo.java
  46. 0 4
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/entity/CadFileQueryParam.java
  47. 6 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/entity/db/AdmCad.java
  48. 23 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/enums/MajorEnum.java
  49. 16 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/interceptor/AppContextConfig.java
  50. 24 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/interceptor/AppContextInterceptor.java
  51. 14 92
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/SyncAppImpl.java
  52. 23 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/AdmCadCheckUpdate.java
  53. 23 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/AdmFileCheckUpdate.java
  54. 24 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/AdmJobSpaceCheckUpdate.java
  55. 25 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/AdmPipeCheckUpdate.java
  56. 30 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/AdmProblemCheckUpdate.java
  57. 23 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/AdmQrCodeCheckUpdate.java
  58. 23 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/AdmServerAreaCheckUpdate.java
  59. 45 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/BdtpObjRelCreateByAppCheckUpdate.java
  60. 43 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/BdtpObjectCheckUpdate.java
  61. 5 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/CheckUpdate.java
  62. 68 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/CheckUpdateChain.java
  63. 9 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/CheckUpdateContext.java
  64. 39 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/MetaSpaceObjRelCheckUpdate.java
  65. 19 10
      adm-business/adm-server/src/main/java/com/persagy/adm/server/algorithm/controller/AdmDeliverPlanController.java
  66. 16 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/delivery/dao/AdmProjectInitTaskMapper.java
  67. 13 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/delivery/dao/BossProjectDeliveryPlanMapper.java
  68. 12 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/delivery/dao/BossSkuDictRelMapper.java
  69. 36 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/delivery/entity/BossProjectDeliveryPlan.java
  70. 28 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/delivery/entity/BossSkuDictRel.java
  71. 10 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/delivery/entity/ProjectInitTaskVo.java
  72. 4 4
      adm-business/adm-server/src/main/java/com/persagy/adm/server/algorithm/service/AdmDeliverPlanService.java
  73. 11 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/delivery/service/AdmProjectInitTaskService.java
  74. 29 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/delivery/service/BossProjectDeliveryPlanService.java
  75. 21 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/delivery/service/BossSkuDictRelService.java
  76. 118 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/delivery/service/impl/AdmDeliverPlanServiceImpl.java
  77. 15 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/delivery/service/impl/AdmProjectInitTaskServiceImpl.java
  78. 48 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/delivery/service/impl/BossProjectDeliveryPlanServiceImpl.java
  79. 32 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/delivery/service/impl/BossSkuDictRelServiceImpl.java
  80. 124 207
      adm-business/adm-server/src/main/resources/db/init/data.sql
  81. 32 0
      adm-business/adm-server/src/main/resources/db/init/schema.sql
  82. 40 0
      adm-comp/adm-steward-starter/pom.xml
  83. 30 0
      adm-comp/adm-steward-starter/src/main/java/com/persagy/adm/steward/basic/config/StewardEncodeInterceptor.java
  84. 51 0
      adm-comp/adm-steward-starter/src/main/java/com/persagy/adm/steward/basic/config/StewardFeignConfig.java
  85. 13 0
      adm-comp/adm-steward-starter/src/main/java/com/persagy/adm/steward/basic/constant/CommonConstants.java
  86. 87 0
      adm-comp/adm-steward-starter/src/main/java/com/persagy/adm/steward/basic/model/response/BossResponse.java
  87. 155 0
      adm-comp/adm-steward-starter/src/main/java/com/persagy/adm/steward/basic/utils/RSAUtils.java
  88. 31 0
      adm-comp/adm-steward-starter/src/main/java/com/persagy/adm/steward/entity/ProductFinishNumReq.java
  89. 147 0
      adm-comp/adm-steward-starter/src/main/java/com/persagy/adm/steward/entity/ProjectDeliverReq.java
  90. 4 0
      adm-comp/adm-steward-starter/src/main/resources/application.yml
  91. 19 0
      adm-comp/pom.xml
  92. 1 0
      pom.xml

+ 63 - 0
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,6 +82,21 @@ public class DiagramController {
 
         List<Diagram> diagramList = dataStrategy.getDiagrams(null, projectId,
                 (String) diagram.get("systemId"), groupCode, null, false);
+        //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);
+                }
+            });
+        }
 
         return diagramManager.json4View(ResultHelper.multi(diagramList));
     }
@@ -95,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);
 
@@ -220,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 是否成功
@@ -231,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;
+    }
 }

+ 5 - 0
adm-business/adm-server/pom.xml

@@ -42,5 +42,10 @@
             <artifactId>jts-core</artifactId>
             <version>1.16.1</version>
         </dependency>
+        <dependency>
+            <groupId>com.persagy</groupId>
+            <artifactId>adm-steward-starter</artifactId>
+            <version>1.0.0</version>
+        </dependency>
     </dependencies>
 </project>

+ 0 - 70
adm-business/adm-server/src/main/java/com/persagy/adm/server/algorithm/domain/DeliverPlanVo.java

@@ -1,70 +0,0 @@
-package com.persagy.adm.server.algorithm.domain;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-import lombok.Data;
-
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotEmpty;
-import java.util.Date;
-import java.util.Set;
-
-/**
- * 交付计划VO类
- * @author : lijie
- * Update By 2022/1/14 16:26
- */
-@Data
-public class DeliverPlanVo {
-    /**
-     * 交付计划总id
-     * @mock @string(8)
-     * */
-    @NotBlank
-    private String deliverPlanMasterId;
-    /**
-     * 交付计划id
-     * @mock @string(8)
-     * */
-    @NotBlank
-    private String deliverPlanId;
-    /**
-     * 交付计划名称
-     * @mock @string(8)
-     * */
-    @NotBlank
-    private String deliverPlanName;
-
-    /**商品编码集合*/
-    @NotEmpty
-    private Set<String> skuCodes;
-    /**
-     * 数量
-     * @mock @natural(0,10000)
-     * */
-    private Integer number;
-    /**
-     * 开始时间,时间戳格式
-     * @mock @timestamp
-     * */
-    private Long startTime;
-    /**
-     * 结束时间,时间戳格式
-     * @mock @timestamp
-     * */
-    private Long endTime;
-    /**
-     * 项目id
-     * @mock @string(8)
-     * */
-    private String itemId;
-    /**
-     * 项目名称
-     * @mock @string(8)
-     * */
-    private String itemName;
-    /**
-     * 创建人名称:管家名称
-     * @mock @string(5)
-     * */
-    private String creator;
-}

+ 0 - 32
adm-business/adm-server/src/main/java/com/persagy/adm/server/algorithm/service/impl/AdmDeliverPlanServiceImpl.java

@@ -1,32 +0,0 @@
-package com.persagy.adm.server.algorithm.service.impl;
-
-import com.persagy.adm.server.algorithm.domain.DeliverPlanVo;
-import com.persagy.adm.server.algorithm.service.AdmDeliverPlanService;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Service;
-
-@Slf4j
-@Service
-@RequiredArgsConstructor
-public class AdmDeliverPlanServiceImpl implements AdmDeliverPlanService {
-
-    /**
-     * 处理BOSS产生的交付计划
-     * @param deliverPlanVo : 交付计划信息
-     * @author : lijie
-     * Update By 2022/1/14 17:22
-     */
-    @Override
-    public void relayDeliverPlan(DeliverPlanVo deliverPlanVo) {
-        // 1.根据商品code与项目任务模板的映射数据与规则生成项目任务数据
-        // 2.调用dmp-rwd服务根据商品code生成交付范围
-    }
-
-
-
-
-
-
-
-}

+ 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.enums.MajorEnum;
 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.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(MajorEnum.getComment(cadFiles.getMajorCode()));
+            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()));
 	}
 

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

@@ -0,0 +1,25 @@
+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.Pattern;
+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不能为空")
+    @Pattern(regexp =  "CF|AC|WS|FF",message = "majorCode不正确")
+    private String majorCode;
+    @NotNull(message = "文件列表不能为空")
+    @Size(min = 1,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")

+ 23 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/enums/MajorEnum.java

@@ -0,0 +1,23 @@
+package com.persagy.adm.server.custom.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+@AllArgsConstructor
+@Getter
+public enum MajorEnum {
+    CF("CF","土建精装"),AC("AC","空调"),WS("WS","给排水"),FF("FF","消防");
+    private String code;
+    private String comment;
+
+    public static String getComment(String code) {
+        switch (code){
+            case "CF": return CF.getComment();
+            case "AC": return AC.getComment();
+            case "WS": return WS.getComment();
+            case "FF": return FF.getComment();
+        }
+
+        return null;
+    }
+}

+ 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;
+    }
+}

+ 19 - 10
adm-business/adm-server/src/main/java/com/persagy/adm/server/algorithm/controller/AdmDeliverPlanController.java

@@ -1,14 +1,14 @@
-package com.persagy.adm.server.algorithm.controller;
+package com.persagy.adm.server.delivery.controller;
 
-import com.persagy.adm.server.algorithm.domain.DeliverPlanVo;
-import com.persagy.adm.server.algorithm.domain.ModelFileVo;
-import com.persagy.adm.server.algorithm.domain.QueryModelFileVo;
-import com.persagy.adm.server.algorithm.service.AdmDeliverPlanService;
-import com.persagy.adm.server.algorithm.service.AdmModelService;
+import com.alibaba.fastjson.JSONObject;
+import com.persagy.adm.server.delivery.service.AdmDeliverPlanService;
+import com.persagy.adm.steward.basic.utils.RSAUtils;
+import com.persagy.adm.steward.entity.ProjectDeliverReq;
 import com.persagy.dmp.common.model.response.CommonResult;
 import com.persagy.dmp.common.utils.ResultHelper;
 import lombok.RequiredArgsConstructor;
-import org.springframework.validation.annotation.Validated;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -26,21 +26,30 @@ import java.util.List;
 @RestController
 @RequestMapping("/deliver/plan")
 @RequiredArgsConstructor
+@Slf4j
 public class AdmDeliverPlanController {
 
     private final AdmDeliverPlanService admDeliverPlanService;
 
+    @Value("${adm.rsa.privateKey}")
+    private String privateKey;
+
     /**
      * 020101-交付计划-处理BOSS产生的交付计划
-     * @param deliverPlanVo : 交付计划信息
+     * @param projectDeliverReqStr : 交付计划信息
      * @return : com.persagy.dmp.common.model.response.CommonResult<java.util.List<java.lang.Void>>
      * @author : lijie
      * Update By 2022/1/14 17:22
      */
     @PostMapping(value = "/relayDeliverPlan")
-    public CommonResult<List<Void>> relayDeliverPlan(@Validated @RequestBody DeliverPlanVo deliverPlanVo) {
-        admDeliverPlanService.relayDeliverPlan(deliverPlanVo);
+    public CommonResult<List<Void>> relayDeliverPlan(@RequestBody String projectDeliverReqStr) {
+        //todo 测试
+        String decode = RSAUtils.decode(projectDeliverReqStr, privateKey);
+        log.info("接受BOSS产生的交付计划入参:{}"+decode);
+        ProjectDeliverReq projectDeliverReq = JSONObject.parseObject(decode, ProjectDeliverReq.class);
+        admDeliverPlanService.relayDeliverPlan(projectDeliverReq);
         return ResultHelper.multi(new ArrayList<>());
     }
 
+
 }

+ 16 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/delivery/dao/AdmProjectInitTaskMapper.java

@@ -0,0 +1,16 @@
+package com.persagy.adm.server.delivery.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.persagy.adm.server.algorithm.entity.AdmProject;
+import com.persagy.adm.server.delivery.entity.ProjectInitTaskVo;
+
+/**
+ * 项目初始化任务 DAO
+ */
+public interface AdmProjectInitTaskMapper extends BaseMapper<ProjectInitTaskVo> {
+
+}
+
+
+
+

+ 13 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/delivery/dao/BossProjectDeliveryPlanMapper.java

@@ -0,0 +1,13 @@
+package com.persagy.adm.server.delivery.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.persagy.adm.server.delivery.entity.BossProjectDeliveryPlan;
+
+/**
+ * BOSS项目交付计划
+ * @author:linhuili
+ * @date:2022/1/22
+ */
+public interface BossProjectDeliveryPlanMapper  extends BaseMapper<BossProjectDeliveryPlan> {
+
+}

+ 12 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/delivery/dao/BossSkuDictRelMapper.java

@@ -0,0 +1,12 @@
+package com.persagy.adm.server.delivery.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.persagy.adm.server.delivery.entity.BossSkuDictRel;
+
+/**
+ *  BOSS商品-BDTP类型映射关系 DTO
+ * @author:linhuili
+ * @date:2022/1/19
+ */
+public interface BossSkuDictRelMapper extends BaseMapper<BossSkuDictRel> {
+}

+ 36 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/delivery/entity/BossProjectDeliveryPlan.java

@@ -0,0 +1,36 @@
+package com.persagy.adm.server.delivery.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.persagy.dmp.common.model.entity.AuditableEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * BOOS项目交付计划
+ * @author:linhuili
+ * @date:2022/1/19
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName(value = "boss_project_delivery_plan", autoResultMap = true)
+public class BossProjectDeliveryPlan extends AuditableEntity {
+
+    /** 项目ID */
+    private Long projectId;
+
+    /** 计划Id */
+    private Long planId;
+
+    /** 验收商品id */
+    private Long planInfoId;
+
+    /** 商品编码 */
+    private String productSkuCode;
+
+    /** 商品对应的实施数量 */
+    private Long productNum;
+
+    /** 管家账号 */
+    private String stewardAccount;
+
+}

+ 28 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/delivery/entity/BossSkuDictRel.java

@@ -0,0 +1,28 @@
+package com.persagy.adm.server.delivery.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.persagy.dmp.common.model.entity.AuditableEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * Description
+ *
+ * @author:linhuili
+ * @date:2022/1/19
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName(value = "boss_sku_dict_rel", autoResultMap = true)
+public class BossSkuDictRel extends AuditableEntity {
+
+    /** 商品编码 */
+    private String skuCode;
+
+    /** 类型编码 */
+    private String classCode;
+
+    /** 对象类型 */
+    private String objType;
+
+}

+ 10 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/delivery/entity/ProjectInitTaskVo.java

@@ -0,0 +1,10 @@
+package com.persagy.adm.server.delivery.entity;
+
+/**
+ * 项目初始化任务VO
+ * @author:linhuili
+ * @date:2022/1/20
+ */
+public class ProjectInitTaskVo {
+
+}

+ 4 - 4
adm-business/adm-server/src/main/java/com/persagy/adm/server/algorithm/service/AdmDeliverPlanService.java

@@ -1,6 +1,6 @@
-package com.persagy.adm.server.algorithm.service;
+package com.persagy.adm.server.delivery.service;
 
-import com.persagy.adm.server.algorithm.domain.DeliverPlanVo;
+import com.persagy.adm.steward.entity.ProjectDeliverReq;
 
 /**
  * 对接BOSS的交付计划逻辑处理接口
@@ -10,9 +10,9 @@ import com.persagy.adm.server.algorithm.domain.DeliverPlanVo;
 public interface AdmDeliverPlanService {
     /**
      * 处理BOSS产生的交付计划
-     * @param deliverPlanVo : 交付计划信息
+     * @param projectDeliverReq : 交付计划信息
      * @author : lijie
      * Update By 2022/1/14 17:22
      */
-    void relayDeliverPlan(DeliverPlanVo deliverPlanVo);
+    void relayDeliverPlan(ProjectDeliverReq projectDeliverReq);
 }

+ 11 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/delivery/service/AdmProjectInitTaskService.java

@@ -0,0 +1,11 @@
+package com.persagy.adm.server.delivery.service;
+
+/**
+ * BOSS订单:项目初始化任务
+ *
+ * @author:linhuili
+ * @date:2022/1/20
+ */
+public interface AdmProjectInitTaskService {
+
+}

+ 29 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/delivery/service/BossProjectDeliveryPlanService.java

@@ -0,0 +1,29 @@
+package com.persagy.adm.server.delivery.service;
+
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.persagy.adm.server.delivery.entity.BossProjectDeliveryPlan;
+import com.persagy.adm.server.delivery.entity.BossSkuDictRel;
+import com.persagy.dmp.delivery.entity.ObjectInfoCollect;
+
+import java.util.List;
+
+/**
+ * BOSS项目交付计划
+ * @author:linhuili
+ * @date:2022/1/22
+ */
+public interface BossProjectDeliveryPlanService {
+    /**
+     * 条件查询BOSS交付计划
+     * @param queryWrapper 查询条件
+     * @return 返回结果
+     */
+    List<BossProjectDeliveryPlan> queryByCondition(Wrapper<BossProjectDeliveryPlan> queryWrapper);
+
+    /**
+     * 新增
+     * @param voList 待新增数据
+     * @return 新增后数据
+     */
+    List<BossProjectDeliveryPlan> insert(List<BossProjectDeliveryPlan> voList);
+}

+ 21 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/delivery/service/BossSkuDictRelService.java

@@ -0,0 +1,21 @@
+package com.persagy.adm.server.delivery.service;
+
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.persagy.adm.server.delivery.entity.BossSkuDictRel;
+
+import java.util.List;
+
+/**
+ * BOSS商品-BDTP类型映射关系
+ * @author:linhuili
+ * @date:2022/1/19
+ */
+public interface BossSkuDictRelService {
+
+    /**
+     * 条件查询BOSS-BDTP商品映射关系
+     * @param queryWrapper 查询条件
+     * @return 返回结果
+     */
+    List<BossSkuDictRel> queryByCondition(Wrapper<BossSkuDictRel> queryWrapper);
+}

+ 118 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/delivery/service/impl/AdmDeliverPlanServiceImpl.java

@@ -0,0 +1,118 @@
+package com.persagy.adm.server.delivery.service.impl;
+
+import cn.hutool.core.collection.CollUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.persagy.adm.server.delivery.entity.BossProjectDeliveryPlan;
+import com.persagy.adm.server.delivery.entity.BossSkuDictRel;
+import com.persagy.adm.server.delivery.service.AdmDeliverPlanService;
+import com.persagy.adm.server.delivery.service.BossProjectDeliveryPlanService;
+import com.persagy.adm.server.delivery.service.BossSkuDictRelService;
+import com.persagy.adm.steward.entity.ProjectDeliverReq;
+import com.persagy.dmp.delivery.client.DigitalObjectTypeCollectFacade;
+import com.persagy.dmp.delivery.dto.DeliveryPlanDTO;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+@Slf4j
+@Service
+@RequiredArgsConstructor
+public class AdmDeliverPlanServiceImpl implements AdmDeliverPlanService {
+
+    @Autowired
+    private BossSkuDictRelService bossSkuDictRelService;
+
+    @Autowired
+    private BossProjectDeliveryPlanService bossDeliveryPlanService;
+
+    /**
+     * 处理BOSS产生的交付计划
+     * @param projectDeliverReq : 交付计划信息
+     * @author : lijie
+     * Update By 2022/1/14 17:22
+     */
+    @Override
+    public void relayDeliverPlan(ProjectDeliverReq projectDeliverReq) {
+        // 1.根据商品code与项目任务模板的映射数据与规则生成项目任务数据
+        // 2.调用dmp-rwd服务根据商品code生成交付范围
+        createProjectDeliveryPlan(projectDeliverReq);
+    }
+
+    /**
+     * 生成项目交付计划
+     * @param projectDeliverReq
+     */
+    private void createProjectDeliveryPlan(ProjectDeliverReq projectDeliverReq){
+        // 存储项目交付信息
+        List<DeliveryPlanDTO> result = new ArrayList<>();
+        // 存储原BOSS订单信息
+        List<BossProjectDeliveryPlan> bossProjectDeliveryPlan = new ArrayList<>();
+        // 获取项目基础信息,后期调整为从上下文获取
+        Long projectId = projectDeliverReq.getProjectId();
+        String groupCode = projectDeliverReq.getBlocCode();
+
+        //1. 查询商品sku与数据字典的映射关系
+        Map<String, Set<String>> typeRelMap = queryBossBdtpTypeRel();
+        if(CollUtil.isEmpty(typeRelMap)){
+            return ;
+        }
+        //2. 获取项目下的计划
+        List<ProjectDeliverReq.PlanDeliverReq> planList = projectDeliverReq.getPlanDeliverReqs();
+        if(CollUtil.isEmpty(planList)){
+            log.info("项目下无计划任务,项目ID:{}"+projectId);
+        }
+        for (ProjectDeliverReq.PlanDeliverReq plan : planList) {
+            Long planId = plan.getId();
+            //获取计划下的商品信息
+            List<ProjectDeliverReq.PlanInfoDeliverReq> planInfoList = plan.getPlanInfoDeliverReqList();
+            if(CollUtil.isEmpty(planInfoList)){
+                log.info("计划下无商品信息,项目ID:{},计划ID:{}"+projectId+plan.getId());
+            }
+            //生成商品交付信息
+            for (ProjectDeliverReq.PlanInfoDeliverReq planInfo : planInfoList) {
+                String skuCode = planInfo.getProductSkuCode();
+                Set<String> classCodes = typeRelMap.get(skuCode);
+                classCodes.forEach(item->{
+                    DeliveryPlanDTO deliveryPlanDTO = new DeliveryPlanDTO();
+                    deliveryPlanDTO.setGroupCode(groupCode);
+                    deliveryPlanDTO.setProjectId("Pj"+projectId);
+                    deliveryPlanDTO.setClassCode(item);
+                    result.add(deliveryPlanDTO);
+                });
+
+                //存储原BOSS订单信息
+                BossProjectDeliveryPlan bossDeliveryPlan = new BossProjectDeliveryPlan();
+                bossDeliveryPlan.setProjectId(projectId);
+                bossDeliveryPlan.setPlanId(planId);
+                bossDeliveryPlan.setPlanInfoId(planInfo.getPlanInfoId());
+                bossDeliveryPlan.setProductSkuCode(skuCode);
+                bossDeliveryPlan.setProductNum(planInfo.getProductNum());
+                bossDeliveryPlan.setStewardAccount(projectDeliverReq.getStewardAccount());
+                bossProjectDeliveryPlan.add(bossDeliveryPlan);
+            }
+        }
+        //生成项目交付信息
+        DigitalObjectTypeCollectFacade.createProjectDelivery(groupCode,"Pj"+ projectId, null, null, result);
+        //存储原BOSS订单信息
+        bossDeliveryPlanService.insert(bossProjectDeliveryPlan);
+    }
+
+    /**
+     * 查询商品类型映射关系
+     * @return
+     */
+    private Map<String,Set<String>> queryBossBdtpTypeRel(){
+        List<BossSkuDictRel> typeRelList = bossSkuDictRelService.queryByCondition(new QueryWrapper<>());
+        if(CollUtil.isEmpty(typeRelList)){
+            return new HashMap<>();
+        }
+        return typeRelList.stream().collect(Collectors.groupingBy(BossSkuDictRel::getSkuCode,
+                Collectors.mapping(BossSkuDictRel::getClassCode, Collectors.toSet())));
+    }
+
+
+}

+ 15 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/delivery/service/impl/AdmProjectInitTaskServiceImpl.java

@@ -0,0 +1,15 @@
+package com.persagy.adm.server.delivery.service.impl;
+
+import com.persagy.adm.server.delivery.service.AdmProjectInitTaskService;
+import org.springframework.stereotype.Service;
+
+/**
+ * BOSS订单:项目初始化任务
+ *
+ * @author:linhuili
+ * @date:2022/1/20
+ */
+@Service
+public class AdmProjectInitTaskServiceImpl implements AdmProjectInitTaskService {
+
+}

+ 48 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/delivery/service/impl/BossProjectDeliveryPlanServiceImpl.java

@@ -0,0 +1,48 @@
+package com.persagy.adm.server.delivery.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.persagy.adm.server.delivery.dao.BossProjectDeliveryPlanMapper;
+import com.persagy.adm.server.delivery.entity.BossProjectDeliveryPlan;
+import com.persagy.adm.server.delivery.service.BossProjectDeliveryPlanService;
+import com.persagy.dmp.delivery.entity.ObjectInfoCollect;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * BOSS项目交付计划
+ * @author:linhuili
+ * @date:2022/1/22
+ */
+@Service
+@Slf4j
+public class BossProjectDeliveryPlanServiceImpl extends ServiceImpl<BossProjectDeliveryPlanMapper, BossProjectDeliveryPlan>  implements BossProjectDeliveryPlanService {
+
+    @Autowired
+    private BossProjectDeliveryPlanMapper bossDeliveryPlanMapper;
+
+    /**
+     * 查询BOSS交付信息
+     * @param queryWrapper 查询条件
+     * @return
+     */
+    @Override
+    public List<BossProjectDeliveryPlan> queryByCondition(Wrapper<BossProjectDeliveryPlan> queryWrapper) {
+        return bossDeliveryPlanMapper.selectList(queryWrapper);
+    }
+
+    /**
+     * 保存BOSS交付信息
+     * @param voList 待新增数据
+     * @return
+     * @throws Exception
+     */
+    @Override
+    public List<BossProjectDeliveryPlan> insert(List<BossProjectDeliveryPlan> voList){
+        saveOrUpdateBatch(voList);
+        return voList;
+    }
+}

+ 32 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/delivery/service/impl/BossSkuDictRelServiceImpl.java

@@ -0,0 +1,32 @@
+package com.persagy.adm.server.delivery.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.persagy.adm.server.delivery.dao.BossSkuDictRelMapper;
+import com.persagy.adm.server.delivery.entity.BossSkuDictRel;
+import com.persagy.adm.server.delivery.service.BossSkuDictRelService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * BOSS商品-BDTP类型映射关系
+ * @author:linhuili
+ * @date:2022/1/19
+ */
+@Service
+public class BossSkuDictRelServiceImpl implements BossSkuDictRelService {
+
+    @Autowired
+    private BossSkuDictRelMapper boosSkuDictRelMapper;
+
+    /**
+     * 条件查询BOSS-BDTP商品映射关系
+     * @param queryWrapper 查询条件
+     * @return
+     */
+    @Override
+    public List<BossSkuDictRel> queryByCondition(Wrapper<BossSkuDictRel> queryWrapper) {
+        return boosSkuDictRelMapper.selectList(queryWrapper);
+    }
+}

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 124 - 207
adm-business/adm-server/src/main/resources/db/init/data.sql


+ 32 - 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 '最后修改人',
@@ -403,3 +404,34 @@ CREATE TABLE IF NOT EXISTS `adm_model_file` (
     PRIMARY KEY (`id`) USING BTREE,
     UNIQUE INDEX `idx_1`(`version`, `floor_id`, `building_id`, `project_id`, `group_code`,`valid`) USING BTREE
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='模型文件表';
+
+CREATE TABLE IF NOT EXISTS `boss_sku_dict_rel` (
+    `id` varchar(40) COLLATE utf8mb4_general_ci NOT NULL,
+    `sku_code` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'BOSS:商品编码',
+    `type_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'BDTP:对象类型编码',
+    `obj_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '对象类型',
+    `creator` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
+    `creation_time` char(14) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建时间',
+    `modifier` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '最后修改人',
+    `modified_time` char(14) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '最后修改时间',
+    `valid` tinyint NOT NULL DEFAULT '1' COMMENT '合法标识',
+    `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '乐观锁',
+    PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='BOSS商品sku与数据字典关系映射表';
+
+CREATE TABLE IF NOT EXISTS `boss_project_delivery_plan` (
+  `id` varchar(40) COLLATE utf8mb4_general_ci NOT NULL,
+  `project_id` int DEFAULT NULL COMMENT '项目id(BOSS)',
+  `plan_id` int DEFAULT NULL COMMENT '商品所属计划Id',
+  `plan_info_id` int NOT NULL COMMENT '验收商品id',
+  `product_sku_code` varchar(40) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '商品编码',
+  `product_num` int DEFAULT NULL COMMENT '商品对应的实施数量',
+  `steward_account` varchar(40) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '管家账号',
+  `creator` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
+  `creation_time` char(14) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建时间',
+  `modifier` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '最后修改人',
+  `modified_time` char(14) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '最后修改时间',
+  `valid` tinyint NOT NULL DEFAULT '1' COMMENT '合法标识',
+  `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '乐观锁',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci='BOSS项目交付计划';

+ 40 - 0
adm-comp/adm-steward-starter/pom.xml

@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <artifactId>adm-comp</artifactId>
+        <groupId>com.persagy</groupId>
+        <version>1.0.0</version>
+    </parent>
+
+    <artifactId>adm-steward-starter</artifactId>
+
+    <dependencies>
+        <!-- 配置中心(包含注册中心) -->
+        <dependency>
+            <groupId>com.persagy</groupId>
+            <artifactId>integrated-config-client</artifactId>
+        </dependency>
+        <!-- 项目启动 -->
+        <dependency>
+            <groupId>com.persagy</groupId>
+            <artifactId>dmp-server</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.persagy</groupId>
+            <artifactId>dmp-mybatis</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.persagy</groupId>
+            <artifactId>dmp-digital-starter</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.locationtech.jts</groupId>
+            <artifactId>jts-core</artifactId>
+            <version>1.16.1</version>
+        </dependency>
+    </dependencies>
+
+</project>

+ 30 - 0
adm-comp/adm-steward-starter/src/main/java/com/persagy/adm/steward/basic/config/StewardEncodeInterceptor.java

@@ -0,0 +1,30 @@
+package com.persagy.adm.steward.basic.config;
+
+import com.alibaba.fastjson.JSONObject;
+import com.persagy.adm.steward.basic.utils.RSAUtils;
+import feign.Request;
+import feign.RequestInterceptor;
+import feign.RequestTemplate;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+/**
+ * 加密拦截器
+ * @author linhuili
+ * @date 2022-01-22
+ */
+@Configuration
+@Slf4j
+public class StewardEncodeInterceptor implements RequestInterceptor {
+
+    @Value("${adm.rsa.privateKey}")
+    private String privateKey;
+
+    @Override
+    public void apply(RequestTemplate template) {
+        // 更改请求体中的content的值
+        Request.Body body = template.requestBody();
+        JSONObject temp = JSONObject.parseObject(body.asString());
+        template.body(RSAUtils.decode(body.asString(),privateKey));
+    }
+}

+ 51 - 0
adm-comp/adm-steward-starter/src/main/java/com/persagy/adm/steward/basic/config/StewardFeignConfig.java

@@ -0,0 +1,51 @@
+package com.persagy.adm.steward.basic.config;
+
+import feign.Logger;
+import feign.RequestInterceptor;
+import feign.codec.Encoder;
+import feign.form.spring.SpringFormEncoder;
+import org.springframework.beans.factory.ObjectFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
+import org.springframework.cloud.openfeign.EnableFeignClients;
+import org.springframework.cloud.openfeign.support.SpringEncoder;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Primary;
+import org.springframework.context.annotation.Scope;
+
+import static org.springframework.beans.factory.config.BeanDefinition.SCOPE_PROTOTYPE;
+
+/**
+ * Feign配置
+ * @author Charlie Yu
+ * @date 2021-05-15
+ */
+@EnableFeignClients(basePackages="com.persagy.**.client")
+@Configuration
+public class StewardFeignConfig {
+
+    @Autowired
+    private ObjectFactory<HttpMessageConverters> messageConverters;
+
+    @Bean
+    @Primary
+    @Scope(SCOPE_PROTOTYPE)
+    Encoder feignFormEncoder() {
+        return new SpringFormEncoder(new SpringEncoder(this.messageConverters));
+    }
+
+    @Bean
+    Logger.Level feignLevel(){
+        return Logger.Level.FULL;
+    }
+
+    @Bean
+    @ConditionalOnMissingBean({RequestInterceptor.class})
+    RequestInterceptor stewardEncryptInterceptor(){
+        return new StewardEncodeInterceptor();
+    }
+
+
+}

+ 13 - 0
adm-comp/adm-steward-starter/src/main/java/com/persagy/adm/steward/basic/constant/CommonConstants.java

@@ -0,0 +1,13 @@
+package com.persagy.adm.steward.basic.constant;
+
+/**
+ * 通用常量
+ * @author:linhuili
+ * @date:2022/1/22
+ */
+public interface CommonConstants {
+
+     Integer SUCCESS = 1;
+
+     Integer FAIL = 0;
+}

+ 87 - 0
adm-comp/adm-steward-starter/src/main/java/com/persagy/adm/steward/basic/model/response/BossResponse.java

@@ -0,0 +1,87 @@
+package com.persagy.adm.steward.basic.model.response;
+
+import com.persagy.adm.steward.basic.constant.CommonConstants;
+
+import java.io.Serializable;
+
+
+/***
+ * @Description: 操作消息提醒
+ *
+ * @Author: QiaoPengQiang
+ * @Date: 2021/12/29
+ */
+public class BossResponse<T> implements Serializable {
+
+    private static final long serialVersionUID = 1626120430566031974L;
+
+    private int code;
+
+    private String msg;
+
+    private T data;
+
+    public static <T> BossResponse<T> success() {
+        return restResult(null, CommonConstants.SUCCESS, null);
+    }
+
+    public static <T> BossResponse<T> success(T data) {
+        return restResult(data, CommonConstants.SUCCESS, null);
+    }
+
+    public static <T> BossResponse<T> success(T data, String msg) {
+        return restResult(data, CommonConstants.SUCCESS, msg);
+    }
+
+    public static <T> BossResponse<T> error() {
+        return restResult(null, CommonConstants.FAIL, "操作失败");
+    }
+
+    public static <T> BossResponse<T> error(String msg) {
+        return restResult(null, CommonConstants.FAIL, msg);
+    }
+
+    public static <T> BossResponse<T> error(T data) {
+        return restResult(data, CommonConstants.FAIL, "操作失败");
+    }
+
+    public static <T> BossResponse<T> error(T data, String msg) {
+        return restResult(data, CommonConstants.FAIL, msg);
+    }
+
+    public static <T> BossResponse<T> error(int code, String msg) {
+        return restResult(null, code, msg);
+    }
+
+    public int getCode() {
+        return code;
+    }
+
+    public void setCode(int code) {
+        this.code = code;
+    }
+
+    public String getMsg() {
+        return msg;
+    }
+
+    public void setMsg(String msg) {
+        this.msg = msg;
+    }
+
+    public T getData() {
+        return data;
+    }
+
+    public void setData(T data) {
+        this.data = data;
+    }
+
+    private static <T> BossResponse<T> restResult(T data, int code, String msg) {
+        BossResponse<T> apiResult = new BossResponse<T>();
+        apiResult.setCode(code);
+        apiResult.setData(data);
+        apiResult.setMsg(msg);
+        return apiResult;
+    }
+}

+ 155 - 0
adm-comp/adm-steward-starter/src/main/java/com/persagy/adm/steward/basic/utils/RSAUtils.java

@@ -0,0 +1,155 @@
+package com.persagy.adm.steward.basic.utils;
+
+import lombok.extern.slf4j.Slf4j;
+
+import org.apache.tomcat.util.codec.binary.Base64;
+
+import javax.crypto.Cipher;
+import java.security.*;
+import java.security.spec.PKCS8EncodedKeySpec;
+import java.security.spec.X509EncodedKeySpec;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description: RSAUtils
+ * @Author: qiaopengqiang
+ * @Date: 2022-01-10
+ * @Version:v1.0
+ */
+@Slf4j
+public class RSAUtils {
+
+    private static String KEY_RSA_TYPE = "RSA";
+    private static String KEY_RSA_TYPE_ALL = "RSA/ECB/PKCS1Padding";
+    private static int KEY_SIZE = 1024;//JDK方式RSA加密最大只有1024位
+    private static int ENCODE_PART_SIZE = KEY_SIZE/8;
+    public static final String PUBLIC_KEY_NAME = "bdtp";
+    public static final String PRIVATE_KEY_NAME = "boss";
+
+    /**
+     * 创建公钥秘钥
+     * @return
+     */
+
+    public static Map<String,String> createRSAKeys(){
+        Map<String,String> keyPairMap = new HashMap<>();//里面存放公私秘钥的Base64位加密
+        try {
+            KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance(KEY_RSA_TYPE);
+            keyPairGenerator.initialize(KEY_SIZE,new SecureRandom());
+            KeyPair keyPair = keyPairGenerator.generateKeyPair();
+
+            //获取公钥秘钥
+            String publicKeyValue = Base64.encodeBase64String(keyPair.getPublic().getEncoded());
+            String privateKeyValue = Base64.encodeBase64String(keyPair.getPrivate().getEncoded());
+
+            //存入公钥秘钥,以便以后获取
+            keyPairMap.put(PUBLIC_KEY_NAME,publicKeyValue);
+            keyPairMap.put(PRIVATE_KEY_NAME,privateKeyValue);
+        } catch (NoSuchAlgorithmException e) {
+            log.error("当前JDK版本没找到RSA加密算法!");
+            e.printStackTrace();
+        }
+        return keyPairMap;
+    }
+
+    /**
+     * 公钥加密
+     * 描述:
+     *     1字节 = 8位;
+     *     最大加密长度如 1024位私钥时,最大加密长度为 128-11 = 117字节,不管多长数据,加密出来都是 128 字节长度。
+     * @param sourceStr
+     * @param publicKeyBase64Str
+     * @return
+     */
+    public static String encode(String sourceStr,String publicKeyBase64Str){
+        byte [] publicBytes = Base64.decodeBase64(publicKeyBase64Str);
+        //公钥加密
+        X509EncodedKeySpec x509EncodedKeySpec = new X509EncodedKeySpec(publicBytes);
+        List<byte[]> alreadyEncodeListData = new LinkedList<>();
+
+        int maxEncodeSize = ENCODE_PART_SIZE - 11;
+        String encodeBase64Result = null;
+        try {
+            KeyFactory keyFactory = KeyFactory.getInstance(KEY_RSA_TYPE);
+            PublicKey publicKey = keyFactory.generatePublic(x509EncodedKeySpec);
+            Cipher cipher = Cipher.getInstance(KEY_RSA_TYPE_ALL);
+            cipher.init(Cipher.ENCRYPT_MODE,publicKey);
+            byte[] sourceBytes = sourceStr.getBytes("utf-8");
+            int sourceLen = sourceBytes.length;
+            for(int i=0;i<sourceLen;i+=maxEncodeSize){
+                int curPosition = sourceLen - i;
+                int tempLen = curPosition;
+                if(curPosition > maxEncodeSize){
+                    tempLen = maxEncodeSize;
+                }
+                byte[] tempBytes = new byte[tempLen];//待加密分段数据
+                System.arraycopy(sourceBytes,i,tempBytes,0,tempLen);
+                byte[] tempAlreadyEncodeData = cipher.doFinal(tempBytes);
+                alreadyEncodeListData.add(tempAlreadyEncodeData);
+            }
+            int partLen = alreadyEncodeListData.size();//加密次数
+
+            int allEncodeLen = partLen * ENCODE_PART_SIZE;
+            byte[] encodeData = new byte[allEncodeLen];//存放所有RSA分段加密数据
+            for (int i = 0; i < partLen; i++) {
+                byte[] tempByteList = alreadyEncodeListData.get(i);
+                System.arraycopy(tempByteList,0,encodeData,i*ENCODE_PART_SIZE,ENCODE_PART_SIZE);
+            }
+            encodeBase64Result = Base64.encodeBase64String(encodeData);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return encodeBase64Result;
+    }
+
+    /**
+     * 私钥解密
+     * @param sourceBase64RSA
+     * @param privateKeyBase64Str
+     */
+    public static String decode(String sourceBase64RSA,String privateKeyBase64Str){
+        byte[] privateBytes = Base64.decodeBase64(privateKeyBase64Str);
+        byte[] encodeSource = Base64.decodeBase64(sourceBase64RSA);
+        int encodePartLen = encodeSource.length/ENCODE_PART_SIZE;
+        List<byte[]> decodeListData = new LinkedList<>();//所有解密数据
+        String decodeStrResult = null;
+        //私钥解密
+        PKCS8EncodedKeySpec pkcs8EncodedKeySpec = new PKCS8EncodedKeySpec(privateBytes);
+        try {
+            KeyFactory keyFactory = KeyFactory.getInstance(KEY_RSA_TYPE);
+            PrivateKey privateKey = keyFactory.generatePrivate(pkcs8EncodedKeySpec);
+            Cipher cipher = Cipher.getInstance(KEY_RSA_TYPE_ALL);
+            cipher.init(Cipher.DECRYPT_MODE,privateKey);
+            int allDecodeByteLen = 0;//初始化所有被解密数据长度
+            for (int i = 0; i < encodePartLen; i++) {
+                byte[] tempEncodedData = new byte[ENCODE_PART_SIZE];
+                System.arraycopy(encodeSource,i*ENCODE_PART_SIZE,tempEncodedData,0,ENCODE_PART_SIZE);
+                byte[] decodePartData = cipher.doFinal(tempEncodedData);
+                decodeListData.add(decodePartData);
+                allDecodeByteLen += decodePartData.length;
+            }
+            byte [] decodeResultBytes = new byte[allDecodeByteLen];
+            for (int i = 0,curPosition = 0; i < encodePartLen; i++) {
+                byte[] tempSorceBytes = decodeListData.get(i);
+                int tempSourceBytesLen = tempSorceBytes.length;
+                System.arraycopy(tempSorceBytes,0,decodeResultBytes,curPosition,tempSourceBytesLen);
+                curPosition += tempSourceBytesLen;
+            }
+            decodeStrResult = new String(decodeResultBytes,"UTF-8");
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+        return decodeStrResult;
+    }
+
+    public static void main(String[] args) {
+        Map<String, String> rsaKeys = RSAUtils.createRSAKeys();
+        String publicKey = rsaKeys.get(RSAUtils.PUBLIC_KEY_NAME);
+        System.out.println("publicKey:"+ publicKey);
+        String privateKey = rsaKeys.get(RSAUtils.PRIVATE_KEY_NAME);
+        System.out.println("privateKey:"+ privateKey);
+    }
+}

+ 31 - 0
adm-comp/adm-steward-starter/src/main/java/com/persagy/adm/steward/entity/ProductFinishNumReq.java

@@ -0,0 +1,31 @@
+package com.persagy.adm.steward.entity;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+
+/**
+ * @Description: ProductFinishNumReq 实施工具调用
+ * @Author: qiaopengqiang
+ * @Date: 2022-01-06
+ * @Version:v1.0
+ */
+@Data
+public class ProductFinishNumReq implements Serializable {
+
+    private static final long serialVersionUID = -8196236532619442356L;
+    /**
+     * 验收商品id
+     */
+    @NotNull(message = "验收商品id不能为空")
+    private Long planInfoId;
+
+    /**
+     * 本次已经完成的数量
+     */
+    @NotNull(message = "该商品已经完成的数量不能为空")
+    private Integer finishNum;
+
+
+}

+ 147 - 0
adm-comp/adm-steward-starter/src/main/java/com/persagy/adm/steward/entity/ProjectDeliverReq.java

@@ -0,0 +1,147 @@
+package com.persagy.adm.steward.entity;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @Description: ProjectDeliverReq 请求交付工具的接口
+ * @Author: qiaopengqiang
+ * @Date: 2022-01-17
+ * @Version:v1.0
+ */
+@Data
+public class ProjectDeliverReq implements Serializable {
+
+    private static final long serialVersionUID = 7257238883268681314L;
+
+    /**
+     * 项目id
+     */
+    private Long projectId;
+
+    /**
+     * 订单编号
+     */
+    private Long orderSn;
+
+    /**
+     * 管家账号
+     */
+    private String stewardAccount;
+
+    /**
+     * 项目名称(购买的商品名称)
+     */
+    private String projectName;
+
+    /**
+     * 下单时间
+     */
+    private Date orderTime;
+
+    /**
+     * 支付时间
+     */
+    private Date payTime;
+
+    /**
+     * 子交付计划汇总数量
+     */
+    private Integer planNumSum;
+
+    /**
+     * 实施人数
+     */
+    private Integer implManNum;
+
+    /**
+     * 集团编码
+     */
+    private String blocCode;
+
+    /**
+     * 集团name
+     */
+    private String blocName;
+
+    /**
+     * 每一个项目下都有一个或者多个计划
+     */
+    private List<PlanDeliverReq> planDeliverReqs;
+
+    /**
+     * 每一个项目都有一个或者多个楼层
+     */
+    private List<StoreyInfoReq> storeyInfoReqs;
+
+    @Data
+    public static class PlanDeliverReq implements Serializable {
+
+        private static final long serialVersionUID = 6855330552397128142L;
+        /**
+         * 主键id
+         */
+        private Long id;
+
+        /**
+         * 交付计划名称
+         */
+        private String planName;
+
+        /**
+         * 每一个计划下都有多个验收商品详情
+         */
+        private List<PlanInfoDeliverReq> planInfoDeliverReqList;
+
+    }
+
+    @Data
+    public static class PlanInfoDeliverReq implements Serializable {
+
+        private static final long serialVersionUID = 2232909478659794811L;
+
+        /**
+         * 验收商品id
+         */
+        private Long planInfoId;
+
+        /**
+         * 商品名称(规格名称,代表唯一的商品名称)
+         */
+        private String productName;
+
+        /**
+         * 商品编码
+         */
+        private String productSkuCode;
+
+        /**
+         * 商品对应的实施数量
+         */
+        private Long productNum;
+
+        /**
+         * 开始时间
+         */
+        private Date startTime;
+
+        /**
+         * 结束时间
+         */
+        private Date endTime;
+    }
+
+    @Data
+    public static class StoreyInfoReq implements Serializable {
+
+        private static final long serialVersionUID = 7645105006381797684L;
+        /**
+         * 楼层id
+         */
+        private Integer storeyId;
+
+        private String storeyName;
+    }
+}

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 4 - 0
adm-comp/adm-steward-starter/src/main/resources/application.yml


+ 19 - 0
adm-comp/pom.xml

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>adm</artifactId>
+        <groupId>com.persagy</groupId>
+        <version>1.0.0</version>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>adm-comp</artifactId>
+    <packaging>pom</packaging>
+    <modules>
+        <module>adm-steward-starter</module>
+    </modules>
+
+
+</project>

+ 1 - 0
pom.xml

@@ -14,6 +14,7 @@
 
     <modules>
         <module>adm-business</module>
+        <module>adm-comp</module>
     </modules>
 
 </project>