[2.11.0/1.6.0] bus 司机端接口联调
This commit is contained in:
@@ -11,45 +11,48 @@ import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
public class BusQueryLineStationsRequest {
|
||||
|
||||
private String sn;
|
||||
private double lat;
|
||||
private double lon;
|
||||
private boolean markDrivingStatus; // 默认false;true:是否需要返回站点的行驶状态,对应返回的drivingStatus
|
||||
// private double lat;
|
||||
// private double lon;
|
||||
// private boolean markDrivingStatus; // 默认false;true:是否需要返回站点的行驶状态,对应返回的drivingStatus
|
||||
// 0 - 关闭、1 - 启动
|
||||
// public String status;
|
||||
public BusQueryLineStationsRequest(double lon, double lat, boolean markDrivingStatus) {
|
||||
// public BusQueryLineStationsRequest(double lon, double lat, boolean markDrivingStatus) {
|
||||
// this.sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
// this.lat = lat;
|
||||
// this.lon = lon;
|
||||
// this.markDrivingStatus = markDrivingStatus;
|
||||
// }
|
||||
public BusQueryLineStationsRequest() {
|
||||
this.sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
this.lat = lat;
|
||||
this.lon = lon;
|
||||
this.markDrivingStatus = markDrivingStatus;
|
||||
}
|
||||
|
||||
public boolean isMarkDrivingStatus() {
|
||||
return markDrivingStatus;
|
||||
}
|
||||
|
||||
public void setMarkDrivingStatus(boolean markDrivingStatus) {
|
||||
this.markDrivingStatus = markDrivingStatus;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
// public boolean isMarkDrivingStatus() {
|
||||
// return markDrivingStatus;
|
||||
// }
|
||||
//
|
||||
// public void setMarkDrivingStatus(boolean markDrivingStatus) {
|
||||
// this.markDrivingStatus = markDrivingStatus;
|
||||
// }
|
||||
//
|
||||
// public void setLat(double lat) {
|
||||
// this.lat = lat;
|
||||
// }
|
||||
//
|
||||
// public void setLon(double lon) {
|
||||
// this.lon = lon;
|
||||
// }
|
||||
//
|
||||
// public String getSn() {
|
||||
// return sn;
|
||||
// }
|
||||
//
|
||||
// public double getLat() {
|
||||
// return lat;
|
||||
// }
|
||||
//
|
||||
// public double getLon() {
|
||||
// return lon;
|
||||
// }
|
||||
// public BusOperationStatusRequest shutdown() {
|
||||
// status = "0";
|
||||
// return this;
|
||||
|
||||
@@ -290,14 +290,12 @@ public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>
|
||||
*
|
||||
* @param text 指定的文字
|
||||
*/
|
||||
public void showSlidePanle(String text) {
|
||||
if (isOperationStatus) {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
slidePanelView.setText(text);
|
||||
slidePanelView.setVisibility(View.VISIBLE);
|
||||
});
|
||||
setArrivedClikable(false);
|
||||
}
|
||||
public void showSlidePanel(String text) {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
slidePanelView.setText(text);
|
||||
slidePanelView.setVisibility(View.VISIBLE);
|
||||
});
|
||||
setArrivedClikable(false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,12 +14,10 @@ import androidx.annotation.Nullable;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.eagle.core.data.map.CenterLine;
|
||||
import com.mogo.eagle.core.data.temp.EventLogout;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
||||
import com.mogo.eagle.core.function.call.map.CallerHDMapManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils;
|
||||
@@ -147,6 +145,7 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
|
||||
}
|
||||
|
||||
public void updateLineEmptyUI(){
|
||||
setArrivedClikable(false);
|
||||
hideStationsPanel();
|
||||
}
|
||||
|
||||
@@ -185,7 +184,7 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
|
||||
//切换路线和结束路线按钮切换
|
||||
showOrHideSwitchLineBtn(false);
|
||||
|
||||
showSlidePanle("单程结束");
|
||||
showSlidePanel("单程结束");
|
||||
|
||||
setOrRemoveMapMaker(false, BusConst.BUS_END_MAP_MAKER, endStation.getLat()
|
||||
, endStation.getLon(),R.raw.end_marker);
|
||||
@@ -193,7 +192,7 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
|
||||
|
||||
showOrHideSwitchLineBtn(true);
|
||||
|
||||
showSlidePanle("滑动出发");
|
||||
showSlidePanel("滑动出发");
|
||||
|
||||
setOrRemoveMapMaker(true, BusConst.BUS_START_MAP_MAKER,
|
||||
startStation.getLat(), startStation.getLon(),R.raw.star_marker);
|
||||
@@ -202,7 +201,7 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
|
||||
}else{
|
||||
if (isArrived){
|
||||
// 重置滑动按钮文字
|
||||
showSlidePanle("滑动出发");
|
||||
showSlidePanel("滑动出发");
|
||||
}
|
||||
|
||||
showOrHideSwitchLineBtn(false);
|
||||
|
||||
@@ -199,8 +199,8 @@ public class BusOrderModel {
|
||||
}
|
||||
});
|
||||
|
||||
//2021/10/20 轮询小巴车订单,暂时用来播报
|
||||
startLoopBusOrders();
|
||||
//2021/10/20 轮询小巴车订单,暂时用来播报 2022/9/23 乘客上车和下车的播报都去除,增加核销的乘客播报
|
||||
// startLoopBusOrders();
|
||||
}
|
||||
|
||||
public void setRefreshBusStationsCallback(IRefreshBusStationsCallback callback){
|
||||
@@ -278,58 +278,58 @@ public class BusOrderModel {
|
||||
updateOrderRoute();
|
||||
}
|
||||
|
||||
/**
|
||||
* 轮询bus待服务订单
|
||||
*/
|
||||
private void startLoopBusOrders() {
|
||||
if (mBusOrdersDisposable != null && !mBusOrdersDisposable.isDisposed()) {
|
||||
return;
|
||||
}
|
||||
mBusOrdersDisposable = Observable.interval(BusConst.LOOP_DELAY,
|
||||
BusConst.LOOP_PERIOD_1S, TimeUnit.MILLISECONDS)
|
||||
.map((aLong -> aLong + 1))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(aLong -> queryBusOrders());
|
||||
}
|
||||
// /**
|
||||
// * 轮询bus待服务订单
|
||||
// */
|
||||
// private void startLoopBusOrders() {
|
||||
// if (mBusOrdersDisposable != null && !mBusOrdersDisposable.isDisposed()) {
|
||||
// return;
|
||||
// }
|
||||
// mBusOrdersDisposable = Observable.interval(BusConst.LOOP_DELAY,
|
||||
// BusConst.LOOP_PERIOD_1S, TimeUnit.MILLISECONDS)
|
||||
// .map((aLong -> aLong + 1))
|
||||
// .subscribeOn(Schedulers.io())
|
||||
// .observeOn(AndroidSchedulers.mainThread())
|
||||
// .subscribe(aLong -> queryBusOrders());
|
||||
// }
|
||||
|
||||
private void queryBusOrders() {
|
||||
BusServiceManager.getInstance().queryBusOrders(mContext, new IBusServiceCallback<BusOrdersResponse>() {
|
||||
@Override
|
||||
public void onSuccess(BusOrdersResponse o) {
|
||||
if (o.data != null && o.data.orders != null && o.data.orders.size() > 0) {
|
||||
CallerLogger.INSTANCE.d( M_BUS + TAG, "获取到bus订单数据: " + o.data.orders.toString() );
|
||||
List<BusOrderBean> busOrders = o.data.orders;
|
||||
for (int i = 0; i < busOrders.size(); i++) {
|
||||
BusOrderBean order = busOrders.get(i);
|
||||
if (order == null) return;
|
||||
if (TextUtils.isEmpty(order.getPassengerPhone())) return;
|
||||
if (prevBusOrderNos.contains(order.getOrderNo())) continue;
|
||||
try {
|
||||
String tailNum = null;
|
||||
try {
|
||||
tailNum = order.getPassengerPhone().substring(order.getPassengerPhone().length() - 4);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
tailNum = order.getPassengerPhone();
|
||||
}
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG, "TTS:" + tailNum);
|
||||
AIAssist.getInstance(mContext).speakTTSVoice("接到新订单,尾号 " + tailNum
|
||||
+ " 上车站点为 " + order.getStartStationName());
|
||||
prevBusOrderNos.add(order.getOrderNo());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(String failMsg) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
// private void queryBusOrders() {
|
||||
// BusServiceManager.getInstance().queryBusOrders(mContext, new IBusServiceCallback<BusOrdersResponse>() {
|
||||
// @Override
|
||||
// public void onSuccess(BusOrdersResponse o) {
|
||||
// if (o.data != null && o.data.orders != null && o.data.orders.size() > 0) {
|
||||
// CallerLogger.INSTANCE.d( M_BUS + TAG, "获取到bus订单数据: " + o.data.orders.toString() );
|
||||
// List<BusOrderBean> busOrders = o.data.orders;
|
||||
// for (int i = 0; i < busOrders.size(); i++) {
|
||||
// BusOrderBean order = busOrders.get(i);
|
||||
// if (order == null) return;
|
||||
// if (TextUtils.isEmpty(order.getPassengerPhone())) return;
|
||||
// if (prevBusOrderNos.contains(order.getOrderNo())) continue;
|
||||
// try {
|
||||
// String tailNum = null;
|
||||
// try {
|
||||
// tailNum = order.getPassengerPhone().substring(order.getPassengerPhone().length() - 4);
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// tailNum = order.getPassengerPhone();
|
||||
// }
|
||||
// CallerLogger.INSTANCE.d(M_BUS + TAG, "TTS:" + tailNum);
|
||||
// AIAssist.getInstance(mContext).speakTTSVoice("接到新订单,尾号 " + tailNum
|
||||
// + " 上车站点为 " + order.getStartStationName());
|
||||
// prevBusOrderNos.add(order.getOrderNo());
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onFail(String failMsg) {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
public void release(){
|
||||
if (mBusOrdersDisposable != null) {
|
||||
@@ -692,30 +692,30 @@ public class BusOrderModel {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询到站下车乘客
|
||||
*/
|
||||
private void queryStationLeaveAwayPassengers() {
|
||||
CallerLogger.INSTANCE.d( M_BUS + TAG, "查询到站下车乘客");
|
||||
|
||||
BusServiceManager.getInstance().queryStationLeaveAwayPassengers(mContext
|
||||
, stationList.get(backgroundCurrentStationIndex +1).getSeq(), stationList.get(backgroundCurrentStationIndex+1).getSiteId()
|
||||
, new IBusServiceCallback<QueryLeaveAwayPassengersResponse>() {
|
||||
@Override
|
||||
public void onSuccess(QueryLeaveAwayPassengersResponse o) {
|
||||
hadQueryLeaveAwayPassager = true;
|
||||
arriveSiteStation(false);
|
||||
playLeavePassengersMsg( o );
|
||||
queryBusOrders();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(String failMsg) {
|
||||
hadQueryLeaveAwayPassager = true;
|
||||
arriveSiteStation(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
// /**
|
||||
// * 查询到站下车乘客
|
||||
// */
|
||||
// private void queryStationLeaveAwayPassengers() {
|
||||
// CallerLogger.INSTANCE.d( M_BUS + TAG, "查询到站下车乘客");
|
||||
//
|
||||
// BusServiceManager.getInstance().queryStationLeaveAwayPassengers(mContext
|
||||
// , stationList.get(backgroundCurrentStationIndex +1).getSeq(), stationList.get(backgroundCurrentStationIndex+1).getSiteId()
|
||||
// , new IBusServiceCallback<QueryLeaveAwayPassengersResponse>() {
|
||||
// @Override
|
||||
// public void onSuccess(QueryLeaveAwayPassengersResponse o) {
|
||||
// hadQueryLeaveAwayPassager = true;
|
||||
// arriveSiteStation(false);
|
||||
// playLeavePassengersMsg( o );
|
||||
// queryBusOrders();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onFail(String failMsg) {
|
||||
// hadQueryLeaveAwayPassager = true;
|
||||
// arriveSiteStation(false);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
/**
|
||||
* 关闭美化模式
|
||||
@@ -780,10 +780,10 @@ public class BusOrderModel {
|
||||
+" isLeaving()="+currentStation.isLeaving());
|
||||
|
||||
//当前站点是始发站,告诉服务端到达始发站。 如果没有这个节点, 服务器不知道始发站到达状态
|
||||
// ,订单开始站下在始发站的状态流转有问题
|
||||
if (backgroundCurrentStationIndex == 0 && !currentStation.isLeaving()){
|
||||
arriveSiteStation(true);
|
||||
}
|
||||
// ,订单开始站下在始发站的状态流转有问题 2022.9.23不需要再调用此接口,拿到任务默认就是首站
|
||||
// if (backgroundCurrentStationIndex == 0 && !currentStation.isLeaving()){
|
||||
// arriveSiteStation(true);
|
||||
// }
|
||||
|
||||
// 美化是否开始
|
||||
if (FunctionBuildConfig.isDemoMode && (backgroundCurrentStationIndex >= 0
|
||||
|
||||
@@ -53,19 +53,18 @@ public class BusServiceManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询小巴车线路
|
||||
* 查询小巴车当前任务
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
public void queryBusRoutes(Context context, IBusServiceCallback<BusRoutesResponse> callback) {
|
||||
//获取当前高德坐标
|
||||
|
||||
mService.querySiteByCoordinate(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
mService.queryBusRoutes(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
, new BusQueryLineStationsRequest(BusOrderModel.getInstance().mLongitude
|
||||
, BusOrderModel.getInstance().mLatitude,true))
|
||||
, new BusQueryLineStationsRequest())
|
||||
.subscribeOn( Schedulers.io() ).observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe( getSubscribeImpl(context,callback,"querySiteByCoordinate"));
|
||||
.subscribe( getSubscribeImpl(context,callback,"queryBusRoutes"));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -78,7 +77,7 @@ public class BusServiceManager {
|
||||
mService.switchLine(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken(),new BusResetDrivingLineRequest(taskId))
|
||||
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context,callback,"debugResetStationStatus"));
|
||||
.subscribe(getSubscribeImpl(context,callback,"switchLine"));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -139,7 +138,7 @@ public class BusServiceManager {
|
||||
,new BusUpdateSiteStatusRequest(taskId,siteId,seq))
|
||||
.subscribeOn( Schedulers.io() )
|
||||
.observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe(getSubscribeImpl(context,callback,"leaveStation"));
|
||||
.subscribe(getSubscribeImpl(context,callback,"arriveSiteStation"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -40,7 +40,7 @@ public interface IBusApiService {
|
||||
// @POST( "/autopilot-car-hailing/line/v2/lineDataWithDriver/query" )
|
||||
@POST( "/autopilot-car-hailing/line/v2/driver/bus/lineDataWithDriver/query" )
|
||||
// @POST( "/mock/268/autopilot-car-hailing/bus/api/lineDataWithDriver/query" )
|
||||
Observable<BusRoutesResponse> querySiteByCoordinate(@Header ("appId") String appId, @Header("ticket") String ticket, @Body BusQueryLineStationsRequest request);
|
||||
Observable<BusRoutesResponse> queryBusRoutes(@Header ("appId") String appId, @Header("ticket") String ticket, @Body BusQueryLineStationsRequest request);
|
||||
|
||||
/**
|
||||
* @param request 请求参数{"destLine":1,"sn":"F803EB2046PZD00229"} 这个接口是重置bus线路的, 不是重置线路中站点的
|
||||
|
||||
Reference in New Issue
Block a user