Browse Source

feat bug fix

lihao1 2 years ago
parent
commit
96de81826e

+ 12 - 10
demo/src/main/java/com/sybotan/android/demo/viewmodel/ChooseSpaceVM.kt

@@ -261,18 +261,20 @@ class ChooseSpaceVM(
                 }
                 objEntity?.let {
                     val obj = objEntity.infos!!.asJsonObject
-                    val info = gson.fromJson(obj, SpaceInfo::class.java)
-                    equips.add(objEntity)
+                    if (obj["outline"] is ArrayList<*>) {
+                        val info = gson.fromJson(obj, SpaceInfo::class.java)
+                        equips.add(objEntity)
 //                spaces.add(info.outline[0])
 
-                    val tunableSpace = TunableSpace()
-                    tunableSpace.outLine = info.outline
-                    tunableSpace.name = ObjectNameUtils.getEquipName(objEntity)
-                    tunableSpace.id = objEntity.id
-                    val floor = repo.getFloorById(objEntity.floorId!!)
-                    tunableSpace.floorName = floor.localName
-                    tunableSpace.floorId = objEntity.floorId
-                    spaces.add(tunableSpace)
+                        val tunableSpace = TunableSpace()
+                        tunableSpace.outLine = info.outline
+                        tunableSpace.name = ObjectNameUtils.getEquipName(objEntity)
+                        tunableSpace.id = objEntity.id
+                        val floor = repo.getFloorById(objEntity.floorId!!)
+                        tunableSpace.floorName = floor.localName
+                        tunableSpace.floorId = objEntity.floorId
+                        spaces.add(tunableSpace)
+                    }
                 }
             }
             mEmitter.SendDirective(SERVE_AREAS, spaces)

+ 1 - 0
demo/src/main/java/com/sybotan/android/demo/viewmodel/EquipDetailVM.kt

@@ -628,6 +628,7 @@ class EquipDetailVM(
         viewModelScope.launch {
             var rel = repo.getRelById(item.id)
             rel.valid = 0
+            rel.state()
             repo.insRelation(rel)
             getRelConfig(equipEntity!!, deviceId, uuid)
         }