소스 검색

空间显示名称

lihao 3 년 전
부모
커밋
417e39cd05
2개의 변경된 파일72개의 추가작업 그리고 72개의 파일을 삭제
  1. 1 1
      demo/src/main/java/com/framework/app/Constants.kt
  2. 71 71
      demo/src/main/java/com/sybotan/android/demo/viewmodel/SpaceMapVM.kt

+ 1 - 1
demo/src/main/java/com/framework/app/Constants.kt

@@ -11,7 +11,7 @@ const val tencentIP = "http://82.157.28.170:8876/"
 
 const val JdIP = "http://82.157.151.123/adm-poc-backend/"
 
-const val IP = test2IP
+const val IP = JdIP
 
 const val devFileServiceUrl = "http://develop.persagy.com/image-service/"
 

+ 71 - 71
demo/src/main/java/com/sybotan/android/demo/viewmodel/SpaceMapVM.kt

@@ -38,11 +38,11 @@ import java.io.File
  * Date: 2021/6/9
  */
 class SpaceMapVM(
-    app: Application,
-    b: BaseViewModelInterface?, activity: BaseActivity?, //建筑id
-    private val buildingId: String, //楼层id
-    private val floorId: String,
-    private val projectId: String
+        app: Application,
+        b: BaseViewModelInterface?, activity: BaseActivity?, //建筑id
+        private val buildingId: String, //楼层id
+        private val floorId: String,
+        private val projectId: String
 ) : BaseViewModel(app, b, activity), DIAware {
     private val gson = Gson()
 
@@ -69,7 +69,7 @@ class SpaceMapVM(
                 if (objectEntity != null) {
                     spaceJobModel.buildingId = buildingId
                     spaceJobModel.id = spaceEntity.spaceId
-                    spaceJobModel.localName = ObjectNameUtils.getEquipName(objectEntity)
+                    spaceJobModel.localName = objectEntity.localName + ObjectNameUtils.getEquipName(objectEntity)
                     spaceJobModel.name = objectEntity.name
                     spaceJobModel.projectId = projectId
                     val infos = gson.fromJson(objectEntity.infos, InfosForObj::class.java)
@@ -90,19 +90,19 @@ class SpaceMapVM(
                     }
                     for (problem in problems) {
                         val geomList = gson.fromJson<List<PointF>>(
-                            problem.geom,
-                            object : TypeToken<List<PointF?>?>() {}.type
+                                problem.geom,
+                                object : TypeToken<List<PointF?>?>() {}.type
                         )
                         for (gemo in geomList) {
                             val pointF = if (geomList.size == 1) {
                                 android.graphics.Point(
-                                    gemo.x.toInt(),
-                                    -gemo.y.toInt()
+                                        gemo.x.toInt(),
+                                        -gemo.y.toInt()
                                 )
                             } else {
                                 android.graphics.Point(
-                                    gemo.x.toInt(),
-                                    gemo.y.toInt()
+                                        gemo.x.toInt(),
+                                        gemo.y.toInt()
                                 )
                             }
                             if (Lasso.isPolygonContainsPoint(list, pointF)) {
@@ -135,13 +135,13 @@ class SpaceMapVM(
      * @param y          y坐标
      */
     fun addProblem(
-        point: PointItem?,
-        photos: ArrayList<Photos>,
-        content: String,
-        x: Float,
-        y: Float,
-        linePoints: ArrayList<PipeLineItem>,
-        isLine: Boolean
+            point: PointItem?,
+            photos: ArrayList<Photos>,
+            content: String,
+            x: Float,
+            y: Float,
+            linePoints: ArrayList<PipeLineItem>,
+            isLine: Boolean
     ) {
         viewModelScope.launch {
             //插入问题数据
@@ -172,16 +172,16 @@ class SpaceMapVM(
             }
 
             val problem = ProblemArchEntity(
-                id = toString,
-                floorId = floorId,
-                projectId = projectId,
-                buildingId = buildingId,
-                geomType = if (array.size == 1) "point" else "line",
-                problemState = 1,
-                message = content,
-                valid = 1,
-                state = 0,
-                geom = toJson
+                    id = toString,
+                    floorId = floorId,
+                    projectId = projectId,
+                    buildingId = buildingId,
+                    geomType = if (array.size == 1) "point" else "line",
+                    problemState = 1,
+                    message = content,
+                    valid = 1,
+                    state = 0,
+                    geom = toJson
             )
             repo.insProblem(problem)
 
@@ -196,17 +196,17 @@ class SpaceMapVM(
                     }
 
                     val file = FileEntity(
-                        id = uuid,
-                        bizType = "problem_arch",
-                        filePath = photo.key,
-                        fileType = "photo",
-                        clientPath = photo.path,
-                        refObjId = toString,
-                        orderNum = order,
-                        projectId = projectId,
-                        buildingId = buildingId,
-                        floorId = floorId,
-                        state = 0
+                            id = uuid,
+                            bizType = "problem_arch",
+                            filePath = photo.key,
+                            fileType = "photo",
+                            clientPath = photo.path,
+                            refObjId = toString,
+                            orderNum = order,
+                            projectId = projectId,
+                            buildingId = buildingId,
+                            floorId = floorId,
+                            state = 0
                     )
                     repo.insFile(file)
                 }
@@ -233,8 +233,8 @@ class SpaceMapVM(
                     promodel.id = problem.id
 
                     val geomList = gson.fromJson<List<PointF>>(
-                        problem.geom,
-                        object : TypeToken<List<PointF?>?>() {}.type
+                            problem.geom,
+                            object : TypeToken<List<PointF?>?>() {}.type
                     )
                     promodel.geomType = problem.geomType
                     if (problem.geomType!! == "point") {
@@ -288,15 +288,15 @@ class SpaceMapVM(
             pointZ.z = toString.toFloat()
             val toJson = gson.toJsonTree(pointZ)
             val qrcode = QrCodeEntity(
-                id = IdUtil.simpleUUID(),
-                qrCode = result!!,
-                objId = choseSpace!!.data.id!!,
-                projectId = projectId,
-                buildingId = buildingId,
-                floorId = floorId,
-                remark = "wall",
-                state = 0,
-                location = toJson
+                    id = IdUtil.simpleUUID(),
+                    qrCode = result!!,
+                    objId = choseSpace!!.data.id!!,
+                    projectId = projectId,
+                    buildingId = buildingId,
+                    floorId = floorId,
+                    remark = "wall",
+                    state = 0,
+                    location = toJson
             )
             repo.insQrcode(qrcode)
             mEmitter.SendDirective(BIND_QECODE, null)
@@ -398,14 +398,14 @@ class SpaceMapVM(
             var entity = repo.getServeAreaByObjId(deviceId)
             if (entity == null) {
                 entity = ServeAreaEntity(
-                    id = IdUtil.simpleUUID(),
-                    projectId = projectId,
-                    buildingId = buildingId,
-                    floorId = floorId,
-                    state = 0,
-                    objId = deviceId,
-                    geomType = "polygon",
-                    geom = gson.toJsonTree(geom),
+                        id = IdUtil.simpleUUID(),
+                        projectId = projectId,
+                        buildingId = buildingId,
+                        floorId = floorId,
+                        state = 0,
+                        objId = deviceId,
+                        geomType = "polygon",
+                        geom = gson.toJsonTree(geom),
                 )
             } else {
                 entity.geom = gson.toJsonTree(geom)
@@ -425,14 +425,14 @@ class SpaceMapVM(
             var entity = repo.getServeAreaByObjId(deviceId)
             if (entity == null) {
                 entity = ServeAreaEntity(
-                    id = IdUtil.simpleUUID(),
-                    projectId = projectId,
-                    buildingId = buildingId,
-                    floorId = floorId,
-                    state = 0,
-                    objId = deviceId,
-                    geomType = "polygon",
-                    geom = gson.toJsonTree(geom),
+                        id = IdUtil.simpleUUID(),
+                        projectId = projectId,
+                        buildingId = buildingId,
+                        floorId = floorId,
+                        state = 0,
+                        objId = deviceId,
+                        geomType = "polygon",
+                        geom = gson.toJsonTree(geom),
                 )
             } else {
                 entity.geom = gson.toJsonTree(geom)
@@ -450,14 +450,14 @@ class SpaceMapVM(
                 val array = entity.geom!!.asJsonArray
                 if (array[0].isJsonObject) {
                     val ar = gson.fromJson<List<PointF>>(
-                        gson.toJson(entity.geom),
-                        object : TypeToken<List<PointF?>?>() {}.type
+                            gson.toJson(entity.geom),
+                            object : TypeToken<List<PointF?>?>() {}.type
                     )
                     mEmitter.SendDirective(SERVE_AREA, ar)
                 } else {
                     val ar = gson.fromJson<List<ArrayList<ArrayList<PointZ>>>>(
-                        gson.toJson(entity.geom),
-                        object : TypeToken<List<ArrayList<ArrayList<PointZ>>>>() {}.type
+                            gson.toJson(entity.geom),
+                            object : TypeToken<List<ArrayList<ArrayList<PointZ>>>>() {}.type
                     )
                     mEmitter.SendDirective(SERVE_AREAS, ar)
                 }