Parcourir la source

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

zhaoyk il y a 2 ans
Parent
commit
63d32732ab
30 fichiers modifiés avec 736 ajouts et 130 suppressions
  1. 38 16
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/migration/controller/DataMigrationController.java
  2. 3 3
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/migration/service/IMigrationLogService.java
  3. 12 16
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/migration/service/Impl/MigrationLogServiceImpl.java
  4. 9 9
      adm-business/adm-middleware/src/main/java/com/persagy/proxy/migration/service/Impl/ObjectRelationMigration.java
  5. 2 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/common/AdmConst.java
  6. 0 1
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/controller/AdmFileController.java
  7. 177 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/controller/AppDataDownloadController.java
  8. 62 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/dto/DownLoadData.java
  9. 4 21
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/entity/db/AdmFile.java
  10. 1 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/entity/db/AdmQrCode.java
  11. 4 1
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/interceptor/AppContextConfig.java
  12. 52 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/interceptor/StewardInterceptor.java
  13. 7 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/interceptor/TokenInterceptor.java
  14. 9 27
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/SyncAppImpl.java
  15. 17 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/offline_data_download/CriteriaUtils.java
  16. 62 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/offline_data_download/DownLoadDataDeal.java
  17. 14 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/offline_data_download/FillBuildingDataChain.java
  18. 1 1
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/offline_data_download/FillCad.java
  19. 36 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/offline_data_download/FillFile.java
  20. 57 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/offline_data_download/FillObject.java
  21. 38 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/offline_data_download/FillQrCode.java
  22. 23 8
      adm-business/adm-server/src/main/java/com/persagy/adm/server/delivery/controller/AdmDeliverPlanController.java
  23. 11 0
      adm-business/adm-server/src/main/java/com/persagy/adm/server/delivery/service/AdmDeliverPlanService.java
  24. 48 1
      adm-business/adm-server/src/main/java/com/persagy/adm/server/delivery/service/impl/AdmDeliverPlanServiceImpl.java
  25. 23 19
      adm-business/adm-server/src/main/resources/db/init/schema.sql
  26. 3 2
      adm-comp/adm-steward-starter/src/main/java/com/persagy/adm/steward/basic/config/StewardEncodeInterceptor.java
  27. 10 0
      adm-comp/adm-steward-starter/src/main/java/com/persagy/adm/steward/client/BossStewardClient.java
  28. 12 0
      adm-comp/adm-steward-starter/src/main/java/com/persagy/adm/steward/client/BossStewardFacade.java
  29. 1 1
      adm-comp/adm-steward-starter/src/main/java/com/persagy/adm/steward/entity/ProjectDeliverReq.java
  30. 0 4
      adm-comp/adm-steward-starter/src/main/resources/application.yml

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

@@ -130,17 +130,7 @@ public class DataMigrationController {
             e.printStackTrace();
             return AdmResponse.failure(MigrationConstant.ERROR +":"+ e.getMessage());
         }
-
         dataMigrationHandler.handleAndSaveLog(context, migrationInfo);
-
-        AdmQueryCriteria admQueryCriteria = new AdmQueryCriteria();
-        admQueryCriteria.addFilters("targetId = 'error'");
-        admQueryCriteria.addFilters("projectId = '" + context.getProjectId() + "'");
-        admQueryCriteria.setOnlyCount(true);
-        AdmResponse response = queryMigrateForLog(admQueryCriteria);
-        if(response.getMessage().equals(DmpResult.SUCCESS) && response.getCount() > 5){
-            return AdmResponse.failure("出现错误次数:"+ response.getCount()+"次,请使用导出检查数据是否迁移成功");
-        }
         return AdmResponse.success();
     }
 
@@ -195,22 +185,54 @@ public class DataMigrationController {
     /**
      * 获取迁移数据日志
      *
-     * @AdmQueryCriteria
+     * @param request
      * {
-     *     "order": "lastUpdate asc, objId asc",
-     *     "pageNumber": 1,
-     *     "pageSize": 15,
-     *     "filters": "projectId='Pj9909990004';sign=2;type='create';objectType='building'"
+     *     "onlyCount": false,
+     *     "withoutCount": false,
+     *     "criteria": {
+     *         "sign": 2,
+     *         "type": "create",
+     *         "tableName": "dt_relation",
+     *         "creationTime":{
+     *             "$gte":20220120121146,
+     *             "$lte":20220123121146
+     *         },
+     *         "valid": 1
+     *     }
      * }
      *
      *  return AdmResponse
      */
     @PostMapping("/log")
-    public AdmResponse queryMigrateForLog(@RequestBody AdmQueryCriteria request) {
+    public CommonResult queryMigrateForLog(@RequestBody QueryCriteria request) {
         InstanceUrlParam context = AdmContextUtil.toDmpContext();
         return logService.queryMigrationLog(context, request);
     }
 
+    /**
+     * 根据条件 删除操作日志 物理删除
+     * @param request
+     * {
+     *     "onlyCount": false,
+     *     "withoutCount": false,
+     *     "criteria": {
+     *         "sign": 2,
+     *         "type": "create",
+     *         "tableName": "dt_relation",
+     *         "creationTime":{
+     *             "$gte":20220120121146,
+     *             "$lte":20220123121146
+     *         },
+     *         "valid": 1
+     *     }
+     * }
+     * @return
+     */
+    @PostMapping("/deleteLog")
+    public CommonResult deleteMigrateForLog(@RequestBody QueryCriteria request) {
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
+        return logService.deleteMigrationLog(context, request);
+    }
 
 
 

+ 3 - 3
adm-business/adm-middleware/src/main/java/com/persagy/proxy/migration/service/IMigrationLogService.java

@@ -1,8 +1,7 @@
 package com.persagy.proxy.migration.service;
 
 import com.persagy.dmp.basic.model.QueryCriteria;
-import com.persagy.proxy.adm.request.AdmQueryCriteria;
-import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.dmp.common.model.response.CommonResult;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
 
 /**
@@ -14,5 +13,6 @@ import com.persagy.proxy.common.entity.InstanceUrlParam;
  */
 public interface IMigrationLogService {
 
-    AdmResponse queryMigrationLog(InstanceUrlParam context, AdmQueryCriteria request);
+    CommonResult queryMigrationLog(InstanceUrlParam context, QueryCriteria queryCriteria);
+    CommonResult deleteMigrationLog(InstanceUrlParam context, QueryCriteria queryCriteria);
 }

+ 12 - 16
adm-business/adm-middleware/src/main/java/com/persagy/proxy/migration/service/Impl/MigrationLogServiceImpl.java

@@ -37,32 +37,28 @@ import java.util.stream.Collectors;
 @Slf4j
 public class MigrationLogServiceImpl implements IMigrationLogService {
     @Override
-    public AdmResponse queryMigrationLog(InstanceUrlParam context, AdmQueryCriteria request) {
-        QueryCriteria queryCriteria = AdmQueryCriteriaHelper.toDmpCriteria(request);
+    public CommonResult queryMigrationLog(InstanceUrlParam context, QueryCriteria queryCriteria) {
         String groupCode = context.getGroupCode();
         String projectId = context.getProjectId();
         CommonResult<List<SyncData>> result = DigitalMigrateLogFacade.query(groupCode, projectId, context.getAppId(), context.getUserId(),queryCriteria);
         if(result.getResult().equals(DmpResult.SUCCESS)){
             if(CollUtil.isEmpty(result.getData())){
-                return AdmResponse.success();
+                return result;
             }
             // 处理返回值
             List<SyncData> syncDatas = result.getData();
             processSynDatas(groupCode, projectId, syncDatas);
-            AdmResponse response = AdmResponse.success(syncDatas);
-            Long total = result.getCount() == null ? null : result.getCount().longValue();
-            if(request.isOnlyCount()){
-                response.setTotal(null);
-                response.setCount(total);
-            }else {
-                response.setTotal(total);
-            }
-            response.setPageNumber(request.getPageNumber());
-            response.setPageSize(request.getPageSize());
-            return response;
-        } else {
-            return AdmResponse.failure(result.getMessage());
+            result.setData(syncDatas);
         }
+        return result;
+    }
+
+    @Override
+    public CommonResult deleteMigrationLog(InstanceUrlParam context, QueryCriteria queryCriteria) {
+        String groupCode = context.getGroupCode();
+        String projectId = context.getProjectId();
+        CommonResult result = DigitalMigrateLogFacade.deleteAllLog(groupCode, projectId, context.getAppId(), context.getUserId(),queryCriteria);
+        return result;
     }
 
 

+ 9 - 9
adm-business/adm-middleware/src/main/java/com/persagy/proxy/migration/service/Impl/ObjectRelationMigration.java

@@ -320,15 +320,6 @@ public class ObjectRelationMigration extends MigrationAbstractServiceImpl<Object
         List<ObjectNode> objectNodeListAdm = JsonNodeUtils.toListNode(admRelations, null, null);
         Map<String,Object> admDefineMap = toEntityMap(objectNodeListAdm, ObjectRelation.class);
 
-        //差集 新增
-        Map<String,Object> doSubtractFromInsert = doSubtractAdd(admDefineMap, projectDefineMap);
-        if(!CollUtil.isEmpty(doSubtractFromInsert)){
-            List<ObjectRelation> insertData = toList(doSubtractFromInsert, admRelations);
-            DataMigrationResponse dataMigrationResponse = insertBatch(insertData, ObjectRelation.class, insertUrl);
-            //处理并保存日志
-            syncDataList.addAll(processDataForLog(dataMigrationResponse, MigrationType.CREATE.getCode()));
-        }
-
         //差集 删除
         Map<String,Object> doSubtractFromDelete = doSubtractDel(admDefineMap, projectDefineMap);
         if(!CollUtil.isEmpty(doSubtractFromDelete)){
@@ -340,6 +331,15 @@ public class ObjectRelationMigration extends MigrationAbstractServiceImpl<Object
             syncDataList.addAll(processDataForLog(dataMigrationResponse, MigrationType.DELETE.getCode()));
         }
 
+        //差集 新增
+        Map<String,Object> doSubtractFromInsert = doSubtractAdd(admDefineMap, projectDefineMap);
+        if(!CollUtil.isEmpty(doSubtractFromInsert)){
+            List<ObjectRelation> insertData = toList(doSubtractFromInsert, admRelations);
+            DataMigrationResponse dataMigrationResponse = insertBatch(insertData, ObjectRelation.class, insertUrl);
+            //处理并保存日志
+            syncDataList.addAll(processDataForLog(dataMigrationResponse, MigrationType.CREATE.getCode()));
+        }
+
         //交集更新
         Map<String,Object> intersectionUpdateFrom = doIntersectionGetFrom(admDefineMap, projectDefineMap);
         Map<String,Object> intersectionUpdateTo = doIntersectionGetTo(admDefineMap, projectDefineMap);

+ 2 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/common/AdmConst.java

@@ -25,6 +25,8 @@ public interface AdmConst {
 
 	String OBJ_TYPE_EQUIPMENT = "equipment";
 
+	String OBJ_TYPE_ISPACE = "ispace";
+
 
 	/** 数据创建者,数据同步服务 */
 	String CREATOR_SYNC = APP_ID + "_sync";

+ 0 - 1
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/controller/AdmFileController.java

@@ -35,7 +35,6 @@ public class AdmFileController {
     /**
      * CAD文件查询接口
      */
-
     @PostMapping("/queryCadFiles")
     public CommonResult<List<AdmCad>> queryCadFiles(@RequestBody CadFileQueryParam queryParam){
         AppContext context = AppContext.getContext();

+ 177 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/controller/AppDataDownloadController.java

@@ -0,0 +1,177 @@
+package com.persagy.adm.server.custom.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+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.dao.AdmCadMapper;
+import com.persagy.adm.server.custom.dao.AdmFileMapper;
+import com.persagy.adm.server.custom.dao.AdmProblemMapper;
+import com.persagy.adm.server.custom.dao.AdmQrCodeMapper;
+import com.persagy.adm.server.custom.dto.DownLoadData;
+import com.persagy.adm.server.custom.entity.Pagination;
+import com.persagy.adm.server.custom.entity.db.AdmCad;
+import com.persagy.adm.server.custom.entity.db.AdmFile;
+import com.persagy.adm.server.custom.entity.db.AdmProblem;
+import com.persagy.adm.server.custom.entity.db.AdmQrCode;
+import com.persagy.adm.server.custom.interceptor.TokenInterceptor;
+import com.persagy.adm.server.custom.service.ServiceUtil;
+import com.persagy.adm.server.custom.service.impl.offline_data_download.CriteriaUtils;
+import com.persagy.adm.server.custom.service.impl.offline_data_download.DownLoadDataDeal;
+import com.persagy.dmp.basic.model.QueryCriteria;
+import com.persagy.dmp.common.model.response.CommonResult;
+import com.persagy.dmp.common.utils.ResultHelper;
+import com.persagy.dmp.digital.client.DigitalObjectClient;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * APP离线数据下载接口
+ */
+@RestController
+@RequestMapping("/app/download")
+public class AppDataDownloadController {
+
+    @Autowired
+    AdmProblemMapper problemMapper;
+    @Autowired
+    AdmCadMapper admCadMapper;
+    @Autowired
+    AdmFileMapper fileMapper;
+    @Autowired
+    AdmQrCodeMapper qrCodeMapper;
+    @Autowired
+    ObjectMapper objectMapper;
+    @Autowired
+    DigitalObjectClient objectClient;
+    @Autowired
+    DownLoadDataDeal downLoadDataDeal;
+
+    /**
+     * 下载问题数据
+     */
+    @GetMapping("/problems")
+    public CommonResult<DownLoadData<List<AdmProblem>>> problems(@RequestParam String groupCode,@RequestParam String projectId,@RequestParam String buildingId, @RequestParam(required = false) Long ts, @RequestParam String clientId){
+        LambdaQueryWrapper<AdmProblem> queryWrapper = new LambdaQueryWrapper<AdmProblem>()
+                .eq(AdmProblem::getGroupCode, groupCode)
+                .eq(AdmProblem::getProjectId, projectId)
+                .eq(AdmProblem::getBuildingId, buildingId)
+                .gt(ts != null && ts != 0,AdmProblem::getTs, ts)
+                .ne(ts != null && ts != 0,AdmProblem::getModifier,CriteriaUtils.getOperator(clientId,TokenInterceptor.bossAuthUserThreadLocal.get().getId()))
+                .orderByDesc(AdmProblem::getModifiedTime);
+        List<AdmProblem> problems = problemMapper.selectList(queryWrapper);
+        DownLoadData<List<AdmProblem>> downLoadData = new DownLoadData<>();
+        downLoadData.setData(problems);
+
+        if (!problems.isEmpty()){
+            Long modifiedTime = problems.get(0).getTs().getTime();
+            downLoadData.setTs(modifiedTime);
+        }
+
+        return ResultHelper.single(downLoadData);
+    }
+
+    /**
+     * 下载图纸数据
+     * @return
+     */
+    @GetMapping("/cadFiles")
+    public CommonResult<DownLoadData<List<AdmCad>>> cadFiles(@RequestParam String groupCode, @RequestParam String projectId, @RequestParam String buildingId, @RequestParam(required = false) Long ts){
+        List<AdmCad> admCads = admCadMapper.selectList(new LambdaQueryWrapper<AdmCad>()
+                .eq(AdmCad::getGroupCode,groupCode)
+                .eq(AdmCad::getProjectId,projectId)
+                .eq(AdmCad::getBuildingId,buildingId)
+                .gt(ts != null && ts != 0,AdmCad::getTs,ts).orderByDesc(AdmCad::getModifiedTime));
+        DownLoadData<List<AdmCad>> downLoadData = new DownLoadData<>();
+        downLoadData.setData(admCads);
+        if (!admCads.isEmpty()){
+            Long modifiedTime = admCads.get(0).getTs().getTime();
+            downLoadData.setTs(modifiedTime);
+        }
+        return ResultHelper.single(downLoadData);
+    }
+    /**
+     * 下载附件现场照片数据
+     * @return
+     */
+    @GetMapping("/files")
+    public CommonResult<DownLoadData<List<AdmFile>>> attachmentsFiles(@RequestParam String groupCode, @RequestParam String projectId, @RequestParam String buildingId, @RequestParam(required = false) Long ts, @RequestParam String clientId){
+        LambdaQueryWrapper<AdmFile> queryWrapper = Wrappers.lambdaQuery(AdmFile.class)
+                .eq(AdmFile::getGroupCode,groupCode)
+                .eq(AdmFile::getProjectId,projectId)
+                .eq(AdmFile::getBuildingId,buildingId)
+                .gt(ts != null && ts != 0 ,AdmFile::getTs,ts)
+                .ne(ts != null && ts != 0 ,AdmFile::getModifier, CriteriaUtils.getOperator(clientId,TokenInterceptor.bossAuthUserThreadLocal.get().getId())).orderByDesc(AdmFile::getModifiedTime);
+        List<AdmFile> files = fileMapper.selectList(queryWrapper);
+
+        DownLoadData<List<AdmFile>> downLoadData = new DownLoadData<>();
+        downLoadData.setData(files);
+        if (!files.isEmpty()){
+            Long modifiedTime = files.get(0).getTs().getTime();
+            downLoadData.setTs(modifiedTime);
+        }
+        return ResultHelper.single(downLoadData);
+
+    }
+    /**
+     * 二维码数据
+     * @return
+     */
+    @GetMapping("/qrCodes")
+    public CommonResult<DownLoadData<List<AdmQrCode>>> qrCodes(@RequestParam String groupCode, @RequestParam String projectId, @RequestParam String buildingId, @RequestParam(required = false) Long ts, @RequestParam String clientId){
+        LambdaQueryWrapper<AdmQrCode> queryWrapper = Wrappers.lambdaQuery(AdmQrCode.class)
+                .eq(AdmQrCode::getGroupCode,groupCode)
+                .eq(AdmQrCode::getProjectId,projectId)
+                .eq(AdmQrCode::getBuildingId,buildingId)
+                .gt(ts != null && ts != 0 ,AdmQrCode::getTs,ts)
+                .ne(ts != null && ts != 0 ,AdmQrCode::getModifier,CriteriaUtils.getOperator(clientId,TokenInterceptor.bossAuthUserThreadLocal.get().getId())).orderByDesc(AdmQrCode::getModifiedTime);
+        List<AdmQrCode> qrCodes = qrCodeMapper.selectList(queryWrapper);
+        DownLoadData<List<AdmQrCode>> downLoadData = new DownLoadData<>();
+        downLoadData.setData(qrCodes);
+        if (!qrCodes.isEmpty()){
+            Long modifiedTime = qrCodes.get(0).getTs().getTime();
+            downLoadData.setTs(modifiedTime);
+        }
+        return ResultHelper.single(downLoadData);
+    }
+
+
+    /**
+     * 对象数据
+     * @return
+     */
+    @GetMapping("/objects")
+    public CommonResult<DownLoadData<List<ObjectNode>>> objects(@RequestParam String groupCode, @RequestParam String projectId, @RequestParam String buildingId, @RequestParam(required = false) Long ts, @RequestParam String clientId){
+        //从bdtp下载对象(空间、竖井、系统、设备、元空间)
+        QueryCriteria criteria = ServiceUtil.getQueryCriteria(objectMapper, AdmConst.OBJ_TYPE_SPACE, AdmConst.OBJ_TYPE_SHAFT, AdmConst.OBJ_TYPE_SYSTEM, AdmConst.OBJ_TYPE_EQUIPMENT, AdmConst.OBJ_TYPE_ISPACE);
+        String operator = CriteriaUtils.getOperator(clientId, TokenInterceptor.bossAuthUserThreadLocal.get().getId());
+        CriteriaUtils.buildDownloadQueryCriteria(criteria,operator,ts);
+
+        // 增量数据下载
+        if (ts != null && ts > 0){
+            criteria.getCriteria().putObject("ts").put("$gt", ts);
+            criteria.getCriteria().putObject("modifier").put("$ne", operator);
+        }
+        criteria.getCriteria().put("buildingId", buildingId);
+        List<ObjectNode> objs = ServiceUtil.queryAllPage(() -> objectClient.query(groupCode, projectId, AdmConst.APP_ID, TokenInterceptor.bossAuthUserThreadLocal.get().getId(), criteria), criteria, new Pagination(500));
+        if (objs == null)
+            objs = new ArrayList<>(0);
+
+        // 处理下载数据并压缩公共字段
+        downLoadDataDeal.packInfos(objs);
+        // 填充ts
+        downLoadDataDeal.test4Ts(objs);
+        DownLoadData<List<ObjectNode>> downLoadData = new DownLoadData<>();
+        downLoadData.setData(objs);
+        downLoadData.buildDownloadTs();
+        return ResultHelper.single(downLoadData);
+    }
+
+}

+ 62 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/dto/DownLoadData.java

@@ -0,0 +1,62 @@
+package com.persagy.adm.server.custom.dto;
+
+import cn.hutool.core.collection.CollUtil;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.persagy.adm.server.custom.entity.db.BaseAdmDataEntity;
+import com.persagy.dmp.common.model.entity.AuditableEntity;
+import com.persagy.dmp.common.model.entity.BaseEntity;
+import com.persagy.dmp.digital.entity.ObjectRelation;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+@Data
+public class DownLoadData<T> {
+
+    private Long ts;
+    private T data;
+
+    public void buildDownloadTs() {
+        long ts = getMaxTs();
+        if(ts > 0)
+            this.ts = ts;
+    }
+
+    protected long getMaxTs() {
+        if(data instanceof List){
+            List<?> list = (List<?>) data;
+            long maxTs = -1;
+            maxTs = max(list, maxTs);
+            return maxTs;
+        }
+        return 0;
+    }
+
+
+    private long max(List<?> list, long maxTs) {
+        if(CollUtil.isNotEmpty(list)) {
+            for (Object data : list) {
+                long ts = -1;
+                if(data instanceof BaseAdmDataEntity) {
+                    if(((BaseAdmDataEntity) data).getTs() != null )
+                        ts = ((BaseAdmDataEntity) data).getTs().getTime();
+                } else if(data instanceof ObjectNode){
+                    if(((ObjectNode) data).get("ts") != null)
+                        ts = ((ObjectNode) data).get("ts").asLong();
+                } else if (data instanceof AuditableEntity){
+                    Date ts1 = ((AuditableEntity) data).getTs();
+                    if (ts1 != null){
+                        ts = ts1.getTime();
+                    }
+                } else if(data instanceof BaseEntity) {
+                    if(((ObjectRelation) data).getTs() != null)
+                        ts = ((ObjectRelation) data).getTs().getTime();
+                }
+                if(ts > maxTs)
+                    maxTs = ts;
+            }
+        }
+        return maxTs;
+    }
+}

+ 4 - 21
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/entity/db/AdmFile.java

@@ -1,5 +1,6 @@
 package com.persagy.adm.server.custom.entity.db;
 
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 @Data
@@ -69,29 +70,11 @@ public class AdmFile extends BaseAdmDataEntity{
      */
     private String fileId;
 
+    private String groupCode;
+
 
     @Override
     public String toString() {
-        return "AdmFile{" +
-                "id=" + id +
-                ", fileType=" + fileType +
-                ", bizType=" + bizType +
-                ", filePath=" + filePath +
-                ", clientPath=" + clientPath +
-                ", refObjId=" + refObjId +
-                ", refInfoCode=" + refInfoCode +
-                ", remark=" + remark +
-                ", orderNum=" + orderNum +
-                ", projectId=" + projectId +
-                ", floorId=" + floorId +
-                ", buildingId=" + buildingId +
-                ", creator=" + creator +
-                ", creationTime=" + creationTime +
-                ", modifier=" + modifier +
-                ", modifiedTime=" + modifiedTime +
-                ", valid=" + valid +
-                ", fileId=" + fileId +
-                ", ts=" + ts +
-                "}";
+        return JSON.toJSONString(this);
     }
 }

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

@@ -15,6 +15,7 @@ import java.io.IOException;
 @Data
 @TableName(value = "adm_qr_code",autoResultMap = true)
 public class AdmQrCode extends BaseAdmDataEntity {
+    private String groupCode;
 
     private String qrCode;
 

+ 4 - 1
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/interceptor/AppContextConfig.java

@@ -20,7 +20,10 @@ public class AppContextConfig implements WebMvcConfigurer {
         InterceptorRegistration registration1 = registry.addInterceptor(new TraceIdInterceptor());
         registration1.addPathPatterns("/**");
 
-        registry.addInterceptor(tokenInterceptor).order(Integer.MAX_VALUE).addPathPatterns("/adm/**").excludePathPatterns("/adm/getUserInfo");
+        InterceptorRegistration StewardRegistration = registry.addInterceptor(new StewardInterceptor());
+        StewardRegistration.addPathPatterns("/deliver/plan/relayDeliverPlan");
+
+        registry.addInterceptor(tokenInterceptor).order(Integer.MAX_VALUE).addPathPatterns("/adm/**","/app/download/**").excludePathPatterns("/adm/getUserInfo","/deliver/plan/**");
 
     }
 }

+ 52 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/interceptor/StewardInterceptor.java

@@ -0,0 +1,52 @@
+package com.persagy.adm.server.custom.interceptor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.BufferedReader;
+import java.io.IOException;
+
+/**
+ * 解密拦截器
+ *
+ * @author:linhuili
+ * @date:2022/1/25
+ */
+@Slf4j
+@Component
+public class StewardInterceptor extends HandlerInterceptorAdapter {
+
+    @Override
+    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
+        // 不再在此处进行修改request请求参数
+        //String body = getBody(request);
+        //log.info("BOSS交付范围加密请求参数:{}"+body);
+        //RSAUtils.decode(body,SpringHelper.getString("boss.rsa.publicKey"));
+        return super.preHandle(request, response, handler);
+    }
+
+    /**
+     * 获取请求体
+     * @param request
+     * @return
+     * @throws IOException
+     */
+    public String getBody(HttpServletRequest request) throws IOException {
+        // 获取请求体
+        BufferedReader br = request.getReader();
+        String inputLine;
+        String body = "";
+        try {
+            while ((inputLine = br.readLine()) != null) {
+                body += inputLine;
+            }
+            br.close();
+        } catch (IOException e) {
+            System.out.println("IOException: " + e);
+        }
+        return body;
+    }
+
+}

+ 7 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/interceptor/TokenInterceptor.java

@@ -8,6 +8,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
+import org.springframework.web.servlet.ModelAndView;
 import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
 
 import javax.servlet.http.HttpServletRequest;
@@ -36,4 +37,10 @@ public class TokenInterceptor extends HandlerInterceptorAdapter {
         }
         return super.preHandle(request, response, handler);
     }
+
+    @Override
+    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
+        bossAuthUserThreadLocal.remove();
+        super.postHandle(request, response, handler, modelAndView);
+    }
 }

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

@@ -264,47 +264,29 @@ public class SyncAppImpl implements ISyncApp {
 
     @Override
     public BuildingData downloadBuildingData(AdmRequest admRequest) {
-        String groupCode = admRequest.getGroupCode();
         String projectId = admRequest.getProjectId();
         String userId = admRequest.getUserId();
         String clientId = admRequest.getClientId();
         String buildingId = admRequest.getBuildingId();
-        Long bdtpDownloadTs = admRequest.getBdtpDownloadTs();
         Long admDownloadTs = admRequest.getAdmDownloadTs();
         String operator = getOperator(clientId, userId);
 
-        //从bdtp下载对象(空间、竖井、系统、设备、元空间)
-        QueryCriteria criteria = ServiceUtil.getQueryCriteria(objectMapper, AdmConst.OBJ_TYPE_SPACE, AdmConst.OBJ_TYPE_SHAFT, AdmConst.OBJ_TYPE_SYSTEM, AdmConst.OBJ_TYPE_EQUIPMENT, "ispace");
-        buildDownloadQueryCriteria(criteria, operator, bdtpDownloadTs);
-        criteria.getCriteria().put("buildingId", buildingId);
-
-        List<ObjectNode> objs = ServiceUtil.queryAllPage(() -> objectClient.query(groupCode, projectId, AdmConst.APP_ID, userId, criteria), criteria, new Pagination(500));
-        if (objs == null)
-            objs = new ArrayList<>(0);
-
-        packInfos(objs);
-        test4Ts(objs);
-
         //关系数据按项目下载,不在建筑数据中处理
 
-        //管道数据,实验方案
-        List<AdmPipe> pipes = pipeMapper.selectList(buildDownloadQueryWrapper(new QueryWrapper<AdmPipe>(), projectId, buildingId, operator, admDownloadTs));
+        //管道数据,实验方案 暂时不需要
+//        List<AdmPipe> pipes = pipeMapper.selectList(buildDownloadQueryWrapper(new QueryWrapper<AdmPipe>(), projectId, buildingId, operator, admDownloadTs));
 
-        //任务相关数据查询
-        List<AdmJobSpace> jobSpace = jobSpaceMapper.selectList(buildDownloadQueryWrapper(new QueryWrapper<AdmJobSpace>(), projectId, buildingId, operator, admDownloadTs));
+        //任务相关数据查询 细节待产品细化
+//        List<AdmJobSpace> jobSpace = jobSpaceMapper.selectList(buildDownloadQueryWrapper(new QueryWrapper<AdmJobSpace>(), projectId, buildingId, operator, admDownloadTs));
 
-        List<AdmFile> file = fileMapper.selectList(buildDownloadQueryWrapper(new QueryWrapper<AdmFile>(), projectId, buildingId, operator, admDownloadTs));
-        List<AdmQrCode> qrCode = qrCodeMapper.selectList(buildDownloadQueryWrapper(new QueryWrapper<AdmQrCode>(), projectId, buildingId, operator, admDownloadTs));
-        List<AdmServeArea> serveArea = serveAreaMapper.selectList(buildDownloadQueryWrapper(new QueryWrapper<AdmServeArea>(), projectId, buildingId, operator, admDownloadTs));
+        // 暂时涉及不到,不明白是干嘛的
+//        List<AdmServeArea> serveArea = serveAreaMapper.selectList(buildDownloadQueryWrapper(new QueryWrapper<AdmServeArea>(), projectId, buildingId, operator, admDownloadTs));
 
         BuildingData data = new BuildingData();
         data.setBuildingId(buildingId);
-        data.setObjects(objs);
-        data.setPipes(pipes);
-        data.setJobSpace(jobSpace);
-        data.setFile(file);
-        data.setQrCode(qrCode);
-        data.setServeArea(serveArea);
+//        data.setPipes(pipes);
+//        data.setJobSpace(jobSpace);
+//        data.setServeArea(serveArea);
         fillBuildingDataChain.fill(admRequest,data);
         data.buildDownloadTs();
 

+ 17 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/offline_data_download/CriteriaUtils.java

@@ -0,0 +1,17 @@
+package com.persagy.adm.server.custom.service.impl.offline_data_download;
+
+import com.persagy.dmp.basic.model.QueryCriteria;
+
+public class CriteriaUtils {
+
+    public static void buildDownloadQueryCriteria(QueryCriteria criteria, String operator, Long lastDownloadTime) {
+        if (lastDownloadTime != null && lastDownloadTime > 0) {
+            criteria.getCriteria().putObject("ts").put("$gt", lastDownloadTime);
+            criteria.getCriteria().putObject("modifier").put("$ne", operator); //TODO 暂时只能处理modifier
+        }
+    }
+
+    public static String getOperator(String clientId, String userId) {
+        return userId + ':' + clientId;
+    }
+}

+ 62 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/offline_data_download/DownLoadDataDeal.java

@@ -0,0 +1,62 @@
+package com.persagy.adm.server.custom.service.impl.offline_data_download;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.persagy.adm.server.custom.util.DataExtrasUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+@Component
+public class DownLoadDataDeal {
+    @Autowired
+    private ObjectMapper objectMapper;
+
+    public void packInfos(List<ObjectNode> dataList) {
+        if (dataList != null) {
+            for (ObjectNode node : dataList) {
+                handle4Download(node);
+                DataExtrasUtil.packObjExtras(node);
+            }
+        }
+    }
+
+    /**
+     * 下载前处理数据结构
+     */
+    public void handle4Download(ObjectNode node) {
+        JsonNode ol = node.get("outline");
+        if (ol != null) {
+            try {
+                node.set("outline", objectMapper.readValue(ol.asText(), ArrayNode.class));
+            } catch (Exception e) {
+
+            }
+        }
+        JsonNode bl = node.get("bimLocation");
+        if (bl != null) {
+            try {
+                String[] arr = bl.asText().split(",");
+                ObjectNode ln = objectMapper.createObjectNode();
+                ln.put("x", Double.parseDouble(arr[0]));
+                ln.put("y", Double.parseDouble(arr[1]));
+                ln.put("z", Double.parseDouble(arr[2]));
+                node.set("location", ln);
+                node.remove("bimLocation");
+            } catch (Exception e) {
+
+            }
+        }
+    }
+
+    public void test4Ts(List<ObjectNode> dataList) {
+        long ts = System.currentTimeMillis();
+        for (ObjectNode data : dataList) {
+            if (data.get("ts") == null)
+                data.put("ts", ts);
+        }
+    }
+}

+ 14 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/offline_data_download/FillBuildingDataChain.java

@@ -19,14 +19,28 @@ public class FillBuildingDataChain implements FillData<BuildingData>{
     FillProblem fillProblem;
     @Autowired
     FillCad fillCad;
+    @Autowired
+    FillFile fillFile;
+    @Autowired
+    FillQrCode fillQrCode;
+    @Autowired
+    FillObject fillObject;
 
     @PostConstruct
     public void init(){
         fillList = Lists.newArrayList();
+        /* ADM数据库数据*/
         // 问题数据
         fillList.add(fillProblem);
         // CAD图纸
         fillList.add(fillCad);
+        // 附件现场照片等
+        fillList.add(fillFile);
+        // 二维码数据
+        fillList.add(fillQrCode);
+        /* BDTP数据库数据*/
+        // 对象数据
+        fillList.add(fillObject);
     }
 
     @Override

+ 1 - 1
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/offline_data_download/FillCad.java

@@ -29,6 +29,6 @@ public class FillCad implements FillData<BuildingData>{
                 .eq(AdmCad::getBuildingId,admRequest.getBuildingId())
                 .gt(admDownloadTs != null && admDownloadTs != 0,AdmCad::getTs,admDownloadTs));
         buildingData.setAdmCads(admCads);
-        log.info("填充CAD图纸数据开始");
+        log.info("填充CAD图纸数据结束");
     }
 }

+ 36 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/offline_data_download/FillFile.java

@@ -0,0 +1,36 @@
+package com.persagy.adm.server.custom.service.impl.offline_data_download;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.persagy.adm.server.custom.common.AdmRequest;
+import com.persagy.adm.server.custom.dao.AdmFileMapper;
+import com.persagy.adm.server.custom.entity.BuildingData;
+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;
+
+import java.util.List;
+
+/**
+ * 离线数据-核查问题现场照片附件
+ */
+@Component
+@Slf4j
+public class FillFile implements FillData<BuildingData>{
+    @Autowired
+    AdmFileMapper fileMapper;
+    @Override
+    public void fill(AdmRequest admRequest, BuildingData buildingData) {
+        log.info("填充现场照片附件数据开始");
+        LambdaQueryWrapper<AdmFile> queryWrapper = Wrappers.lambdaQuery(AdmFile.class)
+                .eq(AdmFile::getGroupCode,admRequest.getGroupCode())
+                .eq(AdmFile::getProjectId,admRequest.getProjectId())
+                .eq(AdmFile::getBuildingId,admRequest.getBuildingId())
+                .eq(admRequest.getAdmDownloadTs() != null && admRequest.getAdmDownloadTs() != 0 ,AdmFile::getTs,admRequest.getAdmDownloadTs())
+                .eq(admRequest.getAdmDownloadTs() != null && admRequest.getAdmDownloadTs() != 0 ,AdmFile::getModifier,CriteriaUtils.getOperator(admRequest.getClientId(),admRequest.getUserId()));
+        List<AdmFile> files = fileMapper.selectList(queryWrapper);
+        buildingData.setFile(files);
+        log.info("填充现场照片附件数据结束");
+    }
+}

+ 57 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/offline_data_download/FillObject.java

@@ -0,0 +1,57 @@
+package com.persagy.adm.server.custom.service.impl.offline_data_download;
+
+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.common.AdmRequest;
+import com.persagy.adm.server.custom.entity.BuildingData;
+import com.persagy.adm.server.custom.entity.Pagination;
+import com.persagy.adm.server.custom.service.ServiceUtil;
+import com.persagy.dmp.basic.model.QueryCriteria;
+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.ArrayList;
+import java.util.List;
+
+/**
+ * 离线数据下载-对象实例数据
+ */
+@Component
+@Slf4j
+public class FillObject implements FillData<BuildingData>{
+    @Autowired
+    private ObjectMapper objectMapper;
+    @Autowired
+    private DigitalObjectClient objectClient;
+    @Autowired
+    DownLoadDataDeal downLoadDataDeal;
+
+    @Override
+    public void fill(AdmRequest admRequest, BuildingData buildingData) {
+        log.info("填充对象实例纸数据开始");
+        //从bdtp下载对象(空间、竖井、系统、设备、元空间)
+        QueryCriteria criteria = ServiceUtil.getQueryCriteria(objectMapper, AdmConst.OBJ_TYPE_SPACE, AdmConst.OBJ_TYPE_SHAFT, AdmConst.OBJ_TYPE_SYSTEM, AdmConst.OBJ_TYPE_EQUIPMENT, AdmConst.OBJ_TYPE_ISPACE);
+        String operator = CriteriaUtils.getOperator(admRequest.getClientId(), admRequest.getUserId());
+        CriteriaUtils.buildDownloadQueryCriteria(criteria,operator,admRequest.getBdtpDownloadTs());
+
+        // 增量数据下载
+        if (admRequest.getBdtpDownloadTs() != null && admRequest.getBdtpDownloadTs() > 0){
+            criteria.getCriteria().putObject("ts").put("$gt", admRequest.getBdtpDownloadTs());
+            criteria.getCriteria().putObject("modifier").put("$ne", operator);
+        }
+        criteria.getCriteria().put("buildingId", admRequest.getBuildingId());
+        List<ObjectNode> objs = ServiceUtil.queryAllPage(() -> objectClient.query(admRequest.getGroupCode(), admRequest.getProjectId(), AdmConst.APP_ID, admRequest.getUserId(), criteria), criteria, new Pagination(500));
+        if (objs == null)
+            objs = new ArrayList<>(0);
+
+        // 处理下载数据并压缩公共字段
+        downLoadDataDeal.packInfos(objs);
+        // 填充ts
+        downLoadDataDeal.test4Ts(objs);
+        buildingData.setObjects(objs);
+        log.info("填充对象实例数据结束");
+    }
+}

+ 38 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/offline_data_download/FillQrCode.java

@@ -0,0 +1,38 @@
+package com.persagy.adm.server.custom.service.impl.offline_data_download;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.persagy.adm.server.custom.common.AdmRequest;
+import com.persagy.adm.server.custom.dao.AdmQrCodeMapper;
+import com.persagy.adm.server.custom.entity.BuildingData;
+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;
+
+import java.util.List;
+
+/**
+ * 离线数据下载-二维码数据
+ */
+@Component
+@Slf4j
+public class FillQrCode implements FillData<BuildingData>{
+
+    @Autowired
+    AdmQrCodeMapper qrCodeMapper;
+
+    @Override
+    public void fill(AdmRequest admRequest, BuildingData buildingData) {
+        log.info("填充二维码数据开始");
+        LambdaQueryWrapper<AdmQrCode> queryWrapper = Wrappers.lambdaQuery(AdmQrCode.class)
+                .eq(AdmQrCode::getGroupCode,admRequest.getGroupCode())
+                .eq(AdmQrCode::getProjectId,admRequest.getProjectId())
+                .eq(AdmQrCode::getBuildingId,admRequest.getBuildingId())
+                .eq(admRequest.getAdmDownloadTs() != null && admRequest.getAdmDownloadTs() != 0 ,AdmQrCode::getTs,admRequest.getAdmDownloadTs())
+                .eq(admRequest.getAdmDownloadTs() != null && admRequest.getAdmDownloadTs() != 0 ,AdmQrCode::getModifier,CriteriaUtils.getOperator(admRequest.getClientId(),admRequest.getUserId()));
+        List<AdmQrCode> qrCode = qrCodeMapper.selectList(queryWrapper);
+        buildingData.setQrCode(qrCode);
+        log.info("填充二维码数据开始");
+    }
+}

+ 23 - 8
adm-business/adm-server/src/main/java/com/persagy/adm/server/delivery/controller/AdmDeliverPlanController.java

@@ -1,9 +1,14 @@
 package com.persagy.adm.server.delivery.controller;
 
 import com.alibaba.fastjson.JSONObject;
+import com.persagy.adm.server.delivery.entity.BossProjectDeliveryPlan;
 import com.persagy.adm.server.delivery.service.AdmDeliverPlanService;
+import com.persagy.adm.steward.basic.model.response.BossResponse;
 import com.persagy.adm.steward.basic.utils.RSAUtils;
+import com.persagy.adm.steward.entity.ProductFinishNumReq;
 import com.persagy.adm.steward.entity.ProjectDeliverReq;
+import com.persagy.dmp.basic.model.QueryCriteria;
+import com.persagy.dmp.common.helper.SpringHelper;
 import com.persagy.dmp.common.model.response.CommonResult;
 import com.persagy.dmp.common.utils.ResultHelper;
 import lombok.RequiredArgsConstructor;
@@ -31,25 +36,35 @@ public class AdmDeliverPlanController {
 
     private final AdmDeliverPlanService admDeliverPlanService;
 
-    @Value("${adm.rsa.privateKey}")
-    private String privateKey;
+    @Value("${boss.rsa.privateKey}")
+    private String bossRsaPrivateKey;
 
     /**
      * 020101-交付计划-处理BOSS产生的交付计划
-     * @param projectDeliverReqStr : 交付计划信息
+     * @param requestStr : 交付计划信息
      * @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(@RequestBody String projectDeliverReqStr) {
-        //todo 测试
-        String decode = RSAUtils.decode(projectDeliverReqStr, privateKey);
-        log.info("接受BOSS产生的交付计划入参:{}"+decode);
-        ProjectDeliverReq projectDeliverReq = JSONObject.parseObject(decode, ProjectDeliverReq.class);
+    public CommonResult<List<Void>> relayDeliverPlan(@RequestBody String requestStr) {
+        String projectDeliverReqStr = RSAUtils.decode(requestStr, bossRsaPrivateKey);
+        ProjectDeliverReq projectDeliverReq = JSONObject.parseObject(projectDeliverReqStr, ProjectDeliverReq.class);
+        log.info("接收BOSS交付计划入参:{}"+projectDeliverReq);
         admDeliverPlanService.relayDeliverPlan(projectDeliverReq);
         return ResultHelper.multi(new ArrayList<>());
     }
 
+    /**
+     * 交付完成-测试
+     * @param deliveryPlan
+     * @return
+     */
+    @PostMapping(value = "/finishDeliverPlan")
+    public BossResponse<List<ProductFinishNumReq>> finishDeliverPlan(@RequestBody BossProjectDeliveryPlan deliveryPlan) {
+        List<ProductFinishNumReq> finishDeliverPlan = admDeliverPlanService.finishDeliverPlan(deliveryPlan);
+        return BossResponse.success(finishDeliverPlan);
+    }
+
 
 }

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

@@ -1,7 +1,11 @@
 package com.persagy.adm.server.delivery.service;
 
+import com.persagy.adm.server.delivery.entity.BossProjectDeliveryPlan;
+import com.persagy.adm.steward.entity.ProductFinishNumReq;
 import com.persagy.adm.steward.entity.ProjectDeliverReq;
 
+import java.util.List;
+
 /**
  * 对接BOSS的交付计划逻辑处理接口
  * @author : lijie
@@ -15,4 +19,11 @@ public interface AdmDeliverPlanService {
      * Update By 2022/1/14 17:22
      */
     void relayDeliverPlan(ProjectDeliverReq projectDeliverReq);
+
+    /**
+     * 交付完成
+     * @param deliveryPlan
+     * @return
+     */
+    List<ProductFinishNumReq> finishDeliverPlan(BossProjectDeliveryPlan deliveryPlan);
 }

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

@@ -1,17 +1,21 @@
 package com.persagy.adm.server.delivery.service.impl;
 
 import cn.hutool.core.collection.CollUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 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.client.BossStewardFacade;
+import com.persagy.adm.steward.entity.ProductFinishNumReq;
 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.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -43,6 +47,49 @@ public class AdmDeliverPlanServiceImpl implements AdmDeliverPlanService {
     }
 
     /**
+     * 交付完成-测试
+     * @param deliveryPlan
+     * @return
+     */
+    @Override
+    public List<ProductFinishNumReq> finishDeliverPlan(BossProjectDeliveryPlan deliveryPlan) {
+        //组装查询条件
+        LambdaQueryWrapper<BossProjectDeliveryPlan> queryWrapper = new LambdaQueryWrapper<>();
+        if(deliveryPlan.getProjectId()!=null){
+            queryWrapper.eq(BossProjectDeliveryPlan::getProjectId,deliveryPlan.getProjectId());
+        }
+        if(deliveryPlan.getPlanId() != null){
+            queryWrapper.eq(BossProjectDeliveryPlan::getPlanId,deliveryPlan.getPlanId());
+        }
+        if(deliveryPlan.getPlanInfoId() != null){
+            queryWrapper.eq(BossProjectDeliveryPlan::getPlanInfoId,deliveryPlan.getPlanInfoId());
+        }
+        queryWrapper.eq(BossProjectDeliveryPlan::getValid,true);
+        //查询BOSS交付任务
+        List<BossProjectDeliveryPlan> bossProjectDeliveryPlans = bossDeliveryPlanService.queryByCondition(queryWrapper);
+        if(CollUtil.isEmpty(bossProjectDeliveryPlans)){
+            return new ArrayList<>();
+        }
+
+        List<ProductFinishNumReq> result = new ArrayList<>();
+        //组装BOSS所需参数
+        bossProjectDeliveryPlans.forEach(item->{
+            ProductFinishNumReq finishNumReq = new ProductFinishNumReq();
+            finishNumReq.setPlanInfoId(item.getProjectId());
+            Long productNum = item.getProductNum();
+            if(productNum == null){
+                finishNumReq.setFinishNum(0);
+            }else{
+                finishNumReq.setFinishNum(item.getProductNum().intValue());
+            }
+            result.add(finishNumReq);
+        });
+        //通过FeignClient调用回调接口
+        BossStewardFacade.finishDeliverPlan(result);
+        return result;
+    }
+
+    /**
      * 生成项目交付计划
      * @param projectDeliverReq
      */
@@ -96,7 +143,7 @@ public class AdmDeliverPlanServiceImpl implements AdmDeliverPlanService {
             }
         }
         //生成项目交付信息
-        DigitalObjectTypeCollectFacade.createProjectDelivery(groupCode,"Pj"+ projectId, null, null, result);
+        DigitalObjectTypeCollectFacade.createProjectDelivery("HR","Pj4403050002", null, null, result);
         //存储原BOSS订单信息
         bossDeliveryPlanService.insert(bossProjectDeliveryPlan);
     }

+ 23 - 19
adm-business/adm-server/src/main/resources/db/init/schema.sql

@@ -8,7 +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 '集团编码',
+  `group_code` varchar(40) 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 '最后修改人',
@@ -97,6 +97,7 @@ CREATE TABLE IF NOT EXISTS `adm_file`  (
   `ref_info_code` varchar(40) NULL DEFAULT NULL COMMENT '关联的对象信息点code',
   `remark` varchar(200) NULL DEFAULT NULL COMMENT '描述',
   `order_num` tinyint(0) NULL DEFAULT NULL COMMENT '文件附件(照片)的排序序号',
+  `group_code` varchar(40) NOT NULL COMMENT '集团编码',
   `project_id` varchar(40) NOT NULL COMMENT '项目id',
   `floor_id` varchar(60) NULL DEFAULT NULL COMMENT '楼层id',
   `building_id` varchar(60) NULL DEFAULT NULL COMMENT '建筑id',
@@ -206,6 +207,7 @@ CREATE TABLE IF NOT EXISTS `adm_pipe_config`  (
 
 CREATE TABLE IF NOT EXISTS `adm_problem`  (
   `id` varchar(100) NOT NULL,
+  `group_code` varchar(40) NOT NULL COMMENT '集团id',
   `project_id` varchar(40) NOT NULL COMMENT '项目id',
   `building_id` varchar(60) NOT NULL COMMENT '建筑id',
   `floor_id` varchar(60) NOT NULL COMMENT '问题所在楼层id',
@@ -218,7 +220,8 @@ CREATE TABLE IF NOT EXISTS `adm_problem`  (
   `type_code` varchar(20) NOT NULL COMMENT '问题类型编码',
   `type_name` varchar(40) NOT NULL COMMENT '问题类型名称',
   `info` json NULL COMMENT '问题描述',
-  `state` tinyint(0) NOT NULL COMMENT '建筑结构核查任务状态(1:有效;2:已解决)',
+  `status` tinyint(0) NOT NULL COMMENT '建筑结构核查任务状态(1:有效;2:已解决)',
+  `remark` varchar(255) DEFAULT NULL COMMENT '备注',
   `creator` varchar(32) NULL DEFAULT NULL COMMENT '创建人',
   `creation_time` char(14) NULL DEFAULT NULL COMMENT '创建时间',
   `modifier` varchar(32) NULL DEFAULT NULL COMMENT '最后修改人',
@@ -275,6 +278,7 @@ CREATE TABLE IF NOT EXISTS `adm_qr_code`  (
   `floor_id` varchar(60) NOT NULL COMMENT '楼层id',
   `location` json NOT NULL COMMENT '位置坐标({x:1,y:1,z:1})',
   `remark` varchar(200) NULL DEFAULT NULL COMMENT '描述信息(临时记录二维码粘贴位置)',
+  `group_code` varchar(40) NOT NULL COMMENT '集团编码',
   `project_id` varchar(40) NOT NULL COMMENT '项目id',
   `building_id` varchar(60) NOT NULL COMMENT '建筑id',
   `creator` varchar(32) NULL DEFAULT NULL COMMENT '创建人',
@@ -408,7 +412,7 @@ CREATE TABLE IF NOT EXISTS `adm_model_file` (
 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:对象类型编码',
+    `class_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 '创建时间',
@@ -419,19 +423,19 @@ CREATE TABLE IF NOT EXISTS `boss_sku_dict_rel` (
     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项目交付计划';
+CREATE TABLE IF NOT EXISTS "boss_project_delivery_plan" (
+  "id" varchar(40) CHARACTER SET utf8mb4 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) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '商品编码',
+  "product_num" int DEFAULT NULL COMMENT '商品对应的实施数量',
+  "steward_account" varchar(40) 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;

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

@@ -27,7 +27,8 @@ public class StewardEncodeInterceptor implements RequestInterceptor {
         }
         // 更改请求体中的content的值
         Request.Body body = template.requestBody();
-        JSONObject temp = JSONObject.parseObject(body.asString());
-        template.body(RSAUtils.decode(body.asString(), SpringHelper.getString("adm.rsa.privateKey")));
+        template.body(RSAUtils.encode(body.asString(), SpringHelper.getString("bdtp.rsa.publicKey")));
+        log.info("template:{}",template);
+        log.info("body.asString():{}",body.asString());
     }
 }

+ 10 - 0
adm-comp/adm-steward-starter/src/main/java/com/persagy/adm/steward/client/BossStewardClient.java

@@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.node.ArrayNode;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.persagy.adm.steward.basic.config.StewardFeignConfig;
 import com.persagy.adm.steward.basic.model.response.BossResponse;
+import com.persagy.adm.steward.entity.ProductFinishNumReq;
 import com.persagy.dmp.common.model.response.CommonResult;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -32,4 +33,13 @@ public interface BossStewardClient {
     @PostMapping("test")
     BossResponse<Void> test(@RequestHeader(value = "encryption-rsa", required = false,defaultValue = "true") Boolean rsaFlag,
                             @RequestBody Set<String> projectIds);
+
+    /**
+     * 项目交付完成接口回调
+     * @param productFinishNumReqList: 交付完成信息
+     * @return 对象数组
+     */
+    @PostMapping("test")
+    BossResponse<List<ProductFinishNumReq>> finishDeliverPlan(@RequestHeader(value = "encryption-rsa", required = false,defaultValue = "true") Boolean rsaFlag,
+                                                              @RequestBody List<ProductFinishNumReq> productFinishNumReqList);
 }

+ 12 - 0
adm-comp/adm-steward-starter/src/main/java/com/persagy/adm/steward/client/BossStewardFacade.java

@@ -1,6 +1,9 @@
 package com.persagy.adm.steward.client;
 
 import cn.hutool.extra.spring.SpringUtil;
+import com.persagy.adm.steward.entity.ProductFinishNumReq;
+
+import java.util.List;
 import java.util.Set;
 
 /**
@@ -20,4 +23,13 @@ public class BossStewardFacade {
     public static void test(Set<String> projectIds) {
         client.test(Boolean.TRUE,projectIds);
     }
+
+    /**
+     * feign调用回调
+     * @param productFinishNumReqList: 交付内容
+     * @return 对象数组
+     */
+    public static void finishDeliverPlan(List<ProductFinishNumReq> productFinishNumReqList) {
+        client.finishDeliverPlan(Boolean.TRUE,productFinishNumReqList);
+    }
 }

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

@@ -140,7 +140,7 @@ public class ProjectDeliverReq implements Serializable {
         /**
          * 楼层id
          */
-        private Integer storeyId;
+        private String storeyId;
 
         private String storeyName;
     }

Fichier diff supprimé car celui-ci est trop grand
+ 0 - 4
adm-comp/adm-steward-starter/src/main/resources/application.yml