From a5d862051462a5fcc2717b405896a6d424002e54 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期二, 22 十二月 2020 15:43:06 +0800
Subject: [PATCH] 1. 调整了数控实体的存储位置; 2. 新增数据表“媒体文件类型别名表”; 3. 修改任意拍模块,将图片分类改为根据场景类型动态生成,同时新增修改分类别名功能; 4. 优化子任务选择界面的任务排序方式,按照“待开始”、“执行中”、“未执行”的顺序进行排序;

---
 app/src/main/java/cn/flightfeather/thirdapp/repository/CommonRepository.kt |   54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 54 insertions(+), 0 deletions(-)

diff --git a/app/src/main/java/cn/flightfeather/thirdapp/repository/CommonRepository.kt b/app/src/main/java/cn/flightfeather/thirdapp/repository/CommonRepository.kt
index 86e494b..40e8692 100644
--- a/app/src/main/java/cn/flightfeather/thirdapp/repository/CommonRepository.kt
+++ b/app/src/main/java/cn/flightfeather/thirdapp/repository/CommonRepository.kt
@@ -1,12 +1,16 @@
 package cn.flightfeather.thirdapp.repository
 
 import cn.flightfeather.thirdapp.common.net.ResultCallBack
+import cn.flightfeather.thirdapp.common.net.ResultObserver
 import cn.flightfeather.thirdapp.common.net.RetrofitFactory
 import cn.flightfeather.thirdapp.httpservice.CommonService
+import cn.flightfeather.thirdapp.model.enumreation.MediaFileType
+import cn.flightfeather.thirdapp.repository.dao.MediaTypeAliasDao
 import io.reactivex.schedulers.Schedulers
 import okhttp3.MediaType
 import okhttp3.MultipartBody
 import okhttp3.RequestBody
+import retrofit2.Response
 import java.io.File
 
 /**
@@ -14,6 +18,7 @@
  * Date: 2020/4/23
  */
 class CommonRepository {
+    private val mediaTypeAliasDao = MediaTypeAliasDao()
 
     fun upLoadCrashInfo(accountName: String, file: File, resultCallBack: ResultCallBack<Boolean>) {
         val builder = MultipartBody.Builder()
@@ -34,4 +39,53 @@
                 resultCallBack.onFailure()
             })
     }
+
+
+    /**
+     * 鑾峰彇鈥滀换鎰忔媿鈥濇ā鍧楀睍绀虹殑鍥剧墖绫诲瀷
+     */
+    fun getMediaFileTypes(sceneTypeId: Int, resultCallBack: ResultCallBack<List<MediaFileType>>) {
+        resultCallBack.onSuccess(MediaFileType.getList(sceneTypeId))
+    }
+
+    /**
+     * 鑾峰彇濯掍綋鏂囦欢绫诲瀷鐨勫埆鍚�
+     * @param sceneTypeId 鍦烘櫙id
+     * @param mediaFileType 濯掍綋鏂囦欢绫诲瀷id
+     */
+    fun getAlias(sceneTypeId: Int, mediaFileType: MediaFileType, resultCallBack: ResultCallBack<String>) {
+        val dbService = mediaTypeAliasDao.getAlias(sceneTypeId, mediaFileType)
+                .map { Response.success(it) }
+
+        RetrofitFactory.executeResult(dbService, object : ResultObserver<String>() {
+            override fun onSuccess(result: String?) {
+                resultCallBack.onSuccess(result)
+            }
+
+            override fun onFailure(e: Throwable, isNetWorkError: Boolean) {
+                resultCallBack.onFailure()
+            }
+        })
+    }
+
+    /**
+     * 鏇存柊濯掍綋鏂囦欢绫诲瀷鐨勫埆鍚�
+     * @param sceneTypeId 鍦烘櫙id
+     * @param mediaFileType 濯掍綋鏂囦欢绫诲瀷id
+     * @param alias 鍒悕
+     */
+    fun updateAlias(sceneTypeId: Int, mediaFileType: MediaFileType, alias: String, resultCallBack: ResultCallBack<Boolean>) {
+        val dbService = mediaTypeAliasDao.updateAlias(sceneTypeId, mediaFileType, alias)
+                .map { Response.success(it) }
+
+        RetrofitFactory.executeResult(dbService, object : ResultObserver<Boolean>() {
+            override fun onSuccess(result: Boolean?) {
+                resultCallBack.onSuccess(result)
+            }
+
+            override fun onFailure(e: Throwable, isNetWorkError: Boolean) {
+                resultCallBack.onFailure()
+            }
+        })
+    }
 }
\ No newline at end of file

--
Gitblit v1.9.3