Merge branch 'dev_robotaxi-d_250417_8.0.0_routing' into dev_robotaxi-d_250709_8.2.0_advideo

# Conflicts:
#	OCH/charter/passenger/src/main/java/com/mogo/och/charter/passenger/model/MusicModel.kt
#	OCH/common/common/src/main/java/com/mogo/och/common/module/constant/OchCommonConst.kt
This commit is contained in:
yangyakun
2025-07-29 16:43:30 +08:00
145 changed files with 4302 additions and 1389 deletions

View File

@@ -40,6 +40,15 @@ android {
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main {
res.srcDirs = [
'src/main/res',
'src/main/res/routing',
]
}
}
}
dependencies {
@@ -53,6 +62,7 @@ dependencies {
implementation rootProject.ext.dependencies.androidxappcompat
implementation rootProject.ext.dependencies.material
implementation rootProject.ext.dependencies.rxandroid
implementation rootProject.ext.dependencies.amapnavi3dmap
implementation project(':OCH:common:common')
implementation rootProject.ext.dependencies.arouter

View File

@@ -0,0 +1,53 @@
package com.mogo.och.biz.routing
import android.content.Context
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.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OCHCOMMON
import com.mogo.och.biz.routing.ui.RoutingSwitchView
import com.mogo.och.common.module.biz.routing.RoutingCallback
import com.mogo.och.common.module.biz.routing.RoutingService
import com.mogo.och.common.module.constant.OchCommonConst
@Route(path = OchCommonConst.BIZ_ROUTING)
class RoutingProvider : RoutingService {
private var context: Context? = null
private val TAG = M_OCHCOMMON + "RoutingProvider"
private var switchView:RoutingSwitchView?=null
private var callback:RoutingCallback?=null
override fun getRoutingView(): View? {
if(AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
context?.let {
if(switchView==null){
switchView = RoutingSwitchView(it)
}
return switchView
}
}
return null
}
override fun setRoutingCallback(callback: RoutingCallback?) {
this.callback = callback
}
override fun init(context: Context?) {
this.context = context
}
fun invokeCallbackShowMap(isShow: Boolean) {
this.callback?.showMap(isShow)
}
}

View File

@@ -0,0 +1,19 @@
package com.mogo.och.biz.routing
import android.annotation.SuppressLint
import com.alibaba.android.arouter.launcher.ARouter
import com.mogo.och.common.module.constant.OchCommonConst
object RoutingServiceManager {
@SuppressLint("StaticFieldLeak")
private var routingService: RoutingProvider? =
ARouter.getInstance().build(OchCommonConst.BIZ_ROUTING).navigation() as RoutingProvider
fun invokeCallback(isShow: Boolean) {
this.routingService?.invokeCallbackShowMap(isShow)
}
}

View File

@@ -0,0 +1,198 @@
package com.mogo.och.biz.routing.bean
import com.mogo.eagle.core.data.BaseData
import com.mogo.och.data.bean.BusStationBean
import com.mogo.och.data.bean.ContraiInfo
import com.mogo.och.data.bean.LineInfo
/**
* 灰度路线信息
*/
data class GrayLineBean(
var lineId: Long?, //线路id
var lineName: String?, //线路名称
var contrailId: Long?, //轨迹id
var carVerificationCount: Int?, //本次今日已验证次数
var lineSuccessCount: Int?, //线路累计反馈可用次数
var lineFailCount: Int?, //线路累计反馈不可用次数
var isChoosed: Boolean = false, //当前是否选中
var startSite: RoutingSite?,
var endSite: RoutingSite?,
var distance:Float,
)
/**
* 站点信息
*/
data class RoutingSite(
var siteId: Long,// 站点ID
var siteName: String,// 站点名称
var gcjLat: Double,// 高德坐标
var gcjLon: Double,// 高德坐标
var wgs84Lon: Double,//高精坐标
var wgs84Lat: Double,//高精坐标
) {
fun toBusStationBean(): BusStationBean {
val temp = BusStationBean()
temp.siteId = siteId.toInt()
temp.name = siteName
temp.lat = wgs84Lat
temp.lon = wgs84Lon
temp.gcjLat = gcjLat
temp.gcjLon = gcjLon
temp.isLeaving = true
return temp
}
}
/**
* 轨迹信息
*/
data class ContrailBean(
var businessType:Int=0,
var contrailId: Long = -1L,
var contrailSaveTime: Long = -1L,
var csvFileMd5: String = "",
var csvFileUrl: String = "",
var lineId: Long = -1L,
var lineName: String = "",
var segmentPointList:MutableList<PointInfoGroup> = mutableListOf(),
var txtFileMd5: String = "",
var txtFileUrl: String = "",
) {
fun toContraiInfo(): ContraiInfo {
val tempPassPoints = mutableListOf<BusStationBean>()
val tempblackPoints = mutableListOf<BusStationBean>()
segmentPointList.forEach {
for (pointInfo in it.blackList) {
tempblackPoints.add(pointInfo.toBusStationBean())
}
for (pointInfo in it.pointList) {
tempPassPoints.add(pointInfo.toBusStationBean())
}
}
return ContraiInfo(lineId,csvFileUrl,csvFileMd5,txtFileUrl,txtFileMd5,contrailSaveTime,tempPassPoints,tempblackPoints, 2)
}
fun getPassAndBlackPoint(index: Int): Pair<MutableList<BusStationBean>, MutableList<BusStationBean>> {
val tempPassPoints = mutableListOf<BusStationBean>()
val tempblackPoints = mutableListOf<BusStationBean>()
segmentPointList.forEach {
if(it.segment==index){
for (pointInfo in it.blackList) {
tempblackPoints.add(pointInfo.toBusStationBean())
}
for (pointInfo in it.pointList) {
tempPassPoints.add(pointInfo.toBusStationBean())
}
return Pair(tempPassPoints,tempblackPoints)
}
}
return Pair(tempPassPoints,tempblackPoints)
}
}
data class PointInfoGroup(var blackList:MutableList<PointInfo>,//用于算路的黑名單點
var pointList:MutableList<PointInfo>,//用于算路的经停点
var segment:Int)
data class PointInfo(var latitude:Double,var longitude:Double,var pointType:Int,var segment:Int) {
fun toBusStationBean(): BusStationBean {
val temp = BusStationBean()
temp.lat = latitude
temp.lon = longitude
temp.pointType = pointType
temp.isLeaving = true
return temp
}
}
/**
* 查询灰度线路列表
*/
data class QueryGrayContrailListRsp(var data: MutableList<GrayLineBean>?) : BaseData()
/**
* 通过id查询轨迹详情
*/
data class StartGrayContrailTaskReq(var sn: String, var contrailId: Long, var driverId: Long)
/**
* 开始一个路线的灰度任务,对服务端的路线标记
*/
data class StartGrayContrailTaskRsp(var data: Long?) : BaseData()
/**
* 根据id查询灰度轨迹详情
*/
data class QueryRoutingContrailByIdRsp(var data: ContrailBean?) : BaseData()
/**
* 结束一个路线的灰度任务
*/
data class EndGrayContrailTaskReq(
var grayId: Long,
var feedback: Int,
var occurrenceTime: Long
) //feedback 1:成功 2:失败
/**
* 灰度任务&查询轨迹详情
*/
data class StartGrayAndQueryContrailRsp(
var taskId: Long?,
var contrail: ContrailBean?,
var grayLineBean: GrayLineBean,
var stationList: MutableList<BusStationBean>
) : BaseData()
data class PointError(var code: String, var name: String, var isCheck: Boolean = false)
/**
* 获取打点问题字典
*/
data class QueryPointErrorReasonsRsp(var data: MutableList<PointError>?) : BaseData()
/**
* 结束一个路线的灰度任务,并上报灰度路线测试情况
*/
data class SaveGrayContrailErrorReasons(
var grayId: Long,
var gcjLon: Double,
var gcjLat: Double,
var wgs84Lon: Double,
var wgs84Lat: Double,
var occurrenceTime: Long,
var plateNumber: String,
var driverId: Long,
var noteCodes: MutableList<String>,
) //feedback 1:成功 2:失败
/**
* 小巴、接驳、班车 获取站点的参数
*/
data class QuerySitesReasons(
var lineId: Long, // 线路id
var businessType: Int,// 业务模式
)
enum class EndGrayTaskFeedbackType(var type: Int) {
USABLE_YES(1),
USABLE_NO(2)
}
data class BindLineListResponse(val data: List<Result>?) : BaseData() {
data class Result(
var line: LineInfo?,
var siteList: List<BusStationBean>?,//站点名称
)
}
data class SitesInfo(val data: List<RoutingSite>?) : BaseData()

View File

@@ -0,0 +1,102 @@
package com.mogo.och.biz.routing.net
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.commons.storage.SharedPrefsMgr
import com.mogo.eagle.core.data.BaseData
import com.mogo.och.biz.routing.bean.BindLineListResponse
import com.mogo.och.biz.routing.bean.QueryGrayContrailListRsp
import com.mogo.och.biz.routing.bean.QueryPointErrorReasonsRsp
import com.mogo.och.biz.routing.bean.QueryRoutingContrailByIdRsp
import com.mogo.och.biz.routing.bean.QuerySitesReasons
import com.mogo.och.biz.routing.bean.SaveGrayContrailErrorReasons
import com.mogo.och.biz.routing.bean.SitesInfo
import com.mogo.och.biz.routing.bean.StartGrayContrailTaskReq
import com.mogo.och.biz.routing.bean.StartGrayContrailTaskRsp
import io.reactivex.Observable
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.Header
import retrofit2.http.Headers
import retrofit2.http.POST
import retrofit2.http.Query
interface RoutingServiceApi {
/**
* 查询灰度线路列表
*/
@Headers("Content-type:application/json;charset=UTF-8")
@GET("/och-contrail/contrail/queryGrayContrailList")
fun queryRoutingGrayLineList(
@Header("appId") appId: String = MoGoAiCloudClientConfig.getInstance().serviceAppId,
@Header("ticket") ticket: String = SharedPrefsMgr.getInstance().token,
@Query("sn") sn: String?
): Observable<QueryGrayContrailListRsp>
/**
* 开始一个路线的灰度任务
*/
@Headers("Content-type:application/json;charset=UTF-8")
@POST("/och-contrail/grayFeedback/saveFeedback")
fun startGrayTask(
@Header("appId") appId: String = MoGoAiCloudClientConfig.getInstance().serviceAppId,
@Header("ticket") ticket: String = SharedPrefsMgr.getInstance().token,
@Body data: StartGrayContrailTaskReq
): Observable<StartGrayContrailTaskRsp>
/**
* 根据轨迹id查询轨迹信息
*/
@Headers("Content-type:application/json;charset=UTF-8")
@GET("/och-contrail/contrail/queryCabinContrailById")
fun queryRoutingContrailById(
@Header("appId") appId: String = MoGoAiCloudClientConfig.getInstance().serviceAppId,
@Header("ticket") ticket: String = SharedPrefsMgr.getInstance().token,
@Query("contrailId") contrailId: Long
): Observable<QueryRoutingContrailByIdRsp>
/**
* 结束一个路线的灰度任务
*/
@Headers("Content-type:application/json;charset=UTF-8")
@GET("/och-contrail/grayFeedback/update")
fun endGrayTask(
@Header("appId") appId: String = MoGoAiCloudClientConfig.getInstance().serviceAppId,
@Header("ticket") ticket: String = SharedPrefsMgr.getInstance().token,
@Query("id") id:Long,
@Query("feedback") feedback:Int,
): Observable<BaseData>
/**
* 获取打点问题字典
*/
@Headers("Content-type:application/json;charset=UTF-8")
@GET("/och-vehicle/api/dict/v1/dot/list")
fun getDotErrorList(
@Header("appId") appId: String = MoGoAiCloudClientConfig.getInstance().serviceAppId,
@Header("ticket") ticket: String = SharedPrefsMgr.getInstance().token,
): Observable<QueryPointErrorReasonsRsp>
/**
* 结束一个路线的灰度任务
*/
@Headers("Content-type:application/json;charset=UTF-8")
@POST("/och-contrail/dotDetail/save")
fun saveDotDetail(
@Header("appId") appId: String = MoGoAiCloudClientConfig.getInstance().serviceAppId,
@Header("ticket") ticket: String = SharedPrefsMgr.getInstance().token,
@Body data: SaveGrayContrailErrorReasons
): Observable<BaseData>
@Headers("Content-type:application/json;charset=UTF-8")
@POST("/och-vehicle/api/line/querySiteListByLine")
fun querySiteListByLine(
@Header("appId") appId: String = MoGoAiCloudClientConfig.getInstance().serviceAppId,
@Header("ticket") ticket: String = SharedPrefsMgr.getInstance().token,
@Body data: QuerySitesReasons
): Observable<SitesInfo>
}

View File

@@ -0,0 +1,167 @@
package com.mogo.och.biz.routing.net
import android.content.Context
import com.mogo.commons.storage.SharedPrefsMgr
import com.mogo.eagle.core.data.BaseData
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.network.MoGoRetrofitFactory
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.och.biz.routing.bean.EndGrayContrailTaskReq
import com.mogo.och.biz.routing.bean.GrayLineBean
import com.mogo.och.biz.routing.bean.QueryGrayContrailListRsp
import com.mogo.och.biz.routing.bean.QueryPointErrorReasonsRsp
import com.mogo.och.biz.routing.bean.QuerySitesReasons
import com.mogo.och.biz.routing.bean.SaveGrayContrailErrorReasons
import com.mogo.och.biz.routing.bean.StartGrayAndQueryContrailRsp
import com.mogo.och.biz.routing.bean.StartGrayContrailTaskReq
import com.mogo.och.common.module.biz.login.LoginStatusManager
import com.mogo.och.common.module.constant.OchCommonConst
import com.mogo.och.common.module.network.OchCommonServiceCallback
import com.mogo.och.common.module.network.OchCommonSubscribeImpl
import com.mogo.och.common.module.network.interceptor.transformTry
import com.mogo.och.data.bean.BusStationBean
import com.mogo.och.weaknet.repository.db.exception.NetDataException
import io.reactivex.Observable
object RoutingServiceManager {
private var mRoutingServiceApi: RoutingServiceApi =
MoGoRetrofitFactory.getInstance(OchCommonConst.getBaseUrl()).create(
RoutingServiceApi::class.java
)
/**
* 查询灰度路线列表
*/
fun queryRoutingGrayLineList(
context: Context,
callback: OchCommonServiceCallback<QueryGrayContrailListRsp>
) {
mRoutingServiceApi.queryRoutingGrayLineList(
sn = SharedPrefsMgr.getInstance().sn
)
.transformTry()
.subscribe(OchCommonSubscribeImpl(context, callback, "queryRoutingGrayLineList"))
}
/**
* 结束一个灰度任务
*/
fun endGrayTask(
context: Context,
data: EndGrayContrailTaskReq,
callback: OchCommonServiceCallback<BaseData>
) {
mRoutingServiceApi.endGrayTask(id = data.grayId, feedback = data.feedback).transformTry()
.subscribe(OchCommonSubscribeImpl(context, callback, "endGrayTask"))
}
fun getErrorPointReasons(
context: Context,
callback: OchCommonServiceCallback<QueryPointErrorReasonsRsp>
) {
mRoutingServiceApi.getDotErrorList().transformTry()
.subscribe(OchCommonSubscribeImpl(context, callback, "dot/list"))
}
fun saveDotDetail(
context: Context,
data: SaveGrayContrailErrorReasons,
callback: OchCommonServiceCallback<BaseData>
) {
mRoutingServiceApi.saveDotDetail(data = data).transformTry()
.subscribe(OchCommonSubscribeImpl(context, callback, "dot/list"))
}
/**
* 标记灰度任务被启动验证
*/
fun startGrayTaskAndQueryRoutingContrail(
context: Context,
sn: String,
contrailId: Long,
grayLineBean: GrayLineBean,
callback: OchCommonServiceCallback<StartGrayAndQueryContrailRsp>
) {
val data = StartGrayContrailTaskReq(sn, contrailId ,LoginStatusManager.getOchLoginInfo()?.driverId?:0L)
val requestContral = mRoutingServiceApi.queryRoutingContrailById(contrailId = contrailId)
val startRouting = mRoutingServiceApi.startGrayTask(data = data)
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)
||AppIdentityModeUtils.isShuttle(FunctionBuildConfig.appIdentityMode)
||AppIdentityModeUtils.isScheduled(FunctionBuildConfig.appIdentityMode)
) {
val request = QuerySitesReasons(grayLineBean.lineId?:0,
LoginStatusManager.getOchBizInfo()?.businessType?:11)
val querySites = mRoutingServiceApi.querySiteListByLine(data = request)
Observable.zip(requestContral,startRouting,querySites) { t1, t2, t3 ->
if ((t1.code != 0 && t1.code != 200) || t1.data == null) {
throw NetDataException(t1.code, "${t1.msg}_queryCabinContrailById")
}
if (t2.code != 0 && t2.code != 200 || t2.data == null) {
throw NetDataException(t2.code, "${t2.msg}_saveFeedback")
}
if (t3.code != 0 && t3.code != 200 || t3.data.isNullOrEmpty()) {
throw NetDataException(t3.code, "${t3.msg}_saveFeedback")
}
val stationList = mutableListOf<BusStationBean>()
t3.data.let { lineList->
lineList.forEach {
stationList.add(it.toBusStationBean())
}
}
val result = StartGrayAndQueryContrailRsp(
taskId = t2.data!!,
contrail = t1.data,
grayLineBean = grayLineBean,
stationList = stationList
)
result.code = t1.code
result.msg = t1.msg
result
}.transformTry()
.subscribe(
OchCommonSubscribeImpl(
context,
callback,
"startGrayTaskAndQueryRoutingContrail"
)
)
}else if(AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)){
Observable.zip(requestContral,startRouting) { t1, t2 ->
if ((t1.code != 0 && t1.code != 200)||t1.data==null) {
throw NetDataException(t1.code,"${t1.msg}_queryCabinContrailById")
}
if (t2.code != 0 && t2.code != 200||t2.data==null) {
throw NetDataException(t2.code,"${t2.msg}_saveFeedback")
}
val stationList = mutableListOf<BusStationBean>()
grayLineBean.startSite?.toBusStationBean()?.let {
stationList.add(it)
}
grayLineBean.endSite?.toBusStationBean()?.let {
stationList.add(it)
}
val result = StartGrayAndQueryContrailRsp(
taskId = t2.data!!,
contrail = t1.data,
grayLineBean = grayLineBean,
stationList = stationList
)
result.code = t1.code
result.msg = t1.msg
result
}.transformTry()
.subscribe(
OchCommonSubscribeImpl(
context,
callback,
"startGrayTaskAndQueryRoutingContrail"
)
)
}
}
}

View File

@@ -0,0 +1,48 @@
package com.mogo.och.biz.routing.ui
import androidx.lifecycle.ViewModel
import com.mogo.och.biz.routing.bean.StartGrayAndQueryContrailRsp
import com.mogo.och.common.module.manager.loop.BizLoopManager
/**
* @author XuXinChao
* @description BadCase录包管理页面
* @since: 2022/12/15
*/
class RoutingSwitchModel : ViewModel() {
private val TAG = RoutingSwitchModel::class.java.simpleName
private var viewCallback: SwtichLineViewCallback? = null
override fun onCleared() {
}
fun setDistanceCallback(viewCallback: SwtichLineViewCallback) {
this.viewCallback = viewCallback
}
fun showLoading() {
BizLoopManager.runInMainThread{
this.viewCallback?.showLoadingView()
}
}
fun showRoutingSelectView(){
this.viewCallback?.showRoutingSelectView()
}
fun showRoutingRunning(data: StartGrayAndQueryContrailRsp) {
this.viewCallback?.showRoutingRunning(data)
}
interface SwtichLineViewCallback {
fun showLoadingView()
fun showRoutingSelectView()
fun showRoutingRunning(data: StartGrayAndQueryContrailRsp)
}
}

View File

@@ -0,0 +1,141 @@
package com.mogo.och.biz.routing.ui
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.findViewTreeViewModelStoreOwner
import com.mogo.commons.module.status.MogoStatusManager
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.och.biz.R
import com.mogo.och.biz.routing.bean.StartGrayAndQueryContrailRsp
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
import com.mogo.och.common.module.utils.ResourcesUtils
import com.mogo.och.common.module.utils.RxUtils
import kotlinx.android.synthetic.main.biz_taxi_switch.view.routingOtherRunningView
import kotlinx.android.synthetic.main.biz_taxi_switch.view.routingSelectView
import kotlinx.android.synthetic.main.biz_taxi_switch.view.routingTaxiRunningView
import kotlinx.android.synthetic.main.biz_taxi_switch.view.switch_routing_loading
class RoutingSwitchView: ConstraintLayout, RoutingSwitchModel.SwtichLineViewCallback {
constructor(context: Context) : super(context)
constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet)
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int) : super(context, attributeSet, defStyleAttr)
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attributeSet, defStyleAttr, defStyleRes)
companion object {
const val TAG = "SwitchBizView"
}
private var viewModel: RoutingSwitchModel?=null
private var data: StartGrayAndQueryContrailRsp?=null
init {
LayoutInflater.from(context).inflate(R.layout.biz_taxi_switch, this, true)
initView()
initEventBus()
}
private fun initView(){
switch_routing_loading.setEmptyText(ResourcesUtils.getString(R.string.common_biz_loading))
}
private fun initEventBus() {
}
override fun onVisibilityAggregated(isVisible: Boolean) {
super.onVisibilityAggregated(isVisible)
if(isVisible){
showLoadingView()
if (MogoStatusManager.getInstance().isTaxiUnmanedDriverLineRoutingPerformTask) {
if(data!=null){
showRoutingRunning(data!!)
}else{
showRoutingSelectView()
}
}else {
showRoutingSelectView()
}
}
}
var startLoading = System.currentTimeMillis()
// 展示loading页面
override fun showLoadingView(){
startLoading = System.currentTimeMillis()
routingSelectView.visibility = GONE
routingTaxiRunningView.visibility = GONE
routingOtherRunningView.visibility = GONE
switch_routing_loading.visibility = VISIBLE
}
override fun showRoutingSelectView() {
this.data = null
val endLoading = System.currentTimeMillis()
val dex = (100-(endLoading - startLoading)).takeIf { it>=0 }?:0
CallerLogger.d(TAG,"展示选择线路 lading 展示了 ${dex}毫秒")
ThreadUtils.runOnUiThreadDelayed({
routingSelectView.visibility = VISIBLE
routingTaxiRunningView.visibility = GONE
routingOtherRunningView.visibility = GONE
switch_routing_loading.visibility = GONE
},dex, ThreadUtils.MODE.QUEUE)
}
override fun showRoutingRunning(data: StartGrayAndQueryContrailRsp) {
this.data = data
val endLoading = System.currentTimeMillis()
val dex = (100-(endLoading - startLoading)).takeIf { it>=0 }?:0
CallerLogger.d(TAG,"展示线路 lading 展示了 ${dex}毫秒")
OchChainLogManager.writeChainLogRouting("展示线路:","延时${dex}ms")
RxUtils.createSubscribe(dex) {
OchChainLogManager.writeChainLogRouting("展示线路:","信息:$data")
routingSelectView.visibility = GONE
switch_routing_loading.visibility = GONE
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)
|| AppIdentityModeUtils.isShuttle(FunctionBuildConfig.appIdentityMode)
|| AppIdentityModeUtils.isScheduled(FunctionBuildConfig.appIdentityMode)
) {
routingTaxiRunningView.visibility = GONE
routingOtherRunningView.visibility = VISIBLE
routingOtherRunningView.setData(data)
}else if(AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)){
routingTaxiRunningView.visibility = VISIBLE
routingOtherRunningView.visibility = GONE
routingTaxiRunningView.setData(data)
}
}
}
override fun onAttachedToWindow() {
CallerLogger.d(TAG,"onAttachedToWindow")
super.onAttachedToWindow()
viewModel = findViewTreeViewModelStoreOwner()?.let {
ViewModelProvider(it).get(RoutingSwitchModel::class.java)
}
viewModel?.setDistanceCallback(this)
data = null
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerLogger.d(TAG,"onDetachedFromWindow")
data = null
}
}

View File

@@ -0,0 +1,69 @@
package com.mogo.och.biz.routing.ui.errorpoint
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.widget.AppCompatImageView
import androidx.appcompat.widget.AppCompatTextView
import androidx.recyclerview.widget.RecyclerView
import com.mogo.eagle.core.utilcode.kotlin.onClick
import com.mogo.och.biz.R
import com.mogo.och.biz.routing.bean.PointError
import me.jessyan.autosize.AutoSizeCompat
/**
* Created by yangyakun on 06/06/17.
*/
class ErrorPointItemAdapter(
private val context: Context,
private val dataList: MutableList<PointError>
) : RecyclerView.Adapter<ErrorPointItemAdapter.TextVH>() {
fun setDataList(dataList: List<PointError>) {
this.dataList.clear()
this.dataList.addAll(dataList)
notifyDataSetChanged()
}
fun getCheckDataList():MutableList<PointError>{
val mutableListOf = mutableListOf<PointError>()
this.dataList.forEach {
if(it.isCheck){
mutableListOf.add(it)
}
}
return mutableListOf
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): TextVH {
val view: View
val inflater = LayoutInflater.from(context)
view = inflater.inflate(R.layout.biz_taxi_report_error_point_item, parent, false)
return TextVH(view)
}
override fun onBindViewHolder(holder: TextVH, position: Int) {
val errorInfo = dataList[holder.bindingAdapterPosition]
AutoSizeCompat.autoConvertDensityOfGlobal(holder.itemView.resources)
if (errorInfo.isCheck) {
holder.cbErrorInfo.setImageResource(R.drawable.biz_taxi_routing_check)
}else{
holder.cbErrorInfo.setImageResource(R.drawable.biz_taxi_uncheck)
}
holder.cbErrorResong.text = errorInfo.name
holder.itemView.onClick {
errorInfo.isCheck = !errorInfo.isCheck
notifyItemChanged(holder.bindingAdapterPosition)
}
}
override fun getItemCount(): Int {
return dataList.size
}
inner class TextVH(itemView: View) : RecyclerView.ViewHolder(itemView) {
var cbErrorInfo: AppCompatImageView = itemView.findViewById(R.id.aciv_show_check_status)
var cbErrorResong: AppCompatTextView = itemView.findViewById(R.id.actv_error_resong)
}
}

View File

@@ -0,0 +1,166 @@
package com.mogo.och.biz.routing.ui.errorpoint
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.GridLayoutManager
import com.mogo.eagle.core.utilcode.kotlin.onClick
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.util.TimeUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.och.biz.R
import com.mogo.och.biz.routing.bean.PointError
import com.mogo.och.common.module.wigets.WindowRelativeLayout
import com.mogo.och.common.module.wigets.dialog.CommonDialogView
import com.mogo.och.common.module.wigets.dialog.CommonFeedbackDialog
import kotlinx.android.synthetic.main.biz_taxi_report_error_point_panel.view.rvErrorPointReason
import kotlinx.android.synthetic.main.biz_taxi_report_error_point_panel.view.lvs_loding
import kotlinx.android.synthetic.main.biz_taxi_report_error_point_panel.view.tv_report_error_point_reason
import kotlinx.android.synthetic.main.biz_taxi_report_error_point_panel.view.tv_report_error_point_reason_cancel
import kotlinx.android.synthetic.main.biz_taxi_report_error_point_panel.view.tv_work_order_time
/**
*
* 评价View
* Created on 2022/5/16
*/
class ReportErrorPointView : WindowRelativeLayout,
ReportErrorPointViewModel.ReportErrorPointViewCallback {
companion object {
const val TAG = "TaxiPassengerArrivedView"
fun showDialog(context: Context, grayId: Long) {
val view = ReportErrorPointView(context)
val dialog = CommonDialogView(context, view,900f,730f,true)
view.setGrayId(grayId)
view.setDismiss(object : CommonDialogView.CloseCallback {
override fun close() {
dialog.hideDialog()
}
})
dialog.showDialog()
}
}
constructor(context: Context) : super(context)
constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet)
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int) : super(
context,
attributeSet,
defStyleAttr
)
constructor(
context: Context,
attributeSet: AttributeSet,
defStyleAttr: Int,
defStyleRes: Int
) : super(context, attributeSet, defStyleAttr, defStyleRes)
private var viewModel: ReportErrorPointViewModel? = null
private lateinit var errorPointItemAdapter: ErrorPointItemAdapter
private var closeCallback: CommonDialogView.CloseCallback? = null
private var grayId: Long? = -1L
private var occurrenceTime: Long = System.currentTimeMillis()
private fun initView() {
d(SceneConstant.M_TAXI_P + TAG, "initView")
LayoutInflater.from(context).inflate(R.layout.biz_taxi_report_error_point_panel, this, true)
rvErrorPointReason?.layoutManager = GridLayoutManager(context, 2)
rvErrorPointReason?.setHasFixedSize(true)
errorPointItemAdapter = ErrorPointItemAdapter(
context, mutableListOf(
)
)
rvErrorPointReason?.adapter = errorPointItemAdapter
tv_report_error_point_reason_cancel.onClick {
this.closeCallback?.close()
}
tv_report_error_point_reason.onClick {
val checkDataList = errorPointItemAdapter.getCheckDataList()
if (checkDataList.isEmpty()) {
ToastUtils.showShort("请选择问题类型")
return@onClick
}
tv_report_error_point_reason_cancel.isEnabled = false
lvs_loding.visibility = VISIBLE
this.viewModel?.submitErrorPointReasons(checkDataList, occurrenceTime)
}
}
override fun onVisibilityAggregated(isVisible: Boolean) {
super.onVisibilityAggregated(isVisible)
d(SceneConstant.M_TAXI_P + TAG, "展示---:${isVisible}")
if (isVisible) {
occurrenceTime = System.currentTimeMillis()
tv_work_order_time.text =
TimeUtils.millis2String(occurrenceTime, TimeUtils.getHourMinSecondFormat())
viewModel?.getPointErrorReasons()
} else {
}
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
viewModel = ViewModelProvider(this).get(ReportErrorPointViewModel::class.java)
viewModel?.setViewCallback(this)
viewModel?.setGrayId(grayId)
}
init {
try {
initView()
} catch (e: Exception) {
e.printStackTrace()
}
}
override fun addViewData(it: MutableList<PointError>) {
errorPointItemAdapter.setDataList(it)
}
override fun hideLoadingWithMessage(msg: String?) {
msg?.let {
ToastUtils.showLong(msg)
}
lvs_loding.visibility = GONE
CommonFeedbackDialog
.Builder()
.title("请重试")
.status(CommonFeedbackDialog.Status.success)
.build(context).show()
}
override fun submitErrorReasons() {
tv_report_error_point_reason_cancel.isEnabled = true
lvs_loding.visibility = GONE
closeCallback?.close()
CommonFeedbackDialog
.Builder()
.title("打点成功")
.status(CommonFeedbackDialog.Status.success)
.build(context).show()
}
fun setDismiss(listener: CommonDialogView.CloseCallback) {
this.closeCallback = listener
}
fun setGrayId(grayId: Long?) {
this.grayId = grayId
}
}

View File

@@ -0,0 +1,123 @@
package com.mogo.och.biz.routing.ui.errorpoint
import androidx.lifecycle.ViewModel
import com.mogo.commons.AbsMogoApplication
import com.mogo.eagle.core.data.BaseData
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.och.biz.routing.bean.PointError
import com.mogo.och.biz.routing.bean.QueryPointErrorReasonsRsp
import com.mogo.och.biz.routing.bean.SaveGrayContrailErrorReasons
import com.mogo.och.biz.routing.net.RoutingServiceManager
import com.mogo.och.bridge.autopilot.location.OchLocationManager
import com.mogo.och.common.module.biz.login.LoginStatusManager
import com.mogo.och.common.module.network.OchCommonServiceCallback
class ReportErrorPointViewModel : ViewModel() {
private val TAG = ReportErrorPointViewModel::class.java.simpleName
private var viewCallback: ReportErrorPointViewCallback? = null
private var grayId: Long?=-1L
init {
}
fun setViewCallback(viewCallback: ReportErrorPointViewCallback) {
this.viewCallback = viewCallback
}
fun getPointErrorReasons(){
RoutingServiceManager.getErrorPointReasons(
AbsMogoApplication.getApp(),
object : OchCommonServiceCallback<QueryPointErrorReasonsRsp> {
override fun onSuccess(data: QueryPointErrorReasonsRsp?) {
data?.data?.let {
viewCallback?.addViewData(it)
}
}
override fun onFail(code: Int, msg: String?) {
viewCallback?.hideLoadingWithMessage(msg)
}
override fun onError() {
super.onError()
viewCallback?.hideLoadingWithMessage("网络错误、请稍后再试")
}
}
)
}
override fun onCleared() {
super.onCleared()
this.viewCallback = null
}
fun submitErrorPointReasons(checkDataList: MutableList<PointError>, occurrenceTime: Long) {
CallerLogger.d(TAG,checkDataList,grayId)
if (grayId == null || grayId!! < 0L) {
viewCallback?.hideLoadingWithMessage("未找到规划Id")
return
}
grayId?.let {
val gcj02 = OchLocationManager.getGCJ02Location()
val wgs84 = OchLocationManager.getWgs02Location()
val errorReasonCodes = mutableListOf<String>()
checkDataList.forEach {pointError->
errorReasonCodes.add(pointError.code)
}
val saveGrayContrailErrorReasons = SaveGrayContrailErrorReasons(
it,
gcj02.longitude,
gcj02.latitude,
wgs84.longitude,
wgs84.latitude,
occurrenceTime,
LoginStatusManager.getOchCarInfo()?.plateNumber?:"",
LoginStatusManager.getOchLoginInfo()?.driverId?:0L,
errorReasonCodes
)
RoutingServiceManager.saveDotDetail(
AbsMogoApplication.getApp(),
saveGrayContrailErrorReasons,
object : OchCommonServiceCallback<BaseData> {
override fun onSuccess(data: BaseData?) {
if (data != null && data.code == 0){
ToastUtils.showShort("提交成功")
viewCallback?.submitErrorReasons()
}
}
override fun onFail(code: Int, msg: String?) {
viewCallback?.hideLoadingWithMessage(msg)
}
override fun onError() {
super.onError()
viewCallback?.hideLoadingWithMessage("网络错误、请稍后再试")
}
}
)
}
}
fun setGrayId(grayId: Long?) {
this.grayId = grayId
}
interface ReportErrorPointViewCallback {
fun addViewData(it: MutableList<PointError>)
fun hideLoadingWithMessage(msg: String?)
fun submitErrorReasons()
}
}

View File

@@ -0,0 +1,110 @@
package com.mogo.och.biz.routing.ui.routingselect
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.widget.AppCompatTextView
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.DiffUtil.Callback
import androidx.recyclerview.widget.RecyclerView
import com.mogo.och.biz.R
import com.mogo.och.biz.routing.bean.GrayLineBean
import me.jessyan.autosize.AutoSizeCompat
/**
* 路线列表adapter
*/
class RoutingItemAdapter(
private val mContext: Context,
val mData: MutableList<GrayLineBean>
) : RecyclerView.Adapter<RoutingItemAdapter.RoutingItemViewHolder>() {
companion object{
const val TAG = "SwitchLineAdapter"
}
// RecyclerView设置点击事件
private var mItemClickListener: LineItemClickListener? = null
fun setDataList(dataList: List<GrayLineBean>) {
if (this.mData == dataList) {
// 如果新旧列表一致,则直接返回
return
}
val diffResult = DiffUtil.calculateDiff(MyDiffCallback(this.mData, dataList))
this.mData.clear()
this.mData.addAll(dataList)
diffResult.dispatchUpdatesTo(this)
}
override fun onCreateViewHolder(
parent: ViewGroup,
viewType: Int
): RoutingItemViewHolder {
val view = LayoutInflater.from(mContext).inflate(
R.layout.biz_taxi_select_item, parent, false
)
return RoutingItemViewHolder(view)
}
override fun onBindViewHolder(holder: RoutingItemViewHolder, position: Int) {
val currentPosition = holder.bindingAdapterPosition
val routing = mData[currentPosition]
AutoSizeCompat.autoConvertDensityOfGlobal(holder.itemView.resources)
holder.routingName.text = routing.lineName
holder.todayVerifyNum.text = "今日验证:${routing.carVerificationCount}"
holder.routingEndName.text = "${routing.endSite?.siteName?:""}方向"
holder.historyVerifyNumEnableNum.text = "${routing.lineSuccessCount}可用"
holder.historyVerifyNumDisenableNum.text = "${routing.lineFailCount}不可用"
//设置item点击事件
holder.routingStart.setOnClickListener {
mItemClickListener?.onItemClick(routing)
}
}
override fun getItemCount(): Int {
return mData.size
}
fun setOnLineItemClickListener(itemClickListener: LineItemClickListener?) {
mItemClickListener = itemClickListener
}
class RoutingItemViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val routingName: AppCompatTextView = itemView.findViewById(R.id.actv_routing_name)//线路名称
val todayVerifyNum: AppCompatTextView = itemView.findViewById(R.id.actv_today_verify_num) //终点
val routingEndName: AppCompatTextView = itemView.findViewById(R.id.actv_routing_end_name) //终点站点名称
val historyVerifyNumEnableNum: AppCompatTextView = itemView.findViewById(R.id.actv_history_verify_num_enable_num) //终点站点名称
val historyVerifyNumDisenableNum: AppCompatTextView = itemView.findViewById(R.id.actv_history_verify_num_disenable_num) //终点站点名称
val routingStart: AppCompatTextView = itemView.findViewById(R.id.actv_routing_start) //终点站点名称
}
interface LineItemClickListener {
fun onItemClick(data: GrayLineBean)
}
inner class MyDiffCallback(private val oldData:List<GrayLineBean>, private val newData:List<GrayLineBean>):
Callback(){
override fun getOldListSize(): Int {
return oldData.size
}
override fun getNewListSize(): Int {
return newData.size
}
override fun areItemsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean {
val oldItem = oldData[oldItemPosition]
val newItem = newData[newItemPosition]
return oldItem == newItem
}
override fun areContentsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean {
val oldItem = oldData[oldItemPosition]
val newItem = newData[newItemPosition]
return oldItem == newItem
}
}
}

View File

@@ -0,0 +1,209 @@
package com.mogo.och.biz.routing.ui.routingselect
import androidx.lifecycle.ViewModel
import com.mogo.commons.AbsMogoApplication
import com.mogo.commons.storage.SharedPrefsMgr
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.och.CallerEagleBaseFunctionCall4OchManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OCHCOMMON
import com.mogo.eagle.core.utilcode.util.GsonUtils
import com.mogo.eagle.core.utilcode.util.NetworkUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.och.biz.routing.bean.GrayLineBean
import com.mogo.och.biz.routing.bean.QueryGrayContrailListRsp
import com.mogo.och.biz.routing.bean.StartGrayAndQueryContrailRsp
import com.mogo.och.biz.routing.net.RoutingServiceManager
import com.mogo.och.bridge.autopilot.line.LineManager
import com.mogo.och.common.module.network.OchCommonServiceCallback
import com.mogo.och.data.bean.LineInfo
import com.mogo.och.common.module.biz.birdge.BridgeManager
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
/**
* @author XuXinChao
* @description BadCase录包管理页面
* @since: 2022/12/15
*/
class RoutingSelectModel : ViewModel() {
private val TAG = M_OCHCOMMON +"RoutingSelectModel"
private var viewCallback: SwtichRoutingViewCallback? = null
private val content = AbsMogoApplication.getApp()
override fun onCleared() {
}
/**
* 查询灰度路线
*/
fun queryRoutingGrayLineList() {
OchChainLogManager.writeChainLogRouting("[查询灰度路线]","[查询灰度路线] 准备发送请求sn=${SharedPrefsMgr.getInstance().sn}")
RoutingServiceManager.queryRoutingGrayLineList(
content,
object : OchCommonServiceCallback<QueryGrayContrailListRsp> {
override fun onSuccess(data: QueryGrayContrailListRsp) {
CallerLogger.d(
TAG,
"queryRoutingGrayLineList onSuccess: data=${GsonUtils.toJson(data)}"
)
OchChainLogManager.writeChainLogRouting("[查询灰度路线]","[查询灰度路线] 请求successdataSize=${data?.data?.size}")
val result = mutableListOf<GrayLineBean>()
data.data?.also {
result.addAll(it)
}
result.forEach {
it.startSite?.let { startSite->
it.distance = BridgeManager.distance2Point( startSite.gcjLon, startSite.gcjLat,)
}
}
result.sortBy { it.distance }
viewCallback?.onQueryRoutingGrayLineListSuccess(result)
}
override fun onFail(code: Int, msg: String?) {
CallerLogger.d(
TAG,
"queryRoutingGrayLineList onFail: code=$code, msg=$msg"
)
OchChainLogManager.writeChainLogRouting("[查询灰度路线]","[查询灰度路线] 请求fail, code=$code, msg=$msg, sn=${SharedPrefsMgr.getInstance().sn}")
ToastUtils.showShort("查询灰度线路列表异常, 请稍后重试, code=$code")
viewCallback?.onQueryRoutingGrayLineListFailed(msg ?: "查询灰度线路列表异常, 请稍后重试")
}
override fun onError() {
super.onError()
var hintStr = ""
if (!NetworkUtils.isConnected(content)) {
hintStr = "网络出现异常,请稍后重试"
} else {
hintStr = "查询灰度线路列表异常, 请稍后重试"
}
CallerLogger.d(
TAG,
"queryRoutingGrayLineList onError, msg=$hintStr, sn=${SharedPrefsMgr.getInstance().sn}"
)
OchChainLogManager.writeChainLogRouting("[查询灰度路线]","[查询灰度路线] 请求error, msg=$hintStr")
viewCallback?.onQueryRoutingGrayLineListFailed(hintStr)
}
})
}
/**
* 开始灰度任务&查询轨迹详情
*/
fun startGrayTaskAndQueryRoutingContrail(contrailId: Long, grayLineBean: GrayLineBean) {
OchChainLogManager.writeChainLogRouting("[开始灰度任务&查询轨迹详情]","[开始灰度任务&查询轨迹详情] 准备发送请求contrailId=${contrailId}, lineId=${grayLineBean.lineId}")
RoutingServiceManager.startGrayTaskAndQueryRoutingContrail(
content,
sn = SharedPrefsMgr.getInstance().sn,
contrailId = contrailId,
grayLineBean = grayLineBean,
object : OchCommonServiceCallback<StartGrayAndQueryContrailRsp> {
override fun onSuccess(data: StartGrayAndQueryContrailRsp) {
CallerLogger.d(
TAG,
"startGrayTaskAndQueryRoutingContrail onSuccess: data=${
GsonUtils.toJson(
data
)
}"
)
OchChainLogManager.writeChainLogRouting("[开始灰度任务&查询轨迹详情]","[开始灰度任务&查询轨迹详情] 请求successtaskId=${data.taskId}, contrailId=${contrailId}, lineId=${grayLineBean.lineId}")
initAutopilot(data)
}
override fun onFail(code: Int, msg: String?) {
CallerLogger.d(
TAG,
"startGrayTaskAndQueryRoutingContrail onFail: code=$code, msg=$msg"
)
OchChainLogManager.writeChainLogRouting("[开始灰度任务&查询轨迹详情]","[开始灰度任务&查询轨迹详情] 请求fail, code=$code, msg=$msg, contrailId=${contrailId}, lineId=${grayLineBean.lineId}")
viewCallback?.onStartGrayTaskAndQueryContrailFailed( msg ?: "startGrayTaskAndQueryRoutingContrail onFail")
}
override fun onError() {
super.onError()
var hintStr = ""
if (!NetworkUtils.isConnected(content)) {
hintStr = "网络出现异常,请稍后重试"
} else {
hintStr = "开始任务并查询轨迹详情异常, 请稍后重试"
}
CallerLogger.d(
TAG,
"startGrayTaskAndQueryRoutingContrail onError, msg=$hintStr, contrailId=${contrailId}, lineId=${grayLineBean.lineId}"
)
OchChainLogManager.writeChainLogRouting("[开始灰度任务&查询轨迹详情]","[开始灰度任务&查询轨迹详情] 请求error, msg=$hintStr")
viewCallback?.onStartGrayTaskAndQueryContrailFailed(hintStr)
}
}
)
}
private fun initAutopilot(data: StartGrayAndQueryContrailRsp) {
OchChainLogManager.writeChainLogRouting("[开始任务]","[开始任务] 准备开始任务")
val grayLineBean = data.grayLineBean
val contrailBean = data.contrail
val grayId = data.taskId
val stationList = data.stationList
if (grayLineBean == null || contrailBean == null || stationList.size < 2) {
ToastUtils.showShort("灰度线路或轨迹信息异常,请稍后再试")
OchChainLogManager.writeChainLogRouting("[开始任务]","[开始任务] 灰度线路或轨迹信息异常,请稍后再试")
return
}
OchChainLogManager.writeChainLogRouting("[启自驾]","[启自驾] 准备启动自驾")
stationList.forEachIndexed { index, busStationBean ->
if(index>0){
val (tempPassPoints, tempblackPoints) = contrailBean.getPassAndBlackPoint(index)
busStationBean.passPoints = tempPassPoints
busStationBean.blackPoints = tempblackPoints
}
}
LineManager.setLineInfo(
LineInfo(grayLineBean.lineId?:0L,
grayLineBean.lineName?:"",
orderId = "${data.taskId}",
siteInfos = stationList)
)
LineManager.setContraiInfo(contrailBean.toContraiInfo())
CallerEagleBaseFunctionCall4OchManager.updateOrderStatus(true)
viewCallback?.onStartGrayTaskAndQueryContrailSuccess(data)
// Routing 从这里解析出经停信息,轨迹信息,并调用下载轨迹接口
LineManager.initAutopilotControlParametersFromContrai()?.let {
CallerLogger.d(TAG,"下发下载轨迹信息:${it}")
OchChainLogManager.writeChainLogRouting("[启自驾]","下发下载轨迹信息:${it}")
CallerAutoPilotControlManager.sendTrajectoryDownloadReq(it)
}
}
fun setDistanceCallback(viewCallback: SwtichRoutingViewCallback) {
this.viewCallback = viewCallback
}
interface SwtichRoutingViewCallback {
fun onQueryRoutingGrayLineListSuccess(data: MutableList<GrayLineBean>)
fun onQueryRoutingGrayLineListFailed(errorStr: String)
/**
* 灰度任务&查询轨迹详情--成功✅
*/
fun onStartGrayTaskAndQueryContrailSuccess(data: StartGrayAndQueryContrailRsp)
/**
* 灰度任务&查询轨迹详情--失败❌
* @param errorStr 错误信息
*/
fun onStartGrayTaskAndQueryContrailFailed(errorStr: String)
}
}

View File

@@ -0,0 +1,150 @@
package com.mogo.och.biz.routing.ui.routingselect
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.findViewTreeViewModelStoreOwner
import com.mogo.eagle.core.utilcode.kotlin.onClick
import com.mogo.eagle.core.utilcode.mogo.view.SpacesItemDecoration
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.och.biz.R
import com.mogo.och.biz.routing.bean.GrayLineBean
import com.mogo.och.biz.routing.bean.StartGrayAndQueryContrailRsp
import com.mogo.och.common.module.wigets.WrapContentLinearLayoutManager
import com.mogo.och.biz.routing.ui.RoutingSwitchModel
import com.mogo.och.biz.routing.ui.routingselect.RoutingSelectModel.SwtichRoutingViewCallback
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
import kotlinx.android.synthetic.main.biz_taxi_select.view.actv_refresh
import kotlinx.android.synthetic.main.biz_taxi_select.view.include_empty
import kotlinx.android.synthetic.main.biz_taxi_select.view.include_error
import kotlinx.android.synthetic.main.biz_taxi_select.view.switch_routing_rv
import me.jessyan.autosize.utils.AutoSizeUtils
class RoutingSelectView: ConstraintLayout, SwtichRoutingViewCallback {
constructor(context: Context) : super(context)
constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet)
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int) : super(context, attributeSet, defStyleAttr)
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attributeSet, defStyleAttr, defStyleRes)
companion object {
const val TAG = "SwitchBizView"
}
private var viewModel: RoutingSelectModel?=null
private var swtichViewModel: RoutingSwitchModel?=null
private lateinit var mChooseLineListAdapter: RoutingItemAdapter
private lateinit var mLinearLayoutManager: WrapContentLinearLayoutManager
private val mRoutingLineList: MutableList<GrayLineBean> = ArrayList()
private var mCurrentChosenPosition: Int = -1
init {
LayoutInflater.from(context).inflate(R.layout.biz_taxi_select, this, true)
initView()
}
private fun initView(){
mLinearLayoutManager = WrapContentLinearLayoutManager(context)
switch_routing_rv.layoutManager = mLinearLayoutManager
mChooseLineListAdapter = RoutingItemAdapter(context, mRoutingLineList)
switch_routing_rv.addItemDecoration(SpacesItemDecoration(AutoSizeUtils.dp2px(context,20f)))
switch_routing_rv.adapter = mChooseLineListAdapter
//设置item 点击事件
mChooseLineListAdapter.setOnLineItemClickListener(object :
RoutingItemAdapter.LineItemClickListener {
override fun onItemClick(data: GrayLineBean) {
if(data.contrailId==null||data.contrailId!!<=0L){
ToastUtils.showShort("请设置轨迹信息")
}
OchChainLogManager.writeChainLogRouting("[选择灰度任务]","[选择灰度任务] 当前选择 ${data} ")
swtichViewModel?.showLoading()
viewModel?.startGrayTaskAndQueryRoutingContrail(data.contrailId!!,data)
}
})
actv_refresh.onClick {
viewModel?.queryRoutingGrayLineList()
}
}
private fun showEmptyView() {
switch_routing_rv.visibility = GONE
include_empty.visibility = View.VISIBLE
include_error.visibility = View.GONE
}
private fun showErrorView() {
switch_routing_rv.visibility = GONE
include_empty.visibility = View.GONE
include_error.visibility = View.VISIBLE
}
private fun showRecyclerView() {
switch_routing_rv.visibility = VISIBLE
include_empty.visibility = View.GONE
include_error.visibility = View.GONE
}
private fun onRoutingGrayLineListChanged(data: MutableList<GrayLineBean>) {
if (data.isNotEmpty()) {
showRecyclerView()
mRoutingLineList.clear()
mRoutingLineList.addAll(data)
mChooseLineListAdapter.notifyDataSetChanged()
ToastUtils.showShort("刷新成功")
} else {
showEmptyView()
}
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
viewModel = findViewTreeViewModelStoreOwner()?.let {
ViewModelProvider(it).get(RoutingSelectModel::class.java)
}
viewModel?.setDistanceCallback(this)
swtichViewModel = findViewTreeViewModelStoreOwner()?.let {
ViewModelProvider(it).get(RoutingSwitchModel::class.java)
}
}
override fun onVisibilityAggregated(isVisible: Boolean) {
super.onVisibilityAggregated(isVisible)
if(isVisible){
viewModel?.queryRoutingGrayLineList()
}
}
override fun onQueryRoutingGrayLineListSuccess(data: MutableList<GrayLineBean>) {
onRoutingGrayLineListChanged(data)
}
override fun onQueryRoutingGrayLineListFailed(errorStr: String) {
showErrorView()
}
override fun onStartGrayTaskAndQueryContrailSuccess(data: StartGrayAndQueryContrailRsp) {
swtichViewModel?.showRoutingRunning(data)
}
override fun onStartGrayTaskAndQueryContrailFailed(errorStr: String) {
swtichViewModel?.showRoutingSelectView()
}
}

View File

@@ -0,0 +1,263 @@
package com.mogo.och.biz.routing.ui.runing.other
import android.animation.ArgbEvaluator
import android.content.Context
import android.graphics.drawable.GradientDrawable
import android.util.TypedValue
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.widget.AppCompatImageView
import androidx.appcompat.widget.AppCompatTextView
import androidx.recyclerview.widget.RecyclerView
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OCHCOMMON
import com.mogo.och.biz.R
import com.mogo.och.common.module.utils.ResourcesUtils
import com.mogo.och.data.bean.BusStationBean
import me.jessyan.autosize.utils.AutoSizeUtils
/**
* 路线列表adapter
*/
class TaskRunningAdapter(
private val mContext: Context,
val mData: MutableList<BusStationBean>
) : RecyclerView.Adapter<TaskRunningAdapter.TaskRunningViewHolder>() {
companion object {
const val TAG = "${M_OCHCOMMON}TaskRunningAdapter"
}
private val argbEvaluator: ArgbEvaluator = ArgbEvaluator()
private val startColor = ResourcesUtils.getColor(R.color.common_1970FF)
private val endColor = ResourcesUtils.getColor(R.color.common_19FF7F)
private val heightItem = 100f
private val halfHeight = 16.5f
private var totalHeight = 0f
override fun onCreateViewHolder(
parent: ViewGroup,
viewType: Int
): TaskRunningViewHolder {
val view = LayoutInflater.from(mContext).inflate(
R.layout.biz_other_running_item, parent, false
)
return TaskRunningViewHolder(view)
}
override fun onBindViewHolder(holder: TaskRunningViewHolder, position: Int) {
val currentPosition = holder.bindingAdapterPosition
val line = mData[currentPosition]
holder.actvStationName.text = line.name
val startStationIndex = TaskRunningModel.currentIndex
if (startStationIndex >= 0) {
CallerLogger.d(TAG, "位置:$currentPosition ${TaskRunningModel.currentIndex} 当前站${mData[startStationIndex]} ")
}
if (currentPosition < startStationIndex) {
holder.actvStationName.setTextSize(
TypedValue.COMPLEX_UNIT_PX,
AutoSizeUtils.dp2px(mContext, 40f).toFloat()
)
holder.actvStationName.setTextColor(ResourcesUtils.getColor(R.color.common_4DFFFFFF))
holder.acivStationHead.setImageResource(R.drawable.bus_switch_line_adapter_point_pass)
} else if (currentPosition == startStationIndex) {
holder.actvStationName.setTextSize(
TypedValue.COMPLEX_UNIT_PX,
AutoSizeUtils.dp2px(mContext, 45f).toFloat()
)
holder.actvStationName.setTextColor(ResourcesUtils.getColor(R.color.common_2EACFF))
holder.acivStationHead.setImageResource(R.drawable.bus_runnint_task_middle)
} else {
holder.actvStationName.setTextColor(ResourcesUtils.getColor(R.color.white))
holder.actvStationName.setTextSize(
TypedValue.COMPLEX_UNIT_PX,
AutoSizeUtils.dp2px(mContext, 40f).toFloat()
)
holder.itemView.background = null
holder.acivStationHead.setImageResource(R.drawable.bus_runnint_task_middle)
}
when (currentPosition) {
0 -> {
holder.acivStationHeadBig.visibility = View.VISIBLE
holder.acivStationHead.visibility = View.INVISIBLE
holder.acivStationHeadBig.setImageResource(R.drawable.bus_runnint_task_start)
holder.middleStationBg.visibility = View.GONE
holder.startStationBg.visibility = View.VISIBLE
holder.endStationBg.visibility = View.GONE
if (startStationIndex == 0) {
if (line.isLeaving) {
// 下端 灰色
holder.startStationBg.setBackgroundResource(R.color.common_4DFFFFFF)
holder.itemView.background = null
} else {
// 下端 彩色
holder.itemView.setBackgroundResource(R.drawable.bus_task_current_station_bg)
val orientation = GradientDrawable.Orientation.TOP_BOTTOM
val temp01 = GradientDrawable(
orientation, intArrayOf(
startColor,
endColor
)
)
holder.startStationBg.background = temp01
}
} else {
// 下端 灰色
holder.startStationBg.setBackgroundResource(R.color.common_4DFFFFFF)
holder.itemView.background = null
}
}
mData.size - 1 -> {
holder.acivStationHeadBig.visibility = View.VISIBLE
holder.acivStationHead.visibility = View.INVISIBLE
holder.acivStationHeadBig.setImageResource(R.drawable.bus_runnint_task_end)
holder.middleStationBg.visibility = View.GONE
holder.startStationBg.visibility = View.GONE
holder.endStationBg.visibility = View.VISIBLE
if (startStationIndex == itemCount - 2) {
if (line.isLeaving) {
holder.endStationBg.setBackgroundResource(R.color.common_4DFFFFFF)
holder.itemView.setBackgroundResource(R.drawable.bus_task_current_station_bg)
} else {
holder.itemView.setBackgroundResource(R.drawable.bus_task_current_station_bg)
holder.endStationBg.setBackgroundResource(R.color.common_4DFFFFFF)
}
} else {
// 上端 彩色
holder.itemView.background = null
val startColorTemp = argbEvaluator.evaluate(
((totalHeight - halfHeight) / totalHeight).toFloat(),
startColor,
endColor
) as Int
val endColorTemp = argbEvaluator.evaluate(1f, startColor, endColor) as Int
val orientation = GradientDrawable.Orientation.TOP_BOTTOM
val temp01 = GradientDrawable(
orientation, intArrayOf(
startColorTemp,
endColorTemp
)
)
holder.endStationBg.background = temp01
}
}
else -> {
holder.acivStationHeadBig.visibility = View.GONE
holder.acivStationHead.visibility = View.VISIBLE
holder.middleStationBg.visibility = View.VISIBLE
holder.startStationBg.visibility = View.GONE
holder.endStationBg.visibility = View.GONE
if (currentPosition == startStationIndex) {
if (line.isLeaving) {
// 灰色
holder.middleStationBg.setBackgroundResource(R.color.common_4DFFFFFF)
holder.itemView.background = null
} else {
// 彩色
holder.itemView.setBackgroundResource(R.drawable.bus_task_current_station_bg)
val startColorTemp = argbEvaluator.evaluate(0f, startColor, endColor) as Int
val endColorTemp =
argbEvaluator.evaluate(100f / totalHeight, startColor, endColor) as Int
val orientation = GradientDrawable.Orientation.TOP_BOTTOM
val temp01 = GradientDrawable(
orientation, intArrayOf(
startColorTemp,
endColorTemp
)
)
holder.middleStationBg.background = temp01
}
} else if (currentPosition < startStationIndex) {
// 灰色
holder.middleStationBg.setBackgroundResource(R.color.common_4DFFFFFF)
holder.itemView.background = null
} else {
var dex = 0f
if (startStationIndex == 0) {
val firstItemData = mData[0]
if (!firstItemData.isLeaving) {
dex = halfHeight
}
} else {
val checkIndex = mData.get(startStationIndex)
if (!checkIndex.isLeaving) {
dex = heightItem
}
}
// 彩色
holder.itemView.background = null
val index = (currentPosition - startStationIndex - 1) * 100
val startFraction = (dex + index) / totalHeight
val endFraction = (dex + index + 100) / totalHeight
// CallerLogger.d(
// TAG,
// "位置:$currentPosition 当前站${startStationIndex} 开始百分比:${startFraction} 结束百分比:${endFraction}"
// )
val startColorTemp =
argbEvaluator.evaluate(startFraction, startColor, endColor) as Int
val endColorTemp =
argbEvaluator.evaluate(endFraction, startColor, endColor) as Int
val orientation = GradientDrawable.Orientation.TOP_BOTTOM
val temp01 = GradientDrawable(
orientation, intArrayOf(
startColorTemp,
endColorTemp
)
)
holder.middleStationBg.background = temp01
}
}
}
if (currentPosition == startStationIndex + 1) {
val preLine = mData[currentPosition - 1]
if (preLine.isLeaving) {
holder.itemView.setBackgroundResource(R.drawable.bus_task_current_station_bg)
} else {
holder.itemView.background = null
}
}
}
override fun getItemCount(): Int {
return mData.size
}
fun setDataList(dataList: List<BusStationBean>) {
this.mData.clear()
this.mData.addAll(dataList)
totalHeight = 33 + (dataList.size - 2) * heightItem
notifyItemRangeChanged(0, dataList.size, true)
}
fun notifyChange(){
if (TaskRunningModel.currentIndex == 0) {
totalHeight = 33 + (mData.size - 2) * heightItem
} else {
totalHeight =
(halfHeight + (mData.size - 1 - TaskRunningModel.currentIndex) * heightItem).toFloat()
}
notifyItemRangeChanged(0, mData.size, true)
}
class TaskRunningViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val actvStationName: AppCompatTextView = itemView.findViewById(R.id.actv_station_name)//站点名称
val acivStationHead: AppCompatImageView =
itemView.findViewById(R.id.aciv_station_head)//普通站点标识 不是起始和终点坐标
val acivStationHeadBig: AppCompatImageView =
itemView.findViewById(R.id.aciv_station_head_big)//起始和终点坐标标识
val middleStationBg: View = itemView.findViewById(R.id.bg_pass_bg) //贯通背景调
val endStationBg: View = itemView.findViewById(R.id.bg_pass_head_bg) //终点的背景
val startStationBg: View = itemView.findViewById(R.id.bg_pass_bottom_bg) //起点坐标的背景
}
}

View File

@@ -0,0 +1,303 @@
package com.mogo.och.biz.routing.ui.runing.other
import androidx.lifecycle.ViewModel
import com.mogo.commons.AbsMogoApplication
import com.mogo.commons.module.status.MogoStatusManager
import com.mogo.eagle.core.data.BaseData
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.och.CallerEagleBaseFunctionCall4OchManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OCHCOMMON
import com.mogo.eagle.core.utilcode.util.GsonUtils
import com.mogo.eagle.core.utilcode.util.NetworkUtils
import com.mogo.och.biz.routing.bean.ContrailBean
import com.mogo.och.biz.routing.bean.EndGrayContrailTaskReq
import com.mogo.och.biz.routing.bean.EndGrayTaskFeedbackType
import com.mogo.och.biz.routing.bean.GrayLineBean
import com.mogo.och.biz.routing.bean.StartGrayAndQueryContrailRsp
import com.mogo.och.biz.routing.net.RoutingServiceManager
import com.mogo.och.bridge.autopilot.autopilot.IOchAutopilotStatusListener
import com.mogo.och.bridge.autopilot.autopilot.OchAutoPilotStatusListenerManager
import com.mogo.och.bridge.autopilot.autopilot.bean.ArrivedStation
import com.mogo.och.bridge.autopilot.line.ILineCallback
import com.mogo.och.bridge.autopilot.line.LineManager
import com.mogo.och.common.module.constant.OchCommonConst
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
import com.mogo.och.common.module.manager.loop.BizLoopManager
import com.mogo.och.common.module.network.OchCommonServiceCallback
import com.mogo.och.data.bean.BusStationBean
/**
* @author XuXinChao
* @description BadCase录包管理页面
* @since: 2022/12/15
*/
class TaskRunningModel : ViewModel() {
private val TAG = M_OCHCOMMON + TaskRunningModel::class.java.simpleName
private var viewCallback: SwtichLineViewCallback? = null
private val content = AbsMogoApplication.getApp()
private var _data: StartGrayAndQueryContrailRsp? = null
val data: StartGrayAndQueryContrailRsp?
get() = _data
private var currentGrayLineBean: GrayLineBean? = null
private var currentContrailBean: ContrailBean? = null
private var stationList: MutableList<BusStationBean>? = null
private var currentGrayId: Long? = null
/**
* 是否可以进行进站操作
*/
var arrivedStation:Boolean = false
companion object {
var currentIndex = -1
}
override fun onCleared() {
}
fun setDistanceCallback(viewCallback: SwtichLineViewCallback) {
this.viewCallback = viewCallback
}
fun setNewData(data: StartGrayAndQueryContrailRsp) {
this._data = data
this.currentGrayLineBean = data.grayLineBean
this.currentContrailBean = data.contrail
this.currentGrayId = data.taskId
this.stationList = data.stationList
this.stationList?.forEach {
it.isLeaving = false
}
currentIndex = 0
this.stationList?.let {
val startStationNext = it[currentIndex]
val endStation = it[currentIndex + 1]
CallerLogger.d(TAG,"setNewData index:${currentIndex} ${startStationNext.name} -- ${endStation.name}")
LineManager.setStartAndEndStation(startStationNext, endStation)
}
MogoStatusManager.getInstance().setTaxiUnmanedDriverLineRoutingPerformTask(TAG, true)
//添加到站监听
OchAutoPilotStatusListenerManager.addListener(TAG, mMogoAutopilotStatusListener)
LineManager.addListener(TAG, lineCallback)
}
//MAP到站监听
private val mMogoAutopilotStatusListener: IOchAutopilotStatusListener =
object : IOchAutopilotStatusListener {
override fun onAutopilotArriveAtStation(arrivalNotification: ArrivedStation?) {
if(!arrivedStation){
OchChainLogManager.writeChainLogRouting("已到站","等待重试",false)
return
}
CallerLogger.i(
TAG,
"onAutopilotArriveAtStation = ${arrivalNotification.toString()}"
)
OchChainLogManager.writeChainLogRouting(
"MAP到站通知",
"[MAP到站通知] 上报到站location=${arrivalNotification?.endLocation}"
)
arriveStation()
}
}
private val lineCallback: ILineCallback = object : ILineCallback {
override fun arrivedStationSuccessBySearch() {
OchChainLogManager.writeChainLogRouting(
"[自车定位围栏]",
"\"[自车定位围栏] 并查询底盘触发到站, endSiteId=${currentGrayLineBean?.endSite?.siteId}, endSiteName=${currentGrayLineBean?.endSite?.siteName}, lineId=${currentGrayLineBean?.lineId},围栏范围:${OchCommonConst.ARRIVE_AT_START_STATION_DISTANCE}米 没有过站、速度基本为零且在15m内\""
)
if(!arrivedStation){
OchChainLogManager.writeChainLogRouting("已到站","等待重试",false)
return
}
arriveStation()
}
}
fun leaveStation() {
stationList?.let {
if (it.isNotEmpty()) {
if (currentIndex + 1 >= it.size) {
this.viewCallback?.showCompleteTask()
return
}
val startStation = it[currentIndex]
val endStation = it[currentIndex + 1]
startStation.isLeaving = true
arrivedStation = true
startStation.drivingStatus = 2
CallerLogger.d(TAG,"leaveStation index:${currentIndex} ${startStation.name}---${endStation.name}")
this.viewCallback?.notifyItemChange(currentIndex)
this.viewCallback?.showArriverStationAndCompleteTask()
if (CallerAutoPilotStatusListenerManager.getState() == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
) {
LineManager.startAutopilot()
}
}
}
}
fun arriveStation() {
stationList?.let {
val startStation = it[currentIndex]
if (currentIndex + 2 >= it.size) {
startStation.isLeaving = true
this.viewCallback?.showCompleteTask()
}else {
startStation.isLeaving = false
arrivedStation = false
startStation.drivingStatus = 1
currentIndex += 1
val startStationNext = it[currentIndex]
val endStation = it[currentIndex + 1]
CallerLogger.d(TAG, "setNewData index:${currentIndex} ${startStationNext.name}----${endStation.name}")
LineManager.setStartAndEndStation(startStationNext, endStation)
}
LineManager.getStations { start, end ->
BizLoopManager.runInMainThread{
this.viewCallback?.onArrivedStation(start.isLeaving)
}
}
}
}
interface SwtichLineViewCallback {
// 到站
fun onArrivedStation(leaving: Boolean)
// 结束服务成功
fun onSubmitEndTaskSuccess()
// 结束服务失败
fun onSubmitEndTaskFailed(s: String)
// 站点到站和结束任务
fun showCompleteTask()
//
fun showArriverStationAndCompleteTask()
fun notifyItemChange(currentIndex: Int)
fun clearData()
}
/**
* 结束灰度任务
*/
fun endGrayTask(grayId: Long, type: EndGrayTaskFeedbackType, occurrenceTime: Long) {
OchChainLogManager.writeChainLogRouting(
"[结束灰度任务]",
"[结束灰度任务] 准备发送请求grayId=$grayId type=${type.type}, typeName=${type.name}"
)
val submit = EndGrayContrailTaskReq(grayId, type.type, occurrenceTime)
RoutingServiceManager.endGrayTask(
content,
submit,
object : OchCommonServiceCallback<BaseData> {
override fun onSuccess(data: BaseData?) {
CallerLogger.d(
TAG,
"endGrayTask onSuccess: data=${
GsonUtils.toJson(
data
)
}"
)
OchChainLogManager.writeChainLogRouting(
"[结束灰度任务]",
"[结束灰度任务] 请求successgrayId=$grayId type=${type.type}, typeName=${type.name}"
)
clearData()
viewCallback?.onSubmitEndTaskSuccess()
}
override fun onFail(code: Int, msg: String?) {
CallerLogger.d(
TAG,
"endGrayTask onFail: code=$code, msg=$msg"
)
OchChainLogManager.writeChainLogRouting(
"[结束灰度任务]",
"[结束灰度任务] 请求fail, code=$code, msg=$msg, grayId=$grayId type=${type.type}, typeName=${type.name}"
)
viewCallback?.onSubmitEndTaskFailed(msg ?: "endGrayTask onFail")
}
override fun onError() {
super.onError()
var hintStr = ""
if (!NetworkUtils.isConnected(content)) {
hintStr = "网络出现异常,请稍后重试"
} else {
hintStr = "上报结束任务异常, 请稍后重试"
}
CallerLogger.d(
TAG,
"endGrayTask onError, msg=$hintStr"
)
OchChainLogManager.writeChainLogRouting(
"[结束灰度任务]",
"[结束灰度任务] 请求error, msg=$hintStr, grayId=$grayId type=${type.type}, typeName=${type.name}"
)
viewCallback?.onSubmitEndTaskFailed(hintStr)
}
})
}
private fun clearData() {
_data = null
this.currentGrayLineBean = null
this.currentContrailBean = null
this.currentGrayId = null
LineManager.setLineInfo(null)
LineManager.setContraiInfo(null)
LineManager.setStartAndEndStation(null, null)
BizLoopManager.runInMainThread{
this.viewCallback?.clearData()
}
CallerEagleBaseFunctionCall4OchManager.updateOrderStatus(false)
// 设置灰度路线任务执行状态,切换模式时判断使用
MogoStatusManager.getInstance().setTaxiUnmanedDriverLineRoutingPerformTask(TAG, false)
// 移除到站监听
OchAutoPilotStatusListenerManager.removeListener(TAG)
LineManager.removeListener(TAG)
cancelAutopilot()
}
/**
* 结束自动驾驶
* */
private fun cancelAutopilot() {
try {
CallerAutoPilotControlManager.cancelAutoPilot()
OchChainLogManager.writeChainLogRouting("[取消自驾]", "[取消自驾] 调用成功")
CallerLogger.d(TAG, "结束自动驾驶")
} catch (e: Exception) {
e.printStackTrace()
}
}
}

View File

@@ -0,0 +1,255 @@
package com.mogo.och.biz.routing.ui.runing.other
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.findViewTreeViewModelStoreOwner
import com.mogo.eagle.core.utilcode.kotlin.onClick
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OCHCOMMON
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.och.biz.R
import com.mogo.och.biz.routing.RoutingServiceManager
import com.mogo.och.biz.routing.bean.EndGrayTaskFeedbackType
import com.mogo.och.biz.routing.bean.StartGrayAndQueryContrailRsp
import com.mogo.och.biz.routing.ui.RoutingSwitchModel
import com.mogo.och.biz.routing.ui.errorpoint.ReportErrorPointView
import com.mogo.och.bridge.autopilot.line.LineManager
import com.mogo.och.common.module.map.AmapNaviToDestinationModel
import com.mogo.och.common.module.wigets.dialog.CommonDialogStatus
import com.mogo.och.common.module.wigets.CommonSlideView
import com.mogo.och.common.module.wigets.WrapContentLinearLayoutManager
import kotlinx.android.synthetic.main.biz_other_running.view.aciv_task_leave_station_slide_bg
import kotlinx.android.synthetic.main.biz_other_running.view.actv_arriver_station
import kotlinx.android.synthetic.main.biz_other_running.view.actv_complete_task
import kotlinx.android.synthetic.main.biz_other_running.view.actv_running_task_last_station
import kotlinx.android.synthetic.main.biz_other_running.view.actv_submit_task
import kotlinx.android.synthetic.main.biz_other_running.view.bus_task_running_line_name
import kotlinx.android.synthetic.main.biz_other_running.view.loading_arrive_station
import kotlinx.android.synthetic.main.biz_other_running.view.rl_running_task_station_list
class TaskRunningView : ConstraintLayout, TaskRunningModel.SwtichLineViewCallback {
constructor(context: Context) : super(context)
constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet)
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int) : super(
context,
attributeSet,
defStyleAttr
)
constructor(
context: Context,
attributeSet: AttributeSet,
defStyleAttr: Int,
defStyleRes: Int
) : super(context, attributeSet, defStyleAttr, defStyleRes)
companion object {
const val TAG = M_OCHCOMMON + "TaskRunningView"
}
private var viewModel: TaskRunningModel? = null
private var swtichViewModel: RoutingSwitchModel?=null
private lateinit var mAdapter: TaskRunningAdapter
private lateinit var linearLayoutManager: WrapContentLinearLayoutManager
private var closeRouting: CommonDialogStatus?=null
init {
LayoutInflater.from(context).inflate(R.layout.biz_other_running, this, true)
initView()
}
private fun initView() {
linearLayoutManager = WrapContentLinearLayoutManager(context)
rl_running_task_station_list.setLayoutManager(linearLayoutManager)
mAdapter = TaskRunningAdapter(context, mutableListOf())
rl_running_task_station_list.setAdapter(mAdapter)
// 滑动出发
aciv_task_leave_station_slide_bg.setSlideListener(object : CommonSlideView.SlideListener {
override fun slideEnd() {
if (TaskRunningModel.currentIndex == mAdapter.mData.size-2) {
LineManager.getStations { start, end ->
if (viewModel?.arrivedStation == true && start.isLeaving) {
aciv_task_leave_station_slide_bg.setTextValue("单程结束")
aciv_task_leave_station_slide_bg.reset()
viewModel?.data?.taskId?.let {
showFeedbackDialog(it)
}
}else{
aciv_task_leave_station_slide_bg.setTextValue("滑动出发")
viewModel?.leaveStation()
}
}
} else {
aciv_task_leave_station_slide_bg.setTextValue("滑动出发")
viewModel?.leaveStation()
}
}
})
// 到站
actv_arriver_station.onClick {
loading_arrive_station.visibility = VISIBLE
viewModel?.arriveStation()
}
// 结束任务
actv_complete_task.onClick {
viewModel?.data?.taskId?.let {
showFeedbackDialog(it)
}
}
actv_submit_task.onClick {
CallerLogger.d(TAG,"启动自驾参数:${LineManager.initAutopilotControlParameters()}")
viewModel?.data?.taskId?.let {
ReportErrorPointView.showDialog(context,it)
}
}
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
viewModel = findViewTreeViewModelStoreOwner()?.let {
ViewModelProvider(it).get(TaskRunningModel::class.java)
}
swtichViewModel = findViewTreeViewModelStoreOwner()?.let {
ViewModelProvider(it).get(RoutingSwitchModel::class.java)
}
viewModel?.setDistanceCallback(this)
}
private fun showFeedbackDialog(grayId: Long) {
val occurrenceTime = System.currentTimeMillis()
if(closeRouting==null) {
closeRouting = CommonDialogStatus
.Builder()
.title("路线验证结束")
.tips("请点击按钮反馈验证结果")
.showClose(true)
.cancelTextColor(R.color.biz_routing_FF4E41)
.cancelStr("线路不可用")
.confirmStr("线路可用")
.status(CommonDialogStatus.Status.success)
.build(context)
}else{
if(closeRouting?.isShowing==true){
return
}
}
closeRouting?.setClickListener(object : CommonDialogStatus.ClickListener {
override fun confirm() {
swtichViewModel?.showLoading()
viewModel?.endGrayTask(grayId, EndGrayTaskFeedbackType.USABLE_YES, occurrenceTime)
}
override fun cancel() {
swtichViewModel?.showLoading()
viewModel?.endGrayTask(
grayId,
EndGrayTaskFeedbackType.USABLE_NO,
occurrenceTime
)
}
})
closeRouting?.show()
}
fun showLeaveStationView() {
aciv_task_leave_station_slide_bg.visibility = VISIBLE
actv_arriver_station.visibility = GONE
actv_complete_task.visibility = GONE
}
override fun showArriverStationAndCompleteTask() {
aciv_task_leave_station_slide_bg.visibility = INVISIBLE
actv_arriver_station.visibility = VISIBLE
actv_complete_task.visibility = VISIBLE
}
fun setData(data: StartGrayAndQueryContrailRsp) {
viewModel?.setNewData(data)
bus_task_running_line_name.setText(data.grayLineBean.lineName)
actv_running_task_last_station.text = "${data.stationList.last().name ?: ""}"
mAdapter.setDataList(data.stationList)
aciv_task_leave_station_slide_bg.setTextValue("滑动出发")
showLeaveStationView()
}
/**
* 到达目的地
*/
override fun onArrivedStation(leaving: Boolean) {
//
showLeaveStationView()
loading_arrive_station.visibility = GONE
notifyItemChange(0)
if (TaskRunningModel.currentIndex == mAdapter.mData.size-2) {
LineManager.getStations { start, end ->
if(start.isLeaving){
aciv_task_leave_station_slide_bg.setTextValue("单程结束")
}else{
aciv_task_leave_station_slide_bg.setTextValue("滑动出发")
}
}
} else {
aciv_task_leave_station_slide_bg.setTextValue("滑动出发")
}
}
/**
* 服务完成
*/
override fun onSubmitEndTaskSuccess() {
ToastUtils.showLong("结束任务成功")
RoutingServiceManager.invokeCallback(false)
// 移除高德导航计算距离
AmapNaviToDestinationModel.getInstance(context).destroyAmaNavi()
swtichViewModel?.showRoutingSelectView()
}
/**
* 服务完成失败
*/
override fun onSubmitEndTaskFailed(errorStr: String) {
ToastUtils.showShort(errorStr)
viewModel?.data?.let {
swtichViewModel?.showRoutingRunning(it)
}
}
override fun showCompleteTask() {
aciv_task_leave_station_slide_bg.setTextValue("单程结束")
}
override fun notifyItemChange(currentIndex: Int) {
mAdapter.notifyChange()
}
override fun clearData() {
bus_task_running_line_name.setText("--")
actv_running_task_last_station.text = "往--"
mAdapter.setDataList(mutableListOf())
aciv_task_leave_station_slide_bg.setTextValue("滑动出发")
showLeaveStationView()
}
}

View File

@@ -0,0 +1,213 @@
package com.mogo.och.biz.routing.ui.runing.taxi
import androidx.lifecycle.ViewModel
import com.mogo.commons.AbsMogoApplication
import com.mogo.commons.module.status.MogoStatusManager
import com.mogo.eagle.core.data.BaseData
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
import com.mogo.eagle.core.function.call.och.CallerEagleBaseFunctionCall4OchManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.util.GsonUtils
import com.mogo.eagle.core.utilcode.util.NetworkUtils
import com.mogo.och.biz.routing.bean.ContrailBean
import com.mogo.och.biz.routing.bean.EndGrayContrailTaskReq
import com.mogo.och.biz.routing.bean.EndGrayTaskFeedbackType
import com.mogo.och.biz.routing.bean.GrayLineBean
import com.mogo.och.biz.routing.bean.StartGrayAndQueryContrailRsp
import com.mogo.och.biz.routing.net.RoutingServiceManager
import com.mogo.och.bridge.autopilot.autopilot.IOchAutopilotStatusListener
import com.mogo.och.bridge.autopilot.autopilot.OchAutoPilotStatusListenerManager
import com.mogo.och.bridge.autopilot.autopilot.bean.ArrivedStation
import com.mogo.och.bridge.autopilot.line.ILineCallback
import com.mogo.och.bridge.autopilot.line.LineManager
import com.mogo.och.bridge.distance.IDistanceListener
import com.mogo.och.bridge.distance.TrajectoryAndDistanceManager
import com.mogo.och.common.module.constant.OchCommonConst
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
import com.mogo.och.common.module.network.OchCommonServiceCallback
/**
* @author XuXinChao
* @description BadCase录包管理页面
* @since: 2022/12/15
*/
class TaxiRunningModel : ViewModel(), IDistanceListener {
private val TAG = TaxiRunningModel::class.java.simpleName
private var viewCallback: RoutingRuningCallback? = null
private val content = AbsMogoApplication.getApp()
private var _data: StartGrayAndQueryContrailRsp?=null
val data: StartGrayAndQueryContrailRsp?
get() = _data
private var currentGrayLineBean: GrayLineBean? = null
private var currentContrailBean: ContrailBean? = null
private var currentGrayId: Long? = null
//MAP到站监听
private val mMogoAutopilotStatusListener: IOchAutopilotStatusListener =
object : IOchAutopilotStatusListener {
override fun onAutopilotArriveAtStation(arrivalNotification: ArrivedStation?) {
CallerLogger.i(
TAG,
"onAutopilotArriveAtStation = ${arrivalNotification.toString()}"
)
OchChainLogManager.writeChainLogRouting("MAP到站通知","[MAP到站通知] 上报到站location=${arrivalNotification?.endLocation}")
viewCallback?.onArrivedStation(currentGrayId)
}
}
private val lineCallback: ILineCallback = object : ILineCallback {
override fun arrivedStationSuccessBySearch() {
OchChainLogManager.writeChainLogRouting("[自车定位围栏]","\"[自车定位围栏] 并查询底盘触发到站, endSiteId=${currentGrayLineBean?.endSite?.siteId}, endSiteName=${currentGrayLineBean?.endSite?.siteName}, lineId=${currentGrayLineBean?.lineId},围栏范围:${OchCommonConst.ARRIVE_AT_START_STATION_DISTANCE}米 没有过站、速度基本为零且在15m内\"")
viewCallback?.onArrivedStation(currentGrayId)
}
}
override fun onCleared() {
}
fun setDistanceCallback(viewCallback: RoutingRuningCallback) {
this.viewCallback = viewCallback
}
fun addListener() {
TrajectoryAndDistanceManager.addDistanceListener(TAG,this)
}
fun removeListener() {
TrajectoryAndDistanceManager.removeListener(TAG)
}
override fun distanceCallback(distance: Float) {
val lastTime = distance / OchCommonConst.TAXI_AVERAGE_SPEED * 3.6 //秒
this.viewCallback?.showDistance(distance.toLong(),lastTime.toLong())
}
fun setNewData(data: StartGrayAndQueryContrailRsp) {
this._data = data
this.currentGrayLineBean = data.grayLineBean
this.currentContrailBean = data.contrail
this.currentGrayId = data.taskId
if(data.stationList.size>=2) {
LineManager.setStartAndEndStation(data.stationList[0], data.stationList[1])
}
MogoStatusManager.getInstance().setTaxiUnmanedDriverLineRoutingPerformTask(TAG, true)
//添加到站监听
OchAutoPilotStatusListenerManager.addListener(TAG, mMogoAutopilotStatusListener)
LineManager.addListener(TAG, lineCallback)
}
/**
* 结束灰度任务
*/
fun endGrayTask(grayId: Long, type: EndGrayTaskFeedbackType, occurrenceTime: Long) {
OchChainLogManager.writeChainLogRouting("[结束灰度任务]","[结束灰度任务] 准备发送请求grayId=$grayId type=${type.type}, typeName=${type.name}")
val submit = EndGrayContrailTaskReq(grayId, type.type, occurrenceTime)
RoutingServiceManager.endGrayTask(
content,
submit,
object : OchCommonServiceCallback<BaseData> {
override fun onSuccess(data: BaseData?) {
CallerLogger.d(
TAG,
"endGrayTask onSuccess: data=${
GsonUtils.toJson(
data
)
}"
)
OchChainLogManager.writeChainLogRouting("[结束灰度任务]","[结束灰度任务] 请求successgrayId=$grayId type=${type.type}, typeName=${type.name}")
clearData()
viewCallback?.onSubmitEndTaskSuccess()
}
override fun onFail(code: Int, msg: String?) {
CallerLogger.d(
TAG,
"endGrayTask onFail: code=$code, msg=$msg"
)
OchChainLogManager.writeChainLogRouting("[结束灰度任务]","[结束灰度任务] 请求fail, code=$code, msg=$msg, grayId=$grayId type=${type.type}, typeName=${type.name}")
viewCallback?.onSubmitEndTaskFailed(msg ?: "endGrayTask onFail")
}
override fun onError() {
super.onError()
var hintStr = ""
if (!NetworkUtils.isConnected(content)) {
hintStr = "网络出现异常,请稍后重试"
} else {
hintStr = "上报结束任务异常, 请稍后重试"
}
CallerLogger.d(
TAG,
"endGrayTask onError, msg=$hintStr"
)
OchChainLogManager.writeChainLogRouting("[结束灰度任务]","[结束灰度任务] 请求error, msg=$hintStr, grayId=$grayId type=${type.type}, typeName=${type.name}")
viewCallback?.onSubmitEndTaskFailed(hintStr)
}
})
}
private fun clearData() {
_data = null
this.currentGrayLineBean = null
this.currentContrailBean = null
this.currentGrayId = null
LineManager.setLineInfo(null)
LineManager.setContraiInfo(null)
LineManager.setStartAndEndStation(null,null)
CallerEagleBaseFunctionCall4OchManager.updateOrderStatus(false)
// 设置灰度路线任务执行状态,切换模式时判断使用
MogoStatusManager.getInstance().setTaxiUnmanedDriverLineRoutingPerformTask(TAG, false)
// 移除到站监听
OchAutoPilotStatusListenerManager.removeListener(TAG)
LineManager.removeListener(TAG)
cancelAutopilot()
}
/**
* 结束自动驾驶
* */
private fun cancelAutopilot() {
try {
CallerAutoPilotControlManager.cancelAutoPilot()
OchChainLogManager.writeChainLogRouting("[取消自驾]","[取消自驾] 调用成功")
CallerLogger.d(TAG, "结束自动驾驶")
} catch (e: Exception) {
e.printStackTrace()
}
}
interface RoutingRuningCallback {
/**
* 结束灰度任务--成功✅
*/
fun onSubmitEndTaskSuccess()
/**
* 结束灰度任务--成功❌
* @param errorStr 错误信息
*/
fun onSubmitEndTaskFailed(errorStr: String)
fun onArrivedStation(currentGrayId: Long?)
// 距离终点的距离
fun showDistance(distance: Long, lastTime: Long)
}
}

View File

@@ -0,0 +1,300 @@
package com.mogo.och.biz.routing.ui.runing.taxi
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.findViewTreeViewModelStoreOwner
import com.amap.api.navi.model.NaviLatLng
import com.mogo.eagle.core.utilcode.kotlin.onClick
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.util.ActivityUtils
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.och.biz.R
import com.mogo.och.biz.routing.RoutingServiceManager
import com.mogo.och.biz.routing.bean.EndGrayTaskFeedbackType
import com.mogo.och.biz.routing.bean.StartGrayAndQueryContrailRsp
import com.mogo.och.bridge.autopilot.location.OchLocationManager
import com.mogo.och.common.module.manager.loop.BizLoopManager
import com.mogo.och.common.module.map.AmapNaviToDestinationModel
import com.mogo.och.common.module.map.ICommonNaviChangedCallback
import com.mogo.och.biz.routing.ui.RoutingSwitchModel
import com.mogo.och.common.module.map.MapMakerManager
import com.mogo.och.common.module.wigets.dialog.CommonDialogStatus
import com.mogo.och.biz.routing.ui.errorpoint.ReportErrorPointView
import com.mogo.och.biz.routing.ui.utils.TimeDistanceUtils
import com.mogo.och.common.module.constant.OchCommonConst
import kotlinx.android.synthetic.main.biz_taxi_running.view.actv_end_routing
import kotlinx.android.synthetic.main.biz_taxi_running.view.actv_current_itinerary_end_name
import kotlinx.android.synthetic.main.biz_taxi_running.view.actv_current_itinerary_start_name
import kotlinx.android.synthetic.main.biz_taxi_running.view.actv_distance_end
import kotlinx.android.synthetic.main.biz_taxi_running.view.actv_routing_name
import kotlinx.android.synthetic.main.biz_taxi_running.view.actv_submit_task
import kotlinx.android.synthetic.main.biz_taxi_running.view.goutp_show_routing_info
import kotlinx.android.synthetic.main.biz_taxi_running.view.include_empty
import kotlinx.android.synthetic.main.biz_taxi_running.view.naviToStart
class TaxiRunningView: ConstraintLayout, TaxiRunningModel.RoutingRuningCallback,
ICommonNaviChangedCallback {
constructor(context: Context) : super(context)
constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet)
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int) : super(context, attributeSet, defStyleAttr)
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attributeSet, defStyleAttr, defStyleRes)
companion object {
const val TAG = "RoutingRunningView"
}
private var viewModel: TaxiRunningModel?=null
private var swtichViewModel: RoutingSwitchModel?=null
private var closeRouting: CommonDialogStatus?=null
init {
LayoutInflater.from(context).inflate(R.layout.biz_taxi_running, this, true)
initView()
initListener()
}
private fun initListener() {
actv_end_routing.onClick {
viewModel?.data?.taskId?.let {
showFeedbackDialog(it)
}
}
actv_submit_task.onClick {
viewModel?.data?.taskId?.let {
ReportErrorPointView.showDialog(context,it)
}
}
}
private fun initView(){
}
private fun showFeedbackDialog(grayId: Long) {
val occurrenceTime = System.currentTimeMillis()
val topActivity = ActivityUtils.getTopActivity()
if(closeRouting==null) {
closeRouting = CommonDialogStatus
.Builder()
.title("路线验证结束")
.tips("请点击按钮反馈验证结果")
.showClose(true)
.cancelTextColor(R.color.biz_routing_FF4E41)
.cancelStr("线路不可用")
.confirmStr("线路可用")
.status(CommonDialogStatus.Status.success)
.build(topActivity)
}else{
if(closeRouting?.isShowing==true){
return
}
}
closeRouting?.setClickListener(object : CommonDialogStatus.ClickListener {
override fun confirm() {
swtichViewModel?.showLoading()
viewModel?.endGrayTask(
grayId,
EndGrayTaskFeedbackType.USABLE_YES,
occurrenceTime
)
}
override fun cancel() {
swtichViewModel?.showLoading()
viewModel?.endGrayTask(
grayId,
EndGrayTaskFeedbackType.USABLE_NO,
occurrenceTime
)
}
})
if(!topActivity.isFinishing() && !topActivity.isDestroyed()) {
closeRouting?.show()
}
}
/**
* 展示选择任务视图
*/
private fun showChooseTaskView() {
swtichViewModel?.showRoutingSelectView()
removeAllMapMarker()
}
private fun removeAllMapMarker() {
MapMakerManager.removeAllMapMarkerByOwner(OchCommonConst.TYPE_MARKER_ROUTING_VERIFY)
}
private fun initStartNaviToStationParam(
isVoicePlay: Boolean,
stationLat: Double,
stationLng: Double
) {
AmapNaviToDestinationModel.getInstance(context).destroyAmaNavi()
val gcJ02Location = OchLocationManager.getGCJ02Location()
val mCurLatitude = gcJ02Location.latitude
val mCurLongitude = gcJ02Location.longitude
CallerLogger.d(TAG, "currentLocation, lat=$mCurLatitude, lon=$mCurLongitude")
val startNaviLatLng = NaviLatLng(mCurLatitude, mCurLongitude)
val endNaviLatLng = NaviLatLng(stationLat, stationLng)
AmapNaviToDestinationModel.getInstance(context).initAMapNavi(startNaviLatLng, endNaviLatLng)
AmapNaviToDestinationModel.getInstance(context).setVoiceIsMute(isVoicePlay)
// 怀疑在线程池执行的destroyAmaNavi会比 主线程执行的setTaxiNaviChangedCallback慢导致setTaxiNaviChangedCallback(this)会被冲掉
ThreadUtils.getSinglePool().execute {
AmapNaviToDestinationModel.getInstance(context).setTaxiNaviChangedCallback(this)
}
}
/**
* 剩余里程和剩余时间
* @param meters 米
* @param timeInSecond 秒
*/
private fun updateCurrentTaskTripInfo(meters: Long, timeInSecond: Long) {
UiThreadHandler.post {
CallerLogger.d(TAG, "updateCurrentTaskTripInfo, taskUtil, ${TimeDistanceUtils.getCurrentTaskTripHtml(meters, timeInSecond)}")
actv_distance_end.text = "${TimeDistanceUtils.getCurrentTaskDistance(meters)} ${TimeDistanceUtils.getCurrentTaskTime(timeInSecond)}"
}
}
/**
* 绘制地图起点终点
* @param isAdd
* @param uuid
*/
private fun setOrRemoveMapMaker(
isAdd: Boolean,
uuid: String,
lat: Double,
lon: Double,
resourceId: Int
) {
if (isAdd) {
MapMakerManager.addMapMaker(OchCommonConst.TYPE_MARKER_ROUTING_VERIFY, uuid, lat, lon, resourceId)
} else {
MapMakerManager.removeMapMaker(uuid, lat, lon)
}
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
viewModel = findViewTreeViewModelStoreOwner()?.let {
ViewModelProvider(it).get(TaxiRunningModel::class.java)
}
swtichViewModel = findViewTreeViewModelStoreOwner()?.let {
ViewModelProvider(it).get(RoutingSwitchModel::class.java)
}
viewModel?.setDistanceCallback(this)
}
override fun onVisibilityAggregated(isVisible: Boolean) {
super.onVisibilityAggregated(isVisible)
if(isVisible){
viewModel?.addListener()
}else{
viewModel?.removeListener()
}
}
override fun onCurrentNaviDistAndTimeChanged(meters: Int, timeInSecond: Long) {
updateCurrentTaskTripInfo(meters.toLong(), timeInSecond)
}
override fun reInitNaviAmap(isPlay: Boolean, isRestart: Boolean) {
CallerLogger.d(TAG, "isPlay = $isPlay, isRestart=$isRestart")
if (!isRestart) {
RoutingServiceManager.invokeCallback(false)
return
}
}
fun setData(data: StartGrayAndQueryContrailRsp) {
viewModel?.setNewData(data)
include_empty.visibility = View.GONE
goutp_show_routing_info.visibility = View.VISIBLE
actv_routing_name.text = data.grayLineBean.lineName
updateCurrentTaskTripInfo(0, 0)
data.grayLineBean.startSite?.also {
initStartNaviToStationParam(
false,
it.gcjLat,
it.gcjLon
)
naviToStart.setOnClickListener {
RoutingServiceManager.invokeCallback(true)
}
setOrRemoveMapMaker(
true,
OchCommonConst.TAXI_ROUTING_VERIFY_START_SITE,
it.wgs84Lat,
it.wgs84Lon,
R.raw.star_marker
)
}
data.grayLineBean.endSite?.also {
setOrRemoveMapMaker(
true,
OchCommonConst.TAXI_ROUTING_VERIFY_END_SITE,
it.wgs84Lat,
it.wgs84Lon,
R.raw.end_marker
)
}
actv_current_itinerary_start_name.text = data.grayLineBean.startSite?.siteName
actv_current_itinerary_end_name.text = data.grayLineBean.endSite?.siteName
}
override fun onSubmitEndTaskSuccess() {
ToastUtils.showLong("结束任务成功")
RoutingServiceManager.invokeCallback(false)
// 移除高德导航计算距离
AmapNaviToDestinationModel.getInstance(context).destroyAmaNavi()
swtichViewModel?.showRoutingSelectView()
}
override fun onSubmitEndTaskFailed(errorStr: String) {
ToastUtils.showShort(errorStr)
viewModel?.data?.let {
swtichViewModel?.showRoutingRunning(it)
}
}
override fun onArrivedStation(currentGrayId: Long?) {
BizLoopManager.runInMainThread(object :Runnable{
override fun run() {
currentGrayId?.let {
showFeedbackDialog(it)
removeAllMapMarker()
}
}
})
}
override fun showDistance(distance: Long, lastTime: Long) {
updateCurrentTaskTripInfo(distance,lastTime)
}
}

View File

@@ -0,0 +1,112 @@
package com.mogo.och.biz.routing.ui.utils
import android.text.Spanned
import androidx.core.text.HtmlCompat
import com.mogo.eagle.core.utilcode.util.DateTimeUtils
import com.mogo.och.common.module.utils.DateTimeUtil
import com.mogo.och.common.module.utils.NumberFormatUtil
import java.util.Calendar
import kotlin.math.ceil
import kotlin.math.roundToInt
object TimeDistanceUtils {
fun getCurrentTaskDistance(meters: Long):String{
var dis = "0"
var disUnit = "公里"
if (meters > 0) {
if (meters / 1000 < 1) {
disUnit = ""
dis = meters.toFloat().roundToInt().toString()
} else {
disUnit = "公里"
dis = NumberFormatUtil.formatLong(meters.toDouble() / 1000)
}
}
return "${dis}${disUnit}"
}
fun getCurrentTaskTime(timeInSecond: Long):String{
val min = ceil(timeInSecond.toDouble() / 60f).toInt()
return "${min}分钟"
}
/**
* 剩余里程和剩余时间 html
*/
fun getCurrentTaskTripHtml(meters: Long, timeInSecond: Long): Spanned {
var dis = "0"
var disUnit = "公里"
if (meters > 0) {
if (meters / 1000 < 1) {
disUnit = ""
dis = meters.toFloat().roundToInt().toString()
} else {
disUnit = "公里"
dis = NumberFormatUtil.formatLong(meters.toDouble() / 1000)
}
}
val min = ceil(timeInSecond.toDouble() / 60f).toInt()
val strHtml =
("<font color=\"#CAD6FF\">里程 </font>"
+ "<b><font color=\"#FFFFFF\">"
+ dis + "</font></b>"
+ "<font color=\"#CAD6FF\"> "
+ disUnit + "</font>"
+ "<font color=\"#CAD6FF\">,剩余 </font>"
+ "<b><font color=\"#FFFFFF\">"
+ min + "</font></b>"
+ "<font color=\"#CAD6FF\"> 分钟</font>")
return HtmlCompat.fromHtml(strHtml, HtmlCompat.FROM_HTML_MODE_LEGACY)
}
fun getCurrentTaskWaitTimeHtml(): Spanned {
val currentCale = DateTimeUtils.getCurrentDateTime()
val currentDay =
DateTimeUtil.formatCalendarToString(currentCale, DateTimeUtil.yyyy_MM_dd)
currentCale.add(Calendar.MINUTE, 10)
val strHtml13: String = if (currentDay == DateTimeUtil.formatCalendarToString(
currentCale,
DateTimeUtil.yyyy_MM_dd
)
) {
("<font color=\"#CAD6FF\">免费等待至 </font>"
+ "<b><font color=\"#FFFFFF\"><big>" + DateTimeUtil.formatCalendarToString(
currentCale,
DateTimeUtil.HH_mm
) + "</big></b></font>")
} else {
("<font color=\"#CAD6FF\">免费等待至</font>"
+ "<font color=\"#FFFFFF\"><big>" + DateTimeUtil.formatCalendarToString(
currentCale,
DateTimeUtil.MM_dd_HH_mm
) + "</big></font>")
}
return HtmlCompat.fromHtml(strHtml13, HtmlCompat.FROM_HTML_MODE_LEGACY)
}
fun getCurrentTaskTotalAndDurationHtml(mileage: Float, duration: Int): Spanned {
val strHtml =
("<font color=\"#CAD6FF\">全程 </font>" + "<font color=\"#FFFFFF\"> $mileage </font>" + "<font color=\"#CAD6FF\"> 公里 </font>"
+ "<font color=\"#CAD6FF\">,总用时 </font>" + "<font color=\"#FFFFFF\"> $duration </font>" + "<font color=\"#CAD6FF\"> 分钟</font>")
return HtmlCompat.fromHtml(strHtml, HtmlCompat.FROM_HTML_MODE_LEGACY)
}
fun getCurrentTaskPhoneNumAndPassengerCountHtml(phoneNum: String, passengerSize: Int): Spanned {
return HtmlCompat.fromHtml(
"<font color=\"#FFFFFF\"> " + phoneNum + "</font>" +
"<font color=\"#6473B2\"> | </font>" +
"<font color=\"#FFFFFF\">" + passengerSize + "" + "</font>",
HtmlCompat.FROM_HTML_MODE_LEGACY
)
}
fun getNextTaskPhoneNumAndPassengerCountHtml(phoneNum: String, passengerSize: Int): Spanned {
return HtmlCompat.fromHtml(
"<font color=\"#FFFFFF\"> " + phoneNum + "</font>" +
"<font color=\"#6473B2\"> | </font>" +
"<font color=\"#FFFFFF\">" + passengerSize + "" + "</font>",
HtmlCompat.FROM_HTML_MODE_LEGACY
)
}
}

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/biz_routing_FF4E41" android:state_pressed="true"/>
<item android:color="@color/biz_routing_FF4E41" android:state_pressed="false"/>
<item android:color="@color/biz_routing_FF4E41"/>
</selector>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/biz_routing_2eacff" android:state_pressed="true"/>
<item android:color="@color/biz_routing_2eacff" android:state_pressed="false"/>
<item android:color="@color/biz_routing_2eacff"/>
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 610 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 261 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 610 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 261 B

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/biz_routing_4D000000"/>
<corners android:radius="@dimen/dp_30"/>
</shape>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/biz_routing_80000000"/>
<corners android:radius="@dimen/dp_30"/>
</shape>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/biz_button_selected"/>
<item android:state_pressed="false" android:drawable="@drawable/biz_button_normal"/>
<item android:state_checked="true" android:drawable="@drawable/biz_button_selected"/>
<item android:state_checked="false" android:drawable="@drawable/biz_button_normal"/>
<item android:drawable="@drawable/biz_button_normal"/>
</selector>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid
android:color="@color/biz_routing_4D000000" />
<corners android:radius="@dimen/dp_30"/>
</shape>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:endColor="#660043FF"
android:startColor="#0028345E" />
</shape>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:endColor="#CC0043FF"
android:startColor="#0028345E" />
</shape>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/bus_switch_task_selected"/>
<item android:state_pressed="false" android:drawable="@drawable/bus_switch_task_normal"/>
<item android:state_checked="true" android:drawable="@drawable/bus_switch_task_selected"/>
<item android:state_checked="false" android:drawable="@drawable/bus_switch_task_normal"/>
<item android:drawable="@drawable/bus_switch_task_normal"/>
</selector>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/bus_switch_task_selected"/>
<item android:state_pressed="false" android:drawable="@drawable/bus_switch_task_normal"/>
<item android:state_checked="true" android:drawable="@drawable/bus_switch_task_selected"/>
<item android:state_checked="false" android:drawable="@drawable/bus_switch_task_normal"/>
<item android:drawable="@drawable/bus_switch_task_normal"/>
</selector>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/common_color_4D000000"/>
<corners android:radius="@dimen/dp_30"/>
</shape>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:endColor="#CC0043FF"
android:startColor="#0028345E" />
<corners android:radius="@dimen/dp_30" />
</shape>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/bus_switch_line_selected"/>
<item android:state_pressed="false" android:drawable="@drawable/bus_switch_line_normal"/>
<item android:drawable="@drawable/bus_switch_line_normal"/>
</selector>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/common_color_4D000000"/>
<corners android:radius="@dimen/dp_30"/>
</shape>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/common_80000000"/>
<corners android:radius="@dimen/dp_30"/>
</shape>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="@dimen/dp_30"/>
<solid android:color="@color/common_color_4D000000"/>
</shape>

View File

@@ -0,0 +1,121 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="@dimen/dp_880"
android:layout_height="match_parent"
tools:layout_height="@dimen/dp_966"
tools:background="@drawable/bus_switch_line_normal"
xmlns:tools="http://schemas.android.com/tools">
<TextView
android:id="@+id/bus_task_running_line_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textSize="@dimen/dp_45"
android:layout_marginStart="@dimen/dp_54"
android:singleLine="true"
android:ellipsize="end"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toStartOf="@+id/actv_running_task_time"
android:layout_marginEnd="@dimen/dp_140"
android:layout_marginTop="@dimen/dp_37"
android:textColor="@color/white"
tools:text="线路名称"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_running_task_last_station"
android:textColor="@color/common_B3FFFFFF"
android:textSize="@dimen/dp_36"
app:layout_constraintStart_toStartOf="@+id/bus_task_running_line_name"
app:layout_constraintTop_toBottomOf="@+id/bus_task_running_line_name"
android:layout_marginTop="@dimen/dp_11"
tools:text="往新街口方向"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<LinearLayout
android:id="@+id/actv_running_task_time"
android:gravity="center"
android:layout_marginEnd="@dimen/dp_54"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginTop="@dimen/dp_2"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_100">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_submit_task"
android:layout_width="@dimen/dp_200"
android:layout_height="@dimen/dp_80"
app:pressed_enabled="false"
android:gravity="center"
android:text="问题打点"
android:background="@drawable/biz_button_selector"
android:textColor="@color/white"
android:textSize="@dimen/dp_40" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rl_running_task_station_list"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_0"
android:layout_marginStart="@dimen/dp_54"
android:layout_marginEnd="@dimen/dp_52"
app:layout_constraintTop_toBottomOf="@+id/actv_running_task_last_station"
app:layout_constraintBottom_toTopOf="@+id/aciv_task_leave_station_slide_bg"
android:layout_marginTop="@dimen/dp_22"
android:layout_marginBottom="@dimen/dp_46"/>
<com.mogo.och.common.module.wigets.CommonSlideView
android:id="@+id/aciv_task_leave_station_slide_bg"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:assetsfolder="images"
app:slide_title="@string/common_leave_station"
android:layout_marginBottom="@dimen/dp_46"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_arriver_station"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:gravity="center"
android:textSize="@dimen/dp_40"
android:textColor="@color/white"
android:background="@drawable/bus_running_task_arrive_station_selector"
android:layout_marginBottom="@dimen/dp_46"
android:layout_marginStart="@dimen/dp_54"
android:text="@string/common_arrive_station"
android:layout_width="@dimen/dp_474"
android:layout_height="@dimen/dp_120"/>
<com.mogo.och.common.module.wigets.loading.LoadingViewSmall
android:id="@+id/loading_arrive_station"
android:src="@drawable/common_biz_loading_samll"
app:layout_constraintTop_toTopOf="@+id/actv_arriver_station"
app:layout_constraintBottom_toBottomOf="@+id/actv_arriver_station"
app:layout_constraintEnd_toEndOf="@+id/actv_arriver_station"
android:layout_marginEnd="@dimen/dp_30"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_complete_task"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:gravity="center"
android:textSize="@dimen/dp_40"
android:textColor="@color/white"
android:background="@drawable/bus_running_task_complete_selector"
android:layout_marginBottom="@dimen/dp_46"
android:layout_marginEnd="@dimen/dp_54"
android:text="@string/common_complete"
android:layout_width="@dimen/dp_245"
android:layout_height="@dimen/dp_120"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_100"
tools:background="@drawable/bus_switch_line_selector">
<View
android:id="@+id/bg_pass_bg"
app:layout_constraintStart_toStartOf="@+id/aciv_station_head"
app:layout_constraintEnd_toEndOf="@+id/aciv_station_head"
android:background="@color/common_4DFFFFFF"
android:layout_width="@dimen/dp_7"
android:layout_height="match_parent"/>
<View
android:id="@+id/bg_pass_head_bg"
android:layout_marginBottom="@dimen/dp_11"
app:layout_constraintStart_toStartOf="@+id/aciv_station_head_big"
app:layout_constraintEnd_toEndOf="@+id/aciv_station_head_big"
tools:background="@color/light_prompt_red"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@+id/aciv_station_head_big"
android:layout_width="@dimen/dp_7"
android:layout_height="0dp"/>
<View
android:id="@+id/bg_pass_bottom_bg"
app:layout_constraintStart_toStartOf="@+id/aciv_station_head_big"
app:layout_constraintEnd_toEndOf="@+id/aciv_station_head_big"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/aciv_station_head_big"
android:layout_marginTop="@dimen/dp_11"
tools:background="@color/light_prompt_red"
android:layout_width="@dimen/dp_7"
android:layout_height="0dp"/>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/aciv_station_head"
android:src="@drawable/bus_switch_line_adapter_point"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginStart="@dimen/dp_33"
android:layout_width="@dimen/dp_30"
android:layout_height="@dimen/dp_30"/>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/aciv_station_head_big"
android:src="@drawable/bus_runnint_task_start"
app:layout_constraintTop_toTopOf="@+id/aciv_station_head"
app:layout_constraintStart_toStartOf="@+id/aciv_station_head"
app:layout_constraintBottom_toBottomOf="@+id/aciv_station_head"
app:layout_constraintEnd_toEndOf="@+id/aciv_station_head"
android:layout_width="@dimen/dp_45"
android:layout_height="@dimen/dp_45"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_station_name"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/aciv_station_head"
android:layout_marginStart="@dimen/dp_36"
android:layout_marginEnd="@dimen/dp_36"
app:layout_constraintEnd_toEndOf="parent"
android:text="天安门天安门天安门…"
android:singleLine="true"
android:textColor="@color/white"
android:ellipsize="end"
android:textSize="@dimen/dp_45"
android:layout_width="0dp"
android:layout_height="wrap_content"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_12"
android:background="@drawable/biz_shape_select_line_item_bg_normal"
android:orientation="vertical"
android:paddingStart="@dimen/dp_78"
android:paddingEnd="@dimen/dp_78">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/switchLineNameTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_20"
android:layout_marginEnd="@dimen/dp_20"
android:ellipsize="end"
android:gravity="left|center_vertical"
android:maxLines="1"
android:singleLine="true"
android:textColor="@android:color/white"
android:textSize="@dimen/dp_44"
tools:text="线路名称线路名称线路" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginTop="@dimen/dp_20"
android:layout_marginBottom="@dimen/dp_20">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/todayVerifyNumTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"
android:gravity="left|center_vertical"
android:maxLines="1"
android:textColor="@android:color/white"
android:textSize="@dimen/dp_34"
tools:text="本车今日已验证1次" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/historyVerifyNumTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_toRightOf="@+id/todayVerifyNumTextView"
android:gravity="right|center_vertical"
android:maxLines="1"
android:textColor="@color/biz_routing_ccb9c3e9"
android:textSize="@dimen/dp_30"
tools:text="路线累计反馈0可用1不可用" />
</RelativeLayout>
</LinearLayout>

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/noDataContainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toTopOf="@+id/bottomBtnContainer"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/no_routing_data_iv"
android:layout_width="@dimen/dp_386"
android:layout_height="@dimen/dp_350"
android:src="@drawable/biz_taxi_no_order_data"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/noRoutingTaskDataTv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:text="暂无任务"
android:textColor="#91A1EA"
android:textSize="@dimen/dp_30"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/no_routing_data_iv" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
xmlns:tools="http://schemas.android.com/tools"
tools:background="@color/result_points"
android:layout_height="@dimen/dp_90">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/aciv_show_check_status"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:src="@drawable/biz_taxi_uncheck"
android:layout_width="@dimen/dp_53"
android:layout_height="@dimen/dp_53"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_error_resong"
app:layout_constraintTop_toTopOf="@+id/aciv_show_check_status"
app:layout_constraintBottom_toBottomOf="@+id/aciv_show_check_status"
app:layout_constraintStart_toEndOf="@+id/aciv_show_check_status"
app:layout_constraintEnd_toEndOf="parent"
android:maxLines="2"
android:ellipsize="end"
android:lineSpacingMultiplier="0.7"
android:layout_marginStart="@dimen/dp_30"
tools:text="绕路绕路绕路绕路绕绕路绕路绕路绕路绕绕路绕路绕路绕路绕绕路绕路绕路绕路绕绕路绕路绕路绕路绕绕路绕路绕路绕路绕"
android:textColor="@color/white"
android:textSize="@dimen/dp_36"
android:layout_width="0dp"
android:layout_height="wrap_content"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,92 @@
<?xml version="1.0" encoding="utf-8"?>
<com.mogo.och.common.module.wigets.OCHRoundConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="@dimen/dp_900"
android:layout_height="@dimen/dp_730"
android:background="@drawable/common_qr_dialog"
app:roundLayoutRadius="@dimen/dp_50">
<TextView
android:id="@+id/tv_report_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_33"
android:text="线路问题打点"
android:textColor="@color/white"
android:textSize="@dimen/sp_45"
android:textStyle="bold"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginTop="@dimen/dp_51"
/>
<TextView
android:id="@+id/tv_work_order_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/dp_67"
android:text="时间"
android:textColor="@color/white"
android:textSize="@dimen/sp_30"
app:layout_constraintTop_toTopOf="@+id/tv_report_title"
app:layout_constraintBottom_toBottomOf="@+id/tv_report_title"
app:layout_constraintEnd_toEndOf="parent"
/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvErrorPointReason"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_0"
android:layout_marginStart="@dimen/dp_65"
android:layout_marginTop="@dimen/dp_56"
android:layout_marginEnd="@dimen/dp_65"
android:layout_marginBottom="@dimen/dp_10"
app:layout_constraintBottom_toTopOf="@+id/tv_report_error_point_reason"
app:layout_constraintTop_toBottomOf="@+id/tv_report_title" />
<TextView
android:id="@+id/tv_report_error_point_reason"
android:layout_width="@dimen/dp_356"
android:layout_height="@dimen/dp_120"
android:background="@drawable/common_button_cancle"
android:gravity="center"
android:text="打点"
android:textColor="@color/biz_routing_2eacff"
android:textSize="@dimen/sp_40"
android:textStyle="bold"
android:layout_marginBottom="@dimen/dp_65"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginStart="@dimen/dp_65"
/>
<com.mogo.och.common.module.wigets.loading.LoadingViewSmall
android:id="@+id/lvs_loding"
app:layout_constraintTop_toTopOf="@+id/tv_report_error_point_reason"
app:layout_constraintBottom_toBottomOf="@+id/tv_report_error_point_reason"
app:layout_constraintEnd_toEndOf="@+id/tv_report_error_point_reason"
android:layout_marginEnd="@dimen/dp_30"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/tv_report_error_point_reason_cancel"
android:layout_width="@dimen/dp_356"
android:layout_height="@dimen/dp_120"
android:layout_marginBottom="@dimen/dp_65"
android:background="@drawable/common_button_cancle"
android:layout_marginEnd="@dimen/dp_66"
android:gravity="center"
android:text="取消"
android:textColor="#FFFFFF"
android:textSize="@dimen/sp_40"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
/>
</com.mogo.och.common.module.wigets.OCHRoundConstraintLayout>

View File

@@ -0,0 +1,169 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout"
android:layout_width="@dimen/dp_880"
android:layout_height="match_parent"
tools:layout_height="@dimen/dp_966"
tools:background="@drawable/biz_shape_itinerary_bg_default"
xmlns:tools="http://schemas.android.com/tools">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_routing_page_title"
android:textSize="@dimen/dp_44"
android:textColor="@color/white"
android:text="当前行程"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginTop="@dimen/dp_38"
android:layout_marginStart="@dimen/dp_54"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_routing_name"
android:textSize="@dimen/dp_40"
android:textColor="@color/white"
android:text="灰度路线11111111"
app:layout_constraintTop_toBottomOf="@+id/actv_routing_page_title"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginTop="@dimen/dp_40"
android:layout_marginStart="@dimen/dp_54"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<View
android:id="@+id/v_bg_itinerary_info"
app:layout_constraintTop_toBottomOf="@+id/actv_routing_name"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginTop="@dimen/dp_28"
android:layout_marginStart="@dimen/dp_54"
android:layout_marginEnd="@dimen/dp_52"
android:layout_width="match_parent"
android:background="@drawable/biz_shape_itinerary_bg_default"
android:layout_height="@dimen/dp_272"/>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/aciv_current_itinerary_start_point"
app:layout_constraintTop_toTopOf="@+id/v_bg_itinerary_info"
app:layout_constraintStart_toStartOf="@+id/v_bg_itinerary_info"
android:layout_marginStart="@dimen/dp_30"
android:layout_marginTop="@dimen/dp_34"
android:layout_width="@dimen/dp_45"
android:layout_height="@dimen/dp_45"
android:src="@drawable/biz_taxi_current_start_station_point" />
<View
android:id="@+id/v_line_current_start_end"
app:layout_constraintTop_toBottomOf="@+id/aciv_current_itinerary_start_point"
app:layout_constraintStart_toStartOf="@+id/aciv_current_itinerary_start_point"
app:layout_constraintEnd_toEndOf="@+id/aciv_current_itinerary_start_point"
android:layout_marginTop="@dimen/dp_8"
android:background="@color/biz_routing_4D000000"
android:layout_width="@dimen/dp_6"
android:layout_height="@dimen/dp_92"/>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/aciv_current_itinerary_end_point"
app:layout_constraintTop_toBottomOf="@+id/v_line_current_start_end"
app:layout_constraintStart_toStartOf="@+id/v_line_current_start_end"
app:layout_constraintEnd_toEndOf="@+id/v_line_current_start_end"
android:layout_marginTop="@dimen/dp_8"
android:layout_width="@dimen/dp_45"
android:layout_height="@dimen/dp_45"
android:src="@drawable/biz_taxi_current_end_station_point" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_current_itinerary_start_name"
app:layout_constraintTop_toTopOf="@+id/aciv_current_itinerary_start_point"
app:layout_constraintBottom_toBottomOf="@+id/aciv_current_itinerary_start_point"
app:layout_constraintStart_toEndOf="@+id/aciv_current_itinerary_start_point"
android:layout_marginStart="@dimen/dp_29"
android:text="天安门"
android:textColor="@color/white"
android:textSize="@dimen/dp_40"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/naviToStart"
app:layout_constraintTop_toTopOf="@+id/actv_current_itinerary_start_name"
app:layout_constraintBottom_toBottomOf="@+id/actv_current_itinerary_start_name"
app:layout_constraintEnd_toEndOf="@+id/v_bg_itinerary_info"
android:src="@drawable/biz_taxi_nav"
android:layout_marginEnd="@dimen/dp_36"
android:layout_width="@dimen/dp_46"
android:layout_height="@dimen/dp_46"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_distance_end"
android:text="5.2公里"
android:textSize="@dimen/dp_32"
android:textColor="@color/biz_routing_CCCCCC"
app:layout_constraintTop_toBottomOf="@+id/actv_current_itinerary_start_name"
app:layout_constraintStart_toStartOf="@+id/actv_current_itinerary_start_name"
app:layout_constraintBottom_toTopOf="@+id/actv_current_itinerary_end_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_current_itinerary_end_name"
app:layout_constraintTop_toTopOf="@+id/aciv_current_itinerary_end_point"
app:layout_constraintBottom_toBottomOf="@+id/aciv_current_itinerary_end_point"
app:layout_constraintStart_toEndOf="@+id/aciv_current_itinerary_end_point"
android:layout_marginStart="@dimen/dp_29"
android:text="环球贸易中心"
android:textColor="@color/white"
android:textSize="@dimen/dp_40"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_submit_task"
android:layout_width="@dimen/dp_356"
android:layout_height="@dimen/dp_120"
app:pressed_enabled="false"
android:gravity="center"
android:text="问题打点"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginStart="@dimen/dp_54"
android:layout_marginBottom="@dimen/dp_55"
android:background="@drawable/biz_button_selector"
android:textColor="@color/biz_taxi_submit_text_color_selector"
android:textSize="@dimen/dp_40" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_end_routing"
android:layout_width="@dimen/dp_356"
android:layout_height="@dimen/dp_120"
app:pressed_enabled="false"
android:gravity="center"
android:text="结束服务"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginEnd="@dimen/dp_54"
android:layout_marginBottom="@dimen/dp_55"
android:background="@drawable/biz_button_selector"
android:textColor="@color/biz_taxi_button_red_text_color"
android:textSize="@dimen/dp_40" />
<androidx.constraintlayout.widget.Group
android:id="@+id/goutp_show_routing_info"
app:constraint_referenced_ids="actv_end_routing,actv_submit_task,actv_current_itinerary_end_name,actv_distance_end,actv_current_itinerary_start_name,aciv_current_itinerary_end_point,v_line_current_start_end,aciv_current_itinerary_start_point,v_bg_itinerary_info,actv_routing_name,naviToStart"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<include
android:id="@+id/include_empty"
layout="@layout/common_empty_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</merge>

View File

@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout"
android:layout_width="@dimen/dp_880"
android:layout_height="match_parent"
tools:layout_height="@dimen/dp_966"
tools:background="@drawable/biz_shape_itinerary_bg_default"
xmlns:tools="http://schemas.android.com/tools">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_routing_title"
android:textSize="@dimen/dp_45"
android:textColor="@color/white"
android:text="算路验证路线"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginStart="@dimen/dp_54"
android:layout_marginTop="@dimen/dp_36"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<LinearLayout
android:id="@+id/actv_running_task_time"
android:gravity="center"
android:layout_marginEnd="@dimen/dp_54"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginTop="@dimen/dp_2"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_100">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_refresh"
android:layout_width="@dimen/dp_200"
android:layout_height="@dimen/dp_80"
app:pressed_enabled="false"
android:gravity="center"
android:text="刷新列表"
android:background="@drawable/biz_button_selector"
android:textColor="@color/white"
android:textSize="@dimen/dp_40" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/switch_routing_rv"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_0"
android:layout_marginStart="@dimen/dp_54"
android:layout_marginEnd="@dimen/dp_52"
app:layout_constraintTop_toBottomOf="@+id/actv_routing_title"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginTop="@dimen/dp_40" />
<include
android:id="@+id/include_empty"
layout="@layout/common_empty_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<include
android:id="@+id/include_error"
layout="@layout/common_error_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</merge>

View File

@@ -0,0 +1,99 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout"
android:layout_width="@dimen/dp_774"
android:layout_height="wrap_content"
android:background="@drawable/biz_shape_itinerary_bg_default"
xmlns:tools="http://schemas.android.com/tools">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_routing_name"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginStart="@dimen/dp_30"
android:layout_marginTop="@dimen/dp_26"
android:textColor="@color/white"
android:textSize="@dimen/dp_40"
tools:text="灰度路线11111111"
android:singleLine="true"
android:ellipsize="end"
app:layout_constraintEnd_toStartOf="@+id/actv_today_verify_num"
android:layout_width="0dp"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_today_verify_num"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginEnd="@dimen/dp_40"
android:layout_marginTop="@dimen/dp_31"
android:textColor="@color/biz_routing_CCFFFFFF"
android:textSize="@dimen/dp_32"
tools:text="今日验证2次"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_routing_end_name"
app:layout_constraintTop_toBottomOf="@+id/actv_routing_name"
app:layout_constraintStart_toStartOf="@+id/actv_routing_name"
android:layout_marginTop="@dimen/dp_12"
android:textColor="@color/white"
android:textSize="@dimen/dp_32"
tools:text="往AAAA方向"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_history_verify_num_title"
app:layout_constraintTop_toBottomOf="@+id/actv_routing_end_name"
app:layout_constraintStart_toStartOf="@+id/actv_routing_end_name"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="@dimen/dp_33"
android:layout_marginTop="@dimen/dp_20"
android:textColor="@color/white"
android:textSize="@dimen/dp_30"
android:text="累计:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_history_verify_num_enable_num"
app:layout_constraintTop_toTopOf="@+id/actv_history_verify_num_title"
app:layout_constraintBottom_toBottomOf="@+id/actv_history_verify_num_title"
app:layout_constraintStart_toEndOf="@+id/actv_history_verify_num_title"
android:textColor="@color/biz_routing_26C14F"
android:layout_marginStart="@dimen/dp_17"
android:textSize="@dimen/dp_30"
tools:text="5可用"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_history_verify_num_disenable_num"
app:layout_constraintTop_toTopOf="@+id/actv_history_verify_num_title"
app:layout_constraintBottom_toBottomOf="@+id/actv_history_verify_num_title"
app:layout_constraintStart_toEndOf="@+id/actv_history_verify_num_enable_num"
android:textColor="@color/biz_routing_FF852E"
android:layout_marginStart="@dimen/dp_28"
android:textSize="@dimen/dp_30"
tools:text="2不可用"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_routing_start"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:textColor="@color/biz_routing_2eacff"
android:layout_marginEnd="@dimen/dp_40"
android:layout_marginBottom="@dimen/dp_32"
android:textSize="@dimen/dp_30"
android:text="开始"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="@dimen/dp_880"
android:layout_height="match_parent"
tools:layout_height="@dimen/dp_966"
xmlns:tools="http://schemas.android.com/tools"
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
<com.mogo.och.biz.routing.ui.routingselect.RoutingSelectView
android:id="@+id/routingSelectView"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<com.mogo.och.biz.routing.ui.runing.taxi.TaxiRunningView
android:id="@+id/routingTaxiRunningView"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<com.mogo.och.biz.routing.ui.runing.other.TaskRunningView
android:id="@+id/routingOtherRunningView"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<com.mogo.och.common.module.wigets.loading.LoadingViewBig
android:id="@+id/switch_routing_loading"
android:visibility="gone"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</merge>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="biz_routing_FF4E41">#FF4E41</color>
<color name="biz_routing_2eacff">#2EACFF</color>
<color name="biz_routing_ccb9c3e9">#CCB9C3E9</color>
<color name="biz_routing_4D000000">#4D000000</color>
<color name="biz_routing_80000000">#80000000</color>
<color name="biz_routing_CCCCCC">#CCCCCC</color>
<color name="biz_routing_CCFFFFFF">#CCFFFFFF</color>
<color name="biz_routing_26C14F">#26C14F</color>
<color name="biz_routing_FF852E">#FF852E</color>
</resources>

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="biz_bus_dialog_tips">您确认要结束任务吗?</string>
</resources>

View File

@@ -16,6 +16,7 @@ import com.mogo.eagle.core.function.call.datacenter.CallerDataCenterBizListener
import com.mogo.eagle.core.function.call.map.CallerMapGlobalTrajectoryDrawManager
import com.mogo.eagle.core.function.call.och.CallerEagleBaseFunctionCall4OchManager
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.e
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OCHCOMMON
@@ -42,7 +43,7 @@ import kotlin.properties.Delegates
* 订单中
*/
object LineManager : CallerBase<ILineCallback>() {
const val TAG = M_OCHCOMMON+"LineManager"
const val TAG = M_OCHCOMMON + "LineManager"
const val firstStationFirstStartAutopilotFlag = 0
const val middleStationFirstStartAutopilotFlag = 1
@@ -54,7 +55,7 @@ object LineManager : CallerBase<ILineCallback>() {
@JvmStatic
private var _lineInfos: LineInfo? = null
val lineInfos:LineInfo?
val lineInfos: LineInfo?
@JvmStatic
get() = _lineInfos
@@ -63,7 +64,7 @@ object LineManager : CallerBase<ILineCallback>() {
*/
@JvmStatic
private var _contraiInfo: ContraiInfo? = null
val contraiInfo:ContraiInfo?
val contraiInfo: ContraiInfo?
@JvmStatic
get() = _contraiInfo
@@ -96,9 +97,9 @@ object LineManager : CallerBase<ILineCallback>() {
* 2 中间站点触发
* 3 新的站点第一次启动自驾成功后
*/
var autopilotFlag : Int by Delegates.observable(firstStationFirstStartAutopilotFlag) { _, oldValue, newValue ->
if(oldValue!=newValue){
d(TAG,"autopilotFlag old=$oldValue new=$newValue")
var autopilotFlag: Int by Delegates.observable(firstStationFirstStartAutopilotFlag) { _, oldValue, newValue ->
if (oldValue != newValue) {
d(TAG, "autopilotFlag old=$oldValue new=$newValue")
}
}
@@ -113,23 +114,24 @@ object LineManager : CallerBase<ILineCallback>() {
CallerEagleBaseFunctionCall4OchManager.setOchAutopilotOrderId(newValue)
isFirstStartAutopilot = true
M_LISTENERS.forEach {
it.value.onAutopilotIdChange(oldValue,newValue)
it.value.onAutopilotIdChange(oldValue, newValue)
}
if(!AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)&&
!AppIdentityModeUtils.isShuttle(FunctionBuildConfig.appIdentityMode)&&
if (!AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode) &&
!AppIdentityModeUtils.isShuttle(FunctionBuildConfig.appIdentityMode) &&
!AppIdentityModeUtils.isScheduled(FunctionBuildConfig.appIdentityMode)
){
) {
val (start, end) = getStations()
if(start!=null&&end!=null){
val ochInfo = OchInfo(0, mutableListOf(start.toMogoLocation(), end.toMogoLocation()))
if (start != null && end != null) {
val ochInfo =
OchInfo(0, mutableListOf(start.toMogoLocation(), end.toMogoLocation()))
CallerDataCenterBizListener.invokeOchInfo(ochInfo)
OchChainLogManager.writeChainLogMap("向地图传参数", "参数信息:${ochInfo}")
d(TAG,"向地图传参数_参数信息:${ochInfo}")
}else{
d(TAG, "向地图传参数_参数信息:${ochInfo}")
} else {
val ochInfo = OchInfo(0, mutableListOf())
CallerDataCenterBizListener.invokeOchInfo(ochInfo)
OchChainLogManager.writeChainLogMap("向地图传参数", "参数信息:${ochInfo}")
d(TAG,"向地图传参数_参数信息:${ochInfo}")
d(TAG, "向地图传参数_参数信息:${ochInfo}")
}
}
}
@@ -165,9 +167,13 @@ object LineManager : CallerBase<ILineCallback>() {
* 在终点10m 范围内向地盘查询是否到站
* [com.mogo.och.bridge.autopilot.autopilot.OchAutoPilotStatusListenerManager.onAutoPilotStation]
*/
val token = CallerAutoPilotControlManager.sendSsmFuncQueryAutoPilotStation(teleOrderId)
OchChainLogManager.writeChainLogAutopilot("到站逻辑","距离站点:$distance 请求token$token")
d(TAG,"到站逻辑_距离站点$distance 请求token$token")
val token =
CallerAutoPilotControlManager.sendSsmFuncQueryAutoPilotStation(teleOrderId)
OchChainLogManager.writeChainLogAutopilot(
"到站逻辑",
"距离站点:$distance 请求token$token"
)
d(TAG, "到站逻辑_距离站点$distance 请求token$token")
}
}
}
@@ -186,7 +192,7 @@ object LineManager : CallerBase<ILineCallback>() {
}
}
fun searchAutopilotState(){
fun searchAutopilotState() {
CallerAutoPilotControlManager.sendSsmFuncQueryAutoPilotInfo()
}
@@ -194,10 +200,10 @@ object LineManager : CallerBase<ILineCallback>() {
* [searchAutopilotState] 方法请求的返回值
*/
fun invokeSetIsFirstAutopilot(orderId: String?, firstAutopilotFlag: Boolean, count: Int) {
if (this.teleOrderId==orderId){
if(count>=1){
if (this.teleOrderId == orderId) {
if (count >= 1) {
teleIsFirstStartAutopilot = false
}else{
} else {
teleIsFirstStartAutopilot = true
}
}
@@ -209,20 +215,23 @@ object LineManager : CallerBase<ILineCallback>() {
fun setStartAndEndStation(startStation: BusStationBean?, endStation: BusStationBean?) {
this.startStation = startStation
this.endStation = endStation
if(startStation==null||endStation==null){
if (startStation == null || endStation == null) {
clearAutopilotControlParameters()
}else {
} else {
setAutopilotControlParameters()
}
OchChainLogManager.writeChainLogAutopilot("自驾参数", "站点信息:${startStation}---${endStation}")
d(TAG,"自驾参数 设置站点_站点信息:${startStation}---${endStation}")
OchChainLogManager.writeChainLogAutopilot(
"自驾参数",
"站点信息:${startStation}---${endStation}"
)
d(TAG, "自驾参数 设置站点_站点信息:${startStation}---${endStation}")
}
fun setContraiInfo(contraiInfo: ContraiInfo?){
fun setContraiInfo(contraiInfo: ContraiInfo?) {
this._contraiInfo = contraiInfo
setAutopilotControlParameters()
OchChainLogManager.writeChainLogAutopilot("自驾参数", "轨迹信息:${contraiInfo}")
d(TAG,"自驾参数 设置轨迹_轨迹信息:${contraiInfo}")
d(TAG, "自驾参数 设置轨迹_轨迹信息:${contraiInfo}")
}
@JvmStatic
@@ -242,12 +251,12 @@ object LineManager : CallerBase<ILineCallback>() {
sb.append(it.value)
}
OchChainLogManager.writeChainLogAutopilot("设置线路", "$sb")
d(TAG,"自驾参数 设置线路_线路信息:${_lineInfos}_${sb}")
d(TAG, "自驾参数 设置线路_线路信息:${_lineInfos}_${sb}")
CallerEagleBaseFunctionCall4OchManager.updateOrderLine(sb.toString())
}
}
OchChainLogManager.writeChainLogAutopilot("设置线路", "线路信息:$_lineInfos")
d(TAG,"自驾参数 设置线路_线路信息:${_lineInfos}")
d(TAG, "自驾参数 设置线路_线路信息:${_lineInfos}")
}
fun getStations(): Pair<BusStationBean?, BusStationBean?> {
@@ -294,8 +303,8 @@ object LineManager : CallerBase<ILineCallback>() {
}
}
fun getLineInfo(function: (lineInfo: LineInfo) -> Unit){
_lineInfos?.let { line->
fun getLineInfo(function: (lineInfo: LineInfo) -> Unit) {
_lineInfos?.let { line ->
function.invoke(line)
return
}
@@ -311,7 +320,7 @@ object LineManager : CallerBase<ILineCallback>() {
}
}
private fun setAutopilotControlParameters(){
private fun setAutopilotControlParameters() {
getStationsWithLine { start, end, lineInfo ->
val parameters = initAutopilotControlParameters()
if (null == parameters) {
@@ -321,7 +330,7 @@ object LineManager : CallerBase<ILineCallback>() {
d(TAG, "AutopilotControlParameters is update.")
if (lineInfo.isFirstStation(start)) {
autopilotFlag = firstStationFirstStartAutopilotFlag
}else{
} else {
autopilotFlag = middleStationFirstStartAutopilotFlag
}
CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(parameters)
@@ -332,14 +341,18 @@ object LineManager : CallerBase<ILineCallback>() {
val endStationLocation = MogoLocation()
endStationLocation.latitude = end.gcjLat
endStationLocation.longitude = end.gcjLon
TrajectoryAndDistanceManager.setStationPoint(startStationLocation, endStationLocation, lineInfo.lineId)
OchLocationManager.addGCJ02Listener(TAG,1, mMapLocationListener)
TrajectoryAndDistanceManager.setStationPoint(
startStationLocation,
endStationLocation,
lineInfo.lineId
)
OchLocationManager.addGCJ02Listener(TAG, 1, mMapLocationListener)
// 恢复启动自驾信息
searchAutopilotState()
}
}
private fun clearAutopilotControlParameters(){
private fun clearAutopilotControlParameters() {
CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(null)
TrajectoryAndDistanceManager.setStationPoint(null, null, null)
autopilotId = ""
@@ -380,20 +393,21 @@ object LineManager : CallerBase<ILineCallback>() {
fun initAutopilotControlParameters(): AutopilotControlParameters? {
var parameters: AutopilotControlParameters? = null
getStationsWithLine { start, end, lineInfo ->
this.autopilotId = "${lineInfo.lineId}_${start.siteId}_${end.siteId}_${lineInfo.orderId}"
this.autopilotId =
"${lineInfo.lineId}_${start.siteId}_${end.siteId}_${lineInfo.orderId}"
this.teleOrderId = lineInfo.genAutopilotId()
}
getStationsWithLineAndContrai { start, end, lineInfo, contrai ->
parameters = AutopilotControlParameters()
parameters?.routeID = lineInfo.lineId.toInt()
parameters?.routeName = lineInfo.lineName
parameters?.startName = start.name
parameters?.endName = end.name
parameters?.startLatLon = AutoPilotLonLat(start.lat, start.lon)
parameters?.endLatLon = AutoPilotLonLat(end.lat, end.lon)
if(AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)){
parameters?.startName = start.name ?: ""
parameters?.endName = end.name ?: ""
parameters?.startLatLon = AutoPilotLonLat(start.lat, start.lon,true)
parameters?.endLatLon = AutoPilotLonLat(end.lat, end.lon,true)
if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)) {
parameters?.vehicleType = 9
}else{
} else {
parameters?.vehicleType = 10
}
parameters?.orderId = this.teleOrderId
@@ -418,95 +432,105 @@ object LineManager : CallerBase<ILineCallback>() {
)
}
val (wayLatLons, blackLatLons) = contrai.getWayBlackLatLons()
parameters?.wayLatLons = wayLatLons
parameters?.blackLatLons = blackLatLons
if (endStation?.passPoints?.isNotEmpty() == true ||
endStation?.blackPoints?.isNotEmpty() == true
) {
val (wayLatLons, blackLatLons) = endStation!!.getWayBlackLatLons()
parameters?.wayLatLons = wayLatLons
parameters?.blackLatLons = blackLatLons
CallerLogger.d(TAG, "从站点获取经停点和禁行点")
} else {
val (wayLatLons, blackLatLons) = contrai.getWayBlackLatLons()
parameters?.wayLatLons = wayLatLons
parameters?.blackLatLons = blackLatLons
CallerLogger.d(TAG, "从轨迹获取经停点和禁行点")
}
}
CallerLogger.d(TAG, "${parameters?.wayLatLons}\n${parameters?.blackLatLons}")
if (parameters == null) {
ToastUtils.showShort("未设置起始或终点站点")
}
return parameters
}
fun getWayBlackLatLons(
passPoints: MutableList<BusStationBean>?,
blackPoints: MutableList<BusStationBean>?
): Pair<MutableList<AutoPilotLonLat>, MutableList<AutoPilotLonLat>> {
fun initAutopilotControlParametersFromContrai(): AutopilotControlParameters? {
var parameters: AutopilotControlParameters? = null
this.autopilotId = "${lineInfos?.lineId}_${startStation?.siteId}_${endStation?.siteId}_${lineInfos?.orderId}"
this.teleOrderId = lineInfos?.genAutopilotId() ?: ""
parameters = AutopilotControlParameters()
parameters.routeID = lineInfos?.lineId?.toInt()?:0
parameters.routeName = lineInfos?.lineName?:""
lineInfos?.siteInfos?.let {
if(it.size>=0){
parameters.startLatLon = AutoPilotLonLat(it.first().lat, it.first().lon,true)
parameters.endLatLon = AutoPilotLonLat(it.last().lat, it.last().lon,true)
parameters.startName = it.first().name ?: ""
parameters.endName = it.last().name ?: ""
}
}
if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)) {
parameters.vehicleType = 9
} else {
parameters.vehicleType = 10
}
parameters.orderId = this.teleOrderId
parameters.firstStationFlag = autopilotFlag
parameters.firstAutopilotFlag = teleIsFirstStartAutopilot
if (parameters.autoPilotLine == null) {
parameters.autoPilotLine = AutoPilotLine(
lineInfos?.lineId?:0L,
lineInfos?.lineName?:"",
contraiInfo?.csvFileUrl?:"",
contraiInfo?.csvFileMd5?:"",
contraiInfo?.txtFileUrl?:"",
contraiInfo?.txtFileMd5?:"",
contraiInfo?.contrailSaveTime?:System.currentTimeMillis(),
"",
"",
"",
"",
"",
0L
)
}
val wayLatLons = mutableListOf<AutoPilotLonLat>()
// 途经点
if (!passPoints.isNullOrEmpty()) {
for (mogoLatLng in passPoints) {
wayLatLons.add(
AutoPilotLonLat(
mogoLatLng.lat,
mogoLatLng.lon,
when (mogoLatLng.pointType) {
1 -> {//途径点
false
}
2 -> {//禁行点
false
}
3 -> {//站点
true
}
else -> {
false
}
}
)
)
}
}
val blackLatLons = mutableListOf<AutoPilotLonLat>()
// 黑名单点
if (!blackPoints.isNullOrEmpty()) {
for (mogoLatLng in blackPoints) {
blackLatLons.add(
AutoPilotLonLat(
mogoLatLng.lat,
mogoLatLng.lat,
when (mogoLatLng.pointType) {
1 -> {//途径点
false
}
2 -> {//禁行点
false
}
3 -> {//站点
true
}
else -> {
false
}
}
)
)
lineInfos?.siteInfos?.forEachIndexed { index, site ->
if(index>0){
val (wayLatLonsSite, blackLatLonsSite) = site.getWayBlackLatLons()
wayLatLons.addAll(wayLatLonsSite)
blackLatLons.addAll(blackLatLonsSite)
if(index!=lineInfos!!.siteInfos.size-1) {
wayLatLons.add(AutoPilotLonLat(site.lat, site.lon, true))
}
}
}
return Pair(wayLatLons,blackLatLons)
}
}
parameters.wayLatLons = wayLatLons
parameters.blackLatLons = blackLatLons
CallerLogger.d(TAG, "从轨迹获取经停点和禁行点")
return parameters
}
// 启动自动驾驶
fun startAutopilot() {
if(startStation ==null|| endStation ==null){
if (startStation == null || endStation == null) {
ToastUtils.showShort("未设置起始或终点站点")
return
}
startStation?.let {
if(!it.isLeaving){
if (!it.isLeaving) {
ToastUtils.showShort("请滑动出发后再启动自驾")
return
}
@@ -522,10 +546,10 @@ object LineManager : CallerBase<ILineCallback>() {
OchAutopilotAnalytics.triggerClickStartAutopilotTime(System.currentTimeMillis())
//1、判断轨迹url是否可用
if(_contraiInfo ==null){
if (_contraiInfo == null) {
ToastUtils.showLong("无发布轨迹, 请发布后重试")
return
}else{
} else {
if (FunctionBuildConfig.isPassStartAutopilotCommand
&& TextUtils.isEmpty(_contraiInfo!!.csvFileUrl)
&& TextUtils.isEmpty(_contraiInfo!!.csvFileMd5)
@@ -558,7 +582,7 @@ object LineManager : CallerBase<ILineCallback>() {
return
}
triggerStartServiceEvent(false,0,"")
triggerStartServiceEvent(false, 0, "")
val parameters = initAutopilotControlParameters()
if (null == parameters) {
@@ -566,10 +590,11 @@ object LineManager : CallerBase<ILineCallback>() {
return
}
val sessionId = startAutoPilot(parameters)
val sessionId = startAutoPilot(parameters)
OchAutopilotAnalytics.triggerUpdateStartAutoPilotSessionId(sessionId)
d(TAG,
d(
TAG,
"行程日志-开启自动驾驶====" + GsonUtil.jsonFromObject(parameters)
+ " startLatLon=" + parameters.startName + "endLatLon=" + parameters.endName +
"isRestart = " + isFirstStartAutopilot
@@ -583,7 +608,7 @@ object LineManager : CallerBase<ILineCallback>() {
private fun triggerUnableStartAPReasonEvent() {
getStationsWithLine { start, end, line ->
OchAutopilotAnalytics.triggerUnableStartAPReasonEvent(
start.name, end.name,line.lineId.toString() , "",
start.name ?: "", end.name ?: "", line.lineId.toString(), "",
OCHAdasAbilityManager.getInstance().autopilotUnAbilityReason
)
}
@@ -594,32 +619,32 @@ object LineManager : CallerBase<ILineCallback>() {
* 1: 通过can消息发送自驾状态确定启动自驾成功
* 2通过FSM 反馈确定启动自驾成功
*/
fun triggerStartServiceEvent(send: Boolean,source:Int,type:String) {
fun triggerStartServiceEvent(send: Boolean, source: Int, type: String) {
getStationsWithLine { start, end, lineInfo ->
OchAutopilotAnalytics.triggerStartAutopilotEvent(
isFirstStartAutopilot,
send,
start.name,
end.name,
start.name ?: "",
end.name ?: "",
lineInfo.lineId.toInt(),
"",
System.currentTimeMillis(),
type,
source
)
if(send){// 启动自驾成功回调
if (send) {// 启动自驾成功回调
teleIsFirstStartAutopilot = false
isFirstStartAutopilot = false
autopilotFlag = norFirstStartAutopilotFlag
M_LISTENERS.forEach {
it.value.startAutopilotSuccess(source,autopilotId)
it.value.startAutopilotSuccess(source, autopilotId)
}
}
}
}
@JvmStatic
fun invokeStartAutopilotTimeOut(){
fun invokeStartAutopilotTimeOut() {
M_LISTENERS.forEach {
it.value.startAutopilotTimeOut()
}
@@ -627,9 +652,13 @@ object LineManager : CallerBase<ILineCallback>() {
@JvmStatic
fun invokeStartAutopilotFailure(startFailedCode: String, startFailedMessage: String) {
OchAutopilotAnalytics.triggerStartAutopilotFailureEventByAdas(startFailedCode,startFailedMessage,System.currentTimeMillis())
OchAutopilotAnalytics.triggerStartAutopilotFailureEventByAdas(
startFailedCode,
startFailedMessage,
System.currentTimeMillis()
)
M_LISTENERS.forEach {
it.value.startAutopilotFailure(startFailedCode,startFailedMessage)
it.value.startAutopilotFailure(startFailedCode, startFailedMessage)
}
}
@@ -640,16 +669,19 @@ object LineManager : CallerBase<ILineCallback>() {
}
fun compareFSMAndOchOrderId(autopilotIdFromFsm: String?) {
if(autopilotIdFromFsm == teleOrderId){
if (autopilotIdFromFsm == teleOrderId) {
// 地盘有和上层一样 不用操作
}else{
if(autopilotIdFromFsm.isNullOrEmpty()){
} else {
if (autopilotIdFromFsm.isNullOrEmpty()) {
// 地盘没有 不做操作
}else{
} else {
// 地盘有但是和och出不一样
// todo 需要och 重新出发轨迹下载操作
ToastUtils.showShort("${autopilotIdFromFsm}_${teleOrderId}_自动驾驶id不同请排查")
OchChainLogManager.writeChainLogAutopilot("自驾Id","${autopilotIdFromFsm}_${teleOrderId}_自动驾驶id不同请排查")
OchChainLogManager.writeChainLogAutopilot(
"自驾Id",
"${autopilotIdFromFsm}_${teleOrderId}_自动驾驶id不同请排查"
)
// val initAutopilotControlParameters = initAutopilotControlParameters()
// if (initAutopilotControlParameters!==null&&initAutopilotControlParameters.autoPilotLine!=null
// && contraiInfo!=null

View File

@@ -17,6 +17,7 @@ import com.mogo.och.bridge.trajectory.TrajectoryCache
import com.mogo.och.common.module.manager.loop.BizLoopManager
import com.mogo.och.common.module.manager.loop.LoopInfo
import com.mogo.och.bridge.utils.CoordinateCalculateRouteUtil
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
import io.reactivex.schedulers.Schedulers
import mogo.telematics.pad.MessagePad
import java.util.concurrent.ConcurrentHashMap
@@ -127,6 +128,7 @@ object TrajectoryAndDistanceManager : IMoGoPlanningRottingListener {
d(M_OCHCOMMON + TAG, "onAutopilotRotting: 收到轨迹")
globalPathResp?.wayPointsList?.let {
if (it.size > 0) {
OchChainLogManager.writeChainLogTrajectory("轨迹监控","收到轨迹信息轨迹个数${it.size}第一个点${it[0]}最后一个点:${it.last()} 轨迹id:${globalPathResp.lineId}")
d(
M_OCHCOMMON + TAG,
"收到轨迹:轨迹个数${it.size}第一个点${it[0]}最后一个点:${it.last()} 轨迹id:${globalPathResp.lineId}"
@@ -192,6 +194,7 @@ object TrajectoryAndDistanceManager : IMoGoPlanningRottingListener {
M_OCHCOMMON + TAG,
"线路id:${lineId}设置站点:开始站点${startStationInfo}、结束站点:${endStationInfo}"
)
OchChainLogManager.writeChainLogTrajectory("轨迹监控","设置站点:线路id:${lineId}设置站点:开始站点${startStationInfo}、结束站点:${endStationInfo}")
if (startStationInfo == null || endStationInfo == null || lineId == -1L) {
this.endStationInfo.index = null
this.endStationInfo.distance = null

View File

@@ -61,7 +61,7 @@ dependencies {
testImplementation project(path: ':OCH:common:common')
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation rootProject.ext.dependencies.amapnavi3dmap
api rootProject.ext.dependencies.amapnavi3dmap
implementation rootProject.ext.dependencies.rxandroid
implementation rootProject.ext.dependencies.arouter

View File

@@ -0,0 +1,5 @@
package com.mogo.och.common.module.biz.routing;
public interface RoutingCallback {
void showMap(boolean show);
}

View File

@@ -0,0 +1,35 @@
package com.mogo.och.common.module.biz.routing
import android.view.View
import androidx.fragment.app.Fragment
import com.alibaba.android.arouter.launcher.ARouter
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OCHCOMMON
import com.mogo.och.common.module.biz.time.TimeService
import com.mogo.och.common.module.constant.OchCommonConst
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
import com.mogo.och.common.module.manager.loop.BizLoopManager
object RoutingManager {
private const val TAG = M_OCHCOMMON+"RoutingManager"
private var routingService: RoutingService? =
ARouter.getInstance().build(OchCommonConst.BIZ_ROUTING).navigation() as RoutingService
fun load(){
OchChainLogManager.writeChainLogInit("初始化信息","初始化算路验证系统")
d(TAG,"初始化信息_初始化算路验证系统")
}
fun getRoutingView():View?{
return routingService?.getRoutingView()
}
fun setRoutingCallback(callback: RoutingCallback?){
routingService?.setRoutingCallback(callback)
}
}

View File

@@ -0,0 +1,13 @@
package com.mogo.och.common.module.biz.routing
import android.view.View
import androidx.fragment.app.Fragment
import com.alibaba.android.arouter.facade.template.IProvider
interface RoutingService : IProvider {
fun getRoutingView(): View?
fun setRoutingCallback(callback: RoutingCallback?)
}

View File

@@ -39,6 +39,7 @@ class OchCommonConst {
const val BIZ_TIME = "/ochbiz/common/time"
const val BIZ_Media = "/ochbiz/common/media"
const val BIZ_ROUTING = "/ochbiz/common/routing"
const val BIZ_OFFLINE = "/offlinedriver/offlinedata"
const val BIZ_Bridge = "/birdge/bridge"
@@ -75,6 +76,19 @@ class OchCommonConst {
const val ARRIVE_AT_END_STATION_DISTANCE = 10
// taxi 到达起始点围栏
const val ARRIVE_AT_START_STATION_DISTANCE = 15 //围栏由20m改为50m 再次改为15m
//算路终点UUID
const val TAXI_ROUTING_VERIFY_END_SITE = "taxi_routing_verify_end_site"
//算路起点UUID
const val TAXI_ROUTING_VERIFY_START_SITE = "taxi_routing_verify_start_site"
const val TYPE_MARKER_ROUTING_VERIFY = "TYPE_MARKER_TAXI_ROUTING_VERIFY"
//b1 b2 平均速度 bus的平均里程25km/h
const val BUS_AVERAGE_SPEED = 25

View File

@@ -64,6 +64,13 @@ object OchChainLogManager {
const val EVENT_KEY_INFO_ERROR = "analytics_event_och_error"
// 算路验证模式
const val EVENT_KEY_INFO_ROUTING = "analytics_event_och_routing"
fun writeChainLogRouting(title: String, info: String , upload: Boolean = true) {
writeChainLog(title, info, upload, EVENT_KEY_INFO_ROUTING)
}
const val EVENT_KEY_INFO_VLM = "analytics_event_och_vlm"
const val EVENT_KEY_INFO_BRIDGE = "analytics_event_och_bridge"

View File

@@ -41,6 +41,10 @@
<string name="common_dialog_goback">返回</string>
<string name="common_leave_station">滑动出发</string>
<string name="common_arrive_station">到站</string>
<string name="common_complete">结束</string>
<string name="common_start_task_after_upload_success">请等待升级完成后再选择任务</string>

View File

@@ -1,214 +0,0 @@
package com.mogo.och.data.bean;
import com.google.gson.annotations.SerializedName;
import com.mogo.eagle.core.data.map.MogoLocation;
import org.jetbrains.annotations.NotNull;
import java.util.List;
import java.util.Objects;
/**
* 单个网约车小巴车站信息
*
* @author tongchenfei
*/
public class BusStationBean {
private int siteId;
@SerializedName(value = "name",alternate = {"siteName"})
private String name;
private String nameKr;
private int seq;
private double gcjLon; //高德
private double gcjLat; //高德
@SerializedName(value = "lon",alternate = {"wgs84Lon"})
private double lon; //高精坐标
@SerializedName(value = "lat",alternate = {"wgs84Lat"})
private double lat; //高精坐标
private int drivingStatus;//行驶信息0初始值1已经过2当前站3未到站
private boolean leaving;// 为出发false 出发true
private String introduction;// 站点简介
private boolean isPlayTts;
private int pointType; // 1:途径点 2:禁行点 3:站点
private List<SiteIntroduce> videoList;
public String getNameKr() {
return nameKr;
}
public void setNameKr(String nameKr) {
this.nameKr = nameKr;
}
public int getSiteId() {
return siteId;
}
public String getName() {
return name;
}
public int getSeq() {
return seq;
}
public double getGcjLon() {
return gcjLon;
}
public double getGcjLat() {
return gcjLat;
}
public double getLon() {
return lon;
}
public double getLat() {
return lat;
}
public int getDrivingStatus() {
return drivingStatus;
}
public boolean isLeaving() {
return leaving;
}
public void setSiteId(int siteId) {
this.siteId = siteId;
}
public void setName(String name) {
this.name = name;
}
public void setSeq(int seq) {
this.seq = seq;
}
public void setGcjLon(double gcjLon) {
this.gcjLon = gcjLon;
}
public void setGcjLat(double gcjLat) {
this.gcjLat = gcjLat;
}
public void setLon(double lon) {
this.lon = lon;
}
public void setLat(double lat) {
this.lat = lat;
}
public void setDrivingStatus(int drivingStatus) {
this.drivingStatus = drivingStatus;
}
public void setLeaving(boolean leaving) {
this.leaving = leaving;
}
public String getIntroduction() {
return introduction;
}
public void setIntroduction(String introduction) {
this.introduction = introduction;
}
public boolean isPlayTts() {
return isPlayTts;
}
public void setPlayTts(boolean playTts) {
isPlayTts = playTts;
}
public List<SiteIntroduce> getVideoList() {
return videoList;
}
public void setVideoList(List<SiteIntroduce> videoList) {
this.videoList = videoList;
}
public int getPointType() {
return pointType;
}
public void setPointType(int pointType) {
this.pointType = pointType;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
BusStationBean that = (BusStationBean) o;
return siteId == that.siteId
&& seq == that.seq
&& Double.compare(gcjLon, that.gcjLon) == 0
&& Double.compare(gcjLat, that.gcjLat) == 0
&& Double.compare(lon, that.lon) == 0
&& Double.compare(lat, that.lat) == 0
&& drivingStatus == that.drivingStatus
&& leaving == that.leaving && isPlayTts == that.isPlayTts
&& pointType == that.pointType
&& Objects.equals(name, that.name)
&& Objects.equals(nameKr, that.nameKr)
&& Objects.equals(introduction, that.introduction)
&& Objects.equals(videoList, that.videoList);
}
@Override
public int hashCode() {
int result = siteId;
result = 31 * result + Objects.hashCode(name);
result = 31 * result + Objects.hashCode(nameKr);
result = 31 * result + seq;
result = 31 * result + Double.hashCode(gcjLon);
result = 31 * result + Double.hashCode(gcjLat);
result = 31 * result + Double.hashCode(lon);
result = 31 * result + Double.hashCode(lat);
result = 31 * result + drivingStatus;
result = 31 * result + Boolean.hashCode(leaving);
result = 31 * result + Objects.hashCode(introduction);
result = 31 * result + Boolean.hashCode(isPlayTts);
result = 31 * result + pointType;
result = 31 * result + Objects.hashCode(videoList);
return result;
}
@Override
public String toString() {
return "BusStationBean{" +
"siteId=" + siteId +
", name='" + name + '\'' +
", nameKr='" + nameKr + '\'' +
", seq=" + seq +
", gcjLon=" + gcjLon +
", gcjLat=" + gcjLat +
", lon=" + lon +
", lat=" + lat +
", drivingStatus=" + drivingStatus +
", leaving=" + leaving +
", introduction='" + introduction + '\'' +
", isPlayTts=" + isPlayTts +
", pointType=" + pointType +
", videoList=" + videoList +
'}';
}
@NotNull
public MogoLocation toMogoLocation() {
MogoLocation result = new MogoLocation();
result.setLatitude(gcjLat);
result.setLongitude(gcjLon);
return result;
}
}

View File

@@ -0,0 +1,169 @@
package com.mogo.och.data.bean
import com.google.gson.annotations.SerializedName
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters.AutoPilotLonLat
import com.mogo.eagle.core.data.map.MogoLocation
import java.util.Objects
/**
* 单个网约车小巴车站信息
*
* @author tongchenfei
*/
open class BusStationBean {
var siteId: Int = 0
@JvmField
@SerializedName(value = "name", alternate = ["siteName"])
var name: String? = null
var nameKr: String? = null
var seq: Int = 0
@JvmField
var gcjLon: Double = 0.0 //高德
@JvmField
var gcjLat: Double = 0.0 //高德
@SerializedName(value = "lon", alternate = ["wgs84Lon"])
var lon: Double = 0.0 //高精坐标
@SerializedName(value = "lat", alternate = ["wgs84Lat"])
var lat: Double = 0.0 //高精坐标
@JvmField
var drivingStatus: Int = 0 //行驶信息0初始值1已经过2当前站3未到站
var isLeaving: Boolean = false // 为出发false 出发true
var introduction: String? = null // 站点简介
var isPlayTts: Boolean = false
var pointType: Int = 0 // 1:途径点 2:禁行点 3:站点
var videoList: List<SiteIntroduce>? = null
var passPoints: List<BusStationBean>? = null // 用于算路的经停点
var blackPoints: List<BusStationBean>? = null // 用于算路的黑名單點
override fun equals(o: Any?): Boolean {
if (this === o) return true
if (o == null || javaClass != o.javaClass) return false
val that = o as BusStationBean
return siteId == that.siteId && seq == that.seq && java.lang.Double.compare(
gcjLon,
that.gcjLon
) == 0 && java.lang.Double.compare(
gcjLat,
that.gcjLat
) == 0 && java.lang.Double.compare(lon, that.lon) == 0 && java.lang.Double.compare(
lat,
that.lat
) == 0 && drivingStatus == that.drivingStatus && isLeaving == that.isLeaving && isPlayTts == that.isPlayTts && pointType == that.pointType && name == that.name
&& nameKr == that.nameKr
&& introduction == that.introduction
&& videoList == that.videoList
}
override fun hashCode(): Int {
var result = siteId
result = 31 * result + Objects.hashCode(name)
result = 31 * result + Objects.hashCode(nameKr)
result = 31 * result + seq
result = 31 * result + java.lang.Double.hashCode(gcjLon)
result = 31 * result + java.lang.Double.hashCode(gcjLat)
result = 31 * result + java.lang.Double.hashCode(lon)
result = 31 * result + java.lang.Double.hashCode(lat)
result = 31 * result + drivingStatus
result = 31 * result + java.lang.Boolean.hashCode(isLeaving)
result = 31 * result + Objects.hashCode(introduction)
result = 31 * result + java.lang.Boolean.hashCode(isPlayTts)
result = 31 * result + pointType
result = 31 * result + Objects.hashCode(videoList)
return result
}
override fun toString(): String {
return "BusStationBean{" +
"siteId=" + siteId +
", name='" + name + '\'' +
", nameKr='" + nameKr + '\'' +
", seq=" + seq +
", gcjLon=" + gcjLon +
", gcjLat=" + gcjLat +
", lon=" + lon +
", lat=" + lat +
", drivingStatus=" + drivingStatus +
", leaving=" + isLeaving +
", introduction='" + introduction + '\'' +
", isPlayTts=" + isPlayTts +
", pointType=" + pointType +
", videoList=" + videoList +
'}'
}
fun toMogoLocation(): MogoLocation {
val result = MogoLocation()
result.latitude = gcjLat
result.longitude = gcjLon
return result
}
fun getWayBlackLatLons(
): Pair<MutableList<AutoPilotLonLat>, MutableList<AutoPilotLonLat>> {
val wayLatLons = mutableListOf<AutoPilotLonLat>()
// 途经点
if (!passPoints.isNullOrEmpty()) {
for (mogoLatLng in passPoints!!) {
wayLatLons.add(
AutoPilotLonLat(
mogoLatLng.lat,
mogoLatLng.lon,
when (mogoLatLng.pointType) {
1 -> {//途径点
false
}
2 -> {//禁行点
false
}
3 -> {//站点
true
}
else -> {
false
}
}
)
)
}
}
val blackLatLons = mutableListOf<AutoPilotLonLat>()
// 黑名单点
if (!blackPoints.isNullOrEmpty()) {
for (mogoLatLng in blackPoints!!) {
blackLatLons.add(
AutoPilotLonLat(
mogoLatLng.lat,
mogoLatLng.lon,
when (mogoLatLng.pointType) {
1 -> {//途径点
false
}
2 -> {//禁行点
false
}
3 -> {//站点
true
}
else -> {
false
}
}
)
)
}
}
return Pair(wayLatLons,blackLatLons)
}
}

View File

@@ -75,7 +75,7 @@ data class ContraiInfo(
blackLatLons.add(
AutoPilotLonLat(
mogoLatLng.lat,
mogoLatLng.lat,
mogoLatLng.lon,
when (mogoLatLng.pointType) {
1 -> {//途径点
false