Browse Source

add poc2.0需求

lihao1 3 years ago
parent
commit
6707f42b08

+ 7 - 2
demo/src/main/java/com/sybotan/android/demo/activities/EquipDetailActivity.kt

@@ -35,6 +35,7 @@ import com.sybotan.android.demo.viewmodel.GraphyVM
 import com.sybotan.base.extensions.toBoolean
 import com.yuyh.library.imgsel.ImageLoader
 import com.yuyh.library.imgsel.ImgSelConfig
+import com.yuyh.library.imgsel.utils.LogUtils
 import io.reactivex.ObservableEmitter
 import org.json.JSONException
 import org.json.JSONObject
@@ -253,20 +254,24 @@ class EquipDetailActivity : BaseActivity(), View.OnTouchListener {
                                 position!!.z.region = zRegion.toString()
                             }
                         }
-                        if (staticInfoAdapter.hashMap != null && staticInfoAdapter.hashMap.get("Photos") != null) {
+                        if (staticInfoAdapter.hashMap != null && staticInfoAdapter.hashMap.get("equipPhoto") != null) {
                             val infoList = Gson().fromJson<List<Photos>>(
-                                staticInfoAdapter.hashMap.get("Photos").toString(),
+                                staticInfoAdapter.hashMap.get("equipPhoto").toString(),
                                 object : TypeToken<List<Photos?>?>() {}.type
                             )
+                            beans.clear()
                             beans.addAll(infoList)
                             pictureAdapter.notifyDataSetChanged()
 
+                        } else {
+                            LogUtils.e("mei")
                         }
                     }
                 }
                 GraphyVM.Equip_INFOS -> {
                     var equip = params as ObjectEntity
                     localId.setEtRight(equip.localId)
+                    deviceId = equip.id
                     val strInfo = Gson().fromJson(equip.strInfos, StrInfosforEquip::class.java)
                     height.setTvRight(strInfo.location.z.toString())
                     if (position!!.z == null) {

+ 1 - 0
demo/src/main/java/com/sybotan/android/demo/activities/GraphyActivity.kt

@@ -1594,6 +1594,7 @@ class GraphyActivity : BaseActivity(), ICaptureStatusListener, ICameraChangedCal
                     point.mY = -position.y.toFloat()
                     point.remark = child.remark
                     point.type = model.type
+                    point.equipState = child.type
                     point.position = child.position
                     point.deviceId = child.deviceId
 

+ 6 - 1
demo/src/main/java/com/sybotan/android/demo/adapter/SelectPopListAdapter.java

@@ -2,6 +2,7 @@ package com.sybotan.android.demo.adapter;
 
 import android.annotation.SuppressLint;
 import android.content.Context;
+import android.text.TextUtils;
 import android.view.Gravity;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -59,7 +60,11 @@ public class SelectPopListAdapter extends RecyclerView.Adapter<SelectPopListAdap
         }
         if (type.equals(Constant.TYPE2)) {
             ObjectEntity options = (ObjectEntity) item;
-            holder.choice_name.setText(options.getLocalId());
+            if (TextUtils.isEmpty(options.getLocalId())) {
+                holder.choice_name.setText(options.getLocalName());
+            } else {
+                holder.choice_name.setText(options.getLocalId());
+            }
         }
         if (selectPosition > 0 && selectPosition - 1 == position) {
             holder.choice_name.setTextColor(context.getResources().getColor(R.color.blue_2f48b7));

+ 6 - 1
demo/src/main/java/com/sybotan/android/demo/view/ObjectRelationDialog.java

@@ -4,6 +4,7 @@ import android.annotation.SuppressLint;
 import android.app.Dialog;
 import android.content.Context;
 import android.content.DialogInterface;
+import android.text.TextUtils;
 import android.view.Gravity;
 import android.view.View;
 import android.view.Window;
@@ -46,7 +47,11 @@ public class ObjectRelationDialog extends Dialog implements View.OnClickListener
 
         relationTitle.setText(configEntity.getGraphName() + "/" + configEntity.getRelName());
         leftName.setText(localId);
-        rightName.setText(equip.getLocalId());
+        if (TextUtils.isEmpty(equip.getLocalId())) {
+            rightName.setText(equip.getLocalName());
+        } else {
+            rightName.setText(equip.getLocalId());
+        }
         if (Objects.equals(configEntity.getClassCodeFrom(), equip.getClassCode())) {
             relationTv.setText("<-");
         } else {

+ 30 - 25
demo/src/main/java/com/sybotan/android/demo/viewmodel/GraphyVM.kt

@@ -167,7 +167,7 @@ class GraphyVM(
                 modifiedTime = time,
                 uploadFlag = "",
                 valid = 1,
-                geom = toJson
+                geom = toJson, state = "1"
             )
             repo.insProblem(problem)
 
@@ -201,7 +201,7 @@ class GraphyVM(
                         modifier = "",
                         modifiedTime = time,
                         valid = 1,
-                        uploadFlag = ""
+                        uploadFlag = "", state = "1"
                     )
                     repo.insFile(file)
                 }
@@ -321,7 +321,7 @@ class GraphyVM(
                 modifier = "Android",
                 modifiedTime = time,
                 valid = 1,
-                uploadFlag = ""
+                uploadFlag = "", state = "1"
             )
             repo.insQrcode(qrcode)
             mEmitter.SendDircetive(BIND_QECODE, null)
@@ -400,6 +400,7 @@ class GraphyVM(
                 space.archState = 2
                 space.equipState = 2
             }
+            space.state = "1"
             repo.insSpace(space)
             mEmitter.SendDircetive(SET_JOB, null)
         }
@@ -630,6 +631,7 @@ class GraphyVM(
         viewModelScope.launch {
             var space = repo.getObject(space.id!!)
             space.infos = JSONObject(hashMap as Map<*, *>)
+            space.state = "1"
             repo.insObject(space)
             mActivity.setResult(RESULT_OK)
             mActivity.finish()
@@ -735,7 +737,7 @@ class GraphyVM(
                     virtualCodes = null,
                     infos = JSONObject(hashMap as Map<*, *>),
                     strInfos = gson.toJson(hashMap),
-                    floorMap = null
+                    floorMap = null, state = "1"
                 )
                 repo.insObject(objectEntity)
             } else {
@@ -773,7 +775,7 @@ class GraphyVM(
                         modifier = "",
                         modifiedTime = null,
                         valid = 1,
-                        uploadFlag = ""
+                        uploadFlag = "", state = "1"
                     )
                     repo.insFile(file)
                 }
@@ -959,7 +961,7 @@ class GraphyVM(
                 clientDevice = null,
                 uploadFlag = null,
                 deliveryState = null,
-                valid = 1, d2mState = null, objFromLocalId = null, objToLocalId = null
+                valid = 1, d2mState = null, objFromLocalId = null, objToLocalId = null, state = "1"
             )
             repo.insRelation(relEntity)
             getRelConfig(equipEntity, deviceId, uuid)
@@ -1013,7 +1015,7 @@ class GraphyVM(
                 pipeType = groupPipeConfigEntity.pipeType,
                 pipeSubType = groupPipeConfigEntity.pipeSubType,
                 route = null,
-                infos = null
+                infos = null, state = "1"
             )
             repo.insPipe(relEntity)
             getRelConfig(equipEntity, deviceId, uuid)
@@ -1022,24 +1024,27 @@ class GraphyVM(
 
     fun insProblemEquip(space: TunableSpaceItem, deviceId: String) {
         viewModelScope.launch {
-            val entity = ProblemEquipEntity(
-                id = UUID.randomUUID().toString(),
-                floorId = floorId,
-                projectId = projectId,
-                buildingId = buildingId,
-                equipId = deviceId,
-                workId = null,
-                problemType = null,
-                problemState = 1,
-                message = null,
-                creator = null,
-                creationTime = null,
-                modifier = null,
-                modifiedTime = null,
-                uploadFlag = null,
-                valid = 1
-            )
-            repo.insProblemEquipEntity(entity)
+            val proEntity = repo.getEqProblem(deviceId)
+            if (proEntity == null) {
+                val entity = ProblemEquipEntity(
+                    id = UUID.randomUUID().toString(),
+                    floorId = floorId,
+                    projectId = projectId,
+                    buildingId = buildingId,
+                    equipId = deviceId,
+                    workId = null,
+                    problemType = null,
+                    problemState = 1,
+                    message = null,
+                    creator = null,
+                    creationTime = null,
+                    modifier = null,
+                    modifiedTime = null,
+                    uploadFlag = null,
+                    valid = 1, state = "1"
+                )
+                repo.insProblemEquipEntity(entity)
+            }
         }
         getSpaceEq(space)
     }