/*
 * *********************************************************************************************************************
 *
 *          !!
 *        .F88X
 *        X8888Y
 *      .}888888N;
 *        i888888N;        .:!              .I$WI:
 *          R888888I      .'N88~            i8}+8Y&8"l8i$8>8W~'>W8}8]KW+8IIN"8&
 *          .R888888I    .;N8888~          .X8'  "8I.!,/8"  !%NY8`"8I8~~8>,88I
 *            +888888N;  .8888888Y                                  "&&8Y.}8,
 *            ./888888N;  .R888888Y        .'}~    .>}'.`+>  i}!    "i'  +/'  .'i~  !11,.:">,  .~]!  .i}i
 *              ~888888%:  .I888888l      .]88~`1/iY88Ii+1'.R$8$8]"888888888>  Y8$  W8E  X8E  W8888'188Il}Y88$*
 *              18888888    E8888881    .]W%8$`R8X'&8%++N8i,8N%N8+l8%`  .}8N:.R$RE%N88N%N$K$R  188,FE$8%~Y88I
 *            .E888888I  .i8888888'      .:$8I;88+`E8R:/8N,.>881.`$8E/1/]N8X.Y8N`"KF&&FK!'88*."88K./$88%RN888+~
 *            8888888I  .,N888888~        ~88i"8W,!N8*.I88.}888%F,i$88"F88"  888:E8X.>88!i88>`888*.}Fl1]*}1YKi'
 *          i888888N'      I888Y          ]88;/EX*IFKFK88X  K8R  .l8W  88Y  ~88}'88E&%8W.X8N``]88!.$8K  .:W8I
 *        .i888888N;        I8Y          .&8$  .X88!  i881.:%888>I88  ;88]  +88+.';;;;:.Y88X  18N.,88l  .+88/
 *      .:R888888I
 *      .&888888I                                          Copyright (c) 2009-2020.  博锐尚格科技股份有限公司
 *        ~8888'
 *        .!88~                                                                     All rights reserved.
 *
 * *********************************************************************************************************************
 */

package com.persagy.server.datacenter.syn.models.tools

import com.alibaba.fastjson.JSON
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import com.persagy.base.extensions.toInt
import com.persagy.base.extensions.toJson
import com.persagy.database.SFilter
import com.persagy.mybatis.SMybatisDao
import com.persagy.server.datacenter.models.entities.assistant.PointPosition
import com.persagy.server.datacenter.models.entities.assistant.TaskPic
import com.persagy.server.datacenter.models.entities.dictnew.DefFuncId
import com.persagy.server.datacenter.wanda.AttPic
import com.persagy.server.datacenter.wanda.obj.ZoneSpace
import com.persagy.server.syn.Opts
import com.persagy.server.syn.controllers.obj.ObjectFromToControllers
import com.persagy.service.SObjectService
import com.persagy.service.utils.SSpringContextUtil
import org.slf4j.LoggerFactory

/**
 * 空间工具
 *
 * @author wx  <zhangweixin@sagacloud.com>
 * @date  2020/10/20 10:53
 */
object SpaceUtil {
    /** 日志 */
    private val logger = LoggerFactory.getLogger(ObjectFromToControllers::class.java)
    /** 信息点 */
    private val dictDefFuncIdService = SObjectService(SMybatisDao(DefFuncId::class.java))
    /** 配置 */
    private val opts: Opts by lazy {
        SSpringContextUtil.getBean(Opts::class.java) as Opts
    }

//    /**
//     * 空间转换工具
//     *
//     * @param projectId     项目 id
//     * @param groupCode     集团编码
//     * @param mapObj        中台数据对象
//     * @return 返回结果
//     */
//    fun spaceDataConversion(projectId: String,groupCode: String, mapObj: HashMap<String, Any?>): ZoneSpace {
//
//        /** 查建楼层型字典 */
//        val dictDefFuncIdList = dictDefFuncIdService.select(SFilter.eq("groupCode", groupCode), SFilter.eq("classCode", mapObj["classCode"].toString())).exec()
//        val mapEx = HashMap<String, Any?>()
//        val mapTwo = HashMap<String, Any?>()
//
//        for (explainProject in dictDefFuncIdList) {
//            mapEx[explainProject.code!!] = explainProject.firstName
//            if (!explainProject.secondName.isNullOrEmpty()) {
//                mapTwo[explainProject.code!!] = explainProject.secondName
//            }
//        }
//        /** 租户信息 */
//        val tenantInfo = HashMap<String, Any?>()
//        /** 环境参数 */
//        val envParam = HashMap<String, Any?>()
//        /** 人员信息 */
//        val peopleInfo = HashMap<String, Any?>()
//        /** 能耗信息 */
//        val consumptionInfo = HashMap<String, Any?>()
//        /** 运行参数 */
//        val runParam = HashMap<String, Any?>()
//        /** 动态信息 */
//        val dynamicInfor = HashMap<String,Any?>()
//        /** 工作历信息 */
//        val workCalendar = HashMap<String,Any?>()
//        /** 反馈参数 */
//        val feedbackParam = HashMap<String,Any?>()
//        /** 静态参数 */
//        val staticParam = HashMap<String,Any?>()
//        /** 自定义 */
//        val customParam = HashMap<String, Any?>()
//
//        /** 温湿度 */
//        val temperatureHumidity = HashMap<String, Any?>()
//        /** 压力 */
//        val pressure = HashMap<String, Any?>()
//        /** 空气质量 */
//        val airQuality = HashMap<String, Any?>()
//        /** 光照 */
//        val illumination = HashMap<String, Any?>()
//        /** 声强 */
//        val soundIntensity = HashMap<String, Any?>()
//        /** 风速 */
//        val windSpeed = HashMap<String, Any?>()
//        /**  关键指标*/
//        val keyIndic = HashMap<String, Any?>()
//        /** 逐时 */
//        val hourly = HashMap<String, Any?>()
//        /** 累计 */
//        val cumulative = HashMap<String, Any?>()
//        /** 租赁信息 */
//        val leaseInfo = java.util.HashMap<String, Any?>()
//        /** 环境参数 */
//        val envParamTwo = HashMap<String, Any?>()
//
//        val zoneSpace = ZoneSpace()
//        zoneSpace.projectId = projectId
//        zoneSpace.classCode = mapObj["classCode"].toString()
//        /** id 是否存在 */
//        val containsKeyId = mapObj.containsKey("id")
//        if(containsKeyId){
//            zoneSpace.id = mapObj["id"].toString()
//        }
//        /** name 是否存在 */
//        val containsKeyName = mapObj.containsKey("name")
//        if(containsKeyName){
//            zoneSpace.name = mapObj["name"].toString()
//        }
//        for (key in mapObj.keys) {
//            val containsKey = mapEx.containsKey(key)
//            if (containsKey) {
//                val value = mapEx[key]
////                logger.info("value= ${key}*${ value}****************************************************************")
//                if (value == opts.TenantInfo) {
//                    /** 租户信息 */
//                    tenantInfo[key] = mapObj[key]
//                } else if (value == opts.EnvParam) {
//                    /** 环境参数 */
//                    val contains = mapTwo.containsKey(key)
//                    if (contains) {
//                        val any = mapTwo[key]
//                        if (any == "温湿度") {
//                            temperatureHumidity[key] = mapObj[key]
//                        } else if (any == "压力") {
//                            pressure[key] = mapObj[key]
//                        } else if (any == "空气质量") {
//                            airQuality[key] = mapObj[key]
//                        } else if (any == "光照") {
//                            illumination[key] = mapObj[key]
//                        } else if (any == "声强") {
//                            soundIntensity[key] = mapObj[key]
//                        } else if (any == "风速") {
//                            windSpeed[key] = mapObj[key]
//                        } else if (any == "关键指标") {
//                            keyIndic[key] = mapObj[key]
//                        } else {
//                            envParam[key] = mapObj[key]
//                        }
//                    } else {
//                        envParam[key] = mapObj[key]
//                    }
//                } else if (value == opts.PeopleInfo) {
//                    /** 人员信息 */
//                    peopleInfo[key] = mapObj[key]
//                } else if (value == opts.ConsumptionInfo) {
//                    /** 能耗信息 */
//                    val contains = mapTwo.containsKey(key)
//                    if (contains) {
//                        val any = mapTwo[key]
//                        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 == "动态信息"){
//                    /** 动态信息 */
//                    val contains = mapTwo.containsKey(key)
//                    if (contains) {
//                        val any = mapTwo[key]
//                        if (any == "租赁信息") {
//                            leaseInfo[key] = mapObj[key]
//                        } else {
//                            dynamicInfor[key] = mapObj[key]
//                        }
//                    } else {
//                        dynamicInfor[key] = mapObj[key]
//                    }
//                } else if (value == opts.RunParam) {
//                    /** 运行参数 */
//                    val contains = mapTwo.containsKey(key)
//                    if (contains) {
//                        val any = mapTwo[key]
//                        if (any == "环境参数") {
//                            envParamTwo[key] = mapObj[key]
//                        } else if (any == "关键指标") {
//                            keyIndic[key] = mapObj[key]
//                        } else {
//                            runParam[key] = mapObj[key]
//                        }
//                    } else {
//                        runParam[key] = mapObj[key]
//                    }
//                } else if (value == "关联工作历"){
//                    workCalendar[key] = mapObj[key]
//                } else if (value == "反馈参数"){
//                    feedbackParam[key] = mapObj[key]
//                } else if (value == "静态参数"){
//                    staticParam [key] = mapObj[key]
//                } else {
//                    try {
//                        when (key) {
//                            "localId" -> zoneSpace.localId = mapObj[key].toString()
//                            "localName" -> zoneSpace.localName = mapObj[key].toString()
//                            "bimId" -> zoneSpace.bimId = mapObj[key].toString()
//                            "qRCodePic" -> zoneSpace.qRCodePic = mapObj[key].toString()
//                            "bimLocation" -> zoneSpace.bimLocation = mapObj[key].toString()
//                            "roomFuncType" -> zoneSpace.roomFuncType = mapObj[key].toString()
//                            "depth" -> zoneSpace.depth = if (!mapObj[key].toString().isNullOrEmpty()) mapObj.getValue(key)!!.toDoubleOrNull() else null
//                            "width" -> {
////                                logger.info("key1= ${key}*${ infos[key]!!.javaClass.simpleName}****************************************************************")
//                                if (mapObj[key].toString().isNullOrEmpty()) {
//                                    zoneSpace.width = null
//                                } else {
//                                    zoneSpace.width = mapObj[key]!!.toDouble()
//                                }
//                            }
//                            "buildArea" -> zoneSpace.buildArea = if (!mapObj[key].toString().isNullOrEmpty()) mapObj.getValue(key)!!.toDouble() else null
//                            "netArea" -> zoneSpace.netArea = if (!mapObj[key].toString().isNullOrEmpty()) mapObj.getValue(key)!!.toDouble() else null
//                            "height" -> zoneSpace.height = if (!mapObj[key].toString().isNullOrEmpty()) mapObj.getValue(key)!!.toDouble() else null
//                            "elecCap" -> zoneSpace.elecCap = if (!mapObj[key].toString().isNullOrEmpty()) mapObj.getValue(key)!!.toDouble() else null
//                            "pollutionDegree" -> zoneSpace.pollutionDegree = mapObj[key].toString()
//                            "intro" -> zoneSpace.intro
//                            "pic" -> {
//
//                                try {
//                                    val attPicList = JSON.parseArray(mapObj[key].toString(), AttPic::class.java) as ArrayList<AttPic>
//                                    val listTaskPic = ArrayList<TaskPic>()
//                                    for (attPic in attPicList){
//                                        val taskPic = TaskPic()
//                                        taskPic.type = attPic.type
//                                        taskPic.systemId = attPic.systemId
//                                        taskPic.name = attPic.name
//                                        taskPic.key = attPic.key
//                                        taskPic.createTime = attPic.createTime
//                                        listTaskPic.add(taskPic)
//                                    }
//                                    zoneSpace.pic = listTaskPic
//                                } catch (e: Exception) {
//                                    e.printStackTrace()
//                                }
//                            }
//                            "outline" -> {
//
//                                try {
//
//
//                                    val replace1 = mapObj[key].toString().replace("X", "x")
//                                    val replace2 = replace1.replace("Y", "y")
//                                    val replace3 = replace2.replace("Z", "z")
//                                    logger.debug("坐标= ${replace3}")
//                                    val type = object : TypeToken<ArrayList<ArrayList<ArrayList<PointPosition>>>>() {
//                                    }.getType()
//                                    var outline=  Gson().fromJson<ArrayList<ArrayList<ArrayList<PointPosition>>>>(replace3,type)
//                                    zoneSpace.outline = outline
//                                } catch (e: Exception) {
//                                    e.printStackTrace()
//                                }
//                            }
//                        }
//                    } catch (e: Exception) {
//                        e.printStackTrace()
//                    }
//                }
//
//            } else if (key.startsWith("ctm-")) {
//                /** 自定义 */
//                customParam[key] = mapObj[key]
//            }
//        }
//        if (temperatureHumidity.size > 0) {
//            envParam["temperatureHumidity"] = temperatureHumidity
//        }
//        if (pressure.size > 0) {
//            envParam["pressure"] = pressure
//        }
//        if (airQuality.size > 0) {
//            envParam["airQuality"] = airQuality
//        }
//        if (illumination.size > 0) {
//            envParam["illumination"] = illumination
//        }
//        if (soundIntensity.size > 0) {
//            envParam["soundIntensity"] = soundIntensity
//        }
//        if (windSpeed.size > 0) {
//            envParam["windSpeed"] = windSpeed
//        }
//        if (keyIndic.size > 0) {
//            envParam["keyIndic"] = keyIndic
//        }
//
//        if (hourly.size > 0) {
//            consumptionInfo["hourly"] = hourly
//        }
//        if (cumulative.size > 0) {
//            consumptionInfo["cumulative"] = cumulative
//        }
//
//        if (leaseInfo.size>0){
//            dynamicInfor["leaseInfo"] = leaseInfo
//        }
//
//        if (envParamTwo.size>0){
//            runParam["envParam"] = envParamTwo
//        }
//        if (keyIndic.size>0){
//            runParam["keyIndic"] = keyIndic
//        }
//
//        if (workCalendar.size>0){
//            zoneSpace.workCalendar = workCalendar
//        }
//
//        if (dynamicInfor.size > 0){
//            zoneSpace.dynamicInfor = dynamicInfor
//        }
//        if (tenantInfo.size > 0) {
//            zoneSpace.tenantInfo = tenantInfo
//        }
//        if (envParam.size > 0) {
//            zoneSpace.envParam = envParam
//        }
//        if (peopleInfo.size > 0) {
//            zoneSpace.peopleInfo = peopleInfo
//        }
//        if (consumptionInfo.size > 0) {
//            zoneSpace.consumptionInfo = consumptionInfo
//        }
//        if (customParam.size > 0) {
//            zoneSpace.customParam = customParam
//        }
//        if (runParam.size > 0){
//            zoneSpace.runParam = runParam
//        }
//        if (feedbackParam.size > 0){
//            zoneSpace.feedbackParam = feedbackParam
//        }
//        if (staticParam.size > 0){
//            zoneSpace.staticParam = staticParam
//        }
//        return zoneSpace
//    }

    /**
     * 空间转换工具
     *
     * @param projectId     项目 id
     * @param groupCode     集团编码
     * @param mapObj        中台数据对象
     * @return 返回结果
     */
    fun spaceDataConversions(projectId: String,groupCode: String, mapObj: HashMap<String, Any?>): ZoneSpace {
        logger.debug("打印空间 = ${mapObj.toJson()}")
        /** 查建楼层型字典 */
        var dictDefFuncIdList = dictDefFuncIdService.select(
            SFilter.eq("classCode", mapObj["classCode"].toString()),SFilter.eq("projectId", projectId)).exec()
        if (dictDefFuncIdList.isNullOrEmpty()) {
            dictDefFuncIdList = dictDefFuncIdService.select(SFilter.eq("type", "commo"),
                SFilter.eq("classCode", mapObj["classCode"].toString())).exec()
        }
        logger.debug("字典 = ${dictDefFuncIdList.size}")
        val mapEx = HashMap<String, Any?>()
        val mapCode = HashMap<String, Any?>()
        /** 遍历项目类型字典 */
        for (explainProject in dictDefFuncIdList) {
            /** 输入类型 */
            mapEx[explainProject.code!!] = explainProject.dataType
            mapCode[explainProject.code!!] = explainProject.category
        }

        val zoneSpace = ZoneSpace()
        zoneSpace.projectId = projectId
        zoneSpace.classCode = mapObj["classCode"].toString()
        for (key in mapObj.keys) {
            val containsKey = mapEx.containsKey(key)
            if (containsKey){
                if (key != "id"&& key!="name"&&key!="localId"&&key!="localName"&&key!="defaultQRCode"
                    &&key!="qRCodePic"&&key!="outline"&&key!="roomSerial"&&key!="roomFuncType"&&key!="depth"
                    &&key!="width"&&key!="bimId"&&key!="bimLocation"&&key!="buildArea"&&key!="netArea"&&key!="height"
                    &&key!="zoneOrientation"&&key!="elecCap"&&key!="pollutionDegree"&&key!="permanentPeopleNum"&&key!="intro"
                    &&key!="pic"&&key!="projRoomFuncType"){
                    val containsKey1 = mapCode.containsKey(key)
                    if (containsKey1){
                        val any = mapCode[key].toString()
                        if (any == "STATIC"){
                            when(mapEx[key].toString()) {
                                "INTEGER" -> {
                                    if (zoneSpace.infos.isNullOrEmpty()){
                                        zoneSpace.infos = HashMap<String,Any?>()
                                    }
                                    zoneSpace.infos!![key] = mapObj[key]!!.toInt()
                                }
                                "DOUBLE" -> {
                                    if (zoneSpace.infos.isNullOrEmpty()){
                                        zoneSpace.infos = HashMap<String,Any?>()
                                    }
                                    zoneSpace.infos!![key] = mapObj[key]!!.toString().toDoubleOrNull()
                                }
                                "BOOLEAN" -> {
                                    if (zoneSpace.infos.isNullOrEmpty()){
                                        zoneSpace.infos = HashMap<String,Any?>()
                                    }
                                    zoneSpace.infos!![key] = mapObj[key]
                                }
                                "STRING" -> {
                                    if (zoneSpace.infos.isNullOrEmpty()){
                                        zoneSpace.infos = HashMap<String,Any?>()
                                    }
                                    zoneSpace.infos!![key] = mapObj[key]!!.toString()
                                }
                                "DATETIME" -> {
                                    if (zoneSpace.infos.isNullOrEmpty()){
                                        zoneSpace.infos = HashMap<String,Any?>()
                                    }
                                    zoneSpace.infos!![key] = mapObj[key]
                                }
                                "ATTACHMENT" -> {
                                    if (zoneSpace.infos.isNullOrEmpty()){
                                        zoneSpace.infos = HashMap<String,Any?>()
                                    }
                                    zoneSpace.infos!![key] = mapObj[key]
                                }
                                "OBJECT" -> {
                                    if (zoneSpace.infos.isNullOrEmpty()){
                                        zoneSpace.infos = HashMap<String,Any?>()
                                    }
                                    zoneSpace.infos!![key] = mapObj[key]
                                }
                                "ENUM" -> {
                                    if (zoneSpace.infos.isNullOrEmpty()){
                                        zoneSpace.infos = HashMap<String,Any?>()
                                    }
                                    zoneSpace.infos!![key] = mapObj[key]
                                }
                                "MENUM" -> {
                                    if (zoneSpace.infos.isNullOrEmpty()){
                                        zoneSpace.infos = HashMap<String,Any?>()
                                    }
                                    zoneSpace.infos!![key] = mapObj[key]
                                }
                                else -> {
                                    if (zoneSpace.infos.isNullOrEmpty()){
                                        zoneSpace.infos = HashMap<String,Any?>()
                                    }
                                    zoneSpace.infos!![key] = mapObj[key]!!.toString()
                                }
                            }
                        }else{
                            if (zoneSpace.infos.isNullOrEmpty()){
                                zoneSpace.infos = HashMap<String,Any?>()
                            }
                            zoneSpace.infos!![key] = mapObj[key]!!.toString()
                        }
                    }

                } else {
                    when(key) {
                        "id" -> zoneSpace.id =  mapObj[key]!!.toString()
                        "name" -> zoneSpace.name =  mapObj[key]!!.toString()
                        "localId" -> zoneSpace.localId =  mapObj[key]!!.toString()
                        "localName" -> zoneSpace.localName =  mapObj[key]!!.toString()
                        "defaultQRCode" -> zoneSpace.defaultQRCode =  mapObj[key]!!.toString()
//                        "qRCodePic" -> zoneSpace.qRCodePic =  mapObj[key]!!.toString()
                        "roomSerial" -> zoneSpace.roomSerial =  mapObj[key]!!.toString().toDoubleOrNull()
                        "roomFuncType" -> zoneSpace.roomFuncType =  mapObj[key]!!.toString()
                        "depth" -> zoneSpace.depth =  mapObj[key]!!.toString().toDoubleOrNull()
                        "width" -> zoneSpace.width =  mapObj[key]!!.toString().toDoubleOrNull()
                        "buildArea" -> zoneSpace.buildArea =  mapObj[key]!!.toString().toDoubleOrNull()
                        "bimId" -> zoneSpace.bimId =  mapObj[key]!!.toString()
                        "bimLocation" -> zoneSpace.bimLocation =  mapObj[key]!!.toString()
                        "netArea" -> zoneSpace.netArea =  mapObj[key]!!.toString().toDoubleOrNull()
                        "height" -> zoneSpace.height =  mapObj[key]!!.toString().toDoubleOrNull()
                        "zoneOrientation" -> zoneSpace.zoneOrientation =  mapObj[key]!!.toString()
                        "elecCap" -> zoneSpace.elecCap =  mapObj[key]!!.toString().toDoubleOrNull()
                        "pollutionDegree" -> zoneSpace.pollutionDegree =  mapObj[key]!!.toString()
                        "permanentPeopleNum" -> zoneSpace.permanentPeopleNum =  mapObj[key]!!.toString().toInt()
                        "intro" -> zoneSpace.intro =  mapObj[key]!!.toString()
                        "projRoomFuncType" -> zoneSpace.projRoomFuncType =  mapObj[key]!!.toString()
                        "pic" -> {
                            try {
                                val attPicList = JSON.parseArray(mapObj[key].toString(), AttPic::class.java) as ArrayList<AttPic>
                                val listTaskPic = ArrayList<TaskPic>()
                                for (attPic in attPicList){
                                    val taskPic = TaskPic()
                                    taskPic.type = attPic.type
                                    taskPic.systemId = attPic.systemId
                                    taskPic.name = attPic.name
                                    taskPic.key = attPic.key
                                    taskPic.createTime = attPic.createTime
                                    listTaskPic.add(taskPic)
                                }
                                zoneSpace.pic = listTaskPic
                            } catch (e: Exception) {
                                e.printStackTrace()
                            }
                        }
                        "outline" -> {
                            try {
//                                val replace1 = mapObj[key].toString().replace("X", "x")
//                                val replace2 = replace1.replace("Y", "y")
//                                val replace3 = replace2.replace("Z", "z")
                                logger.debug("**********************************************************************************")
                                val type = object : TypeToken<ArrayList<ArrayList<ArrayList<PointPosition>>>>() {
                                }.type
                                var outline=  Gson().fromJson<ArrayList<ArrayList<ArrayList<PointPosition>>>>(mapObj[key].toString(),type)
                                zoneSpace.outline = outline
                                logger.debug("/////////////////////////////////////////////////////////////////////")
                            } catch (e: Exception) {
                                e.printStackTrace()
                            }
                        }
                    }
                }
            } else {
//                if (zoneSpace.infos.isNullOrEmpty()){
//                    zoneSpace.infos = HashMap<String,Any?>()
//                }
//                zoneSpace.infos!![key] =  mapObj[key]!!.toString()
            }
        }

        return zoneSpace
    }

    /**
     * 空间工具
     *
     * @param projectId     项目 id
     * @param zoneSpace     空间对象
     * @return 返回结果
     */
    fun spaceTools(projectId: String,zoneSpace: ZoneSpace): ArrayList<HashMap<String,Any?>> {
        var list = ArrayList<HashMap<String,Any?>>()
        val hashMap = HashMap<String, Any?>()
        hashMap["id"] = zoneSpace.id
        hashMap["name"] = zoneSpace.name
        hashMap["projectId"] = projectId
        hashMap["objType"] = "space"
        hashMap["classCode"] = zoneSpace.classCode
        if (!zoneSpace.localName.isNullOrEmpty()){
            hashMap["localName"] = zoneSpace.localName
        }
        if (!zoneSpace.localId.isNullOrEmpty()){
            hashMap["localId"] = zoneSpace.localId
        }
        if (!zoneSpace.defaultQRCode.isNullOrEmpty()){
            hashMap["defaultQRCode"] = zoneSpace.defaultQRCode
        }
        if (!zoneSpace.qRCodePic.isNullOrEmpty()){
            hashMap["qRCodePic"] = zoneSpace.qRCodePic
        }
        if (zoneSpace.roomSerial!=null&&zoneSpace.roomSerial!=0.0){
            hashMap["roomSerial"] = zoneSpace.roomSerial
        }
        if (!zoneSpace.roomFuncType.isNullOrEmpty()){
            hashMap["roomFuncType"] = zoneSpace.roomFuncType
        }
        if (!zoneSpace.bimId.isNullOrEmpty()){
            hashMap["bimId"] = zoneSpace.bimId
        }
        if (!zoneSpace.bimLocation.isNullOrEmpty()){
            hashMap["bimLocation"] = zoneSpace.bimLocation
        }
        if (!zoneSpace.outline.isNullOrEmpty()){
            hashMap["outline"] = zoneSpace.outline!!.toJson()
        }
        if (zoneSpace.permanentPeopleNum!=null&&zoneSpace.permanentPeopleNum!=0){
            hashMap["permanentPeopleNum"] = zoneSpace.permanentPeopleNum
        }
        if (zoneSpace.depth!=null&&zoneSpace.depth!=0.0){
            hashMap["depth"] = zoneSpace.depth
        }
        if (zoneSpace.width!=null&&zoneSpace.width!=0.0){
            hashMap["width"] = zoneSpace.width
        }
        if (zoneSpace.buildArea!=null&&zoneSpace.buildArea!=0.0){
            hashMap["buildArea"] = zoneSpace.buildArea
        }
        if (zoneSpace.netArea!=null&&zoneSpace.netArea!=0.0){
            hashMap["netArea"] = zoneSpace.netArea
        }
        if (zoneSpace.height!=null&&zoneSpace.height!=0.0){
            hashMap["height"] = zoneSpace.height
        }
        if (zoneSpace.elecCap!=null&&zoneSpace.elecCap!=0.0){
            hashMap["elecCap"] = zoneSpace.elecCap
        }
        if (!zoneSpace.zoneOrientation.isNullOrEmpty()){
            hashMap["zoneOrientation"] = zoneSpace.zoneOrientation
        }
        if (!zoneSpace.pollutionDegree.isNullOrEmpty()){
            hashMap["pollutionDegree"] = zoneSpace.pollutionDegree
        }
        if (!zoneSpace.intro.isNullOrEmpty()){
            hashMap["intro"] = zoneSpace.intro
        }
        if (!zoneSpace.projRoomFuncType.isNullOrEmpty()){
            hashMap["projRoomFuncType"] = zoneSpace.projRoomFuncType
        }
        if (!zoneSpace.pic.isNullOrEmpty()){
            hashMap["pic"] = zoneSpace.pic
        }
        if (!zoneSpace.infos.isNullOrEmpty()){
            for (key in zoneSpace.infos!!.keys){
                hashMap[key] = zoneSpace.infos!![key]
            }
        }

        list.add(hashMap)
        return list
    }

}