|
@@ -23,6 +23,7 @@ import com.persagy.proxy.adm.constant.AdmObjectType;
|
|
|
import com.persagy.proxy.adm.constant.GraphCodeEnum;
|
|
|
import com.persagy.proxy.adm.constant.RelCodeEnum;
|
|
|
import com.persagy.proxy.adm.model.EquipmentBindPointExcel;
|
|
|
+import com.persagy.proxy.adm.model.EquipmentCountExcel;
|
|
|
import com.persagy.proxy.adm.model.EquipmentExcel;
|
|
|
import com.persagy.proxy.adm.service.IRelationReportService;
|
|
|
import com.persagy.proxy.adm.strategy.RelationObjectContext;
|
|
@@ -66,8 +67,8 @@ public class RelationReportHandler {
|
|
|
}
|
|
|
|
|
|
// 2.获取所有的设备类定义的className
|
|
|
- List<ObjectTypeDefine> classList = this.relationReportService.queryClassList(groupCode, projectId, null, equipment, null);
|
|
|
- // key-classCode, value-className
|
|
|
+ List<ObjectTypeDefine> classList = this.relationReportService.queryClassList(groupCode, projectId, null, Sets.newHashSet(equipment), null);
|
|
|
+ /** key-classCode, value-className */
|
|
|
Map<String, String> classDefine = new HashMap<String, String>();
|
|
|
for (ObjectTypeDefine objectTypeDefine : classList) {
|
|
|
classDefine.put(objectTypeDefine.getCode(), objectTypeDefine.getName());
|
|
@@ -109,17 +110,17 @@ public class RelationReportHandler {
|
|
|
}
|
|
|
|
|
|
// 3.获取所有的设备、系统类定义信息
|
|
|
- List<ObjectTypeDefine> equipClass = this.relationReportService.queryClassList(groupCode, projectId, null, equipment, null);
|
|
|
- List<ObjectTypeDefine> systemClass = this.relationReportService.queryClassList(groupCode, projectId, null, AdmObjectType.SYSTEM.getIndex(), null);
|
|
|
- // key-equipCode, value-equipName
|
|
|
+ List<ObjectTypeDefine> classInfo = this.relationReportService.queryClassList(groupCode, projectId, null, Sets.newHashSet(equipment, AdmObjectType.SYSTEM.getIndex()), null);
|
|
|
+ /** key-equipCode, value-equipName */
|
|
|
Map<String, String> equipTemp = new HashMap<String, String>();
|
|
|
- for (ObjectTypeDefine equip : equipClass) {
|
|
|
- equipTemp.put(equip.getCode(), equip.getName());
|
|
|
- }
|
|
|
- // key-systemCode, value-systemName
|
|
|
+ /** key-systemCode, value-systemName */
|
|
|
Map<String, String> systemTemp = new HashMap<String, String>();
|
|
|
- for (ObjectTypeDefine system : systemClass) {
|
|
|
- systemTemp.put(system.getCode(), system.getName());
|
|
|
+ for (ObjectTypeDefine info : classInfo) {
|
|
|
+ if (info.getCode().length() > 5) {
|
|
|
+ equipTemp.put(info.getCode(), info.getName());
|
|
|
+ } else {
|
|
|
+ systemTemp.put(info.getCode(), info.getName());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 4.获取所有的信息点
|
|
@@ -129,6 +130,51 @@ public class RelationReportHandler {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 下载报告-统计项目下已有的设备,以及静态和iot 信息点使用情况,以classCode为维度
|
|
|
+ *
|
|
|
+ * @param groupCode
|
|
|
+ * @param projectId
|
|
|
+ */
|
|
|
+ public List<EquipmentCountExcel> countClassCodeEquip(String groupCode, String projectId) {
|
|
|
+ groupCode = StrUtil.isBlank(groupCode) ? defaultCode : groupCode;
|
|
|
+ String equipment = AdmObjectType.EQUIPMENT.getIndex();
|
|
|
+
|
|
|
+ // 1.获取项目名称
|
|
|
+ List<ObjectNode> projects = this.relationReportService.queryObjects(groupCode, projectId, projectId, AdmObjectType.PROJECT.getIndex(), null, null);
|
|
|
+ if (CollectionUtil.isEmpty(projects)) {
|
|
|
+ return Lists.newArrayList();
|
|
|
+ }
|
|
|
+ String projectName = projects.get(0).has("localName") ? projects.get(0).get("localName").asText() : null;
|
|
|
+
|
|
|
+ // 2.获取所有的设备对象数据
|
|
|
+ List<ObjectNode> equipList = this.relationReportService.queryObjects(groupCode, projectId, null, null, equipment, "classCode");
|
|
|
+ if (CollectionUtil.isEmpty(equipList)) {
|
|
|
+ return Lists.newArrayList();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 3.获取所有的设备、系统类定义信息
|
|
|
+ List<ObjectTypeDefine> classInfo = this.relationReportService.queryClassList(groupCode, projectId, null, Sets.newHashSet(equipment, AdmObjectType.SYSTEM.getIndex()), null);
|
|
|
+ /** key-equipCode, value-equipName */
|
|
|
+ Map<String, String> equipTemp = new HashMap<String, String>();
|
|
|
+ /** key-systemCode, value-systemName */
|
|
|
+ Map<String, String> systemTemp = new HashMap<String, String>();
|
|
|
+ for (ObjectTypeDefine info : classInfo) {
|
|
|
+ if (info.getCode().length() > 5) {
|
|
|
+ equipTemp.put(info.getCode(), info.getName());
|
|
|
+ } else {
|
|
|
+ systemTemp.put(info.getCode(), info.getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 4.获取所有的信息点
|
|
|
+ Set<String> equipCodes = equipTemp.keySet();
|
|
|
+ List<ObjectInfoDefine> funidList = this.relationReportService.queryFunidList(groupCode, projectId, equipCodes, null, null);
|
|
|
+
|
|
|
+ // 5.导出结果汇总返回
|
|
|
+ return this.exportClassEquipExcel(equipList, equipTemp, systemTemp, funidList, groupCode, projectId, projectName);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 构造 excel 设备数据--不在空间内的设备数据
|
|
|
*
|
|
|
* @param equipList 设备数据集合
|
|
@@ -139,12 +185,13 @@ public class RelationReportHandler {
|
|
|
* @return
|
|
|
*/
|
|
|
private List<EquipmentExcel> exportEquipmentExcel(List<ObjectNode> equipList, Map<String, String> classDefine, Set<String> excludeIds, 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>();
|
|
|
+ /** key: 设备ID,value: 楼层名称 */
|
|
|
+ Map<String, String> floorNameTemp = new HashMap<String, String>();
|
|
|
+ this.findFloorName(floorNameTemp, groupCode, projectId);
|
|
|
|
|
|
- this.findBuildAndFloorName(buildTemp, floorTemp, groupCode, projectId);
|
|
|
+ /** key: 设备ID,value: 建筑名称 */
|
|
|
+ Map<String, String> buildNameTemp = new HashMap<String, String>();
|
|
|
+ this.findBuildingName(buildNameTemp, groupCode, projectId);
|
|
|
|
|
|
// 结果封装
|
|
|
List<EquipmentExcel> excelList = new ArrayList<EquipmentExcel>();
|
|
@@ -166,8 +213,8 @@ public class RelationReportHandler {
|
|
|
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.setBuildName(buildNameTemp.get(id));
|
|
|
+ excel.setFloorName(floorNameTemp.get(id));
|
|
|
excel.setModelFileName("T1F10模型文件v18.rvt"); // 这里写死是不对的,需要后续再补充改变
|
|
|
excelList.add(excel);
|
|
|
}
|
|
@@ -188,21 +235,22 @@ public class RelationReportHandler {
|
|
|
*/
|
|
|
private List<EquipmentBindPointExcel> exportEquipmentBindPointExcel(List<ObjectNode> equipList, Map<String, String> equipTemp,
|
|
|
Map<String, String> systemTemp, List<ObjectInfoDefine> funidList, String groupCode, String projectId, String projectName) {
|
|
|
- // key: 设备ID,value: 建筑名称
|
|
|
- Map<String, String> buildTemp = new HashMap<String, String>();
|
|
|
- // key: 设备ID,value: 楼层名称
|
|
|
- Map<String, String> floorTemp = new HashMap<String, String>();
|
|
|
+ /** key: 设备ID,value: 楼层名称 */
|
|
|
+ Map<String, String> floorNameTemp = new HashMap<String, String>();
|
|
|
+ this.findFloorName(floorNameTemp, groupCode, projectId);
|
|
|
|
|
|
- this.findBuildAndFloorName(buildTemp, floorTemp, groupCode, projectId);
|
|
|
+ /** key: 设备ID,value: 建筑名称 */
|
|
|
+ Map<String, String> buildNameTemp = new HashMap<String, String>();
|
|
|
+ this.findBuildingName(buildNameTemp, groupCode, projectId);
|
|
|
|
|
|
// 信息点分类信息统计
|
|
|
- // key: classCode, value: 信息点
|
|
|
+ /** key: classCode, value: 信息点 */
|
|
|
Map<String, Set<String>> infoCodes = new HashMap<String, Set<String>>();
|
|
|
- // key: classCode, value: 静态信息点的数量
|
|
|
+ /** key: classCode, value: 静态信息点的数量 */
|
|
|
Map<String, Integer> staticCount = new HashMap<String, Integer>();
|
|
|
- // key: classCode, value: 动态信息点的数量
|
|
|
+ /** key: classCode, value: 动态信息点的数量 */
|
|
|
Map<String, Integer> dynamicCount = new HashMap<String, Integer>();
|
|
|
- // key: classCode_infoCode, value: 动静态
|
|
|
+ /** key: classCode_infoCode, value: 动静态 */
|
|
|
Map<String, String> codeAttrbut = new HashMap<String, String>();
|
|
|
for (ObjectInfoDefine infoDefine : funidList) {
|
|
|
String classCode = infoDefine.getClassCode();
|
|
@@ -234,8 +282,8 @@ public class RelationReportHandler {
|
|
|
EquipmentBindPointExcel excel = new EquipmentBindPointExcel();
|
|
|
excel.setIndex(i + 1);
|
|
|
excel.setProjectName(projectName);
|
|
|
- excel.setBuildName(buildTemp.get(id));
|
|
|
- excel.setFloorName(floorTemp.get(id));
|
|
|
+ excel.setBuildName(buildNameTemp.get(id));
|
|
|
+ excel.setFloorName(floorNameTemp.get(id));
|
|
|
excel.setSystemCode(systemCode);
|
|
|
excel.setSystemName(systemTemp.get(systemCode));
|
|
|
excel.setEquipCode(equipCode);
|
|
@@ -245,14 +293,16 @@ public class RelationReportHandler {
|
|
|
excel.setLocalName(equip.get("localName") == null ? null : equip.get("localName").asText());
|
|
|
|
|
|
// 获取此classCode下有多少信息点、静态信息点、动态信息点
|
|
|
- int staticNum = staticCount.get(equipCode) == null ? 0 : staticCount.get(equipCode);
|
|
|
+
|
|
|
+ // 静态的默认存在4个已绑信息点,ID、name、localId、localName
|
|
|
+ int nowStatic = 4;
|
|
|
+ int nowDynamic = 0;
|
|
|
+ int staticNum = staticCount.get(equipCode) == null ? nowStatic : staticCount.get(equipCode);
|
|
|
int dynamicNum = dynamicCount.get(equipCode) == null ? 0 : dynamicCount.get(equipCode);
|
|
|
- excel.setNeedPointCount(staticNum + dynamicNum);
|
|
|
+ excel.setNeedBindPointCount(staticNum + dynamicNum);
|
|
|
excel.setNeedStaticPointCount(staticNum);
|
|
|
excel.setNeedDynamicPointCount(dynamicNum);
|
|
|
|
|
|
- int nowStatic = 0;
|
|
|
- int nowDynamic = 0;
|
|
|
Set<String> needCodes = infoCodes.get(equipCode);
|
|
|
String infos = equip.get("infos") == null ? null : equip.get("infos").asText();
|
|
|
if (StrUtil.isNotBlank(infos)) {
|
|
@@ -271,7 +321,7 @@ public class RelationReportHandler {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- excel.setNowPointCount(nowStatic + nowDynamic);
|
|
|
+ excel.setNowBindPointCount(nowStatic + nowDynamic);
|
|
|
excel.setNowStaticPointCount(nowStatic);
|
|
|
excel.setNowDynamicPointCount(nowDynamic);
|
|
|
excelList.add(excel);
|
|
@@ -280,14 +330,211 @@ public class RelationReportHandler {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 获取建筑、楼层的名称
|
|
|
+ * 大概率不对,后续观察
|
|
|
*
|
|
|
- * @param buildTemp key: 设备ID,value: 建筑名称
|
|
|
- * @param floorTemp key: 设备ID,value: 楼层名称
|
|
|
+ * @param equipList
|
|
|
+ * @param equipTemp
|
|
|
+ * @param systemTemp
|
|
|
+ * @param funidList
|
|
|
* @param groupCode
|
|
|
* @param projectId
|
|
|
+ * @param projectName
|
|
|
+ * @return
|
|
|
*/
|
|
|
- private void findBuildAndFloorName(Map<String, String> buildTemp, Map<String, String> floorTemp, String groupCode, String projectId) {
|
|
|
+ private List<EquipmentCountExcel> exportClassEquipExcel(List<ObjectNode> equipList, Map<String, String> equipTemp,
|
|
|
+ Map<String, String> systemTemp, List<ObjectInfoDefine> funidList, String groupCode, String projectId, String projectName) {
|
|
|
+
|
|
|
+ /** key: classCode, value: 信息点 */
|
|
|
+ Map<String, Set<String>> infoCodes = new HashMap<String, Set<String>>();
|
|
|
+ /** key: classCode, value: 静态信息点的数量 */
|
|
|
+ Map<String, Integer> staticCount = new HashMap<String, Integer>();
|
|
|
+ /** key: classCode, value: 动态信息点的数量 */
|
|
|
+ Map<String, Integer> dynamicCount = new HashMap<String, Integer>();
|
|
|
+ /** key: classCode_infoCode, value: 动静态 */
|
|
|
+ Map<String, String> codeAttrbut = new HashMap<String, String>();
|
|
|
+ // 信息点数据汇总
|
|
|
+ for (ObjectInfoDefine infoDefine : funidList) {
|
|
|
+ String classCode = infoDefine.getClassCode();
|
|
|
+ String category = infoDefine.getCategory();
|
|
|
+ if ("STATIC".equals(category)) {
|
|
|
+ int count = (staticCount.get(classCode) == null ? 0 : staticCount.get(classCode)) + 1;
|
|
|
+ staticCount.put(classCode, count);
|
|
|
+ } else {
|
|
|
+ int count = (dynamicCount.get(classCode) == null ? 0 : dynamicCount.get(classCode)) + 1;
|
|
|
+ dynamicCount.put(classCode, count);
|
|
|
+ }
|
|
|
+
|
|
|
+ codeAttrbut.put(classCode + AdmCommonConstant.UNDERLINE + infoDefine.getCode(), category);
|
|
|
+ if (infoCodes.containsKey(classCode)) {
|
|
|
+ infoCodes.get(classCode).add(infoDefine.getCode());
|
|
|
+ } else {
|
|
|
+ infoCodes.put(classCode, Sets.newHashSet(infoDefine.getCode()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ funidList.clear(); //即时清空
|
|
|
+
|
|
|
+ /** key: 设备ID,value: 建筑Id */
|
|
|
+ Map<String, String> equipId2BuildId = new HashMap<String, String>();
|
|
|
+ /** key: 建筑ID,value: 建筑名称 */
|
|
|
+ Map<String, String> buildNameTemp = new HashMap<String, String>();
|
|
|
+ String graphAndRelKey = GraphCodeEnum.MechInArch.name() + AdmCommonConstant.UNDERLINE + RelCodeEnum.Eq2Bd.name();
|
|
|
+ List<ObjectDigital> buildDigitals = this.relationObjectContext.queryAllRelations(groupCode, projectId, graphAndRelKey);
|
|
|
+ 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) {
|
|
|
+ equipId2BuildId.put(master.getId(), slave.getId());
|
|
|
+ buildNameTemp.put(slave.getId(), slave.getLocalName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ buildDigitals.clear(); // 即时清空
|
|
|
+
|
|
|
+ /** key: classCode, value: 当BIMID不为空时,建筑ID不为空时,值+1 */
|
|
|
+ Map<String, Integer> equipBimIdByBuild = new HashMap<String, Integer>();
|
|
|
+ /** key: classCode, value: 当BIMID不为空时,建筑ID为空时,值+1 */
|
|
|
+ Map<String, Integer> equipBimIdByBuildNull = new HashMap<String, Integer>();
|
|
|
+ /** key: classCode, value: 当BIMID为空时,建筑ID不为空时,值+1 */
|
|
|
+ Map<String, Integer> equipBimIdNullByBuild = new HashMap<String, Integer>();
|
|
|
+ /** key: classCode, value: 当BIMID为空时,建筑ID为空时,值+1 */
|
|
|
+ Map<String, Integer> equipBimIdNullByBuildNull = new HashMap<String, Integer>();
|
|
|
+
|
|
|
+ /** key: classCode, value: 已绑定的静态信息点数量 */
|
|
|
+ Map<String, Integer> equipStaticInfoTemp = new HashMap<String, Integer>();
|
|
|
+ /** key: classCode, value: 已绑定的动态信息点数量 */
|
|
|
+ Map<String, Integer> equipDynamicInfoTemp = new HashMap<String, Integer>();
|
|
|
+
|
|
|
+ /** key: classCode, value: 建筑ID */
|
|
|
+ Map<String, String> classBuildId = new HashMap<String, String>();
|
|
|
+ /** key: classCode_建筑ID, value: infos字段包含信息点的设备数量 */
|
|
|
+ Map<String, Integer> classInfosByBuild = new HashMap<String, Integer>();
|
|
|
+ /** key: classCode, value: infos字段包含信息点且建筑ID为空的设备数量 */
|
|
|
+ Map<String, Integer> classInfosNotBuild = new HashMap<String, Integer>();
|
|
|
+ /** key: classCode, value: 存在建筑的设备数量 */
|
|
|
+ Map<String, Integer> classByBuild = new HashMap<String, Integer>();
|
|
|
+ /** key: classCode, value: 不存在建筑的设备数量 */
|
|
|
+ Map<String, Integer> classNotBuild = new HashMap<String, Integer>();
|
|
|
+ // 总结出如上map所需数据
|
|
|
+ for (int i = 0; i < equipList.size(); i++) {
|
|
|
+ ObjectNode equip = equipList.get(i);
|
|
|
+ String id = equip.get("id") == null ? null : equip.get("id").asText();
|
|
|
+ String classCode = equip.get("classCode") == null ? null : equip.get("classCode").asText();
|
|
|
+ String buildingId = equipId2BuildId.get(id); // 获取建筑ID
|
|
|
+ if (StrUtil.isBlank(buildingId)) {
|
|
|
+ classNotBuild.put(classCode, (classNotBuild.get(classCode) == null ? 0 : (classNotBuild.get(classCode) + 1)));
|
|
|
+ } else {
|
|
|
+ classByBuild.put(classCode, (classByBuild.get(classCode) == null ? 0 : (classByBuild.get(classCode) + 1)));
|
|
|
+ classBuildId.put(classCode, buildingId);
|
|
|
+ }
|
|
|
+
|
|
|
+ int nowStatic = 0;
|
|
|
+ int nowDynamic = 0;
|
|
|
+ Set<String> needCodes = infoCodes.get(classCode);
|
|
|
+ String infos = equip.get("infos") == null ? null : equip.get("infos").asText();
|
|
|
+ if (StrUtil.isNotBlank(infos)) {
|
|
|
+ JSONObject parseObject = JSONObject.parseObject(infos);
|
|
|
+ String bimId = parseObject.getString("bimId");
|
|
|
+ if (StrUtil.isBlank(bimId)) {
|
|
|
+ if (StrUtil.isBlank(buildingId)) {
|
|
|
+ equipBimIdNullByBuildNull.put(id, (equipBimIdNullByBuildNull.get(id) == null ? 1 : (equipBimIdNullByBuildNull.get(id) + 1)));
|
|
|
+ } else {
|
|
|
+ equipBimIdNullByBuild.put(id, (equipBimIdNullByBuild.get(id) == null ? 1 : (equipBimIdNullByBuild.get(id) + 1)));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (StrUtil.isBlank(buildingId)) {
|
|
|
+ equipBimIdByBuildNull.put(id, (equipBimIdByBuildNull.get(id) == null ? 1 : (equipBimIdByBuildNull.get(id) + 1)));
|
|
|
+ } else {
|
|
|
+ equipBimIdByBuild.put(id, (equipBimIdByBuild.get(id) == null ? 1 : (equipBimIdByBuild.get(id) + 1)));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StrUtil.isBlank(buildingId)) {
|
|
|
+ classInfosNotBuild.put(classCode, (classInfosNotBuild.get(classCode) == null ? 1 : (classInfosNotBuild.get(classCode) + 1)));
|
|
|
+ } else {
|
|
|
+ String key = classCode + AdmCommonConstant.UNDERLINE + buildingId;
|
|
|
+ classInfosByBuild.put(key, (classInfosByBuild.get(key) == null ? 1 : (classInfosByBuild.get(key) + 1)));
|
|
|
+ }
|
|
|
+ // 判断已绑定多少信息点
|
|
|
+ Set<String> nowCodes = parseObject.keySet();
|
|
|
+ for (String key : nowCodes) {
|
|
|
+ if (needCodes.contains(key)) {
|
|
|
+ if ("STATIC".equals(codeAttrbut.get(classCode + AdmCommonConstant.UNDERLINE + key))) {
|
|
|
+ nowStatic++;
|
|
|
+ } else {
|
|
|
+ nowDynamic++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ equipStaticInfoTemp.put(classCode, (equipStaticInfoTemp.get(classCode) == null ? nowStatic : (equipStaticInfoTemp.get(classCode) + nowStatic)));
|
|
|
+ equipDynamicInfoTemp.put(classCode, (equipDynamicInfoTemp.get(classCode) == null ? nowDynamic : (equipDynamicInfoTemp.get(classCode) + nowDynamic)));
|
|
|
+ }
|
|
|
+ equipList.clear(); //即时清空
|
|
|
+
|
|
|
+ Set<String> classCodes = classByBuild.keySet();
|
|
|
+ Set<String> keySet = classNotBuild.keySet();
|
|
|
+ classCodes.addAll(keySet);
|
|
|
+
|
|
|
+ // 结果封装
|
|
|
+ int count = 0;
|
|
|
+ List<EquipmentCountExcel> excelList = new ArrayList<EquipmentCountExcel>();
|
|
|
+ for (String classCode : classCodes) {
|
|
|
+ String systemCode = (classCode == null || classCode.length() < 5) ? null : classCode.substring(0, 4);
|
|
|
+ String buildingId = classBuildId.get(classCode);
|
|
|
+ EquipmentCountExcel excel = new EquipmentCountExcel();
|
|
|
+ excel.setIndex(++count);
|
|
|
+ excel.setProjectName(projectName);
|
|
|
+ excel.setBuildName(buildingId == null ? null : (buildNameTemp.get(buildingId) == null ? null : buildNameTemp.get(buildingId)));
|
|
|
+ excel.setSystemCode(systemCode);
|
|
|
+ excel.setSystemName(systemTemp.get(systemCode));
|
|
|
+ excel.setEquipCode(classCode);
|
|
|
+ excel.setEquipName(equipTemp.get(classCode));
|
|
|
+
|
|
|
+ if (StrUtil.isBlank(buildingId)) {
|
|
|
+ // 第7列,bimId为空的设备数量
|
|
|
+ excel.setEquipBimIdNullCount(equipBimIdNullByBuildNull.get(classCode) == null ? 0 : equipBimIdNullByBuildNull.get(classCode));
|
|
|
+ // 第8列,bimId不为空的数量
|
|
|
+ excel.setEquipBimIdCount(equipBimIdByBuildNull.get(classCode) == null ? 0 : equipBimIdByBuildNull.get(classCode));
|
|
|
+ // 第9列,当前classCode下,建筑为空的设备
|
|
|
+ excel.setEquipCountByBuild(classNotBuild.get(classCode) == null ? 0 : classNotBuild.get(classCode));
|
|
|
+ // 第10列,当前classCode下,建筑为空且信息点不为空的设备
|
|
|
+ excel.setEquipBindPointCount(classInfosNotBuild.get(classCode) == null ? 0 : classInfosNotBuild.get(classCode));
|
|
|
+ } else {
|
|
|
+ // 第7列,bimId为空的设备数量
|
|
|
+ excel.setEquipBimIdNullCount(equipBimIdNullByBuild.get(classCode) == null ? 0 : equipBimIdNullByBuild.get(classCode));
|
|
|
+ // 第8列,bimId不为空的数量
|
|
|
+ excel.setEquipBimIdCount(equipBimIdByBuild.get(classCode) == null ? 0 : equipBimIdByBuild.get(classCode));
|
|
|
+ // 第9列,当前建筑下的设备数量
|
|
|
+ excel.setEquipCountByBuild(classByBuild.get(classCode) == null ? 0 : classByBuild.get(classCode));
|
|
|
+ // 第10列,当前建筑下的设备且信息点不为空的数量
|
|
|
+ String key = classCode + AdmCommonConstant.UNDERLINE + buildingId;
|
|
|
+ excel.setEquipBindPointCount(classInfosByBuild.get(key) == null ? 0 : classInfosByBuild.get(key));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 静态的默认存在4个已绑信息点,ID、name、localId、localName
|
|
|
+ int staticNum = (staticCount.get(classCode) == null ? 0 : staticCount.get(classCode)) + 4;
|
|
|
+ int dynamicNum = dynamicCount.get(classCode) == null ? 0 : dynamicCount.get(classCode);
|
|
|
+ excel.setNeedStaticPointCount(staticNum);
|
|
|
+ excel.setNeedDynamicPointCount(dynamicNum);
|
|
|
+ excel.setNowStaticPointCount(equipStaticInfoTemp.get(classCode));
|
|
|
+ excel.setNowDynamicPointCount(equipDynamicInfoTemp.get(classCode));
|
|
|
+ excelList.add(excel);
|
|
|
+ }
|
|
|
+
|
|
|
+ return excelList;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取建筑的名称
|
|
|
+ *
|
|
|
+ * @param buildNameTemp key: 设备ID,value: 建筑名称
|
|
|
+ * @param buildIdTemp key: 设备ID,value: 建筑ID
|
|
|
+ * @param groupCode
|
|
|
+ * @param projectId
|
|
|
+ */
|
|
|
+ private void findBuildingName(Map<String, String> buildNameTemp, String groupCode, String projectId) {
|
|
|
// 获取建筑名称
|
|
|
String graphAndRelKey = GraphCodeEnum.MechInArch.name() + AdmCommonConstant.UNDERLINE + RelCodeEnum.Eq2Bd.name();
|
|
|
List<ObjectDigital> buildDigitals = this.relationObjectContext.queryAllRelations(groupCode, projectId, graphAndRelKey);
|
|
@@ -296,19 +543,29 @@ public class RelationReportHandler {
|
|
|
List<ObjectDigital> slaveDigitals = master.getRelObjs();
|
|
|
ObjectDigital slave = CollectionUtil.isEmpty(slaveDigitals) ? null : slaveDigitals.get(0);
|
|
|
if (slave != null) {
|
|
|
- buildTemp.put(master.getId(), slave.getLocalName());
|
|
|
+ buildNameTemp.put(master.getId(), slave.getLocalName());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取楼层的名称
|
|
|
+ *
|
|
|
+ * @param floorNameTemp key: 设备ID,value: 楼层名称
|
|
|
+ * @param groupCode
|
|
|
+ * @param projectId
|
|
|
+ */
|
|
|
+ private void findFloorName(Map<String, String> floorNameTemp, String groupCode, String projectId) {
|
|
|
// 获取楼层名称
|
|
|
- graphAndRelKey = GraphCodeEnum.MechInArch.name() + AdmCommonConstant.UNDERLINE + RelCodeEnum.Eq2Fl.name();
|
|
|
+ String graphAndRelKey = GraphCodeEnum.MechInArch.name() + AdmCommonConstant.UNDERLINE + RelCodeEnum.Eq2Fl.name();
|
|
|
List<ObjectDigital> floorDigitals = this.relationObjectContext.queryAllRelations(groupCode, projectId, graphAndRelKey);
|
|
|
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());
|
|
|
+ floorNameTemp.put(master.getId(), slave.getLocalName());
|
|
|
}
|
|
|
}
|
|
|
}
|