|
@@ -6,7 +6,6 @@ import java.util.Collections;
|
|
|
import java.util.Comparator;
|
|
|
import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
-import java.util.HashSet;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Set;
|
|
@@ -28,25 +27,18 @@ import com.persagy.dmp.basic.model.QueryCriteria;
|
|
|
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.define.client.DigitalDefineFacade;
|
|
|
import com.persagy.dmp.define.client.DigitalGraphDefineFacade;
|
|
|
import com.persagy.dmp.define.client.DigitalRelationDefineFacade;
|
|
|
import com.persagy.dmp.define.entity.GraphDefine;
|
|
|
-import com.persagy.dmp.define.entity.ObjectTypeDefine;
|
|
|
import com.persagy.dmp.define.entity.RelationDefine;
|
|
|
import com.persagy.dmp.digital.client.DigitalObjectFacade;
|
|
|
import com.persagy.dmp.digital.client.DigitalRelationFacade;
|
|
|
import com.persagy.dmp.digital.client.DigitalRelationProjectCalFacade;
|
|
|
-import com.persagy.dmp.digital.entity.ObjectDigital;
|
|
|
import com.persagy.dmp.digital.entity.ObjectRelation;
|
|
|
import com.persagy.dmp.digital.entity.ObjectRelationProjectCal;
|
|
|
import com.persagy.dmp.simple.client.DigitalObjectSimpleFacade;
|
|
|
import com.persagy.proxy.adm.constant.AdmCommonConstant;
|
|
|
-import com.persagy.proxy.adm.constant.AdmObjectType;
|
|
|
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.model.EquipmentExcel;
|
|
|
import com.persagy.proxy.adm.service.IRelationReportService;
|
|
|
import com.persagy.proxy.adm.strategy.relationdata.RelationObjectStrategy;
|
|
|
|
|
@@ -336,46 +328,6 @@ public class RelationReportService implements IRelationReportService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<EquipmentExcel> findEquipByNotSpace(String groupCode, String projectId) {
|
|
|
- groupCode = StrUtil.isBlank(groupCode) ? defaultCode : groupCode;
|
|
|
- // 1.获取所有的设备对象数据
|
|
|
- ObjectMapper objectMapper = SpringHelper.getBean(ObjectMapper.class);
|
|
|
- QueryCriteria objectCriteria = new QueryCriteria();
|
|
|
- ObjectNode object = objectMapper.createObjectNode();
|
|
|
- object.put("objType", AdmObjectType.EQUIPMENT.getIndex());
|
|
|
- objectCriteria.setCriteria(object);
|
|
|
- List<ObjectNode> equipList = DigitalObjectFacade.query(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, objectCriteria);
|
|
|
- if (CollectionUtil.isEmpty(equipList)) {
|
|
|
- return Lists.newArrayList();
|
|
|
- }
|
|
|
-
|
|
|
- // 2.获取所有的设备类定义的className
|
|
|
- List<ObjectTypeDefine> classList = DigitalDefineFacade.queryObjectType(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, objectCriteria);
|
|
|
- // key-classCode, value-className
|
|
|
- Map<String, String> classDefine = new HashMap<String, String>();
|
|
|
- if (CollectionUtil.isNotEmpty(classList)) {
|
|
|
- for (ObjectTypeDefine objectTypeDefine : classList) {
|
|
|
- classDefine.put(objectTypeDefine.getCode(), objectTypeDefine.getName());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 3.查询出所有的边类型为 Eq2Sp 的关系数据
|
|
|
- QueryCriteria relationCriteria = new QueryCriteria();
|
|
|
- ObjectNode relation = objectMapper.createObjectNode();
|
|
|
- relation.put("relCode", RelCodeEnum.Eq2Sp.name());
|
|
|
- relationCriteria.setCriteria(relation);
|
|
|
- List<ObjectRelation> relationList = DigitalRelationFacade.query(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, relationCriteria);
|
|
|
- Set<String> equipIds = new HashSet<String>();
|
|
|
- if (CollectionUtil.isNotEmpty(relationList)) {
|
|
|
- for (ObjectRelation relationInfo : relationList) {
|
|
|
- equipIds.add(relationInfo.getObjFrom());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return this.exportEquipmentExcel(equipList, classDefine, equipIds, groupCode, projectId);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
public boolean createRelationProjectCal(String groupCode, String projectId) throws JsonProcessingException {
|
|
|
groupCode = StrUtil.isBlank(groupCode) ? defaultCode : groupCode;
|
|
|
// 1.验证是否已经添加过
|
|
@@ -418,6 +370,7 @@ public class RelationReportService implements IRelationReportService {
|
|
|
AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, nodes);
|
|
|
return CollectionUtil.isNotEmpty(result);
|
|
|
}
|
|
|
+
|
|
|
/***
|
|
|
* Description: 创建存储的对象
|
|
|
* @param groupCode : 集团编码
|
|
@@ -453,10 +406,6 @@ public class RelationReportService implements IRelationReportService {
|
|
|
return objectNode;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 查询关系总览(空表,先插入)
|
|
|
- * @param content: 模糊查询卡片名称关键字
|
|
|
- */
|
|
|
@Override
|
|
|
public JSONObject overview(String content) throws JsonProcessingException {
|
|
|
JSONObject result = new JSONObject();
|
|
@@ -689,78 +638,4 @@ public class RelationReportService implements IRelationReportService {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 构造 excel 设备数据
|
|
|
- *
|
|
|
- * @param equipList 设备数据集合
|
|
|
- * @param classDefine 类定义信息
|
|
|
- * @param equipIds 需要剔除的设备ID集合
|
|
|
- * @param groupCode
|
|
|
- * @param projectId
|
|
|
- * @return
|
|
|
- */
|
|
|
- private List<EquipmentExcel> exportEquipmentExcel(List<ObjectNode> equipList, Map<String, String> classDefine, Set<String> equipIds, String groupCode, String projectId) {
|
|
|
- // key: 设备ID,value: 建筑名称
|
|
|
- Map<String, String> buildTemp = new HashMap<String, String>();
|
|
|
- // key: 设备ID,value: 楼层名称
|
|
|
- Map<String, String> floorTemp = new HashMap<String, String>();
|
|
|
-
|
|
|
- // 建筑名称
|
|
|
- RequestData requestData = new RequestData();
|
|
|
- requestData.setGraphCode(GraphCodeEnum.MechInArch.name());
|
|
|
- requestData.setRelCode(RelCodeEnum.Eq2Bd.name());
|
|
|
- requestData.setPage(1L);
|
|
|
- requestData.setSize(10000000L);
|
|
|
- List<ObjectDigital> buildDigitals = DigitalObjectFacade.queryObjectListByGraphCodeAndRelCode(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, requestData);
|
|
|
- if (CollectionUtil.isNotEmpty(buildDigitals)) {
|
|
|
- for (ObjectDigital master : buildDigitals) {
|
|
|
- List<ObjectDigital> slaveDigitals = master.getRelObjs();
|
|
|
- ObjectDigital slave = CollectionUtil.isEmpty(slaveDigitals) ? null : slaveDigitals.get(0);
|
|
|
- if (slave != null) {
|
|
|
- buildTemp.put(master.getId(), slave.getLocalName());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- // 楼层名称
|
|
|
- requestData.setRelCode(RelCodeEnum.Eq2Fl.name());
|
|
|
- List<ObjectDigital> floorDigitals = DigitalObjectFacade.queryObjectListByGraphCodeAndRelCode(groupCode, projectId, AdmCommonConstant.APP_ID, AdmCommonConstant.USER_ID, requestData);
|
|
|
- if (CollectionUtil.isNotEmpty(floorDigitals)) {
|
|
|
- for (ObjectDigital master : floorDigitals) {
|
|
|
- List<ObjectDigital> slaveDigitals = master.getRelObjs();
|
|
|
- ObjectDigital slave = CollectionUtil.isEmpty(slaveDigitals) ? null : slaveDigitals.get(0);
|
|
|
- if (slave != null) {
|
|
|
- floorTemp.put(master.getId(), slave.getLocalName());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 结果封装
|
|
|
- List<EquipmentExcel> excelList = new ArrayList<EquipmentExcel>();
|
|
|
- for (ObjectNode equip : equipList) {
|
|
|
- String id = equip.get("id") == null ? null : equip.get("id").asText();
|
|
|
- if (id != null && !equipIds.contains(id)) {
|
|
|
- EquipmentExcel excel = new EquipmentExcel();
|
|
|
- excel.setId(id);
|
|
|
- excel.setName(equip.get("name") == null ? null : equip.get("name").asText());
|
|
|
- excel.setLocalId(equip.get("localId") == null ? null : equip.get("localId").asText());
|
|
|
- excel.setLocalName(equip.get("localName") == null ? null : equip.get("localName").asText());
|
|
|
-
|
|
|
- String infos = equip.get("infos") == null ? null : equip.get("infos").asText();
|
|
|
- if (StrUtil.isNotBlank(infos)) {
|
|
|
- JSONObject parseObject = JSONObject.parseObject(infos);
|
|
|
- excel.setBimId(parseObject.getString("bimId"));
|
|
|
- }
|
|
|
-
|
|
|
- String classCode = equip.get("classCode") == null ? null : equip.get("classCode").asText();
|
|
|
- excel.setClassCodeName(classCode == null ? null : classDefine.get(classCode));
|
|
|
-
|
|
|
- excel.setBuildName(buildTemp.get(id));
|
|
|
- excel.setFloorName(floorTemp.get(id));
|
|
|
- excel.setModelFileName("T1F10模型文件v18.rvt"); // 这里写死是不对的,需要后续再补充改变
|
|
|
- excelList.add(excel);
|
|
|
- }
|
|
|
- }
|
|
|
- return excelList;
|
|
|
- }
|
|
|
-
|
|
|
}
|