[6.0.0] opt 暂时将mogogo-qa 的och_url: http://10.0.0.182:30560
This commit is contained in:
@@ -57,8 +57,6 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
implementation rootProject.ext.dependencies.amapnavi3dmap
|
||||
|
||||
implementation "androidx.fragment:fragment-ktx:1.3.6"
|
||||
|
||||
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1"
|
||||
|
||||
// annotationProcessor"android.arch.lifecycle:compiler:1.1.1"
|
||||
|
||||
@@ -71,5 +71,7 @@ class TaxiUnmannedConst {
|
||||
|
||||
const val TIMER_START_AUTOPILOT_INTERVAL = 20 * 1000L
|
||||
|
||||
const val TIMER_PREPARE_TASK_INTERVAL = 30 * 1000L
|
||||
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,6 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.setIPCDemoMode
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.setIgnoreConditionDraw
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getState
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager.addListener
|
||||
@@ -46,7 +45,6 @@ import com.mogo.och.common.module.biz.common.socketmessage.OCHSocketMessageManag
|
||||
import com.mogo.och.common.module.biz.common.socketmessage.OCHSocketMessageManager.registerSocketMessageListener
|
||||
import com.mogo.och.common.module.biz.common.socketmessage.OCHSocketMessageManager.releaseSocketMessageListener
|
||||
import com.mogo.och.common.module.biz.common.socketmessage.data.OCHOperationalMessage
|
||||
import com.mogo.och.common.module.biz.constant.LoginStatusManager.isLogin
|
||||
import com.mogo.och.common.module.biz.constant.OchCommonConst
|
||||
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback
|
||||
import com.mogo.och.common.module.biz.provider.LoginService
|
||||
@@ -59,8 +57,6 @@ import com.mogo.och.common.module.manager.distancemamager.ITrajectoryListener
|
||||
import com.mogo.och.common.module.manager.distancemamager.TrajectoryAndDistanceManager.addDistanceListener
|
||||
import com.mogo.och.common.module.manager.distancemamager.TrajectoryAndDistanceManager.addTrajectoryListener
|
||||
import com.mogo.och.common.module.manager.distancemamager.TrajectoryAndDistanceManager.setStationPoint
|
||||
import com.mogo.och.common.module.utils.ToastUtilsOch
|
||||
import com.mogo.och.taxi.R
|
||||
import com.mogo.och.taxi.bean.OrderDetail
|
||||
import com.mogo.och.taxi.bean.PrepareTaskRespBean
|
||||
import com.mogo.och.taxi.bean.QueryCurrentTaskRespBean
|
||||
@@ -70,15 +66,13 @@ import com.mogo.och.taxi.callback.ITaxiADASStatusCallback
|
||||
import com.mogo.och.taxi.callback.ITaxiCarOperationalCallback
|
||||
import com.mogo.och.taxi.callback.ITaxiControllerStatusCallback
|
||||
import com.mogo.och.taxi.callback.ITaxiOrderStatusCallback
|
||||
import com.mogo.och.taxi.constant.TaskTypeEnum
|
||||
import com.mogo.och.taxi.constant.TaxiOrderStatusEnum
|
||||
import com.mogo.och.taxi.constant.TaxiOrderStatusEnum.Companion.valueOf
|
||||
import com.mogo.och.taxi.constant.TaxiUnmannedConst
|
||||
import com.mogo.och.taxi.constant.TaxtServingStatusManager.isOpeningOrderStatus
|
||||
import com.mogo.och.taxi.constant.TaxiUnmannedConst.Companion.TIMER_PREPARE_TASK_INTERVAL
|
||||
import com.mogo.och.taxi.network.CarServiceManager.arriveSite
|
||||
import com.mogo.och.taxi.network.CarServiceManager.endService
|
||||
import com.mogo.och.taxi.network.CarServiceManager.prepareTask
|
||||
import com.mogo.och.taxi.network.CarServiceManager.startService
|
||||
import com.mogo.och.taxi.network.CarServiceManager.startTask
|
||||
import com.mogo.och.taxi.utils.TaxiAnalyticsManager
|
||||
import com.mogo.och.taxi.utils.TaxiTrajectoryManager
|
||||
import com.zhjt.service.chain.ChainLog
|
||||
@@ -105,7 +99,7 @@ object TaxiModel {
|
||||
|
||||
private var mCurrentTaskAndOrder : QueryCurrentTaskRespBean.Result? = null //当前任务和订单
|
||||
|
||||
private var mVirtualTask : StartServiceRespBean.Result? = null
|
||||
private var mUntruthTask : StartServiceRespBean.Result? = null
|
||||
|
||||
private var mADASStatusCallback //Model->Presenter:自动驾驶状态相关
|
||||
: ITaxiADASStatusCallback? = null
|
||||
@@ -122,11 +116,11 @@ object TaxiModel {
|
||||
|
||||
private val mRoutePoints: MutableList<MogoLocation>? = ArrayList()
|
||||
|
||||
private var mLongitude = 0.0
|
||||
private var mLatitude = 0.0
|
||||
private var mLocation: MogoLocation? = null
|
||||
// private var mLongitude = 0.0
|
||||
// private var mLatitude = 0.0
|
||||
// private var mLocation: MogoLocation? = null
|
||||
|
||||
private var loginService: LoginService? = null
|
||||
var loginService: LoginService? = null
|
||||
|
||||
fun setMoGoAutopilotPlanningListener(moGoAutopilotPlanningCallback: IOCHTaxiAutopilotPlanningCallback?) {
|
||||
mAutopilotPlanningCallback = moGoAutopilotPlanningCallback
|
||||
@@ -265,71 +259,6 @@ object TaxiModel {
|
||||
stopLoopAbnormalFactors()
|
||||
}
|
||||
|
||||
//更新接单状态
|
||||
fun updateCarStatus() {
|
||||
if (!isLogin()) {
|
||||
loginService!!.queryLoginStatusByNet()
|
||||
return
|
||||
}
|
||||
if (isOpeningOrderStatus()){//接单状态下,去结束
|
||||
endService(mContext!!,object : OchCommonServiceCallback<BaseData>{
|
||||
override fun onSuccess(data: BaseData?) {
|
||||
loginService!!.queryLoginStatusByNet()
|
||||
//需要将虚拟任务停掉, 虚拟任务会再开始接单后获取新的
|
||||
updateVirtualTask(null)
|
||||
}
|
||||
|
||||
override fun onError() {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
ToastUtils.showShort(mContext!!.getString(R.string.network_error_tip))
|
||||
} else {
|
||||
ToastUtils.showShort(mContext!!.getString(R.string.request_error_tip))
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String) {
|
||||
ToastUtilsOch.showWithCodeMessage(code, msg)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
}else{//暂停接单状态下,去接单
|
||||
startService(mContext!!,
|
||||
getChassisLocationGCJ02().latitude,
|
||||
getChassisLocationGCJ02().longitude,
|
||||
object: OchCommonServiceCallback<StartServiceRespBean>{
|
||||
override fun onSuccess(data: StartServiceRespBean?) {
|
||||
if (data == null || data.code != 0) return
|
||||
loginService!!.queryLoginStatusByNet()
|
||||
//虚拟任务要开启到站围栏
|
||||
updateVirtualTask(data.data)
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String?) {
|
||||
ToastUtilsOch.showWithCodeMessage(code, msg)
|
||||
}
|
||||
|
||||
override fun onError() {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
ToastUtils.showShort(mContext!!.getString(R.string.network_error_tip))
|
||||
} else {
|
||||
ToastUtils.showShort(mContext!!.getString(R.string.request_error_tip))
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateVirtualTask(result: StartServiceRespBean.Result?) {
|
||||
mVirtualTask = result
|
||||
if (result == null) return
|
||||
}
|
||||
|
||||
private fun startVirtualTask() {
|
||||
|
||||
}
|
||||
|
||||
// 获取当前订单状态
|
||||
fun getCurOrderStatus(): TaxiOrderStatusEnum? {
|
||||
if (mCurrentTaskAndOrder == null) TaxiOrderStatusEnum.None
|
||||
@@ -337,8 +266,12 @@ object TaxiModel {
|
||||
return valueOf(order.orderStatus)
|
||||
}
|
||||
|
||||
fun getCurTaskAndOrder(): QueryCurrentTaskRespBean.Result?{
|
||||
return mCurrentTaskAndOrder
|
||||
}
|
||||
|
||||
//更新本地currentOrder信息,并保存订单到本地避免车机重启丢失数据
|
||||
public fun updateNativeCurrentOrder(data: QueryCurrentTaskRespBean.Result?) {
|
||||
fun updateNativeCurrentOrder(data: QueryCurrentTaskRespBean.Result?) {
|
||||
if (data == null) {
|
||||
return
|
||||
}
|
||||
@@ -396,10 +329,14 @@ object TaxiModel {
|
||||
updateAutopilotControlParameters(null)
|
||||
}
|
||||
|
||||
public fun updateCurrentTaskAndOrder(result: QueryCurrentTaskRespBean.Result?){
|
||||
fun updateCurrentTaskAndOrder(result: QueryCurrentTaskRespBean.Result?){
|
||||
mCurrentTaskAndOrder = result
|
||||
}
|
||||
|
||||
fun updateUntruthTask(untruthTask : StartServiceRespBean.Result?) {
|
||||
mUntruthTask = untruthTask
|
||||
}
|
||||
|
||||
//清除任务订单信息
|
||||
fun clearCurrentOCHOrder() {
|
||||
startOrStopCalculateRouteInfo(false)
|
||||
@@ -419,13 +356,12 @@ object TaxiModel {
|
||||
|
||||
//检测当前订单
|
||||
fun checkCurrentTask(): Boolean {
|
||||
return mCurrentTaskAndOrder != null && mCurrentTaskAndOrder!!.endSite != null
|
||||
&& mCurrentTaskAndOrder!!.taskType != TaskTypeEnum.VirtualTask.code
|
||||
return mCurrentTaskAndOrder != null && mCurrentTaskAndOrder!!.startSite != null
|
||||
&& mCurrentTaskAndOrder!!.endSite != null
|
||||
}
|
||||
|
||||
fun checkCurrentOrder(): Boolean {
|
||||
return mCurrentTaskAndOrder != null && mCurrentTaskAndOrder!!.order != null
|
||||
&& mCurrentTaskAndOrder!!.taskType == TaskTypeEnum.ToOrderEndTask.code
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -553,18 +489,18 @@ object TaxiModel {
|
||||
}
|
||||
|
||||
//根据围栏判断,是否到达起点
|
||||
private fun judgeStartStation(location: MogoLocation) {
|
||||
if (checkCurrentOrder()) {
|
||||
val startSite = mCurrentTaskAndOrder!!.order!!.orderStartSite ?: return
|
||||
private fun judgeTaskStartStation(location: MogoLocation) {
|
||||
if (checkCurrentTask()) {
|
||||
val startSite = mCurrentTaskAndOrder!!.startSite ?: return
|
||||
val startLon = startSite.gcjLon
|
||||
val startLat = startSite.gcjLat
|
||||
val distance = CoordinateUtils.calculateLineDistance(
|
||||
startLon, startLat,
|
||||
location.longitude, location.latitude
|
||||
).toDouble()
|
||||
i(SceneConstant.M_TAXI + TAG, "judgeStartStation() distance = $distance")
|
||||
i(SceneConstant.M_TAXI + TAG, "judgeTaskStartStation() distance = $distance")
|
||||
if (distance <= TaxiUnmannedConst.ARRIVE_AT_START_STATION_DISTANCE) {
|
||||
arriveSite(startSite.siteId)
|
||||
arriveSite(startSite.siteId,false)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -617,75 +553,85 @@ object TaxiModel {
|
||||
//位置变化时,通过围栏判断是否到达x点
|
||||
if (null == mogoLocation) return
|
||||
|
||||
if (mVirtualTask != null){
|
||||
judgeVirtualStation(mVirtualTask,mogoLocation)
|
||||
if (mUntruthTask != null){
|
||||
judgeUntruthStation(mUntruthTask,mogoLocation)
|
||||
}
|
||||
|
||||
if (checkCurrentOrder()) {
|
||||
if (getCurOrderStatus() === TaxiOrderStatusEnum.OnTheWayToStart) {
|
||||
judgeStartStation(mogoLocation)
|
||||
}
|
||||
if (getCurOrderStatus() === TaxiOrderStatusEnum.OnTheWayToEnd &&
|
||||
getState() != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
|
||||
) {
|
||||
judgeEndStation(mogoLocation)
|
||||
}
|
||||
if (checkCurrentTask()){
|
||||
judgeTaskStartStation(mogoLocation)
|
||||
judgeTaskEndSiteStation(mogoLocation)
|
||||
}
|
||||
|
||||
mLongitude = mogoLocation.longitude
|
||||
mLatitude = mogoLocation.latitude
|
||||
mLocation = mogoLocation
|
||||
if (mControllerStatusCallback != null) {
|
||||
mControllerStatusCallback!!.onCarLocationChanged(mogoLocation)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun judgeVirtualStation(virtualTask: StartServiceRespBean.Result?,currentLocation: MogoLocation) {
|
||||
if (mVirtualTask == null || virtualTask == null) return
|
||||
private fun judgeUntruthStation(virtualTask: StartServiceRespBean.Result?, currentLocation: MogoLocation) {
|
||||
if (mUntruthTask == null || virtualTask == null) return
|
||||
val distance = CoordinateUtils.calculateLineDistance(
|
||||
virtualTask.gcjLon, virtualTask.gcjLat,
|
||||
currentLocation.longitude, currentLocation.latitude
|
||||
).toDouble()
|
||||
i(SceneConstant.M_TAXI + TAG, "judgeEndStation() ${virtualTask.siteName} distance = $distance")
|
||||
if (distance <= TaxiUnmannedConst.ARRIVE_AT_START_STATION_DISTANCE) { // 15米内到站
|
||||
arriveSite(virtualTask.siteId)
|
||||
arriveSite(virtualTask.siteId, true)
|
||||
}
|
||||
}
|
||||
|
||||
private fun arriveSite(siteId: Int) {
|
||||
private fun arriveSite(siteId: Int, isArriveEndSite: Boolean) {
|
||||
arriveSite(mContext!!,siteId,object : OchCommonServiceCallback<BaseData>{
|
||||
override fun onSuccess(data: BaseData?) {
|
||||
if (data == null || data.code != 0) return
|
||||
//到站后去查询下一个任务
|
||||
startPrepareTask(siteId)
|
||||
d(SceneConstant.M_TAXI + TAG,GsonUtil.jsonFromObject(data))
|
||||
mUntruthTask = null
|
||||
if (isArriveEndSite){
|
||||
//到目的站后去查询下一个任务
|
||||
startPrepareTask(siteId)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String?) {
|
||||
TODO("Not yet implemented")
|
||||
d(SceneConstant.M_TAXI + TAG,"$code $msg")
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
private fun startTask(lineId: Int) {
|
||||
startTask(mContext!!, lineId,object : OchCommonServiceCallback<BaseData>{
|
||||
override fun onSuccess(data: BaseData?) {
|
||||
d(SceneConstant.M_TAXI + TAG,GsonUtil.jsonFromObject(data))
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String?) {
|
||||
d(SceneConstant.M_TAXI + TAG,"$code $msg")
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
private fun startPrepareTask(siteId: Int) {
|
||||
prepareTask(mContext!!,siteId,object : OchCommonServiceCallback<PrepareTaskRespBean>{
|
||||
override fun onSuccess(data: PrepareTaskRespBean?) {
|
||||
TODO("送驾任务不显示,普通演练任务要显示")
|
||||
}
|
||||
UiThreadHandler.postDelayed({
|
||||
prepareTask(mContext!!,siteId,object : OchCommonServiceCallback<PrepareTaskRespBean>{
|
||||
override fun onSuccess(data: PrepareTaskRespBean?) {
|
||||
d(SceneConstant.M_TAXI + TAG,GsonUtil.jsonFromObject(data))
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String?) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
override fun onFail(code: Int, msg: String?) {
|
||||
d(SceneConstant.M_TAXI + TAG,"$code $msg")
|
||||
}
|
||||
|
||||
})
|
||||
})
|
||||
},TIMER_PREPARE_TASK_INTERVAL)
|
||||
}
|
||||
|
||||
private fun judgeEndStation(currentLocation: MogoLocation) {
|
||||
if (!checkCurrentOrder()) {
|
||||
private fun judgeTaskEndSiteStation(currentLocation: MogoLocation) {
|
||||
if (!checkCurrentTask()) {
|
||||
return
|
||||
}
|
||||
val endSite = mCurrentTaskAndOrder!!.order!!.orderEndSite ?: return
|
||||
val endSite = mCurrentTaskAndOrder!!.endSite ?: return
|
||||
|
||||
val endLon = endSite.gcjLon
|
||||
val endLat = endSite.gcjLat
|
||||
@@ -695,12 +641,6 @@ object TaxiModel {
|
||||
).toDouble()
|
||||
i(SceneConstant.M_TAXI + TAG, "judgeEndStation() distance = $distance")
|
||||
if (distance <= TaxiUnmannedConst.ARRIVE_AT_START_STATION_DISTANCE) { //1、当前位置和站点围栏15m内
|
||||
if ((!checkCurrentOrder()
|
||||
|| (getCurOrderStatus() === TaxiOrderStatusEnum.ArriveAtEnd))
|
||||
) {
|
||||
i(SceneConstant.M_TAXI + TAG, "order exception or order ArriveAtEnd")
|
||||
return
|
||||
}
|
||||
|
||||
//2、开始计算当前位置和站点的向量角度 < 90度 未经过 >90度 经过
|
||||
val stationAngle = DrivingDirectionUtils.getDegreeOfCar2Poi(
|
||||
@@ -723,7 +663,7 @@ object TaxiModel {
|
||||
return
|
||||
}
|
||||
i(SceneConstant.M_TAXI + TAG, "judgeEndStation() = 刚过站且在15m内")
|
||||
arriveSite(endSite.siteId)
|
||||
arriveSite(endSite.siteId,true)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -732,33 +672,37 @@ object TaxiModel {
|
||||
* 订单流转debug START
|
||||
*/
|
||||
fun setArriveAtStartStation() {
|
||||
// if ((mCurrentOrder == null
|
||||
// || mCurrentOrder!!.orderStatus != TaxiOrderStatusEnum.OnTheWayToStart.code)
|
||||
// ) {
|
||||
// ToastUtils.showShort("订单状态不匹配该操作!")
|
||||
// return
|
||||
// }
|
||||
// TODO: 调用到达起点 arrivedStartPoint()
|
||||
}
|
||||
|
||||
fun setArriveAtEndStation() {
|
||||
if (checkCurrentOrder()) {
|
||||
if (!checkCurrentTask()) {
|
||||
ToastUtils.showShort("订单状态不匹配该操作!")
|
||||
return
|
||||
}
|
||||
// TODO: arriveSite()
|
||||
arriveSite(mCurrentTaskAndOrder?.startSite!!.siteId,false)
|
||||
}
|
||||
|
||||
fun setArriveAtEndStation() {
|
||||
if (!checkCurrentTask()) {
|
||||
ToastUtils.showShort("无任务!")
|
||||
return
|
||||
}
|
||||
arriveSite(mCurrentTaskAndOrder?.endSite!!.siteId,true)
|
||||
}
|
||||
|
||||
fun toStartTask() {
|
||||
if (!checkCurrentTask()){
|
||||
ToastUtils.showShort("无任务!")
|
||||
return
|
||||
}
|
||||
mCurrentTaskAndOrder?.lineId?.let { startTask(it) }
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试开启自动驾驶
|
||||
*/
|
||||
fun setOnTheWayToEndStation() {
|
||||
// if ((mCurrentOrder == null
|
||||
// || mCurrentOrder!!.orderStatus != TaxiOrderStatusEnum.UserArriveAtStart.code)
|
||||
// ) {
|
||||
// ToastUtils.showShort("订单状态不匹配该操作!")
|
||||
// }
|
||||
// TODO: 调用开始任务 startServicePilotDone()
|
||||
if (!checkCurrentOrder()) {
|
||||
ToastUtils.showShort("订单状态不匹配该操作!")
|
||||
}
|
||||
startAutoPilot()
|
||||
}
|
||||
|
||||
private val mGoAutopilotStatusListener: IMoGoAutopilotStatusListener =
|
||||
@@ -868,7 +812,7 @@ object TaxiModel {
|
||||
if (!checkCurrentOrder()) return
|
||||
val endSite = mCurrentTaskAndOrder!!.order!!.orderEndSite
|
||||
if (endSite != null){
|
||||
arriveSite(endSite.siteId)
|
||||
arriveSite(endSite.siteId,true)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1032,7 +976,7 @@ object TaxiModel {
|
||||
|
||||
// 登出
|
||||
fun logout() {
|
||||
loginService!!.loginOut(mLatitude, mLongitude)
|
||||
loginService!!.loginOut(getChassisLocationGCJ02().latitude, getChassisLocationGCJ02().longitude)
|
||||
}
|
||||
|
||||
//导航去订单终点目的地
|
||||
|
||||
@@ -1,18 +1,26 @@
|
||||
package com.mogo.och.taxi.model
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.i
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.och.common.module.biz.constant.LoginStatusManager.isLogin
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.common.module.biz.constant.LoginStatusManager
|
||||
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback
|
||||
import com.mogo.och.common.module.utils.ToastUtilsOch
|
||||
import com.mogo.och.taxi.R
|
||||
import com.mogo.och.taxi.base.BaseViewModel
|
||||
import com.mogo.och.taxi.base.IUiIntent
|
||||
import com.mogo.och.taxi.bean.PrepareTaskRespBean
|
||||
import com.mogo.och.taxi.bean.QueryCurrentTaskRespBean
|
||||
import com.mogo.och.taxi.bean.StartServiceRespBean
|
||||
import com.mogo.och.taxi.constant.TaxiUnmannedConst
|
||||
import com.mogo.och.taxi.constant.TaxtServingStatusManager.isOpeningOrderStatus
|
||||
import com.mogo.och.taxi.constant.TaxtServingStatusManager
|
||||
import com.mogo.och.taxi.network.CarServiceManager
|
||||
import com.mogo.och.taxi.ui.unmanned.TaskAndOrderUiState
|
||||
import com.mogo.och.taxi.ui.unmanned.UnmannedIntent
|
||||
@@ -32,6 +40,8 @@ class TaxiUnmannedViewModel : BaseViewModel<UnmannedState, UnmannedIntent>(){
|
||||
private var mInAndWaitServiceDisposable: Disposable? = null //进行中、待服务订单列表轮询
|
||||
private var mCurrentTaskAndOrder: QueryCurrentTaskRespBean.Result? = null
|
||||
private val TAG = "TaxiUnmannedViewModel"
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private var mContext : Context = AbsMogoApplication.getApp().applicationContext
|
||||
|
||||
init {
|
||||
startOrStopOrderLoop(true)
|
||||
@@ -44,6 +54,10 @@ class TaxiUnmannedViewModel : BaseViewModel<UnmannedState, UnmannedIntent>(){
|
||||
override fun handleIntent(intent: IUiIntent) {
|
||||
when(intent) {
|
||||
|
||||
is UnmannedIntent.StartOrPauseReceivingOrder -> {//开始、暂停接单
|
||||
updateCarStatus()
|
||||
}
|
||||
|
||||
is UnmannedIntent.GetNextTask -> {
|
||||
getNextTask()
|
||||
}
|
||||
@@ -74,6 +88,65 @@ class TaxiUnmannedViewModel : BaseViewModel<UnmannedState, UnmannedIntent>(){
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新接单状态
|
||||
*/
|
||||
private fun updateCarStatus() {
|
||||
if (!LoginStatusManager.isLogin()) {
|
||||
TaxiModel.loginService!!.queryLoginStatusByNet()
|
||||
return
|
||||
}
|
||||
if (TaxtServingStatusManager.isOpeningOrderStatus()){//接单状态下,去结束
|
||||
CarServiceManager.endService(mContext,
|
||||
object : OchCommonServiceCallback<BaseData> {
|
||||
override fun onSuccess(data: BaseData?) {
|
||||
TaxiModel.loginService!!.queryLoginStatusByNet()
|
||||
//需要将虚拟任务停掉, 虚拟任务会再开始接单后获取新的
|
||||
updateUntruthTask(null)
|
||||
}
|
||||
|
||||
override fun onError() {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
ToastUtils.showShort(mContext.getString(R.string.network_error_tip))
|
||||
} else {
|
||||
ToastUtils.showShort(mContext.getString(R.string.request_error_tip))
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String) {
|
||||
ToastUtilsOch.showWithCodeMessage(code, msg)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
}else{//暂停接单状态下,去接单
|
||||
CarServiceManager.startService(mContext,
|
||||
CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02().latitude,
|
||||
CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02().longitude,
|
||||
object : OchCommonServiceCallback<StartServiceRespBean> {
|
||||
override fun onSuccess(data: StartServiceRespBean?) {
|
||||
if (data == null || data.code != 0) return
|
||||
TaxiModel.loginService!!.queryLoginStatusByNet()
|
||||
//虚拟任务要开启到站围栏
|
||||
updateUntruthTask(data.data)
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String?) {
|
||||
ToastUtilsOch.showWithCodeMessage(code, msg)
|
||||
}
|
||||
|
||||
override fun onError() {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
ToastUtils.showShort(mContext.getString(R.string.network_error_tip))
|
||||
} else {
|
||||
ToastUtils.showShort(mContext.getString(R.string.request_error_tip))
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
private fun getNextTask() {
|
||||
if (mCurrentTaskAndOrder != null && mCurrentTaskAndOrder!!.endSite != null){
|
||||
CarServiceManager.prepareTask(AbsMogoApplication.getApp().applicationContext,
|
||||
@@ -153,18 +226,30 @@ class TaxiUnmannedViewModel : BaseViewModel<UnmannedState, UnmannedIntent>(){
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateUntruthTask(result: StartServiceRespBean.Result?) {
|
||||
|
||||
TaxiModel.updateUntruthTask(result)
|
||||
|
||||
sendUiState {
|
||||
copy(
|
||||
taskAndOrderUiState = TaskAndOrderUiState.UNTRUTHTASK(result)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateTaskAndOrderUi() {
|
||||
sendUiState {
|
||||
copy(
|
||||
taskAndOrderUiState = TaskAndOrderUiState.SUCCESS(mCurrentTaskAndOrder)
|
||||
taskAndOrderUiState = TaskAndOrderUiState.TASKANDORDER(mCurrentTaskAndOrder)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateNoTaskAndOrderUi() {
|
||||
|
||||
sendUiState {
|
||||
copy(
|
||||
taskAndOrderUiState = TaskAndOrderUiState.SUCCESS(null)
|
||||
taskAndOrderUiState = TaskAndOrderUiState.TASKANDORDER(null)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,12 +95,6 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
|
||||
TaxiModel.INSTANCE.startAutoPilot();
|
||||
}
|
||||
|
||||
// 更新接单状态
|
||||
public void updateCarStatus() {
|
||||
TaxiModel.INSTANCE.updateCarStatus();
|
||||
}
|
||||
|
||||
|
||||
// 获取当前订单状态
|
||||
public TaxiOrderStatusEnum getCurOrderStatus() {
|
||||
return TaxiModel.INSTANCE.getCurOrderStatus();
|
||||
@@ -209,6 +203,10 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
|
||||
runOnUIThread(() -> {
|
||||
mView.updateOperationStatus(TaxtServingStatusManager.isOpeningOrderStatus(), finalRole);
|
||||
});
|
||||
|
||||
if (!TaxiModel.INSTANCE.checkCurrentTask()){
|
||||
mView.showPanel();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -35,6 +35,7 @@ import com.mogo.och.taxi.R
|
||||
import com.mogo.och.taxi.bean.OrderDetail
|
||||
import com.mogo.och.taxi.bean.OrderQueryRouteInfoRespBean
|
||||
import com.mogo.och.taxi.bean.QueryCurrentTaskRespBean
|
||||
import com.mogo.och.taxi.bean.StartServiceRespBean
|
||||
import com.mogo.och.taxi.constant.TaskTypeEnum
|
||||
import com.mogo.och.taxi.constant.TaxiOrderStatusEnum
|
||||
import com.mogo.och.taxi.constant.TaxiUnmannedConst.Companion.TAXI_END_MAP_MAKER
|
||||
@@ -69,12 +70,12 @@ import kotlin.math.roundToInt
|
||||
class TaxiBeingTaskFragment : BaseFragment(),
|
||||
View.OnClickListener, ICommonNaviChangedCallback {
|
||||
|
||||
// private val mViewModel by viewModels<TaxiUnmannedViewModel>()
|
||||
private lateinit var mViewModel : TaxiUnmannedViewModel
|
||||
|
||||
@Volatile
|
||||
private var mTtsLessThan200Tip = 0 //离终点200米提示播报
|
||||
private var mCurrentTaskAndOrder: QueryCurrentTaskRespBean.Result? = null
|
||||
private var mCurrentUntruthTask: StartServiceRespBean.Result? = null
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.unmanned_being_order
|
||||
@@ -111,19 +112,54 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
|
||||
}
|
||||
|
||||
is TaskAndOrderUiState.SUCCESS -> {
|
||||
if (state.model == null){
|
||||
isHaveBeingOrder(true)
|
||||
is TaskAndOrderUiState.TASKANDORDER -> {
|
||||
mCurrentTaskAndOrder = state.model
|
||||
if (state.model == null && mCurrentUntruthTask == null){
|
||||
isHaveBeingOrder(false)
|
||||
return@collect
|
||||
}
|
||||
updateCurrentOrderStatusChanged(state.model)
|
||||
}
|
||||
|
||||
is TaskAndOrderUiState.UNTRUTHTASK -> {
|
||||
mCurrentUntruthTask = state.untruthTask
|
||||
if (state.untruthTask == null && mCurrentTaskAndOrder == null){
|
||||
isHaveBeingOrder(false)
|
||||
return@collect
|
||||
}
|
||||
isHaveBeingOrder(true)
|
||||
updateCurrentOrderStatusChanged(state.model)
|
||||
updateUntruthTask(state.untruthTask)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateUntruthTask(untruthTask: StartServiceRespBean.Result?) {
|
||||
if (untruthTask == null) return
|
||||
updateUntruthTaskView()
|
||||
updateUntruthTaskUIData(untruthTask.siteName)
|
||||
}
|
||||
|
||||
private fun updateUntruthTaskUIData(siteName: String) {
|
||||
taskStatus.text = resources.getString(R.string.task_start_to_virtual_site)
|
||||
startStationName.text = resources.getString(R.string.task_current_loc)
|
||||
endStationName.text = siteName
|
||||
// TODO("剩余历程和时间导航去更新taskOtherInfo")
|
||||
}
|
||||
|
||||
private fun updateUntruthTaskView() {
|
||||
taskStatus.visibility = View.VISIBLE
|
||||
taskTypeTv.visibility = View.VISIBLE
|
||||
orderPhoneAndNum.visibility = View.GONE
|
||||
startStationName.visibility = View.VISIBLE
|
||||
endStationName.visibility = View.VISIBLE
|
||||
taskClickBtn.visibility = View.GONE
|
||||
naviToStart.visibility = View.GONE
|
||||
naviToEnd.visibility = View.VISIBLE
|
||||
taskOtherInfo.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
private fun initOnClickListener() {
|
||||
cancelOrder.setOnClickListener(this)
|
||||
taskStatus.setOnClickListener(this)
|
||||
@@ -140,7 +176,11 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
@SuppressLint("SetTextI18n", "UseCompatLoadingForDrawables")
|
||||
fun updateCurrentOrderStatusChanged(taskAndOrder: QueryCurrentTaskRespBean.Result?) {
|
||||
if (taskAndOrder == null) return
|
||||
if (taskAndOrder.endSite == null && taskAndOrder.order == null) return
|
||||
if (taskAndOrder.endSite == null && taskAndOrder.order == null){
|
||||
isHaveBeingOrder(false)
|
||||
return
|
||||
}
|
||||
isHaveBeingOrder(true)
|
||||
/**
|
||||
* 根据任务类型判断任务显示,
|
||||
* 虚拟单, 显示在进行中 前往上车点
|
||||
@@ -163,7 +203,7 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
taskTypeTv.text = resources.getString(R.string.task_exercise)
|
||||
startStationName.text = startSite.siteName
|
||||
endStationName.text = endSite.siteName
|
||||
TODO("剩余历程和时间导航去更新taskOtherInfo")
|
||||
// TODO("剩余历程和时间导航去更新taskOtherInfo")
|
||||
}
|
||||
TaskTypeEnum.ToOrderEndTask.code,TaskTypeEnum.ToOrderStartTask.code -> {// 送驾/接驾任务任务
|
||||
if (order == null) return
|
||||
@@ -173,7 +213,7 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
startStationName.text = order.orderStartSite?.siteName
|
||||
endStationName.text = order.orderEndSite?.siteName
|
||||
updateOrderUI(order)
|
||||
TODO("剩余历程和时间导航去更新taskOtherInfo")
|
||||
// TODO("剩余历程和时间导航去更新taskOtherInfo")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -183,7 +223,7 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
when(order.orderStatus){
|
||||
|
||||
TaxiOrderStatusEnum.None.code -> { //无
|
||||
TODO("显示无订单页面")
|
||||
// TODO("显示无订单页面")
|
||||
}
|
||||
|
||||
TaxiOrderStatusEnum.Cancel.code -> { //取消
|
||||
@@ -377,9 +417,8 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
}
|
||||
|
||||
private fun updateUIShowStatus(taskType: Int, currentStatus: Int, order: OrderDetail?) {
|
||||
if (order == null) return
|
||||
when (taskType) {
|
||||
TaskTypeEnum.VirtualTask.code,TaskTypeEnum.ToOrderStartTask.code -> { //虚拟单、演练单
|
||||
TaskTypeEnum.VirtualTask.code -> { //演练单
|
||||
taskStatus.visibility = View.VISIBLE
|
||||
taskTypeTv.visibility = View.VISIBLE
|
||||
orderPhoneAndNum.visibility = View.GONE
|
||||
@@ -391,7 +430,8 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
naviToEnd.visibility = if (currentStatus == 2) View.VISIBLE else View.GONE
|
||||
taskOtherInfo.visibility = if (currentStatus == 0) View.GONE else View.VISIBLE
|
||||
}
|
||||
TaskTypeEnum.ToOrderEndTask.code -> {// 运营单
|
||||
TaskTypeEnum.ToOrderEndTask.code,TaskTypeEnum.ToOrderStartTask.code -> {// 运营单(接驾任务、送驾任务)
|
||||
if (order == null) return
|
||||
taskStatus.visibility = View.VISIBLE
|
||||
taskTypeTv.visibility = View.VISIBLE
|
||||
orderPhoneAndNum.visibility = View.VISIBLE
|
||||
@@ -551,13 +591,13 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
if (being) {
|
||||
noTaskData.visibility = View.GONE
|
||||
mBeingOrderLayout.visibility = View.VISIBLE
|
||||
mTaxiFragment!!.changeOperationViewVisible(View.GONE)
|
||||
// mTaxiFragment!!.changeOperationViewVisible(View.GONE)
|
||||
clearSmallMapRouteLine()
|
||||
} else {
|
||||
noTaskData.visibility = View.VISIBLE
|
||||
noOrderDataTv.text = "暂无进行中订单"
|
||||
mBeingOrderLayout.visibility = View.GONE
|
||||
mTaxiFragment!!.changeOperationViewVisible(View.VISIBLE)
|
||||
// mTaxiFragment!!.changeOperationViewVisible(View.VISIBLE)
|
||||
}
|
||||
} catch (e: NullPointerException) { //可能会出现订单信息已经轮询回来,但进行中页面控件还未初始化完成的情况
|
||||
TaxiModel.clearCurrentOCHOrder()
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
package com.mogo.och.taxi.ui
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.fragment.app.FragmentTransaction
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.commons.module.status.MogoStatusManager
|
||||
import com.mogo.eagle.core.data.temp.EventLogout
|
||||
@@ -23,11 +21,14 @@ import com.mogo.och.taxi.R
|
||||
import com.mogo.och.taxi.base.BaseTaxiTabFragment
|
||||
import com.mogo.och.taxi.constant.TaxiOrderStatusEnum
|
||||
import com.mogo.och.taxi.model.TaxiModel
|
||||
import com.mogo.och.taxi.model.TaxiUnmannedViewModel
|
||||
import com.mogo.och.taxi.network.LoginBusImpl
|
||||
import com.mogo.och.taxi.presenter.TaxiPresenter
|
||||
import com.mogo.och.taxi.ui.unmanned.UnmannedIntent
|
||||
import com.mogo.och.taxi.utils.TPRouteDataTestUtils
|
||||
import kotlinx.android.synthetic.main.taxi_base_fragment.module_mogo_och_operation_status
|
||||
import kotlinx.android.synthetic.main.taxi_base_fragment.taxi_driver_role_tv
|
||||
import kotlinx.coroutines.flow.map
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
import org.greenrobot.eventbus.ThreadMode
|
||||
@@ -42,6 +43,7 @@ class TaxiFragment : BaseTaxiTabFragment<TaxiFragment, TaxiPresenter>(),
|
||||
private var serverOrdersFragmentWR: WeakReference<TaxiServerOrdersFragment>? = null
|
||||
private var personalDialogFragment: WeakReference<TaxiPersonalDialogFragment>? = null
|
||||
private var loginService: LoginService? = null
|
||||
private lateinit var mViewModel : TaxiUnmannedViewModel
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
@@ -52,6 +54,11 @@ class TaxiFragment : BaseTaxiTabFragment<TaxiFragment, TaxiPresenter>(),
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
mViewModel = ViewModelProvider(this, ViewModelProvider.NewInstanceFactory()).get(TaxiUnmannedViewModel::class.java)
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
@@ -67,10 +74,7 @@ class TaxiFragment : BaseTaxiTabFragment<TaxiFragment, TaxiPresenter>(),
|
||||
|
||||
override fun startAutopilot() {
|
||||
// 在自动驾驶中,或者自己确认车辆环境可开启自动驾驶 则可点击
|
||||
if ((mPresenter.curOrderStatus === TaxiOrderStatusEnum.OnTheWayToEnd ||
|
||||
mPresenter.curOrderStatus === TaxiOrderStatusEnum.UserArriveAtStart)
|
||||
&& !isStarting
|
||||
) {
|
||||
if (!isStarting) {
|
||||
d(SceneConstant.M_TAXI + TAG, "startAutopilot")
|
||||
mPresenter.startAutoPilot()
|
||||
}
|
||||
@@ -111,7 +115,7 @@ class TaxiFragment : BaseTaxiTabFragment<TaxiFragment, TaxiPresenter>(),
|
||||
|
||||
override fun onChangeOperationStatus() {
|
||||
super.onChangeOperationStatus()
|
||||
mPresenter.updateCarStatus()
|
||||
mViewModel.sendUiIntent(UnmannedIntent.StartOrPauseReceivingOrder)
|
||||
}
|
||||
|
||||
fun switchVRFlatMode(isVRMode: Boolean) {
|
||||
@@ -161,7 +165,6 @@ class TaxiFragment : BaseTaxiTabFragment<TaxiFragment, TaxiPresenter>(),
|
||||
null,
|
||||
null
|
||||
)
|
||||
hidPanel()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -201,6 +204,10 @@ class TaxiFragment : BaseTaxiTabFragment<TaxiFragment, TaxiPresenter>(),
|
||||
TaxiModel.setArriveAtEndStation()
|
||||
}
|
||||
|
||||
findViewById<View>(R.id.test_bar_start_service_confirm)?.setOnClickListener{
|
||||
TaxiModel.toStartTask()
|
||||
}
|
||||
|
||||
findViewById<View>(R.id.test_bar_on_the_way_to_end)?.setOnClickListener {
|
||||
if (!isStarting) {
|
||||
mPresenter.startAutoPilot()
|
||||
@@ -248,29 +255,31 @@ class TaxiFragment : BaseTaxiTabFragment<TaxiFragment, TaxiPresenter>(),
|
||||
private var testCurStopMd5DPQP: TextView? = null
|
||||
@SuppressLint("SetTextI18n")
|
||||
fun clickTestBar() {
|
||||
// if (testBar == null) {
|
||||
// testBar = findViewById<View>(R.id.module_och_taxi_order_status_change_test_bar)
|
||||
// testCurOrderId = findViewById<TextView>(R.id.test_bar_current_order_id)
|
||||
// testCurLineId = findViewById<TextView>(R.id.test_bar_current_line_id)
|
||||
// testCurTrajMd5 = findViewById<TextView>(R.id.test_bar_current_traj_md5)
|
||||
// testCurStopMd5 = findViewById<TextView>(R.id.test_bar_current_stop_md5)
|
||||
// testCurTrajMd5DPQP = findViewById<TextView>(R.id.test_bar_current_traj_md5_dpqp)
|
||||
// testCurStopMd5DPQP = findViewById<TextView>(R.id.test_bar_current_stop_md5_dpqp)
|
||||
// }
|
||||
// if (testBar!!.visibility == View.VISIBLE) {
|
||||
// testBar!!.visibility = View.GONE
|
||||
// } else {
|
||||
// val order = TaxiModel.getCurrentOrder()
|
||||
// testCurOrderId!!.text = "orderNo:" + (order?.orderNo?.toString() ?: "")
|
||||
// testCurLineId!!.text = "lineId:" + (order?.lineId?.toString() ?: "")
|
||||
if (testBar == null) {
|
||||
testBar = findViewById<View>(R.id.module_och_taxi_order_status_change_test_bar)
|
||||
testCurOrderId = findViewById<TextView>(R.id.test_bar_current_order_id)
|
||||
testCurLineId = findViewById<TextView>(R.id.test_bar_current_line_id)
|
||||
testCurTrajMd5 = findViewById<TextView>(R.id.test_bar_current_traj_md5)
|
||||
testCurStopMd5 = findViewById<TextView>(R.id.test_bar_current_stop_md5)
|
||||
testCurTrajMd5DPQP = findViewById<TextView>(R.id.test_bar_current_traj_md5_dpqp)
|
||||
testCurStopMd5DPQP = findViewById<TextView>(R.id.test_bar_current_stop_md5_dpqp)
|
||||
}
|
||||
if (testBar!!.visibility == View.VISIBLE) {
|
||||
testBar!!.visibility = View.GONE
|
||||
} else {
|
||||
val result = TaxiModel.getCurTaskAndOrder()
|
||||
val task = result?.endSite
|
||||
val order = result?.order
|
||||
testCurOrderId!!.text = ":" + (order?.orderNo ?: "")
|
||||
testCurLineId!!.text = "lineId:" + (result?.lineId.toString() ?: "")
|
||||
// testCurTrajMd5!!.text = "TMd5:" + if (order == null) "" else order.csvFileMd5
|
||||
// testCurStopMd5!!.text = "SMd5:" + if (order == null) "" else order.txtFileMd5
|
||||
// testCurTrajMd5DPQP!!.text =
|
||||
// "TMd5DPQP:" + if (order == null) "" else order.csvFileMd5DPQP
|
||||
// testCurStopMd5DPQP!!.text =
|
||||
// "SMd5DPQP:" + if (order == null) "" else order.txtFileMd5DPQP
|
||||
// testBar!!.visibility = View.VISIBLE
|
||||
// }
|
||||
testBar!!.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
|
||||
@@ -7,7 +7,7 @@ import android.graphics.Color
|
||||
import android.graphics.drawable.GradientDrawable
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.mogo.commons.mvp.BaseFragment
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
@@ -36,8 +36,12 @@ import kotlinx.coroutines.flow.map
|
||||
*/
|
||||
class TaxiReserveOrderFragment : BaseFragment() {
|
||||
private val mData: MutableList<QueryCurrentTaskRespBean.Result> = ArrayList()
|
||||
private lateinit var mViewModel : TaxiUnmannedViewModel
|
||||
|
||||
private val mViewModel by viewModels<TaxiUnmannedViewModel>()
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
mViewModel = ViewModelProvider(this, ViewModelProvider.NewInstanceFactory()).get(TaxiUnmannedViewModel::class.java)
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.unmanned_being_order
|
||||
@@ -65,7 +69,7 @@ class TaxiReserveOrderFragment : BaseFragment() {
|
||||
|
||||
}
|
||||
|
||||
is TaskAndOrderUiState.SUCCESS -> {
|
||||
is TaskAndOrderUiState.TASKANDORDER -> {
|
||||
updateOrderChanged(state.model)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,11 +11,8 @@ sealed class UnmannedIntent: IUiIntent{
|
||||
//获取接单/暂停接单状态
|
||||
object GetReceivingOrderState : UnmannedIntent()
|
||||
|
||||
//开始接单
|
||||
object StartReceivingOrder : UnmannedIntent()
|
||||
|
||||
//暂停接单
|
||||
object PauseReceivingOrder : UnmannedIntent()
|
||||
//开始接单 、 暂停接单
|
||||
object StartOrPauseReceivingOrder : UnmannedIntent()
|
||||
|
||||
//获取当前任务信息
|
||||
object GetCurrentTask : UnmannedIntent()
|
||||
@@ -23,9 +20,6 @@ sealed class UnmannedIntent: IUiIntent{
|
||||
//到站获取下一个执行的任务信息
|
||||
object GetNextTask: UnmannedIntent()
|
||||
|
||||
//轮询订单
|
||||
object GetOrder: UnmannedIntent()
|
||||
|
||||
//开始接单后获取要前往的虚拟站点
|
||||
object GetVirtualStation: UnmannedIntent()
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.mogo.och.taxi.base.IUiState
|
||||
import com.mogo.och.taxi.bean.OrderDetail
|
||||
import com.mogo.och.taxi.bean.QueryCurrentTaskRespBean
|
||||
import com.mogo.och.taxi.bean.Site
|
||||
import com.mogo.och.taxi.bean.StartServiceRespBean
|
||||
|
||||
sealed class TaskUiState {
|
||||
object INIT : TaskUiState()
|
||||
@@ -17,7 +18,9 @@ sealed class OrderUiState {
|
||||
|
||||
sealed class TaskAndOrderUiState {
|
||||
object INIT : TaskAndOrderUiState()
|
||||
data class SUCCESS(val model: QueryCurrentTaskRespBean.Result?) : TaskAndOrderUiState()
|
||||
data class TASKANDORDER(val model: QueryCurrentTaskRespBean.Result?) : TaskAndOrderUiState()//演练、接驾、送驾任务
|
||||
|
||||
data class UNTRUTHTASK(val untruthTask: StartServiceRespBean.Result?) : TaskAndOrderUiState()//伪任务
|
||||
}
|
||||
|
||||
data class UnmannedState(val taskAndOrderUiState: TaskAndOrderUiState) : IUiState
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
android:id="@+id/test_bar_to_start"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="到达上车点"
|
||||
android:text="到达起点"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<Button
|
||||
@@ -91,7 +91,7 @@
|
||||
android:id="@+id/test_bar_to_end"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="到达目的地"
|
||||
android:text="到达终点"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<Button
|
||||
|
||||
@@ -13,8 +13,6 @@
|
||||
android:layout_height="match_parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/taskStatus"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -170,9 +168,10 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/dp_40"
|
||||
app:layout_goneMarginBottom="@dimen/dp_172"
|
||||
android:textSize="@dimen/dp_30"
|
||||
android:textColor="@color/station_tag_color"
|
||||
android:text="距离--公里, 用时间--分钟"
|
||||
android:text="距离 -- 公里, 用时 -- 分钟"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/taskStatus"
|
||||
app:layout_constraintBottom_toTopOf="@+id/taskClickBtn" />
|
||||
|
||||
@@ -188,7 +187,7 @@
|
||||
android:textSize="@dimen/dp_44"
|
||||
app:layout_constraintBottom_toBottomOf="parent" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
<include
|
||||
android:id="@+id/noTaskData"
|
||||
layout="@layout/taxi_no_data_common_view"
|
||||
|
||||
@@ -124,7 +124,7 @@
|
||||
},
|
||||
"saas": {
|
||||
"qa": {
|
||||
"och_url": "https://mogogo-driver-qa.zhidaozhixing.com",
|
||||
"och_url": "http://10.0.0.182:30560",
|
||||
"shuttle_url": "https://mogogo-driver-qa.zhidaozhixing.com",
|
||||
"passport_url": "https://mogogo-driver-qa.zhidaozhixing.com/arch/passport/",
|
||||
"socket_base_url": "https://mogogo-driver-qa.zhidaozhixing.com/arch/push/",
|
||||
|
||||
Reference in New Issue
Block a user