Browse Source

交付范围 关系范围

lvxianyun 3 years ago
parent
commit
076b9356ad

+ 8 - 1
adm-business/adm-middleware/src/main/java/com/persagy/proxy/dictionary/service/IAdmDictBaseService.java

@@ -76,13 +76,20 @@ public interface IAdmDictBaseService<T>{
     AdmResponse doQueryObjectTypeCollect(InstanceUrlParam context, QueryCriteria queryCriteria);
 
     /**
-     * 设置采集信息点
+     * 查询采集 类型
      * @param context
      * @param clazz
      * @param voList
      * @return
      */
     List<T> doSetObjectInfoCollect(InstanceUrlParam context, Class<T> clazz, List<T> voList);
+
+    /**
+     * 设置采集 类型
+     * @param typeList
+     * @param collectTypeList
+     * @return
+     */
     List<AdmObjectType> doSetObjectTypeCollect(List<AdmObjectType> typeList, List<ObjectTypeCollect> collectTypeList);
 
 

+ 19 - 1
adm-business/adm-middleware/src/main/java/com/persagy/proxy/report/service/IRelationReportService.java

@@ -13,8 +13,9 @@ import com.persagy.dmp.define.entity.GraphDefine;
 import com.persagy.dmp.define.entity.ObjectInfoDefine;
 import com.persagy.dmp.define.entity.ObjectTypeDefine;
 import com.persagy.dmp.define.entity.RelationDefine;
+import com.persagy.dmp.delivery.entity.RelationDefineCollect;
 import com.persagy.dmp.digital.entity.ObjectRelation;
-import lombok.SneakyThrows;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
 
 /**
  * 报表/模板下载
@@ -272,4 +273,21 @@ public interface IRelationReportService {
 	 * @return
 	 */
 	Map<String, List<ObjectNode>> findObjectNodesByPage(String groupCode, String projectId, Set<String> objTypes, String infoKey, Set<String> codes);
+
+
+	/**
+	 * 查询采集 范围
+	 * @param context
+	 * @param queryCriteria
+	 * @return
+	 */
+	List<RelationDefineCollect> doQueryRelationDefineCollect(InstanceUrlParam context, QueryCriteria queryCriteria);
+
+	/**
+	 * 设置采集 范围
+	 * @param relList
+	 * @param collectRelList
+	 * @return
+	 */
+	void doSetRelationDefineCollect(List<JSONObject> relList, List<RelationDefineCollect> collectRelList);
 }

+ 69 - 0
adm-business/adm-middleware/src/main/java/com/persagy/proxy/report/service/impl/RelationReportService.java

@@ -21,6 +21,7 @@ import com.persagy.dmp.common.constant.CommonConstant;
 import com.persagy.dmp.common.context.AppContext;
 import com.persagy.dmp.common.helper.SpringHelper;
 import com.persagy.dmp.common.model.response.CommonResult;
+import com.persagy.dmp.common.utils.JsonHelper;
 import com.persagy.dmp.define.client.DigitalDefineFacade;
 import com.persagy.dmp.define.client.DigitalGraphDefineFacade;
 import com.persagy.dmp.define.client.DigitalObjectInfoFacade;
@@ -29,6 +30,7 @@ import com.persagy.dmp.define.entity.GraphDefine;
 import com.persagy.dmp.define.entity.ObjectInfoDefine;
 import com.persagy.dmp.define.entity.ObjectTypeDefine;
 import com.persagy.dmp.define.entity.RelationDefine;
+import com.persagy.dmp.delivery.entity.RelationDefineCollect;
 import com.persagy.dmp.digital.client.DigitalObjectFacade;
 import com.persagy.dmp.digital.client.DigitalRelationFacade;
 import com.persagy.dmp.digital.client.DigitalRelationProjectCalFacade;
@@ -40,10 +42,17 @@ import com.persagy.proxy.adm.constant.AdmCommonConstant;
 import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
 import com.persagy.proxy.adm.constant.SpaceTypeEnum;
 import com.persagy.proxy.adm.strategy.relationdata.RelationObjectStrategy;
+import com.persagy.proxy.adm.utils.AdmContextUtil;
+import com.persagy.proxy.adm.utils.AdmEntityTransferUtil;
+import com.persagy.proxy.common.client.DmpRwdClient;
+import com.persagy.proxy.common.entity.DmpResult;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
 import com.persagy.proxy.report.service.IRelationReportService;
 import lombok.SneakyThrows;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.io.IOException;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -59,6 +68,9 @@ import java.util.stream.Collectors;
 @Service
 public class RelationReportService implements IRelationReportService {
 
+	@Autowired
+	private DmpRwdClient rwdClient;
+
 	@Override
 	public List<ObjectTypeDefine> queryClassList(String groupCode, String projectId, Set<String> classCodes, Set<String> objTypes, List<OrderItem> orderItems) {
 		ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
@@ -393,6 +405,57 @@ public class RelationReportService implements IRelationReportService {
 		return result;
 	}
 
+	/**
+	 * 查询采集 范围
+	 *
+	 * @param context
+	 * @param queryCriteria
+	 * @return
+	 */
+	@Override
+	public List<RelationDefineCollect> doQueryRelationDefineCollect(InstanceUrlParam context, QueryCriteria queryCriteria) {
+		// 转换参数
+		JSONObject para = null;
+		try {
+			para = JsonHelper.toJsonObject(queryCriteria);
+		} catch (IOException e) {
+			return null;
+		}
+		// 调用中台查询
+		DmpResult<JSONArray> dmpResult = rwdClient.queryObjectRelCollect(context, para);
+		List<RelationDefineCollect> admVOs = AdmEntityTransferUtil.toAdmMultiEntity(dmpResult.getData(), null, RelationDefineCollect.class);
+		return  admVOs;
+	}
+
+	/**
+	 * 设置采集 范围
+	 *
+	 * @param relList
+	 * @param collectRelList
+	 * @return
+	 */
+	@Override
+	public void doSetRelationDefineCollect(List<JSONObject> relList, List<RelationDefineCollect> collectRelList) {
+		if(CollUtil.isEmpty(relList)){
+			return ;
+		}
+		if(CollUtil.isEmpty(collectRelList)){
+			return ;
+		}
+		for (RelationDefineCollect relCol : collectRelList){
+			if(relCol.getDeliveryType() == null){
+				continue;
+			}
+			for(JSONObject jsonObject : relList){
+				if(relCol.getRelCode().equals(jsonObject.getString("code")) && relCol.getGraphCode().equals(jsonObject.getString("graphicId"))){
+					jsonObject.put("deliveryType", relCol.getDeliveryType());
+				}
+			}
+		}
+
+	}
+
+
 	@Override
 	public ObjectNode getObjectByCodeAndId(String groupCode, String projectId, String graphCode, String relCode, String objFrom, String objTo) {
 		// 获取出关联对象
@@ -742,6 +805,9 @@ public class RelationReportService implements IRelationReportService {
 	 */
 	private List<JSONObject> getGraphRelationProjectTree(String groupCode, String projectId, String content) {
 		List<JSONObject> resultList = new ArrayList<>();
+
+		//获取交付范围
+		List<RelationDefineCollect> relationDefineCollects = doQueryRelationDefineCollect(AdmContextUtil.toDmpContext(), new QueryCriteria());
 		// 1.获取所有的一级,二级图类型定义
 		QueryCriteria parentCriteria = new QueryCriteria();
 		List<GraphDefine> graphDefines = DigitalGraphDefineFacade.query(groupCode, projectId,
@@ -799,6 +865,7 @@ public class RelationReportService implements IRelationReportService {
 		if(MapUtil.isEmpty(relMap)) {
 			return resultList;
 		}
+
 		// 组装&排序
 		resultList = CollUtil.sort(typeMap.values(), Comparator.comparing(b -> b.getIntValue("sort")));
 		for(JSONObject result:resultList) {
@@ -818,6 +885,8 @@ public class RelationReportService implements IRelationReportService {
 					continue;
 				}
 				List<JSONObject> relList = CollUtil.sort(rels.values(), Comparator.comparing(b -> b.getString("relationTypeCode")));
+				//设置关系交付范围
+				doSetRelationDefineCollect(relList, relationDefineCollects);
 				graph.put("relationTypeProjectList", relList);
 			}
 		}