[6.1.2优化] 开始到站立马到站问题处理

This commit is contained in:
wangmingjun
2023-10-23 19:29:05 +08:00
parent 376162db44
commit 739b4d79ac
2 changed files with 37 additions and 8 deletions

View File

@@ -103,19 +103,19 @@ class TaxiCurrentTaskViewModel : BaseViewModel<UnmannedState, TaskUiIntent>(),
}
private fun jumpPassengerCheck() {
DebugView.printInfoMsg("[开始服务] 准备发送请求")
DebugView.printInfoMsg("[跳过乘客验证] 准备发送请求")
val currentTaskWithOrder = TaxiTaskModel.getCurrentTaskWithOrder()
currentTaskWithOrder?.order?.also {
TaxiTaskWithOrderServiceManager.jumpPassengerCheck(AbsMogoApplication.getApp().applicationContext,
it.orderNo,
object : OchCommonServiceCallback<BaseData> {
override fun onSuccess(data: BaseData?) {
DebugView.printInfoMsg("[开始服务] 请求success")
DebugView.printInfoMsg("[跳过乘客验证] 请求success")
d(TAG, "jumpPassengerCheck onSuccess:")
}
override fun onFail(code: Int, msg: String?) {
DebugView.printInfoMsg("[开始服务] 请求fail, code=$code, msg=$msg")
DebugView.printInfoMsg("[跳过乘客验证] 请求fail, code=$code, msg=$msg")
d(TAG, "jumpPassengerCheck onFail: code=$code, msg=$msg")
}
})

View File

@@ -325,7 +325,34 @@ object TaxiTaskModel {
)
return
}
autopilotArriveAtStation()
//围栏已经到站, 拉取到下一个任务, 此时自驾的到站才传递过来, 导致直接上报了当前任务的终点站到站, 造成任务一开始立马到站的问题
//解决方案: 根据自驾到站的经纬度和当前任务终点站的坐标比对, 如果距离在15米内, 则任务到站正确, 否则不请求到站
if (!checkCurrentTaskCondition()) return
val endSiteLat: Double? = mCurrentTaskWithOrder?.endSite?.gcjLat
val endSiteLon: Double? = mCurrentTaskWithOrder?.endSite?.gcjLon
val mapEndSiteLatWgs: Double? = arrivalNotification?.endLocation?.latitude
val mapEndSiteLonWgs: Double? = arrivalNotification?.endLocation?.longitude
if (endSiteLon != null && endSiteLat != null && mapEndSiteLonWgs != null && mapEndSiteLatWgs != null){
var latLngs = CoordinateUtils.transformWgsToGcj(mapEndSiteLatWgs,mapEndSiteLonWgs)
val distance = CoordinateUtils.calculateLineDistance(
endSiteLon, endSiteLat,
latLngs[0], latLngs[1]
).toDouble()
if (distance <= TaxiUnmannedConst.ARRIVE_AT_START_STATION_DISTANCE){// 两坐标小于15米
DebugView.printInfoMsg("[MAP到站通知] 到站坐标和任务终点15米内, 请求到站")
autopilotArriveAtStation()
}else{
DebugView.printInfoMsg("[MAP到站通知] 到站坐标和任务终点不一致, 不请求到站")
}
}else{
DebugView.printInfoMsg("[MAP到站通知] endSiteLat = $endSiteLat, endSiteLon = $endSiteLon, " +
"mapEndSiteLat = $mapEndSiteLatWgs, mapEndSiteLon = $mapEndSiteLonWgs")
}
if (FunctionBuildConfig.isDemoMode) {
// 当美化模式(演示模式)开启时: 到达目的地置false
// 2022.10.08 到达目的地时候取消自动起自驾, 服务完成取消引导线和自动驾驶按钮状态
@@ -550,8 +577,10 @@ object TaxiTaskModel {
isArrivedNearestStation: Boolean = false
) {
if (mIsArrivedSiteStartTag) {
DebugView.printInfoMsg("arriveSite接口正在调用中")
i(TAG, message = "arriveSite接口正在调用中 mIsArrivedSite = $mIsArrivedSiteStartTag")
DebugView.printInfoMsg("[上报ArriveSite] arriveSite接口正在调用中, 跳过本次请求" +
", siteId=$siteId, isArriveAtEndSite=$isArriveAtEndSite")
i(TAG, message = "arriveSite接口正在调用中, 跳过本次请求 mIsArrivedSite = $mIsArrivedSiteStartTag" +
", siteId=$siteId, isArriveAtEndSite=$isArriveAtEndSite")
return
}
mIsArrivedSiteStartTag = true
@@ -1234,7 +1263,7 @@ object TaxiTaskModel {
}
private fun judgeTaskEndSiteStation(currentLocation: MogoLocation) {
if (!checkCurrentTaskCondition()) {
if (!checkCurrentTaskCondition() || !QueryCurrentTaskRespBean.isTaskStartTaskType(mCurrentTaskWithOrder)) {
return
}
val endSite = mCurrentTaskWithOrder!!.endSite ?: return
@@ -1261,7 +1290,7 @@ object TaxiTaskModel {
)
if (!checkCurrentTaskCondition()
|| getCurTaskStatus() != TaskStatusEnum.StartTask.code
|| !QueryCurrentTaskRespBean.isTaskStartTaskType(mCurrentTaskWithOrder)
) {
i(TAG, "task null or TaskStatus = ${getCurTaskStatus()}")
return