|
@@ -211,26 +211,20 @@ public class RelationReportService implements IRelationReportService {
|
|
|
List<JSONObject> resultList = new ArrayList<>();
|
|
|
Map<String, AdmRelationTypeEnum> graphRelTypeMap = AdmCommonConstant.GRAPH_RELATION_TYPE_MAP;
|
|
|
Map<String, RelationDefine> relationDefineMap = queryAllRelationDefineMap(groupCode, projectId);
|
|
|
+ Map<String, Integer> relCountMap = queryAllRelationCountMap(groupCode,projectId);
|
|
|
+ Map<String,List<ObjectNode>> graphCodeMap = queryAllProjectCalMap(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);
|
|
|
- ObjectNode criteria = objectMapper.createObjectNode();
|
|
|
- criteria.put("projectId", projectId);
|
|
|
- criteria.put("graphCode", graphCode);
|
|
|
- criteria.put("valid", 1);
|
|
|
- projectCriteria.setCriteria(criteria);
|
|
|
- List<ObjectNode> projectList = DigitalRelationProjectCalFacade.query(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, projectCriteria);
|
|
|
+ List<ObjectNode> projectList = graphCodeMap.getOrDefault(graphCode,new ArrayList<>());
|
|
|
if (CollectionUtil.isEmpty(projectList)) {
|
|
|
graphObject.put("relationTypeProjectList", Lists.newArrayList());
|
|
|
continue;
|
|
|
}
|
|
|
// 再根据图类型、边类型,统计此类型下的数量
|
|
|
List<JSONObject> tempList = new ArrayList<>();
|
|
|
- Map<String, Integer> relCountMap = queryAllRelationCountMap(groupCode,projectId);
|
|
|
for (ObjectNode objectNode : projectList) {
|
|
|
String relCode = objectNode.get("relCode") == null ? null : objectNode.get("relCode").asText();
|
|
|
tempList.add(this.fillRelationProjectCal(objectNode, graphDefine.getCode(), relCode, graphRelTypeMap,relationDefineMap,relCountMap));
|
|
@@ -241,6 +235,39 @@ public class RelationReportService implements IRelationReportService {
|
|
|
|
|
|
return resultList;
|
|
|
}
|
|
|
+ /***
|
|
|
+ * Description: 查询项目的图类型映射
|
|
|
+ * @param groupCode : 集团编码
|
|
|
+ * @param projectId : 项目id
|
|
|
+ * @return : java.util.Map<java.lang.String,java.util.List<com.fasterxml.jackson.databind.node.ObjectNode>>
|
|
|
+ * @author : lijie
|
|
|
+ * @date :2021/11/11 16:03
|
|
|
+ * Update By lijie 2021/11/11 16:03
|
|
|
+ */
|
|
|
+ private Map<String, List<ObjectNode>> queryAllProjectCalMap(String groupCode, String projectId) {
|
|
|
+ Map<String, List<ObjectNode>> result = new HashMap<>();
|
|
|
+ // 查询出对应项目关系计算数据
|
|
|
+ QueryCriteria projectCriteria = new QueryCriteria();
|
|
|
+ ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
|
|
|
+ ObjectNode criteria = objectMapper.createObjectNode();
|
|
|
+ criteria.put("projectId", projectId);
|
|
|
+ criteria.put("valid", 1);
|
|
|
+ projectCriteria.setCriteria(criteria);
|
|
|
+ List<ObjectNode> projectList = DigitalRelationProjectCalFacade.query(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, projectCriteria);
|
|
|
+ if (CollUtil.isEmpty(projectList)){
|
|
|
+ return new HashMap<>();
|
|
|
+ }
|
|
|
+ for (ObjectNode objectNode : projectList) {
|
|
|
+ if (!objectNode.has("graphCode")
|
|
|
+ || StrUtil.isBlank(objectNode.get("graphCode").asText())){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ List<ObjectNode> projectCals = result.getOrDefault(objectNode.get("graphCode").asText(), new ArrayList<>());
|
|
|
+ projectCals.add(objectNode);
|
|
|
+ result.put(objectNode.get("graphCode").asText(),projectCals);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
|
|
|
@Override
|
|
|
public JSONObject getRelationProjectCal(String groupCode, String projectId, String relType) {
|