[Taxi无人化] refactor: DebugView 增加展示 轨迹保存时间,最新数据查询成功时间 等信息展示和优化;

This commit is contained in:
aibingbing
2023-12-07 18:43:11 +08:00
parent a4b77cd9a2
commit 0c6b9229df
5 changed files with 56 additions and 7 deletions

View File

@@ -4,6 +4,7 @@ import com.mogo.och.taxi.bean.QueryCurrentTaskRespBean
import com.mogo.och.taxi.bean.TrajectoryListRespBean
interface ITaxiTaskWithOrderCallback {
fun onTaskWithOrderQuerySuccess(timeMillis: Long)
fun onTaskWithOrderDataChanged(taskWithOrder: QueryCurrentTaskRespBean.Result?)
fun onTaskCompleted(result: QueryCurrentTaskRespBean.Result?)
fun onTaskStarted(result: QueryCurrentTaskRespBean.Result?)

View File

@@ -42,10 +42,12 @@ import kotlinx.android.synthetic.main.taxi_debug_order.view.currentLineId
import kotlinx.android.synthetic.main.taxi_debug_order.view.currentOrder
import kotlinx.android.synthetic.main.taxi_debug_order.view.currentOrderStopInfo
import kotlinx.android.synthetic.main.taxi_debug_order.view.currentOrderTrajectoryInfo
import kotlinx.android.synthetic.main.taxi_debug_order.view.currentOrderTrajectoryTime
import kotlinx.android.synthetic.main.taxi_debug_order.view.currentStatus
import kotlinx.android.synthetic.main.taxi_debug_order.view.currentTaskType
import kotlinx.android.synthetic.main.taxi_debug_order.view.debugLogHistoryTextView
import kotlinx.android.synthetic.main.taxi_debug_order.view.debugLogTitleTextView
import kotlinx.android.synthetic.main.taxi_debug_order.view.lastQuerySuccessDataTimestamps
import kotlinx.android.synthetic.main.taxi_debug_order.view.orderEndSiteInfo
import kotlinx.android.synthetic.main.taxi_debug_order.view.orderNo
import kotlinx.android.synthetic.main.taxi_debug_order.view.orderPreLoadLines
@@ -126,6 +128,16 @@ public class DebugView @JvmOverloads constructor(
DateTimeUtil.yyyy_MM_dd_HH_mm_ss
)
}
private fun formatDateTimeString(timeMillis: Long): String {
if (timeMillis <= 0L) {
return ""
}
return DateTimeUtil.formatCalendarToString(
DateTimeUtil.formatLongToCalendar(timeMillis),
DateTimeUtil.yyyy_MM_dd_HH_mm_ss
)
}
}
private val broadcastReceiver = object : BroadcastReceiver() {
@@ -198,6 +210,7 @@ public class DebugView @JvmOverloads constructor(
initCurrentBusinessMode()
initViewByTaskData(TaxiTaskModel.getCurrentTaskWithOrder())
initDebugLogTextViewTitle()
initLastTaskDataQuerySuccess(0L)
}
private fun initCurrentBusinessMode() {
@@ -207,11 +220,16 @@ public class DebugView @JvmOverloads constructor(
"当前业务模式:${if (isRoutingVerifyMode) "自主算路验证模式" else "无人化运营流程模式"}"
}
private fun initLastTaskDataQuerySuccess(timeMillis: Long) {
lastQuerySuccessDataTimestamps.text =
"【最新数据查询成功时间】${formatDateTimeString(timeMillis)}"
}
private fun initViewByTaskData(data: QueryCurrentTaskRespBean.Result?) {
//release包下隐藏Mock按钮避免司机误操作
btnContainer.visibility = if (AppUtils.isAppDebug()) View.VISIBLE else View.INVISIBLE
val curContrail = TaxiTaskModel.getCurrentTaskTrajectory()
currentDataTimestamps.text = "【当前数据返回时间】${currentDateTimeString()}"
currentDataTimestamps.text = "【当前数据更新时间】${currentDateTimeString()}"
currentCarStatus.text =
"【当前车辆状态】${data?.servingStatus} --> ${if (data?.servingStatus == 1) "开始接单" else "暂停接单"}"
currentTaskType.text =
@@ -233,10 +251,12 @@ public class DebugView @JvmOverloads constructor(
"【订单终点】${data?.order?.orderEndSite?.siteName} siteId=${data?.order?.orderEndSite?.siteId}"
orderPreLoadLines.text =
"【接驾任务预加载lineIds】${GsonUtil.jsonFromObject(data?.order?.planningLines)}"
currentOrderTrajectoryTime.text =
"【当前任务轨迹保存时间】contrailSaveTime=${formatDateTimeString(curContrail?.contrailSaveTime ?: 0L)} , contrailSaveTimeDPQP=${formatDateTimeString(curContrail?.contrailSaveTimeDPQP ?: 0L)}"
currentOrderTrajectoryInfo.text =
"【当前任务Traj信息】TrajMd5=${curContrail?.csvFileMd5} , TrajDPQPMd5=${curContrail?.csvFileMd5DPQP}"
"【当前任务轨迹Traj信息】TrajMd5=${curContrail?.csvFileMd5} , TrajDPQPMd5=${curContrail?.csvFileMd5DPQP}"
currentOrderStopInfo.text =
"【当前任务Stop信息】StopMd5=${curContrail?.txtFileMd5}, StopDPQPMd5=${curContrail?.txtFileMd5DPQP}"
"【当前任务轨迹Stop信息】StopMd5=${curContrail?.txtFileMd5}, StopDPQPMd5=${curContrail?.txtFileMd5DPQP}"
}
private fun initDebugLogTextViewTitle() {
@@ -246,6 +266,10 @@ public class DebugView @JvmOverloads constructor(
if (isRoutingVerifyMode) "自主算路验证模式关键节点日志(司机端)" else "无人化运营流程关键节点日志(司机端)"
}
override fun onTaskWithOrderQuerySuccess(timeMillis: Long) {
initLastTaskDataQuerySuccess(timeMillis)
}
override fun onTaskWithOrderDataChanged(taskWithOrder: QueryCurrentTaskRespBean.Result?) {
d(TAG, "onTaskWithOrderDataChanged")
initViewByTaskData(taskWithOrder)

View File

@@ -232,6 +232,9 @@ class TaxiCurrentTaskViewModel : BaseViewModel<UnmannedState, TaskUiIntent>(),
}
}
override fun onTaskWithOrderQuerySuccess(timeMillis: Long) {
}
override fun onTaskWithOrderDataChanged(result: QueryCurrentTaskRespBean.Result?) {
d(TAG, "onTaskWithOrderChanged = result = " + GsonUtil.jsonFromObject(result))
DebugView.printInfoMsg("[查询TaskWithOrder信息] 更新数据, 刷新UI")

View File

@@ -466,7 +466,7 @@ object TaxiTaskModel {
startFailedCode: String,
startFailedMessage: String
) {
DebugView.printInfoMsg("[启自驾] 执行失败code=$startFailedCode, msg=$startFailedMessage")
DebugView.printErrorMsg("[启自驾] 执行失败code=$startFailedCode, msg=$startFailedMessage")
TaxiAnalyticsManager.getInstance()
.triggerStartAutopilotFailureEventByAdas(startFailedCode, startFailedMessage)
if (mADASStatusCallback != null && !FunctionBuildConfig.isDemoMode) {
@@ -723,6 +723,12 @@ object TaxiTaskModel {
object : OchCommonServiceCallback<QueryCurrentTaskRespBean> {
override fun onSuccess(data: QueryCurrentTaskRespBean?) {
//DebugView.printInfoMsg("[查询TaskWithOrder信息] success")
val currentTimeStamp = System.currentTimeMillis()
mTaxiTaskWithOrderCallbackMap.forEach {
val listener = it.value
listener.onTaskWithOrderQuerySuccess(currentTimeStamp)
}
if (data?.data == null) {
d(
TAG,

View File

@@ -17,7 +17,7 @@
android:id="@+id/unmanedTaskOrderContainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10">
android:layout_marginTop="@dimen/dp_5">
<LinearLayout
android:id="@+id/btnContainer"
@@ -97,11 +97,18 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_5"
android:text="车辆当前任务&amp;订单信息"
android:textColor="@android:color/white"
android:textSize="@dimen/dp_24" />
<TextView
android:id="@+id/lastQuerySuccessDataTimestamps"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
android:textSize="@dimen/dp_24" />
<TextView
android:id="@+id/currentDataTimestamps"
android:layout_width="wrap_content"
@@ -156,6 +163,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
android:visibility="gone"
android:textSize="@dimen/dp_24" />
<TextView
@@ -193,6 +201,13 @@
android:textColor="@android:color/white"
android:textSize="@dimen/dp_24" />
<TextView
android:id="@+id/currentOrderTrajectoryTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
android:textSize="@dimen/dp_24" />
<TextView
android:id="@+id/currentOrderTrajectoryInfo"
android:layout_width="wrap_content"
@@ -213,7 +228,7 @@
android:id="@+id/debugLogTitleTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_5"
android:text="无人化运营流程关键节点日志(司机端)"
android:textColor="@android:color/white"
android:textSize="@dimen/dp_24" />