|
@@ -1,6 +1,9 @@
|
|
|
package com.persagy.proxy.adm.service.impl;
|
|
|
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
+import java.util.*;
|
|
|
+import java.util.concurrent.ConcurrentLinkedQueue;
|
|
|
+import java.util.stream.Collectors;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Collections;
|
|
|
import java.util.HashMap;
|
|
@@ -9,6 +12,13 @@ import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Set;
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
|
|
+import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
+import com.persagy.dmp.basic.dto.GraphParentMes;
|
|
|
+import com.persagy.dmp.common.context.AppContext;
|
|
|
+import com.persagy.dmp.common.utils.JsonHelper;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -111,11 +121,11 @@ public class RelationReportService implements IRelationReportService {
|
|
|
List<RelationDefine> relationDefines = DigitalRelationDefineFacade.query(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, queryCriteria);
|
|
|
return relationDefines;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
@Override
|
|
|
- public List<ObjectNode> getAllRelationProjectCal(String groupCode, String projectId) {
|
|
|
+ public List<JSONObject> getAllRelationProjectCal(String groupCode, String projectId) {
|
|
|
groupCode = StrUtil.isBlank(groupCode) ? defaultCode : groupCode;
|
|
|
-
|
|
|
+
|
|
|
// 查询出对应项目关系计算数据
|
|
|
QueryCriteria projectCriteria = new QueryCriteria();
|
|
|
ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
|
|
@@ -126,20 +136,22 @@ public class RelationReportService implements IRelationReportService {
|
|
|
if (CollectionUtil.isEmpty(projectList)) {
|
|
|
return Lists.newArrayList();
|
|
|
}
|
|
|
+ List<JSONObject> result = Lists.newArrayList();
|
|
|
+ Map<String, AdmRelationTypeEnum> graphRelTypeMap = AdmRelationTypeEnum.getGraphRelTypeMap();
|
|
|
+ Map<String, RelationDefine> relationDefineMap = queryAllRelationDefineMap(groupCode, projectId);
|
|
|
for (ObjectNode objectNode : projectList) {
|
|
|
String graphCode = objectNode.get("graphCode") == null ? null : objectNode.get("graphCode").asText();
|
|
|
String relCode = objectNode.get("relCode") == null ? null : objectNode.get("relCode").asText();
|
|
|
AdmRelationTypeEnum relationTypeEnum = AdmCommonConstant.GRAPH_RELATION_TYPE_MAP.get(graphCode + AdmCommonConstant.UNDERLINE + relCode);
|
|
|
- this.fillRelationProjectCal(objectNode, relationTypeEnum, groupCode, projectId);
|
|
|
+ result.add(this.fillRelationProjectCal(objectNode, graphCode,relCode,graphRelTypeMap, relationDefineMap));
|
|
|
}
|
|
|
-
|
|
|
- return projectList;
|
|
|
+ return result;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
@Override
|
|
|
public List<JSONObject> getAllRelationProjectCalTree(String groupCode, String projectId) {
|
|
|
groupCode = StrUtil.isBlank(groupCode) ? defaultCode : groupCode;
|
|
|
-
|
|
|
+
|
|
|
// 获取所有的二级标签
|
|
|
QueryCriteria secondCriteria = new QueryCriteria();
|
|
|
List<GraphDefine> secondList = DigitalGraphDefineFacade.query(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, secondCriteria);
|
|
@@ -147,11 +159,13 @@ public class RelationReportService implements IRelationReportService {
|
|
|
return Lists.newArrayList();
|
|
|
}
|
|
|
// 获取此图类型对应项目计算数据
|
|
|
- List<JSONObject> resultList = new ArrayList<JSONObject>();
|
|
|
+ List<JSONObject> resultList = new ArrayList<>();
|
|
|
+ Map<String, AdmRelationTypeEnum> graphRelTypeMap = AdmRelationTypeEnum.getGraphRelTypeMap();
|
|
|
+ Map<String, RelationDefine> relationDefineMap = queryAllRelationDefineMap(groupCode, projectId);
|
|
|
for (GraphDefine graphDefine : secondList) {
|
|
|
String graphCode = graphDefine.getCode();
|
|
|
JSONObject graphObject = this.transfer(graphDefine);
|
|
|
-
|
|
|
+
|
|
|
// 查询出对应项目关系计算数据
|
|
|
QueryCriteria projectCriteria = new QueryCriteria();
|
|
|
ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
|
|
@@ -165,20 +179,20 @@ public class RelationReportService implements IRelationReportService {
|
|
|
continue;
|
|
|
}
|
|
|
// 再根据图类型、边类型,统计此类型下的数量
|
|
|
+ List<JSONObject> tempList = new ArrayList<>();
|
|
|
for (ObjectNode objectNode : projectList) {
|
|
|
String relCode = objectNode.get("relCode") == null ? null : objectNode.get("relCode").asText();
|
|
|
- AdmRelationTypeEnum relationTypeEnum = AdmCommonConstant.GRAPH_RELATION_TYPE_MAP.get(graphCode + AdmCommonConstant.UNDERLINE + relCode);
|
|
|
- this.fillRelationProjectCal(objectNode, relationTypeEnum, groupCode, projectId);
|
|
|
+ tempList.add(this.fillRelationProjectCal(objectNode,graphDefine.getCode(),relCode,graphRelTypeMap,relationDefineMap));
|
|
|
}
|
|
|
graphObject.put("relationTypeProjectList", projectList);
|
|
|
resultList.add(graphObject);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
return resultList;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
@Override
|
|
|
- public ObjectNode getRelationProjectCal(String groupCode, String projectId, String relType) {
|
|
|
+ public JSONObject getRelationProjectCal(String groupCode, String projectId, String relType) {
|
|
|
groupCode = StrUtil.isBlank(groupCode) ? defaultCode : groupCode;
|
|
|
|
|
|
AdmRelationTypeEnum relationTypeEnum = AdmCommonConstant.RELATION_TYPE_MAP.get(relType);
|
|
@@ -186,12 +200,15 @@ public class RelationReportService implements IRelationReportService {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- ObjectNode objectNode = this.getRelationProjectCal(groupCode, projectId, relationTypeEnum.getGraphCode(), relationTypeEnum.getRelCode(), null);
|
|
|
+ ObjectNode objectNode = this.getRelationProjectCal(groupCode, projectId, relationTypeEnum.getGraphCode(),
|
|
|
+ relationTypeEnum.getRelCode(), null);
|
|
|
+ Map<String, AdmRelationTypeEnum> graphRelTypeMap = AdmRelationTypeEnum.getGraphRelTypeMap();
|
|
|
+ Map<String, RelationDefine> relationDefineMap = queryAllRelationDefineMap(groupCode, projectId);
|
|
|
if (objectNode != null) {
|
|
|
- this.fillRelationProjectCal(objectNode, relationTypeEnum, groupCode, projectId);
|
|
|
+ return this.fillRelationProjectCal(objectNode,groupCode,relationTypeEnum.getRelCode(),graphRelTypeMap,relationDefineMap);
|
|
|
}
|
|
|
|
|
|
- return objectNode;
|
|
|
+ return new JSONObject();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -423,7 +440,6 @@ public class RelationReportService implements IRelationReportService {
|
|
|
String projectId, RelationDefine relationDefine,
|
|
|
String zoneType) throws JsonProcessingException {
|
|
|
ObjectNode objectNode = objectMapper.createObjectNode();
|
|
|
- // 缺少业务分区类型
|
|
|
objectNode.put("groupCode", groupCode);
|
|
|
objectNode.put("projectId", projectId);
|
|
|
objectNode.put("id", IdWorker.getIdStr());
|
|
@@ -438,7 +454,7 @@ public class RelationReportService implements IRelationReportService {
|
|
|
objectNode.put("systemType", relationDefine.getSystemType()); // 风系统1,水系统0
|
|
|
objectNode.put("computeVersion", 0); // 计算版本
|
|
|
objectNode.put("mepSystemType", CollUtil.isNotEmpty(relationDefine.getMepSystemType())
|
|
|
- ?objectMapper.writeValueAsString(relationDefine.getMepSystemType()):null); // 机电系统类型
|
|
|
+ ? objectMapper.valueToTree(relationDefine.getMepSystemType()) :objectMapper.createArrayNode()); // 机电系统类型
|
|
|
objectNode.put("creator", AdmCommonConstant.USER_ID); // 创建人
|
|
|
objectNode.put("modifier", AdmCommonConstant.USER_ID); // 最后修改人
|
|
|
return objectNode;
|
|
@@ -454,7 +470,7 @@ public class RelationReportService implements IRelationReportService {
|
|
|
if (StrUtil.isBlank(content)) {
|
|
|
this.createRelationProjectCal(AppContext.getContext().getGroupCode(), AppContext.getContext().getProjectId());
|
|
|
}
|
|
|
- List<JSONObject> parentList = new ArrayList<JSONObject>();
|
|
|
+ List<JSONObject> parentList = new ArrayList<>();
|
|
|
// 获取树结构
|
|
|
this.getGraphRelationProjectTree(parentList, AppContext.getContext().getGroupCode(),
|
|
|
AppContext.getContext().getProjectId(), content);
|
|
@@ -477,63 +493,132 @@ public class RelationReportService implements IRelationReportService {
|
|
|
*/
|
|
|
private void getGraphRelationProjectTree(List<JSONObject> parentList, String groupCode, String projectId, String content) {
|
|
|
boolean isQuery = StringUtils.isNotBlank(content);
|
|
|
- // 获取所有的一级图类型定义
|
|
|
+ // 1.获取所有的一级,二级图类型定义
|
|
|
QueryCriteria parentCriteria = new QueryCriteria();
|
|
|
- List<GraphDefine> topList = DigitalGraphDefineFacade.query(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, parentCriteria);
|
|
|
- for (int i = topList.size() - 1; i >= 0; i--) {
|
|
|
- // 获取所有的二级图类型定义
|
|
|
- QueryCriteria childCriteria = new QueryCriteria();
|
|
|
- List<GraphDefine> childList = DigitalGraphDefineFacade.query(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, childCriteria);
|
|
|
- if (CollectionUtil.isEmpty(childList)) {
|
|
|
- if (isQuery) {
|
|
|
- topList.remove(i); //移除
|
|
|
- }
|
|
|
+ List<GraphDefine> graphDefines = DigitalGraphDefineFacade.query(groupCode, projectId,
|
|
|
+ AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, parentCriteria);
|
|
|
+ if (CollUtil.isEmpty(graphDefines)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 2.查询所有的边类型定义
|
|
|
+ Map<String, RelationDefine> relationDefineMap = queryAllRelationDefineMap(groupCode,projectId);
|
|
|
+ // 3.查询出对应项目关系计算数据
|
|
|
+ List<ObjectNode> projectRelList = queryRelationProjectCalsByProjectId(groupCode,projectId,content);
|
|
|
+ if (CollUtil.isEmpty(projectRelList)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Map<String,List<JSONObject>> levelMap = new HashMap<>();
|
|
|
+ Map<String, AdmRelationTypeEnum> graphRelTypeMap = AdmRelationTypeEnum.getGraphRelTypeMap();
|
|
|
+ for (ObjectNode projectRel : projectRelList) {
|
|
|
+ if (!projectRel.has("relCode")
|
|
|
+ || StrUtil.isBlank(projectRel.get("relCode").asText())){
|
|
|
continue;
|
|
|
}
|
|
|
-
|
|
|
- GraphDefine topGraph = topList.get(i);
|
|
|
- JSONObject parent = this.transfer(topGraph);
|
|
|
- // 二级数据封装
|
|
|
- for (int j = childList.size() - 1; j >= 0; j--) {
|
|
|
- GraphDefine childGraph = topList.get(i);
|
|
|
- JSONObject child = this.transfer(childGraph);
|
|
|
- // 查询出对应项目关系计算数据
|
|
|
- QueryCriteria projectCriteria = new QueryCriteria();
|
|
|
- ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
|
|
|
- ObjectNode criteria = objectMapper.createObjectNode();
|
|
|
- criteria.put("projectId", projectId);
|
|
|
- if (isQuery) {
|
|
|
- ObjectNode condition = objectMapper.createObjectNode();
|
|
|
- condition.put("$like", content);
|
|
|
- criteria.putPOJO("name", condition); // 模糊查询
|
|
|
- }
|
|
|
- projectCriteria.setCriteria(criteria);
|
|
|
- projectCriteria.setOrders(Collections.singletonList(OrderItem.asc("relCode")));
|
|
|
- List<ObjectNode> projectList = DigitalRelationProjectCalFacade.query(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, projectCriteria);
|
|
|
- if (CollectionUtil.isEmpty(projectList)) {
|
|
|
- if (isQuery) {
|
|
|
- childList.remove(i); //移除
|
|
|
- }
|
|
|
- continue;
|
|
|
- }
|
|
|
- // 三级数据封装
|
|
|
- for (ObjectNode objectNode : projectList) {
|
|
|
- String relCode = objectNode.get("relCode") == null ? null : objectNode.get("relCode").asText();
|
|
|
- AdmRelationTypeEnum relationTypeEnum = AdmCommonConstant.GRAPH_RELATION_TYPE_MAP.get(childGraph.getCode() + AdmCommonConstant.UNDERLINE + relCode);
|
|
|
- this.fillRelationProjectCal(objectNode, relationTypeEnum, null, null);
|
|
|
- }
|
|
|
- child.put("relationTypeProjectList", projectList);
|
|
|
+ String relCode = projectRel.get("relCode").asText();
|
|
|
+ String graphCode = projectRel.get("graphCode").asText();
|
|
|
+ if (!graphRelTypeMap.containsKey(graphCode+StrUtil.UNDERLINE+relCode)){
|
|
|
+ continue;
|
|
|
}
|
|
|
- // 再判断一次,防止当二级有数据但被清除了的情况下,一级还会存在
|
|
|
- if (isQuery && CollectionUtil.isEmpty(childList)) {
|
|
|
- childList.remove(i); //移除
|
|
|
+ List<JSONObject> sonList = levelMap.getOrDefault(graphCode, new ArrayList<>());
|
|
|
+ JSONObject son = this.fillRelationProjectCal(projectRel, graphCode,relCode,graphRelTypeMap,relationDefineMap);
|
|
|
+ sonList.add(son);
|
|
|
+ sonList.sort(Comparator.comparing(b -> b.getString("relationTypeCode")));
|
|
|
+ levelMap.put(graphCode,sonList);
|
|
|
+ }
|
|
|
+ // 3.使用图类型定义的二级标签作为第一级
|
|
|
+ List<JSONObject> topList = new ArrayList<>();
|
|
|
+ for (GraphDefine graphDefine : graphDefines) {
|
|
|
+ GraphParentMes secondCategoryMes = graphDefine.getSecondCategoryMes();
|
|
|
+ if (null==secondCategoryMes){
|
|
|
continue;
|
|
|
}
|
|
|
- parent.put("childGraphicTypeList", childList);
|
|
|
- parentList.add(parent);
|
|
|
+ if (!levelMap.containsKey(secondCategoryMes.getId())){
|
|
|
+ topList.add(this.transfer(secondCategoryMes));
|
|
|
+ }
|
|
|
+ List<JSONObject> sonList = levelMap.getOrDefault(secondCategoryMes.getId(), new ArrayList<>());
|
|
|
+ JSONObject secondLevel = this.transfer(graphDefine);
|
|
|
+ secondLevel.put("relationTypeProjectList",levelMap.getOrDefault(graphDefine.getCode(),new ArrayList<>()));
|
|
|
+ sonList.add(secondLevel);
|
|
|
+ sonList.sort(Comparator.comparing(b -> b.getString("graphTypeCode")));
|
|
|
+ levelMap.put(secondCategoryMes.getId(),sonList);
|
|
|
+ }
|
|
|
+ if (CollUtil.isEmpty(topList)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ for (JSONObject top : topList) {
|
|
|
+ top.put("childGraphicTypeList",levelMap.getOrDefault(top.getString("graphTypeId"),new ArrayList<>()));
|
|
|
+ }
|
|
|
+ // 顶级按sort排序
|
|
|
+ topList.sort(Comparator.comparing(b -> b.getIntValue("sort")));
|
|
|
+ parentList.addAll(topList);
|
|
|
+ }
|
|
|
+ /***
|
|
|
+ * Description: 根据项目id查询项目计算关系
|
|
|
+ * @param groupCode : 集团编码
|
|
|
+ * @param projectId : 项目id
|
|
|
+ * @param content : 查询关键字
|
|
|
+ * @return : java.util.List<com.fasterxml.jackson.databind.node.ObjectNode>
|
|
|
+ * @author : lijie
|
|
|
+ * @date :2021/10/15 11:26
|
|
|
+ * Update By lijie 2021/10/15 11:26
|
|
|
+ */
|
|
|
+ private List<ObjectNode> queryRelationProjectCalsByProjectId(String groupCode, String projectId,String content) {
|
|
|
+ QueryCriteria projectCriteria = new QueryCriteria();
|
|
|
+ ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
|
|
|
+ ObjectNode criteria = objectMapper.createObjectNode();
|
|
|
+ criteria.put("projectId", projectId);
|
|
|
+ if (StrUtil.isNotBlank(content)) {
|
|
|
+ ObjectNode condition = objectMapper.createObjectNode();
|
|
|
+ condition.put("$like", content);
|
|
|
+ criteria.putPOJO("name", condition); // 模糊查询
|
|
|
}
|
|
|
+ projectCriteria.setCriteria(criteria);
|
|
|
+ projectCriteria.setOrders(Collections.singletonList(OrderItem.asc("relCode")));
|
|
|
+ return DigitalRelationProjectCalFacade.query(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, projectCriteria);
|
|
|
}
|
|
|
+
|
|
|
+ /***
|
|
|
+ * Description: 查询所有关系类型
|
|
|
|
|
|
+ * @return : java.util.Map<java.lang.String,com.persagy.dmp.define.entity.RelationDefine>
|
|
|
+ * @author : lijie
|
|
|
+ * @date :2021/10/15 11:22
|
|
|
+ * Update By lijie 2021/10/15 11:22
|
|
|
+ */
|
|
|
+ private Map<String, RelationDefine> queryAllRelationDefineMap(String groupCode,String projectId) {
|
|
|
+ List<RelationDefine> relationDefines = DigitalRelationDefineFacade.query(groupCode, projectId,
|
|
|
+ AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, new QueryCriteria());
|
|
|
+ if (CollUtil.isEmpty(relationDefines)){
|
|
|
+ return new HashMap<>();
|
|
|
+ }
|
|
|
+ return relationDefines.stream()
|
|
|
+ .collect(Collectors.toMap(relationDefine ->
|
|
|
+ relationDefine.getGraphCode() + StrUtil.UNDERLINE + relationDefine.getCode(),
|
|
|
+ relationDefine -> relationDefine, (k1, k2) -> k1));
|
|
|
+ }
|
|
|
+
|
|
|
+ /***
|
|
|
+ * Description: 创建一级返回数据
|
|
|
+ * @param graphParentMes : 一级信息对象
|
|
|
+ * @return : com.alibaba.fastjson.JSONObject
|
|
|
+ * @author : lijie
|
|
|
+ * @date :2021/10/14 20:56
|
|
|
+ * Update By lijie 2021/10/14 20:56
|
|
|
+ */
|
|
|
+ private JSONObject transfer(GraphParentMes graphParentMes) {
|
|
|
+ JSONObject top = new JSONObject();
|
|
|
+ top.put("sort", graphParentMes.getSort());
|
|
|
+ top.put("note", "");
|
|
|
+ top.put("statistics", new JSONObject());
|
|
|
+ top.put("graphTypeName", graphParentMes.getName());
|
|
|
+ top.put("graphTypeId", graphParentMes.getId());
|
|
|
+ top.put("graphTypeCode", graphParentMes.getCode());
|
|
|
+ top.put("code", graphParentMes.getCode());
|
|
|
+ top.put("lastUpdate", DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss"));
|
|
|
+ top.put("createTime", DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss"));
|
|
|
+ return top;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 获取转换后的数据,图类型数据转换
|
|
|
*
|
|
@@ -542,51 +627,57 @@ public class RelationReportService implements IRelationReportService {
|
|
|
*/
|
|
|
private JSONObject transfer(GraphDefine graphDefine) {
|
|
|
JSONObject top = new JSONObject();
|
|
|
- top.put("sort", 1);
|
|
|
+ top.put("sort", 10);
|
|
|
top.put("note", "");
|
|
|
- top.put("statistics", Lists.newArrayList());
|
|
|
+ top.put("statistics", new JSONObject());
|
|
|
top.put("graphTypeName", graphDefine.getName());
|
|
|
top.put("graphTypeId", graphDefine.getId());
|
|
|
top.put("graphTypeCode", graphDefine.getCode());
|
|
|
+ top.put("code", graphDefine.getCode());
|
|
|
top.put("lastUpdate", graphDefine.getModifiedTime() == null ? null : graphDefine.getModifiedTime().toString(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
|
|
top.put("createTime", graphDefine.getCreationTime() == null ? null : graphDefine.getCreationTime().toString(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
|
|
return top;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 填充项目关系计算ADM所需的数据
|
|
|
- * @param objectNode 项目关系计算的数据记录
|
|
|
- * @param relationTypeEnum 枚举类
|
|
|
- * @param groupCode 集团编码
|
|
|
- * @param projectId 项目ID
|
|
|
+ * 获取转换后的数据,项目计算数据转换
|
|
|
+ *
|
|
|
+ * @param relationProject :项目对象
|
|
|
+ * @param relCode :边类型编码
|
|
|
+ * @param graphRelTypeMap :与旧数据中心的code的映射关系
|
|
|
+ * @param relationDefineMap
|
|
|
+ * @return
|
|
|
*/
|
|
|
- private void fillRelationProjectCal(ObjectNode objectNode, AdmRelationTypeEnum relationTypeEnum, String groupCode, String projectId) {
|
|
|
- if (StrUtil.isAllNotBlank(groupCode, projectId)) {
|
|
|
- String zoneType = objectNode.get("zoneType") == null ? null : objectNode.get("zoneType").asText();
|
|
|
- long count = this.countRelationObject(groupCode, projectId, relationTypeEnum.getGraphCode(), relationTypeEnum.getRelCode(), zoneType);
|
|
|
- objectNode.put("count", count);
|
|
|
- }
|
|
|
-
|
|
|
- objectNode.put("relationTypeCode", relationTypeEnum.getRelCode());
|
|
|
- objectNode.put("relationType", relationTypeEnum.getRelationType());
|
|
|
- objectNode.put("relationTypeName", objectNode.get("relCodeName") == null ? null : objectNode.get("relCodeName").asText());
|
|
|
-
|
|
|
- objectNode.put("graphicId", objectNode.get("graphCode") == null ? null : objectNode.get("graphCode").asText());
|
|
|
- objectNode.put("automatic", "1".equals(objectNode.get("automaticFlag") == null ? null : objectNode.get("automaticFlag").asText()));
|
|
|
- objectNode.put("source", "1".equals(objectNode.get("sourceFlag") == null ? null : objectNode.get("sourceFlag").asText()));
|
|
|
- objectNode.put("conneObject", ObjTypeMapping.getConneObject(relationTypeEnum.getRelCode()));
|
|
|
-
|
|
|
- Long modifiedTime = objectNode.get("modifiedTime") == null ? null : objectNode.get("modifiedTime").asLong();
|
|
|
- Long creationTime = objectNode.get("creationTime") == null ? null : objectNode.get("creationTime").asLong();
|
|
|
- objectNode.put("lastUpdate", modifiedTime == null ? null : new DateTime(modifiedTime).toString());
|
|
|
- objectNode.put("createTime", creationTime == null ? null : new DateTime(creationTime).toString());
|
|
|
-
|
|
|
+ private JSONObject fillRelationProjectCal(ObjectNode relationProject, String graphicId, String relCode,
|
|
|
+ Map<String, AdmRelationTypeEnum> graphRelTypeMap,
|
|
|
+ Map<String, RelationDefine> relationDefineMap) {
|
|
|
+ String key = graphicId + StrUtil.UNDERLINE + relCode;
|
|
|
+ AdmRelationTypeEnum typeEnum = graphRelTypeMap.get(key);
|
|
|
+ RelationDefine relationDefine = relationDefineMap.getOrDefault(key,new RelationDefine());
|
|
|
+ JSONObject result = new JSONObject();
|
|
|
+ result.put("graphicId", graphicId);
|
|
|
+ result.put("computationalState",relationProject.has("computationalState")?relationProject.get("computationalState").asText():null);
|
|
|
+ result.put("id",relationProject.has("id")?relationProject.get("id").asText():null);
|
|
|
+ result.put("manual",relationProject.has("manual")?relationProject.get("manual").asText():null);
|
|
|
+ result.put("projectId",relationProject.has("projectId")?relationProject.get("projectId").asText():null);
|
|
|
+ result.put("relationType",typeEnum.getRelationType());
|
|
|
+ result.put("relManualType",typeEnum.getRelationType());
|
|
|
+ result.put("relationTypeCode",relationProject.has("relCode")?relationProject.get("relCode").asText():null);
|
|
|
+ result.put("code", relationProject.has("relCode")?relationProject.get("relCode").asText():null);
|
|
|
+ result.put("relationTypeName",relationProject.has("relCodeName")?relationProject.get("relCodeName").asText():null);
|
|
|
+ result.put("statistics", new JSONObject());
|
|
|
+ result.put("automatic", relationProject.has("automaticFlag") && relationProject.get("automaticFlag").asBoolean());
|
|
|
+ result.put("source", relationProject.has("sourceFlag") && relationProject.get("sourceFlag").asBoolean());
|
|
|
+ result.put("conneObject", relationDefine.getTargetObjs());
|
|
|
|
|
|
- String prefix = ObjTypeMapping.getRelCodePrefix(relationTypeEnum.getRelCode());
|
|
|
- String suffix = ObjTypeMapping.getRelCodeSuffix(relationTypeEnum.getRelCode());
|
|
|
- objectNode.put("mainObject", ObjTypeMapping.PREFIX_NAME.get(prefix));
|
|
|
- objectNode.put("fromObject", ObjTypeMapping.PREFIX_NAME.get(suffix));
|
|
|
- objectNode.putPOJO("statistics", new JSONObject());
|
|
|
+ Long modifiedTime = relationProject.get("modifiedTime") == null ? null : relationProject.get("modifiedTime").asLong();
|
|
|
+ Long creationTime = relationProject.get("creationTime") == null ? null : relationProject.get("creationTime").asLong();
|
|
|
+
|
|
|
+ result.put("lastUpdate", modifiedTime == null ? null : new DateTime(modifiedTime).toString());
|
|
|
+ result.put("createTime", creationTime == null ? null : new DateTime(creationTime).toString());
|
|
|
+ result.put("mainObject", relationDefine.getFromObjType());
|
|
|
+ result.put("fromObject", relationDefine.getToObjType());
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
/**
|