[fea]
[车型注解、数据同步]
This commit is contained in:
yangyakun
2024-09-23 16:51:21 +08:00
parent bf2dc19d65
commit ce926a6412
7 changed files with 96 additions and 43 deletions

View File

@@ -5,6 +5,7 @@ import android.view.View
import androidx.fragment.app.Fragment
import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.enums.Carmodel
import com.mogo.eagle.core.function.call.och.CallerOchFunctionCallManager
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
@@ -151,8 +152,8 @@ class LoginProvider : LoginService {
this.loginInfo = loginInfo
}
CallerOchFunctionCallManager.setCarModel(loginInfo.carModel)
CallerOchFunctionCallManager.setPlateNumber(loginInfo.plateNumber)
CallerOchFunctionCallManager.setOchCarModel(Carmodel.getCarModelFromServerName(loginInfo.carModel))
CallerOchFunctionCallManager.setOchPlateNumber(loginInfo.plateNumber)
}

View File

@@ -6,6 +6,7 @@ import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.animation.LinearInterpolator
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.data.enums.Carmodel
import com.mogo.commons.module.status.MogoStatusManager
import com.mogo.eagle.core.data.config.HdMapBuildConfig
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
@@ -57,33 +58,10 @@ class CommonLoadingView @JvmOverloads constructor(
HdMapBuildConfig.isMapLoaded = true
// 设置地图样式
MogoMapListenerHandler.mogoMapListenerHandler.onMapModeChanged(EnumMapUI.MAP_STYLE_DAY_VR)
when (LoginStatusManager.getLoginInfo()?.carModel) {
"E70" -> {
HdMapBuildConfig.currentCarVrIconRes = com.mogo.eagle.core.data.R.raw.chuzuche
}
"H9" -> {
HdMapBuildConfig.currentCarVrIconRes = com.mogo.eagle.core.data.R.raw.hq_h9
}
"B1" -> {
HdMapBuildConfig.currentCarVrIconRes = com.mogo.eagle.core.data.R.raw.xiaoba
}
"B2" -> {
HdMapBuildConfig.currentCarVrIconRes = com.mogo.eagle.core.data.R.raw.m2
}
"M1" -> {
HdMapBuildConfig.currentCarVrIconRes = R.raw.m1
}
"金旅牌XML6606JEVY0"-> {
HdMapBuildConfig.currentCarVrIconRes = com.mogo.eagle.core.data.R.raw.xiaoba
}
"NJL6450ICEV"-> {
HdMapBuildConfig.currentCarVrIconRes = com.mogo.eagle.core.data.R.raw.xiaoba
}
"BJ5122TXSEV-H1"-> {
HdMapBuildConfig.currentCarVrIconRes = R.raw.huanwei
}
else -> {}
}
val carModel = Carmodel.getCarModelFromServerName(LoginStatusManager.getLoginInfo()?.carModel)
HdMapBuildConfig.currentCarVrIconRes = carModel.rawValue
CallerMapUIServiceManager.getMapUIController()?.changeCurrentIcon(HdMapBuildConfig.currentCarVrIconRes)
UiThreadHandler.postDelayed({ visibility = GONE },2_000,UiThreadHandler.MODE.QUEUE)
}

View File

@@ -16,13 +16,31 @@ import com.mogo.och.weaknet.repository.db.repository.TaskDb
data class CarExecutableTaskResponse(val data: List<Result>?) : BaseData(){
data class Result(
var line: LineDataBean?,
var line: LineDataBeanInsert?,
var siteList: List<SiteDataBean>?,//站点名称
val contrail: ContrailDataBean?,//站点名称
val taskList: List<TaskDataBean>?,//站点名称
)
data class LineDataBeanInsert(
/**
* 线路id
*/
var lineId: Long? = null,
/**
* 线路名称
*/
var lineName: String? = null,
/**
* 终点站点名称
*/
var endStationName: String? = null,
)
companion object{
/**
* 保存 线路信息、自驾轨迹信息、站点信息和任务到数据库
@@ -35,9 +53,12 @@ data class CarExecutableTaskResponse(val data: List<Result>?) : BaseData(){
data.data?.forEach { dataInfo->
var lineId:Long?=null
dataInfo.line?.let { lineInfo->
val tempLineInfo = LineDataBean()
lineId = lineInfo.lineId
lineInfo.endStationName = dataInfo.siteList?.last()?.name?:""
lineList.add(lineInfo)
tempLineInfo.lineId = lineInfo.lineId
tempLineInfo.lineName = lineInfo.lineName
tempLineInfo.endStationName = dataInfo.siteList?.last()?.name?:""
lineList.add(tempLineInfo)
}
dataInfo.contrail?.let { contrailInfo->
contrailInfo.lineId = lineId

View File

@@ -13,6 +13,7 @@ import com.mogo.eagle.core.utilcode.kotlin.onClick
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.view.SpacesItemDecoration
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.och.common.module.manager.loop.BizLoopManager
import com.mogo.och.common.module.utils.ResourcesUtils
import com.mogo.och.common.module.wigets.WindowRelativeLayout
import com.mogo.och.shuttle.weaknet.R
@@ -129,12 +130,14 @@ class SwitchLineView: WindowRelativeLayout, SwtichLineModel.SwtichLineViewCallba
* @param b
*/
private fun showNoData(b: Boolean) {
if (b) {
switch_line_rv.visibility = View.GONE
no_order_data_view.visibility = View.VISIBLE
} else {
switch_line_rv.visibility = View.VISIBLE
no_order_data_view.visibility = View.GONE
BizLoopManager.runInMainThread{
if (b) {
switch_line_rv.visibility = View.GONE
no_order_data_view.visibility = View.VISIBLE
} else {
switch_line_rv.visibility = View.VISIBLE
no_order_data_view.visibility = View.GONE
}
}
}

View File

@@ -0,0 +1,48 @@
package com.mogo.eagle.core.data.enums
import androidx.annotation.RawRes
import com.mogo.eagle.core.data.R
enum class Carmodel(val serverName:String,@RawRes val rawValue: Int) {
T1("E70", R.raw.chuzuche),
T2("H9", R.raw.hq_h9),
B1("B1", R.raw.xiaoba),
B2("B2", R.raw.m2),
M1("M1", R.raw.m1),
C1("C1", R.raw.huanwei),;
companion object{
fun getCarModelFromServerName(serverName:String?): Carmodel {
return when (serverName) {
"E70" -> {
T1
}
"H9" -> {
T2
}
"B1" -> {
B1
}
"金旅牌XML6606JEVY0" -> {
B1
}
"NJL6450ICEV" -> {
B1
}
"B2" -> {
B2
}
"M1" -> {
M1
}
"BJ5122TXSEV-H1" -> {
C1
}
else -> {
B1
}
}
}
}
}

View File

@@ -1,5 +1,7 @@
package com.mogo.eagle.core.function.api.och
import com.mogo.eagle.core.data.enums.Carmodel
/**
* 定义给 Och 业务层调用的接口
*/
@@ -11,7 +13,7 @@ interface IOchFunctionCall {
fun registerToolKitDefaultItemClickListener(tag: String, listener: IToolKitItemClickListener) {}
// 车型变化回调
fun invokeCarMode(carModel: String?){}
fun invokeCarMode(carModel: Carmodel?){}
// 车牌变化回调
fun invokePlateNumber(plateNumber: String?){}

View File

@@ -1,5 +1,6 @@
package com.mogo.eagle.core.function.call.och
import com.mogo.eagle.core.data.enums.Carmodel
import com.mogo.eagle.core.function.api.och.IOchCommonFunctionCall
import com.mogo.eagle.core.function.api.och.IOchFunctionCall
import com.mogo.eagle.core.function.api.och.IToolKitItemClickListener
@@ -20,7 +21,7 @@ object CallerOchFunctionCallManager : CallerBase<IOchFunctionCall>() {
}
// 车的类型
private var carModel:String? by Delegates.observable(null) { _, oldValue, newValue ->
private var carModel: Carmodel? by Delegates.observable(null) { _, oldValue, newValue ->
if (oldValue != newValue) {
M_LISTENERS.forEach {
it.value.invokeCarMode(carModel)
@@ -52,12 +53,11 @@ object CallerOchFunctionCallManager : CallerBase<IOchFunctionCall>() {
}
// 车型 E70 H9 B1 B2 M1 金旅牌XML6606JEVY0(小巴车) NJL6450ICEV(小巴) BJ5122TXSEV-H1(环卫车)
fun setCarModel(carModel: String?) {
fun setOchCarModel(carModel: Carmodel) {
this.carModel = carModel
}
// 车牌
fun setPlateNumber(plateNumber:String?){
fun setOchPlateNumber(plateNumber:String?){
this.plateNumber = plateNumber
}