|
@@ -2361,6 +2361,7 @@ object EquipUtil {
|
|
|
* 设备转换
|
|
|
*/
|
|
|
fun equipSyns(projectId: String,groupCode: String, mapObj: HashMap<String, Any?>): Equipment {
|
|
|
+ val equipment = Equipment()
|
|
|
/** 查建楼层型字典 */
|
|
|
val dictDefFuncIdList = dictDefFuncIdService.select(SFilter.eq("groupCode", groupCode),SFilter.eq("projectId", projectId), SFilter.eq("classCode", mapObj["classCode"].toString())).exec()
|
|
|
val mapEx = HashMap<String, Any?>()
|
|
@@ -2372,114 +2373,173 @@ object EquipUtil {
|
|
|
mapCode[explainProject.code!!] = explainProject.category
|
|
|
}
|
|
|
logger.debug("打印= ${mapObj.toJson()}")
|
|
|
- val equipment = Equipment()
|
|
|
+
|
|
|
equipment.projectId = projectId
|
|
|
equipment.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!="rfId"&&key!="cadId"&&key!="bimFamilyName"&&key!="bimFamilySymbol"
|
|
|
- &&key!="bimTypeId"&&key!="bimId"&&key!="bimLocation"&&key!="equipSerial"){
|
|
|
- val containsKey1 = mapCode.containsKey(key)
|
|
|
- if (containsKey1){
|
|
|
- val any = mapCode[key].toString()
|
|
|
- if (any == "STATIC"){
|
|
|
- when(mapEx[key].toString()) {
|
|
|
- "INTEGER" -> {
|
|
|
- if (equipment.infos.isNullOrEmpty()){
|
|
|
- equipment.infos = HashMap<String,Any?>()
|
|
|
+ equipment.id = mapObj["id"]!!.toString()
|
|
|
+ equipment.name = mapObj["name"]!!.toString()
|
|
|
+ val containsKey2 = mapObj.containsKey("localId")
|
|
|
+ if (containsKey2) {
|
|
|
+ equipment.localId = mapObj["localId"]!!.toString()
|
|
|
+ }
|
|
|
+ val containsKey3 = mapObj.containsKey("localId")
|
|
|
+ if (containsKey3) {
|
|
|
+ equipment.localName = mapObj["localName"]!!.toString()
|
|
|
+ }
|
|
|
+ val containsKey4 = mapObj.containsKey("defaultQRCode")
|
|
|
+ if (containsKey4) {
|
|
|
+ equipment.defaultQRCode = mapObj["defaultQRCode"]!!.toString()
|
|
|
+ }
|
|
|
+ val containsKey5 = mapObj.containsKey("rfId")
|
|
|
+ if (containsKey5) {
|
|
|
+ equipment.rfId = mapObj["rfId"]!!.toString()
|
|
|
+ }
|
|
|
+ val containsKey6 = mapObj.containsKey("cadId")
|
|
|
+ if (containsKey6) {
|
|
|
+ equipment.cadId = mapObj["cadId"]!!.toString()
|
|
|
+ }
|
|
|
+ val containsKey7 = mapObj.containsKey("cADID")
|
|
|
+ if (containsKey7) {
|
|
|
+ equipment.cadId = mapObj["cADID"]!!.toString()
|
|
|
+ }
|
|
|
+ val containsKey8 = mapObj.containsKey("bimFamilyName")
|
|
|
+ if (containsKey8) {
|
|
|
+ equipment.bimFamilyName = mapObj["bimFamilyName"]!!.toString()
|
|
|
+ }
|
|
|
+ val containsKey9 = mapObj.containsKey("bimFamilySymbol")
|
|
|
+ if (containsKey9) {
|
|
|
+ equipment.bimFamilySymbol = mapObj["bimFamilySymbol"]!!.toString()
|
|
|
+ }
|
|
|
+ val containsKey10 = mapObj.containsKey("bimTypeId")
|
|
|
+ if (containsKey10) {
|
|
|
+ equipment.bimTypeId = mapObj["bimTypeId"]!!.toString()
|
|
|
+ }
|
|
|
+ val containsKey11 = mapObj.containsKey("bimId")
|
|
|
+ if (containsKey11) {
|
|
|
+ equipment.bimId = mapObj["bimId"]!!.toString()
|
|
|
+ }
|
|
|
+ val containsKey12 = mapObj.containsKey("bimLocation")
|
|
|
+ if (containsKey12) {
|
|
|
+ equipment.bimLocation = mapObj["bimLocation"]!!.toString()
|
|
|
+ }
|
|
|
+ val containsKey13 = mapObj.containsKey("equipSerial")
|
|
|
+ if (containsKey13) {
|
|
|
+ equipment.equipSerial = mapObj["equipSerial"]!!.toString().toDoubleOrNull()
|
|
|
+ }
|
|
|
+
|
|
|
+ try {
|
|
|
+ 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!="rfId"&&key!="cadId"&&key!="bimFamilyName"&&key!="bimFamilySymbol"
|
|
|
+ &&key!="bimTypeId"&&key!="bimId"&&key!="bimLocation"&&key!="equipSerial"){
|
|
|
+ val containsKey1 = mapCode.containsKey(key)
|
|
|
+ if (containsKey1){
|
|
|
+ val any = mapCode[key].toString()
|
|
|
+ if (any == "STATIC"){
|
|
|
+ when(mapEx[key].toString()) {
|
|
|
+ "INTEGER" -> {
|
|
|
+ if (equipment.infos.isNullOrEmpty()){
|
|
|
+ equipment.infos = HashMap<String,Any?>()
|
|
|
+ }
|
|
|
+ equipment.infos!![key] = mapObj[key]!!.toInt()
|
|
|
}
|
|
|
- equipment.infos!![key] = mapObj[key]!!.toInt()
|
|
|
- }
|
|
|
- "DOUBLE" -> {
|
|
|
- if (equipment.infos.isNullOrEmpty()){
|
|
|
- equipment.infos = HashMap<String,Any?>()
|
|
|
+ "DOUBLE" -> {
|
|
|
+ if (equipment.infos.isNullOrEmpty()){
|
|
|
+ equipment.infos = HashMap<String,Any?>()
|
|
|
+ }
|
|
|
+ equipment.infos!![key] = mapObj[key]!!.toString().toDoubleOrNull()
|
|
|
}
|
|
|
- equipment.infos!![key] = mapObj[key]!!.toString().toDoubleOrNull()
|
|
|
- }
|
|
|
- "BOOLEAN" -> {
|
|
|
- if (equipment.infos.isNullOrEmpty()){
|
|
|
- equipment.infos = HashMap<String,Any?>()
|
|
|
+ "BOOLEAN" -> {
|
|
|
+ if (equipment.infos.isNullOrEmpty()){
|
|
|
+ equipment.infos = HashMap<String,Any?>()
|
|
|
+ }
|
|
|
+ equipment.infos!![key] = mapObj[key]!!.toString().toBoolean()
|
|
|
}
|
|
|
- equipment.infos!![key] = mapObj[key]!!.toString().toBoolean()
|
|
|
- }
|
|
|
- "STRING" -> {
|
|
|
- if (equipment.infos.isNullOrEmpty()){
|
|
|
- equipment.infos = HashMap<String,Any?>()
|
|
|
+ "STRING" -> {
|
|
|
+ if (equipment.infos.isNullOrEmpty()){
|
|
|
+ equipment.infos = HashMap<String,Any?>()
|
|
|
+ }
|
|
|
+ equipment.infos!![key] = mapObj[key]!!.toString()
|
|
|
}
|
|
|
- equipment.infos!![key] = mapObj[key]!!.toString()
|
|
|
- }
|
|
|
- "DATETIME" -> {
|
|
|
- if (equipment.infos.isNullOrEmpty()){
|
|
|
- equipment.infos = HashMap<String,Any?>()
|
|
|
+ "DATETIME" -> {
|
|
|
+ if (equipment.infos.isNullOrEmpty()){
|
|
|
+ equipment.infos = HashMap<String,Any?>()
|
|
|
+ }
|
|
|
+ equipment.infos!![key] = mapObj[key]!!.toString()
|
|
|
}
|
|
|
- equipment.infos!![key] = mapObj[key]!!.toString()
|
|
|
- }
|
|
|
- "ATTACHMENT" -> {
|
|
|
- if (equipment.infos.isNullOrEmpty()){
|
|
|
- equipment.infos = HashMap<String,Any?>()
|
|
|
+ "ATTACHMENT" -> {
|
|
|
+ if (equipment.infos.isNullOrEmpty()){
|
|
|
+ equipment.infos = HashMap<String,Any?>()
|
|
|
+ }
|
|
|
+ equipment.infos!![key] = mapObj[key]!!.toString()
|
|
|
}
|
|
|
- equipment.infos!![key] = mapObj[key]!!.toString()
|
|
|
- }
|
|
|
- "OBJECT" -> {
|
|
|
- if (equipment.infos.isNullOrEmpty()){
|
|
|
- equipment.infos = HashMap<String,Any?>()
|
|
|
+ "OBJECT" -> {
|
|
|
+ if (equipment.infos.isNullOrEmpty()){
|
|
|
+ equipment.infos = HashMap<String,Any?>()
|
|
|
+ }
|
|
|
+ equipment.infos!![key] = mapObj[key]!!.toString()
|
|
|
}
|
|
|
- equipment.infos!![key] = mapObj[key]!!.toString()
|
|
|
- }
|
|
|
- "ENUM" -> {
|
|
|
- if (equipment.infos.isNullOrEmpty()){
|
|
|
- equipment.infos = HashMap<String,Any?>()
|
|
|
+ "ENUM" -> {
|
|
|
+ if (equipment.infos.isNullOrEmpty()){
|
|
|
+ equipment.infos = HashMap<String,Any?>()
|
|
|
+ }
|
|
|
+ equipment.infos!![key] = mapObj[key]!!.toString()
|
|
|
}
|
|
|
- equipment.infos!![key] = mapObj[key]!!.toString()
|
|
|
- }
|
|
|
- "MENUM" -> {
|
|
|
- if (equipment.infos.isNullOrEmpty()){
|
|
|
- equipment.infos = HashMap<String,Any?>()
|
|
|
+ "MENUM" -> {
|
|
|
+ if (equipment.infos.isNullOrEmpty()){
|
|
|
+ equipment.infos = HashMap<String,Any?>()
|
|
|
+ }
|
|
|
+ equipment.infos!![key] = mapObj[key]!!.toString()
|
|
|
}
|
|
|
- equipment.infos!![key] = mapObj[key]!!.toString()
|
|
|
- }
|
|
|
- else -> {
|
|
|
- if (equipment.infos.isNullOrEmpty()){
|
|
|
- equipment.infos = HashMap<String,Any?>()
|
|
|
+ else -> {
|
|
|
+ if (equipment.infos.isNullOrEmpty()){
|
|
|
+ equipment.infos = HashMap<String,Any?>()
|
|
|
+ }
|
|
|
+ equipment.infos!![key] = mapObj[key]!!.toString()
|
|
|
}
|
|
|
- equipment.infos!![key] = mapObj[key]!!.toString()
|
|
|
}
|
|
|
+ }else{
|
|
|
+ if (equipment.infos.isNullOrEmpty()){
|
|
|
+ equipment.infos = HashMap<String,Any?>()
|
|
|
+ }
|
|
|
+ equipment.infos!![key] = mapObj[key]!!.toString()
|
|
|
}
|
|
|
- }else{
|
|
|
- if (equipment.infos.isNullOrEmpty()){
|
|
|
- equipment.infos = HashMap<String,Any?>()
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ try {
|
|
|
+ when(key) {
|
|
|
+ "id" -> equipment.id = mapObj[key]!!.toString()
|
|
|
+ "name" -> equipment.name = mapObj[key]!!.toString()
|
|
|
+ "localId" -> equipment.localId = mapObj[key]!!.toString()
|
|
|
+ "localName" -> equipment.localName = mapObj[key]!!.toString()
|
|
|
+ "defaultQRCode" -> equipment.defaultQRCode = mapObj[key]!!.toString()
|
|
|
+ "qRCodePic" -> equipment.qRCodePic = mapObj[key]!!.toString()
|
|
|
+ "rfId" -> equipment.rfId = mapObj[key]!!.toString()
|
|
|
+ "cadId" -> equipment.cadId = mapObj[key]!!.toString()
|
|
|
+ "bimFamilyName" -> equipment.bimFamilyName = mapObj[key]!!.toString()
|
|
|
+ "bimFamilySymbol" -> equipment.bimFamilySymbol = mapObj[key]!!.toString()
|
|
|
+ "bimTypeId" -> equipment.bimTypeId = mapObj[key]!!.toString()
|
|
|
+ "bimId" -> equipment.bimId = mapObj[key]!!.toString()
|
|
|
+ "bimLocation" -> equipment.bimLocation = mapObj[key]!!.toString()
|
|
|
+ "equipSerial" -> equipment.equipSerial = mapObj[key]!!.toString().toDoubleOrNull()
|
|
|
}
|
|
|
- equipment.infos!![key] = mapObj[key]!!.toString()
|
|
|
+ } catch (e: Exception) {
|
|
|
+ e.printStackTrace()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
- when(key) {
|
|
|
- "id" -> equipment.id = mapObj[key]!!.toString()
|
|
|
- "name" -> equipment.name = mapObj[key]!!.toString()
|
|
|
- "localId" -> equipment.localId = mapObj[key]!!.toString()
|
|
|
- "localName" -> equipment.localName = mapObj[key]!!.toString()
|
|
|
- "defaultQRCode" -> equipment.defaultQRCode = mapObj[key]!!.toString()
|
|
|
- "qRCodePic" -> equipment.qRCodePic = mapObj[key]!!.toString()
|
|
|
- "rfId" -> equipment.rfId = mapObj[key]!!.toString()
|
|
|
- "cadId" -> equipment.cadId = mapObj[key]!!.toString()
|
|
|
- "bimFamilyName" -> equipment.bimFamilyName = mapObj[key]!!.toString()
|
|
|
- "bimFamilySymbol" -> equipment.bimFamilySymbol = mapObj[key]!!.toString()
|
|
|
- "bimTypeId" -> equipment.bimTypeId = mapObj[key]!!.toString()
|
|
|
- "bimId" -> equipment.bimId = mapObj[key]!!.toString()
|
|
|
- "bimLocation" -> equipment.bimLocation = mapObj[key]!!.toString()
|
|
|
- "equipSerial" -> equipment.equipSerial = mapObj[key]!!.toString().toDoubleOrNull()
|
|
|
- }
|
|
|
+ // if (equipment.infos.isNullOrEmpty()){
|
|
|
+ // equipment.infos = HashMap<String,Any?>()
|
|
|
+ // }
|
|
|
+ // equipment.infos!![key] = mapObj[key]!!.toString()
|
|
|
}
|
|
|
-
|
|
|
- } else {
|
|
|
-// if (equipment.infos.isNullOrEmpty()){
|
|
|
-// equipment.infos = HashMap<String,Any?>()
|
|
|
-// }
|
|
|
-// equipment.infos!![key] = mapObj[key]!!.toString()
|
|
|
}
|
|
|
+ } catch (e: Exception) {
|
|
|
+ e.printStackTrace()
|
|
|
}
|
|
|
|
|
|
return equipment
|