[清扫车 Sweepers 1.0.0] 去除清扫车不需要的订单轮询和乘客业务
This commit is contained in:
@@ -91,8 +91,6 @@ public class SweepersOrderModel {
|
||||
public double mLongitude = 0;
|
||||
public double mLatitude = 0;
|
||||
private Context mContext;
|
||||
private Disposable mBusOrdersDisposable; //定时轮询小巴车订单
|
||||
private List<String> prevBusOrderNos = new ArrayList<>();
|
||||
private final List<SweepersStationBean> stationList = new ArrayList<>();
|
||||
private SweepersRoutesResult sweepersRoutesResult = null;
|
||||
/**
|
||||
@@ -196,8 +194,6 @@ public class SweepersOrderModel {
|
||||
}
|
||||
});
|
||||
|
||||
//2021/10/20 轮询小巴车订单,暂时用来播报
|
||||
startLoopBusOrders();
|
||||
}
|
||||
|
||||
public void setCarOperationStatusCallback(ICarOperationStatusCallback callback){
|
||||
@@ -279,63 +275,7 @@ public class SweepersOrderModel {
|
||||
updateOrderRoute();
|
||||
}
|
||||
|
||||
/**
|
||||
* 轮询bus待服务订单
|
||||
*/
|
||||
private void startLoopBusOrders() {
|
||||
if (mBusOrdersDisposable != null && !mBusOrdersDisposable.isDisposed()) {
|
||||
return;
|
||||
}
|
||||
mBusOrdersDisposable = Observable.interval(SweepersConst.LOOP_DELAY,
|
||||
SweepersConst.LOOP_PERIOD_1S, TimeUnit.MILLISECONDS)
|
||||
.map((aLong -> aLong + 1))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(aLong -> queryBusOrders());
|
||||
}
|
||||
|
||||
private void queryBusOrders() {
|
||||
SweepersServiceManager.getInstance().queryBusOrders(mContext, new ISweepersServiceCallback<SweepersOrdersResponse>() {
|
||||
@Override
|
||||
public void onSuccess(SweepersOrdersResponse 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<SweepersOrderBean> busOrders = o.data.orders;
|
||||
for (int i = 0; i < busOrders.size(); i++) {
|
||||
SweepersOrderBean 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) {
|
||||
mBusOrdersDisposable.dispose();
|
||||
}
|
||||
startOrStopOrderLoop(false);
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
@@ -626,31 +566,6 @@ public class SweepersOrderModel {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询到站下车乘客
|
||||
*/
|
||||
private void queryStationLeaveAwayPassengers() {
|
||||
CallerLogger.INSTANCE.d( M_BUS + TAG, "查询到站下车乘客");
|
||||
|
||||
SweepersServiceManager.getInstance().queryStationLeaveAwayPassengers(mContext
|
||||
, stationList.get(backgroundCurrentStationIndex +1).getSeq(), stationList.get(backgroundCurrentStationIndex+1).getSiteId()
|
||||
, new ISweepersServiceCallback<QueryLeaveAwayPassengersResponse>() {
|
||||
@Override
|
||||
public void onSuccess(QueryLeaveAwayPassengersResponse o) {
|
||||
hadQueryLeaveAwayPassager = true;
|
||||
arriveSiteStation(false);
|
||||
playLeavePassengersMsg( o );
|
||||
queryBusOrders();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(String failMsg) {
|
||||
hadQueryLeaveAwayPassager = true;
|
||||
arriveSiteStation(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 收车
|
||||
*/
|
||||
@@ -946,16 +861,7 @@ public class SweepersOrderModel {
|
||||
CallerLogger.INSTANCE.d( M_BUS + TAG, "到站====currentStationIndex=" + backgroundCurrentStationIndex);
|
||||
isGoingToNextStation = false;
|
||||
|
||||
queryStationLeaveAwayPassengers();
|
||||
UiThreadHandler.postDelayed(new Runnable() {// 先查询下车乘客,再上报到站,便于后台筛查下车订单
|
||||
@Override
|
||||
public void run() {
|
||||
if (!hadQueryLeaveAwayPassager){
|
||||
arriveSiteStation(false);
|
||||
}
|
||||
hadQueryLeaveAwayPassager = false;
|
||||
}
|
||||
},1500);
|
||||
arriveSiteStation(false);//到站上报
|
||||
}
|
||||
|
||||
public boolean isGoingToNextStation() {
|
||||
|
||||
@@ -36,9 +36,7 @@ public interface ISweepersApiService {
|
||||
* @return 接口返回数据
|
||||
*/
|
||||
@Headers( {"Content-Type:application/json;charset=UTF-8"} )
|
||||
// @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<SweepersRoutesResponse> querySiteByCoordinate(@Header ("appId") String appId, @Header("ticket") String ticket, @Body SweepersQueryLineStationsRequest request);
|
||||
|
||||
/**
|
||||
@@ -48,9 +46,7 @@ public interface ISweepersApiService {
|
||||
* @return 返回值是重置后的车站列表
|
||||
*/
|
||||
@Headers( {"Content-Type:application/json;charset=UTF-8"} )
|
||||
// @POST( "/autopilot-car-hailing/car/v2/bus/drivingLine/reset" )
|
||||
@POST( "/autopilot-car-hailing/car/v2/driver/bus/drivingLine/reset" )
|
||||
// @POST( "/mock/268/autopilot-car-hailing/bus/api/drivingLine/reset" )
|
||||
Observable<SweepersRoutesResponse> resetStationStatus(@Header ("appId") String appId, @Header("ticket") String ticket, @Body SweepersResetDrivingLineRequest request);
|
||||
|
||||
/**
|
||||
@@ -59,9 +55,7 @@ public interface ISweepersApiService {
|
||||
* @return
|
||||
*/
|
||||
@Headers({"Content-Type:application/json;charset=UTF-8"})
|
||||
// @POST("/autopilot-car-hailing/car/v2/bus/driving/away")
|
||||
@POST("/autopilot-car-hailing/car/v2/driver/bus/driving/away")
|
||||
// @POST("/mock/268/autopilot-car-hailing/bus/api/driving/away")
|
||||
Observable<SweepersRoutesResponse> leaveStation(@Header ("appId") String appId, @Header("ticket") String ticket, @Body SweepersUpdateSiteStatusRequest request);
|
||||
|
||||
/**
|
||||
@@ -70,32 +64,16 @@ public interface ISweepersApiService {
|
||||
* @return
|
||||
*/
|
||||
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||
// @POST("/autopilot-car-hailing/order/v2/bus/driving/attachSite")
|
||||
@POST("/autopilot-car-hailing/order/v2/driver/bus/driving/attachSite")
|
||||
// @POST("/mock/268/autopilot-car-hailing/bus/api/driving/attachSite")
|
||||
Observable< BaseData > arriveSiteStation(@Header ("appId") String appId,@Header("ticket") String ticket,@Body SweepersUpdateSiteStatusRequest request);
|
||||
|
||||
|
||||
/**
|
||||
* 到站查询下车乘客
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||
// @POST("/autopilot-car-hailing/order/v2/bus/driving/siteArrivedOrders")
|
||||
@POST("/autopilot-car-hailing/order/v2/driver/bus/driving/siteArrivedOrders")
|
||||
// @POST("/mock/268/autopilot-car-hailing/bus/api/driving/siteArrivedOrders")
|
||||
Observable< QueryLeaveAwayPassengersResponse > queryStationLeaveAwayPassengers(@Header ("appId") String appId,@Header("ticket") String ticket,@Body QueryLeaveAwayPassengersRequest request);
|
||||
|
||||
/**
|
||||
* 出车
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
// @POST("/autopilot-car-hailing/car/v2/bus/startTakeOrder")
|
||||
@POST("/autopilot-car-hailing/car/v2/driver/bus/startTakeOrder")
|
||||
// @POST("/mock/268/autopilot-car-hailing/bus/api/startTakeOrder")
|
||||
Observable<BaseData> startTakeOrder(@Header ("appId") String appId,@Header("ticket") String ticket,@Body SweepersOperationStatusRequest request);
|
||||
|
||||
/**
|
||||
@@ -104,9 +82,7 @@ public interface ISweepersApiService {
|
||||
* @return
|
||||
*/
|
||||
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||
// @POST("/autopilot-car-hailing/car/v2/bus/stopTakeOrder")
|
||||
@POST("/autopilot-car-hailing/car/v2/driver/bus/stopTakeOrder")
|
||||
// @POST("/mock/268/autopilot-car-hailing/bus/api/stopTakeOrder")
|
||||
Observable<BaseData> stopTakeOrder(@Header ("appId") String appId,@Header("ticket") String ticket,@Body SweepersOperationStatusRequest request);
|
||||
|
||||
/**
|
||||
@@ -115,24 +91,15 @@ public interface ISweepersApiService {
|
||||
* @return
|
||||
*/
|
||||
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||
// @GET("/autopilot-car-hailing/car/v2/bus/takeOrderStatus/query")
|
||||
@GET("/autopilot-car-hailing/car/v2/driver/bus/takeOrderStatus/query")
|
||||
// @GET("/mock/268/autopilot-car-hailing/bus/api/takeOrderStatus/query")
|
||||
Observable<SweepersOperationStatusResponse> queryOperationStatus(@Header ("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn);
|
||||
|
||||
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||
// @GET("/autopilot-car-hailing/order/v2/bus/servicingOrders/query")
|
||||
@GET("/autopilot-car-hailing/order/v2/driver/bus/servicingOrders/query")
|
||||
// @GET("/mock/268/autopilot-car-hailing/bus/api/servicingOrders/query")
|
||||
Observable<SweepersOrdersResponse> queryBusOrders(@Header ("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn);
|
||||
|
||||
/**
|
||||
* 车机端上传心跳数据(只在出车状态时上传):包含高德坐标系经纬度
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
// @POST( "/autopilot-car-hailing/location/v2/driver/heartbeat" )
|
||||
@POST( "/autopilot-car-hailing/location/v2/driver/bus/heartbeat" )
|
||||
Observable<BaseData> runCarHeartbeat(@Header ("appId") String appId,@Header("ticket") String ticket,@Body CarHeartbeatReqBean data);
|
||||
|
||||
@@ -143,7 +110,6 @@ public interface ISweepersApiService {
|
||||
* @param sn
|
||||
* @return
|
||||
*/
|
||||
// @GET("/autopilot-car-hailing/line/v2/driver/bindLine/query")
|
||||
@GET("/autopilot-car-hailing/line/v2/driver/bus/bindLine/query")
|
||||
Observable<SweepersQueryLinesResponse> queryBusLines(@Header ("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn);
|
||||
|
||||
|
||||
@@ -114,22 +114,6 @@ public class SweepersServiceManager {
|
||||
.subscribe(getSubscribeImpl(context,callback,"leaveStation"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询下车乘客
|
||||
* @param context
|
||||
* @param seq
|
||||
* @param siteId
|
||||
* @param callback
|
||||
*/
|
||||
public void queryStationLeaveAwayPassengers(Context context, int seq, int siteId
|
||||
, ISweepersServiceCallback<QueryLeaveAwayPassengersResponse> callback){
|
||||
mService.queryStationLeaveAwayPassengers( MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken(),new QueryLeaveAwayPassengersRequest(seq,siteId))
|
||||
.subscribeOn( Schedulers.io() )
|
||||
.observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe(getSubscribeImpl(context,callback,"queryStationLeaveAwayPassengers"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 收车
|
||||
* @param context
|
||||
@@ -173,18 +157,6 @@ public class SweepersServiceManager {
|
||||
.subscribe(getSubscribeImpl(context,callback,"queryOperationStatus"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询小巴车订单
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
public void queryBusOrders(Context context, ISweepersServiceCallback<SweepersOrdersResponse> callback){
|
||||
mService.queryBusOrders(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken(),MoGoAiCloudClientConfig.getInstance().getSn())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context,callback,"queryBusOrders"));
|
||||
}
|
||||
|
||||
public void queryBusLines(Context context, ISweepersServiceCallback<SweepersQueryLinesResponse> callback){
|
||||
mService.queryBusLines(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
|
||||
Reference in New Issue
Block a user