Pārlūkot izejas kodu

fix : space report add interface /unspace-ispace 未关联业务空间的元空间 使用关系查询,未使用原来adm的函数计算

lvxianyun 3 gadi atpakaļ
vecāks
revīzija
101883dd26

+ 34 - 8
src/main/java/com/persagy/proxy/report/controller/AdmSpaceInfoController.java

@@ -5,20 +5,22 @@ import com.fasterxml.jackson.databind.node.JsonNodeFactory;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.persagy.dmp.common.constant.ResponseCode;
 import com.persagy.proxy.adm.constant.AdmCommonConstant;
-import com.persagy.proxy.object.model.AdmEquipment;
-import com.persagy.proxy.object.model.AdmSystem;
+import com.persagy.proxy.adm.request.AdmDCSQueryRequest;
 import com.persagy.proxy.adm.request.AdmQueryCriteria;
 import com.persagy.proxy.adm.request.AdmResponse;
-import com.persagy.proxy.adm.service.*;
+import com.persagy.proxy.adm.service.IAdmRelationService;
 import com.persagy.proxy.adm.utils.AdmContextUtil;
-import com.persagy.proxy.object.service.IAdmEquipmentService;
-import com.persagy.proxy.object.service.IAdmFloorService;
-import com.persagy.proxy.object.service.IAdmSpaceService;
-import com.persagy.proxy.object.service.IAdmSystemService;
+import com.persagy.proxy.object.model.AdmEquipment;
+import com.persagy.proxy.object.model.AdmISpace;
+import com.persagy.proxy.object.model.AdmSystem;
+import com.persagy.proxy.object.service.*;
 import lombok.RequiredArgsConstructor;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
-import org.springframework.web.bind.annotation.*;
+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;
@@ -42,6 +44,8 @@ public class AdmSpaceInfoController {
 	@Autowired
 	private IAdmSpaceService spaceService;
 	@Autowired
+	private IAdmISpaceService ispaceService;
+	@Autowired
 	private IAdmSystemService systemService;
 	@Autowired
 	private IAdmEquipmentService equipmentService;
@@ -122,6 +126,28 @@ public class AdmSpaceInfoController {
 		return unSpaceEq(type, spaceId, request, "MechInArch");
 	}
 
+	/**
+	 * 未关联业务空间的元空间  si2sp
+	 */
+	@PostMapping("/unspace-ispace")
+	public AdmResponse unSpaceIspace(@QueryParam("objectType") String objectType, @RequestBody AdmDCSQueryRequest request) {
+		//si2sp
+		ObjectNode relationFrom = JsonNodeFactory.instance.objectNode();
+		relationFrom.put("relCode", "Si2Sp");
+		relationFrom.put("$bindFlag",false);
+		request.setRelationFrom(relationFrom);
+		request.setName(AdmISpace.OBJ_TYPE);
+		String floorFilter = "floorId = '" + request.getFloorId()+"'";
+		if(StrUtil.isNotEmpty(request.getFilters())){
+			request.setFilters(request.getFilters()+";"+floorFilter);
+		}else{
+			request.setFilters(floorFilter);
+		}
+		if(StrUtil.isNotEmpty(objectType)){
+			request.setFilters(request.getFilters()+"; classCode='"+objectType+"'");
+		}
+		return ispaceService.doQuery(AdmContextUtil.toDmpContext(),request, AdmISpace.class);
+	}
 
 	private AdmResponse unSpaceEq(String type, String spaceId, AdmQueryCriteria request, String graphCode) {
 		if (StrUtil.isBlank(spaceId)) {