Merge branch 'master' of gitlab.navinfo.com:CollectVehicle/OneMapQS
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
package com.navinfo.omqs.bean
|
||||
|
||||
import android.os.Parcelable
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import kotlinx.android.parcel.Parcelize
|
||||
|
||||
@Parcelize
|
||||
data class EvaluationInfo(
|
||||
@SerializedName("evaluationTaskId")
|
||||
val evaluationTaskId: String = "",//测评任务id
|
||||
@@ -46,5 +49,5 @@ data class EvaluationInfo(
|
||||
|
||||
@SerializedName("evaluationWay")
|
||||
val evaluationWay: String = ""//测评方式
|
||||
)
|
||||
) : Parcelable
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ import io.realm.Realm
|
||||
import kotlinx.coroutines.*
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.logging.HttpLoggingInterceptor
|
||||
import retrofit2.Call
|
||||
import retrofit2.Retrofit
|
||||
import retrofit2.converter.gson.GsonConverterFactory
|
||||
import java.util.concurrent.TimeUnit
|
||||
@@ -66,7 +67,7 @@ class GlobalModule {
|
||||
}.apply {
|
||||
level = if (Constant.DEBUG) {
|
||||
//坑 !!!! 下载文件时打印log 内存不足
|
||||
HttpLoggingInterceptor.Level.BASIC
|
||||
HttpLoggingInterceptor.Level.BODY
|
||||
} else {
|
||||
HttpLoggingInterceptor.Level.NONE
|
||||
}
|
||||
@@ -92,9 +93,12 @@ class GlobalModule {
|
||||
@Singleton
|
||||
fun provideGson(): Gson = GsonBuilder()
|
||||
// 解决解析Json时将int类型自动转换为Double的问题
|
||||
.registerTypeAdapter(object : TypeToken<Map<String, Any?>>() {}.getType(), IntTypeAdapter())
|
||||
.registerTypeAdapter(object : TypeToken<Map<String, Any>>() {}.getType(), IntTypeAdapter())
|
||||
.registerTypeAdapter(object : TypeToken<Map<Any, Any>>() {}.getType(), IntTypeAdapter())
|
||||
.registerTypeAdapter(object : TypeToken<Map<String, Any?>>() {}.type, IntTypeAdapter())
|
||||
.registerTypeAdapter(object : TypeToken<Map<String, Any>>() {}.type, IntTypeAdapter())
|
||||
.registerTypeAdapter(object : TypeToken<Map<Any, Any>>() {}.type, IntTypeAdapter())
|
||||
// .registerTypeAdapter(Call::class.java, object : TypeToken<Call<*>>(){
|
||||
//
|
||||
// })
|
||||
.create()
|
||||
|
||||
@Provides
|
||||
|
||||
@@ -58,7 +58,7 @@ interface RetrofitNetworkServiceAPI {
|
||||
|
||||
@Headers("Content-Type: application/json")
|
||||
@POST("/devcp/upload")
|
||||
suspend fun postRequest(@Body listEvaluationInfo: List<EvaluationInfo>?): Call<ResponseBody>
|
||||
suspend fun postRequest(@Body listEvaluationInfo: List<EvaluationInfo>?): Response<ResponseBody>
|
||||
|
||||
/**
|
||||
* @FormUrlEncoded 请求格式注解,请求实体是一个From表单,每个键值对需要使用@Field注解
|
||||
|
||||
@@ -9,6 +9,7 @@ import androidx.lifecycle.Observer
|
||||
import com.navinfo.collect.library.data.entity.QsRecordBean
|
||||
import com.navinfo.omqs.bean.EvaluationInfo
|
||||
import com.navinfo.omqs.bean.TaskBean
|
||||
import com.navinfo.omqs.http.NetResult
|
||||
import com.navinfo.omqs.tools.FileManager
|
||||
import com.navinfo.omqs.tools.FileManager.Companion.FileUploadStatus
|
||||
import io.realm.Realm
|
||||
@@ -114,9 +115,16 @@ class TaskUploadScope(
|
||||
taskBean.hadLinkDvoList.forEach { hadLinkDvoBean ->
|
||||
val objects = realm.where(QsRecordBean::class.java)
|
||||
.equalTo("linkId", /*"84207223282277331"*/hadLinkDvoBean.linkPid).findAll()
|
||||
if(objects.size == 0){
|
||||
// change(FileUploadStatus.NONE)
|
||||
return
|
||||
}
|
||||
|
||||
val bodyList: MutableList<EvaluationInfo> = ArrayList()
|
||||
|
||||
if (objects != null) {
|
||||
objects.forEach{
|
||||
val copyList =realm.copyFromRealm(objects)
|
||||
copyList.forEach {
|
||||
val evaluationInfo = EvaluationInfo(
|
||||
taskBean.id.toString(),
|
||||
hadLinkDvoBean.linkPid,//"84207223282277331"
|
||||
@@ -137,26 +145,20 @@ class TaskUploadScope(
|
||||
bodyList.add(evaluationInfo)
|
||||
}
|
||||
|
||||
uploadManager.netApi.postRequest(bodyList).enqueue(object :
|
||||
Callback<ResponseBody> {
|
||||
override fun onResponse(
|
||||
call: Call<ResponseBody>,
|
||||
response: Response<ResponseBody>
|
||||
) {
|
||||
if (response.code() == 200) {
|
||||
taskBean.syncStatus = FileUploadStatus.DONE
|
||||
// handle the response
|
||||
Log.e("qj", "")
|
||||
change(FileUploadStatus.DONE)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(call: Call<ResponseBody>, t: Throwable) {
|
||||
val result = uploadManager.netApi.postRequest(bodyList)// .enqueue(object :
|
||||
// Callback<ResponseBody> {
|
||||
if (result.isSuccessful) {
|
||||
if (result.code() == 200) {
|
||||
taskBean.syncStatus = FileUploadStatus.DONE
|
||||
// handle the response
|
||||
change(FileUploadStatus.DONE)
|
||||
} else {
|
||||
// handle the failure
|
||||
Log.e("qj", "")
|
||||
change(FileUploadStatus.ERROR)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
change(FileUploadStatus.ERROR)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -60,22 +60,20 @@ class EvaluationResultFragment : BaseFragment(), View.OnClickListener {
|
||||
onBackPressed()
|
||||
}
|
||||
//返回按钮点击
|
||||
binding.evaluationBar.setNavigationOnClickListener {
|
||||
binding.evaluationBar.setOnClickListener() {
|
||||
onBackPressed()
|
||||
}
|
||||
//标题栏按钮
|
||||
binding.evaluationBar.setOnMenuItemClickListener {
|
||||
when (it.itemId) {
|
||||
R.id.save -> {
|
||||
viewModel.saveData()
|
||||
true
|
||||
}
|
||||
R.id.delete -> {
|
||||
viewModel.deleteData()
|
||||
true
|
||||
}
|
||||
else -> true
|
||||
}
|
||||
|
||||
//保存事件
|
||||
binding.evaluationBarSave.setOnClickListener() {
|
||||
viewModel.saveData()
|
||||
}
|
||||
|
||||
//删除事件
|
||||
binding.evaluationBarDelete.setOnClickListener() {
|
||||
|
||||
viewModel.deleteData()
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -91,6 +91,8 @@ class EvaluationResultViewModel @Inject constructor(
|
||||
|
||||
var mSoundMeter: SoundMeter? = null
|
||||
|
||||
var classTypeTemp: String = ""
|
||||
|
||||
init {
|
||||
liveDataQsRecordBean.value = QsRecordBean(id = UUID.randomUUID().toString())
|
||||
Log.e("jingo", "EvaluationResultViewModel 创建了 ${hashCode()}")
|
||||
@@ -128,6 +130,7 @@ class EvaluationResultViewModel @Inject constructor(
|
||||
geoPoint?.let {
|
||||
liveDataQsRecordBean.value!!.geometry = GeometryTools.createGeometry(it).toText()
|
||||
mapController.markerHandle.addMarker(geoPoint, markerTitle)
|
||||
mapController.animationHandler.animationByLonLat(geoPoint.latitude,geoPoint.longitude)
|
||||
viewModelScope.launch {
|
||||
captureLink(geoPoint.longitude, geoPoint.latitude)
|
||||
}
|
||||
@@ -148,6 +151,8 @@ class EvaluationResultViewModel @Inject constructor(
|
||||
}
|
||||
}
|
||||
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)
|
||||
}
|
||||
|
||||
@@ -196,6 +201,7 @@ class EvaluationResultViewModel @Inject constructor(
|
||||
if (liveDataQsRecordBean.value!!.classType.isEmpty()) {
|
||||
Log.e("jingo", "getClassTypeList $classType")
|
||||
liveDataQsRecordBean.value!!.classType = classType
|
||||
classTypeTemp = classType
|
||||
}
|
||||
getProblemList(classType)
|
||||
}
|
||||
@@ -285,12 +291,14 @@ class EvaluationResultViewModel @Inject constructor(
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
getProblemList(classType)
|
||||
}
|
||||
classTypeTemp = classType
|
||||
}
|
||||
|
||||
/**
|
||||
* 监听右侧栏的点击事件,修改数据
|
||||
*/
|
||||
fun setPhenomenonMiddleBean(adapterBean: RightBean) {
|
||||
liveDataQsRecordBean.value!!.classType = classTypeTemp
|
||||
liveDataQsRecordBean.value!!.phenomenon = adapterBean.text
|
||||
liveDataQsRecordBean.value!!.problemType = adapterBean.title
|
||||
liveDataQsRecordBean.postValue(liveDataQsRecordBean.value)
|
||||
@@ -305,7 +313,6 @@ class EvaluationResultViewModel @Inject constructor(
|
||||
fun saveData() {
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
val realm = Realm.getDefaultInstance()
|
||||
Log.e("jingo", "realm hashCOde ${realm.hashCode()}")
|
||||
realm.executeTransaction {
|
||||
it.copyToRealmOrUpdate(liveDataQsRecordBean.value)
|
||||
}
|
||||
@@ -327,6 +334,7 @@ class EvaluationResultViewModel @Inject constructor(
|
||||
}
|
||||
// realm.close()
|
||||
mapController.markerHandle.removeQsRecordMark(liveDataQsRecordBean.value!!)
|
||||
mapController.mMapView.vtmMap.updateMap(true)
|
||||
liveDataFinish.postValue(true)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,9 +29,11 @@ class LeftAdapter(private var itemListener: ((Int, String) -> Unit?)? = null) :
|
||||
val title = data[position]
|
||||
bd.itemId.text = title
|
||||
if (selectTitle == title) {
|
||||
bd.itemId.setBackgroundColor(holder.viewBinding.root.context.getColor(R.color.cv_gray_153))
|
||||
bd.itemId.setBackgroundResource(R.drawable.drawable_bg_tittle_blue_bg_4_radius)
|
||||
bd.itemId.setTextColor(holder.viewBinding.root.context.getColor(R.color.highFontColor))
|
||||
} else {
|
||||
bd.itemId.setBackgroundColor(holder.viewBinding.root.context.getColor(R.color.white))
|
||||
bd.itemId.setBackgroundResource(R.drawable.drawable_bg_white_bg_4_radius)
|
||||
bd.itemId.setTextColor(holder.viewBinding.root.context.getColor(R.color.black))
|
||||
}
|
||||
bd.root.setOnClickListener {
|
||||
if (selectTitle != title) {
|
||||
|
||||
@@ -28,10 +28,15 @@ class MiddleAdapter(private var itemListener: ((Int, String) -> Unit?)? = null)
|
||||
val bd = holder.viewBinding as TextItemSelectBinding
|
||||
val title = data[position]
|
||||
bd.itemId.text = title
|
||||
val layoutParams: ViewGroup.LayoutParams = holder.viewBinding.itemLayout.layoutParams
|
||||
layoutParams.width = 115
|
||||
bd.itemLayout.layoutParams = layoutParams
|
||||
if (selectTitle == title) {
|
||||
bd.itemId.setBackgroundColor(holder.viewBinding.root.context.getColor(R.color.cv_gray_153))
|
||||
bd.itemId.setBackgroundResource(R.drawable.drawable_bg_blue_bg_4_radius)
|
||||
bd.itemId.setTextColor(holder.viewBinding.root.context.getColor(R.color.white))
|
||||
} else {
|
||||
bd.itemId.setBackgroundColor(holder.viewBinding.root.context.getColor(R.color.white))
|
||||
bd.itemId.setBackgroundResource(R.drawable.drawable_bg_white_bg_4_radius)
|
||||
bd.itemId.setTextColor(holder.viewBinding.root.context.getColor(R.color.black))
|
||||
}
|
||||
bd.root.setOnClickListener {
|
||||
if (selectTitle != title) {
|
||||
|
||||
@@ -102,7 +102,8 @@ class PhenomenonFragment :
|
||||
|
||||
//中间菜单
|
||||
binding.phenomenonMiddleRecyclerview.setHasFixedSize(true)
|
||||
binding.phenomenonMiddleRecyclerview.layoutManager = LinearLayoutManager(requireContext())
|
||||
binding.phenomenonMiddleRecyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
||||
|
||||
binding.phenomenonMiddleRecyclerview.adapter = middleAdapter
|
||||
//中间侧菜单查询结果监听
|
||||
viewModel.liveDataMiddleTypeList.observe(viewLifecycleOwner) {
|
||||
|
||||
@@ -5,15 +5,19 @@ import android.graphics.Canvas
|
||||
import android.graphics.Color
|
||||
import android.graphics.Paint
|
||||
import android.graphics.Rect
|
||||
import android.os.Build
|
||||
import android.view.View
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.recyclerview.widget.RecyclerView.ItemDecoration
|
||||
import com.navinfo.omqs.R
|
||||
|
||||
|
||||
/**
|
||||
* 自定义装饰器(实现分组+吸顶效果)
|
||||
*/
|
||||
@RequiresApi(Build.VERSION_CODES.M)
|
||||
class RightGroupHeaderDecoration(context: Context) : ItemDecoration() {
|
||||
//头部的高
|
||||
private val mItemHeaderHeight: Int
|
||||
@@ -31,7 +35,7 @@ class RightGroupHeaderDecoration(context: Context) : ItemDecoration() {
|
||||
mTextPaddingLeft = dp2px(context, 6f)
|
||||
mTextRect = Rect()
|
||||
mItemHeaderPaint = Paint(Paint.ANTI_ALIAS_FLAG)
|
||||
mItemHeaderPaint.color = Color.GRAY
|
||||
mItemHeaderPaint.color = context.getColor(R.color.btn_bg_blue)
|
||||
mTextPaint = Paint(Paint.ANTI_ALIAS_FLAG)
|
||||
mTextPaint.textSize = 46f
|
||||
mTextPaint.color = Color.WHITE
|
||||
@@ -84,7 +88,6 @@ class RightGroupHeaderDecoration(context: Context) : ItemDecoration() {
|
||||
(view.top - 1).toFloat(), right.toFloat(),
|
||||
view.top.toFloat(), mLinePaint
|
||||
)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user