|
@@ -1,5 +1,7 @@
|
|
|
package com.persagy.proxy.adm.service.impl;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Set;
|
|
@@ -22,6 +24,7 @@ import com.persagy.dmp.digital.client.DigitalObjectFacade;
|
|
|
import com.persagy.dmp.digital.client.DigitalRelationFacade;
|
|
|
import com.persagy.dmp.digital.client.DigitalRelationProjectCalFacade;
|
|
|
import com.persagy.dmp.digital.entity.ObjectRelation;
|
|
|
+import com.persagy.dmp.digital.entity.ObjectRelationProjectCal;
|
|
|
import com.persagy.dmp.simple.client.DigitalObjectSimpleFacade;
|
|
|
import com.persagy.proxy.adm.constant.AdmCommonConstant;
|
|
|
import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
|
|
@@ -30,6 +33,8 @@ import com.persagy.proxy.adm.service.IRelationReportService;
|
|
|
import com.persagy.proxy.adm.strategy.relationdata.RelationObjectStrategy;
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
+import cn.hutool.core.util.IdUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import net.minidev.json.JSONObject;
|
|
|
|
|
@@ -258,5 +263,67 @@ public class RelationReportService implements IRelationReportService {
|
|
|
List<ObjectRelation> objectRelations = DigitalRelationFacade.query(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, queryCriteria);
|
|
|
return CollectionUtil.isEmpty(objectRelations) ? Lists.newArrayList() : objectRelations;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean createRelationProjectCal(String groupCode, String projectId) {
|
|
|
+ groupCode = StrUtil.isBlank(groupCode) ? defaultCode : groupCode;
|
|
|
+
|
|
|
+ // 验证是否已经添加过
|
|
|
+ QueryCriteria queryCriteria = new QueryCriteria();
|
|
|
+ queryCriteria.setOnlyCount(true);
|
|
|
+ CommonResult<List<ObjectNode>> prototype = DigitalRelationProjectCalFacade.queryPrototype(groupCode, null, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, queryCriteria);
|
|
|
+ if (prototype != null && prototype.getCount() != 0) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 获取所有的边类型
|
|
|
+ QueryCriteria criteria = new QueryCriteria();
|
|
|
+ List<RelationDefine> list = DigitalRelationDefineFacade.query(groupCode, null, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, criteria);
|
|
|
+ if (CollectionUtil.isEmpty(list)) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 组装关系计算数据
|
|
|
+ String now = DateUtil.format(new Date(), "yyyyMMddHHmmss");
|
|
|
+ List<ObjectNode> nodes = new ArrayList<ObjectNode>();
|
|
|
+ ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
|
|
|
+ for (RelationDefine relationDefine : list) {
|
|
|
+ ObjectNode objectNode = objectMapper.createObjectNode();
|
|
|
+
|
|
|
+ String key = relationDefine.getGraphCode() + AdmCommonConstant.UNDERLINE + relationDefine.getCode();
|
|
|
+ AdmRelationTypeEnum typeEnum = AdmCommonConstant.GRAPH_RELATION_TYPE_MAP.get(key);
|
|
|
+
|
|
|
+ objectNode.put("projectId", projectId);
|
|
|
+ objectNode.put("id", IdUtil.fastSimpleUUID());
|
|
|
+ objectNode.put("graphCode", relationDefine.getGraphCode());
|
|
|
+ objectNode.put("relCode", relationDefine.getCode());
|
|
|
+ objectNode.put("sourceFlag", typeEnum == null ? null : typeEnum.getSourceFlag()); // 是否需要配置源末端
|
|
|
+ objectNode.put("automaticFlag", relationDefine.getAutomaticFlag()); // 是否自动计算类型
|
|
|
+ objectNode.put("manual", typeEnum == null ? null : typeEnum.getManualFlag()); // 手动计算类型 1 禁用 2提示引导 3手动维护
|
|
|
+ //objectNode.put("computingTime", relationDefine.getGraphCode()); // 最后一次自动计算时间
|
|
|
+ objectNode.put("computationalState", 1); // 计算状态 1初始状态 2需要计算 3计算中 4等待中 5计算失败(如果处于计算中状态,则不再次调用)
|
|
|
+ //objectNode.put("zoneType", relationDefine.getGraphCode()); // 业务分区类型
|
|
|
+ objectNode.put("systemType", typeEnum == null ? null : typeEnum.getSystemType()); // 风系统1,水系统0
|
|
|
+ //objectNode.put("relManualType", relationDefine.getGraphCode()); // 手动计算关系类型
|
|
|
+ //objectNode.put("computeVersion", relationDefine.getGraphCode()); // 计算版本
|
|
|
+ objectNode.put("creator", AdmCommonConstant.USER_ID); // 创建人
|
|
|
+ objectNode.put("creationTime", now); // 创建时间
|
|
|
+ objectNode.put("modifier", AdmCommonConstant.USER_ID); // 最后修改人
|
|
|
+ objectNode.put("modifiedTime", now); // 最后修改时间
|
|
|
+ //objectNode.put("valid", relationDefine.getGraphCode()); // 合法标识
|
|
|
+ }
|
|
|
+
|
|
|
+ List<ObjectRelationProjectCal> result = DigitalRelationProjectCalFacade.create(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, nodes);
|
|
|
+ return CollectionUtil.isNotEmpty(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void overview(String groupCode, String projectId, String content) {
|
|
|
+ if (StrUtil.isBlank(content)) {
|
|
|
+ this.createRelationProjectCal(groupCode, projectId);
|
|
|
+
|
|
|
+ // 获取所有的一级图类型定义
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
}
|