Kaynağa Gözat

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

zhaoyk 2 yıl önce
ebeveyn
işleme
c13f2a25c9
39 değiştirilmiş dosya ile 894 ekleme ve 325 silme
  1. 58 1
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/controller/DiagramController.java
  2. 9 0
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/DataStrategy.java
  3. 29 1
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/impl/DataStrategyImpl.java
  4. 7 0
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/dao/IconMapper.java
  5. 5 0
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/demo/DemoDataStrategy.java
  6. 9 0
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/service/IconService.java
  7. 20 0
      adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/service/impl/IconServiceImpl.java
  8. 11 0
      adm-business/adm-diagram/src/main/resources/mapper/DiagramIcon.xml
  9. 9 1
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/dictionary/service/impl/AdmDictServiceImpl.java
  10. 1 1
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/migration/controller/DataMigrationController.java
  11. 6 4
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/migration/service/Impl/ObjectDigitalMigration.java
  12. 2 2
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/object/controller/AdmProjectController.java
  13. 22 1
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/object/service/IAdmProjectService.java
  14. 61 0
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/object/service/impl/AdmProjectServiceImpl.java
  15. 5 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/common/AdmRequest.java
  16. 24 2
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/controller/AdmFileController.java
  17. 19 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/controller/AppController.java
  18. 26 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/dto/CadFiles.java
  19. 6 9
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/entity/CadFileInfo.java
  20. 0 4
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/entity/CadFileQueryParam.java
  21. 6 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/entity/db/AdmCad.java
  22. 16 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/interceptor/AppContextConfig.java
  23. 24 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/interceptor/AppContextInterceptor.java
  24. 14 92
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/SyncAppImpl.java
  25. 23 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/AdmCadCheckUpdate.java
  26. 23 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/AdmFileCheckUpdate.java
  27. 24 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/AdmJobSpaceCheckUpdate.java
  28. 25 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/AdmPipeCheckUpdate.java
  29. 30 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/AdmProblemCheckUpdate.java
  30. 23 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/AdmQrCodeCheckUpdate.java
  31. 23 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/AdmServerAreaCheckUpdate.java
  32. 45 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/BdtpObjRelCreateByAppCheckUpdate.java
  33. 43 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/BdtpObjectCheckUpdate.java
  34. 5 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/CheckUpdate.java
  35. 68 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/CheckUpdateChain.java
  36. 9 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/CheckUpdateContext.java
  37. 39 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/check_update/MetaSpaceObjRelCheckUpdate.java
  38. 124 207
      adm-business/adm-server/src/main/resources/db/init/data.sql
  39. 1 0
      adm-business/adm-server/src/main/resources/db/init/schema.sql

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

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

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

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

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

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

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

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

@@ -635,9 +635,17 @@ public class AdmDictServiceImpl<T> extends AbstractAdmDictBaseServiceImpl<T> imp
         if(CollUtil.isEmpty(list)){
             return Collections.emptyList();
         }
-        List<String> projectCodes = Arrays.asList("businessOpeningTime","owner","property","designer","constructor","longitude",
+        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());
     }
     /**

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

@@ -160,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);

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

@@ -130,18 +130,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("',");
@@ -152,7 +152,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(",");

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

+ 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/src/main/java/com/persagy/adm/server/custom/common/AdmRequest.java

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Dosya farkı çok büyük olduğundan ihmal edildi
+ 124 - 207
adm-business/adm-server/src/main/resources/db/init/data.sql


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

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