|
@@ -1,33 +1,45 @@
|
|
|
package com.persagy.proxy.relation.controller;
|
|
|
|
|
|
-import cn.hutool.core.collection.CollUtil;
|
|
|
-import cn.hutool.core.util.ObjectUtil;
|
|
|
-import cn.hutool.core.util.StrUtil;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Set;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fasterxml.jackson.databind.node.JsonNodeFactory;
|
|
|
import com.fasterxml.jackson.databind.node.ObjectNode;
|
|
|
+import com.google.common.collect.Sets;
|
|
|
import com.persagy.dmp.basic.dto.RequestData;
|
|
|
import com.persagy.dmp.basic.model.QueryCriteria;
|
|
|
+import com.persagy.dmp.common.context.AppContext;
|
|
|
+import com.persagy.dmp.define.entity.ObjectTypeDefine;
|
|
|
import com.persagy.dmp.digital.client.DigitalObjectFacade;
|
|
|
import com.persagy.dmp.digital.entity.ObjectDigital;
|
|
|
import com.persagy.dmp.digital.entity.ObjectRelation;
|
|
|
import com.persagy.proxy.adm.constant.AdmCommonConstant;
|
|
|
import com.persagy.proxy.adm.constant.AdmDictCategoryEnum;
|
|
|
+import com.persagy.proxy.adm.constant.AdmObjectType;
|
|
|
import com.persagy.proxy.adm.request.AdmResponse;
|
|
|
import com.persagy.proxy.adm.service.IAdmRelationService;
|
|
|
import com.persagy.proxy.adm.utils.AdmContextUtil;
|
|
|
import com.persagy.proxy.common.client.DmpRwdClient;
|
|
|
import com.persagy.proxy.common.entity.InstanceUrlParam;
|
|
|
import com.persagy.proxy.common.entity.RelationDTO;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.beans.factory.annotation.Value;
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
+import com.persagy.proxy.report.service.IRelationReportService;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Set;
|
|
|
-import java.util.stream.Collectors;
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
+import cn.hutool.core.collection.CollectionUtil;
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
|
|
|
/**
|
|
|
* @description:023、关系-竖井下的业务空间
|
|
@@ -40,10 +52,15 @@ public class RelationShContainSpBaseController {
|
|
|
|
|
|
@Autowired
|
|
|
private IAdmRelationService service;
|
|
|
+
|
|
|
@Autowired
|
|
|
DmpRwdClient rwdClient;
|
|
|
+
|
|
|
@Value("${middleware.group.code}")
|
|
|
private String groupCode;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IRelationReportService relationReportService;
|
|
|
|
|
|
/**
|
|
|
* 默认图类型
|
|
@@ -272,31 +289,27 @@ public class RelationShContainSpBaseController {
|
|
|
@PostMapping("/space-type-query")
|
|
|
public AdmResponse spaceTypeQuery(@RequestParam(value = "shaftId", required = false) String shaftId,
|
|
|
@RequestBody JSONObject param) throws Exception {
|
|
|
-
|
|
|
// 组装上下文条件
|
|
|
- InstanceUrlParam context = AdmContextUtil.toDmpContext();
|
|
|
- // 组装条件
|
|
|
- QueryCriteria queryRequestTmp = new QueryCriteria();
|
|
|
- ObjectNode nodeTmp = JsonNodeFactory.instance.objectNode();
|
|
|
- nodeTmp.put("graphCode", DEFAULT_GRAPH_CODE);
|
|
|
- nodeTmp.put("relCode", DEFAULT_REL_CODE);
|
|
|
- nodeTmp.put("objFrom", shaftId);
|
|
|
- queryRequestTmp.setCriteria(nodeTmp);
|
|
|
- //关系查询空间id
|
|
|
- Set<String> relValue = service.queryByCondition(context,queryRequestTmp).stream().map(ObjectRelation::getRelValue).collect(Collectors.toSet());
|
|
|
- JSONObject queryCriteria = new JSONObject();
|
|
|
- JSONObject criteria = new JSONObject();
|
|
|
- criteria.put("code",relValue);
|
|
|
- queryCriteria.put("criteria",criteria);
|
|
|
- JSONArray dmpResult = rwdClient.queryDefClass(context, queryCriteria).getData(JSONArray.class);
|
|
|
+ //InstanceUrlParam context = AdmContextUtil.toDmpContext();
|
|
|
+ if (StrUtil.isBlank(shaftId)) {
|
|
|
+ shaftId = param.getString("shaftId");
|
|
|
+ }
|
|
|
+ String groupCode = AppContext.getContext().getGroupCode();
|
|
|
+ String projectId = AppContext.getContext().getProjectId();
|
|
|
+
|
|
|
+ List<ObjectTypeDefine> classList = this.relationReportService.queryClassList(groupCode, projectId, null, Sets.newHashSet(AdmObjectType.SPACE.getIndex()), null);
|
|
|
+ if (CollectionUtil.isEmpty(classList)) {
|
|
|
+ return AdmResponse.success();
|
|
|
+ }
|
|
|
+
|
|
|
JSONArray result = new JSONArray();
|
|
|
- for (int i = 0; i < dmpResult.size(); i++) {
|
|
|
- JSONObject defClass = dmpResult.getJSONObject(i);
|
|
|
- JSONObject temp = new JSONObject();
|
|
|
- temp.put("objectType",defClass.getString("code"));
|
|
|
- temp.put("objectTypeName",defClass.getString("name"));
|
|
|
+ for (ObjectTypeDefine objectTypeDefine : classList) {
|
|
|
+ JSONObject temp = new JSONObject();
|
|
|
+ temp.put("objectType", objectTypeDefine.getCode());
|
|
|
+ temp.put("objectTypeName", objectTypeDefine.getName());
|
|
|
result.add(temp);
|
|
|
- }
|
|
|
+ }
|
|
|
+
|
|
|
return AdmResponse.success(result);
|
|
|
}
|
|
|
}
|