[6.1.0] 到站接口拦截
This commit is contained in:
@@ -30,7 +30,6 @@ import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02Lis
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerParallelDrivingActionsListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager
|
||||
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.mogo.logger.CallerLogger.e
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.i
|
||||
@@ -142,6 +141,8 @@ object TaxiTaskModel {
|
||||
|
||||
private var mPrepareTaskDelayRunnable: Runnable? = null
|
||||
|
||||
private var mIsArrivedSiteTag = false //到站标志位,防止围栏触发多次调用到站接口
|
||||
|
||||
fun addTaskWithOrderListener(tag: String, listener: ITaxiTaskWithOrderCallback) {
|
||||
if (mTaxiTaskWithOrderCallbackMap.containsKey(tag)) {
|
||||
return
|
||||
@@ -413,7 +414,6 @@ object TaxiTaskModel {
|
||||
if (checkCurrentTaskCondition()
|
||||
&& QueryCurrentTaskRespBean.isStartTaskType(mCurrentTaskWithOrder)
|
||||
) {
|
||||
// judgeTaskStartStation(mogoLocation)
|
||||
judgeTaskEndSiteStation(mogoLocation)
|
||||
}
|
||||
|
||||
@@ -576,23 +576,6 @@ object TaxiTaskModel {
|
||||
}
|
||||
}
|
||||
|
||||
//根据围栏判断,是否到达起点
|
||||
private fun judgeTaskStartStation(location: MogoLocation) {
|
||||
if (checkCurrentTaskCondition()) {
|
||||
val startSite = mCurrentTaskWithOrder!!.startSite ?: return
|
||||
val startLon = startSite.gcjLon
|
||||
val startLat = startSite.gcjLat
|
||||
val distance = CoordinateUtils.calculateLineDistance(
|
||||
startLon, startLat,
|
||||
location.longitude, location.latitude
|
||||
).toDouble()
|
||||
i(TAG, "judgeTaskStartStation() distance = $distance")
|
||||
if (distance <= TaxiUnmannedConst.ARRIVE_AT_START_STATION_DISTANCE) {
|
||||
submitArriveSite(startSite.siteId, false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun autopilotArriveAtStation() {
|
||||
if (!checkCurrentTaskCondition()) return
|
||||
i(
|
||||
@@ -613,6 +596,12 @@ object TaxiTaskModel {
|
||||
siteId: Long, isArriveAtEndSite: Boolean,
|
||||
isArrivedNearestStation: Boolean = false
|
||||
) {
|
||||
if (mIsArrivedSiteTag){
|
||||
DebugView.printInfoMsg("arriveSite接口正在调用中")
|
||||
i(TAG, message = "arriveSite接口正在调用中 mIsArrivedSite = $mIsArrivedSiteTag")
|
||||
return
|
||||
}
|
||||
mIsArrivedSiteTag = true
|
||||
DebugView.printInfoMsg("[上报ArriveSite] siteId=$siteId, isArriveAtEndSite=$isArriveAtEndSite")
|
||||
i(TAG, message = "submitArriveSite: siteId=$siteId isArriveAtEndSite=$isArriveAtEndSite")
|
||||
TaxiTaskWithOrderServiceManager.arriveSite(
|
||||
@@ -620,6 +609,7 @@ object TaxiTaskModel {
|
||||
siteId,
|
||||
object : OchCommonServiceCallback<BaseData> {
|
||||
override fun onSuccess(data: BaseData?) {
|
||||
mIsArrivedSiteTag = false
|
||||
if (data == null || data.code != 0) return
|
||||
DebugView.printInfoMsg("[上报ArriveSite] success siteId=$siteId, isArriveAtEndSite=$isArriveAtEndSite")
|
||||
d(TAG, "submitArriveSite-onSuccess data=" + GsonUtil.jsonFromObject(data))
|
||||
@@ -637,6 +627,7 @@ object TaxiTaskModel {
|
||||
|
||||
override fun onError() {
|
||||
super.onError()
|
||||
mIsArrivedSiteTag = false
|
||||
if (!NetworkUtils.isConnected(mContext)) { // 网络异常,接口重试
|
||||
ToastUtils.showShort("网络出现异常,请稍后重试")
|
||||
DebugView.printErrorMsg("[上报ArriveSite] 网络出现异常,请稍后重试")
|
||||
@@ -647,6 +638,7 @@ object TaxiTaskModel {
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String?) {
|
||||
mIsArrivedSiteTag = false
|
||||
DebugView.printErrorMsg("[上报ArriveSite] failed, code=$code, msg=$msg")
|
||||
d(TAG, "code=$code msg=$msg")
|
||||
ToastUtils.showShort("到站接口请求出现异常,请稍后重试,code=$code msg=$msg")
|
||||
|
||||
Reference in New Issue
Block a user