|
@@ -12,6 +12,10 @@ import com.google.common.collect.Lists;
|
|
|
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.define.client.DigitalGraphDefineFacade;
|
|
|
+import com.persagy.dmp.define.client.DigitalRelationDefineFacade;
|
|
|
+import com.persagy.dmp.define.entity.GraphDefine;
|
|
|
+import com.persagy.dmp.define.entity.RelationDefine;
|
|
|
import com.persagy.dmp.digital.client.DigitalObjectFacade;
|
|
|
import com.persagy.dmp.digital.client.DigitalRelationFacade;
|
|
|
import com.persagy.dmp.digital.client.DigitalRelationProjectCalFacade;
|
|
@@ -27,6 +31,7 @@ import com.persagy.proxy.adm.strategy.relationdata.RelationObjectStrategy;
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import net.minidev.json.JSONObject;
|
|
|
|
|
|
/**
|
|
|
* 报表/模板下载
|
|
@@ -45,9 +50,22 @@ public class RelationReportService implements IRelationReportService {
|
|
|
|
|
|
@Autowired
|
|
|
private RelationObjectContext relationObjectContext;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<GraphDefine> getGraphDefine(String groupCode, String projectId, String graphCode) {
|
|
|
+ ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
|
|
|
+ QueryCriteria queryCriteria = new QueryCriteria();
|
|
|
+ ObjectNode criteria = objectMapper.createObjectNode();
|
|
|
+ if (StrUtil.isNotBlank(graphCode)) {
|
|
|
+ criteria.put("code", graphCode);
|
|
|
+ }
|
|
|
+ queryCriteria.setCriteria(criteria);
|
|
|
+ List<GraphDefine> graphDefines = DigitalGraphDefineFacade.query(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, queryCriteria);
|
|
|
+ return graphDefines;
|
|
|
+ }
|
|
|
|
|
|
@Override
|
|
|
- public void getGraphRelDefine(String groupCode, String graphCode, String relCode) {
|
|
|
+ public List<RelationDefine> getRelationDefine(String groupCode, String projectId, String graphCode, String relCode) {
|
|
|
ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
|
|
|
QueryCriteria queryCriteria = new QueryCriteria();
|
|
|
ObjectNode criteria = objectMapper.createObjectNode();
|
|
@@ -55,9 +73,11 @@ public class RelationReportService implements IRelationReportService {
|
|
|
criteria.put("graphCode", graphCode);
|
|
|
}
|
|
|
if (StrUtil.isNotBlank(relCode)) {
|
|
|
- criteria.put("relCode", relCode);
|
|
|
+ criteria.put("code", relCode);
|
|
|
}
|
|
|
queryCriteria.setCriteria(criteria);
|
|
|
+ List<RelationDefine> relationDefines = DigitalRelationDefineFacade.query(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, queryCriteria);
|
|
|
+ return relationDefines;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -75,14 +95,20 @@ public class RelationReportService implements IRelationReportService {
|
|
|
objectNode.put("relationType", relType);
|
|
|
|
|
|
// 获取此图类型和边类型对应的数据记录
|
|
|
+ List<RelationDefine> relationDefines = this.getRelationDefine(groupCode, projectId, relationTypeEnum.getGraphCode(), relationTypeEnum.getRelCode());
|
|
|
+ if (CollectionUtil.isNotEmpty(relationDefines)) {
|
|
|
+ RelationDefine relationDefine = relationDefines.get(0);
|
|
|
+ objectNode.put("conneObject", relationDefine.getTargetObjs());
|
|
|
+ objectNode.put("relationTypeCode", relationDefine.getCode());
|
|
|
+ objectNode.put("relationTypeName", relationDefine.getName());
|
|
|
+ objectNode.put("automatic", (null == relationDefine.getAutomaticFlag() || 0 == relationDefine.getAutomaticFlag()) ? false : true);
|
|
|
+ }
|
|
|
|
|
|
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.put("relationTypeCode", relationTypeEnum.getRelCode());
|
|
|
- boolean automatic = objectNode.get("automaticFlag") == null ? false : objectNode.get("automaticFlag").asBoolean(false);
|
|
|
- objectNode.put("automatic", automatic);
|
|
|
+ objectNode.putPOJO("statistics", new JSONObject());
|
|
|
}
|
|
|
|
|
|
return objectNode;
|