|
@@ -1,11 +1,9 @@
|
|
|
package com.persagy.server.syn.models.tools
|
|
|
|
|
|
-import com.google.gson.Gson
|
|
|
-import com.google.gson.reflect.TypeToken
|
|
|
+import com.persagy.base.extensions.toDouble
|
|
|
+import com.persagy.base.extensions.toInt
|
|
|
import com.persagy.database.SFilter
|
|
|
import com.persagy.mybatis.SMybatisDao
|
|
|
-import com.persagy.server.datacenter.models.entities.assistant.AttPic
|
|
|
-import com.persagy.server.datacenter.models.entities.assistant.TaskPic
|
|
|
import com.persagy.server.datacenter.models.entities.dictnew.DefFuncId
|
|
|
import com.persagy.server.datacenter.models.entities.objects.Building
|
|
|
import com.persagy.server.syn.Opts
|
|
@@ -26,293 +24,416 @@ object BuildingUtil {
|
|
|
SSpringContextUtil.getBean(Opts::class.java) as Opts
|
|
|
}
|
|
|
|
|
|
+// /**
|
|
|
+// * 中台建筑转数据中心
|
|
|
+// */
|
|
|
+// fun buildingDataConversion(projectId: String,groupCode: String, mapObj: HashMap<String, Any?>): Building {
|
|
|
+// /** 查建筑类型字典 */
|
|
|
+// val dictDefFuncIdList = dictDefFuncIdService.select(SFilter.eq("groupCode", groupCode), SFilter.eq("classCode", "building")).exec()
|
|
|
+// val mapEx = HashMap<String, Any?>()
|
|
|
+// val mapCode = HashMap<String, Any?>()
|
|
|
+//
|
|
|
+// for (explainProject in dictDefFuncIdList) {
|
|
|
+// mapEx[explainProject.code!!] = explainProject.firstName
|
|
|
+// if (!explainProject.secondName.isNullOrEmpty()) {
|
|
|
+// mapCode[explainProject.code!!] = explainProject.secondName
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// /** 建筑信息 */
|
|
|
+// val buildingInfo = HashMap<String, Any?>()
|
|
|
+// /** 工作历 */
|
|
|
+// val schedule = HashMap<String, Any?>()
|
|
|
+// /** 人员信息 */
|
|
|
+// val peopleInfo = HashMap<String, Any?>()
|
|
|
+// /** 能耗信息 */
|
|
|
+// val consumptionInfo = HashMap<String, Any?>()
|
|
|
+// /** 自定义 */
|
|
|
+// val customParam = HashMap<String, Any?>()
|
|
|
+// /** 建筑文档 */
|
|
|
+// val buildingDoc = HashMap<String, Any?>()
|
|
|
+//
|
|
|
+// /** 建筑类型 */
|
|
|
+// var buildingType = HashMap<String, Any?>()
|
|
|
+// /** 设计指标 */
|
|
|
+// var designIndex = HashMap<String, Any?>()
|
|
|
+// /** 结构参数 */
|
|
|
+// var structureParam = HashMap<String, Any?>()
|
|
|
+// /** 面积信息 */
|
|
|
+// var areaInfo = HashMap<String, Any?>()
|
|
|
+// /** 人员信息 */
|
|
|
+// val peopleInfoTwo = HashMap<String, Any?>()
|
|
|
+//
|
|
|
+// /** 工作作息 */
|
|
|
+// var workRest = HashMap<String, Any?>()
|
|
|
+// /** 季节 */
|
|
|
+// var season = HashMap<String, Any?>()
|
|
|
+// /** 工作历信息 */
|
|
|
+// var workCalendar = HashMap<String, Any?>()
|
|
|
+//
|
|
|
+// /** 逐时 */
|
|
|
+// var hourly = HashMap<String, Any?>()
|
|
|
+// /** 累计 */
|
|
|
+// var cumulative = HashMap<String, Any?>()
|
|
|
+//
|
|
|
+// /** 建筑对象 */
|
|
|
+// val building = Building()
|
|
|
+// building.projectId = projectId
|
|
|
+// /** id 是否存在 */
|
|
|
+// val containsKeyId = mapObj.containsKey("id")
|
|
|
+// if(containsKeyId){
|
|
|
+// building.id = mapObj["id"].toString()
|
|
|
+// }
|
|
|
+// /** name 是否存在 */
|
|
|
+// val containsKeyName = mapObj.containsKey("name")
|
|
|
+// if(containsKeyName){
|
|
|
+// building.name = mapObj["name"].toString()
|
|
|
+// }
|
|
|
+//
|
|
|
+// for (key in mapObj!!.keys) {
|
|
|
+// val containsKey = mapEx.containsKey(key)
|
|
|
+// if (containsKey) {
|
|
|
+// val value = mapEx[key]
|
|
|
+// if (value == opts.BuildingInfo) {
|
|
|
+// /** 建筑信息 */
|
|
|
+// val contains = mapCode.containsKey(key)
|
|
|
+// if (contains) {
|
|
|
+// val any = mapCode[key].toString()
|
|
|
+// if (any == "建筑类型") {
|
|
|
+//
|
|
|
+// /** 安装图纸 安装照片 安装质检报告 */
|
|
|
+// if (key == "Pic" ){
|
|
|
+// try {
|
|
|
+// val gson = Gson()
|
|
|
+// val type = object : TypeToken<ArrayList<AttPic>>() {
|
|
|
+// }.type
|
|
|
+// val attPicList = gson.fromJson<ArrayList<AttPic>>(mapObj[key].toString(),type)
|
|
|
+// if (attPicList.isNotEmpty()){
|
|
|
+// val listPic =ArrayList<TaskPic>()
|
|
|
+// for (attPic in attPicList){
|
|
|
+// val taskPic = TaskPic()
|
|
|
+// taskPic.key = attPic.key
|
|
|
+// taskPic.name = attPic.name
|
|
|
+// taskPic.systemId = attPic.systemId
|
|
|
+// taskPic.type = attPic.type
|
|
|
+// listPic.add(taskPic)
|
|
|
+// }
|
|
|
+// buildingType[key] = listPic
|
|
|
+// }
|
|
|
+// } catch (e: Exception) {
|
|
|
+// e.printStackTrace()
|
|
|
+// }
|
|
|
+// }else{
|
|
|
+// buildingType[key] = mapObj[key]
|
|
|
+// }
|
|
|
+// } else if (any == "设计指标") {
|
|
|
+// designIndex[key] = mapObj[key]
|
|
|
+// } else if (any == "结构参数") {
|
|
|
+// structureParam[key] = mapObj[key]
|
|
|
+// } else if (any == "面积信息") {
|
|
|
+// areaInfo[key] = mapObj[key]
|
|
|
+// } else if(any == "人员信息"){
|
|
|
+// peopleInfo[key]= mapObj[key]
|
|
|
+// }else {
|
|
|
+// buildingInfo[key] = mapObj[key]
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// buildingInfo[key] = mapObj[key]
|
|
|
+// }
|
|
|
+// } else if (value == opts.Schedule) {
|
|
|
+// /** 工作历 */
|
|
|
+// val contains = mapCode.containsKey(key)
|
|
|
+// if (contains) {
|
|
|
+// val any = mapCode[key].toString()
|
|
|
+// if (any == "工作作息") {
|
|
|
+// workRest[key] = mapObj[key]
|
|
|
+// } else if (any == "季节") {
|
|
|
+// season[key] = mapObj[key]
|
|
|
+// } else if (any == "工作历信息") {
|
|
|
+// workCalendar[key] = mapObj[key]
|
|
|
+// } else {
|
|
|
+// schedule[key] = mapObj[key]
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// schedule[key] = mapObj[key]
|
|
|
+// }
|
|
|
+////
|
|
|
+// } else if (value == opts.PeopleInfo) {
|
|
|
+// /** 人员信息 */
|
|
|
+// peopleInfo[key] = mapObj[key]
|
|
|
+// } else if (value == opts.ConsumptionInfo) {
|
|
|
+// /** 能耗信息 */
|
|
|
+// val contains = mapCode.containsKey(key)
|
|
|
+// if (contains) {
|
|
|
+// val any = mapCode[key].toString()
|
|
|
+// if (any == "逐时") {
|
|
|
+// hourly[key] = mapObj[key]
|
|
|
+// } else if (any == "累计") {
|
|
|
+// cumulative[key] = mapObj[key]
|
|
|
+// } else {
|
|
|
+// consumptionInfo[key] = mapObj[key]
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// consumptionInfo[key] = mapObj[key]
|
|
|
+// }
|
|
|
+// } else if (value == "建筑文档") {
|
|
|
+//
|
|
|
+// if (key == "drawing" ){
|
|
|
+// try {
|
|
|
+// val gson = Gson()
|
|
|
+// val type = object : TypeToken<ArrayList<AttPic>>() {
|
|
|
+// }.type
|
|
|
+// val attPicList = gson.fromJson<ArrayList<AttPic>>(mapObj[key].toString(),type)
|
|
|
+// if (attPicList.isNotEmpty()){
|
|
|
+// val listPic =ArrayList<TaskPic>()
|
|
|
+// for (attPic in attPicList){
|
|
|
+// val taskPic = TaskPic()
|
|
|
+// taskPic.key = attPic.key
|
|
|
+// taskPic.name = attPic.name
|
|
|
+// taskPic.systemId = attPic.systemId
|
|
|
+// taskPic.type = attPic.type
|
|
|
+// listPic.add(taskPic)
|
|
|
+// }
|
|
|
+// buildingType[key] = listPic
|
|
|
+// }
|
|
|
+// } catch (e: Exception) {
|
|
|
+// e.printStackTrace()
|
|
|
+// }
|
|
|
+// }else if (key == "archive"){
|
|
|
+// try {
|
|
|
+// val gson = Gson()
|
|
|
+// val type = object : TypeToken<ArrayList<AttPic>>() {
|
|
|
+// }.type
|
|
|
+// val attPicList = gson.fromJson<ArrayList<AttPic>>(mapObj[key].toString(),type)
|
|
|
+// if (attPicList.isNotEmpty()){
|
|
|
+// val listPic =ArrayList<TaskPic>()
|
|
|
+// for (attPic in attPicList){
|
|
|
+// val taskPic = TaskPic()
|
|
|
+// taskPic.key = attPic.key
|
|
|
+// taskPic.name = attPic.name
|
|
|
+// taskPic.systemId = attPic.systemId
|
|
|
+// taskPic.type = attPic.type
|
|
|
+// listPic.add(taskPic)
|
|
|
+// }
|
|
|
+// buildingType[key] = listPic
|
|
|
+// }
|
|
|
+// } catch (e: Exception) {
|
|
|
+// e.printStackTrace()
|
|
|
+// }
|
|
|
+// }else if (key == "simulationModel"){
|
|
|
+// try {
|
|
|
+// val gson = Gson()
|
|
|
+// val type = object : TypeToken<ArrayList<AttPic>>() {
|
|
|
+// }.type
|
|
|
+// val attPicList = gson.fromJson<ArrayList<AttPic>>(mapObj[key].toString(),type)
|
|
|
+// if (attPicList.isNotEmpty()){
|
|
|
+// val listPic =ArrayList<TaskPic>()
|
|
|
+// for (attPic in attPicList){
|
|
|
+// val taskPic = TaskPic()
|
|
|
+// taskPic.key = attPic.key
|
|
|
+// taskPic.name = attPic.name
|
|
|
+// taskPic.systemId = attPic.systemId
|
|
|
+// taskPic.type = attPic.type
|
|
|
+// listPic.add(taskPic)
|
|
|
+// }
|
|
|
+// buildingType[key] = listPic
|
|
|
+// }
|
|
|
+// } catch (e: Exception) {
|
|
|
+// e.printStackTrace()
|
|
|
+// }
|
|
|
+// }else{
|
|
|
+// buildingDoc[key] = mapObj[key]
|
|
|
+// }
|
|
|
+//
|
|
|
+// } else {
|
|
|
+// when (key) {
|
|
|
+// "localID" -> building.localId = mapObj[key].toString()
|
|
|
+// "localName" -> building.localName = mapObj[key].toString()
|
|
|
+// "defaultQRCode" -> building.defaultQRCode.toString()
|
|
|
+// "buildQRCode" -> building.buildQRCode.toString()
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (buildingType.size > 0) {
|
|
|
+// buildingInfo.put("BuildingType", buildingType)
|
|
|
+// }
|
|
|
+// if (designIndex.size > 0) {
|
|
|
+// buildingInfo.put("DesignIndex", designIndex)
|
|
|
+// }
|
|
|
+// if (structureParam.size > 0) {
|
|
|
+// buildingInfo.put("StructureParam", structureParam)
|
|
|
+// }
|
|
|
+// if (areaInfo.size > 0) {
|
|
|
+// buildingInfo.put("AreaInfo", areaInfo)
|
|
|
+// }
|
|
|
+// if (peopleInfoTwo.size>0){
|
|
|
+// buildingInfo.put("PeopleInfo", peopleInfoTwo)
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (workRest.size > 0) {
|
|
|
+// schedule.put("WorkRest", workRest)
|
|
|
+// }
|
|
|
+// if (season.size > 0) {
|
|
|
+// schedule.put("Season", season)
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (hourly.size > 0) {
|
|
|
+// consumptionInfo.put("Hourly", hourly)
|
|
|
+// }
|
|
|
+// if (cumulative.size > 0) {
|
|
|
+// consumptionInfo.put("Cumulative", cumulative)
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (workCalendar.size > 0) {
|
|
|
+// schedule.put("WorkCalendar", workCalendar)
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (buildingDoc.size > 0) {
|
|
|
+// building.buildingDoc = buildingDoc
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (buildingInfo.size > 0) {
|
|
|
+// building.buildingInfo = buildingInfo
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (schedule.size > 0) {
|
|
|
+// building.schedule = schedule
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (peopleInfo.size > 0) {
|
|
|
+// building.peopleInfo = peopleInfo
|
|
|
+// }
|
|
|
+// if (consumptionInfo.size > 0) {
|
|
|
+// building.consumptionInfo = consumptionInfo
|
|
|
+// }
|
|
|
+//
|
|
|
+// if (customParam.size > 0) {
|
|
|
+// building.customParam = customParam
|
|
|
+// }
|
|
|
+//
|
|
|
+// return building
|
|
|
+// }
|
|
|
+
|
|
|
/**
|
|
|
- * 中台建筑转数据中心
|
|
|
+ * 建筑
|
|
|
+ *
|
|
|
+ * @param projectId 项目 id
|
|
|
+ * @param groupCode 集团编码
|
|
|
+ * @param mapObj 对象信息
|
|
|
+ * @return 建筑对象
|
|
|
*/
|
|
|
- fun buildingDataConversion(projectId: String,groupCode: String, mapObj: HashMap<String, Any?>): Building {
|
|
|
+ fun buildingDataConversions(projectId: String,groupCode: String, mapObj: HashMap<String, Any?>): Building {
|
|
|
/** 查建筑类型字典 */
|
|
|
val dictDefFuncIdList = dictDefFuncIdService.select(SFilter.eq("groupCode", groupCode), SFilter.eq("classCode", "building")).exec()
|
|
|
val mapEx = HashMap<String, Any?>()
|
|
|
val mapCode = HashMap<String, Any?>()
|
|
|
-
|
|
|
+ /** 遍历项目类型字典 */
|
|
|
for (explainProject in dictDefFuncIdList) {
|
|
|
- mapEx[explainProject.code!!] = explainProject.firstName
|
|
|
- if (!explainProject.secondName.isNullOrEmpty()) {
|
|
|
- mapCode[explainProject.code!!] = explainProject.secondName
|
|
|
- }
|
|
|
+ /** 输入类型 */
|
|
|
+ mapEx[explainProject.code!!] = explainProject.dataType
|
|
|
+ mapCode[explainProject.code!!] = explainProject.category
|
|
|
}
|
|
|
|
|
|
- /** 建筑信息 */
|
|
|
- val buildingInfo = HashMap<String, Any?>()
|
|
|
- /** 工作历 */
|
|
|
- val schedule = HashMap<String, Any?>()
|
|
|
- /** 人员信息 */
|
|
|
- val peopleInfo = HashMap<String, Any?>()
|
|
|
- /** 能耗信息 */
|
|
|
- val consumptionInfo = HashMap<String, Any?>()
|
|
|
- /** 自定义 */
|
|
|
- val customParam = HashMap<String, Any?>()
|
|
|
- /** 建筑文档 */
|
|
|
- val buildingDoc = HashMap<String, Any?>()
|
|
|
-
|
|
|
- /** 建筑类型 */
|
|
|
- var buildingType = HashMap<String, Any?>()
|
|
|
- /** 设计指标 */
|
|
|
- var designIndex = HashMap<String, Any?>()
|
|
|
- /** 结构参数 */
|
|
|
- var structureParam = HashMap<String, Any?>()
|
|
|
- /** 面积信息 */
|
|
|
- var areaInfo = HashMap<String, Any?>()
|
|
|
- /** 人员信息 */
|
|
|
- val peopleInfoTwo = HashMap<String, Any?>()
|
|
|
-
|
|
|
- /** 工作作息 */
|
|
|
- var workRest = HashMap<String, Any?>()
|
|
|
- /** 季节 */
|
|
|
- var season = HashMap<String, Any?>()
|
|
|
- /** 工作历信息 */
|
|
|
- var workCalendar = HashMap<String, Any?>()
|
|
|
-
|
|
|
- /** 逐时 */
|
|
|
- var hourly = HashMap<String, Any?>()
|
|
|
- /** 累计 */
|
|
|
- var cumulative = HashMap<String, Any?>()
|
|
|
-
|
|
|
- /** 建筑对象 */
|
|
|
val building = Building()
|
|
|
building.projectId = projectId
|
|
|
- /** id 是否存在 */
|
|
|
- val containsKeyId = mapObj.containsKey("id")
|
|
|
- if(containsKeyId){
|
|
|
- building.id = mapObj["id"].toString()
|
|
|
- }
|
|
|
- /** name 是否存在 */
|
|
|
- val containsKeyName = mapObj.containsKey("name")
|
|
|
- if(containsKeyName){
|
|
|
- building.name = mapObj["name"].toString()
|
|
|
- }
|
|
|
-
|
|
|
- for (key in mapObj!!.keys) {
|
|
|
+ for (key in mapObj.keys) {
|
|
|
val containsKey = mapEx.containsKey(key)
|
|
|
- if (containsKey) {
|
|
|
- val value = mapEx[key]
|
|
|
- if (value == opts.BuildingInfo) {
|
|
|
- /** 建筑信息 */
|
|
|
- val contains = mapCode.containsKey(key)
|
|
|
- if (contains) {
|
|
|
+ if (containsKey){
|
|
|
+ if (key != "id"&& key!="name"&&key!="localId"&&key!="localName"&&key!="defaultQRCode"
|
|
|
+ &&key!="buildQRCode"){
|
|
|
+ val containsKey1 = mapCode.containsKey(key)
|
|
|
+ if (containsKey1){
|
|
|
val any = mapCode[key].toString()
|
|
|
- if (any == "建筑类型") {
|
|
|
-
|
|
|
- /** 安装图纸 安装照片 安装质检报告 */
|
|
|
- if (key == "Pic" ){
|
|
|
- try {
|
|
|
- val gson = Gson()
|
|
|
- val type = object : TypeToken<ArrayList<AttPic>>() {
|
|
|
- }.type
|
|
|
- val attPicList = gson.fromJson<ArrayList<AttPic>>(mapObj[key].toString(),type)
|
|
|
- if (attPicList.isNotEmpty()){
|
|
|
- val listPic =ArrayList<TaskPic>()
|
|
|
- for (attPic in attPicList){
|
|
|
- val taskPic = TaskPic()
|
|
|
- taskPic.key = attPic.key
|
|
|
- taskPic.name = attPic.name
|
|
|
- taskPic.systemId = attPic.systemId
|
|
|
- taskPic.type = attPic.type
|
|
|
- listPic.add(taskPic)
|
|
|
- }
|
|
|
- buildingType[key] = listPic
|
|
|
+ if (any == "STATIC"){
|
|
|
+ when(mapEx[key].toString()) {
|
|
|
+ "INTEGER" -> {
|
|
|
+ if (building.infos.isNullOrEmpty()){
|
|
|
+ building.infos = HashMap<String,Any?>()
|
|
|
}
|
|
|
- } catch (e: Exception) {
|
|
|
- e.printStackTrace()
|
|
|
+ building.infos!![key] = mapObj[key]!!.toInt()
|
|
|
}
|
|
|
- }else{
|
|
|
- buildingType[key] = mapObj[key]
|
|
|
- }
|
|
|
- } else if (any == "设计指标") {
|
|
|
- designIndex[key] = mapObj[key]
|
|
|
- } else if (any == "结构参数") {
|
|
|
- structureParam[key] = mapObj[key]
|
|
|
- } else if (any == "面积信息") {
|
|
|
- areaInfo[key] = mapObj[key]
|
|
|
- } else if(any == "人员信息"){
|
|
|
- peopleInfo[key]= mapObj[key]
|
|
|
- }else {
|
|
|
- buildingInfo[key] = mapObj[key]
|
|
|
- }
|
|
|
- } else {
|
|
|
- buildingInfo[key] = mapObj[key]
|
|
|
- }
|
|
|
- } else if (value == opts.Schedule) {
|
|
|
- /** 工作历 */
|
|
|
- val contains = mapCode.containsKey(key)
|
|
|
- if (contains) {
|
|
|
- val any = mapCode[key].toString()
|
|
|
- if (any == "工作作息") {
|
|
|
- workRest[key] = mapObj[key]
|
|
|
- } else if (any == "季节") {
|
|
|
- season[key] = mapObj[key]
|
|
|
- } else if (any == "工作历信息") {
|
|
|
- workCalendar[key] = mapObj[key]
|
|
|
- } else {
|
|
|
- schedule[key] = mapObj[key]
|
|
|
- }
|
|
|
- } else {
|
|
|
- schedule[key] = mapObj[key]
|
|
|
- }
|
|
|
-//
|
|
|
- } else if (value == opts.PeopleInfo) {
|
|
|
- /** 人员信息 */
|
|
|
- peopleInfo[key] = mapObj[key]
|
|
|
- } else if (value == opts.ConsumptionInfo) {
|
|
|
- /** 能耗信息 */
|
|
|
- val contains = mapCode.containsKey(key)
|
|
|
- if (contains) {
|
|
|
- val any = mapCode[key].toString()
|
|
|
- if (any == "逐时") {
|
|
|
- hourly[key] = mapObj[key]
|
|
|
- } else if (any == "累计") {
|
|
|
- cumulative[key] = mapObj[key]
|
|
|
- } else {
|
|
|
- consumptionInfo[key] = mapObj[key]
|
|
|
- }
|
|
|
- } else {
|
|
|
- consumptionInfo[key] = mapObj[key]
|
|
|
- }
|
|
|
- } else if (value == "建筑文档") {
|
|
|
-
|
|
|
- if (key == "drawing" ){
|
|
|
- try {
|
|
|
- val gson = Gson()
|
|
|
- val type = object : TypeToken<ArrayList<AttPic>>() {
|
|
|
- }.type
|
|
|
- val attPicList = gson.fromJson<ArrayList<AttPic>>(mapObj[key].toString(),type)
|
|
|
- if (attPicList.isNotEmpty()){
|
|
|
- val listPic =ArrayList<TaskPic>()
|
|
|
- for (attPic in attPicList){
|
|
|
- val taskPic = TaskPic()
|
|
|
- taskPic.key = attPic.key
|
|
|
- taskPic.name = attPic.name
|
|
|
- taskPic.systemId = attPic.systemId
|
|
|
- taskPic.type = attPic.type
|
|
|
- listPic.add(taskPic)
|
|
|
+ "DOUBLE" -> {
|
|
|
+ if (building.infos.isNullOrEmpty()){
|
|
|
+ building.infos = HashMap<String,Any?>()
|
|
|
+ }
|
|
|
+ building.infos!![key] = mapObj[key]!!.toString().toDouble()
|
|
|
}
|
|
|
- buildingType[key] = listPic
|
|
|
- }
|
|
|
- } catch (e: Exception) {
|
|
|
- e.printStackTrace()
|
|
|
- }
|
|
|
- }else if (key == "archive"){
|
|
|
- try {
|
|
|
- val gson = Gson()
|
|
|
- val type = object : TypeToken<ArrayList<AttPic>>() {
|
|
|
- }.type
|
|
|
- val attPicList = gson.fromJson<ArrayList<AttPic>>(mapObj[key].toString(),type)
|
|
|
- if (attPicList.isNotEmpty()){
|
|
|
- val listPic =ArrayList<TaskPic>()
|
|
|
- for (attPic in attPicList){
|
|
|
- val taskPic = TaskPic()
|
|
|
- taskPic.key = attPic.key
|
|
|
- taskPic.name = attPic.name
|
|
|
- taskPic.systemId = attPic.systemId
|
|
|
- taskPic.type = attPic.type
|
|
|
- listPic.add(taskPic)
|
|
|
+ "BOOLEAN" -> {
|
|
|
+ if (building.infos.isNullOrEmpty()){
|
|
|
+ building.infos = HashMap<String,Any?>()
|
|
|
+ }
|
|
|
+ building.infos!![key] = mapObj[key]!!.toString().toBoolean()
|
|
|
}
|
|
|
- buildingType[key] = listPic
|
|
|
- }
|
|
|
- } catch (e: Exception) {
|
|
|
- e.printStackTrace()
|
|
|
- }
|
|
|
- }else if (key == "simulationModel"){
|
|
|
- try {
|
|
|
- val gson = Gson()
|
|
|
- val type = object : TypeToken<ArrayList<AttPic>>() {
|
|
|
- }.type
|
|
|
- val attPicList = gson.fromJson<ArrayList<AttPic>>(mapObj[key].toString(),type)
|
|
|
- if (attPicList.isNotEmpty()){
|
|
|
- val listPic =ArrayList<TaskPic>()
|
|
|
- for (attPic in attPicList){
|
|
|
- val taskPic = TaskPic()
|
|
|
- taskPic.key = attPic.key
|
|
|
- taskPic.name = attPic.name
|
|
|
- taskPic.systemId = attPic.systemId
|
|
|
- taskPic.type = attPic.type
|
|
|
- listPic.add(taskPic)
|
|
|
+ "STRING" -> {
|
|
|
+ if (building.infos.isNullOrEmpty()){
|
|
|
+ building.infos = HashMap<String,Any?>()
|
|
|
+ }
|
|
|
+ building.infos!![key] = mapObj[key]!!.toString()
|
|
|
+ }
|
|
|
+ "DATETIME" -> {
|
|
|
+ if (building.infos.isNullOrEmpty()){
|
|
|
+ building.infos = HashMap<String,Any?>()
|
|
|
+ }
|
|
|
+ building.infos!![key] = mapObj[key]!!.toString()
|
|
|
+ }
|
|
|
+ "ATTACHMENT" -> {
|
|
|
+ if (building.infos.isNullOrEmpty()){
|
|
|
+ building.infos = HashMap<String,Any?>()
|
|
|
+ }
|
|
|
+ building.infos!![key] = mapObj[key]!!.toString()
|
|
|
+ }
|
|
|
+ "OBJECT" -> {
|
|
|
+ if (building.infos.isNullOrEmpty()){
|
|
|
+ building.infos = HashMap<String,Any?>()
|
|
|
+ }
|
|
|
+ building.infos!![key] = mapObj[key]!!.toString()
|
|
|
+ }
|
|
|
+ "ENUM" -> {
|
|
|
+ if (building.infos.isNullOrEmpty()){
|
|
|
+ building.infos = HashMap<String,Any?>()
|
|
|
+ }
|
|
|
+ building.infos!![key] = mapObj[key]!!.toString()
|
|
|
+ }
|
|
|
+ "MENUM" -> {
|
|
|
+ if (building.infos.isNullOrEmpty()){
|
|
|
+ building.infos = HashMap<String,Any?>()
|
|
|
+ }
|
|
|
+ building.infos!![key] = mapObj[key]!!.toString()
|
|
|
}
|
|
|
- buildingType[key] = listPic
|
|
|
+ else -> {
|
|
|
+ if (building.infos.isNullOrEmpty()){
|
|
|
+ building.infos = HashMap<String,Any?>()
|
|
|
+ }
|
|
|
+ building.infos!![key] = mapObj[key]!!.toString()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ if (building.infos.isNullOrEmpty()){
|
|
|
+ building.infos = HashMap<String,Any?>()
|
|
|
}
|
|
|
- } catch (e: Exception) {
|
|
|
- e.printStackTrace()
|
|
|
+ building.infos!![key] = mapObj[key]!!.toString()
|
|
|
}
|
|
|
- }else{
|
|
|
- buildingDoc[key] = mapObj[key]
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
- when (key) {
|
|
|
- "localID" -> building.localId = mapObj[key].toString()
|
|
|
- "localName" -> building.localName = mapObj[key].toString()
|
|
|
- "defaultQRCode" -> building.defaultQRCode.toString()
|
|
|
- "buildQRCode" -> building.buildQRCode.toString()
|
|
|
+ when(key) {
|
|
|
+ "id" -> building.id = mapObj[key]!!.toString()
|
|
|
+ "name" -> building.name = mapObj[key]!!.toString()
|
|
|
+ "localId" -> building.localId = mapObj[key]!!.toString()
|
|
|
+ "localName" -> building.localName = mapObj[key]!!.toString()
|
|
|
+ "defaultQRCode" -> building.defaultQRCode = mapObj[key]!!.toString()
|
|
|
+ "buildQRCode" -> building.buildQRCode = mapObj[key]!!.toString()
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (buildingType.size > 0) {
|
|
|
- buildingInfo.put("BuildingType", buildingType)
|
|
|
- }
|
|
|
- if (designIndex.size > 0) {
|
|
|
- buildingInfo.put("DesignIndex", designIndex)
|
|
|
- }
|
|
|
- if (structureParam.size > 0) {
|
|
|
- buildingInfo.put("StructureParam", structureParam)
|
|
|
- }
|
|
|
- if (areaInfo.size > 0) {
|
|
|
- buildingInfo.put("AreaInfo", areaInfo)
|
|
|
- }
|
|
|
- if (peopleInfoTwo.size>0){
|
|
|
- buildingInfo.put("PeopleInfo", peopleInfoTwo)
|
|
|
- }
|
|
|
-
|
|
|
- if (workRest.size > 0) {
|
|
|
- schedule.put("WorkRest", workRest)
|
|
|
- }
|
|
|
- if (season.size > 0) {
|
|
|
- schedule.put("Season", season)
|
|
|
- }
|
|
|
-
|
|
|
- if (hourly.size > 0) {
|
|
|
- consumptionInfo.put("Hourly", hourly)
|
|
|
- }
|
|
|
- if (cumulative.size > 0) {
|
|
|
- consumptionInfo.put("Cumulative", cumulative)
|
|
|
- }
|
|
|
-
|
|
|
- if (workCalendar.size > 0) {
|
|
|
- schedule.put("WorkCalendar", workCalendar)
|
|
|
- }
|
|
|
|
|
|
- if (buildingDoc.size > 0) {
|
|
|
- building.buildingDoc = buildingDoc
|
|
|
- }
|
|
|
-
|
|
|
- if (buildingInfo.size > 0) {
|
|
|
- building.buildingInfo = buildingInfo
|
|
|
- }
|
|
|
-
|
|
|
- if (schedule.size > 0) {
|
|
|
- building.schedule = schedule
|
|
|
- }
|
|
|
-
|
|
|
- if (peopleInfo.size > 0) {
|
|
|
- building.peopleInfo = peopleInfo
|
|
|
- }
|
|
|
- if (consumptionInfo.size > 0) {
|
|
|
- building.consumptionInfo = consumptionInfo
|
|
|
- }
|
|
|
-
|
|
|
- if (customParam.size > 0) {
|
|
|
- building.customParam = customParam
|
|
|
+ } else {
|
|
|
+ // if (zoneSpace.infos.isNullOrEmpty()){
|
|
|
+// zoneSpace.infos = HashMap<String,Any?>()
|
|
|
+// }
|
|
|
+// zoneSpace.infos!![key] = mapObj[key]!!.toString()
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return building
|
|
@@ -320,4 +441,5 @@ object BuildingUtil {
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
}
|