Browse Source

空间 报表添加 /unspace-for-eq-point /unspace-fIn-eq-point /unspace-in-sys //unspace-in-eq
不使用关系计算,直接查询关系

lvxianyun 3 năm trước cách đây
mục cha
commit
8c6a959590

+ 88 - 9
src/main/java/com/persagy/proxy/adm/controller/AdmSpaceInfoController.java

@@ -1,15 +1,23 @@
 package com.persagy.proxy.adm.controller;
 
-import javax.servlet.http.HttpServletRequest;
-
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
+import cn.hutool.core.util.StrUtil;
+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.adm.model.AdmEquipment;
+import com.persagy.proxy.adm.model.AdmSystem;
+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.utils.AdmContextUtil;
 import lombok.RequiredArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.QueryParam;
 
 /**
  * 
@@ -20,20 +28,30 @@ import lombok.RequiredArgsConstructor;
  */
 @RestController
 @RequiredArgsConstructor
+@RequestMapping("/space")
 public class AdmSpaceInfoController {
 
 	public static final String EXPORT_SHEET_NAME = "关系维护";
 
 	@Value("${middleware.group.code}")
 	private String defaultCode;
-
+	@Autowired
+	private IAdmSpaceService spaceService;
+	@Autowired
+	private IAdmSystemService systemService;
+	@Autowired
+	private IAdmEquipmentService equipmentService;
+	@Autowired
+	private IAdmRelationService relationService;
+	@Autowired
+	private IAdmFloorService floorService;
 	/**
 	 * 统计 属于多建筑楼层的空间
 	 * 
 	 * @param request
 	 * @return
 	 */
-	@RequestMapping("/space/space-bd-fl")
+	@RequestMapping("/space-bd-fl")
 	public AdmResponse queryCount(HttpServletRequest request) {
 		String groupCode = request.getHeader(AdmCommonConstant.GROUP_CODE_HEADER);
 		String projectId = request.getHeader(AdmCommonConstant.PROJECT_ID_HEADER);
@@ -42,4 +60,65 @@ public class AdmSpaceInfoController {
 		return response;
 	}
 
+	/**
+	 * 查询没有和当前空间绑定的系统
+	 *  description= "例如:prijectId=Pj4201050001,type=AirConditioningZone spaceId=Sp4201050001df2091cdf719443b80bb737aeabf0525 " + "spaceId 为当前空间id type为当前空间类型 "
+	 * @param   type        空间类型  空间id确定,空间类型一定确定,此参数可以不用
+	 * @param   spaceId     空间id
+	 *
+	 * @author lxy
+	 */
+	@RequestMapping("/unspace-in-sys")
+	public AdmResponse unSpaceSys(@QueryParam("type") String type, @QueryParam("spaceId") String spaceId, @RequestBody AdmQueryCriteria request){
+		//sy2sp
+		ObjectNode relationFrom = JsonNodeFactory.instance.objectNode();
+		relationFrom.put("relCode", "Sy2Sp");
+		relationFrom.put("graphCode", "MechInArch");
+		relationFrom.put("objTo", spaceId);
+		relationFrom.put("$bindFlag",false);
+		request.setRelationFrom(relationFrom);
+		request.setName(AdmSystem.OBJ_TYPE);
+		return systemService.doQuery(AdmContextUtil.toDmpContext(),request, AdmSystem.class);
+	}
+
+	/**
+	 * 查询没有和当前空间绑定的设备
+	 * description ="例如:prijectId=Pj4201050001,type=AirConditioningZone spaceId=Sp4201050001df2091cdf719443b80bb737aeabf0525 " + "spaceId 为当前空间id type为当前空间类型 "
+	 * @return
+	 */
+	@PostMapping("/unspace-in-eq")
+	public AdmResponse unSpaceEq(@QueryParam("type") String type, @QueryParam("spaceId") String spaceId, @RequestBody AdmQueryCriteria request) {
+		return unSpaceEq(type, spaceId, request, "MechInArch");
+	}
+
+	/**
+	 * 空间内没有服务于当前空间的设备
+	 */
+	@PostMapping("/unspace-for-eq-point")
+	public AdmResponse unSpaceForEqPoint(@QueryParam("type") String type, @QueryParam("spaceId") String spaceId, @RequestBody AdmQueryCriteria request) {
+		return unSpaceEq(type, spaceId, request, "MechForArch");
+	}
+
+	/**
+	 * 空间内没有和空间关联的设备
+	 */
+	@PostMapping("/unspace-fIn-eq-point")
+	public AdmResponse unSpaceInEqPoint(@QueryParam("type") String type, @QueryParam("spaceId") String spaceId, @RequestBody AdmQueryCriteria request) {
+		return unSpaceEq(type, spaceId, request, "MechInArch");
+	}
+
+
+	private AdmResponse unSpaceEq(String type, String spaceId, AdmQueryCriteria request, String graphCode) {
+		if (StrUtil.isBlank(spaceId)) {
+			return AdmResponse.failure(ResponseCode.A0400.getDesc() + "空间id为空");
+		}
+		request.setName(AdmEquipment.OBJ_TYPE);
+		ObjectNode relationFrom = JsonNodeFactory.instance.objectNode();
+		relationFrom.put("relCode", "Eq2Sp");
+		relationFrom.put("graphCode", graphCode);
+		relationFrom.put("objTo", spaceId);
+		relationFrom.put("$bindFlag", false);
+		request.setRelationFrom(relationFrom);
+		return equipmentService.doQuery(AdmContextUtil.toDmpContext(), request, AdmEquipment.class);
+	}
 }