From e234a15b428267997c903a4ed42536c5d9f14a1f Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期一, 10 十一月 2025 13:10:42 +0800
Subject: [PATCH] 2025.11.10 1. 新增巡查场景历史详情相关数据逻辑; 2. 新增工地施工阶段修改界面;

---
 app/src/main/java/cn/flightfeather/thirdappmodule/repository/CommonRepository.kt |   47 +++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 45 insertions(+), 2 deletions(-)

diff --git a/app/src/main/java/cn/flightfeather/thirdappmodule/repository/CommonRepository.kt b/app/src/main/java/cn/flightfeather/thirdappmodule/repository/CommonRepository.kt
index 0bcebe7..a21dd27 100644
--- a/app/src/main/java/cn/flightfeather/thirdappmodule/repository/CommonRepository.kt
+++ b/app/src/main/java/cn/flightfeather/thirdappmodule/repository/CommonRepository.kt
@@ -1,9 +1,12 @@
 package cn.flightfeather.thirdappmodule.repository
 
+import cn.flightfeather.thirdappmodule.bean.entity.Domainitem
 import cn.flightfeather.thirdappmodule.common.net.ResultCallBack
 import cn.flightfeather.thirdappmodule.common.net.ResultObserver
 import cn.flightfeather.thirdappmodule.common.net.RetrofitFactory
 import cn.flightfeather.thirdappmodule.httpservice.CommonService
+import cn.flightfeather.thirdappmodule.httpservice.DomainItemService
+import cn.flightfeather.thirdappmodule.model.bean.BaseResponse
 import cn.flightfeather.thirdappmodule.model.enumreation.MediaFileType
 import cn.flightfeather.thirdappmodule.repository.dao.MediaTypeAliasDao
 import io.reactivex.schedulers.Schedulers
@@ -18,7 +21,12 @@
  * Date: 2020/4/23
  */
 class CommonRepository {
+    companion object {
+        @JvmStatic
+        val instance: CommonRepository by lazy(LazyThreadSafetyMode.SYNCHRONIZED) { CommonRepository()}
+    }
     private val mediaTypeAliasDao = MediaTypeAliasDao()
+    val retrofit = RetrofitFactory.instance.retrofit
 
     fun upLoadCrashInfo(accountName: String, file: File, resultCallBack: ResultCallBack<Boolean>) {
         val builder = MultipartBody.Builder()
@@ -43,9 +51,27 @@
 
     /**
      * 鑾峰彇鈥滀换鎰忔媿鈥濇ā鍧楀睍绀虹殑鍥剧墖绫诲瀷
+     * @date 2025.7.1 淇敼涓轰粠鏈嶅姟绔繙绋嬭幏鍙栵紝骞朵慨鏀硅繑鍥炵被鍨�
      */
     fun getMediaFileTypes(sceneTypeId: Int, resultCallBack: ResultCallBack<List<MediaFileType>>) {
-        resultCallBack.onSuccess(MediaFileType.getList(sceneTypeId))
+//        resultCallBack.onSuccess(MediaFileType.getList(sceneTypeId))
+
+        val service = retrofit.create(DomainItemService::class.java).getMediaFileType(sceneTypeId)
+
+        RetrofitFactory.executeResult(service, object : ResultObserver<Map<String?, String?>>() {
+            override fun onSuccess(result: Map<String?, String?>?) {
+                val res = mutableListOf<MediaFileType>()
+                result?.forEach { (t, u) ->
+                    if (t == null || u == null) return@forEach
+                    res.add(MediaFileType(t.toInt(), u))
+                }
+                resultCallBack.onSuccess(res)
+            }
+
+            override fun onFailure(e: Throwable, isNetWorkError: Boolean) {
+                resultCallBack.onFailure()
+            }
+        })
     }
 
     /**
@@ -53,7 +79,7 @@
      * @param sceneTypeId 鍦烘櫙id
      * @param mediaFileType 濯掍綋鏂囦欢绫诲瀷id
      */
-    fun getAlias(sceneTypeId: Int, mediaFileType: MediaFileType, resultCallBack: ResultCallBack<String>) {
+    fun getAlias(sceneTypeId: Int, mediaFileType: Int, resultCallBack: ResultCallBack<String>) {
         val dbService = mediaTypeAliasDao.getAlias(sceneTypeId, mediaFileType)
                 .map { Response.success(it) }
 
@@ -88,4 +114,21 @@
             }
         })
     }
+
+    /**
+     * 鏍规嵁鍊煎煙绫诲埆鍚嶇О锛岃幏鍙栧叿浣撶殑閫夐」
+     */
+    fun getDomainItem(name: String, resultCallBack: ResultCallBack<ArrayList<Domainitem>>) {
+        val service = retrofit.create(DomainItemService::class.java).getItemByName(name)
+
+        RetrofitFactory.executeResult(service, object : ResultObserver<BaseResponse<ArrayList<Domainitem>>>() {
+            override fun onSuccess(result: BaseResponse<ArrayList<Domainitem>>?) {
+                resultCallBack.onSuccess(result?.data)
+            }
+
+            override fun onFailure(e: Throwable, isNetWorkError: Boolean) {
+                resultCallBack.onFailure()
+            }
+        })
+    }
 }
\ No newline at end of file

--
Gitblit v1.9.3