瀏覽代碼

add poc2.0需求

lihao1 3 年之前
父節點
當前提交
38f046834d

+ 1 - 0
demo/src/main/java/com/framework/mvvm/model/db/entity/QrCodeEntity.kt

@@ -25,6 +25,7 @@ data class QrCodeEntity(
     @ColumnInfo(name = "valid") val valid: Int?,                 // 合法标识
     @ColumnInfo(name = "upload_flag") val uploadFlag: String?,      // app端上传数据标记
     @ColumnInfo(name = "location") val location: String?,           // 位置坐标({x:1,y:1,z:1})
+    @ColumnInfo(name = "strLocation") val strLocation: String?,           // 位置坐标({x:1,y:1,z:1})
     @ColumnInfo(name = "state") var state: String? = "0"             // 数据状态:0:未处理,1:已处理 2:已上传
 
 )

+ 10 - 6
demo/src/main/java/com/sybotan/android/demo/activities/EquipDetailActivity.kt

@@ -281,12 +281,16 @@ class EquipDetailActivity : BaseActivity(), View.OnTouchListener {
                     } else {
                         position!!.z.offset = strInfo.location.z.toString()
                     }
-                    for (eq in equips) {
-                        if (equip.classCode.equals(eq.code)) {
-                            this.equipEntity = eq
-                            equipClass.setTvRight(eq.name)
-                            graphyVM.getRelConfig(eq, deviceId, uuid)
-                            break
+                    if (this.equipEntity == null) {
+                        for (eq in equips) {
+                            if (equip.classCode.equals(eq.code)) {
+                                this.equipEntity = eq
+//                            graphyVM.getRelConfig(eq, deviceId, uuid)
+                                equipClass.setTvRight(equipEntity!!.systemName + "/" + equipEntity!!.name)
+                                graphyVM.getEquipInfosConfig(equipEntity!!)
+                                graphyVM.getEquipment(deviceId)
+                                break
+                            }
                         }
                     }
                 }

+ 8 - 4
demo/src/main/java/com/sybotan/android/demo/activities/GraphyActivity.kt

@@ -1116,6 +1116,10 @@ class GraphyActivity : BaseActivity(), ICaptureStatusListener, ICameraChangedCal
                 ToastUtils.showMyToast("请扎点")
                 return@setOnClickListener
             }
+            if (TextUtils.isEmpty(equipEdit.text.toString())) {
+                ToastUtils.showMyToast("请输入高度")
+                return@setOnClickListener
+            }
             val intent = Intent(this, EquipDetailActivity::class.java)
             val bundle = Bundle()
             val positon = Position()
@@ -1735,10 +1739,10 @@ class GraphyActivity : BaseActivity(), ICaptureStatusListener, ICameraChangedCal
                     equipLocation.setText("")
                     equipEdit.setText("")
                     scene.eqItem?.let { it1 -> scene.removeItem(it1) }
-                    roof.isChecked = false
-                    floor.isChecked = false
-                    wall.isChecked = false
-                    air.isChecked = false
+//                    roof.isChecked = false
+//                    floor.isChecked = false
+//                    wall.isChecked = false
+//                    air.isChecked = false
                     scene.point = Point()
                     scene.type = "normal"
                     equipLl.visibility = View.GONE

+ 42 - 38
demo/src/main/java/com/sybotan/android/demo/viewmodel/GraphyVM.kt

@@ -35,6 +35,8 @@ import java.text.SimpleDateFormat
 import java.util.*
 import kotlin.collections.ArrayList
 import kotlin.collections.HashMap
+import com.alibaba.fastjson.JSON
+
 
 /**
  * Created by lihao.
@@ -322,14 +324,14 @@ class GraphyVM(
                 projectId = projectId,
                 buildingId = buildingId,
                 floorId = floorId,
-                location = toJson,
+                strLocation = toJson,
                 remark = "wall",
                 creator = "Anroid",
                 creationTime = time,
                 modifier = "Android",
                 modifiedTime = null,
                 valid = 1,
-                uploadFlag = "", state = "1"
+                uploadFlag = "", state = "1", location = null
             )
             repo.insQrcode(qrcode)
             mEmitter.SendDircetive(BIND_QECODE, null)
@@ -366,7 +368,7 @@ class GraphyVM(
                 var qrcodeModel = QrcodeModel()
                 qrcodeModel.obj_id = qrcode.objId
                 qrcodeModel.qr_code = qrcode.qrCode
-                var pointZ = gson.fromJson(qrcode.location, PointZ::class.java)
+                var pointZ = gson.fromJson(qrcode.strLocation, PointZ::class.java)
                 val position = Position()
                 position.x = pointZ.x.toString()
                 position.y = pointZ.y.toString()
@@ -617,9 +619,9 @@ class GraphyVM(
                 object : TypeToken<List<Infos?>?>() {}.type
             )
             var spaceObject = repo.getObject(spaceId)
-            var infos = spaceObject!!.infos
+            val infos = gson.fromJson(spaceObject!!.strInfos, HashMap::class.java)
 
-            mEmitter.SendDircetive(SPACE_INFOS, jsonObjectToHashMap(infos))
+            mEmitter.SendDircetive(SPACE_INFOS, infos)
             mEmitter.SendDircetive(SPACE_INFO, infoList)
         }
     }
@@ -642,7 +644,7 @@ class GraphyVM(
         viewModelScope.launch {
             var space = repo.getObject(space.id!!)
 //            space!!.infos = JSONObject(hashMap as Map<*, *>)
-            space!!.strInfos = gson.toJson(JSONObject(hashMap as Map<*, *>))
+            space!!.strInfos = gson.toJson(hashMap)
             space.state = "1"
             repo.insObject(space)
             mActivity.setResult(RESULT_OK)
@@ -670,8 +672,8 @@ class GraphyVM(
 
             if (!TextUtils.isEmpty(deviceId)) {
                 var equip = repo.getObject(deviceId)
-                var infos = equip!!.infos
-                mEmitter.SendDircetive(SPACE_INFOS, jsonObjectToHashMap(infos))
+                val infos = gson.fromJson(equip!!.strInfos, HashMap::class.java)
+                mEmitter.SendDircetive(SPACE_INFOS, infos)
                 mEmitter.SendDircetive(Equip_INFOS, equip)
             }
 
@@ -747,7 +749,7 @@ class GraphyVM(
                     deliveryState = null,
                     d2mState = null,
                     virtualCodes = null,
-                    infos = JSONObject(hashMap as Map<*, *>),
+                    infos = null,
                     strInfos = gson.toJson(hashMap),
                     floorMap = null, state = "1"
                 )
@@ -761,37 +763,39 @@ class GraphyVM(
             //插入文件数据
             var order = 0
             for (photo in beans) {
-                if (order != 0) {
-                    var phUuid = ""
-                    if (TextUtils.isEmpty(photo.id)) {
-                        phUuid = UUID.randomUUID().toString().replace("-", "")
-                    } else {
-                        phUuid = photo.id
-                    }
+                if (photo.itemType != 1) {
+                    if (order != 0) {
+                        var phUuid = ""
+                        if (TextUtils.isEmpty(photo.id)) {
+                            phUuid = UUID.randomUUID().toString().replace("-", "")
+                        } else {
+                            phUuid = photo.id
+                        }
 
-                    val file = FileEntity(
-                        id = phUuid,
-                        bizType = "problem_arch",
-                        filePath = photo.key,
-                        fileType = "photo",
-                        clientPath = photo.path,
-                        refObjId = if (TextUtils.isEmpty(deviceId)) uuid else deviceId,
-                        refInfoCode = "",
-                        remark = "",
-                        orderNum = order,
-                        projectId = projectId,
-                        buildingId = buildingId,
-                        floorId = floorId,
-                        creator = "android",
-                        creationTime = "",
-                        modifier = "",
-                        modifiedTime = null,
-                        valid = 1,
-                        uploadFlag = "", state = "1"
-                    )
-                    repo.insFile(file)
+                        val file = FileEntity(
+                            id = phUuid,
+                            bizType = "problem_arch",
+                            filePath = photo.key,
+                            fileType = "photo",
+                            clientPath = photo.path,
+                            refObjId = if (TextUtils.isEmpty(deviceId)) uuid else deviceId,
+                            refInfoCode = "",
+                            remark = "",
+                            orderNum = order,
+                            projectId = projectId,
+                            buildingId = buildingId,
+                            floorId = floorId,
+                            creator = "android",
+                            creationTime = "",
+                            modifier = "",
+                            modifiedTime = null,
+                            valid = 1,
+                            uploadFlag = "", state = "1"
+                        )
+                        repo.insFile(file)
+                    }
+                    order++
                 }
-                order++
             }
             mActivity.setResult(RESULT_OK)
             mActivity.finish()