diff --git a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/model/TaxiModel.java b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/model/TaxiModel.java index 3f672cc3b6..8b03f98c22 100644 --- a/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/model/TaxiModel.java +++ b/OCH/mogo-och-taxi/src/main/java/com/mogo/och/taxi/model/TaxiModel.java @@ -1015,7 +1015,12 @@ public class TaxiModel { if (getCurOrderStatus() == TaxiOrderStatusEnum.OnTheWayToStart) { judgeStartStation(location); } + if (getCurOrderStatus() == TaxiOrderStatusEnum.OnTheWayToEnd && + mPrevAPStatus != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING){ + judgeEndStation(location); + } } + mLongitude = location.getLongitude(); mLatitude = location.getLatitude(); if (mControllerStatusCallback != null) { @@ -1024,6 +1029,37 @@ public class TaxiModel { } }; + private void judgeEndStation(Location location) { + if (mCurrentOCHOrder == null || mCurrentOCHOrder.endSiteGcjPoint == null + || mCurrentOCHOrder.endSiteGcjPoint.size() < 2) { + return; + } + double startLon = mCurrentOCHOrder.endSiteGcjPoint.get(0); + double startLat = mCurrentOCHOrder.endSiteGcjPoint.get(1); + double distance = CoordinateUtils.calculateLineDistance( + startLon, startLat, + location.getLongitude(), location.getLatitude()); + + CallerLogger.INSTANCE.i(M_TAXI + TAG, "judgeEndStation() distance = " + distance); + + if (distance > TaxiConst.ARRIVE_AT_START_STATION_DISTANCE) { + distance = CoordinateUtils.calculateLineDistance(startLon, startLat, + CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lon(), + CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lat()); + } + + if (distance <= TaxiConst.ARRIVE_AT_START_STATION_DISTANCE) { + if (!checkCurrentOCHOrder() + || (getCurOrderStatus() == TaxiOrderStatusEnum.ArriveAtEnd)) { + CallerLogger.INSTANCE.i(M_TAXI + TAG, "order exception or order ArriveAtEnd"); + return; + } + arriveTerminal(); + return; + } + + } + /** * 订单流转debug START */ @@ -1134,10 +1170,8 @@ public class TaxiModel { || (getCurOrderStatus() == TaxiOrderStatusEnum.ArriveAtEnd)) { return; } - if (DebugConfig.isDebug()) { - // ToastUtils.showShort("到达目的地"); - } arriveTerminal(); + if (FunctionBuildConfig.isDemoMode) { // 当美化模式(演示模式)开启时: 到达目的地,置false FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = false;