修改数据上传
This commit is contained in:
parent
5826922bb9
commit
3a1e1bc9d6
@ -1,7 +1,10 @@
|
|||||||
package com.navinfo.omqs.bean
|
package com.navinfo.omqs.bean
|
||||||
|
|
||||||
|
import android.os.Parcelable
|
||||||
import com.google.gson.annotations.SerializedName
|
import com.google.gson.annotations.SerializedName
|
||||||
|
import kotlinx.android.parcel.Parcelize
|
||||||
|
|
||||||
|
@Parcelize
|
||||||
data class EvaluationInfo(
|
data class EvaluationInfo(
|
||||||
@SerializedName("evaluationTaskId")
|
@SerializedName("evaluationTaskId")
|
||||||
val evaluationTaskId: String = "",//测评任务id
|
val evaluationTaskId: String = "",//测评任务id
|
||||||
@ -46,5 +49,5 @@ data class EvaluationInfo(
|
|||||||
|
|
||||||
@SerializedName("evaluationWay")
|
@SerializedName("evaluationWay")
|
||||||
val evaluationWay: String = ""//测评方式
|
val evaluationWay: String = ""//测评方式
|
||||||
)
|
) : Parcelable
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@ import io.realm.Realm
|
|||||||
import kotlinx.coroutines.*
|
import kotlinx.coroutines.*
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import okhttp3.logging.HttpLoggingInterceptor
|
import okhttp3.logging.HttpLoggingInterceptor
|
||||||
|
import retrofit2.Call
|
||||||
import retrofit2.Retrofit
|
import retrofit2.Retrofit
|
||||||
import retrofit2.converter.gson.GsonConverterFactory
|
import retrofit2.converter.gson.GsonConverterFactory
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
@ -66,7 +67,7 @@ class GlobalModule {
|
|||||||
}.apply {
|
}.apply {
|
||||||
level = if (Constant.DEBUG) {
|
level = if (Constant.DEBUG) {
|
||||||
//坑 !!!! 下载文件时打印log 内存不足
|
//坑 !!!! 下载文件时打印log 内存不足
|
||||||
HttpLoggingInterceptor.Level.BASIC
|
HttpLoggingInterceptor.Level.BODY
|
||||||
} else {
|
} else {
|
||||||
HttpLoggingInterceptor.Level.NONE
|
HttpLoggingInterceptor.Level.NONE
|
||||||
}
|
}
|
||||||
@ -92,9 +93,12 @@ class GlobalModule {
|
|||||||
@Singleton
|
@Singleton
|
||||||
fun provideGson(): Gson = GsonBuilder()
|
fun provideGson(): Gson = GsonBuilder()
|
||||||
// 解决解析Json时将int类型自动转换为Double的问题
|
// 解决解析Json时将int类型自动转换为Double的问题
|
||||||
.registerTypeAdapter(object : TypeToken<Map<String, Any?>>() {}.getType(), IntTypeAdapter())
|
.registerTypeAdapter(object : TypeToken<Map<String, Any?>>() {}.type, IntTypeAdapter())
|
||||||
.registerTypeAdapter(object : TypeToken<Map<String, Any>>() {}.getType(), IntTypeAdapter())
|
.registerTypeAdapter(object : TypeToken<Map<String, Any>>() {}.type, IntTypeAdapter())
|
||||||
.registerTypeAdapter(object : TypeToken<Map<Any, Any>>() {}.getType(), IntTypeAdapter())
|
.registerTypeAdapter(object : TypeToken<Map<Any, Any>>() {}.type, IntTypeAdapter())
|
||||||
|
// .registerTypeAdapter(Call::class.java, object : TypeToken<Call<*>>(){
|
||||||
|
//
|
||||||
|
// })
|
||||||
.create()
|
.create()
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
|
@ -58,7 +58,7 @@ interface RetrofitNetworkServiceAPI {
|
|||||||
|
|
||||||
@Headers("Content-Type: application/json")
|
@Headers("Content-Type: application/json")
|
||||||
@POST("/devcp/upload")
|
@POST("/devcp/upload")
|
||||||
suspend fun postRequest(@Body listEvaluationInfo: List<EvaluationInfo>?): Call<ResponseBody>
|
suspend fun postRequest(@Body listEvaluationInfo: List<EvaluationInfo>?): Response<ResponseBody>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @FormUrlEncoded 请求格式注解,请求实体是一个From表单,每个键值对需要使用@Field注解
|
* @FormUrlEncoded 请求格式注解,请求实体是一个From表单,每个键值对需要使用@Field注解
|
||||||
|
@ -9,6 +9,7 @@ import androidx.lifecycle.Observer
|
|||||||
import com.navinfo.collect.library.data.entity.QsRecordBean
|
import com.navinfo.collect.library.data.entity.QsRecordBean
|
||||||
import com.navinfo.omqs.bean.EvaluationInfo
|
import com.navinfo.omqs.bean.EvaluationInfo
|
||||||
import com.navinfo.omqs.bean.TaskBean
|
import com.navinfo.omqs.bean.TaskBean
|
||||||
|
import com.navinfo.omqs.http.NetResult
|
||||||
import com.navinfo.omqs.tools.FileManager
|
import com.navinfo.omqs.tools.FileManager
|
||||||
import com.navinfo.omqs.tools.FileManager.Companion.FileUploadStatus
|
import com.navinfo.omqs.tools.FileManager.Companion.FileUploadStatus
|
||||||
import io.realm.Realm
|
import io.realm.Realm
|
||||||
@ -114,9 +115,16 @@ class TaskUploadScope(
|
|||||||
taskBean.hadLinkDvoList.forEach { hadLinkDvoBean ->
|
taskBean.hadLinkDvoList.forEach { hadLinkDvoBean ->
|
||||||
val objects = realm.where(QsRecordBean::class.java)
|
val objects = realm.where(QsRecordBean::class.java)
|
||||||
.equalTo("linkId", /*"84207223282277331"*/hadLinkDvoBean.linkPid).findAll()
|
.equalTo("linkId", /*"84207223282277331"*/hadLinkDvoBean.linkPid).findAll()
|
||||||
|
if(objects.size == 0){
|
||||||
|
// change(FileUploadStatus.NONE)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
val bodyList: MutableList<EvaluationInfo> = ArrayList()
|
val bodyList: MutableList<EvaluationInfo> = ArrayList()
|
||||||
|
|
||||||
if (objects != null) {
|
if (objects != null) {
|
||||||
objects.forEach{
|
val copyList =realm.copyFromRealm(objects)
|
||||||
|
copyList.forEach {
|
||||||
val evaluationInfo = EvaluationInfo(
|
val evaluationInfo = EvaluationInfo(
|
||||||
taskBean.id.toString(),
|
taskBean.id.toString(),
|
||||||
hadLinkDvoBean.linkPid,//"84207223282277331"
|
hadLinkDvoBean.linkPid,//"84207223282277331"
|
||||||
@ -137,26 +145,20 @@ class TaskUploadScope(
|
|||||||
bodyList.add(evaluationInfo)
|
bodyList.add(evaluationInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
uploadManager.netApi.postRequest(bodyList).enqueue(object :
|
val result = uploadManager.netApi.postRequest(bodyList)// .enqueue(object :
|
||||||
Callback<ResponseBody> {
|
// Callback<ResponseBody> {
|
||||||
override fun onResponse(
|
if (result.isSuccessful) {
|
||||||
call: Call<ResponseBody>,
|
if (result.code() == 200) {
|
||||||
response: Response<ResponseBody>
|
|
||||||
) {
|
|
||||||
if (response.code() == 200) {
|
|
||||||
taskBean.syncStatus = FileUploadStatus.DONE
|
taskBean.syncStatus = FileUploadStatus.DONE
|
||||||
// handle the response
|
// handle the response
|
||||||
Log.e("qj", "")
|
|
||||||
change(FileUploadStatus.DONE)
|
change(FileUploadStatus.DONE)
|
||||||
}
|
} else {
|
||||||
}
|
|
||||||
|
|
||||||
override fun onFailure(call: Call<ResponseBody>, t: Throwable) {
|
|
||||||
// handle the failure
|
// handle the failure
|
||||||
Log.e("qj", "")
|
|
||||||
change(FileUploadStatus.ERROR)
|
change(FileUploadStatus.ERROR)
|
||||||
}
|
}
|
||||||
})
|
} else {
|
||||||
|
change(FileUploadStatus.ERROR)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,6 +91,8 @@ class EvaluationResultViewModel @Inject constructor(
|
|||||||
|
|
||||||
var mSoundMeter: SoundMeter? = null
|
var mSoundMeter: SoundMeter? = null
|
||||||
|
|
||||||
|
var classTypeTemp: String = ""
|
||||||
|
|
||||||
init {
|
init {
|
||||||
liveDataQsRecordBean.value = QsRecordBean(id = UUID.randomUUID().toString())
|
liveDataQsRecordBean.value = QsRecordBean(id = UUID.randomUUID().toString())
|
||||||
Log.e("jingo", "EvaluationResultViewModel 创建了 ${hashCode()}")
|
Log.e("jingo", "EvaluationResultViewModel 创建了 ${hashCode()}")
|
||||||
@ -128,6 +130,7 @@ class EvaluationResultViewModel @Inject constructor(
|
|||||||
geoPoint?.let {
|
geoPoint?.let {
|
||||||
liveDataQsRecordBean.value!!.geometry = GeometryTools.createGeometry(it).toText()
|
liveDataQsRecordBean.value!!.geometry = GeometryTools.createGeometry(it).toText()
|
||||||
mapController.markerHandle.addMarker(geoPoint, markerTitle)
|
mapController.markerHandle.addMarker(geoPoint, markerTitle)
|
||||||
|
mapController.animationHandler.animationByLonLat(geoPoint.latitude,geoPoint.longitude)
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
captureLink(geoPoint.longitude, geoPoint.latitude)
|
captureLink(geoPoint.longitude, geoPoint.latitude)
|
||||||
}
|
}
|
||||||
@ -148,6 +151,8 @@ class EvaluationResultViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
val point = GeometryTools.createGeoPoint(bean.geometry)
|
val point = GeometryTools.createGeoPoint(bean.geometry)
|
||||||
|
liveDataQsRecordBean.value!!.geometry = GeometryTools.createGeometry(point).toText()
|
||||||
|
mapController.animationHandler.animationByLonLat(point.latitude,point.longitude)
|
||||||
mapController.markerHandle.addMarker(point, markerTitle)
|
mapController.markerHandle.addMarker(point, markerTitle)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,6 +201,7 @@ class EvaluationResultViewModel @Inject constructor(
|
|||||||
if (liveDataQsRecordBean.value!!.classType.isEmpty()) {
|
if (liveDataQsRecordBean.value!!.classType.isEmpty()) {
|
||||||
Log.e("jingo", "getClassTypeList $classType")
|
Log.e("jingo", "getClassTypeList $classType")
|
||||||
liveDataQsRecordBean.value!!.classType = classType
|
liveDataQsRecordBean.value!!.classType = classType
|
||||||
|
classTypeTemp = classType
|
||||||
}
|
}
|
||||||
getProblemList(classType)
|
getProblemList(classType)
|
||||||
}
|
}
|
||||||
@ -285,12 +291,14 @@ class EvaluationResultViewModel @Inject constructor(
|
|||||||
viewModelScope.launch(Dispatchers.IO) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
getProblemList(classType)
|
getProblemList(classType)
|
||||||
}
|
}
|
||||||
|
classTypeTemp = classType
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 监听右侧栏的点击事件,修改数据
|
* 监听右侧栏的点击事件,修改数据
|
||||||
*/
|
*/
|
||||||
fun setPhenomenonMiddleBean(adapterBean: RightBean) {
|
fun setPhenomenonMiddleBean(adapterBean: RightBean) {
|
||||||
|
liveDataQsRecordBean.value!!.classType = classTypeTemp
|
||||||
liveDataQsRecordBean.value!!.phenomenon = adapterBean.text
|
liveDataQsRecordBean.value!!.phenomenon = adapterBean.text
|
||||||
liveDataQsRecordBean.value!!.problemType = adapterBean.title
|
liveDataQsRecordBean.value!!.problemType = adapterBean.title
|
||||||
liveDataQsRecordBean.postValue(liveDataQsRecordBean.value)
|
liveDataQsRecordBean.postValue(liveDataQsRecordBean.value)
|
||||||
@ -305,7 +313,6 @@ class EvaluationResultViewModel @Inject constructor(
|
|||||||
fun saveData() {
|
fun saveData() {
|
||||||
viewModelScope.launch(Dispatchers.IO) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
val realm = Realm.getDefaultInstance()
|
val realm = Realm.getDefaultInstance()
|
||||||
Log.e("jingo", "realm hashCOde ${realm.hashCode()}")
|
|
||||||
realm.executeTransaction {
|
realm.executeTransaction {
|
||||||
it.copyToRealmOrUpdate(liveDataQsRecordBean.value)
|
it.copyToRealmOrUpdate(liveDataQsRecordBean.value)
|
||||||
}
|
}
|
||||||
|
@ -591,8 +591,9 @@ public final class NIMapView extends RelativeLayout {
|
|||||||
BASE(0)/*底图图层组*/,
|
BASE(0)/*底图图层组*/,
|
||||||
VECTOR_TILE(1)/*矢量瓦片组*/,
|
VECTOR_TILE(1)/*矢量瓦片组*/,
|
||||||
VECTOR(2)/*高亮组*/,
|
VECTOR(2)/*高亮组*/,
|
||||||
OPERATE(3)/*操作图层组*/,
|
OPERATE_LINE(3)/*操作图层组*/,
|
||||||
NAVIGATION(4)/*定位导航组*/;
|
OPERATE_MARKER(4)/*操作图层组*/,
|
||||||
|
NAVIGATION(5)/*定位导航组*/;
|
||||||
|
|
||||||
int groupIndex;
|
int groupIndex;
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ class LineHandler(context: AppCompatActivity, mapView: NIMapView) : BaseHandler(
|
|||||||
.strokeColor(context.resources.getColor(R.color.draw_line_red_color, null))
|
.strokeColor(context.resources.getColor(R.color.draw_line_red_color, null))
|
||||||
.fixed(true).randomOffset(false).build()
|
.fixed(true).randomOffset(false).build()
|
||||||
mDefaultPathLayer = PathLayer(mMapView.vtmMap, defaultLineStyle)
|
mDefaultPathLayer = PathLayer(mMapView.vtmMap, defaultLineStyle)
|
||||||
addLayer(mDefaultPathLayer, NIMapView.LAYER_GROUPS.OPERATE)
|
addLayer(mDefaultPathLayer, NIMapView.LAYER_GROUPS.OPERATE_LINE)
|
||||||
mPathLayer = PathLayer(mMapView.vtmMap, lineStyle)
|
mPathLayer = PathLayer(mMapView.vtmMap, lineStyle)
|
||||||
// addLayer(mPathLayer, NIMapView.LAYER_GROUPS.OPERATE)
|
// addLayer(mPathLayer, NIMapView.LAYER_GROUPS.OPERATE)
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
|
|||||||
|
|
||||||
//初始化之间数据图层
|
//初始化之间数据图层
|
||||||
initQsRecordDataLayer()
|
initQsRecordDataLayer()
|
||||||
addLayer(mDefaultMarkerLayer, NIMapView.LAYER_GROUPS.OPERATE);
|
addLayer(mDefaultMarkerLayer, NIMapView.LAYER_GROUPS.OPERATE_MARKER);
|
||||||
// 设置矢量图层均在12级以上才显示
|
// 设置矢量图层均在12级以上才显示
|
||||||
mMapView.vtmMap.events.bind(Map.UpdateListener { e, mapPosition ->
|
mMapView.vtmMap.events.bind(Map.UpdateListener { e, mapPosition ->
|
||||||
if (e == Map.SCALE_EVENT) {
|
if (e == Map.SCALE_EVENT) {
|
||||||
@ -259,7 +259,7 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
addLayer(itemizedLayer, NIMapView.LAYER_GROUPS.OPERATE)
|
addLayer(itemizedLayer, NIMapView.LAYER_GROUPS.OPERATE_MARKER)
|
||||||
mContext.lifecycleScope.launch(Dispatchers.IO) {
|
mContext.lifecycleScope.launch(Dispatchers.IO) {
|
||||||
var list = mutableListOf<QsRecordBean>()
|
var list = mutableListOf<QsRecordBean>()
|
||||||
val realm = Realm.getDefaultInstance()
|
val realm = Realm.getDefaultInstance()
|
||||||
|
@ -116,7 +116,7 @@ open class MeasureLayerHandler(context: AppCompatActivity, mapView: NIMapView) :
|
|||||||
|
|
||||||
mPathLayer = PathLayer(mMapView.vtmMap, lineStyle)
|
mPathLayer = PathLayer(mMapView.vtmMap, lineStyle)
|
||||||
|
|
||||||
addLayer(mPathLayer, NIMapView.LAYER_GROUPS.OPERATE)
|
addLayer(mPathLayer, NIMapView.LAYER_GROUPS.OPERATE_LINE)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user