소스 검색

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

zhaoyk 2 년 전
부모
커밋
ea70759324

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

@@ -73,7 +73,7 @@ public class AppController {
 		req.setUserId(TokenInterceptor.bossAuthUserThreadLocal.get().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());
+			data = syncApp.downloadBuildingData(req);
 		}else {
 			throw new BusinessException(ResponseCode.A0400.getCode(),"建筑ID不能为空");
 		}

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

@@ -46,7 +46,7 @@ public class BuildingData extends DownLoadData {
 		long ts = getMaxTs(objects, relations);
 		if(ts > 0)
 			bdtpDownloadTs = ts;
-		ts = getMaxTs(pipes, jobSpace, file, qrCode, serveArea);
+		ts = getMaxTs(pipes, jobSpace, file, qrCode, serveArea,problems,admCads);
 		if(ts > 0)
 			admDownloadTs = ts;
 	}

+ 7 - 0
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/entity/DownLoadData.java

@@ -3,10 +3,12 @@ package com.persagy.adm.server.custom.entity;
 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;
 
 /**
@@ -33,6 +35,11 @@ abstract public class DownLoadData {
 				} 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();

+ 2 - 1
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/ISyncApp.java

@@ -1,5 +1,6 @@
 package com.persagy.adm.server.custom.service;
 
+import com.persagy.adm.server.custom.common.AdmRequest;
 import com.persagy.adm.server.custom.dto.HasUpdateReq;
 import com.persagy.adm.server.custom.entity.*;
 
@@ -24,7 +25,7 @@ public interface ISyncApp {
 
 	BuildingData downloadBuildingData(String projectId, String buildingId, String uploadFlag, String lastDownloadTime);
 
-	BuildingData downloadBuildingData(String groupCode, String projectId, String userId, String clientId, String buildingId, Long bdtpDownloadTs, Long admDownloadTs);
+	BuildingData downloadBuildingData(AdmRequest admRequest);
 
 	ProjectData downloadProjectData(String groupCode, String projectId, String userId, String clientId, Long bdtpDownloadTs, Long admDownloadTs);
 

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 692 - 685
adm-business/adm-server/src/main/java/com/persagy/adm/server/custom/service/impl/SyncAppImpl.java


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

@@ -7,7 +7,7 @@ import org.springframework.stereotype.Component;
 import javax.annotation.PostConstruct;
 import java.util.List;
 @Component
-public class CheckUpdateChain{
+public class CheckUpdateChain implements CheckUpdate{
     @Autowired
     AdmProblemCheckUpdate admProblemCheck;
     @Autowired
@@ -57,6 +57,7 @@ public class CheckUpdateChain{
         checkUpdates.add(metaSpaceObjRelCheckUpdate);
     }
 
+    @Override
     public boolean doCheck(CheckUpdateContext hasUpdateReq) {
         for (CheckUpdate checkUpdate : checkUpdates){
             if (checkUpdate.doCheck(hasUpdateReq)){

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

@@ -0,0 +1,36 @@
+package com.persagy.adm.server.custom.service.impl.offline_data_download;
+
+import com.persagy.adm.server.custom.common.AdmRequest;
+import com.persagy.adm.server.custom.entity.BuildingData;
+import lombok.extern.slf4j.Slf4j;
+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
+@Slf4j
+public class FillBuildingDataChain implements FillData<BuildingData>{
+    List<FillData<BuildingData>> fillList;
+
+    @Autowired
+    FillProblem fillProblem;
+    @Autowired
+    FillCad fillCad;
+
+    @PostConstruct
+    public void init(){
+        fillList = Lists.newArrayList();
+        // 问题数据
+        fillList.add(fillProblem);
+        // CAD图纸
+        fillList.add(fillCad);
+    }
+
+    @Override
+    public void fill(AdmRequest admRequest, BuildingData downLoadData) {
+        fillList.forEach(buildingDataFillData -> buildingDataFillData.fill(admRequest,downLoadData));
+    }
+}

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

@@ -0,0 +1,34 @@
+package com.persagy.adm.server.custom.service.impl.offline_data_download;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.persagy.adm.server.custom.common.AdmRequest;
+import com.persagy.adm.server.custom.dao.AdmCadMapper;
+import com.persagy.adm.server.custom.entity.BuildingData;
+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;
+
+import java.util.List;
+
+/**
+ * 离线数据下载-CAD图纸数据
+ */
+@Component
+@Slf4j
+public class FillCad implements FillData<BuildingData>{
+    @Autowired
+    AdmCadMapper admCadMapper;
+    @Override
+    public void fill(AdmRequest admRequest, BuildingData buildingData) {
+        log.info("填充CAD图纸数据开始");
+        Long admDownloadTs = buildingData.getAdmDownloadTs();
+        List<AdmCad> admCads = admCadMapper.selectList(new LambdaQueryWrapper<AdmCad>()
+                .eq(AdmCad::getGroupCode,admRequest.getGroupCode())
+                .eq(AdmCad::getProjectId,admRequest.getProjectId())
+                .eq(AdmCad::getBuildingId,admRequest.getBuildingId())
+                .gt(admDownloadTs != null && admDownloadTs != 0,AdmCad::getTs,admDownloadTs));
+        buildingData.setAdmCads(admCads);
+        log.info("填充CAD图纸数据开始");
+    }
+}

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

@@ -0,0 +1,9 @@
+package com.persagy.adm.server.custom.service.impl.offline_data_download;
+
+import com.persagy.adm.server.custom.common.AdmRequest;
+import com.persagy.adm.server.custom.entity.DownLoadData;
+
+public interface FillData<T extends DownLoadData>{
+
+    void fill(AdmRequest admRequest, T t);
+}

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

@@ -0,0 +1,40 @@
+package com.persagy.adm.server.custom.service.impl.offline_data_download;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.persagy.adm.server.custom.common.AdmRequest;
+import com.persagy.adm.server.custom.dao.AdmProblemMapper;
+import com.persagy.adm.server.custom.entity.BuildingData;
+import com.persagy.adm.server.custom.entity.db.AdmProblem;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * 离线数据下载-核查问题数据
+ */
+@Component
+@Slf4j
+public class FillProblem implements FillData<BuildingData>{
+
+    @Autowired
+    AdmProblemMapper problemMapper;
+
+    @Override
+    public void fill(AdmRequest admRequest, BuildingData buildingData) {
+        log.info("填充任务数据开始");
+        String operator = admRequest.getUserId() + ":" + admRequest.getClientId();
+        // 问题相关数据
+        LambdaQueryWrapper<AdmProblem> queryWrapper = new LambdaQueryWrapper<AdmProblem>()
+                .eq(AdmProblem::getGroupCode, admRequest.getGroupCode())
+                .eq(AdmProblem::getProjectId, admRequest.getProjectId())
+                .eq(AdmProblem::getBuildingId, admRequest.getBuildingId())
+                .gt(admRequest.getAdmDownloadTs()!=null && admRequest.getAdmDownloadTs() != 0,AdmProblem::getTs, admRequest.getAdmDownloadTs())
+                .ne(StringUtils.isNotBlank(operator),AdmProblem::getModifier,operator);
+        List<AdmProblem> problems = problemMapper.selectList(queryWrapper);
+        buildingData.setProblems(problems);
+        log.info("填充任务结束");
+    }
+}