|
@@ -24,7 +24,6 @@ import com.persagy.dmp.common.constant.ValidEnum;
|
|
|
import com.persagy.dmp.define.entity.RelationDefine;
|
|
|
import com.persagy.dmp.digital.client.DigitalObjectClient;
|
|
|
import com.persagy.dmp.digital.client.DigitalRelationClient;
|
|
|
-import com.persagy.dmp.digital.entity.ObjectRelation;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -256,7 +255,9 @@ public class SyncAppImpl implements ISyncApp {
|
|
|
|
|
|
//从bdtp下载对象(空间、竖井、系统、设备)
|
|
|
QueryCriteria criteria = ServiceUtil.getQueryCriteria(objectMapper, AdmConst.OBJ_TYPE_SPACE, AdmConst.OBJ_TYPE_SHAFT, AdmConst.OBJ_TYPE_SYSTEM, AdmConst.OBJ_TYPE_EQUIPMENT);
|
|
|
- buildDownloadQueryCriteria(criteria, operator, bdtpDownloadTs, buildingId);
|
|
|
+ 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);
|
|
@@ -315,25 +316,19 @@ public class SyncAppImpl implements ISyncApp {
|
|
|
return wrapper;
|
|
|
}
|
|
|
|
|
|
- private void buildDownloadQueryCriteria(QueryCriteria criteria, String operator, Long lastDownloadTime, String buildingId){
|
|
|
+ private 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
|
|
|
}
|
|
|
- if(StrUtil.isNotBlank(buildingId))
|
|
|
- criteria.getCriteria().put("buildingId", buildingId);
|
|
|
}
|
|
|
|
|
|
//TODO debug 接口未返回ts时,添加一个
|
|
|
- private void test4Ts(List<?> dataList){
|
|
|
- for(Object data : dataList) {
|
|
|
- if(data instanceof ObjectNode) {
|
|
|
- if (((ObjectNode) data).get("ts") == null)
|
|
|
- ((ObjectNode) data).put("ts", System.currentTimeMillis());
|
|
|
- } else if(data instanceof ObjectRelation){
|
|
|
- if(((ObjectRelation) data).getTs() == null)
|
|
|
- ((ObjectRelation) data).setTs(new Date());
|
|
|
- }
|
|
|
+ private void test4Ts(List<ObjectNode> dataList){
|
|
|
+ long ts = System.currentTimeMillis();
|
|
|
+ for(ObjectNode data : dataList) {
|
|
|
+ if (data.get("ts") == null)
|
|
|
+ data.put("ts", ts);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -342,13 +337,19 @@ public class SyncAppImpl implements ISyncApp {
|
|
|
String operator = getOperator(clientId, userId);
|
|
|
|
|
|
QueryCriteria criteria = ServiceUtil.getQueryCriteria(objectMapper);
|
|
|
- buildDownloadQueryCriteria(criteria, operator, bdtpDownloadTs, null);
|
|
|
+ buildDownloadQueryCriteria(criteria, operator, bdtpDownloadTs);
|
|
|
+ criteria.getCriteria().put("createApp", AdmConst.CREATOR_APP);
|
|
|
|
|
|
- //List<ObjectRelation> rels = ServiceUtil.queryAllPage(() -> relationClient.query(groupCode, projectId, AdmConst.APP_ID, userId, criteria), criteria, new Pagination(500));
|
|
|
+ List<ObjectNode> rels = ServiceUtil.queryAllPage(() -> rwdClient.queryRelation(groupCode, projectId, AdmConst.APP_ID, userId, criteria), criteria, new Pagination(500));
|
|
|
+ /*
|
|
|
//TODO debug 关系数据量过大,测试下载1000条
|
|
|
criteria.setPage(1L);
|
|
|
criteria.setSize(1000L);
|
|
|
List<ObjectNode> rels = ServiceUtil.call(() -> rwdClient.queryRelation(groupCode, projectId, AdmConst.APP_ID, userId, criteria));
|
|
|
+ */
|
|
|
+
|
|
|
+ if(rels == null)
|
|
|
+ rels = new ArrayList<>();
|
|
|
test4Ts(rels);
|
|
|
|
|
|
ProjectData data = new ProjectData();
|
|
@@ -453,7 +454,6 @@ public class SyncAppImpl implements ISyncApp {
|
|
|
ObjectNode entity = iter.next();
|
|
|
handle4Upload(entity);
|
|
|
DataExtrasUtil.unpackObjExtras(entity);
|
|
|
- entity.remove("ts"); //调用bdtp接口前,删除ts字段
|
|
|
|
|
|
AdmUploadLog log;
|
|
|
if (entity.get("state").asInt() == 1) {
|
|
@@ -477,10 +477,6 @@ public class SyncAppImpl implements ISyncApp {
|
|
|
entity.put("modifier", operator);
|
|
|
entity.put("modifiedTime", time);
|
|
|
|
|
|
- //修改对象信息点,轮廓不上传
|
|
|
- if(entity.get("outline") != null)
|
|
|
- entity.remove("outline");
|
|
|
-
|
|
|
//TODO 可能需要进行删除信息点操作
|
|
|
|
|
|
} else {
|
|
@@ -643,6 +639,13 @@ public class SyncAppImpl implements ISyncApp {
|
|
|
|
|
|
/** 上传前处理数据结构 */
|
|
|
private void handle4Upload(ObjectNode node){
|
|
|
+ node.remove("ts"); //调用bdtp接口前,删除ts字段
|
|
|
+
|
|
|
+ //轮廓不上传
|
|
|
+ if(node.get("outline") != null)
|
|
|
+ node.remove("outline");
|
|
|
+
|
|
|
+ //location对象转为bimLocation
|
|
|
JsonNode l = node.get("location");
|
|
|
if(l != null) {
|
|
|
try {
|