From 72a27c6e78850dcaade9be8b04d567a8ae2835a8 Mon Sep 17 00:00:00 2001 From: yangyakun Date: Wed, 25 Sep 2024 11:17:21 +0800 Subject: [PATCH 01/17] =?UTF-8?q?[6.6.1]=20[fix]=20[=E4=BF=AE=E5=A4=8D=20s?= =?UTF-8?q?ession=20=E8=B6=85=E6=97=B6=E6=9C=AA=E6=B8=85=E7=90=86]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../autopilot/OchAutoPilotManager.kt | 40 +++++++++++----- .../autopilot/OchAutopilotAnalytics.kt | 48 +++++++++++-------- .../autopilot/bean/SessionWithTime.kt | 3 ++ 3 files changed, 61 insertions(+), 30 deletions(-) create mode 100644 OCH/common/common/src/main/java/com/mogo/och/common/module/manager/autopilot/autopilot/bean/SessionWithTime.kt diff --git a/OCH/common/common/src/main/java/com/mogo/och/common/module/manager/autopilot/autopilot/OchAutoPilotManager.kt b/OCH/common/common/src/main/java/com/mogo/och/common/module/manager/autopilot/autopilot/OchAutoPilotManager.kt index 0cfb8c4f7f..3aa3f95b19 100644 --- a/OCH/common/common/src/main/java/com/mogo/och/common/module/manager/autopilot/autopilot/OchAutoPilotManager.kt +++ b/OCH/common/common/src/main/java/com/mogo/och/common/module/manager/autopilot/autopilot/OchAutoPilotManager.kt @@ -14,19 +14,22 @@ import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.utilcode.util.ToastUtils import com.mogo.och.common.module.manager.autopilot.OCHAdasAbilityManager +import com.mogo.och.common.module.manager.autopilot.autopilot.bean.SessionWithTime import com.mogo.och.common.module.manager.autopilot.line.LineManager import com.mogo.och.common.module.manager.distance.TrajectoryAndDistanceManager +import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager import com.zhjt.mogo.adas.common.MessageType import com.zhjt.mogo.adas.data.bean.ReceivedAck import com.zhjt.mogo.adas.data.bean.ReceivedAck.Status import fsm.Fsm2024 import java.util.concurrent.atomic.AtomicLong +import java.util.concurrent.atomic.AtomicReference object OchAutoPilotManager : IMoGoReceiveReceivedAckListener, IMoGoFsm2024Listener { const val TAG = "OchAutoPilotManager" - private val globalSessionId = AtomicLong(-1) + private val globalSessionId = AtomicReference() private val fsmBackSessionId = AtomicLong(-1L) init { @@ -51,18 +54,27 @@ object OchAutoPilotManager : IMoGoReceiveReceivedAckListener, IMoGoFsm2024Listen * 启动自驾中禁止再次启动自驾 */ @JvmStatic - fun canStartAutopilotBySessionId():Boolean{ - return (globalSessionId.get()==-1L).apply { - if(!this) { + fun canStartAutopilotBySessionId(): Boolean { + val sessionInfo = globalSessionId.get() + val currentTimeMillis = System.currentTimeMillis() + if(sessionInfo==null){ + return true + }else{ + if(currentTimeMillis-sessionInfo.setTime>=OchAutopilotAnalytics.LOOP_PERIOD_16S){ + clearGlobalSessionId("检测session 自带的时间 ${currentTimeMillis}_${sessionInfo.setTime}_${sessionInfo.sessionId}") + return true + }else{ ToastUtils.showLong("自驾启动中,请勿重复点击") OchAutopilotAnalytics.triggerCanStartAutopilotBySessionId(globalSessionId.get()) + return false } } } @JvmStatic fun canStartAutopilotBySessionIdInner():Boolean{ - return (globalSessionId.get()==-1L) + OchChainLogManager.writeChainLogAutopilot("自驾流程","清理SessiongId") + return (globalSessionId.get()==null) } @JvmStatic @@ -88,14 +100,15 @@ object OchAutoPilotManager : IMoGoReceiveReceivedAckListener, IMoGoFsm2024Listen return true } - fun clearGlobalSessionId(){ - globalSessionId.set(-1) + fun clearGlobalSessionId(log:String){ + OchChainLogManager.writeChainLogAutopilot("自驾流程","清理SessiongId${globalSessionId}_${fsmBackSessionId}_${log}") + globalSessionId.set(null) } @JvmStatic fun startAutoPilot(controlParameters: AutopilotControlParameters?): Long { val sessionId = CallerAutoPilotControlManager.startAutoPilot(controlParameters) - globalSessionId.set(sessionId) + globalSessionId.set(SessionWithTime(sessionId,System.currentTimeMillis())) fsmBackSessionId.set(-1L) OchAutopilotAnalytics.triggerStartAutopilotParameters(controlParameters, sessionId) return sessionId @@ -120,9 +133,14 @@ object OchAutoPilotManager : IMoGoReceiveReceivedAckListener, IMoGoFsm2024Listen * 启动自驾失败切 FSM返回的Session和启动SessionId 不同 */ fun checkStartSessionAndFailSessionId(){ - if(globalSessionId.get() != fsmBackSessionId.get()){ - OchAutopilotAnalytics.triggerStartAutopilotFailCheckSessionDiff(globalSessionId.get(), - fsmBackSessionId.get()) + val sessionInfo = globalSessionId.get() + if(sessionInfo!=null) { + if (sessionInfo.sessionId != fsmBackSessionId.get()) { + OchAutopilotAnalytics.triggerStartAutopilotFailCheckSessionDiff( + sessionInfo, + fsmBackSessionId.get() + ) + } } } } \ No newline at end of file diff --git a/OCH/common/common/src/main/java/com/mogo/och/common/module/manager/autopilot/autopilot/OchAutopilotAnalytics.kt b/OCH/common/common/src/main/java/com/mogo/och/common/module/manager/autopilot/autopilot/OchAutopilotAnalytics.kt index e1a4591ad8..8e18aedf1b 100644 --- a/OCH/common/common/src/main/java/com/mogo/och/common/module/manager/autopilot/autopilot/OchAutopilotAnalytics.kt +++ b/OCH/common/common/src/main/java/com/mogo/och/common/module/manager/autopilot/autopilot/OchAutopilotAnalytics.kt @@ -11,8 +11,11 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant import com.mogo.eagle.core.utilcode.util.DateTimeUtils import com.mogo.och.common.module.manager.autopilot.OCHAdasAbilityManager +import com.mogo.och.common.module.manager.autopilot.autopilot.bean.SessionWithTime import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager import com.mogo.och.common.module.manager.loop.BizLoopManager +import com.mogo.och.common.module.utils.RxUtils +import io.reactivex.disposables.Disposable object OchAutopilotAnalytics { @@ -49,6 +52,7 @@ object OchAutopilotAnalytics { private const val EVENT_PARAM_VEHICLE_START_AUTOPILOT_CMD_SESSION_ID_FSM_RETURN = "cmd_session_id_fsm_return" private val LOOP_PERIOD_15S = 15 * 1000L + val LOOP_PERIOD_16S = 16 * 1000L private var mStartAutopilotKey: String? = null @@ -94,34 +98,36 @@ object OchAutopilotAnalytics { /** * 等待底盘返回的间隙 重复启动自驾 */ - fun triggerCanStartAutopilotBySessionId(globalSessionId : Long){ + fun triggerCanStartAutopilotBySessionId(globalSessionId : SessionWithTime){ val map = hashMapOf() map[EVENT_PARAM_AUTOPILOTANALYTICS_GROUP] = EVENT_PARAM_AUTOPILOTANALYTICS_GROUP - OchChainLogManager.writeChainLog("启动自驾Session判断","已有globalSessionId:${globalSessionId}", eventID = EVENT_KEY_VEHICLE_START_AUTOPILOT_CMD_SESSION_DUPLICATED, patch = map) + OchChainLogManager.writeChainLog("启动自驾Session判断","已有globalSessionId:${globalSessionId.sessionId}_创建时间:${globalSessionId.setTime}", eventID = EVENT_KEY_VEHICLE_START_AUTOPILOT_CMD_SESSION_DUPLICATED, patch = map) } /** * 启动失败后 对比两个session是否相同 */ - fun triggerStartAutopilotFailCheckSessionDiff(globalSessionId: Long, fsmBackSessionId: Long){ + fun triggerStartAutopilotFailCheckSessionDiff(globalSessionId: SessionWithTime, fsmBackSessionId: Long){ val map = hashMapOf() map[EVENT_PARAM_AUTOPILOTANALYTICS_GROUP] = EVENT_PARAM_AUTOPILOTANALYTICS_GROUP - map[EVENT_PARAM_VEHICLE_START_AUTOPILOT_CMD_SESSION_ID_START] = globalSessionId + map[EVENT_PARAM_VEHICLE_START_AUTOPILOT_CMD_SESSION_ID_START] = "${globalSessionId.sessionId}_${globalSessionId.setTime}" map[EVENT_PARAM_VEHICLE_START_AUTOPILOT_CMD_SESSION_ID_FSM_RETURN] = fsmBackSessionId OchChainLogManager.writeChainLog("启动自驾失败且SessionId不同","globalSessionId:${globalSessionId}——————fsmBackSessionId:${fsmBackSessionId}", eventID = EVENT_KEY_VEHICLE_START_AUTOPILOT_CMD_SESSION_DIFF, patch = map) } - - private val timeOutRunnable = Runnable { - // 15s内未开启,上报失败埋点 - triggerStartAutopilotFailureEvent("", "15s后app等待超时", System.currentTimeMillis()) - } + private var timeOutDisposable: Disposable?=null /** * 底盘明确告知启动自驾失败 */ fun triggerStartAutopilotFailureEventByAdas(failCode: String, failMsg: String, startFailDate: Long) { - BizLoopManager.removeCallback(timeOutRunnable) + OchChainLogManager.writeChainLogAutopilot("自驾流程","启动自驾失败回调${failCode}_${failMsg}") + if(OchAutoPilotManager.canStartAutopilotBySessionIdInner()){ + CallerLogger.e(SceneConstant.M_OCHCOMMON + "triggerStartAutopilotFailureEvent canStartAutopilotBySessionIdInner == false") + OchChainLogManager.writeChainLogAutopilot("自驾流程","异常情况 启动自驾失败回调${failCode}_${failMsg}_sessiong为空") + return + } + RxUtils.disposeSubscribe(timeOutDisposable) // 判断Session 是否相同 OchAutoPilotManager.checkStartSessionAndFailSessionId() triggerStartAutopilotFailureEvent(failCode, failMsg, startFailDate) @@ -132,12 +138,10 @@ object OchAutopilotAnalytics { } private fun triggerStartAutopilotFailureEvent(failCode: String, failMsg: String, startFailDate: Long) { - if(OchAutoPilotManager.canStartAutopilotBySessionIdInner()){ - CallerLogger.e(SceneConstant.M_OCHCOMMON + "triggerStartAutopilotFailureEvent canStartAutopilotBySessionIdInner == false") + OchAutoPilotManager.clearGlobalSessionId("$failMsg _ ${failCode}") + if (mStartAutopilotParams.isEmpty()) { return } - OchAutoPilotManager.clearGlobalSessionId() - if (mStartAutopilotParams.isEmpty()) return CallerLogger.e(SceneConstant.M_OCHCOMMON + "triggerStartAutopilotFailureEvent", failMsg) if (CallerAutoPilotStatusListenerManager.getState() != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) { mStartAutopilotParams[EVENT_PARAM_START_FAILURE_CODE] = failCode @@ -170,15 +174,19 @@ object OchAutopilotAnalytics { triggerDate: Long, source:Int = 0 ) { + OchChainLogManager.writeChainLogAutopilot("自驾流程","send:${send}_${restart}_${startName}_${endName}_${lineId}_${orderId}_${source}_${triggerDate}") mStartAutopilotKey = if (restart) getEventKeyRestartService() else getEventKeyStartService() if (send) { if(OchAutoPilotManager.canStartAutopilotBySessionIdInner()){ CallerLogger.e(SceneConstant.M_OCHCOMMON + "triggerStartAutopilotEvent canStartAutopilotBySessionIdInner == false") + OchChainLogManager.writeChainLogAutopilot("自驾流程","异常情况 启动自驾成功_sessiong为空") + return + } + OchAutoPilotManager.clearGlobalSessionId("启动自驾成功") + RxUtils.disposeSubscribe(timeOutDisposable) + if (mStartAutopilotParams.isEmpty()) { return } - OchAutoPilotManager.clearGlobalSessionId() - BizLoopManager.removeCallback(timeOutRunnable) - if (mStartAutopilotParams.isEmpty()) return // 开启成功,上报埋点 mStartAutopilotParams[EVENT_PARAM_START_FAILURE_CODE] = "" mStartAutopilotParams[EVENT_PARAM_START_FAILURE_MSG] = "" @@ -198,8 +206,10 @@ object OchAutopilotAnalytics { mStartAutopilotParams[EVENT_PARAM_END_NAME] = endName mStartAutopilotParams[EVENT_PARAM_LINE_ID] = lineId mStartAutopilotParams[EVENT_PARAM_ORDER_NUMBER] = orderId?:"" - BizLoopManager.removeCallback(timeOutRunnable) - BizLoopManager.postDelayed(timeOutRunnable,LOOP_PERIOD_15S) + RxUtils.disposeSubscribe(timeOutDisposable) + timeOutDisposable = RxUtils.createSubscribe(LOOP_PERIOD_15S) { + triggerStartAutopilotFailureEvent("", "15s后app等待超时", System.currentTimeMillis()) + } } } diff --git a/OCH/common/common/src/main/java/com/mogo/och/common/module/manager/autopilot/autopilot/bean/SessionWithTime.kt b/OCH/common/common/src/main/java/com/mogo/och/common/module/manager/autopilot/autopilot/bean/SessionWithTime.kt new file mode 100644 index 0000000000..7a3e97167f --- /dev/null +++ b/OCH/common/common/src/main/java/com/mogo/och/common/module/manager/autopilot/autopilot/bean/SessionWithTime.kt @@ -0,0 +1,3 @@ +package com.mogo.och.common.module.manager.autopilot.autopilot.bean + +data class SessionWithTime(val sessionId:Long,val setTime:Long) From 4ae9ea79e96fca405f24c24456af1bc511e25738 Mon Sep 17 00:00:00 2001 From: donghongyu-pc Date: Wed, 25 Sep 2024 14:14:48 +0800 Subject: [PATCH 02/17] =?UTF-8?q?[6.6.1]=20[Fix]=201=E3=80=81=E5=8D=87?= =?UTF-8?q?=E7=BA=A7Ai=20SDK=E5=88=B01.4.7.41=20-=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E7=BD=91=E7=BB=9C=E8=AF=B7=E6=B1=82=E8=B6=85=E6=97=B6=E6=97=B6?= =?UTF-8?q?=E9=97=B4=20const=20val=20READ=5FTIMEOUT=20=3D=2010000L=20const?= =?UTF-8?q?=20val=20WRITE=5FTIMEOUT=20=3D=2010000L=20-=20=E5=8D=87?= =?UTF-8?q?=E7=BA=A7retrofit=E7=89=88=E6=9C=AC=E5=88=B02.6.4=20-=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0OkHttp=E7=BA=BF=E7=A8=8B=E6=B1=A0=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gradle.properties | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/gradle.properties b/gradle.properties index c6bc8a5c1e..c269ad894a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -64,21 +64,21 @@ bytex.ASM_API=ASM7 LOGLIB_VERSION=1.10.18 ######## MogoAiCloudSDK Version ######## # 网络请求LOGLIB_VERSION -MOGO_NETWORK_VERSION=1.4.7.38 +MOGO_NETWORK_VERSION=1.4.7.41 # 鉴权 -MOGO_PASSPORT_VERSION=1.4.7.38 +MOGO_PASSPORT_VERSION=1.4.7.41 # 长链接 -MOGO_SOCKET_VERSION=1.4.7.38 +MOGO_SOCKET_VERSION=1.4.7.41 # 数据采集 -MOGO_REALTIME_VERSION=1.4.7.38 +MOGO_REALTIME_VERSION=1.4.7.41 # 直播推流 -MOGO_LIVE_VERSION=1.4.7.38 +MOGO_LIVE_VERSION=1.4.7.41 # 直播拉流 -MOGO_TRAFFICLIVE_VERSION=1.4.7.38 +MOGO_TRAFFICLIVE_VERSION=1.4.7.41 # 定位服务 -MOGO_LOCATION_VERSION=1.4.7.38 +MOGO_LOCATION_VERSION=1.4.7.41 # 远程通讯模块 -MOGO_TELEMATIC_VERSION=1.4.7.38 +MOGO_TELEMATIC_VERSION=1.4.7.41 ######## MogoAiCloudSDK Version ######## # 自研地图 MAP_SDK_VERSION=3.4.0.6 From eb8f3fac2b901017e2600ed9aab7a2b5e3bb07f2 Mon Sep 17 00:00:00 2001 From: donghongyu-pc Date: Wed, 25 Sep 2024 15:43:39 +0800 Subject: [PATCH 03/17] =?UTF-8?q?[6.6.1]=20[Fix]=201=E3=80=81=E5=8D=87?= =?UTF-8?q?=E7=BA=A7Ai=20SDK=E5=88=B01.4.7.42=20-=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E7=BD=91=E7=BB=9C=E8=AF=B7=E6=B1=82=E8=B6=85=E6=97=B6=E6=97=B6?= =?UTF-8?q?=E9=97=B4=20const=20val=20READ=5FTIMEOUT=20=3D=2010000L=20const?= =?UTF-8?q?=20val=20WRITE=5FTIMEOUT=20=3D=2010000L=20-=20=E5=8D=87?= =?UTF-8?q?=E7=BA=A7retrofit=E7=89=88=E6=9C=AC=E5=88=B02.6.4=20-=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0OkHttp=E7=BA=BF=E7=A8=8B=E6=B1=A0=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gradle.properties | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/gradle.properties b/gradle.properties index c269ad894a..c4f3054837 100644 --- a/gradle.properties +++ b/gradle.properties @@ -64,21 +64,21 @@ bytex.ASM_API=ASM7 LOGLIB_VERSION=1.10.18 ######## MogoAiCloudSDK Version ######## # 网络请求LOGLIB_VERSION -MOGO_NETWORK_VERSION=1.4.7.41 +MOGO_NETWORK_VERSION=1.4.7.42 # 鉴权 -MOGO_PASSPORT_VERSION=1.4.7.41 +MOGO_PASSPORT_VERSION=1.4.7.42 # 长链接 -MOGO_SOCKET_VERSION=1.4.7.41 +MOGO_SOCKET_VERSION=1.4.7.42 # 数据采集 -MOGO_REALTIME_VERSION=1.4.7.41 +MOGO_REALTIME_VERSION=1.4.7.42 # 直播推流 -MOGO_LIVE_VERSION=1.4.7.41 +MOGO_LIVE_VERSION=1.4.7.42 # 直播拉流 -MOGO_TRAFFICLIVE_VERSION=1.4.7.41 +MOGO_TRAFFICLIVE_VERSION=1.4.7.42 # 定位服务 -MOGO_LOCATION_VERSION=1.4.7.41 +MOGO_LOCATION_VERSION=1.4.7.42 # 远程通讯模块 -MOGO_TELEMATIC_VERSION=1.4.7.41 +MOGO_TELEMATIC_VERSION=1.4.7.42 ######## MogoAiCloudSDK Version ######## # 自研地图 MAP_SDK_VERSION=3.4.0.6 From 889f3a7724ffb97093d09c27e8ead707240ae458 Mon Sep 17 00:00:00 2001 From: donghongyu-pc Date: Wed, 25 Sep 2024 15:49:54 +0800 Subject: [PATCH 04/17] =?UTF-8?q?[6.6.1]=20[Fix]=201=E3=80=81=E5=8D=87?= =?UTF-8?q?=E7=BA=A7=E5=BA=94=E7=94=A8=E7=89=88=E6=9C=AC=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gradle.properties | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gradle.properties b/gradle.properties index c4f3054837..3c3272f49c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -90,8 +90,8 @@ WEBSOCKET_VERSION=1.1.7 applicationId=com.mogo.launcer applicationName=IntelligentPilot # RoboBus司机端:2.5.1;RoboTaxi司机端:2.5.1;RoboTaxi乘客端:1.0.0 -versionCode=6006000 -versionName=6.6.0 +versionCode=6006001 +versionName=6.6.1 ################# 新架构模块Maven版本管理 ################# MOGO_CORE_FUNCTION_HMI_VERSION=0.0.58.10 @@ -149,7 +149,7 @@ MATRIX_VERSION=2.0.8 # 公交模式司机端版本号 -DRIVER_VERSION=6.6.0 +DRIVER_VERSION=6.6.1 # 公交模式乘客端端版本号 -PASSENGER_VERSION=5.6.0 +PASSENGER_VERSION=5.6.1 From 2e2365c9e806be08f7cd031b25f649c08ffd484d Mon Sep 17 00:00:00 2001 From: xuxinchao Date: Thu, 26 Sep 2024 20:04:15 +0800 Subject: [PATCH 05/17] =?UTF-8?q?[6.6.1]IndexOutOfBoundsException=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../workorder/adapter/TakeOverListAdapter.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/workorder/adapter/TakeOverListAdapter.kt b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/workorder/adapter/TakeOverListAdapter.kt index 887ea182e8..46b76449c1 100644 --- a/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/workorder/adapter/TakeOverListAdapter.kt +++ b/core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/workorder/adapter/TakeOverListAdapter.kt @@ -47,7 +47,7 @@ class TakeOverListAdapter(private val context: Context): RecyclerView.Adapter Date: Thu, 26 Sep 2024 20:21:51 +0800 Subject: [PATCH 06/17] [6.6.1]java.lang.reflect.GenericSignatureFormatError catch --- .../core/MogoTrafficLightManager.kt | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/trafficlight/core/MogoTrafficLightManager.kt b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/trafficlight/core/MogoTrafficLightManager.kt index ccb92729d1..992862e93d 100644 --- a/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/trafficlight/core/MogoTrafficLightManager.kt +++ b/core/function-impl/mogo-core-function-biz/src/main/java/com/mogo/eagle/function/biz/v2x/trafficlight/core/MogoTrafficLightManager.kt @@ -23,6 +23,7 @@ import com.mogo.eagle.function.biz.v2x.trafficlight.core.TrafficLightThreadHandl import com.mogo.eagle.function.biz.v2x.trafficlight.core.TrafficLightThreadHandler.Companion.MSG_WHAT_STOP_SEARCH_TRAFFIC_LIGHT import com.mogo.eagle.function.biz.v2x.trafficlight.network.TrafficLightNetWorkModel import com.zhidaoauto.map.data.road.RoadCross +import java.lang.Exception class MogoTrafficLightManager : IMoGoChassisLocationGCJ02Listener, IMoGoMapRoadListener { @@ -70,15 +71,17 @@ class MogoTrafficLightManager : IMoGoChassisLocationGCJ02Listener, } // CallerLogger.i("$M_BIZ$TAG", "红绿灯路口请求 : $stopLineDis") mLocation?.let { it -> - trafficLightNetWorkModel.requestRoadID( - it.latitude, it.longitude, it.heading, - { - mThreadHandler?.sendEmptyMessage(MSG_WHAT_STOP_SEARCH_CROSS_ROAD) - roadIDResult = it - }, - { - //CallerLogger.w(M_V2X + TAG, "request road id error : $it") - }) + try { + trafficLightNetWorkModel.requestRoadID( + it.latitude, it.longitude, it.heading, + { + mThreadHandler?.sendEmptyMessage(MSG_WHAT_STOP_SEARCH_CROSS_ROAD) + roadIDResult = it + }, + { + //CallerLogger.w(M_V2X + TAG, "request road id error : $it") + }) + }catch (_: Exception){} } }, { //stop loop search road id From bdfdacb3cecfd3cf8e69bda2aff27d5969227662 Mon Sep 17 00:00:00 2001 From: renwj Date: Wed, 18 Sep 2024 11:26:01 +0800 Subject: [PATCH 07/17] =?UTF-8?q?[6.6.2][=E8=A7=86=E8=A7=92=E5=8F=98?= =?UTF-8?q?=E6=8D=A2]=20=E4=BC=98=E5=8C=96=E8=A7=86=E8=A7=92=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../eagle/core/function/angle/scenes/CrossRoad.kt | 5 +++-- .../mogo/eagle/core/function/angle/scenes/Default.kt | 12 +++++++++--- .../eagle/core/function/angle/scenes/LongSight.kt | 10 ++++++++++ .../eagle/core/function/angle/scenes/RoadEvent.kt | 8 ++++++++ .../mogo/eagle/core/function/angle/scenes/Roma.kt | 10 ++++++++++ .../mogo/eagle/core/function/api/map/angle/Scenes.kt | 4 ++-- 6 files changed, 42 insertions(+), 7 deletions(-) diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/angle/scenes/CrossRoad.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/angle/scenes/CrossRoad.kt index e74451a697..af3b7f4fd7 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/angle/scenes/CrossRoad.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/angle/scenes/CrossRoad.kt @@ -24,7 +24,7 @@ class CrossRoad(private val delayTime: Long = 0, unit: TimeUnit = TimeUnit.SECON } override fun isCanTouch(): Boolean { - return false + return AppIdentityModeUtils.isB2(FunctionBuildConfig.appIdentityMode) && AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode) } override fun isCanSwitch(): Boolean { @@ -38,7 +38,8 @@ class CrossRoad(private val delayTime: Long = 0, unit: TimeUnit = TimeUnit.SECON override fun getScreenToOriginDis(): ScreenToOriginDis { if (AppIdentityModeUtils.isB2(FunctionBuildConfig.appIdentityMode) && AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) { return NONE + } else { + return DOWN } - return DOWN } } diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/angle/scenes/Default.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/angle/scenes/Default.kt index 524e5fb898..cd5d3c443a 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/angle/scenes/Default.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/angle/scenes/Default.kt @@ -3,6 +3,7 @@ package com.mogo.eagle.core.function.angle.scenes import android.util.Log import com.mogo.eagle.core.data.config.FunctionBuildConfig import com.mogo.eagle.core.function.api.map.angle.Scene +import com.mogo.eagle.core.function.api.map.angle.ScreenToOriginDis import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils import com.mogo.map.uicontroller.VisualAngleMode @@ -15,9 +16,7 @@ import java.util.concurrent.TimeUnit class Default(val delayTime: Long = 0, val unit: TimeUnit = TimeUnit.SECONDS, val forceClosePrev: Boolean = false): Scene(delayTime, unit) { override fun getVisualAngleMode(): VisualAngleMode { - Log.d("Default", "---- 1 --------------") - if (AppIdentityModeUtils.isB2(FunctionBuildConfig.appIdentityMode) && AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) { - Log.d("Default", "---- 2 --------------") + if (AppIdentityModeUtils.isB2(FunctionBuildConfig.appIdentityMode) && AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) { return VisualAngleMode.MAP_STYLE_VR_ERHAI_B2 } return CallerMapUIServiceManager.getMapUIController()?.getVrAngleDefaultMode() ?: MODE_MEDIUM_SIGHT @@ -26,4 +25,11 @@ class Default(val delayTime: Long = 0, val unit: TimeUnit = TimeUnit.SECONDS, va override fun toString(): String { return "Default(delay=${getDelay()}, unit=$unit, angle=${getVisualAngleMode()}, priority=${getPriority()}, closePrevious=$forceClosePrev)" } + + override fun getScreenToOriginDis(): ScreenToOriginDis { + if (AppIdentityModeUtils.isB2(FunctionBuildConfig.appIdentityMode) && AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) { + return ScreenToOriginDis.NONE + } + return ScreenToOriginDis.DEFAULT + } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/angle/scenes/LongSight.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/angle/scenes/LongSight.kt index 3189dcd1e7..14a8a81126 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/angle/scenes/LongSight.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/angle/scenes/LongSight.kt @@ -1,6 +1,9 @@ package com.mogo.eagle.core.function.angle.scenes +import com.mogo.eagle.core.data.config.FunctionBuildConfig import com.mogo.eagle.core.function.api.map.angle.Scene +import com.mogo.eagle.core.function.api.map.angle.ScreenToOriginDis +import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils import com.mogo.map.uicontroller.VisualAngleMode import com.mogo.map.uicontroller.VisualAngleMode.MODE_LONG_SIGHT import java.util.concurrent.TimeUnit @@ -14,4 +17,11 @@ class LongSight(private val delayTime: Long = 0, private val unit: TimeUnit = Ti override fun toString(): String { return "LongSight(delayTime=${delayTime}, priority=${getPriority()}, displayThreshold: ${getDisplayThreshold()}, priority=${getPriority()})" } + + override fun getScreenToOriginDis(): ScreenToOriginDis { + if (AppIdentityModeUtils.isB2(FunctionBuildConfig.appIdentityMode) && AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) { + return ScreenToOriginDis.NONE + } + return ScreenToOriginDis.DEFAULT + } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/angle/scenes/RoadEvent.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/angle/scenes/RoadEvent.kt index b2b97f9b79..2a91f20d6b 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/angle/scenes/RoadEvent.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/angle/scenes/RoadEvent.kt @@ -2,6 +2,7 @@ package com.mogo.eagle.core.function.angle.scenes import com.mogo.eagle.core.data.config.FunctionBuildConfig import com.mogo.eagle.core.function.api.map.angle.Scene +import com.mogo.eagle.core.function.api.map.angle.ScreenToOriginDis import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils import com.mogo.map.uicontroller.VisualAngleMode @@ -24,4 +25,11 @@ class RoadEvent(delayTime: Long, unit: TimeUnit): Scene(delayTime, unit) { override fun toString(): String { return "RoadEvent(mode: ${getVisualAngleMode()}, priority=${getPriority()}, displayThreshold: ${getDisplayThreshold()}," } + + override fun getScreenToOriginDis(): ScreenToOriginDis { + if (AppIdentityModeUtils.isB2(FunctionBuildConfig.appIdentityMode) && AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) { + return ScreenToOriginDis.NONE + } + return ScreenToOriginDis.DEFAULT + } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/angle/scenes/Roma.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/angle/scenes/Roma.kt index 640d5bf2eb..67b8ede09e 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/angle/scenes/Roma.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/angle/scenes/Roma.kt @@ -1,6 +1,9 @@ package com.mogo.eagle.core.function.angle.scenes +import com.mogo.eagle.core.data.config.FunctionBuildConfig import com.mogo.eagle.core.function.api.map.angle.Scene +import com.mogo.eagle.core.function.api.map.angle.ScreenToOriginDis +import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils import com.mogo.map.uicontroller.VisualAngleMode import com.mogo.map.uicontroller.VisualAngleMode.MAP_STYLE_VR_ROMA import java.util.concurrent.TimeUnit @@ -25,4 +28,11 @@ class Roma(val delayTime: Long = 2, val unit: TimeUnit = TimeUnit.SECONDS): Scen override fun getPriority(): Int { return 1 } + + override fun getScreenToOriginDis(): ScreenToOriginDis { + if (AppIdentityModeUtils.isB2(FunctionBuildConfig.appIdentityMode) && AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) { + return ScreenToOriginDis.NONE + } + return ScreenToOriginDis.DEFAULT + } } \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/map/angle/Scenes.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/map/angle/Scenes.kt index 7398ca28a4..53e38d5dac 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/map/angle/Scenes.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/map/angle/Scenes.kt @@ -1,6 +1,6 @@ package com.mogo.eagle.core.function.api.map.angle -import com.mogo.eagle.core.function.api.map.angle.ScreenToOriginDis.DEFAULT +import com.mogo.eagle.core.function.api.map.angle.ScreenToOriginDis.NONE import com.mogo.map.uicontroller.* import java.util.concurrent.TimeUnit @@ -58,6 +58,6 @@ abstract class Scene(private val delay: Long, private val unit: TimeUnit = TimeU * 3. [ScreenToOriginDis.UP]: 偏上 * 4. [ScreenToOriginDis.DOWN]: 偏下 */ - open fun getScreenToOriginDis(): ScreenToOriginDis = DEFAULT + open fun getScreenToOriginDis(): ScreenToOriginDis = NONE } From 52b72a8b53b60a39ce4c14e4a4dcc25e2b1ab2c8 Mon Sep 17 00:00:00 2001 From: donghongyu-pc Date: Sun, 29 Sep 2024 12:09:15 +0800 Subject: [PATCH 08/17] =?UTF-8?q?[6.6.1]=20[Update]=201=E3=80=81=E5=9B=A0?= =?UTF-8?q?=E4=B8=BAjenkins=E7=9A=84=E7=89=88=E6=9C=AC=E7=94=9F=E6=88=90?= =?UTF-8?q?=E8=A7=84=E5=88=99=E5=AF=BC=E8=87=B4=E5=8E=9F=E6=9D=A5=E7=9A=84?= =?UTF-8?q?660=E7=89=88=E6=9C=AC=E5=8F=B7=E5=B7=B2=E7=BB=8F=E5=A4=A7?= =?UTF-8?q?=E4=BA=8E661=E7=94=9F=E6=88=90=E7=9A=84=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8F=B7=E4=BA=86=EF=BC=8C=E6=89=80=E4=BB=A5=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=E5=BA=94=E7=94=A8=E7=89=88=E6=9C=AC=E5=8F=B76.6.2=E6=9D=A5?= =?UTF-8?q?=E8=A7=A3=E5=86=B3=E8=BF=99=E4=B8=AA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 3c3272f49c..7a05cf35f6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -149,7 +149,7 @@ MATRIX_VERSION=2.0.8 # 公交模式司机端版本号 -DRIVER_VERSION=6.6.1 +DRIVER_VERSION=6.6.2 # 公交模式乘客端端版本号 -PASSENGER_VERSION=5.6.1 +PASSENGER_VERSION=5.6.2 From ae96ca32309790fcb0d2d2879018e277e6dd4d63 Mon Sep 17 00:00:00 2001 From: donghongyu-pc Date: Sun, 29 Sep 2024 13:19:51 +0800 Subject: [PATCH 09/17] =?UTF-8?q?[6.6.1]=20[Update]=201=E3=80=81=E5=9B=A0?= =?UTF-8?q?=E4=B8=BAjenkins=E7=9A=84=E7=89=88=E6=9C=AC=E7=94=9F=E6=88=90?= =?UTF-8?q?=E8=A7=84=E5=88=99=E5=AF=BC=E8=87=B4=E5=8E=9F=E6=9D=A5=E7=9A=84?= =?UTF-8?q?660=E7=89=88=E6=9C=AC=E5=8F=B7=E5=B7=B2=E7=BB=8F=E5=A4=A7?= =?UTF-8?q?=E4=BA=8E661=E7=94=9F=E6=88=90=E7=9A=84=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8F=B7=E4=BA=86=EF=BC=8C=E6=89=80=E4=BB=A5=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=E5=BA=94=E7=94=A8=E7=89=88=E6=9C=AC=E5=8F=B76.6.3=E6=9D=A5?= =?UTF-8?q?=E8=A7=A3=E5=86=B3=E8=BF=99=E4=B8=AA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 7a05cf35f6..a156c104ff 100644 --- a/gradle.properties +++ b/gradle.properties @@ -149,7 +149,7 @@ MATRIX_VERSION=2.0.8 # 公交模式司机端版本号 -DRIVER_VERSION=6.6.2 +DRIVER_VERSION=6.6.3 # 公交模式乘客端端版本号 -PASSENGER_VERSION=5.6.2 +PASSENGER_VERSION=5.6.3 From 5d11c14ecae78b04d6ec4c8b231f29e301eace2d Mon Sep 17 00:00:00 2001 From: aibingbing Date: Fri, 11 Oct 2024 18:27:42 +0800 Subject: [PATCH 10/17] =?UTF-8?q?[6.7.0][=E6=95=B0=E6=8D=AE=E4=B8=8A?= =?UTF-8?q?=E8=BD=A6]=20refactor:=20B2=E4=B9=98=E5=AE=A2=E7=AB=AF=E9=80=9A?= =?UTF-8?q?=E7=94=A8=E4=BA=8B=E4=BB=B6=E5=BC=B9=E6=A1=86=20UI=20=E8=B5=B0?= =?UTF-8?q?=E6=9F=A5=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/function/hmi/ui/v2n/RoadV2NEventWindowView.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/v2n/RoadV2NEventWindowView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/v2n/RoadV2NEventWindowView.kt index 2bf68e4695..207f5bb072 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/v2n/RoadV2NEventWindowView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/v2n/RoadV2NEventWindowView.kt @@ -294,17 +294,17 @@ class RoadV2NEventWindowView @JvmOverloads constructor( TypedValue.COMPLEX_UNIT_PX, AutoSizeUtils.dp2px(context, 28f).toFloat() ) - tvV2XHintContent.setTypeface(null, Typeface.NORMAL) + tvV2XHintContent.setTypeface(null, Typeface.BOLD) tvV2XHintContent.setPadding(0, 0, 0, AutoSizeUtils.dp2px(context, 28f)) val containerImageAndLiveVideoLayoutParams = containerImageAndLiveVideo.layoutParams as ConstraintLayout.LayoutParams containerImageAndLiveVideoLayoutParams.width = - AutoSizeUtils.dp2px(context, 350f + 18f * (350f / 480f)) //乘客屏视频加载里面背景切图包含了白边 + AutoSizeUtils.dp2px(context, 350f) //乘客屏视频加载里面背景切图包含了白边 containerImageAndLiveVideoLayoutParams.height = AutoSizeUtils.dp2px(context, 197f) containerImageAndLiveVideoLayoutParams.setMargins( AutoSizeUtils.dp2px(context, 20f), - AutoSizeUtils.dp2px(context, 23f - 14f * (54f / 69f)), //乘客屏icon ivV2XImage带了白边 + AutoSizeUtils.dp2px(context, 23.3f - 14f * (54f / 69f)), //乘客屏icon ivV2XImage带了白边 AutoSizeUtils.dp2px(context, 20f), 0 ) From 85097386559b9624270b1c01e84f61e24818df75 Mon Sep 17 00:00:00 2001 From: EmArrow Date: Fri, 11 Oct 2024 19:36:46 +0800 Subject: [PATCH 11/17] [6.7.0] ui change --- .../src/main/res/layout/view_map_container.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_map_container.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_map_container.xml index 1aa00feff6..cdc78adcc2 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_map_container.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_map_container.xml @@ -149,7 +149,7 @@ android:layout_height="wrap_content" android:layout_marginTop="@dimen/dp_39" android:layout_marginEnd="@dimen/dp_23" - android:visibility="gone" + android:visibility="visible" android:focusable="false" android:focusableInTouchMode="false" app:layout_constraintRight_toRightOf="parent" @@ -158,11 +158,11 @@ Date: Fri, 11 Oct 2024 19:38:06 +0800 Subject: [PATCH 12/17] [6.7.0] ui --- .../src/main/res/layout/view_map_container.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_map_container.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_map_container.xml index cdc78adcc2..66f88e0add 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_map_container.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_map_container.xml @@ -149,7 +149,7 @@ android:layout_height="wrap_content" android:layout_marginTop="@dimen/dp_39" android:layout_marginEnd="@dimen/dp_23" - android:visibility="visible" + android:visibility="gone" android:focusable="false" android:focusableInTouchMode="false" app:layout_constraintRight_toRightOf="parent" @@ -162,7 +162,7 @@ android:layout_height="@dimen/dp_790" android:layout_marginTop="@dimen/dp_39" android:layout_marginEnd="@dimen/dp_24" - android:visibility="visible" + android:visibility="gone" android:focusable="false" android:focusableInTouchMode="false" app:layout_constraintRight_toRightOf="parent" From 335afebcb4acde080c25657af5b218927ab68bb5 Mon Sep 17 00:00:00 2001 From: chenfufeng Date: Sat, 12 Oct 2024 12:00:14 +0800 Subject: [PATCH 13/17] =?UTF-8?q?[6.7.0][Fix]=E8=A7=A3=E5=86=B3=E5=B0=8F?= =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E5=92=8C=E8=A1=8C=E7=A8=8B=E6=80=BB=E8=A7=88?= =?UTF-8?q?=E5=9C=B0=E5=9B=BEUI=E6=98=BE=E7=A4=BA=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/mogo/eagle/core/function/view/TravelRealityView.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/TravelRealityView.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/TravelRealityView.kt index c4ed7c4598..cad739a6db 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/TravelRealityView.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/TravelRealityView.kt @@ -1420,9 +1420,15 @@ class TravelRealityView @JvmOverloads constructor( if (isSmallMap) { if (globalPath.wayPointsList.size > 0) { this.globalPathResp = globalPath + val pointCloneList = ArrayList() + globalPath.wayPointsList.forEach { loc -> + pointCloneList.add(Point(loc.longitude, loc.latitude)) + } + reqData = pointCloneList drawRotting() } } else { + this.globalPathResp = globalPath val pointList = ArrayList() val pointCloneList = ArrayList() globalPath.wayPointsList.forEach { loc -> From ecb9925c69e27bea24f0c4ceec46a43821bfc03e Mon Sep 17 00:00:00 2001 From: aibingbing Date: Sat, 12 Oct 2024 15:11:46 +0800 Subject: [PATCH 14/17] =?UTF-8?q?[6.7.0][=E5=B7=A5=E5=85=B7=E7=AE=B1]=20fi?= =?UTF-8?q?x:=20=E6=BC=AB=E6=B8=B8=20=E7=82=B9=E5=87=BB=E4=B8=8D=E7=94=9F?= =?UTF-8?q?=E6=95=88=E9=97=AE=E9=A2=98=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../function/hmi/bone/toolkit/custom/ToolDriverRomaView.kt | 3 ++- .../src/main/res/layout/view_tool_driver_roma.xml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/toolkit/custom/ToolDriverRomaView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/toolkit/custom/ToolDriverRomaView.kt index 8f69e31e74..fece3e38b4 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/toolkit/custom/ToolDriverRomaView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/bone/toolkit/custom/ToolDriverRomaView.kt @@ -15,6 +15,7 @@ import com.mogo.eagle.core.utilcode.util.ClickUtils import com.mogo.eagle.core.utilcode.util.ThreadUtils import com.mogo.eagle.core.utilcode.util.ToastUtils import kotlinx.android.synthetic.main.view_tool_driver_roma.view.ivRomaView +import kotlinx.android.synthetic.main.view_tool_driver_roma.view.toolDriverRomaContainer class ToolDriverRomaView @JvmOverloads constructor( context: Context, @@ -41,7 +42,7 @@ class ToolDriverRomaView @JvmOverloads constructor( 0 ) - setOnClickListener { + toolDriverRomaContainer.setOnClickListener { if (ClickUtils.isClickTooFrequent(this, 2500)) { ToastUtils.showShort("不要频繁点击哦~") return@setOnClickListener diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_tool_driver_roma.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_tool_driver_roma.xml index 24338356e1..75ce81ba4b 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_tool_driver_roma.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_tool_driver_roma.xml @@ -1,7 +1,7 @@ From 05b86f677d5406e4a688c2ca50cdf4de731636ef Mon Sep 17 00:00:00 2001 From: yangyakun Date: Sat, 12 Oct 2024 15:34:38 +0800 Subject: [PATCH 15/17] =?UTF-8?q?[6.7.0]=20[fix]=20[=E5=88=B0=E7=AB=99?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E4=BF=AE=E6=94=B9]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mogo/och/weaknet/repository/impl/ShuttleSaasRepository.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/repository/impl/ShuttleSaasRepository.kt b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/repository/impl/ShuttleSaasRepository.kt index b4e1c233ef..cc61dfaf56 100644 --- a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/repository/impl/ShuttleSaasRepository.kt +++ b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/repository/impl/ShuttleSaasRepository.kt @@ -219,8 +219,8 @@ class ShuttleSaasRepository : IRepository { EventDb.saveEventTaskArriveSite( task.taskId!!, task.lineId!!, - start.siteId.toLong(), - start.seq, + end.siteId.toLong(), + end.seq, task.taskStartTime, lineInfo.lineName ) From 3b9061a2165205dc26dd5d0eb0ec2a1c9473101f Mon Sep 17 00:00:00 2001 From: yangyakun Date: Sat, 12 Oct 2024 16:18:44 +0800 Subject: [PATCH 16/17] =?UTF-8?q?[6.7.0]=20[fea]=20[=E5=BD=93=E5=89=8D?= =?UTF-8?q?=E7=9B=B8=E4=B9=98=20=E8=99=9A=E6=8B=9F=E5=8D=95=E5=B1=95?= =?UTF-8?q?=E7=A4=BA]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/module/wigets/CommonSlideView.kt | 2 +- .../module/wigets/autopilot/AutopilotState.kt | 10 +- .../wigets/autopilot/AutopilotStateModel.kt | 6 +- .../module/wigets/commonview/EmptyView.kt | 55 ++ .../wigets/map/orderstatus/OrderStatusView.kt | 22 +- .../map/orderstatus/OrderStatusViewModel.kt | 2 + .../common/src/main/res/values/attrs.xml | 4 + .../och/unmanned/taxi/ui/base/TaxiFragment.kt | 23 +- .../och/unmanned/taxi/ui/debug/DebugView.kt | 6 +- .../TaxiOperationalDialogFragment.kt | 3 +- .../unmanned/taxi/ui/task/TaxiTaskModel.kt | 16 +- .../itinerarycurrent/ItineraryCurrentModel.kt | 486 ++++++++++- .../itinerarycurrent/ItineraryCurrentView.kt | 767 +++++++++++++++++- .../taxi/wigets/TaxiSelectViewGroup.kt | 2 +- .../res/layout/unmanned_itinerary_current.xml | 203 ++++- .../res/layout/unmanned_switch_itinerary.xml | 6 +- .../layout/unmanned_taxi_base_fragment.xml | 9 + .../main/res/layout/unmanned_taxi_panel.xml | 7 - .../src/main/res/values/colors.xml | 1 + 19 files changed, 1550 insertions(+), 80 deletions(-) create mode 100644 OCH/common/common/src/main/java/com/mogo/och/common/module/wigets/commonview/EmptyView.kt diff --git a/OCH/common/common/src/main/java/com/mogo/och/common/module/wigets/CommonSlideView.kt b/OCH/common/common/src/main/java/com/mogo/och/common/module/wigets/CommonSlideView.kt index 69e257067f..1b4ea64f73 100644 --- a/OCH/common/common/src/main/java/com/mogo/och/common/module/wigets/CommonSlideView.kt +++ b/OCH/common/common/src/main/java/com/mogo/och/common/module/wigets/CommonSlideView.kt @@ -130,7 +130,7 @@ class CommonSlideView @JvmOverloads constructor( if(isVisible){ lottie_bg.setAnimation("slide.json") lottie_bg.playAnimation() - draggableButton.setTextColor(ResourcesUtils.getColor(R.color.white)) + draggableButton.setTextColor(context.getColor(R.color.white)) ObjectAnimator.ofFloat( draggableButton, "translationX", draggableButton.translationX, 0f diff --git a/OCH/common/common/src/main/java/com/mogo/och/common/module/wigets/autopilot/AutopilotState.kt b/OCH/common/common/src/main/java/com/mogo/och/common/module/wigets/autopilot/AutopilotState.kt index 762db267ba..1ae3d57c97 100644 --- a/OCH/common/common/src/main/java/com/mogo/och/common/module/wigets/autopilot/AutopilotState.kt +++ b/OCH/common/common/src/main/java/com/mogo/och/common/module/wigets/autopilot/AutopilotState.kt @@ -50,11 +50,11 @@ class AutopilotState @JvmOverloads constructor( autopilotLoadingAnimator = ObjectAnimator.ofFloat(aciv_autopilot_state, "rotation", 0f, 360f); autopilotLoadingAnimator.interpolator = LinearInterpolator() autopilotLoadingAnimator.repeatCount = -1 //无限循环 - autopilotLoadingAnimator.duration = 1000 //无限循环 + autopilotLoadingAnimator.duration = 2000 //无限循环 autopilotChangeStateAnimator = ObjectAnimator.ofFloat(aciv_autopilot_state, "alpha", 1f, 0f,1f); autopilotChangeStateAnimator.interpolator = LinearInterpolator() - autopilotChangeStateAnimator.duration = 200 + autopilotChangeStateAnimator.duration = 300 onClick { startAutopilot() } @@ -127,7 +127,7 @@ class AutopilotState @JvmOverloads constructor( override fun inAutopilot() { CallerLogger.d(TAG,"展示自驾中UI") - updateImageInAnimator(R.drawable.common_autopilot_starting_new) + updateImageInAnimator(R.drawable.common_autopilot_running) actv_pxjs_state.visibility = GONE actv_autopilot_head.visibility = VISIBLE @@ -225,7 +225,7 @@ class AutopilotState @JvmOverloads constructor( actv_pxjs_state.setTextColor(ResourcesUtils.getColor(R.color.common_19FFCB)) AutopilotState@this.isEnabled = false - aciv_autopilot_running_ani.visibility = VISIBLE + aciv_autopilot_running_ani.visibility = GONE autopilotStateAnimator?.stop() autopilotLoadingAnimator.cancel() autopilotChangeStateAnimator.start() @@ -234,7 +234,7 @@ class AutopilotState @JvmOverloads constructor( private fun updateImageInAnimator(@DrawableRes resource:Int){ UiThreadHandler.postDelayed({ aciv_autopilot_state.setImageResource(resource) - },100,UiThreadHandler.MODE.QUEUE) + },150,UiThreadHandler.MODE.QUEUE) } } \ No newline at end of file diff --git a/OCH/common/common/src/main/java/com/mogo/och/common/module/wigets/autopilot/AutopilotStateModel.kt b/OCH/common/common/src/main/java/com/mogo/och/common/module/wigets/autopilot/AutopilotStateModel.kt index 79b15bf807..f23f021a51 100644 --- a/OCH/common/common/src/main/java/com/mogo/och/common/module/wigets/autopilot/AutopilotStateModel.kt +++ b/OCH/common/common/src/main/java/com/mogo/och/common/module/wigets/autopilot/AutopilotStateModel.kt @@ -12,6 +12,7 @@ import com.mogo.och.common.module.manager.autopilot.line.ILineCallback import com.mogo.och.common.module.manager.autopilot.line.LineManager import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager import com.mogo.och.common.module.manager.loop.BizLoopManager +import com.mogo.och.common.module.utils.RxUtils import java.util.concurrent.atomic.AtomicBoolean /** @@ -126,6 +127,9 @@ class AutopilotStateModel : ViewModel(), IOchAutopilotStatusListener, ILineCall OchChainLogManager.writeChainLog("自驾信息","启动自驾") if(AutopilotStateDebug.debugStatus){ startAutopilotSuccess() + RxUtils.createSubscribe(5_000) { + startAutopilotFail() + } }else { LineManager.startAutopilot() } @@ -159,7 +163,7 @@ class AutopilotStateModel : ViewModel(), IOchAutopilotStatusListener, ILineCall this.isPalyStartAni.set(false) UiThreadHandler.postDelayed({ autopilotStateChange() - },1000,UiThreadHandler.MODE.QUEUE) + },3000,UiThreadHandler.MODE.QUEUE) } } diff --git a/OCH/common/common/src/main/java/com/mogo/och/common/module/wigets/commonview/EmptyView.kt b/OCH/common/common/src/main/java/com/mogo/och/common/module/wigets/commonview/EmptyView.kt new file mode 100644 index 0000000000..66252b9b03 --- /dev/null +++ b/OCH/common/common/src/main/java/com/mogo/och/common/module/wigets/commonview/EmptyView.kt @@ -0,0 +1,55 @@ +package com.mogo.och.common.module.wigets.commonview + +import android.content.Context +import android.util.AttributeSet +import android.view.LayoutInflater +import androidx.constraintlayout.widget.ConstraintLayout +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger +import com.mogo.map.listener.IMogoMapListener +import com.mogo.och.common.module.R +import com.mogo.och.common.module.utils.ResourcesUtils +import kotlinx.android.synthetic.main.common_empty_view.view.no_order_data_tv + +class EmptyView @JvmOverloads constructor( + context: Context, + attrs: AttributeSet? = null, + defStyleAttr: Int = 0 +) : ConstraintLayout(context, attrs, defStyleAttr),IMogoMapListener { + companion object { + const val TAG = "LoadingMapStatusView" + } + + private var emptyTitle:String = "" + + + init { + LayoutInflater.from(context).inflate(R.layout.common_empty_view, this, true) + try { + val typedArray = context.obtainStyledAttributes(attrs, R.styleable.EmptyView) + emptyTitle = typedArray.getString(R.styleable.EmptyView_empty_title)?:ResourcesUtils.getString(R.string.common_empty_data) + typedArray.recycle() + } catch (e: Exception) { + e.printStackTrace() + } + no_order_data_tv.text = emptyTitle + } + + override fun onAttachedToWindow() { + super.onAttachedToWindow() + CallerLogger.d(TAG,"onAttachedToWindow") + + } + + override fun onVisibilityAggregated(isVisible: Boolean) { + super.onVisibilityAggregated(isVisible) + + } + + override fun onDetachedFromWindow() { + super.onDetachedFromWindow() + CallerLogger.d(TAG,"onDetachedFromWindow") + } + + + +} \ No newline at end of file diff --git a/OCH/common/common/src/main/java/com/mogo/och/common/module/wigets/map/orderstatus/OrderStatusView.kt b/OCH/common/common/src/main/java/com/mogo/och/common/module/wigets/map/orderstatus/OrderStatusView.kt index a7e1eb3083..9b2258896e 100644 --- a/OCH/common/common/src/main/java/com/mogo/och/common/module/wigets/map/orderstatus/OrderStatusView.kt +++ b/OCH/common/common/src/main/java/com/mogo/och/common/module/wigets/map/orderstatus/OrderStatusView.kt @@ -54,16 +54,18 @@ class OrderStatusView : RelativeLayout, OrderStatusViewModel.IVisualCallback { override fun setImageViewResource(name: Int,ordering:Boolean) { iv_order_status.setImageResource(name) - if (iv_order_status.layoutParams is RelativeLayout.LayoutParams) { - val temp = iv_order_status.layoutParams as RelativeLayout.LayoutParams - temp.removeRule(RelativeLayout.ALIGN_PARENT_START) - temp.addRule(ALIGN_PARENT_END) - iv_order_status.layoutParams = temp - }else{ - val temp = iv_order_status.layoutParams as RelativeLayout.LayoutParams - temp.removeRule(RelativeLayout.ALIGN_PARENT_END) - temp.addRule(ALIGN_PARENT_START) - iv_order_status.layoutParams = temp + if (iv_order_status.layoutParams is LayoutParams) { + if(ordering){ + val temp = iv_order_status.layoutParams as LayoutParams + temp.removeRule(ALIGN_PARENT_START) + temp.addRule(ALIGN_PARENT_END) + iv_order_status.layoutParams = temp + }else{ + val temp = iv_order_status.layoutParams as LayoutParams + temp.removeRule(ALIGN_PARENT_END) + temp.addRule(ALIGN_PARENT_START) + iv_order_status.layoutParams = temp + } } } diff --git a/OCH/common/common/src/main/java/com/mogo/och/common/module/wigets/map/orderstatus/OrderStatusViewModel.kt b/OCH/common/common/src/main/java/com/mogo/och/common/module/wigets/map/orderstatus/OrderStatusViewModel.kt index 82f4b26dfe..ae2f82b5fd 100644 --- a/OCH/common/common/src/main/java/com/mogo/och/common/module/wigets/map/orderstatus/OrderStatusViewModel.kt +++ b/OCH/common/common/src/main/java/com/mogo/och/common/module/wigets/map/orderstatus/OrderStatusViewModel.kt @@ -2,6 +2,7 @@ package com.mogo.och.common.module.wigets.map.orderstatus import androidx.annotation.DrawableRes import androidx.lifecycle.ViewModel +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger import com.mogo.eagle.core.utilcode.util.UiThreadHandler import com.mogo.och.common.module.R import com.mogo.och.common.module.biz.login.ILoginCallback @@ -30,6 +31,7 @@ class OrderStatusViewModel : ViewModel(), ILoginCallback { } override fun onOpenOrderStatusEnumChange(businessEnum: OpenOrderStatusEnum?) { + CallerLogger.d(TAG,"新的接单状态${businessEnum}") UiThreadHandler.post({ if (LoginStatusManager.isOpenOrderType()) { this.viewCallback?.setImageViewResource(R.drawable.common_order_status,true) diff --git a/OCH/common/common/src/main/res/values/attrs.xml b/OCH/common/common/src/main/res/values/attrs.xml index 31323f4270..ab122895b6 100644 --- a/OCH/common/common/src/main/res/values/attrs.xml +++ b/OCH/common/common/src/main/res/values/attrs.xml @@ -14,6 +14,10 @@ + + + + diff --git a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/base/TaxiFragment.kt b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/base/TaxiFragment.kt index 980ff8fb45..dbca0cc86f 100644 --- a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/base/TaxiFragment.kt +++ b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/base/TaxiFragment.kt @@ -40,8 +40,8 @@ import com.mogo.och.unmanned.taxi.ui.task.TaxiTaskTabFragment import com.mogo.och.unmanned.taxi.utils.TPRouteDataTestUtils import kotlinx.android.synthetic.main.unmanned_taxi_base_fragment.unmannedMapCL import kotlinx.android.synthetic.main.unmanned_taxi_base_fragment.module_mogo_och_navi_panel_container +import kotlinx.android.synthetic.main.unmanned_taxi_base_fragment.orderDebugView import kotlinx.android.synthetic.main.unmanned_taxi_base_fragment.taxi_close_navi_icon -import kotlinx.android.synthetic.main.unmanned_taxi_panel.orderDebugView import java.lang.ref.WeakReference /** @@ -64,8 +64,6 @@ class TaxiFragment :MvpFragment(), private val lineView = "LINEVIEW" private var personalDialogFragment: WeakReference? = null - private var taskTabFragment: WeakReference? = null - private fun updateOperationBtnStatusOnModeChange(isRoutingVerifyMode: Boolean) { if (MogoStatusManager.getInstance().isTaxiUnmanedDriverTakingOrders) { @@ -175,11 +173,6 @@ class TaxiFragment :MvpFragment(), unmannedMapCL.onPause() } - fun onChangeOperationStatus() { - if (null == taskTabFragment || taskTabFragment!!.get() == null) return - taskTabFragment!!.get()!!.onCarTakeOrderStatusChanged() - } - override fun onLowMemory() { super.onLowMemory() unmannedMapCL.onLowMemory() @@ -273,15 +266,6 @@ class TaxiFragment :MvpFragment(), } - /** - * 获取站点面板view,在[.initViews]时候添加到container中 - * - * @return 站点面板view - */ - fun getStationPanelViewId(): Int { - return R.layout.unmanned_taxi_panel - } - /** * 重新开启自动驾驶 */ @@ -419,8 +403,9 @@ class TaxiFragment :MvpFragment(), if (MogoStatusManager.getInstance().isTaxiUnmanedDriverLineRoutingVerifyMode) { showAmapNaviToStationFragment(isShow) } else { - if (null == taskTabFragment || taskTabFragment!!.get() == null) return - taskTabFragment!!.get()!!.onNaviToEndStationByAMap(isShow) + // TODO: 需要复原 +// if (null == taskTabFragment || taskTabFragment!!.get() == null) return +// taskTabFragment!!.get()!!.onNaviToEndStationByAMap(isShow) } } else if (isShow) { //使用routing数据 showRoutingToStationFragment(true) diff --git a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/debug/DebugView.kt b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/debug/DebugView.kt index 6cd50de673..66579ebe65 100644 --- a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/debug/DebugView.kt +++ b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/debug/DebugView.kt @@ -22,6 +22,7 @@ import com.mogo.commons.module.status.StatusDescriptor import com.mogo.commons.utils.MogoAnalyticUtils import com.mogo.eagle.core.function.main.MainMoGoApplication import com.mogo.eagle.core.network.utils.GsonUtil +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.util.AppUtils import com.mogo.eagle.core.utilcode.util.UiThreadHandler @@ -74,16 +75,19 @@ public class DebugView @JvmOverloads constructor( private var logHistoryTextView: TextView? = null fun printInfoMsg(msg: String) { + CallerLogger.i(TAG,msg) printMsg("Info $msg", MainMoGoApplication.getApp().getColor(R.color.background_info)) trackEvent("Info", msg) } fun printWarnMsg(msg: String) { + CallerLogger.w(TAG,msg) printMsg("Warn $msg", MainMoGoApplication.getApp().getColor(R.color.background_debug)) trackEvent("Warn", msg) } fun printErrorMsg(msg: String) { + CallerLogger.e(TAG,msg) printMsg("Error $msg", MainMoGoApplication.getApp().getColor(R.color.background_error)) trackEvent("Error", msg) } @@ -155,7 +159,7 @@ public class DebugView @JvmOverloads constructor( initBroadcastReceiver() LayoutInflater.from(context).inflate(R.layout.unmanned_taxi_debug_order, this, true) debugLogHistoryTextView.movementMethod = ScrollingMovementMethod.getInstance() - visibility = GONE + visibility = VISIBLE logHistoryTextView = debugLogHistoryTextView initView() diff --git a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/operational/TaxiOperationalDialogFragment.kt b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/operational/TaxiOperationalDialogFragment.kt index f7b40c9862..092926449b 100644 --- a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/operational/TaxiOperationalDialogFragment.kt +++ b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/operational/TaxiOperationalDialogFragment.kt @@ -26,7 +26,6 @@ import com.mogo.och.unmanned.taxi.bean.QueryServingDurationRespBean import com.mogo.och.unmanned.taxi.bean.QueryTaskRespBean import com.mogo.och.unmanned.taxi.constant.StationTypeEnum import com.mogo.och.unmanned.taxi.constant.TaskTypeEnum -import com.mogo.och.unmanned.taxi.ui.task.TaxiCurrentTaskFragment import kotlinx.android.synthetic.main.unmanned_taxi_operational_data_view.dayCompletedOrdersView import kotlinx.android.synthetic.main.unmanned_taxi_operational_data_view.dayTotalOrdersView import kotlinx.android.synthetic.main.unmanned_taxi_operational_data_view.itemDayTv @@ -115,7 +114,7 @@ class TaxiOperationalDialogFragment : DialogFragment(), lifecycleScope.launchWhenStarted { mViewModel.uiStateFlow.map { it.operationalDataUIState }.collect { operationalDataUIState -> - d(TaxiCurrentTaskFragment.TAG, "uiStateFlow-initViewModelObserver: $operationalDataUIState") + d(TAG, "uiStateFlow-initViewModelObserver: $operationalDataUIState") when (operationalDataUIState) { is OperationalDataStateUIState.Init -> { } diff --git a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/TaxiTaskModel.kt b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/TaxiTaskModel.kt index 45372c123c..83f27f04c6 100644 --- a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/TaxiTaskModel.kt +++ b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/TaxiTaskModel.kt @@ -276,14 +276,14 @@ object TaxiTaskModel { private val mMogoAutopilotStatusListener: IOchAutopilotStatusListener = object : IOchAutopilotStatusListener { override fun onAutopilotIpcConnectStatusChanged(status: AdasConstants.IpcConnectionStatus, reason: String?) { - DebugView.printInfoMsg( - "[域控连接状态变化] status=$status, reason=${ - if (TextUtils.isEmpty( - reason - ) - ) "" else reason - }" - ) +// DebugView.printInfoMsg( +// "[域控连接状态变化] status=$status, reason=${ +// if (TextUtils.isEmpty( +// reason +// ) +// ) "" else reason +// }" +// ) } override fun onAutopilotGuardian(guardianInfo: MogoReportMessage?, lineId: Long) { diff --git a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/itinerarycurrent/ItineraryCurrentModel.kt b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/itinerarycurrent/ItineraryCurrentModel.kt index c79a16007a..b843c773be 100644 --- a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/itinerarycurrent/ItineraryCurrentModel.kt +++ b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/itinerarycurrent/ItineraryCurrentModel.kt @@ -1,27 +1,505 @@ package com.mogo.och.unmanned.taxi.ui.itinerarycurrent 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.data.config.FunctionBuildConfig +import com.mogo.eagle.core.data.map.MogoLocation +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.unmanned.CallerUnmannedListenerManager +import com.mogo.eagle.core.network.utils.GsonUtil +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.util.NetworkUtils +import com.mogo.eagle.core.utilcode.util.ToastUtils +import com.mogo.eagle.core.utilcode.util.UiThreadHandler +import com.mogo.och.common.module.biz.order.TaxiOrderStatusEnum +import com.mogo.och.common.module.manager.autopilot.line.LineManager +import com.mogo.och.common.module.manager.autopilot.location.OchLocationManager +import com.mogo.och.common.module.manager.distance.TrajectoryAndDistanceManager +import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager +import com.mogo.och.common.module.network.OchCommonServiceCallback +import com.mogo.och.common.module.utils.ToastUtilsOch +import com.mogo.och.common.module.voice.VoiceNotice +import com.mogo.och.unmanned.taxi.R +import com.mogo.och.unmanned.taxi.base.BaseViewModel +import com.mogo.och.unmanned.taxi.base.IUiIntent +import com.mogo.och.unmanned.taxi.bean.QueryCurrentTaskRespBean import com.mogo.och.unmanned.taxi.bean.StartGrayAndQueryContrailRsp +import com.mogo.och.unmanned.taxi.bean.StartServiceRespBean +import com.mogo.och.unmanned.taxi.bean.TrajectoryListRespBean +import com.mogo.och.unmanned.taxi.callback.ITaxiCarServiceCallback +import com.mogo.och.unmanned.taxi.callback.ITaxiTaskWithOrderCallback +import com.mogo.och.unmanned.taxi.constant.TaskStatusEnum +import com.mogo.och.unmanned.taxi.constant.TaskTypeEnum +import com.mogo.och.unmanned.taxi.constant.TaxiUnmannedConst +import com.mogo.och.unmanned.taxi.network.TaxiTaskWithOrderServiceManager +import com.mogo.och.unmanned.taxi.ui.debug.DebugView +import com.mogo.och.unmanned.taxi.ui.task.TaskUiIntent +import com.mogo.och.unmanned.taxi.ui.task.TaskWithOrderUIState +import com.mogo.och.unmanned.taxi.ui.task.TaxiTaskModel +import com.mogo.och.unmanned.taxi.ui.task.UnmannedState +import com.mogo.och.unmanned.taxi.utils.TaxiTrajectoryManager /** * @author XuXinChao * @description BadCase录包管理页面 * @since: 2022/12/15 */ -class ItineraryCurrentModel : ViewModel() { +class ItineraryCurrentModel : BaseViewModel(), + ITaxiTaskWithOrderCallback, ITaxiCarServiceCallback { private val TAG = ItineraryCurrentModel::class.java.simpleName + init { + TaxiTaskModel.addTaskWithOrderListener(TAG, this) + TaxiTaskModel.setCarServiceCallback(this) + } + private var viewCallback: SwtichLineViewCallback? = null + fun setDistanceCallback(viewCallback: SwtichLineViewCallback) { + this.viewCallback = viewCallback + } + + override fun onCleared() { - + TaxiTaskModel.removeTaskWithOrderListener(TAG) + TaxiTaskModel.removeCarServiceCallback() + super.onCleared() } - fun setDistanceCallback(viewCallback: SwtichLineViewCallback) { - this.viewCallback = viewCallback + override fun initUiState(): UnmannedState { + return UnmannedState(TaskWithOrderUIState.Init) + } + + override fun handleIntent(intent: IUiIntent) { + when (intent) { + is TaskUiIntent.StartTaskWithOrderLooper -> { //开始轮询 + startOrStopCurrentTaskWithOrderLoop(true) + } + + is TaskUiIntent.StartOrEndTakeOrder -> {//开始、暂停接单 + TaxiTaskModel.updateCarServingStatus() + } + + is TaskUiIntent.JumpPassengerCheck -> { //手动点击跳过乘客验证 + jumpPassengerCheck() + } + + is TaskUiIntent.JourneyCompleted -> { //点击服务完成 + journeyCompleted() + } + + is TaskUiIntent.CloseOrderByDriver -> { + closeOrderByDriver() + } + + is TaskUiIntent.CancelOrder -> {// 取消订单, 暂未加取消类型和原因 + cancelOrder(intent.type) + } + + is TaskUiIntent.StartTask -> { + startTask() + } + } + } + + fun startOrStopCurrentTaskWithOrderLoop(start: Boolean) { + d(TAG, "startOrStopCurrentTaskWithOrderLoop(): isStart=$start") + if (start) { + DebugView.printInfoMsg("[查询TaskWithOrder信息] start loop") + TaxiTaskModel.startQueryCurrentTaskWithOrderLoop() + } else { + DebugView.printInfoMsg("[查询TaskWithOrder信息] stop loop") + TaxiTaskModel.stopQueryCurrentTaskWithOrderLoop() + } + } + + private fun cancelOrder(cancelType: Int) { + val currentTaskWithOrder = TaxiTaskModel.getCurrentTaskWithOrder() + currentTaskWithOrder?.order?.also { + TaxiTaskModel.cancelOrder(it.orderNo, cancelType) + } + } + + private fun jumpPassengerCheck() { + DebugView.printInfoMsg("[跳过乘客验证] 准备发送请求") + val currentTaskWithOrder = TaxiTaskModel.getCurrentTaskWithOrder() + currentTaskWithOrder?.order?.also { + TaxiTaskWithOrderServiceManager.jumpPassengerCheck( + AbsMogoApplication.getApp().applicationContext, + it.orderNo, + object : OchCommonServiceCallback { + override fun onSuccess(data: BaseData?) { + DebugView.printInfoMsg("[跳过乘客验证] 请求success") + d(TAG, "jumpPassengerCheck onSuccess:") + } + + override fun onFail(code: Int, msg: String?) { + DebugView.printInfoMsg("[跳过乘客验证] 请求fail, code=$code, msg=$msg") + d(TAG, "jumpPassengerCheck onFail: code=$code, msg=$msg") + } + }) + } + } + + private fun journeyCompleted() { + DebugView.printInfoMsg("[服务完成] 准备发送请求") + val currentTaskWithOrder = TaxiTaskModel.getCurrentTaskWithOrder() + currentTaskWithOrder?.order?.also { + TaxiTaskWithOrderServiceManager.orderCompleted( + AbsMogoApplication.getApp().applicationContext, + it.orderNo, + object : OchCommonServiceCallback { + override fun onSuccess(data: BaseData?) { + DebugView.printInfoMsg("[服务完成] 请求success") + d(TAG, "journeyCompleted onSuccess") + } + + override fun onFail(code: Int, msg: String?) { + DebugView.printInfoMsg("[服务完成] 请求fail, code=$code, msg=$msg") + d(TAG, "journeyCompleted onFail: code=$code, msg=$msg") + } + }) + } + } + + private fun closeOrderByDriver() { + val currentTaskWithOrder = TaxiTaskModel.getCurrentTaskWithOrder() + currentTaskWithOrder?.order?.orderEndSite?.also { + TaxiTaskModel.submitArriveSite(it.siteId, true) + } + } + + private fun startTask(isStartAutopilot: Boolean = true) { + if (!TaxiTaskModel.checkCurrentTaskCondition()) { + ToastUtils.showShort("无任务!") + return + } + + TaxiTaskModel.getCurrentTaskWithOrder()?.let { + TaxiTaskModel.startTask( + if (it.order != null && it.order!!.orderStatus >= TaxiOrderStatusEnum.ArriveAtStart.code) + it.order!!.orderLine //当前若是启动的送驾任务 , 则使用订单信息的lineId + else + it.lineId + ,isStartAutopilot) + } + } + + private fun updateTaskAndOrderUi(currentTaskWithOrder: QueryCurrentTaskRespBean.Result?) { + d( + TAG, "updateTaskAndOrderUi: currentTaskWithOrder=${ + GsonUtil.getGson().toJson(currentTaskWithOrder) + }" + ) + sendUiState { + copy( + taskWithOrderUIState = TaskWithOrderUIState.TaskWithOrder( + currentTaskWithOrder + ) + ) + } + } + + private fun updatePrepareTaskDelayUI(delayTime: Long, isStart: Boolean) { + d(TAG, "UpdatePrepareTaskDelay120SUI = $isStart") + sendUiState { + copy( + taskWithOrderUIState = TaskWithOrderUIState.UpdatePrepareTaskDelay(delayTime, + isStart + ) + ) + } + } + + private fun updateDriveToNearestStationTaskUI(driveToNearestStationTask: StartServiceRespBean.Result?) { + d(TAG, "updateDriveToNearestStationTaskUI = ${driveToNearestStationTask?.toString()}") + sendUiState { + copy( + taskWithOrderUIState = TaskWithOrderUIState.TaskDriveToNearestStationTask( + driveToNearestStationTask + ) + ) + } + } + + private fun updateOrderTripInfoUI(mileage: Float, duration: Int) { + d(TAG, "updateOrderTripInfoUI") + OchChainLogManager.writeChainLog("到达目的地计算距离和时间", "距离:${mileage} 时间:${duration}") + sendUiState { + copy( + taskWithOrderUIState = TaskWithOrderUIState.UpdateOrderTripInfo( + mileage, duration + ) + ) + } + } + + private fun updateTaskTripInfoLocalCalculateUI(meters: Long, timeInSecond: Long) { + d(TAG, "UpdateTaskTripInfoLocalCalculateUI") + sendUiState { + copy( + taskWithOrderUIState = TaskWithOrderUIState.UpdateTaskTripLocalCalculateInfo( + meters, timeInSecond + ) + ) + } + } + + override fun onTaskWithOrderQuerySuccess(timeMillis: Long) { + } + + override fun onTaskWithOrderDataChanged(result: QueryCurrentTaskRespBean.Result?) { + d(TAG, "onTaskWithOrderChanged = result = " + GsonUtil.jsonFromObject(result)) + DebugView.printInfoMsg("[查询TaskWithOrder信息] 更新数据, 刷新UI") + updateTaskAndOrderUi(result) + // 设置task执行相关状态,切换模式时判断使用 + if (result == null || result.taskType == TaskTypeEnum.None.code) { + MogoStatusManager.getInstance().setTaxiUnmanedDriverPerformTask(TAG, false) + LineManager.setLineInfo(null); + } else { + MogoStatusManager.getInstance().setTaxiUnmanedDriverPerformTask(TAG, true) + } + } + + override fun onTaskStarted(result: QueryCurrentTaskRespBean.Result?) { + updateLocalCalculateStation(result) + if (result?.endSite != null){ + TaxiTaskModel.setBeautificationMode(true) + updateAutopilotControlParameters() + }else{ + clearDemoModeAndACParameters() + } + } + + private fun updateLocalCalculateStation(result: QueryCurrentTaskRespBean.Result?) { + if (result?.startSite != null && result.endSite != null + ) { + d(TAG, "updateLocalCalculateStation start") + val curTaskAndOrder = TaxiTaskModel.getCurrentTaskWithOrder() ?: return + if (curTaskAndOrder.startSite != null && curTaskAndOrder.endSite != null) { + val startStation = MogoLocation() + startStation.longitude = curTaskAndOrder.startSite!!.gcjLon + startStation.latitude = curTaskAndOrder.startSite!!.gcjLat + val endStation = MogoLocation() + endStation.longitude = curTaskAndOrder.endSite!!.gcjLon + endStation.latitude = curTaskAndOrder.endSite!!.gcjLat + TrajectoryAndDistanceManager.setStationPoint( + startStation, + endStation, + curTaskAndOrder.lineId + ) + } + } else { + TaxiTaskModel.clearLocalCalculateStation() + } + } + + /** + * 开始倒计时120s或者10s拉取任务 + * 演练任务120s拉取 + * 接驾任务10s拉取 + */ + override fun onTaskCompleted(result: QueryCurrentTaskRespBean.Result?) { + d(TAG, "onTaskCompleted: ${result?.currentStatus}, siteId=${result?.endSite?.siteId}") + + if (result?.order != null && result.servingStatus == 1){ + if (result.taskType <= TaskTypeEnum.VirtualTask.code + && result.order!!.orderStatus < TaxiOrderStatusEnum.ArriveAtStart.code) { + VoiceNotice.showNotice("已为您接到订单") + } + if (result.order!!.orderStatus == TaxiOrderStatusEnum.ArriveAtStart.code){ + VoiceNotice.showNotice("已到达上车地点,等待乘客上车") + } + } + + /** + * 1、有订单下(表示当前有订单或者未来有要执行的订单): + * 接驾任务需要立即拉取, 拉取时机在车辆前往上车点状态 + * 送驾任务需要立即拉取, 拉取时机在乘客已上车状态 + * 2、在没有订单情况下 + * 若当前到站的是前往标定站点, 则45s去拉取任务 + * 若当前是演练任务到站, 45s去拉取任务 + * 若当前是接驾任务到站, 此情况肯定是有订单的, 则走1 + * 若当前到站的是送驾任务, 不去拉取, 需等待司机点击服务完成按钮后拉取 + */ + + if (result?.order != null){ //接到订单情况下 + if (QueryCurrentTaskRespBean.isOrderOnTheWayToStart(result)){ //接驾任务拉取 + TaxiTaskModel.startPrepareTaskDelay( + TaxiUnmannedConst.START_PREPARE_TO_START_TASK_INTERVAL, + result?.endSite!!.siteId) + }else if (QueryCurrentTaskRespBean.isOrderUserArriveAtStart(result)) { //送驾任务拉取 + TaxiTaskModel.startPrepareTaskDelay(0, result?.endSite!!.siteId) + }else{ // 在已经接到订单的其他情况下, 取消倒计时任务拉取 + TaxiTaskModel.removePrepareTaskDelay() + } + }else{ //演练任务拉取 6.2.0使用配置的时间拉取, 默认45s + TaxiTaskModel.startPrepareTaskDelay( + CallerUnmannedListenerManager.getVirtualTaskPullTaskIntervalF() * 1000L, result?.endSite!!.siteId) + } + + clearDemoModeAndACParameters() + } + + override fun onTaskTrajectoryDataChanged(data: TrajectoryListRespBean?) { + TaxiTrajectoryManager.getInstance().syncTrajectoryInfo() //同步轨迹信息 + } + + override fun onOrderCancel() { + VoiceNotice.showNotice("已取消行程") + //取消自驾,D档位会溜车 map3.6.0 修改 + TaxiTaskModel.cancelAutopilot() + // 设置task执行相关状态,切换模式时判断使用 + MogoStatusManager.getInstance().setTaxiUnmanedDriverPerformTask(TAG, false) + LineManager.setLineInfo(null); + } + + override fun onOrderArriveAtEnd(orderNo: String) { + TaxiTaskModel.queryOrderByOrderNo(orderNo) + } + + /** + * 更新总全程信息(公里和分钟), 后端返回的数据 + */ + override fun onOrderTripInfoChanged(mileage: Float, duration: Int) { + updateOrderTripInfoUI(mileage, duration) + } + + override fun onOrderJourneyCompleted() { + updateTaskAndOrderUi(null) + //获取新的任务 + val currentTaskWithOrder = TaxiTaskModel.getCurrentTaskWithOrder() + currentTaskWithOrder?.endSite?.also {//使用配置的时间拉取, 默认是45s + TaxiTaskModel.startPrepareTaskDelay( + CallerUnmannedListenerManager.getVirtualTaskPullTaskIntervalF() * 1000L, + it.siteId) + } + // 设置task执行相关状态,切换模式时判断使用 + MogoStatusManager.getInstance().setTaxiUnmanedDriverPerformTask(TAG, false) + LineManager.setLineInfo(null); + } + + override fun onStartAutopilot(postDelayTime: Long) { + UiThreadHandler.postDelayed(startTaskRunnable, postDelayTime) // 5s后或者倒计时结束开启自驾, 状态流转 + } + + private val startTaskRunnable: Runnable = Runnable { + startTask() //状态流转 + VoiceNotice.showNotice("车辆正在自动开启自动驾驶") + } + + /** + * 主动请求平行驾驶, 停止启动自驾命令, 任务状态需向下流转 + */ + override fun onStopAutopilot() { + UiThreadHandler.removeCallbacks(startTaskRunnable) + if (!TaxiTaskModel.checkCurrentTaskCondition()) { + d(TAG, "onStopAutopilot: 无任务无需流转状态") + return + } + startTask(false) + } + + override fun onPauseStartAutopilot() { + UiThreadHandler.removeCallbacks(startTaskRunnable) + } + + /** + * 开始倒计时120s或者10s拉取任务 + * 演练任务120s拉取 + * 接驾任务10s拉取 + */ + override fun onStartPrepareTaskUI(delayTime: Long, isStart: Boolean) { + updatePrepareTaskDelayUI(delayTime, isStart) + } + + /** + * 更新本次任务行程信息, 本地计算的数据 + */ + override fun onTaskTripInfoLocalCalculateChanged(meters: Long, timeInSecond: Long) { + updateTaskTripInfoLocalCalculateUI(meters, timeInSecond) + } + + override fun onCarEndServiceSuccess( + driveToNearestStationTask: StartServiceRespBean.Result?, + currentTaskWithOrder: QueryCurrentTaskRespBean.Result? + ) { + if (currentTaskWithOrder == null) return + if (currentTaskWithOrder.currentStatus < TaskStatusEnum.CompleteTask.code //任务未完成 + && currentTaskWithOrder.currentStatus > TaskStatusEnum.None.code // 暂停接单后查询到任务状态是0, 代表没任务 + || currentTaskWithOrder.order != null) {// 有订单未完成 + VoiceNotice.showNotice("暂停接单啦!要完成当前订单哦") + } else { + VoiceNotice.showNotice("暂停接单啦") + updateDriveToNearestStationTaskUI(driveToNearestStationTask) + } + } + + override fun onCarEndServiceFailed(code: Int, msg: String) { + ToastUtilsOch.showWithCodeMessage(code, msg) + } + + override fun onCarEndServiceError() { + val context = AbsMogoApplication.getApp().applicationContext + if (!NetworkUtils.isConnected(context)) { + ToastUtils.showShort(context.getString(R.string.network_error_tip)) + } else { + ToastUtils.showShort(context.getString(R.string.request_error_tip)) + } + } + + override fun onCarStartServiceSuccess( + driveToNearestStationTask: StartServiceRespBean.Result?, + currentTaskWithOrder: QueryCurrentTaskRespBean.Result? + ) { + VoiceNotice.showNotice("开始接单啦") + updateDriveToNearestStationTaskUI(driveToNearestStationTask) + } + + override fun onCarStartServiceFailed(code: Int, msg: String) { + val gcJ02Location = OchLocationManager.getGCJ02Location() + ToastUtilsOch.showWithCodeMessage( + code, + "$msg curLatitude = ${gcJ02Location.latitude}" + " curLongitude = ${gcJ02Location.longitude}" + ) + } + + override fun onCarStartServiceError() { + val context = AbsMogoApplication.getApp().applicationContext + if (!NetworkUtils.isConnected(context)) { + ToastUtils.showShort(context.getString(R.string.network_error_tip)) + } else { + ToastUtils.showShort(context.getString(R.string.request_error_tip)) + } + } + + private fun clearDemoModeAndACParameters(){ + if (FunctionBuildConfig.isDemoMode) { + d(TAG, "setIPCDemoMode:false") + CallerAutoPilotControlManager.setIPCDemoMode(false) + } + TaxiTaskModel.clearAutopilotControlParameters() + } + + /** + * 将业务订单信息保存,鹰眼可取用 + */ + private fun updateAutopilotControlParameters() { + val parameters = TaxiTaskModel.initAutopilotControlParameters() + if (null == parameters) { + CallerLogger.e(TAG, "AutopilotControlParameters is empty.") + return + } + d(TAG, "AutopilotControlParameters is update.") + DebugView.printInfoMsg("[启自驾] updateAutopilotControlParameters调用成功") + CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(parameters) } diff --git a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/itinerarycurrent/ItineraryCurrentView.kt b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/itinerarycurrent/ItineraryCurrentView.kt index c43a3f0d3d..c0e72f1d27 100644 --- a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/itinerarycurrent/ItineraryCurrentView.kt +++ b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/itinerarycurrent/ItineraryCurrentView.kt @@ -1,17 +1,84 @@ package com.mogo.och.unmanned.taxi.ui.task.itinerarycurrent import android.content.Context +import android.graphics.Color +import android.os.CountDownTimer +import android.text.TextUtils import android.util.AttributeSet import android.view.LayoutInflater +import android.view.View import androidx.constraintlayout.widget.ConstraintLayout +import androidx.core.content.ContextCompat import androidx.lifecycle.LifecycleOwner import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.findViewTreeViewModelStoreOwner +import androidx.lifecycle.lifecycleScope +import com.amap.api.navi.model.NaviLatLng +import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener +import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getState +import com.mogo.eagle.core.function.hmi.ui.widget.ItinerarySummaryDialog +import com.mogo.eagle.core.function.main.MainMoGoApplication +import com.mogo.eagle.core.network.utils.GsonUtil +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.CallerLogger.i +import com.mogo.eagle.core.utilcode.util.ClickUtils +import com.mogo.eagle.core.utilcode.util.ToastUtils +import com.mogo.eagle.core.utilcode.util.UiThreadHandler +import com.mogo.och.common.module.biz.order.TaxiOrderStatusEnum +import com.mogo.och.common.module.manager.autopilot.location.OchLocationManager +import com.mogo.och.common.module.map.AmapNaviToDestinationModel +import com.mogo.och.common.module.map.ICommonNaviChangedCallback +import com.mogo.och.common.module.map.MapMakerManager +import com.mogo.och.common.module.utils.DateTimeUtil +import com.mogo.och.common.module.utils.FlowBus +import com.mogo.och.common.module.utils.ResourcesUtils +import com.mogo.och.common.module.voice.VoiceNotice +import com.mogo.och.common.module.wigets.CommonSlideView +import com.mogo.och.common.module.wigets.OCHCommitDialog import com.mogo.och.unmanned.taxi.R import com.mogo.och.unmanned.taxi.TaxiUnmannedDriverProvider +import com.mogo.och.unmanned.taxi.bean.OrderDetail +import com.mogo.och.unmanned.taxi.bean.QueryCurrentTaskRespBean +import com.mogo.och.unmanned.taxi.bean.StartServiceRespBean +import com.mogo.och.unmanned.taxi.constant.TaskStatusEnum +import com.mogo.och.unmanned.taxi.constant.TaskTypeEnum +import com.mogo.och.unmanned.taxi.constant.TaxiDriverEventConst +import com.mogo.och.unmanned.taxi.constant.TaxiUnmannedConst.Companion.TAXI_END_MAP_MAKER +import com.mogo.och.unmanned.taxi.constant.TaxiUnmannedConst.Companion.TAXI_START_MAP_MAKER +import com.mogo.och.unmanned.taxi.constant.TaxiUnmannedConst.Companion.TYPE_MARKER_TAXI_ORDER +import com.mogo.och.unmanned.taxi.ui.debug.DebugView import com.mogo.och.unmanned.taxi.ui.itinerarycurrent.ItineraryCurrentModel +import com.mogo.och.unmanned.taxi.ui.task.TaskUiIntent +import com.mogo.och.unmanned.taxi.ui.task.TaskWithOrderUIState +import com.mogo.och.unmanned.taxi.ui.task.TaxiOrderCancelDialog +import com.mogo.och.unmanned.taxi.ui.task.TaxiTaskModel +import com.mogo.och.unmanned.taxi.utils.TaskUtils +import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.aciv_task_type_exercise +import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.aciv_task_type_order +import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.actv_distance_end +import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.actv_end_order +import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.actv_submit_task +import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.cancelOrder +import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.commonSlideViewStartServer +import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.gourp_order +import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.group_itinerary_info +import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.include_empty +import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.naviToEnd +import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.naviToStart +import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.prepareTaskCountdownTv +import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.taskStatus +import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.actv_time_end +import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.endStationName +import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.startStationName +import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.orderPhoneAndNum +import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.pathwayPoint +import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.trajectoryType +import kotlinx.android.synthetic.main.unmanned_itinerary_current.view.v_bg_route_point_station_name +import kotlinx.coroutines.flow.map -class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineViewCallback { +class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineViewCallback, + View.OnClickListener, ICommonNaviChangedCallback { constructor(context: Context) : super(context) @@ -27,6 +94,10 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi const val TAG = "SwitchBizView" } + private var mPrepareTasCountDownTimer: CountDownTimer? = null + + private var dialog: ItinerarySummaryDialog? = null + private var viewModel: ItineraryCurrentModel?=null private var fragment: LifecycleOwner?=null @@ -41,6 +112,272 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi fragment = TaxiUnmannedDriverProvider.getFragmentInfo() } + private fun initViewModelObserver() { + viewModel?.sendUiIntent(TaskUiIntent.StartTaskWithOrderLooper) + + //监听返回的数据状态 + fragment?.lifecycleScope?.launchWhenStarted { + viewModel?.uiStateFlow?.map { it.taskWithOrderUIState }?.collect { taskAndOrderUiState -> + d(TAG, "uiStateFlow-initViewModelObserver: $taskAndOrderUiState") + when (taskAndOrderUiState) { + is TaskWithOrderUIState.Init -> { + } + + // 开始接单后 需要将车开到最近的一个站点就位,然后才能开启 无人化 流程 + is TaskWithOrderUIState.TaskDriveToNearestStationTask -> { + if (taskAndOrderUiState.driveToNearestStationTask != null) { + updateViewByDriveToNearestStationTask(taskAndOrderUiState.driveToNearestStationTask) + } else { + updatePrepareTaskDelayUI(0, false) + initContainerView(false) + removeAllMapMarker() + } + } + + is TaskWithOrderUIState.TaskWithOrder -> { + val currentTaskWithOrder = taskAndOrderUiState.taskWithOrder + if (currentTaskWithOrder == null) { + initContainerView(false) + removeAllMapMarker() + } else { + updateViewByCurrentTaskWithOrder(currentTaskWithOrder) + } + updateNextTaskFragment(currentTaskWithOrder) + } + + is TaskWithOrderUIState.UpdateOrderTripInfo -> { + dialog?.setOrderMileage(taskAndOrderUiState.mileage*1000) + actv_distance_end.text = TaskUtils.getCurrentTaskDistance(taskAndOrderUiState.mileage.toLong()) + actv_time_end.text = TaskUtils.getCurrentTaskTime(taskAndOrderUiState.duration.toLong()) + } + + is TaskWithOrderUIState.UpdateTaskTripLocalCalculateInfo -> { + actv_distance_end.text = TaskUtils.getCurrentTaskDistance(taskAndOrderUiState.meters.toLong()) + actv_time_end.text = TaskUtils.getCurrentTaskTime(taskAndOrderUiState.timeInSecond.toLong()) + } + + is TaskWithOrderUIState.UpdatePrepareTaskDelay -> { + updatePrepareTaskDelayUI( + taskAndOrderUiState.delayTime, + taskAndOrderUiState.isStart + ) + } + } + } + } + } + + /** + * 更新拉取任务倒计时 + */ + private fun updatePrepareTaskDelayUI(millisInFuture: Long, isStart: Boolean) { + DebugView.printInfoMsg("距离任务获取还有 ${DateTimeUtil.second2MMSS(millisInFuture / 1000)}") + if (!isStart) { + prepareTaskCountdownTv.visibility = View.GONE + mPrepareTasCountDownTimer?.cancel() + mPrepareTasCountDownTimer = null + return + } + + if (mPrepareTasCountDownTimer != null) { + mPrepareTasCountDownTimer?.cancel() + mPrepareTasCountDownTimer = null + } + + mPrepareTasCountDownTimer = object : CountDownTimer(millisInFuture, 1000L) {// 倒计时后开启自驾 + + override fun onTick(millisUntilFinished: Long) { + DebugView.printInfoMsg("距离任务获取还有 ${DateTimeUtil.second2MMSS(millisUntilFinished / 1000)}") + // 倒计时 + UiThreadHandler.post { + prepareTaskCountdownTv.visibility = View.VISIBLE + prepareTaskCountdownTv.text = + "距离任务获取还有 ${DateTimeUtil.second2MMSS(millisUntilFinished / 1000)}" + } + } + + override fun onFinish() { + //倒计时结束了... + UiThreadHandler.post { + prepareTaskCountdownTv.visibility = View.INVISIBLE + } + mPrepareTasCountDownTimer?.cancel() + } + } + + mPrepareTasCountDownTimer?.start() + } + + /** + * 更新当前任务和订单信息 + */ + private fun updateViewByCurrentTaskWithOrder(taskAndOrder: QueryCurrentTaskRespBean.Result?) { + if (taskAndOrder == null) return + /** + * 根据任务类型判断任务显示, + * 虚拟单, 显示在进行中 前往上车点 + * 演练任务,显示演练任务, 同时有订单显示在待服务中 + * 当前任务是接驾任务,显示订单状态+运营单 订单显示在进行中, 任务不再显示 + */ + val taskType = taskAndOrder.taskType // 任务类型 + val order = taskAndOrder.order // 订单信息 + val endSite = taskAndOrder.endSite // 终点 + val currentStatus = taskAndOrder.currentStatus // 任务的状态 0:空闲 1:获取任务 2:开始任务 3:到达目的地 + + if ((endSite == null || currentStatus == TaskStatusEnum.CompleteTask.code) // 无任务或者任务已经完成的时候且无订单的时候 + && taskAndOrder.order == null + ) { + initContainerView(false) + removeAllMapMarker() + return + } + + initContainerView(true) + + when (taskType) { + TaskTypeEnum.None.code -> { + if (order != null && (currentStatus == TaskStatusEnum.CompleteTask.code + || currentStatus == TaskStatusEnum.None.code) + ) { //暂停接单会清空前往上车点任务 + updateOrderUI(order) + } + } + + TaskTypeEnum.VirtualTask.code -> { //演练任务 + + if (order != null && currentStatus == TaskStatusEnum.CompleteTask.code) { + updateOrderUI(order) + } else { + updateVirtualTaskUI(taskAndOrder) + } + } + + TaskTypeEnum.ToOrderEndTask.code, TaskTypeEnum.ToOrderStartTask.code -> {// 接驾任务 或 送驾任务 + order?.also { + updatePathwayPoint(taskType, endSite?.siteName) + updateOrderUI(it) + } + } + } + + updateMapMarkers(taskAndOrder) + updateRemainDistanceAndTime(false) + } + + // 第一个特殊任务 也是虚拟任务 + private fun updateViewByDriveToNearestStationTask(driveToNearestStationTask: StartServiceRespBean.Result?) { + if (driveToNearestStationTask == null) return + initContainerView(true) + // DriverToNearestStationTask 任务更新 + gourp_order.visibility = GONE + group_itinerary_info.visibility = VISIBLE + aciv_task_type_exercise.visibility = VISIBLE + // 更新任务状态,起点,终点 + taskStatus.text = resources.getString(R.string.task_start_to_virtual_site) + startStationName.text = resources.getString(R.string.task_current_loc) + endStationName.text = driveToNearestStationTask.siteName + + setOrRemoveMapMaker( + true, + TAXI_END_MAP_MAKER, + driveToNearestStationTask.wgs84Lat, + driveToNearestStationTask.wgs84Lon, + R.raw.end_marker + ) + + // 使用高德获取导航数据 + startNaviToStation( + false, + driveToNearestStationTask.gcjLat, + driveToNearestStationTask.gcjLon + ) + } + + private fun showEmptyView() { + gourp_order.visibility = GONE + aciv_task_type_exercise.visibility = GONE + group_itinerary_info.visibility = GONE + include_empty.visibility = VISIBLE + prepareTaskCountdownTv.visibility = GONE + } + + private fun initOnClickListener() { + naviToStart.setOnClickListener(this) + naviToEnd.setOnClickListener(this) + + cancelOrder.setOnClickListener(this) + taskStatus.setOnClickListener(this) + commonSlideViewStartServer.setSlideListener(object :CommonSlideView.SlideListener{ + override fun slideEnd() { + d(TAG, taskStatus.text.toString()) + startOrEndService() + } + }) + actv_submit_task.onClick { + startOrEndService() + } + actv_end_order.onClick { + startOrEndService() + } + } + + private fun initTaskDebugViewListener() { + fragment?.let { fr-> + aciv_task_type_exercise.setOnLongClickListener { + FlowBus.with(TaxiDriverEventConst.TaxiFragmentEvent.EVENT_TYPE_SHOW_DEBUG_VIEW) + .post(fr.lifecycleScope, true) + false + } + aciv_task_type_order.setOnLongClickListener { + FlowBus.with(TaxiDriverEventConst.TaxiFragmentEvent.EVENT_TYPE_SHOW_DEBUG_VIEW) + .post(fr.lifecycleScope, true) + false + } + } + } + + private fun startOrEndService() { + val currentTaskWithOrder = TaxiTaskModel.getCurrentTaskWithOrder() + if (currentTaskWithOrder?.order == null) return + val order = currentTaskWithOrder.order + if (TaxiOrderStatusEnum.ArriveAtStart.code == order!!.orderStatus) { //到达乘客上车点,司机可跳过乘客屏认证 + viewModel?.sendUiIntent(TaskUiIntent.JumpPassengerCheck) + } else if (TaxiOrderStatusEnum.UserArriveAtStart.code == order.orderStatus) { + viewModel?.sendUiIntent(TaskUiIntent.StartTask) + } else if (TaxiOrderStatusEnum.ArriveAtEnd.code == order.orderStatus) { //点击了完成服务,结束订单并更新订单信息 + viewModel?.sendUiIntent(TaskUiIntent.JourneyCompleted) + } else if (TaxiOrderStatusEnum.OnTheWayToEnd.code == order.orderStatus) { //前往目的地过程中可提前结束行程 + //自驾中提示,接管后才能结束 + if (getState() + == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING + ) { + ToastUtils.showLong(R.string.taxi_switch_line_btn_warning1) + } else { + closeOrderDialog() + } + } + } + + private fun closeOrderDialog() { + val builder = OCHCommitDialog.Builder() + val closeOrderDialog = builder + .title(ResourcesUtils.getString(R.string.dialog_order_close_title)) + .tips(ResourcesUtils.getString(R.string.dialog_order_close_content)) + .confirmStr(ResourcesUtils.getString(R.string.dialog_order_close_confirm)) + .cancelStr(ResourcesUtils.getString(R.string.dialog_order_close_cancel)) + .build(context) + closeOrderDialog!!.setClickListener(object : OCHCommitDialog.ClickListener { + override fun confirm() { + viewModel?.sendUiIntent(TaskUiIntent.CloseOrderByDriver) + } + + override fun cancel() { + closeOrderDialog.dismiss() + } + }) + closeOrderDialog.show() + } + override fun onAttachedToWindow() { super.onAttachedToWindow() @@ -48,6 +385,434 @@ class ItineraryCurrentView: ConstraintLayout, ItineraryCurrentModel.SwtichLineVi ViewModelProvider(it).get(ItineraryCurrentModel::class.java) } viewModel?.setDistanceCallback(this) + initOnClickListener() + showEmptyView() + initTaskDebugViewListener() + initViewModelObserver() + } + + override fun onClick(v: View?) { + if (!ClickUtils.isFastClick()) { + i(TAG, "view点击过快") + return + } + when (v?.id) { + + cancelOrder.id -> { + val currentWithOrder = TaxiTaskModel.getCurrentTaskWithOrder() + if (currentWithOrder?.order != null) { + val order = currentWithOrder.order + TaxiOrderCancelDialog(context, order!!.orderStatus) { type -> + viewModel?.sendUiIntent(TaskUiIntent.CancelOrder(type)) + }.show() + } + } + + naviToStart.id, + naviToEnd.id -> { + showNaviToEndStationFragment(true) + } + } + } + + /** + * 显示/隐藏 前往任务目的地的导航 + * + * @param isShow + */ + private fun showNaviToEndStationFragment(isShow: Boolean) { + fragment?.let { + FlowBus.with(TaxiDriverEventConst.TaxiFragmentEvent.EVENT_TYPE_START_NAVI_TO_END_STATION) + .post(it.lifecycleScope, isShow) + } + } + + /** + * 是否有正在进行的订单,进行UI显示 + * + * @param hasCurrentTask + */ + private fun initContainerView(hasCurrentTask: Boolean) { + d( + TAG, + "hasCurrentTask = $hasCurrentTask" + ) + if (hasCurrentTask) { + include_empty.visibility = View.GONE + prepareTaskCountdownTv.visibility = View.GONE + } else { + // 空页面 + include_empty.visibility = View.VISIBLE + // 倒计时 + prepareTaskCountdownTv.visibility = View.GONE + // 行程信息 + group_itinerary_info.visibility = View.GONE + // 订单信息 + gourp_order.visibility = View.GONE + // 途经点信息 + pathwayPoint.visibility = View.GONE + // 演练单标识 + aciv_task_type_exercise.visibility = View.GONE + // 轨迹标识 + trajectoryType.visibility = View.GONE + } + } + + private fun removeAllMapMarker() { + MapMakerManager.removeAllMapMarkerByOwner(TYPE_MARKER_TAXI_ORDER) + } + + private fun updateNextTaskFragment(result: QueryCurrentTaskRespBean.Result?) { + fragment?.let { + FlowBus.with(TaxiDriverEventConst.TabFragmentEvent.EVENT_TYPE_TASK_WITH_ORDER_CHANGED) + .post(it.lifecycleScope, result) + + if (result != null + && result.taskType == TaskTypeEnum.VirtualTask.code + && result.order != null + && result.currentStatus != TaskStatusEnum.CompleteTask.code + ) { + VoiceNotice.showNotice("已为您提前接到下一订单,待完成当前任务后服务") + FlowBus.with(TaxiDriverEventConst.TabFragmentEvent.EVENT_TYPE_SHOW_RED_POINT) + .post(it.lifecycleScope, true) + } else { + FlowBus.with(TaxiDriverEventConst.TabFragmentEvent.EVENT_TYPE_SHOW_RED_POINT) + .post(it.lifecycleScope, false) + } + } + + } + + private fun updateOrderUI(order: OrderDetail) { + cancelOrder.visibility = if (order.orderStatus == TaxiOrderStatusEnum.ArriveAtEnd.code + ) View.GONE else View.VISIBLE + gourp_order.visibility = View.VISIBLE + group_itinerary_info.visibility = View.VISIBLE + aciv_task_type_exercise.visibility = View.GONE +// orderStatus: 0 订单创建(为派单), 10 已派上司机(司机去往上车点), 20 司机到达上车点, +// 30 乘客到达上车点, 40 服务中(去往目的地), 50 到达目的地, 60 已完成, 70 已取消 + naviToStart.visibility = if (order.orderStatus + == TaxiOrderStatusEnum.OnTheWayToStart.code + ) View.VISIBLE else View.GONE + + naviToEnd.visibility = if (order.orderStatus + == TaxiOrderStatusEnum.OnTheWayToEnd.code + ) View.VISIBLE else View.GONE + + updatePrepareTaskDelayUI(0, false) + + orderPhoneAndNum.text = TaskUtils.getCurrentTaskPhoneNumAndPassengerCountHtml( + order.bookingUserPhone, + order.passengerSize + ) + startStationName.text = order.orderStartSite?.siteName + endStationName.text = order.orderEndSite?.siteName + TaxiTaskModel.getCurrentOrderTrajectoryList().also { + val orderTrajectory = it.firstOrNull {order.orderLine == it.lineId} + trajectoryType.visibility = if (orderTrajectory?.source == 2) + View.VISIBLE else View.GONE + } + + when (order.orderStatus) { + TaxiOrderStatusEnum.None.code -> { //无 + dismissDialog() + initContainerView(false) + removeAllMapMarker() + } + + TaxiOrderStatusEnum.ArriveAtEnd.code -> { //到达目的地 + taskStatus.text = resources.getString(R.string.task_start_end_site) + + actv_end_order.visibility = VISIBLE + actv_end_order.text = ResourcesUtils.getString(R.string.module_och_taxi_order_server_end) + commonSlideViewStartServer.visibility = GONE + actv_submit_task.visibility = GONE + + showDialog() + hideNaviBtns() + } + + TaxiOrderStatusEnum.OnTheWayToEnd.code -> { //送驾中 + dismissDialog() + taskStatus.text = resources.getString(R.string.task_start_end_site) + + actv_end_order.visibility = VISIBLE + actv_end_order.text = ResourcesUtils.getString(R.string.module_och_taxi_order_close) + commonSlideViewStartServer.visibility = GONE + actv_submit_task.visibility = GONE + + } + + TaxiOrderStatusEnum.UserArriveAtStart.code, TaxiOrderStatusEnum.ArriveAtStart.code -> { + //乘客到达上车点, 验证成功 ; 到达乘客上车点 + dismissDialog() + taskStatus.text = resources.getString(R.string.arrived_start_site) + + actv_end_order.visibility = GONE + commonSlideViewStartServer.visibility = GONE + actv_submit_task.visibility = VISIBLE + if (order.orderStatus == TaxiOrderStatusEnum.UserArriveAtStart.code) { + actv_submit_task.text = + ResourcesUtils.getString(R.string.module_och_taxi_order_server_start) + } + else { + actv_submit_task.text = + ResourcesUtils.getString(R.string.module_och_taxi_order_server_start_wait_check) + } + hideNaviBtns() + actv_time_end.text = TaskUtils.getCurrentTaskWaitTimeHtml() + } + + TaxiOrderStatusEnum.OnTheWayToStart.code -> { //前往上车地点 + dismissDialog() + taskStatus.text = resources.getString(R.string.task_start_start_site) + actv_end_order.visibility = GONE + commonSlideViewStartServer.visibility = VISIBLE + actv_submit_task.visibility = GONE + } + } + } + + //展示虚拟订单 + private fun updateVirtualTaskUI(taskAndOrder: QueryCurrentTaskRespBean.Result?) { + + if (taskAndOrder == null) return + + val startSite = taskAndOrder.startSite // 起点 + val endSite = taskAndOrder.endSite // 终点 + val currentStatus = taskAndOrder.currentStatus // 任务的状态 0:空闲 1:获取任务 2:开始任务 3:到达目的地 + + + + // 空页面 + include_empty.visibility = View.GONE + // 倒计时 + prepareTaskCountdownTv.visibility = View.GONE + // 行程信息 + group_itinerary_info.visibility = View.VISIBLE + // 订单信息 + gourp_order.visibility = View.GONE + // 途经点信息 + pathwayPoint.visibility = View.GONE + // 演练单标识 + aciv_task_type_exercise.visibility = View.VISIBLE + + naviToStart.visibility = View.GONE + naviToEnd.visibility = if (currentStatus >= TaskStatusEnum.StartTask.code) View.VISIBLE else View.GONE + + if (startSite == null || endSite == null) return + + taskStatus.text = resources.getString(R.string.task_start_end_site) + + + startStationName.text = startSite.siteName + endStationName.text = endSite.siteName + TaxiTaskModel.getCurrentOrderTrajectoryList().also { + val taskTrajectory = it.firstOrNull {taskAndOrder.lineId == it.lineId} + trajectoryType.visibility = if (taskTrajectory?.source == 2) + View.VISIBLE else View.GONE + } + updatePrepareTaskDelayUI(0, false) + } + + private fun updatePathwayPoint(taskType: Int, endSiteName: String?) { + if (TextUtils.isEmpty(endSiteName)) return + pathwayPoint.visibility = if (taskType == TaskTypeEnum.ToOrderStartTask.code) + View.VISIBLE else View.GONE + v_bg_route_point_station_name.text = "途径: $endSiteName" + } + + private fun updateMapMarkers(taskAndOrder: QueryCurrentTaskRespBean.Result?) { + if (taskAndOrder?.startSite != null + && taskAndOrder.endSite != null + ) { + when (taskAndOrder.currentStatus) { + TaskStatusEnum.GetTask.code -> { + setOrRemoveMapMaker( + true, + TAXI_START_MAP_MAKER, + taskAndOrder.startSite!!.wgs84Lat, + taskAndOrder.startSite!!.wgs84Lon, + R.raw.star_marker + ) + setOrRemoveMapMaker( + true, + TAXI_END_MAP_MAKER, + taskAndOrder.endSite!!.wgs84Lat, + taskAndOrder.endSite!!.wgs84Lon, + R.raw.end_marker + ) + } + + TaskStatusEnum.StartTask.code -> { + setOrRemoveMapMaker( + false, + TAXI_START_MAP_MAKER, + taskAndOrder.startSite!!.wgs84Lat, + taskAndOrder.startSite!!.wgs84Lon, + R.raw.star_marker + ) + setOrRemoveMapMaker( + true, + TAXI_END_MAP_MAKER, + taskAndOrder.endSite!!.wgs84Lat, + taskAndOrder.endSite!!.wgs84Lon, + R.raw.end_marker + ) + } + + TaskStatusEnum.CompleteTask.code -> { + setOrRemoveMapMaker( + false, + TAXI_START_MAP_MAKER, + taskAndOrder.startSite!!.wgs84Lat, + taskAndOrder.startSite!!.wgs84Lon, + R.raw.star_marker + ) + setOrRemoveMapMaker( + false, + TAXI_END_MAP_MAKER, + taskAndOrder.endSite!!.wgs84Lat, + taskAndOrder.endSite!!.wgs84Lon, + R.raw.end_marker + ) + } + } + } else { + d( + TAG, + "CurrentTaskWithOrder == " + GsonUtil.jsonFromObject(taskAndOrder) + ) + } + } + + /** + * 绘制地图起点终点 + * @param isAdd + * @param uuid + */ + private fun setOrRemoveMapMaker( + isAdd: Boolean, uuid: String, + lat: Double, lon: Double, resourceId: Int + ) { + if (isAdd) { + MapMakerManager.addMapMaker(TYPE_MARKER_TAXI_ORDER, uuid, lat, lon, resourceId) + } else { + MapMakerManager.removeMapMaker(uuid, lat, lon) + } + } + + /** + * 根据任务状态计算剩余历程和时间 + */ + private fun updateRemainDistanceAndTime(isVoicePlay: Boolean) { + val currentTaskWithOrder = TaxiTaskModel.getCurrentTaskWithOrder() ?: return + d(TAG, "updateRemainDistanceAndTime ${currentTaskWithOrder.currentStatus}") + if (currentTaskWithOrder.currentStatus == TaskStatusEnum.StartTask.code) { + if (currentTaskWithOrder.endSite != null) { + startNaviToStation( + isVoicePlay, currentTaskWithOrder.endSite!!.gcjLat, + currentTaskWithOrder.endSite!!.gcjLon + ) + } + + } else if (currentTaskWithOrder.currentStatus == TaskStatusEnum.CompleteTask.code && + currentTaskWithOrder.taskType <= TaskTypeEnum.ToOrderStartTask.code + ) { + actv_distance_end.text = "已到达 ${currentTaskWithOrder.endSite?.siteName}" + } else { + actv_distance_end.text = "距离 -- 公里, 用时 -- 分钟" + } + } + + private fun startNaviToStation(isVoicePlay: Boolean, stationLat: Double, stationLng: Double) { + AmapNaviToDestinationModel.getInstance(context).destroyAmaNavi() + val gcJ02Location = OchLocationManager.getGCJ02Location() + val mCurLatitude = gcJ02Location.latitude + val mCurLongitude = gcJ02Location.longitude + d(TAG, "currentLatLng=$mCurLatitude $mCurLongitude") + val startNaviLatLng = NaviLatLng(mCurLatitude, mCurLongitude) + val endNaviLatLng = NaviLatLng(stationLat, stationLng) + AmapNaviToDestinationModel.getInstance(context).initAMapNavi(startNaviLatLng, endNaviLatLng) + AmapNaviToDestinationModel.getInstance(context).setVoiceIsMute(isVoicePlay) + AmapNaviToDestinationModel.getInstance(context).setTaxiNaviChangedCallback(this) + } + + private fun showDialog(){ + if(dialog==null&&context!=null){ + + } + context?.let { + if(dialog==null) { + dialog = ItinerarySummaryDialog(it, true, R.style.summary_dialog) + } + dialog?.let { dialogInner -> + if(!dialogInner.isShowing){ + dialogInner.show() + } + } + } + + } + + private fun dismissDialog(){ + dialog?.let { + if(it.isShowing){ + it.dismiss() + } + } + dialog = null + } + + private fun hideNaviBtns() { + naviToStart.visibility = View.GONE + naviToEnd.visibility = View.GONE + AmapNaviToDestinationModel.getInstance(context).destroyAmaNavi() + fragment?.let { + FlowBus.with(TaxiDriverEventConst.TaxiFragmentEvent.EVENT_TYPE_SHOW_AMAP_NAVI_TO_STATION_FRAGMENT) + .post(it.lifecycleScope, false) + FlowBus.with(TaxiDriverEventConst.TaxiFragmentEvent.EVENT_TYPE_SHOW_ROUTING_TO_STATION_FRAGMENT) + .post(it.lifecycleScope, false) + } + + } + + override fun onCurrentNaviDistAndTimeChanged(meters: Int, timeInSecond: Long) { + actv_distance_end.text = TaskUtils.getCurrentTaskDistance(meters.toLong()) + actv_time_end.text = TaskUtils.getCurrentTaskTime(timeInSecond) + } + + override fun reInitNaviAmap(isPlay: Boolean, isRestart: Boolean) { + d(TAG, "isPlay = $isPlay, isRestart=$isRestart") + if (!isRestart) { + fragment?.let { + FlowBus.with(TaxiDriverEventConst.TaxiFragmentEvent.EVENT_TYPE_SHOW_AMAP_NAVI_TO_STATION_FRAGMENT) + .post(it.lifecycleScope, false) + } + return + } + val currentTaskWithOrder = TaxiTaskModel.getCurrentTaskWithOrder() + + UiThreadHandler.postDelayed({ + updateRemainDistanceAndTime(false) + }, 2000) + + UiThreadHandler.postDelayed({ + if (currentTaskWithOrder?.currentStatus == TaskStatusEnum.GetTask.code + ) { + if (naviToStart.visibility == View.GONE) { + naviToStart.visibility = View.VISIBLE + } + } + if ((currentTaskWithOrder?.currentStatus == TaskStatusEnum.StartTask.code + && currentTaskWithOrder.order == null) + || (currentTaskWithOrder?.order?.orderStatus == TaxiOrderStatusEnum.OnTheWayToEnd.code) + ) { + if (naviToEnd.visibility == View.GONE) { + naviToEnd.visibility = View.VISIBLE + } + } + }, 3000) } } diff --git a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/wigets/TaxiSelectViewGroup.kt b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/wigets/TaxiSelectViewGroup.kt index 9c04f15962..6e73abf9f6 100644 --- a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/wigets/TaxiSelectViewGroup.kt +++ b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/wigets/TaxiSelectViewGroup.kt @@ -61,7 +61,7 @@ class TaxiSelectViewGroup @JvmOverloads constructor( override fun onVisibilityAggregated(isVisible: Boolean) { super.onVisibilityAggregated(isVisible) if(isVisible){ - + textCurrentItinerary.setCheck(true) }else{ } diff --git a/OCH/taxi/unmanned-driver/src/main/res/layout/unmanned_itinerary_current.xml b/OCH/taxi/unmanned-driver/src/main/res/layout/unmanned_itinerary_current.xml index fd6679d196..c473742cc3 100644 --- a/OCH/taxi/unmanned-driver/src/main/res/layout/unmanned_itinerary_current.xml +++ b/OCH/taxi/unmanned-driver/src/main/res/layout/unmanned_itinerary_current.xml @@ -8,7 +8,7 @@ xmlns:tools="http://schemas.android.com/tools"> - + + + @@ -144,14 +158,14 @@ android:textSize="@dimen/dp_32" android:textColor="@color/taxi_color_CCCCCC" app:layout_constraintTop_toBottomOf="@+id/actv_distance_end" - app:layout_constraintStart_toStartOf="@+id/actv_current_itinerary_start_name" - app:layout_constraintBottom_toTopOf="@+id/actv_current_itinerary_end_name" + app:layout_constraintStart_toStartOf="@+id/startStationName" + app:layout_constraintBottom_toTopOf="@+id/endStationName" android:layout_width="wrap_content" android:layout_height="wrap_content"/> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/OCH/taxi/unmanned-driver/src/main/res/layout/unmanned_switch_itinerary.xml b/OCH/taxi/unmanned-driver/src/main/res/layout/unmanned_switch_itinerary.xml index 2c807a6f4e..d2790945a0 100644 --- a/OCH/taxi/unmanned-driver/src/main/res/layout/unmanned_switch_itinerary.xml +++ b/OCH/taxi/unmanned-driver/src/main/res/layout/unmanned_switch_itinerary.xml @@ -28,19 +28,21 @@ app:layout_constraintStart_toStartOf="parent" android:layout_marginTop="@dimen/dp_28" app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintBottom_toBottomOf="parent" android:visibility="gone" app:layout_constraintTop_toBottomOf="@+id/taxiServerSelector" android:layout_width="match_parent" - android:layout_height="wrap_content"/> + android:layout_height="0dp"/> + android:layout_height="0dp"/> \ No newline at end of file diff --git a/OCH/taxi/unmanned-driver/src/main/res/layout/unmanned_taxi_base_fragment.xml b/OCH/taxi/unmanned-driver/src/main/res/layout/unmanned_taxi_base_fragment.xml index d1f28311ba..daf8149f23 100644 --- a/OCH/taxi/unmanned-driver/src/main/res/layout/unmanned_taxi_base_fragment.xml +++ b/OCH/taxi/unmanned-driver/src/main/res/layout/unmanned_taxi_base_fragment.xml @@ -75,4 +75,13 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" /> + + + \ No newline at end of file diff --git a/OCH/taxi/unmanned-driver/src/main/res/layout/unmanned_taxi_panel.xml b/OCH/taxi/unmanned-driver/src/main/res/layout/unmanned_taxi_panel.xml index 277e864b33..84ba5addce 100644 --- a/OCH/taxi/unmanned-driver/src/main/res/layout/unmanned_taxi_panel.xml +++ b/OCH/taxi/unmanned-driver/src/main/res/layout/unmanned_taxi_panel.xml @@ -9,11 +9,4 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" /> - - \ No newline at end of file diff --git a/OCH/taxi/unmanned-driver/src/main/res/values/colors.xml b/OCH/taxi/unmanned-driver/src/main/res/values/colors.xml index cd63f6153e..510aaafcfb 100644 --- a/OCH/taxi/unmanned-driver/src/main/res/values/colors.xml +++ b/OCH/taxi/unmanned-driver/src/main/res/values/colors.xml @@ -43,4 +43,5 @@ #80000000 #2EACFF #FF4E41 + #91A1EA \ No newline at end of file From 6223e3bb591c615a7ad20a585e210c045d4e8245 Mon Sep 17 00:00:00 2001 From: yangyakun Date: Sat, 12 Oct 2024 16:43:23 +0800 Subject: [PATCH 17/17] =?UTF-8?q?[6.7.0]=20[fea]=20[=E5=BE=85=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E9=A1=B5=E9=9D=A2]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../task/itinerarynext/ItineraryNextView.kt | 92 ++++++++++++++++++- .../itinerayswitch/ItinerarySwitchView.kt | 4 - .../res/layout/unmanned_itinerary_next.xml | 33 ++++--- 3 files changed, 113 insertions(+), 16 deletions(-) diff --git a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/itinerarynext/ItineraryNextView.kt b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/itinerarynext/ItineraryNextView.kt index 964d18fa25..84faaa5f93 100644 --- a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/itinerarynext/ItineraryNextView.kt +++ b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/itinerarynext/ItineraryNextView.kt @@ -3,14 +3,30 @@ package com.mogo.och.unmanned.taxi.ui.task.itinerarynext import android.content.Context import android.util.AttributeSet import android.view.LayoutInflater +import android.view.View import androidx.constraintlayout.widget.ConstraintLayout import androidx.lifecycle.LifecycleOwner import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.findViewTreeViewModelStoreOwner -import com.mogo.och.common.module.wigets.WindowRelativeLayout +import com.mogo.eagle.core.utilcode.kotlin.onClick +import com.mogo.och.common.module.utils.FlowBus import com.mogo.och.unmanned.taxi.R import com.mogo.och.unmanned.taxi.TaxiUnmannedDriverProvider +import com.mogo.och.unmanned.taxi.bean.OrderDetail +import com.mogo.och.unmanned.taxi.bean.QueryCurrentTaskRespBean +import com.mogo.och.unmanned.taxi.constant.TaskStatusEnum +import com.mogo.och.unmanned.taxi.constant.TaskTypeEnum +import com.mogo.och.unmanned.taxi.constant.TaxiDriverEventConst import com.mogo.och.unmanned.taxi.ui.itinerarynext.ItineraryNextModel +import com.mogo.och.unmanned.taxi.ui.task.TaxiOrderCancelDialog +import com.mogo.och.unmanned.taxi.ui.task.TaxiTaskModel +import kotlinx.android.synthetic.main.unmanned_itinerary_next.view.aciv_order_close +import kotlinx.android.synthetic.main.unmanned_itinerary_next.view.actv_end_station_name +import kotlinx.android.synthetic.main.unmanned_itinerary_next.view.actv_order_count +import kotlinx.android.synthetic.main.unmanned_itinerary_next.view.actv_order_phone +import kotlinx.android.synthetic.main.unmanned_itinerary_next.view.actv_start_station_name +import kotlinx.android.synthetic.main.unmanned_itinerary_next.view.group_order_next +import kotlinx.android.synthetic.main.unmanned_itinerary_next.view.include_empty class ItineraryNextView: ConstraintLayout, ItineraryNextModel.SwtichLineViewCallback { @@ -40,6 +56,17 @@ class ItineraryNextView: ConstraintLayout, ItineraryNextModel.SwtichLineViewCall private fun initView() { fragment = TaxiUnmannedDriverProvider.getFragmentInfo() + + aciv_order_close.onClick { //取消待服务订单 + val currentWithOrder = TaxiTaskModel.getCurrentTaskWithOrder() + if (currentWithOrder?.order != null) { + val order = currentWithOrder.order + TaxiOrderCancelDialog(context, order!!.orderStatus) { type -> + TaxiTaskModel.cancelOrder(order.orderNo,type) + }.show() + } + } + showNoNextTaskView() } @@ -49,6 +76,69 @@ class ItineraryNextView: ConstraintLayout, ItineraryNextModel.SwtichLineViewCall ViewModelProvider(it)[ItineraryNextModel::class.java] } viewModel?.setDistanceCallback(this) + initTaskDebugViewListener() + } + + fun onTaskDataChanged(taskWithOrder: QueryCurrentTaskRespBean.Result?) { + if (taskWithOrder?.order == null) { + showNoNextTaskView() + return + } + + if (taskWithOrder.taskType == TaskTypeEnum.VirtualTask.code && + taskWithOrder.currentStatus != TaskStatusEnum.CompleteTask.code + ) { + val order = taskWithOrder.order + updateTaskUI(order!!) + } else { + showNoNextTaskView() + } + } + + private fun showNoNextTaskView() { + include_empty.visibility = View.VISIBLE + group_order_next.visibility = View.GONE + } + + private fun showNextTaskView() { + include_empty.visibility = View.GONE + group_order_next.visibility = View.VISIBLE + } + + private fun updateTaskUI(order: OrderDetail) { + showNextTaskView() + + var tempPhone = order.bookingUserPhone + + tempPhone.let { + if (it.length > 8) { + //截取电话号码前三位 + val phoneNumPre = it.substring(0, 3) + //截取电话号码后四位 + val phoneNumFix = it.substring(7) + tempPhone = "$phoneNumPre****$phoneNumFix" + } + } + actv_order_phone.text = tempPhone + + order.passengerSize + actv_order_count.text = "${order.passengerSize}人" + + order.orderStartSite?.let { + actv_start_station_name.text = it.siteName + } + order.orderEndSite?.let { + actv_end_station_name.text = it.siteName + } + } + + private fun initTaskDebugViewListener() { + fragment?.let { fr-> + FlowBus.with(TaxiDriverEventConst.TabFragmentEvent.EVENT_TYPE_TASK_WITH_ORDER_CHANGED) + .register(fr) { taskWithOrder -> + onTaskDataChanged(taskWithOrder) + } + } } } diff --git a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/itinerayswitch/ItinerarySwitchView.kt b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/itinerayswitch/ItinerarySwitchView.kt index bc24b02e20..5a4ed664ae 100644 --- a/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/itinerayswitch/ItinerarySwitchView.kt +++ b/OCH/taxi/unmanned-driver/src/main/java/com/mogo/och/unmanned/taxi/ui/task/itinerayswitch/ItinerarySwitchView.kt @@ -84,10 +84,6 @@ class ItinerarySwitchView: ConstraintLayout, ItinerarySwitchModel.SwtichLineView .register(it) { show -> taxiServerSelector.setNextItineraryRedBagVisable( if (show) View.VISIBLE else View.GONE) } -// FlowBus.with(TaxiDriverEventConst.TabFragmentEvent.EVENT_TYPE_TASK_WITH_ORDER_CHANGED) -// .register(it) { taskWithOrder -> -// nextTaskFragment?.onTaskDataChanged(taskWithOrder) -// } } } diff --git a/OCH/taxi/unmanned-driver/src/main/res/layout/unmanned_itinerary_next.xml b/OCH/taxi/unmanned-driver/src/main/res/layout/unmanned_itinerary_next.xml index 52d197d77d..154b09b2c4 100644 --- a/OCH/taxi/unmanned-driver/src/main/res/layout/unmanned_itinerary_next.xml +++ b/OCH/taxi/unmanned-driver/src/main/res/layout/unmanned_itinerary_next.xml @@ -72,17 +72,6 @@ android:layout_width="wrap_content" android:layout_height="wrap_content"/> - - - + + + + \ No newline at end of file