From f33a63cb64fee1041d0d1a2100235b7f204a5f93 Mon Sep 17 00:00:00 2001 From: wangmingjun Date: Wed, 26 Oct 2022 12:13:21 +0800 Subject: [PATCH] =?UTF-8?q?[2.12.0]=20bus=E5=8F=B8=E6=9C=BA=E7=AB=AF?= =?UTF-8?q?=E7=BB=99=E5=A4=96=E5=B1=8F=E6=8E=A5=E5=8F=A3=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/mogo/och/bus/model/BusOrderModel.java | 43 ++++++++++++------- .../och/bus/util/BusSendTripInfoManager.kt | 14 +++--- 2 files changed, 36 insertions(+), 21 deletions(-) diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/model/BusOrderModel.java b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/model/BusOrderModel.java index 49a0d83a0e..c8befdfc97 100644 --- a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/model/BusOrderModel.java +++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/model/BusOrderModel.java @@ -481,6 +481,7 @@ public class BusOrderModel { BusSendTripInfoManager.INSTANCE.sendBusTripInfo(BusSendTripInfoManager.END_TRIP , busRoutesResult.getName() ,"" + ,"" ,false); } } @@ -490,16 +491,27 @@ public class BusOrderModel { * 服务端返回的OchBusRoutesResult逻辑, 离开站为当前站, 到达下一站后才会将下一站置为当前站, * 车机端展示是离开当前站,下一站设置为当前站, 所以服务端数据回来要做处理,不能直接渲染 */ - private void leaveStationSuccess(int leaveIndex) { + private void leaveStationSuccess(int leaveIndex,String leaveStation,String nextStation) { + + onStartAutopilot(leaveIndex); + + leaveTTSTips(nextStation); if (busRoutesResult != null){ + boolean isLastStop = false; + if (leaveIndex + 1 == stationList.size() -1){ + isLastStop = true; + } //给bus外屏发送 BusSendTripInfoManager.INSTANCE.sendBusTripInfo(BusSendTripInfoManager.LEAVE_STATION , busRoutesResult.getName() - ,busRoutesResult.getSites().get(leaveIndex).getName() - ,false); + ,leaveStation + ,nextStation + ,isLastStop); } + } + private void onStartAutopilot(int leaveIndex) { //开启自动驾驶 2.10.0: 如果自动驾驶状态下开启, 非自动驾驶状态下不开启,需手动点击自动驾驶按钮开启 isGoingToNextStation = true; if (CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState() @@ -605,6 +617,7 @@ public class BusOrderModel { } int arrivedStationIndex = backgroundCurrentStationIndex + 1; String arriveStation = stationList.get(arrivedStationIndex).getName(); + String departureStopName = stationList.get(backgroundCurrentStationIndex).getName(); CallerLogger.INSTANCE.d(M_BUS + TAG,"arriveSiteStation-currentStationIndex = "+ arrivedStationIndex); BusServiceManager.arriveSiteStation(mContext , @@ -617,11 +630,7 @@ public class BusOrderModel { CallerLogger.INSTANCE.d(M_BUS + TAG,"行程日志-arriveSiteStation success"); queryBusRoutes(); - arriveStationSuccess(arrivedStationIndex); - - ttsTips(String.format(mContext - .getString(R.string.bus_arrived_station_tip), - arriveStation)); + arriveStationSuccess(arrivedStationIndex,departureStopName,arriveStation); //5s轮询核销乘客 startOrStopQueryPassengerWriteOff(true); @@ -642,20 +651,23 @@ public class BusOrderModel { }); } - private void arriveStationSuccess(int arrivedStationIndex) { + private void arriveStationSuccess(int arrivedStationIndex,String departureStopName,String arriveStation) { if (busRoutesResult != null){ - boolean isLastStop; + boolean isLastStop = false; if (arrivedStationIndex == busRoutesResult.getSites().size() - 1 ){ isLastStop = true; - }else { - isLastStop = false; } //给bus外屏发送 BusSendTripInfoManager.INSTANCE.sendBusTripInfo(BusSendTripInfoManager.ARRIVE_STATION , busRoutesResult.getName() - ,busRoutesResult.getSites().get(arrivedStationIndex).getName() + ,departureStopName + ,arriveStation ,isLastStop); } + + ttsTips(String.format(mContext + .getString(R.string.bus_arrived_station_tip), + arriveStation)); } /** @@ -681,8 +693,7 @@ public class BusOrderModel { //需要更改当前站和下一站的状态 然后渲染 startOrStopQueryPassengerWriteOff(false); queryBusRoutes(); - leaveStationSuccess(backgroundCurrentStationIndex); - leaveTTSTips(finalNextStationName); + leaveStationSuccess(backgroundCurrentStationIndex,currentStationName,finalNextStationName); } @Override public void onFail(int code, String failMsg) { @@ -774,7 +785,7 @@ public class BusOrderModel { && !stationList.get(0).isLeaving()){ //默认是第一站到站查询 if (busRoutesResult != null){ // 第一站到站也是行程开始的时候 BusSendTripInfoManager.INSTANCE.sendBusTripInfo(BusSendTripInfoManager.START_TRIP - ,busRoutesResult.getName(),"",false); + ,busRoutesResult.getName(),"","",false); } startOrStopQueryPassengerWriteOff(true); } diff --git a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/util/BusSendTripInfoManager.kt b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/util/BusSendTripInfoManager.kt index 21927b0403..45d89d2359 100644 --- a/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/util/BusSendTripInfoManager.kt +++ b/OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/util/BusSendTripInfoManager.kt @@ -19,13 +19,17 @@ object BusSendTripInfoManager{ * 行程信息 * @param type 事件类型, 1:行程开始, 2:行程结束, 3:出站, 4:进站, 5:城市占道施工预警 * @param lineName 路线名, for type 1, 2 - * @param stopName 站点名, for type 3, 4 - * @param isLastStop 是否终点站 + * @param departureStopName 出站站点名, for type 3, 4 + * @param arrivalStopName 下一站到达站点名, for type 3, 4 + * @param isLastStop 是否终点站(下一站或者要到达站) * @return */ - fun sendBusTripInfo(type: Int, lineName: String, stationName: String, isLastStop: Boolean) { + fun sendBusTripInfo(type: Int, lineName: String, + departureStopName: String, + arrivalStopName: String, + isLastStop: Boolean) { d(SceneConstant.M_BUS + "BusSendTripInfoManager", "type: "+ type - +", lineName: "+ lineName + ", stationName: "+stationName+", isLastStop: "+isLastStop) - CallerAutoPilotManager.sendTripInfo(type,lineName,stationName, "", isLastStop) + +", lineName: "+ lineName + ", stationName: "+arrivalStopName+", isLastStop: "+isLastStop) + CallerAutoPilotManager.sendTripInfo(type,lineName,departureStopName, arrivalStopName, isLastStop) } }