重构轨迹回放业务

This commit is contained in:
qiji4215
2023-07-18 15:45:11 +08:00
parent dfbea188ea
commit 78bd363372
12 changed files with 334 additions and 51 deletions

View File

@@ -6,8 +6,7 @@ import com.navinfo.omqs.bean.IndoorConnectionInfoBean
import com.navinfo.omqs.bean.LoginUserBean
import com.navinfo.omqs.bean.QRCodeBean
import com.navinfo.omqs.bean.SysUserBean
import okhttp3.ResponseBody
import retrofit2.Response
import com.navinfo.omqs.bean.TraceVideoBean
/**
@@ -38,4 +37,9 @@ interface NetworkService {
* 更新用户信息
*/
suspend fun updateServerInfo(url: String,indoorConnectionInfoBean: IndoorConnectionInfoBean): NetResult<QRCodeBean>
/**
* 设置轨迹对应的视频
*/
suspend fun sendServerCommand(url: String,traceVideoBean: TraceVideoBean): NetResult<QRCodeBean>
}

View File

@@ -6,6 +6,7 @@ import com.navinfo.omqs.bean.IndoorConnectionInfoBean
import com.navinfo.omqs.bean.LoginUserBean
import com.navinfo.omqs.bean.QRCodeBean
import com.navinfo.omqs.bean.SysUserBean
import com.navinfo.omqs.bean.TraceVideoBean
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import okhttp3.ResponseBody
@@ -110,6 +111,33 @@ class NetworkServiceImpl @Inject constructor(
map["baseurl"] = indoorConnectionInfoBean.baseurl
map["platform"] = indoorConnectionInfoBean.platform
val result = netApi.retrofitUpdateServerInfo(url,map)
if (result.isSuccessful) {
if (result.code() == 200) {
NetResult.Success(result.body())
} else {
NetResult.Failure<Any>(result.code(), result.message())
}
} else {
NetResult.Failure<Any>(result.code(), result.message())
}
} catch (e: Exception) {
NetResult.Error<Any>(e)
}
}
override suspend fun sendServerCommand(
url: String,
traceVideoBean: TraceVideoBean
): NetResult<QRCodeBean> =
//在IO线程中运行
withContext(Dispatchers.IO) {
return@withContext try {
val map: MutableMap<String, String> = HashMap()
map["userid"] = traceVideoBean.userid
map["playMode"] = traceVideoBean.playMode
map["time"] = traceVideoBean.time
val result = netApi.retrofitUpdateServerInfo(url,map)
if (result.isSuccessful) {
if (result.code() == 200) {