|
@@ -1,7 +1,29 @@
|
|
|
package com.persagy.proxy.report.controller;
|
|
|
|
|
|
-import cn.hutool.core.util.StrUtil;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.ws.rs.QueryParam;
|
|
|
+
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+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.RestController;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
+import com.fasterxml.jackson.databind.node.ObjectNode;
|
|
|
+import com.google.common.collect.Sets;
|
|
|
import com.persagy.dmp.common.constant.ResponseCode;
|
|
|
+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.digital.entity.ObjectRelation;
|
|
|
+import com.persagy.dmp.simple.client.DigitalObjectSimpleFacade;
|
|
|
+import com.persagy.proxy.adm.constant.AdmCommonConstant;
|
|
|
+import com.persagy.proxy.adm.constant.GraphCodeEnum;
|
|
|
+import com.persagy.proxy.adm.constant.RelCodeEnum;
|
|
|
import com.persagy.proxy.adm.request.AdmDCSQueryRequest;
|
|
|
import com.persagy.proxy.adm.request.AdmQueryCriteria;
|
|
|
import com.persagy.proxy.adm.request.AdmResponse;
|
|
@@ -12,15 +34,10 @@ import com.persagy.proxy.object.model.AdmSystem;
|
|
|
import com.persagy.proxy.object.service.IAdmEquipmentService;
|
|
|
import com.persagy.proxy.object.service.IAdmISpaceService;
|
|
|
import com.persagy.proxy.object.service.IAdmSystemService;
|
|
|
-import lombok.RequiredArgsConstructor;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-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.RestController;
|
|
|
|
|
|
-import javax.servlet.http.HttpServletRequest;
|
|
|
-import javax.ws.rs.QueryParam;
|
|
|
+import cn.hutool.core.collection.CollectionUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
|
|
|
/**
|
|
|
*
|
|
@@ -47,10 +64,34 @@ public class AdmSpaceInfoController {
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping("/space-bd-fl")
|
|
|
- public AdmResponse queryCount(HttpServletRequest request) {
|
|
|
- AdmResponse response = AdmResponse.success();
|
|
|
- response.setCount(0L);
|
|
|
- return response;
|
|
|
+ public JSONObject queryCount(HttpServletRequest request) {
|
|
|
+ String groupCode = AppContext.getContext().getGroupCode();
|
|
|
+ String projectId = AppContext.getContext().getProjectId();
|
|
|
+
|
|
|
+ ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
|
|
|
+ ObjectNode objectNode = objectMapper.createObjectNode();
|
|
|
+ objectNode.putPOJO("projectIds", Sets.newHashSet(projectId));
|
|
|
+ objectNode.putPOJO("graphCodes", Sets.newHashSet(GraphCodeEnum.ArchSubset.name()));
|
|
|
+ objectNode.putPOJO("relCodes", Sets.newHashSet(RelCodeEnum.Fl2Sp.name(), RelCodeEnum.Bd2Sp.name()));
|
|
|
+ objectNode.putPOJO("groups", Sets.newHashSet("objTo"));
|
|
|
+ CommonResult<List<ObjectRelation>> countByObjIds = DigitalObjectSimpleFacade.queryRelationCountByObjIds(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, objectNode);
|
|
|
+ List<ObjectRelation> data = countByObjIds.getData();
|
|
|
+
|
|
|
+ int count = 0;
|
|
|
+ JSONObject result = new JSONObject();
|
|
|
+ result.put("count", count);
|
|
|
+ result.put("message", "");
|
|
|
+ result.put("result", "success");
|
|
|
+ if (CollectionUtil.isEmpty(data)) {
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ for (ObjectRelation objectRelation : data) {
|
|
|
+ if (objectRelation.getCount() != null && objectRelation.getCount() > 1) {
|
|
|
+ count++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ result.put("count", count);
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
/**
|