فهرست منبع

Merge remote-tracking branch 'origin/develop' into develop

lijie 3 سال پیش
والد
کامیت
e07ade2859

+ 4 - 2
src/main/java/com/persagy/proxy/dictionary/service/impl/AdmModelRelServiceImpl.java

@@ -149,11 +149,11 @@ public class AdmModelRelServiceImpl extends AbstractAdmBaseServiceImpl<AdmModelR
         if(CollUtil.isEmpty(content)) {
             return;
         }
-        List<String> nullList = CollUtil.newArrayList("buildingId", "floorId");
         List<AdmEquipment> rsList = new ArrayList<>();
         for (AdmEquipment admEquipment : content) {
             if(deleteFlag) {
-                admEquipment.setNullList(nullList);
+                admEquipment.setBuildingId(null);
+                admEquipment.setFloorId(null);
                 rsList.add(admEquipment);
                 continue;
             }
@@ -198,6 +198,8 @@ public class AdmModelRelServiceImpl extends AbstractAdmBaseServiceImpl<AdmModelR
         List<String> nullList = CollUtil.newArrayList("buildingId", "floorId");
         for (AdmISpace iSpace : content) {
             if(deleteFlag) {
+                iSpace.setBuildingId(null);
+                iSpace.setFloorId(null);
                 iSpace.setNullList(nullList);
                 continue;
             }

+ 262 - 519
src/main/java/com/persagy/proxy/object/controller/AdmEquipmentController.java

@@ -14,39 +14,38 @@ import cn.hutool.poi.excel.RowUtil;
 import cn.hutool.poi.excel.WorkbookUtil;
 import cn.hutool.poi.excel.cell.CellUtil;
 import cn.hutool.poi.excel.editors.TrimEditor;
-import com.alibaba.fastjson.JSONObject;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.JsonNodeFactory;
+import com.alibaba.excel.EasyExcel;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.persagy.dmp.basic.dto.RequestData;
 import com.persagy.dmp.basic.model.QueryCriteria;
+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.entity.BaseEntity;
+import com.persagy.dmp.common.exception.BusinessException;
 import com.persagy.dmp.common.model.response.CommonResult;
-import com.persagy.dmp.define.client.DigitalDefineFacade;
+import com.persagy.dmp.define.client.DigitalObjectInfoFacade;
 import com.persagy.dmp.define.entity.ObjectInfoDefine;
 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.simple.client.DigitalObjectSimpleFacade;
 import com.persagy.proxy.adm.constant.AdmCommonConstant;
 import com.persagy.proxy.adm.constant.AdmDictCategoryEnum;
-import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
-import com.persagy.proxy.adm.request.AdmCreateRequest;
-import com.persagy.proxy.adm.request.AdmCreateResponse;
-import com.persagy.proxy.adm.request.AdmQueryCriteria;
-import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.adm.request.*;
 import com.persagy.proxy.adm.service.IAdmRelationService;
 import com.persagy.proxy.adm.utils.AdmContextUtil;
 import com.persagy.proxy.adm.utils.AdmExcelUtil;
+import com.persagy.proxy.adm.utils.AdmQueryCriteriaHelper;
 import com.persagy.proxy.adm.utils.ObjectNameUtil;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
 import com.persagy.proxy.common.entity.RelationDTO;
 import com.persagy.proxy.dictionary.model.AdmDict;
 import com.persagy.proxy.dictionary.model.AdmObjectType;
 import com.persagy.proxy.dictionary.service.IAdmDictService;
 import com.persagy.proxy.object.model.AdmEquipment;
+import com.persagy.proxy.object.model.AdmProject;
+import com.persagy.proxy.object.model.AdmSystem;
 import com.persagy.proxy.object.service.IAdmEquipmentService;
+import com.persagy.proxy.object.service.IAdmProjectService;
+import com.persagy.proxy.report.model.EquipmentPointExcel;
 import com.persagy.proxy.report.service.IRelationReportService;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.poi.ss.usermodel.*;
@@ -61,6 +60,8 @@ import javax.servlet.http.HttpServletResponse;
 import java.awt.Color;
 import java.io.FileOutputStream;
 import java.io.IOException;
+import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
 import java.util.List;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -82,7 +83,8 @@ public class AdmEquipmentController {
 	private IRelationReportService relationReportService;
 	@Autowired
 	private IAdmDictService dictService;
-
+	@Autowired
+	private IAdmProjectService projectService;
 	/**
 	 * 统计
 	 *
@@ -153,8 +155,6 @@ public class AdmEquipmentController {
 			return AdmCreateResponse.success();
 		}
 		filterVOs = service.doInsert(AdmContextUtil.toDmpContext(), AdmEquipment.class, filterVOs);
-		//处理关系
-        processRelations(filterVOs);
 		return AdmCreateResponse.success(filterVOs);
 	}
 
@@ -168,122 +168,61 @@ public class AdmEquipmentController {
 	public AdmResponse delete( @RequestBody List<AdmEquipment> vos) throws Exception {
 		// 组装上下文条件
 		service.doDelete(AdmContextUtil.toDmpContext(), vos);
-        QueryCriteria queryCriteria = new QueryCriteria();
-        vos.forEach(vo -> {
-            /** 清除空间和建筑楼层的的数据 */
-            dealRelation(vo.getId(), queryCriteria, AdmRelationTypeEnum.EQ2BD.getRelCode());
-            dealRelation(vo.getId(), queryCriteria, AdmRelationTypeEnum.EQ2FL.getRelCode());
-        });
 		return AdmResponse.success();
 	}
 
-
-    /**
-     * 更新
-     * @param createRequest
-     * @return
-     * @throws Exception
-     */
-    @PostMapping("/update")
-    public AdmResponse update(@RequestBody AdmCreateRequest<AdmEquipment> createRequest) throws Exception {
-        List<AdmEquipment> vos = CollUtil.newArrayList(createRequest.getContent());
-        //vos = service.doUpdateEuip(AdmContextUtil.toDmpContext(), AdmEquipment.class, vos);
-        //针对设备更新时,所有更新的字段都放到信息点中的情况特殊处理
-        if(CollUtil.isNotEmpty(vos)){
-			Map<String, AdmEquipment> admEquipmentMap = CollUtil.fieldValueMap(vos, BaseEntity.PROP_ID);
-			AdmRelationTypeEnum typeEnum = AdmRelationTypeEnum.EQ2BD;
-			String graphCode = typeEnum.getGraphCode();
-			QueryCriteria criteria = new QueryCriteria();
-			ObjectNode node = JsonNodeFactory.instance.objectNode();
-			node.put("graphCode", graphCode);
-			admEquipmentMap.keySet().stream().forEach(equipId -> {
-				AdmEquipment admEquipment = admEquipmentMap.get(equipId);
-				//处理建筑 楼层信息点
-				int removeflBd = 0 ;//关系处理 0不删除 1删除bd 2删除fl 3都删除
-				String flowBuild = admEquipment.getFlowBuild();
-				if(StrUtil.isNotEmpty(flowBuild)){
-					if(!flowBuild.contains("-")){
-						if(flowBuild.startsWith("Bd")){
-							admEquipment.setBuildingId(flowBuild);
-							if(StrUtil.isNotEmpty(admEquipment.getFloorId())){
-								Map<String, Object> infos = new HashMap<String,Object>(16);
-								infos.put("$remove", Arrays.asList("floorId"));
-								admEquipment.setInfos(infos);
-								removeflBd = 2;
-							}
-						}
-					}else {
-						String[] str = flowBuild.split("-");
-						if(str[0].startsWith("Bd")){
-							admEquipment.setBuildingId(str[0]);
-							admEquipment.setFloorId(str[1]);
-						}else{
-							admEquipment.setBuildingId(str[1]);
-							admEquipment.setFloorId(str[0]);
-						}
-						removeflBd = 3;
-					}
-					admEquipment.setFlowBuild(null);
-				}else{
-					if(StrUtil.isAllNotEmpty(admEquipment.getBuildingId(),admEquipment.getFloorId())){
-						Map<String, Object> infos = new HashMap<String,Object>(16);
-						infos.put("$remove",Arrays.asList("floorId","buildingId"));
-						admEquipment.setInfos(infos);
-						removeflBd = 3;
+	/**
+	 * 更新
+	 * @param createRequest
+	 * @return
+	 * @throws Exception
+	 */
+	@PostMapping("/update")
+	public AdmResponse update(@RequestBody AdmCreateRequest<AdmEquipment> createRequest) throws Exception {
+		List<AdmEquipment> vos = createRequest.getContent();
+		if(CollUtil.isEmpty(vos)) {
+			return AdmResponse.success(vos);
+		}
+		for(AdmEquipment vo:vos) {
+			if(StrUtil.isNotBlank(vo.getFlowBuild())) {
+				// 处理建筑-楼层信息点
+				List<String> flows = StrUtil.splitTrim(vo.getFlowBuild(), "-");
+				for(String flow:flows) {
+					if(StrUtil.startWith(flow, "Bd")) {
+						vo.setBuildingId(flow);
+					} else if(StrUtil.startWith(flow, "fl")) {
+						vo.setFloorId(flow);
 					}
 				}
-				//删除关系 然后重建
-				if(removeflBd == 3 || removeflBd == 2){
-					node.put("relCode", "Eq2Fl");
-					node.put("objFrom", equipId);
-					criteria.setCriteria(node);
-					relationService.doDelete(AdmContextUtil.toDmpContext(), criteria);
-				}
-				if(removeflBd == 3 || removeflBd == 1){
-					node.put("relCode", "Eq2Bd");
-					node.put("objFrom", equipId);
-					criteria.setCriteria(node);
-					relationService.doDelete(AdmContextUtil.toDmpContext(), criteria);
-				}
-			});
-
-			List<RelationDTO> relationDTOList = new ArrayList<>(vos.size());
-			admEquipmentMap.keySet().stream().forEach(equipId -> {
-				if(StrUtil.isNotEmpty(admEquipmentMap.get(equipId).getBuildingId())){
-					RelationDTO relationbd = new RelationDTO(null, graphCode, "Eq2Bd", null, equipId, admEquipmentMap.get(equipId).getBuildingId());
-					relationDTOList.add(relationbd);
-				}
-				if(StrUtil.isNotEmpty(admEquipmentMap.get(equipId).getFloorId())) {
-					RelationDTO relationfl = new RelationDTO(null, graphCode, "Eq2Fl", null, equipId, admEquipmentMap.get(equipId).getFloorId());
-					relationDTOList.add(relationfl);
-				}
-			});
-
-			if(CollUtil.isNotEmpty(relationDTOList)){
-				relationService.doSave(AdmContextUtil.toDmpContext(), relationDTOList);
+				vo.setFlowBuild(null);
 			}
-			//处理设备更新特殊数据
-            vos.stream().forEach(equipment -> {
-				//特殊处理位置信息
-				if(StrUtil.isNotEmpty(equipment.getBimLocation())){
-					Map<String,Object> infos = equipment.getInfos();
-					if(CollUtil.isEmpty(infos)){
-						infos = new HashMap<String, Object>();
-						infos.put("bimLocation", equipment.getBimLocation());
-						equipment.setInfos(infos);
-					}
-				}
-                if(CollUtil.isNotEmpty(equipment.getInfos())){
-                	Object localId = equipment.getInfos().get("localId");
-                   if(localId != null && StrUtil.isNotEmpty(localId.toString())){
-						equipment.setLocalId(localId.toString());
-				   }
-                }
-            });
-        }
-        vos = service.doUpdate(AdmContextUtil.toDmpContext(), AdmEquipment.class, vos);
-        return AdmResponse.success(vos);
-    }
+			// 设置remove信息
+			Set<String> nullList = CollUtil.newHashSet();
+			CollUtil.addAll(nullList, vo.getNullList());
+			if(StrUtil.isBlank(vo.getFloorId())) {
+				nullList.add("floorId");
+			}
+			if(StrUtil.isBlank(vo.getBuildingId())) {
+				nullList.add("buildingId");
+			}
+			vo.setNullList(CollUtil.newArrayList(nullList));
+			//特殊处理位置信息
+			Map<String,Object> infos = vo.getInfos();
+			if(infos == null) {
+				infos = new HashMap<String, Object>();
+				vo.setInfos(infos);
+			}
+			if(StrUtil.isNotEmpty(vo.getBimLocation())){
+				infos.put("bimLocation", vo.getBimLocation());
+			}
+			String localId = MapUtil.getStr(infos, "localId");
+			if(StrUtil.isNotEmpty(localId)){
+				vo.setLocalId(localId);
+			}
+		}
+		vos = service.doUpdate(AdmContextUtil.toDmpContext(), AdmEquipment.class, vos);
+		return AdmResponse.success(vos);
+	}
 
 	/**
 	 * 查询
@@ -325,16 +264,74 @@ public class AdmEquipmentController {
 
 	/**
 	 * 设备绑定的动态信息点或静态信息点
-	 * @param type static:已交付的静态信息点;iot:已交付的iot信息点
+	 * @param type 数据类型 static (静态)、iot (动态)
 	 * @return
 	 * @throws Exception
 	 */
 	@GetMapping("/export")
-	public AdmResponse exportInfos(@RequestParam("type") String type,@RequestParam("projectId") String projectId) throws Exception {
-		return null;
+	public void exportInfos(@RequestParam("type") String type, @RequestParam("projectId") String projectId, HttpServletResponse response) throws Exception {
+		try {
+			response.setContentType("application/vnd.ms-excel");
+			String encode = StandardCharsets.UTF_8.name();
+			response.setCharacterEncoding(encode);
+			AdmQueryCriteria projectRequest = new AdmQueryCriteria();
+			projectRequest.setName(AdmProject.OBJ_TYPE);
+			projectRequest.setFilters("id = '" + projectId + "';");
+			AdmResponse responsePro = projectService.doQuery(AdmContextUtil.toDmpContext(), projectRequest, AdmProject.class);
+
+			if (CollUtil.isEmpty(responsePro.getContent())) {
+				throw new BusinessException(ResponseCode.A0402.getCode(), ResponseCode.A0402.getDesc());
+			} else {
+				AdmProject admProject = (AdmProject) responsePro.getContent().get(0);
+				// 防止中文乱码
+				String fileName = admProject.getLocalName() + "设备已交付信息点";
+				fileName = URLEncoder.encode(fileName, encode);
+
+				response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
+				List<EquipmentPointExcel> equipmentPointExcels = dealEquipmentPoint(admProject.getGroupCode(),admProject.getId(),type, false, null);
+				int count = equipmentPointExcels.size();
+				if(count > 100000){
+					EasyExcel.write(response.getOutputStream(), EquipmentPointExcel.class).sheet("sheet1").doWrite(equipmentPointExcels.subList(0,100000));
+					EasyExcel.write(response.getOutputStream(), EquipmentPointExcel.class).sheet("sheet2").doWrite(equipmentPointExcels.subList(100000,count+1));
+				}else{
+					EasyExcel.write(response.getOutputStream(), EquipmentPointExcel.class).sheet("sheet1").doWrite(equipmentPointExcels);
+				}
+			}
+		}catch (Exception e){
+			log.error("设备数据导出异常,获取项目失败",e);
+		}
+	}
+	/**
+	 * 根据建筑 查询设备绑定的动态信息点或静态信息点
+	 * @param type 数据类型 static (静态)、iot (动态)
+	 */
+	@GetMapping("/export/bulidng")
+	public void equipInfosTwo(@RequestParam("type") String type, @RequestParam("projectId") String projectId, HttpServletResponse response,@RequestParam("buildingId") String buildingId) {
+		try {
+			response.setContentType("application/vnd.ms-excel");
+			String encode = StandardCharsets.UTF_8.name();
+			response.setCharacterEncoding(encode);
+			AdmQueryCriteria projectRequest = new AdmQueryCriteria();
+			projectRequest.setName(AdmProject.OBJ_TYPE);
+			projectRequest.setFilters("id = '" + projectId + "';");
+			AdmResponse responsePro = projectService.doQuery(AdmContextUtil.toDmpContext(), projectRequest, AdmProject.class);
+
+			if (CollUtil.isEmpty(responsePro.getContent())) {
+				throw new BusinessException(ResponseCode.A0402.getCode(), ResponseCode.A0402.getDesc());
+			} else {
+				AdmProject admProject = (AdmProject) responsePro.getContent().get(0);
+				// 防止中文乱码
+				String fileName = admProject.getLocalName() + "设备已交付信息点";
+				fileName = URLEncoder.encode(fileName, encode);
+
+				response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
+				List<EquipmentPointExcel> equipmentPointExcels = dealEquipmentPoint(admProject.getGroupCode(),admProject.getId(),type, true, buildingId);
+				EasyExcel.write(response.getOutputStream(), EquipmentPointExcel.class).sheet("sheet1").doWrite(equipmentPointExcels);
+			}
+		}catch (Exception e){
+			log.error("设备数据导出异常,获取项目失败",e);
+		}
 	}
-
-
 	/**
 	 * 根据项目id查询所有的设备和部件
 	 *
@@ -365,39 +362,23 @@ public class AdmEquipmentController {
 		if(CollUtil.isEmpty(vos)){
 			return AdmCreateResponse.success();
 		}
-		//创建设备
-		vos.stream().forEach(equipment -> {
-			if (StrUtil.isEmpty(equipment.getName())){
-				equipment.setName(ObjectNameUtil.objectName("设备-"));
-			}
-		});
-		List<AdmEquipment> reVos = new ArrayList<>(vos.size());
+		// 这里应该要移到实现类里
 		List<RelationDTO> relationDTOS = new ArrayList<>(16);
-		vos.stream().forEach(admEq -> {
-			//创建设备
-			List<AdmEquipment> vosR = service.doInsert(AdmContextUtil.toDmpContext(), AdmEquipment.class, CollUtil.newArrayList(admEq));
-			//TODO 创建资产
-			//添加设备和系统、建筑、楼层的关系
-			if(CollUtil.isNotEmpty(vosR)){
-				String equipId = vosR.get(0).getId();
-				if(StrUtil.isNotEmpty(equipId)){
-					if(CollUtil.isNotEmpty(admEq.getLinkSystem())){
-						admEq.getLinkSystem().stream().forEach(admSystem -> {
-							relationDTOS.add(new RelationDTO(null, "MechSubset", "Sy2Eq", null , admSystem.getId(), equipId));
-						});
-					}
-					if(StrUtil.isNotEmpty(admEq.getBuildingId())){
-						relationDTOS.add(new RelationDTO(null, "MechInArch", "Eq2Bd", null , equipId, admEq.getBuildingId()));
-					}
-					if(StrUtil.isNotEmpty(admEq.getFloorId())){
-						relationDTOS.add(new RelationDTO(null, "MechInArch", "Eq2Fl", null , equipId, admEq.getFloorId()));
-					}
-				}
+		for(AdmEquipment vo:vos) {
+			if (StrUtil.isEmpty(vo.getName())){
+				vo.setName(ObjectNameUtil.objectName("设备-"));
 			}
-			reVos.addAll(vosR);
-		});
+			List<AdmSystem> systems = vo.getLinkSystem();
+			if(CollUtil.isEmpty(systems)){
+				continue;
+			}
+			for(AdmSystem system:systems) {
+				relationDTOS.add(new RelationDTO(null, "MechSubset", "Sy2Eq", null , system.getId(), vo.getId()));
+			}
+		}
 		relationService.doSave(AdmContextUtil.toDmpContext(),relationDTOS);
-		return AdmCreateResponse.success(reVos);
+		vos = service.doInsert(AdmContextUtil.toDmpContext(), AdmEquipment.class, vos);
+		return AdmCreateResponse.success(vos);
 	}
 
 	/**
@@ -407,258 +388,6 @@ public class AdmEquipmentController {
 	 * @param request
 	 * @param response
 	 */
-//	@RequestMapping("/import")
-//	public AdmResponse importFile(@RequestParam("file") MultipartFile file, HttpServletRequest request, HttpServletResponse response) {
-//		if (file == null) {
-//			return AdmResponse.failure("未选择文件");
-//		}
-//		String path = AdmCommonConstant.SERVER_ROOT_PATH + AdmExcelUtil.TEMP_UPLOAD_PAHT;
-//
-//		int failurNum = 0;
-//		int successCount = 0;
-//		String failure = null;
-//		String primaryKey = null;
-//		String classCodeCloumn = null;
-//		XSSFWorkbook workbook = null;
-//		FileOutputStream fileOutputStream = null;
-//		String groupCode = AppContext.getContext().getGroupCode();
-//		String projectId = AppContext.getContext().getProjectId();
-//		try {
-//
-//			workbook = new XSSFWorkbook(file.getInputStream());
-//			XSSFSheet sheet = workbook.getSheetAt(0);	// 第一个sheet
-//			XSSFRow row1 = sheet.getRow(1);
-//			if (row1 == null) {
-//				AdmExcelUtil.writeFile2Local(workbook, projectId, path, file.getOriginalFilename());
-//				return AdmExcelUtil.getImportFailResult("数据不存在", "2", 0, ++failurNum);
-//			}
-//
-//			/** 获取识别码 */
-//			XSSFCell markCell = row1.getCell(0);
-//			if (markCell == null) {
-//				AdmExcelUtil.writeFile2Local(workbook, projectId, path, file.getOriginalFilename());
-//				return AdmExcelUtil.getImportFailResult("未填写识别码", "2", 0, ++failurNum);
-//			}
-//			primaryKey = markCell.getStringCellValue().trim(); 	// 识别码
-//			boolean containsKey = AdmCommonConstant.codeColMap.containsKey(primaryKey);
-//			if (!containsKey) {
-//				AdmExcelUtil.writeFile2Local(workbook, projectId, path, file.getOriginalFilename());
-//				return AdmExcelUtil.getImportFailResult("未找到识别码", "2", 0, ++failurNum);
-//			}
-//			primaryKey = AdmCommonConstant.codeColMap.get(primaryKey);
-//
-//			/** 获取类型 */
-//			XSSFCell cell = row1.getCell(1);
-//			if (cell == null) {
-//				AdmExcelUtil.writeFile2Local(workbook, projectId, path, file.getOriginalFilename());
-//				return AdmExcelUtil.getImportFailResult("未填写设备类型", "2", 0, ++failurNum);
-//			}
-//			classCodeCloumn = cell.getStringCellValue().trim();
-//			if (!"ClassCode".equals(classCodeCloumn)) {
-//				AdmExcelUtil.writeFile2Local(workbook, projectId, path, file.getOriginalFilename());
-//				return AdmExcelUtil.getImportFailResult("缺少设备类型(ClassCode)", "2", 0, ++failurNum);
-//			}
-//
-//			// 存取所有的信息点
-//			Map<Integer, String> infoMap = new HashMap<Integer, String>();
-//			short lastCellNum = row1.getLastCellNum();
-//			for (int i = 1; i <= lastCellNum; i++) {
-//				XSSFCell xssfCell = row1.getCell(i);
-//				if (xssfCell != null && xssfCell.getStringCellValue() != null) {
-//					infoMap.put(i, xssfCell.getStringCellValue().trim());
-//				}
-//			}
-//
-//			// 录入数据获取
-//			int lastRowNum = sheet.getLastRowNum();
-//			boolean isClassCode = "classCode".equals(primaryKey);
-//			for (int i = 2; i <= lastRowNum; i++) {
-//				XSSFRow xssfRow = sheet.getRow(i);
-//				if (xssfRow == null) {
-//					continue;
-//				}
-//
-//				String value = null;
-//				String classCode = null;
-//				ObjectNode equipment = null;
-//				List<ObjectNode> equipmentList = null;
-//				Map<String, Object> tempMap = new HashMap<String, Object>();
-//
-//				lastCellNum = xssfRow.getLastCellNum();
-//				for (int j = 0; j <= lastCellNum; j++) {
-//					cell = xssfRow.getCell(j);
-//					if (cell == null || StrUtil.isBlank(cell.getRawValue())) {
-//						xssfRow.createCell(j);
-//						if (j == 0) {
-//							this.setColor(workbook, 252, 255, 77, xssfRow.getCell(j));
-//						} else {
-//							this.setColor(workbook, 77, 178, 255, xssfRow.getCell(j));
-//						}
-//						continue;
-//					}
-//					if (j == 0) {
-//						cell.setCellType(CellType.STRING);
-//						value = cell.getStringCellValue().trim();
-//						String codeType = isClassCode ? xssfRow.getCell(0).toString().trim() : xssfRow.getCell(1).toString().trim();
-//						// 获取类型定义
-//						ObjectTypeDefine define = this.getObjectTypeDefine(groupCode, projectId, codeType);
-//						if (define == null) {
-//							this.setColor(workbook, 56, 94, 15, cell);
-//							continue;
-//						}
-//						classCode = define.getCode();
-//						equipmentList = isClassCode ? this.getEquipmentList(groupCode, projectId, null, null, classCode)
-//								: this.getEquipmentList(groupCode, projectId, primaryKey, value, classCode);
-//
-//						if (CollectionUtil.isEmpty(equipmentList)) {
-//							failurNum++;
-//							this.setColor(workbook, 153, 225, 77, cell);
-//							continue;
-//						}
-//
-//						if (isClassCode) {
-//							equipment = equipmentList.get(0);
-//						} else {
-//							if (equipmentList.size() > 1) {
-//								failurNum++;
-//								this.setColor(workbook, 249, 203, 77, cell);
-//							} else {
-//								equipment = equipmentList.get(0);
-//							}
-//						}
-//
-//						continue;
-//					}
-//					// 剩余列数据处理
-//					if (j != 1 && equipment != null && infoMap.containsKey(j)) {
-//						// 获取设备类的信息点
-//						List<ObjectInfoDefine> funidList = this.relationReportService.queryFunidList(groupCode, projectId, Sets.newHashSet(classCode), infoMap.get(j), "STATIC");
-//						if (CollectionUtil.isEmpty(funidList)) {
-//							failurNum++;
-//							this.setColor(workbook, 77, 178, 255, cell);
-//							continue;
-//						}
-//						ObjectInfoDefine define = funidList.get(0);
-//						if ("STRING".equalsIgnoreCase(define.getDataType())) {
-//							cell.setCellType(CellType.STRING);
-//							tempMap.put(define.getCode(), cell.getStringCellValue().trim());
-//						} else if ("INTEGER".equalsIgnoreCase(define.getDataType())) {
-//							try {
-//								if (!CellType.NUMERIC.equals(cell.getCellTypeEnum()) || StrUtil.isBlank(cell.getRawValue())) {
-//									failurNum++;
-//									this.setColor(workbook, 155, 227, 255, cell);
-//									continue;
-//								}
-//								cell.setCellType(CellType.STRING);
-//								tempMap.put(define.getCode(), cell.getStringCellValue().trim());
-//							} catch (Exception e) {
-//								failurNum++;
-//								this.setColor(workbook, 155, 227, 255, cell);
-//								continue;
-//							}
-//						} else if ("ENUM".equalsIgnoreCase(define.getDataType())) {
-//							if (CellType.NUMERIC.equals(cell.getCellTypeEnum()) && StrUtil.isNotBlank(cell.getRawValue())) {
-//								cell.setCellType(CellType.STRING);
-//								tempMap.put(define.getCode(), cell.getStringCellValue().trim());
-//							} else if (CellType.STRING.equals(cell.getCellTypeEnum()) && StrUtil.isNotBlank(cell.getRawValue())) {
-//								tempMap.put(define.getCode(), cell.getStringCellValue().trim());
-//							} else {
-//								failurNum++;
-//								this.setColor(workbook, 155, 227, 255, cell);
-//								continue;
-//							}
-//						} else if ("DATETIME".equalsIgnoreCase(define.getDataType())) {
-//							try {
-//								cell.setCellType(CellType.STRING);
-//								String trim = cell.getStringCellValue().trim();
-//								tempMap.put(define.getCode(), DateUtil.parseByPatterns(trim, "yyyyMMdd"));
-//							} catch (Exception e) {
-//								failurNum++;
-//								this.setColor(workbook, 155, 227, 255, cell);
-//								continue;
-//							}
-//						} else if ("DOUBLE".equalsIgnoreCase(define.getDataType())) {
-//							try {
-//								cell.setCellType(CellType.STRING);
-//								String trim = cell.getStringCellValue().trim();
-//								tempMap.put(define.getCode(), Double.parseDouble(trim));
-//							} catch (Exception e) {
-//								failurNum++;
-//								this.setColor(workbook, 155, 227, 255, cell);
-//								continue;
-//							}
-//						} else if ("BOOLEAN".equalsIgnoreCase(define.getDataType())) {
-//							cell.setCellType(CellType.STRING);
-//							String trim = cell.getStringCellValue() == null ? null : cell.getStringCellValue().trim();
-//							if ("1".equals(trim) || "0".equals(trim)) {
-//								tempMap.put(define.getCode(), Double.parseDouble(trim));
-//							} else {
-//								failurNum++;
-//								this.setColor(workbook, 155, 227, 255, cell);
-//								continue;
-//							}
-//						} else {
-//							failurNum++;
-//							this.setColor(workbook, 204, 99, 233, cell);
-//							continue;
-//						}
-//					}
-//				}
-//
-//				if (isClassCode) {
-//					if (CollectionUtil.isNotEmpty(equipmentList) && tempMap.size() > 0) {
-//						for (ObjectNode equipNode : equipmentList) {
-//							int success = this.updateEquipInfo(tempMap, groupCode, projectId, equipNode.get("id").asText());
-//							if (success == 0) {
-//								failurNum++;
-//							} else {
-//								successCount++;
-//							}
-//						}
-//					}
-//				} else {
-//					if (StrUtil.isNotBlank(value) && equipment != null && tempMap.size() > 0) {
-//						int success = this.updateEquipInfo(tempMap, groupCode, projectId, equipment.get("id").asText());
-//						if (success == 0) {
-//							failurNum++;
-//						} else {
-//							successCount++;
-//						}
-//					}
-//				}
-//			}
-//
-//			// 写入错误报告对比值颜色
-//			this.wirteReport(workbook, sheet);
-//
-//			// 返回正确结果
-//			String fileName = AdmExcelUtil.writeFile2Local(workbook, projectId, path, file.getOriginalFilename());
-//			return AdmExcelUtil.getImportSuccessResult(fileName, successCount, failurNum);
-//		} catch (Exception e) {
-//			log.error("台账信息导入失败", e);
-//			failure = e.getMessage();
-//		} finally {
-//			if (fileOutputStream != null) {
-//				try {
-//					fileOutputStream.flush();
-//					fileOutputStream.close();
-//				} catch (IOException e) {}
-//			}
-//			if (workbook != null) {
-//				try {
-//					workbook.close();
-//				} catch (IOException e) {}
-//			}
-//		}
-//		return AdmResponse.failure(failure);
-//	}
-	/**
-	 * 设备上传excel识别静态信息点
-	 *
-	 * @param file
-	 * @param request
-	 * @param response
-	 */
 	@RequestMapping("/import")
 	public AdmResponse importFile(@RequestParam("file") MultipartFile file, HttpServletRequest request, HttpServletResponse response) {
 		if (file == null) {
@@ -934,80 +663,6 @@ public class AdmEquipmentController {
 	}
 
 	/**
-	 * 更新设备信息
-	 *
-	 * @param tempMap
-	 * @param groupCode
-	 * @param projectId
-	 * @param equipId
-	 * @return
-	 */
-	private int updateEquipInfo(Map<String, Object> tempMap, String groupCode, String projectId, String equipId) {
-		ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
-
-		Set<String> keySet = tempMap.keySet();
-		ObjectNode updateEquip = objectMapper.createObjectNode();
-		for (String key : keySet) {
-			Object obj = tempMap.get(key);
-
-			updateEquip.put("id", equipId);
-			if (obj instanceof Date) {
-				updateEquip.putPOJO(key, obj);
-			} else {
-				updateEquip.put(key, obj.toString());
-			}
-
-		}
-
-		ObjectDigital updateOne = DigitalObjectFacade.updateOne(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, updateEquip);
-		return updateOne == null ? 0 : 1;
-	}
-
-	/**
-	 * 获取类型定义
-	 *
-	 * @param code
-	 * @return
-	 */
-	private ObjectTypeDefine getObjectTypeDefine(String groupCode, String projectId, String code) {
-		QueryCriteria queryCriteria = new QueryCriteria();
-		ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
-		ObjectNode condition = objectMapper.createObjectNode();
-		JSONObject arrays = new JSONObject();
-		arrays.put("$ne", "system");
-		condition.putPOJO("parentCode", arrays);
-		condition.put("code", code);
-		queryCriteria.setCriteria(condition);
-
-		List<ObjectTypeDefine> objectType = DigitalDefineFacade.queryObjectType(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, queryCriteria);
-		return CollectionUtil.isEmpty(objectType) ? null : objectType.get(0);
-	}
-
-	/**
-	 * 获取设备
-	 *
-	 * @param groupCode
-	 * @param projectId
-	 * @param primaryKey
-	 * @param code
-	 * @param classCode
-	 * @return
-	 */
-	private List<ObjectNode> getEquipmentList(String groupCode, String projectId, String primaryKey, String code, String classCode) {
-		QueryCriteria queryCriteria = new QueryCriteria();
-		ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
-		ObjectNode condition = objectMapper.createObjectNode();
-		if (StrUtil.isAllNotBlank(primaryKey, code)) {
-			condition.put(primaryKey, code);
-		}
-		condition.put("classCode", classCode);
-		queryCriteria.setCriteria(condition);
-
-		List<ObjectNode> objectNodes = DigitalObjectFacade.query(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, queryCriteria);
-		return objectNodes;
-	}
-
-	/**
 	 * 设置填充色
 	 *
 	 * @param workbook
@@ -1114,37 +769,125 @@ public class AdmEquipmentController {
 		this.setColor(workbook,56,94,15,createCell);
 	}
 
-    /**
-     * 添加绑定关系
-     */
-    private void processRelations(List<AdmEquipment> vosR){
-        if(CollUtil.isNotEmpty(vosR)) {
-            List<RelationDTO> relationDTOS = new ArrayList<>(vosR.size());
-            vosR.forEach(admEquipment -> {
-                if (StrUtil.isNotEmpty(admEquipment.getBuildingId())) {
-                    relationDTOS.add(new RelationDTO(null, AdmRelationTypeEnum.EQ2BD.getGraphCode(), AdmRelationTypeEnum.EQ2BD.getRelCode(), admEquipment.getClassCode(), admEquipment.getId(), admEquipment.getBuildingId()));
-                }
-                if (StrUtil.isNotEmpty(admEquipment.getFloorId())) {
-                    relationDTOS.add(new RelationDTO(null, AdmRelationTypeEnum.EQ2FL.getGraphCode(), AdmRelationTypeEnum.EQ2FL.getRelCode(), admEquipment.getClassCode(), admEquipment.getId(),admEquipment.getFloorId()));
-                }
-            });
-            if (CollUtil.isNotEmpty(relationDTOS)) {
-                relationService.doSave(AdmContextUtil.toDmpContext(), relationDTOS);
-            }
-        }
-    }
-
-    /**
-     * 删除关系
-     * @param euipId
-     * @param queryCriteria
-     * @param relCode
-     */
-    private void dealRelation(String euipId, QueryCriteria queryCriteria, String relCode){
-        ObjectNode rBd = JsonNodeFactory.instance.objectNode();
-        rBd.put("objFrom",euipId);
-        rBd.put("relCode",relCode);
-        queryCriteria.setCriteria(rBd);
-        relationService.doDelete(AdmContextUtil.toDmpContext(), queryCriteria);
-    }
+	/**
+	 * 组装需要导出的设备信息点
+	 * @param groupCode
+	 * @param projectId
+	 * @return
+	 */
+    private List<EquipmentPointExcel> dealEquipmentPoint(String groupCode,String projectId, String type, Boolean withBuilding, String buildingId){
+		InstanceUrlParam context = AdmContextUtil.toDmpContext();
+    	if(StrUtil.isAllNotEmpty(groupCode,projectId)){
+			// 结果封装
+			List<EquipmentPointExcel> excelList = new ArrayList<EquipmentPointExcel>();
+			/** 统计项目设备类型 */
+			RequestData requestData = new RequestData();
+			requestData.setProjectId(projectId);
+			requestData.setGroupCode(groupCode);
+			requestData.setObjType(AdmEquipment.OBJ_TYPE);
+			requestData.setObjTypes(CollUtil.newHashSet(AdmEquipment.OBJ_TYPE));
+			List<Map<String, Object>> equipTypeList = DigitalObjectSimpleFacade.queryDefineInfoByObjType(groupCode,projectId,null,null,requestData);
+			/** 统计信息不为空继续 */
+			if (equipTypeList.size() > 0 ) {
+				for(int i = 0; i < equipTypeList.size(); i++){
+					AdmDictQueryCriteria admQueryCriteriaInfo = new AdmDictQueryCriteria();
+					/** 是否查询静态信息点 */
+					if (type == "static"){
+						admQueryCriteriaInfo.addFilters("category = 'STATIC'");
+					} else {
+						admQueryCriteriaInfo.addFilters("category != 'STATIC'");
+					}
+					admQueryCriteriaInfo.addFilters("valid = 1 ");
+					admQueryCriteriaInfo.addFilters("classCode = '" + equipTypeList.get(i).get("code").toString() + "'");
+
+					AdmQueryCriteria admQueryCriteriaEquip = new AdmQueryCriteria();
+					admQueryCriteriaEquip.addFilters("classCode = '" + equipTypeList.get(i).get("code").toString() + "'");
+					admQueryCriteriaEquip.addFilters("not infos isnull");
+					admQueryCriteriaEquip.setName(AdmEquipment.OBJ_TYPE);
+					if(withBuilding){
+						if(StrUtil.isNotEmpty(buildingId)){
+							admQueryCriteriaEquip.addFilters("buildingId = '"+buildingId+"'");
+						}else{
+							admQueryCriteriaEquip.addFilters("buildingId isnull");
+						}
+					}
+					AdmResponse eqResponse = service.query(admQueryCriteriaEquip);
+					List<AdmEquipment> equipmentList = (List<AdmEquipment>) eqResponse.getContent();
+					if (equipmentList.size() > 0) {
+						/** 字典信息点 */
+						//AdmResponse responseDic = dictService.query(context, admQueryCriteriaInfo, AdmDictConstant.CLASS_CODE, AdmObjectInfo.class);
+						//List<AdmObjectInfo> defFuncIdList = (List<AdmObjectInfo>) responseDic.getContent();
+						QueryCriteria queryCriteria = AdmQueryCriteriaHelper.toDmpCriteria(admQueryCriteriaInfo);
+						queryCriteria.setOnlyCount(false);
+						List<ObjectInfoDefine> defFuncIdList = DigitalObjectInfoFacade.query(AdmContextUtil.toDmpContext().getGroupCode(), AdmContextUtil.toDmpContext().getProjectId(), AdmCommonConstant.APP_ID,null,queryCriteria);
+
+						if (defFuncIdList.size() > 0) {
+							Map mapInfo = new HashMap<String,String>();
+							Map mapInputType = new HashMap<String,String>();
+							Map mapInputFirstName = new HashMap<String,String>();
+							for (ObjectInfoDefine defFuncId : defFuncIdList) {
+								if(StrUtil.isEmpty(defFuncId.getCode())){
+									continue;
+								}
+								mapInfo.put(defFuncId.getCode(),defFuncId.getName());
+								if(StrUtil.isNotEmpty(defFuncId.getDataType())){
+									mapInputType.put(defFuncId.getCode(), defFuncId.getDataType());
+								}
+								if(StrUtil.isNotEmpty(defFuncId.getFirstTag())){
+									mapInputFirstName.put(defFuncId.getCode(),defFuncId.getFirstTag());
+								}
+							}
+							for (AdmEquipment equipment : equipmentList) {
+								if(CollUtil.isEmpty(equipment.getInfos())){
+									continue;
+								}
+								Map<String, Object> info = equipment.getInfos();
+								for(String key : info.keySet()){
+									if(info.get(key) != null && StrUtil.isNotEmpty(info.get(key).toString())){
+										boolean containsKey = mapInfo.containsKey(key);
+										if(!containsKey){
+											continue;
+										}
+										/** 处理数据写入文件 */
+										EquipmentPointExcel excel = new EquipmentPointExcel();
+										/** id */
+										excel.setId(equipment.getId());
+										/** 本地编码 */
+										excel.setLocalId(equipment.getLocalId());
+										/** 本地名称 */
+										excel.setLocalName(equipment.getLocalName());
+										/** 类型 */
+										excel.setClassCode(equipment.getClassCode());
+										/** 类型 */
+										excel.setClassCodeName(equipTypeList.get(i).get("name").toString());
+										/** 一级标签 */
+										boolean containsFirstName = mapInputFirstName.containsKey(key);
+										if (containsFirstName) {
+											/** 一级标签 */
+											excel.setMapInputFirstName(mapInputFirstName.get(key).toString());
+										}
+										/** 信息点名 */
+										excel.setInfoName(mapInfo.get(key).toString());
+										/** 信息点 */
+										excel.setInfoCode(key);
+										boolean containsInputType = mapInputType.containsKey(key);
+										if (containsInputType) {
+											/** 输入类型 */
+											excel.setInputType(mapInputType.get(key).toString());
+										}
+										/** 值 */
+										excel.setInputValue(info.get(key).toString());
+										excelList.add(excel);
+									}
+								}
+							}
+						}
+					}
+				}
+			}
+			return excelList;
+		}else{
+    		return null;
+		}
+	}
 }

+ 2 - 17
src/main/java/com/persagy/proxy/object/controller/AdmFloorController.java

@@ -218,24 +218,9 @@ public class AdmFloorController {
     public AdmResponse updateOutline(@RequestBody AdmCreateRequest<AdmFloor> admFloor) throws Exception {
         // 组装上下文条件
         AdmResponse admResponse = update(admFloor);
-        //TODO 处理关系
+
         /** 处理关系标记 */
-       /* val listtype = ArrayList<String>()
-        listtype.add("sh2bd")
-        listtype.add("bd2sp")
-        listtype.add("fl2sp")
-        listtype.add("syeq2bd")
-        listtype.add("sy2fl")
-        listtype.add("eq2fl")
-        listtype.add("pe2bd")
-        listtype.add("pe2fl")
-        for (type in listtype){
-            val entity = EquipmentService.relationTypeProjectservice.select(SFilter.eq("projectId", Opt.projectId!!), SFilter.eq("relationType", type)).entity()
-            if (entity!=null){
-                entity.computationalState = 2
-                EquipmentService.relationTypeProjectservice.update(entity)
-            }
-        }*/
+        service.processRelationType((List<AdmFloor>) admResponse.getContent());
         return admResponse;
     }
 

+ 56 - 1
src/main/java/com/persagy/proxy/object/controller/AdmShaftController.java

@@ -313,6 +313,61 @@ public class AdmShaftController {
      */
     @GetMapping("/shaft-zoneSpaceBaseTable-building")
     public AdmResponse queryZoneSpBd(@QueryParam("shaftId") String shaftId,
+                                     @QueryParam("objectType") String objectType) throws Exception {
+        if(!StrUtil.isAllNotEmpty(shaftId,AdmContextUtil.toDmpContext().getProjectId())) {
+            return AdmResponse.failure("必填项:shaftId(竖井id)、projectId(项目id)");
+        }
+        // 组装条件 查询竖井下的空间
+        AdmQueryCriteria admQueryCriteriaSpace = new AdmQueryCriteria();
+        admQueryCriteriaSpace.setName(AdmSpace.OBJ_TYPE);
+        if(StrUtil.isNotEmpty(objectType)){
+            admQueryCriteriaSpace.setFilters(" classCode = '"+objectType+"'");
+        }
+        ObjectNode relationTO = JsonNodeFactory.instance.objectNode();
+        relationTO.put("relCode", "Sh2Sp");
+        relationTO.put("graphCode","ArchSubset");
+        relationTO.put("objFrom", shaftId);
+        relationTO.put("relValue", objectType);
+        admQueryCriteriaSpace.setRelationTo(relationTO);
+
+        //1 空间级联建筑
+        List<AdmQueryCriteria> cascadeSp2BdFl = new ArrayList<>(1);
+        //1.1 空间级联楼层
+        AdmQueryCriteria cascadeSpFl = new AdmQueryCriteria();
+        cascadeSpFl.setName("floorList");
+        cascadeSpFl.setProjection(Arrays.asList("id","name","localName"));
+        cascadeSpFl.setOrders("floorSequenceId desc");
+        cascadeSp2BdFl.add(cascadeSpFl);
+
+        //1.2 空间级联建
+        AdmQueryCriteria queryCriteriaBd = new AdmQueryCriteria();
+        queryCriteriaBd.setName("building");
+        queryCriteriaBd.setProjection(Arrays.asList("id","name","localName","floor"));
+
+        cascadeSp2BdFl.add(queryCriteriaBd);
+        admQueryCriteriaSpace.setCascade(cascadeSp2BdFl);
+
+        AdmResponse admResponseSp = spaceService.query(admQueryCriteriaSpace);
+        if(CollUtil.isNotEmpty(admResponseSp.getContent())){
+            //处理建筑下的楼层不是和空间关联的信息
+            List<AdmSpace> spaces = (List<AdmSpace>) admResponseSp.getContent();
+            List<AdmBuilding> admBuildingList = new ArrayList<>();
+            for(AdmSpace space : spaces){
+                AdmBuilding building = space.getBuilding();
+                List<AdmFloor> floorList = space.getFloorList();
+                if(building != null && CollUtil.isNotEmpty(floorList)){
+                    building.setFloor(floorList);
+                    admBuildingList.add(building);
+                }
+            }
+            return AdmResponse.success(admBuildingList);
+        }else{
+            return AdmResponse.success();
+        }
+    }
+
+    /*@GetMapping("/shaft-zoneSpaceBaseTable-building")
+    public AdmResponse queryZoneSpBd(@QueryParam("shaftId") String shaftId,
              @QueryParam("objectType") String objectType) throws Exception {
         if(!StrUtil.isAllNotEmpty(shaftId,AdmContextUtil.toDmpContext().getProjectId())) {
             return AdmResponse.failure("必填项:shaftId(竖井id)、projectId(项目id)");
@@ -362,7 +417,7 @@ public class AdmShaftController {
             return AdmResponse.success();
         }
     }
-
+*/
     /**
      * 查询和当前竖井没有关联的业务空间
      * shaftId 为竖井id

+ 7 - 3
src/main/java/com/persagy/proxy/object/controller/AdmSpaceController.java

@@ -37,6 +37,7 @@ import java.util.*;
 
 @RestController
 @RequestMapping("/object/zone")
+
 public class AdmSpaceController {
     @Autowired
     private IAdmSpaceService service;
@@ -49,6 +50,7 @@ public class AdmSpaceController {
     @Autowired
     private SpaceRelationInfoHandler spaceRelationInfoHandler;
 
+
     /**
      * 统计
      *
@@ -364,9 +366,11 @@ public class AdmSpaceController {
     @PostMapping("/update-outline")
     public AdmResponse updateOutLine(@RequestBody AdmCreateRequest<AdmSpace> createRequest) throws Exception {
         List<AdmSpace> vos = CollUtil.newArrayList(createRequest.getContent());
-        vos = service.doUpdate( AdmContextUtil.toDmpContext(), AdmSpace.class, vos);
-        //TODO 更新计算关系ZoneSpaceBaseService.upDateOutline
-        return AdmResponse.success(vos);
+        /*vos = service.doUpdate( AdmContextUtil.toDmpContext(), AdmSpace.class, vos);
+        //更新计算关系ZoneSpaceBaseService.upDateOutline
+        service.processRelationType(vos);
+        return AdmResponse.success(vos);*/
+        return service.updateOutLine(vos);
     }
 
     /**

+ 170 - 20
src/main/java/com/persagy/proxy/object/controller/AdmSystemController.java

@@ -3,40 +3,47 @@ package com.persagy.proxy.object.controller;
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONUtil;
+import com.alibaba.excel.EasyExcel;
 import com.fasterxml.jackson.databind.node.ArrayNode;
 import com.fasterxml.jackson.databind.node.JsonNodeFactory;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.persagy.dmp.basic.dto.RequestData;
 import com.persagy.dmp.basic.model.QueryCriteria;
+import com.persagy.dmp.common.constant.ResponseCode;
+import com.persagy.dmp.common.exception.BusinessException;
 import com.persagy.dmp.common.model.entity.BaseEntity;
 import com.persagy.dmp.common.model.response.CommonResult;
 import com.persagy.dmp.define.client.DigitalDefineFacade;
+import com.persagy.dmp.define.client.DigitalObjectInfoFacade;
+import com.persagy.dmp.define.entity.ObjectInfoDefine;
 import com.persagy.dmp.define.entity.ObjectTypeDefine;
 import com.persagy.dmp.digital.client.DigitalObjectFacade;
 import com.persagy.dmp.digital.client.DigitalRelationFacade;
 import com.persagy.dmp.digital.entity.ObjectRelation;
 import com.persagy.dmp.simple.client.DigitalObjectSimpleFacade;
-import com.persagy.proxy.adm.request.AdmCreateRequest;
-import com.persagy.proxy.adm.request.AdmCreateResponse;
-import com.persagy.proxy.adm.request.AdmQueryCriteria;
-import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.request.*;
 import com.persagy.proxy.adm.service.IAdmRelationService;
 import com.persagy.proxy.adm.utils.AdmContextUtil;
 import com.persagy.proxy.adm.utils.AdmQueryCriteriaHelper;
 import com.persagy.proxy.adm.utils.ObjectNameUtil;
 import com.persagy.proxy.common.entity.RelationDTO;
-import com.persagy.proxy.object.model.AdmEquipment;
-import com.persagy.proxy.object.model.AdmShaft;
-import com.persagy.proxy.object.model.AdmSpace;
-import com.persagy.proxy.object.model.AdmSystem;
+import com.persagy.proxy.object.model.*;
+import com.persagy.proxy.object.service.IAdmProjectService;
 import com.persagy.proxy.object.service.IAdmSystemService;
+import com.persagy.proxy.report.model.SystemPointExcel;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.json.JsonObject;
+import javax.servlet.http.HttpServletResponse;
 import javax.validation.constraints.NotNull;
 import javax.ws.rs.QueryParam;
+import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -45,7 +52,7 @@ import java.util.Map;
  * @author lvxy
  * @date 2021/8/16
  */
-
+@Slf4j
 @RestController
 @RequestMapping("/object/general-system")
 public class AdmSystemController {
@@ -53,6 +60,8 @@ public class AdmSystemController {
     private IAdmSystemService service;
     @Autowired
     private IAdmRelationService relationService;
+    @Autowired
+    private IAdmProjectService projectService;
 
     /**
      * 统计
@@ -167,17 +176,6 @@ public class AdmSystemController {
     }
 
     /**
-     * 系统绑定的动态信息点或静态信息点
-     * type: static(静态),iot (动态)
-     * @return
-     * @throws Exception
-     */
-    @GetMapping("/export")
-    public AdmResponse exportInfos(@RequestParam("type") String type,@RequestParam("projectId") String projectId) throws Exception {
-        return null;
-    }
-
-    /**
      * 创建系统下的设备关系
      * @param createRequest
      * @return
@@ -364,4 +362,156 @@ public class AdmSystemController {
         return AdmResponse.success(obj,request);
     }
 
+    /**
+     * 导出系统的静态或动态数据
+     * @param type: static(静态),iot (动态)
+     */
+    @GetMapping("/export")
+    public void exportInfos(@RequestParam("type") String type, @RequestParam("projectId") String projectId, HttpServletResponse response) throws Exception {
+        try {
+            response.setContentType("application/vnd.ms-excel");
+            String encode = StandardCharsets.UTF_8.name();
+            response.setCharacterEncoding(encode);
+            AdmQueryCriteria projectRequest = new AdmQueryCriteria();
+            projectRequest.setName(AdmProject.OBJ_TYPE);
+            projectRequest.setFilters("id = '" + projectId + "';");
+            AdmResponse responsePro = projectService.doQuery(AdmContextUtil.toDmpContext(), projectRequest, AdmProject.class);
+
+            if (CollUtil.isEmpty(responsePro.getContent())) {
+                throw new BusinessException(ResponseCode.A0402.getCode(), ResponseCode.A0402.getDesc());
+            } else {
+                AdmProject admProject = (AdmProject) responsePro.getContent().get(0);
+                // 防止中文乱码
+                String fileName = admProject.getLocalName() + "设备已交付信息点";
+                fileName = URLEncoder.encode(fileName, encode);
+
+                response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
+                List<SystemPointExcel> systemPointExcels = dealEquipmentPoint(admProject.getGroupCode(),admProject.getId(),type, false, null);
+                EasyExcel.write(response.getOutputStream(), SystemPointExcel.class).sheet("sheet1").doWrite(systemPointExcels);
+            }
+        }catch (Exception e){
+            log.error("设备数据导出异常,获取项目失败",e);
+        }
+    }
+
+    /**
+     * 组装需要导出的设备信息点
+     * @param groupCode
+     * @param projectId
+     * @return
+     */
+    private List<SystemPointExcel> dealEquipmentPoint(String groupCode, String projectId, String type, Boolean withBuilding, String buildingId){
+        if(StrUtil.isAllNotEmpty(groupCode,projectId)){
+            // 结果封装
+            List<SystemPointExcel> excelList = new ArrayList<>();
+            /** 统计项目设备类型 */
+            RequestData requestData = new RequestData();
+            requestData.setProjectId(projectId);
+            requestData.setGroupCode(groupCode);
+            requestData.setObjType(AdmSystem.OBJ_TYPE);
+            requestData.setObjTypes(CollUtil.newHashSet(AdmSystem.OBJ_TYPE));
+            List<Map<String, Object>> equipTypeList = DigitalObjectSimpleFacade.queryDefineInfoByObjType(groupCode,projectId,null,null,requestData);
+            /** 统计信息不为空继续 */
+            if (equipTypeList.size() > 0 ) {
+                for(int i = 0; i < equipTypeList.size(); i++){
+                    AdmDictQueryCriteria admQueryCriteriaInfo = new AdmDictQueryCriteria();
+                    /** 是否查询静态信息点 */
+                    if (type == "static"){
+                        admQueryCriteriaInfo.addFilters("category = 'STATIC'");
+                    } else {
+                        admQueryCriteriaInfo.addFilters("category != 'STATIC'");
+                    }
+                    admQueryCriteriaInfo.addFilters("valid = 1 ");
+                    admQueryCriteriaInfo.addFilters("classCode = '" + equipTypeList.get(i).get("code").toString() + "'");
+
+                    AdmQueryCriteria admQueryCriteriaSys = new AdmQueryCriteria();
+                    admQueryCriteriaSys.addFilters("classCode = '" + equipTypeList.get(i).get("code").toString() + "'");
+                    admQueryCriteriaSys.addFilters("not infos isnull");
+                    admQueryCriteriaSys.setName(AdmEquipment.OBJ_TYPE);
+                    if(withBuilding){
+                        if(StrUtil.isNotEmpty(buildingId)){
+                            admQueryCriteriaSys.addFilters("buildingId = '"+buildingId+"'");
+                        }else{
+                            admQueryCriteriaSys.addFilters("buildingId isnull");
+                        }
+                    }
+                    AdmResponse eqResponse = service.query(admQueryCriteriaSys);
+                    List<AdmSystem> equipmentList = (List<AdmSystem>) eqResponse.getContent();
+                    if (equipmentList.size() > 0) {
+                        /** 字典信息点 */
+                        //AdmResponse responseDic = dictService.query(context, admQueryCriteriaInfo, AdmDictConstant.CLASS_CODE, AdmObjectInfo.class);
+                        //List<AdmObjectInfo> defFuncIdList = (List<AdmObjectInfo>) responseDic.getContent();
+                        QueryCriteria queryCriteria = AdmQueryCriteriaHelper.toDmpCriteria(admQueryCriteriaInfo);
+                        queryCriteria.setOnlyCount(false);
+                        List<ObjectInfoDefine> defFuncIdList = DigitalObjectInfoFacade.query(AdmContextUtil.toDmpContext().getGroupCode(), AdmContextUtil.toDmpContext().getProjectId(), AdmCommonConstant.APP_ID,null,queryCriteria);
+
+                        if (defFuncIdList.size() > 0) {
+                            Map mapInfo = new HashMap<String,String>();
+                            Map mapInputType = new HashMap<String,String>();
+                            Map mapInputFirstName = new HashMap<String,String>();
+                            for (ObjectInfoDefine defFuncId : defFuncIdList) {
+                                if(StrUtil.isEmpty(defFuncId.getCode())){
+                                    continue;
+                                }
+                                mapInfo.put(defFuncId.getCode(),defFuncId.getName());
+                                if(StrUtil.isNotEmpty(defFuncId.getDataType())){
+                                    mapInputType.put(defFuncId.getCode(), defFuncId.getDataType());
+                                }
+                                if(StrUtil.isNotEmpty(defFuncId.getFirstTag())){
+                                    mapInputFirstName.put(defFuncId.getCode(),defFuncId.getFirstTag());
+                                }
+                            }
+                            for (AdmSystem admSystem : equipmentList) {
+                                if(CollUtil.isEmpty(admSystem.getInfos())){
+                                    continue;
+                                }
+                                Map<String, Object> info = admSystem.getInfos();
+                                for(String key : info.keySet()){
+                                    if(info.get(key) != null && StrUtil.isNotEmpty(info.get(key).toString())){
+                                        boolean containsKey = mapInfo.containsKey(key);
+                                        if(!containsKey){
+                                            continue;
+                                        }
+                                        /** 处理数据写入文件 */
+                                        SystemPointExcel excel = new SystemPointExcel();
+                                        /** id */
+                                        excel.setId(admSystem.getId());
+                                        /** 本地编码 */
+                                        excel.setLocalId(admSystem.getLocalId());
+                                        /** 本地名称 */
+                                        excel.setLocalName(admSystem.getLocalName());
+                                        /** 类型 */
+                                        excel.setClassCode(admSystem.getClassCode());
+                                        /** 类型 */
+                                        excel.setClassCodeName(equipTypeList.get(i).get("name").toString());
+                                        /** 一级标签 */
+                                        boolean containsFirstName = mapInputFirstName.containsKey(key);
+                                        if (containsFirstName) {
+                                            /** 一级标签 */
+                                            excel.setMapInputFirstName(mapInputFirstName.get(key).toString());
+                                        }
+                                        /** 信息点名 */
+                                        excel.setInfoName(mapInfo.get(key).toString());
+                                        /** 信息点 */
+                                        excel.setInfoCode(key);
+                                        boolean containsInputType = mapInputType.containsKey(key);
+                                        if (containsInputType) {
+                                            /** 输入类型 */
+                                            excel.setInputType(mapInputType.get(key).toString());
+                                        }
+                                        /** 值 */
+                                        excel.setInputValue(info.get(key).toString());
+                                        excelList.add(excel);
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+            return excelList;
+        }else{
+            return null;
+        }
+    }
 }

+ 6 - 1
src/main/java/com/persagy/proxy/object/service/IAdmEquipmentService.java

@@ -1,6 +1,5 @@
 package com.persagy.proxy.object.service;
 
-import com.persagy.dmp.basic.model.QueryCriteria;
 import com.persagy.proxy.adm.request.AdmQueryCriteria;
 import com.persagy.proxy.adm.request.AdmResponse;
 import com.persagy.proxy.adm.service.IAdmBaseService;
@@ -68,4 +67,10 @@ public interface IAdmEquipmentService extends IAdmBaseService<AdmEquipment> {
      * @return
      */
     AdmResponse queryEquipClassCode(InstanceUrlParam context,AdmQueryCriteria request,Class<AdmEquipment> clazz);
+
+    /**
+     * 关系计算处理
+     * @param vos
+     */
+    void processRelationType(List<AdmEquipment> vos);
 }

+ 8 - 2
src/main/java/com/persagy/proxy/object/service/IAdmFloorService.java

@@ -1,10 +1,10 @@
 package com.persagy.proxy.object.service;
 
-import com.persagy.proxy.adm.service.IAdmBaseService;
-import com.persagy.proxy.object.model.AdmFloor;
 import com.persagy.proxy.adm.request.AdmQueryCriteria;
 import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.adm.service.IAdmBaseService;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
+import com.persagy.proxy.object.model.AdmFloor;
 
 import java.util.List;
 
@@ -46,4 +46,10 @@ public interface IAdmFloorService extends IAdmBaseService<AdmFloor> {
      * Update By lijie 2021/10/28 20:13
      */
     AdmResponse query(AdmQueryCriteria criteria);
+
+    /**
+     * 关系计算处理
+     * @param vos
+     */
+    void processRelationType(List<AdmFloor> vos);
 }

+ 12 - 2
src/main/java/com/persagy/proxy/object/service/IAdmSpaceService.java

@@ -3,10 +3,10 @@ package com.persagy.proxy.object.service;
 import com.alibaba.fastjson.JSONObject;
 import com.persagy.proxy.adm.request.AdmDCSQueryRequest;
 import com.persagy.proxy.adm.request.AdmQueryCriteria;
-import com.persagy.proxy.adm.service.IAdmBaseService;
-import com.persagy.proxy.object.model.AdmSpace;
 import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.adm.service.IAdmBaseService;
 import com.persagy.proxy.common.entity.InstanceUrlParam;
+import com.persagy.proxy.object.model.AdmSpace;
 
 import javax.servlet.http.HttpServletRequest;
 import java.util.List;
@@ -101,4 +101,14 @@ public interface IAdmSpaceService extends IAdmBaseService<AdmSpace> {
      * Update By lijie 2021/10/28 21:07
      */
     AdmResponse query(AdmQueryCriteria request);
+
+    /**
+     * 修改空间轮廓线
+     */
+    AdmResponse updateOutLine(List<AdmSpace> vos);
+
+    /**
+     * 处理关系计算
+     */
+    void processRelationType(List<AdmSpace> vos);
 }

+ 84 - 18
src/main/java/com/persagy/proxy/object/service/impl/AdmEquipmentServiceImpl.java

@@ -15,17 +15,21 @@ import com.persagy.dmp.common.model.entity.BaseEntity;
 import com.persagy.dmp.digital.client.DigitalRelationFacade;
 import com.persagy.dmp.digital.entity.ObjectRelation;
 import com.persagy.proxy.adm.constant.AdmCommonConstant;
+import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
 import com.persagy.proxy.adm.constant.GraphCodeEnum;
 import com.persagy.proxy.adm.constant.RelCodeEnum;
 import com.persagy.proxy.adm.request.AdmQueryCriteria;
 import com.persagy.proxy.adm.request.AdmResponse;
+import com.persagy.proxy.adm.service.IAdmRelationService;
 import com.persagy.proxy.adm.service.impl.AbstractAdmBaseServiceImpl;
 import com.persagy.proxy.adm.utils.AdmContextUtil;
 import com.persagy.proxy.adm.utils.AdmEntityTransferUtil;
+import com.persagy.proxy.calculation.service.AdmRelCalService;
 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.common.entity.ObjRelationDTO;
+import com.persagy.proxy.common.entity.RelationDTO;
 import com.persagy.proxy.dictionary.model.AdmDict;
 import com.persagy.proxy.dictionary.model.AdmObjectType;
 import com.persagy.proxy.dictionary.service.IAdmDictService;
@@ -57,6 +61,10 @@ public class AdmEquipmentServiceImpl extends AbstractAdmBaseServiceImpl<AdmEquip
     private ObjectMapper objectMapper;
     @Autowired
     private IAdmDictService dictService;
+    @Autowired
+    private AdmRelCalService admRelCalService;
+    @Autowired
+    private IAdmRelationService relationService;
 
     @Override
     public List<AdmEquipment> doInsertEuip(InstanceUrlParam context, Class<AdmEquipment> clazz, List<AdmEquipment> voList) {
@@ -68,24 +76,8 @@ public class AdmEquipmentServiceImpl extends AbstractAdmBaseServiceImpl<AdmEquip
 
     @Override
     public List<AdmEquipment> doUpdateEuip(InstanceUrlParam context, Class<AdmEquipment> clazz, List<AdmEquipment> voList) {
-        //TODO 处理关系标记
-        /*try {
-         *//** 处理关系标记 *//*
-            val listtype = ArrayList<String>()
-            listtype.add("pe2bd")
-            listtype.add("pe2fl")
-            listtype.add("pe2sh")
-            listtype.add("pe2sp")
-            for (type in listtype){
-                val entity = relationTypeProjectservice.select(SFilter.eq("projectId", Opt.projectId!!), SFilter.eq("relationType", type)).entity()
-                if (entity!=null){
-                    entity.computationalState = 2
-                    relationTypeProjectservice.update(entity)
-                }
-            }
-        } catch (e: Exception) {
-            e.printStackTrace()
-        }*/
+        // 处理关系标记
+        processRelationType(voList);
         Map<String, AdmEquipment> voMap = CollUtil.fieldValueMap(voList, BaseEntity.PROP_ID);
         //查询设备对应的资产 关系 Pe2Eq (1:N,一个资产关联多个设备,设备是最小单位 by:lvxianyun)
         DmpResult<List<ObjRelationDTO>> relationRes = queryRelation(context, voMap);
@@ -112,6 +104,70 @@ public class AdmEquipmentServiceImpl extends AbstractAdmBaseServiceImpl<AdmEquip
     }
 
     @Override
+    public List<AdmEquipment> doInsert(InstanceUrlParam context, Class<AdmEquipment> clazz, List<AdmEquipment> voList) {
+        processFloorRelations(context, voList, false);
+        return super.doInsert(context, clazz, voList);
+    }
+
+    @Override
+    public List<AdmEquipment> doUpdate(InstanceUrlParam context, Class<AdmEquipment> clazz, List<AdmEquipment> voList) {
+        processFloorRelations(context, voList, false);
+        return super.doUpdate(context, clazz, voList);
+    }
+
+    @Override
+    public void doDelete(InstanceUrlParam context, List<AdmEquipment> voList) {
+        processFloorRelations(context, voList, true);
+        super.doDelete(context, voList);
+    }
+
+    /**
+     * 同步设备相关的关系
+     * 先删除后新增
+     * @param context
+     * @param voList
+     */
+    private void processFloorRelations(InstanceUrlParam context, List<AdmEquipment> voList, boolean isDelete) {
+        if(CollUtil.isEmpty(voList)) {
+            return;
+        }
+        // 两个关系的graphCode一样
+        String graphCode = AdmRelationTypeEnum.EQ2BD.getGraphCode();
+        String buildingRelCode = AdmRelationTypeEnum.EQ2BD.getRelCode();
+        String floorRelCode = AdmRelationTypeEnum.EQ2FL.getRelCode();
+        // 删除设备相关关系的条件
+        QueryCriteria criteria = new QueryCriteria();
+        criteria.setCriteria(JsonNodeFactory.instance.objectNode());
+        criteria.getCriteria().put("graphCode", graphCode);
+        criteria.getCriteria().putArray("relCode").add(buildingRelCode).add(floorRelCode);
+        ArrayNode arrayNode = criteria.getCriteria().putArray("objFrom");
+        // 待新增关系
+        List<RelationDTO> relations = new ArrayList();
+        for(AdmEquipment vo:voList) {
+            // 加入删除关系
+            arrayNode.add(vo.getId());
+            // 如果建筑ID为空,不用增加关系
+            if(isDelete || StrUtil.isBlank(vo.getBuildingId())) {
+                continue;
+            }
+            // 增加BD关系
+            relations.add(RelationDTO.builder().graphCode(graphCode).relCode(buildingRelCode).objFrom(vo.getId()).objTo(vo.getBuildingId()).build());
+            if(StrUtil.isBlank(vo.getFloorId())) {
+                continue;
+            }
+            // 增加FL关系
+            relations.add(RelationDTO.builder().graphCode(graphCode).relCode(floorRelCode).objFrom(vo.getId()).objTo(vo.getFloorId()).build());
+        }
+        // 先删除旧关系
+        relationService.doDelete(context, criteria);
+        // 再创建新关系
+        if(CollUtil.isEmpty(relations)) {
+            return;
+        }
+        relationService.doSave(context, relations);
+    }
+
+    @Override
     public AdmResponse doQuery(InstanceUrlParam context, AdmQueryCriteria request, Class<AdmEquipment> clazz) {
         AdmResponse response = super.doQuery(context, request, clazz);
         // 系统需要补充分类名称属性
@@ -354,4 +410,14 @@ public class AdmEquipmentServiceImpl extends AbstractAdmBaseServiceImpl<AdmEquip
     public AdmResponse queryEquipClassCode(InstanceUrlParam context,AdmQueryCriteria request,Class<AdmEquipment> clazz){
         return queryObjectClassCode(context,request,clazz);
     }
+
+    @Override
+    public void processRelationType(List<AdmEquipment> vos) {
+        admRelCalService.calcRelation(AdmContextUtil.toDmpContext(),
+                CollUtil.newArrayList(
+                        AdmRelationTypeEnum.PE2BD,
+                        AdmRelationTypeEnum.PE2FL,
+                        AdmRelationTypeEnum.PE2SH,
+                        AdmRelationTypeEnum.PE2SP),null);
+    }
 }

+ 34 - 4
src/main/java/com/persagy/proxy/object/service/impl/AdmFloorServiceImpl.java

@@ -10,17 +10,18 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.persagy.dmp.basic.model.QueryCriteria;
 import com.persagy.dmp.common.helper.SpringHelper;
+import com.persagy.proxy.adm.constant.AdmRelationTypeEnum;
 import com.persagy.proxy.adm.constant.GraphCodeEnum;
 import com.persagy.proxy.adm.constant.RelCodeEnum;
+import com.persagy.proxy.adm.request.AdmQueryCriteria;
+import com.persagy.proxy.adm.request.AdmResponse;
 import com.persagy.proxy.adm.service.impl.AbstractAdmBaseServiceImpl;
 import com.persagy.proxy.adm.utils.AdmContextUtil;
+import com.persagy.proxy.calculation.service.AdmRelCalService;
 import com.persagy.proxy.common.entity.DmpResult;
+import com.persagy.proxy.common.entity.InstanceUrlParam;
 import com.persagy.proxy.object.model.AdmFloor;
-import com.persagy.proxy.adm.request.AdmQueryCriteria;
-import com.persagy.proxy.adm.request.AdmResponse;
-import com.persagy.proxy.object.model.AdmSpace;
 import com.persagy.proxy.object.service.IAdmFloorService;
-import com.persagy.proxy.common.entity.InstanceUrlParam;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -39,6 +40,8 @@ import java.util.Map;
 public class AdmFloorServiceImpl extends AbstractAdmBaseServiceImpl<AdmFloor> implements IAdmFloorService {
     @Autowired
     private ObjectMapper objectMapper;
+    @Autowired
+    private AdmRelCalService admRelCalService;
 
     public static final Boolean QUERY = true;
     public static final Boolean CREAT_UPDATE = false;
@@ -77,6 +80,33 @@ public class AdmFloorServiceImpl extends AbstractAdmBaseServiceImpl<AdmFloor> im
         ensureSpecialValues(context, admFloors, QUERY);
         return response;
     }
+
+    @Override
+    public void processRelationType(List<AdmFloor> vos) {
+        /**
+         isttype.add("sh2bd")
+         listtype.add("bd2sp")
+         listtype.add("fl2sp")
+         listtype.add("syeq2bd")
+         listtype.add("sy2fl")
+         listtype.add("eq2fl")
+         listtype.add("pe2bd")
+         listtype.add("pe2fl")
+         */
+        admRelCalService.calcRelation(AdmContextUtil.toDmpContext(),
+                CollUtil.newArrayList(
+                        AdmRelationTypeEnum.SH2BD,
+                        AdmRelationTypeEnum.BD2SP,
+                        AdmRelationTypeEnum.FL2SP,
+                        AdmRelationTypeEnum.SYEQ2BD,
+                        AdmRelationTypeEnum.SY2FL,
+                        AdmRelationTypeEnum.EQ2FL,
+                        AdmRelationTypeEnum.PE2BD,
+                        AdmRelationTypeEnum.PE2FL
+                ),
+                null);
+    }
+
     /***
      * Description: 子类重写,以便处理带buildingId
      * @param dmpRequest : 中台查询参数

+ 37 - 5
src/main/java/com/persagy/proxy/object/service/impl/AdmSpaceServiceImpl.java

@@ -22,6 +22,7 @@ import com.persagy.dmp.digital.client.DigitalObjectFacade;
 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.AdmRelationTypeEnum;
 import com.persagy.proxy.adm.constant.GraphCodeEnum;
 import com.persagy.proxy.adm.constant.RelCodeEnum;
 import com.persagy.proxy.adm.request.AdmDCSQueryRequest;
@@ -32,16 +33,14 @@ import com.persagy.proxy.adm.service.impl.AbstractAdmBaseServiceImpl;
 import com.persagy.proxy.adm.utils.AdmContextUtil;
 import com.persagy.proxy.adm.utils.AdmEntityTransferUtil;
 import com.persagy.proxy.adm.utils.AdmQueryCriteriaHelper;
+import com.persagy.proxy.calculation.service.AdmRelCalService;
 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.common.entity.RelationDTO;
-import com.persagy.proxy.dictionary.model.AdmDict;
-import com.persagy.proxy.dictionary.model.AdmObjectType;
 import com.persagy.proxy.object.model.AdmEquipment;
 import com.persagy.proxy.object.model.AdmSpace;
 import com.persagy.proxy.object.model.AdmSystem;
-import com.persagy.proxy.object.model.AdmSystemCategory;
 import com.persagy.proxy.object.service.IAdmEquipmentService;
 import com.persagy.proxy.object.service.IAdmSpaceService;
 import com.persagy.proxy.object.service.IAdmSystemService;
@@ -75,6 +74,8 @@ public class AdmSpaceServiceImpl extends AbstractAdmBaseServiceImpl<AdmSpace> im
     private IAdmSystemService systemService;
     @Autowired
     private IRelationReportService relationReportService;
+    @Autowired
+    private AdmRelCalService admRelCalService;
 
     @Override
     public AdmResponse doQuery(InstanceUrlParam context, AdmQueryCriteria request, Class<AdmSpace> clazz) {
@@ -101,8 +102,7 @@ public class AdmSpaceServiceImpl extends AbstractAdmBaseServiceImpl<AdmSpace> im
         //添加绑定关系
         processRelations(vosR);
         //处理关系标记
-        //TODO 处理关系标记
-        //processRelationType();
+        processRelationType(vosR);
         return vosR;
     }
 
@@ -329,6 +329,38 @@ public class AdmSpaceServiceImpl extends AbstractAdmBaseServiceImpl<AdmSpace> im
         return response;
     }
 
+    /**
+     * 更新轮廓线
+     * @param vos
+     * @return
+     */
+    @Override
+    public AdmResponse updateOutLine(List<AdmSpace> vos) {
+        InstanceUrlParam context = AdmContextUtil.toDmpContext();
+        vos = super.doUpdate(context,  AdmSpace.class, vos);
+        processRelationType(vos);
+        return AdmResponse.success(vos);
+    }
+
+    /**
+     * 触发关系计算
+     * @param vos
+     */
+    @Override
+    public void processRelationType(List<AdmSpace> vos) {
+        admRelCalService.calcRelation(AdmContextUtil.toDmpContext(),
+                CollUtil.newArrayList(
+                        AdmRelationTypeEnum.SP2SP_SPACENEIGHBORHOOD_5,
+                        AdmRelationTypeEnum.SP2SP_TRAFFICNETWORK_3,
+                        AdmRelationTypeEnum.SP2SP_CONVECTIONNETWORK_1,
+                        AdmRelationTypeEnum.SP2SP_RADIATIONNETWORK_1),null);
+
+        vos.forEach(admSpace -> {
+            admRelCalService.calcRelation(AdmContextUtil.toDmpContext(),
+                    CollUtil.newArrayList(AdmRelationTypeEnum.EQ2SP_IN),admSpace.getClassCode());
+        });
+    }
+
     /***
      * Description: 根据查询条件查询空间统计数据,定制接口,后续可优化口
      * @param request : 请求参数

+ 61 - 0
src/main/java/com/persagy/proxy/report/model/EquipmentPointExcel.java

@@ -0,0 +1,61 @@
+package com.persagy.proxy.report.model;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
+import com.alibaba.excel.annotation.write.style.HeadFontStyle;
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.poi.ss.usermodel.Font;
+
+/**
+ * @author lvxianyun
+ * @title: EquipmentPointExcel
+ * @projectName adm-middleware
+ * @description: 导出设备的静态或动态信息点
+ * @date 2021/11/23 18:27
+ */
+@Getter
+@Setter
+@HeadFontStyle(color = Font.COLOR_NORMAL)
+public class EquipmentPointExcel {
+
+    @ColumnWidth(50)
+    @ExcelProperty(value = "设备id", index=0)
+    private String id;
+
+    @ColumnWidth(20)
+    @ExcelProperty(value = "本地编码", index=1)
+    private String localId;
+
+    @ColumnWidth(20)
+    @ExcelProperty(value = "本地名称", index=2)
+    private String localName;
+
+    @ColumnWidth(20)
+    @ExcelProperty(value = "设备类型编码", index=3)
+    private String classCode;
+
+    @ColumnWidth(20)
+    @ExcelProperty(value = "设备类型名称", index=4)
+    private String classCodeName;
+
+    @ColumnWidth(20)
+    @ExcelProperty(value = "一级标签", index=5)
+    private String mapInputFirstName;
+
+    @ColumnWidth(20)
+    @ExcelProperty(value = "信息点名", index=6)
+    private String infoName;
+
+    @ColumnWidth(25)
+    @ExcelProperty(value = "信息点编码", index=7)
+    private String infoCode;
+
+    @ColumnWidth(25)
+    @ExcelProperty(value = "输入类型", index=8)
+    private String inputType;
+
+    @ColumnWidth(25)
+    @ExcelProperty(value = "已交付值", index=9)
+    private String inputValue;
+}

+ 61 - 0
src/main/java/com/persagy/proxy/report/model/SystemPointExcel.java

@@ -0,0 +1,61 @@
+package com.persagy.proxy.report.model;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
+import com.alibaba.excel.annotation.write.style.HeadFontStyle;
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.poi.ss.usermodel.Font;
+
+/**
+ * @author lvxianyun
+ * @title: SystemPointExcel
+ * @projectName adm-middleware
+ * @description: 导出设备的静态或动态信息点
+ * @date 2021/11/23 18:27
+ */
+@Getter
+@Setter
+@HeadFontStyle(color = Font.COLOR_NORMAL)
+public class SystemPointExcel {
+
+    @ColumnWidth(50)
+    @ExcelProperty(value = "系统id", index=0)
+    private String id;
+
+    @ColumnWidth(20)
+    @ExcelProperty(value = "本地编码", index=1)
+    private String localId;
+
+    @ColumnWidth(20)
+    @ExcelProperty(value = "本地名称", index=2)
+    private String localName;
+
+    @ColumnWidth(20)
+    @ExcelProperty(value = "类型编码", index=3)
+    private String classCode;
+
+    @ColumnWidth(20)
+    @ExcelProperty(value = "类型名称", index=4)
+    private String classCodeName;
+
+    @ColumnWidth(20)
+    @ExcelProperty(value = "一级标签", index=5)
+    private String mapInputFirstName;
+
+    @ColumnWidth(20)
+    @ExcelProperty(value = "信息点名", index=6)
+    private String infoName;
+
+    @ColumnWidth(25)
+    @ExcelProperty(value = "信息点编码", index=7)
+    private String infoCode;
+
+    @ColumnWidth(25)
+    @ExcelProperty(value = "输入类型", index=8)
+    private String inputType;
+
+    @ColumnWidth(25)
+    @ExcelProperty(value = "已交付值", index=9)
+    private String inputValue;
+}