[2.11.0/1.6.0] bus司机端 接口调整
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class BusCloseTaskRequest {
|
||||
|
||||
private String sn;
|
||||
private int taskId;
|
||||
public BusCloseTaskRequest(int taskId) {
|
||||
this.sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
this.taskId = taskId;
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
}
|
||||
}
|
||||
@@ -2,14 +2,13 @@ package com.mogo.och.bus.bean;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/3/22
|
||||
*
|
||||
* 根据车机行驶线路站点信息
|
||||
*/
|
||||
class BusQueryLineStationsRequest {
|
||||
public class BusQueryLineStationsRequest {
|
||||
|
||||
private String sn;
|
||||
private double lat;
|
||||
|
||||
@@ -12,16 +12,14 @@ import com.mogo.commons.network.Utils;
|
||||
public class BusUpdateSiteStatusRequest {
|
||||
|
||||
public String sn;
|
||||
public int taskId;
|
||||
public int seq;//站点序号
|
||||
public int siteId;//站点id
|
||||
public double lon;
|
||||
public double lat;
|
||||
|
||||
public BusUpdateSiteStatusRequest(int seq, int siteId, double lon, double lat) {
|
||||
public BusUpdateSiteStatusRequest(int taskId,int siteId,int seq) {
|
||||
this.sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
this.seq = seq;
|
||||
this.siteId = siteId;
|
||||
this.lon = lon;
|
||||
this.lat = lat;
|
||||
this.taskId = taskId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -505,7 +505,7 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
|
||||
if ((int)mSwitchLine.getTag() == 0){//切换路线
|
||||
Intent intent = new Intent(getContext(), BusSwitchLineActivity.class);
|
||||
startActivity(intent);
|
||||
}else {//结束路线
|
||||
}else {//结束任务
|
||||
OCHCommitDialog.Builder builder = new OCHCommitDialog.Builder();
|
||||
OCHCommitDialog closeLineConfirmDialog = builder
|
||||
.title(getString(R.string.bus_dialog_title))
|
||||
@@ -516,7 +516,7 @@ public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
|
||||
closeLineConfirmDialog.setClickListener(new OCHCommitDialog.ClickListener() {
|
||||
@Override
|
||||
public void confirm() {
|
||||
mPresenter.resetCurrentLineStatus();
|
||||
mPresenter.abortTask();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -504,13 +504,13 @@ public class BusOrderModel {
|
||||
/**
|
||||
* 重置路线站点状态--结束路线,当前路线恢复到始发站
|
||||
*/
|
||||
public void resetCurrentLineStatus() {
|
||||
CallerLogger.INSTANCE.d( M_BUS + TAG, "结束当前路线");
|
||||
BusServiceManager.getInstance().resetCurrentLineStatus(mContext, currentLineId
|
||||
public void abortTask() {
|
||||
CallerLogger.INSTANCE.d( M_BUS + TAG, "结束当前路线abortTask");
|
||||
BusServiceManager.getInstance().abortTask(mContext, currentLineId
|
||||
, new IBusServiceCallback<BusRoutesResponse>() {
|
||||
@Override
|
||||
public void onSuccess(BusRoutesResponse o) {
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG, "结束当前路线成功: " + o);
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG, "abortTask success: " + o);
|
||||
isGoingToNextStation = false;
|
||||
if (o.code == 0){ // 重置成功
|
||||
queryBusRoutes();
|
||||
@@ -528,27 +528,22 @@ public class BusOrderModel {
|
||||
/**
|
||||
* 离站上报
|
||||
*/
|
||||
public void leaveStation(boolean isOneWayOver,boolean isRestart){
|
||||
public void leaveStation(boolean isRestart){
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG,"leaveStation-backgroundCurrentStationIndex = "+backgroundCurrentStationIndex);
|
||||
BusServiceManager.getInstance().leaveStation(mContext, stationList.get(backgroundCurrentStationIndex).getSeq()
|
||||
, stationList.get(backgroundCurrentStationIndex).getSiteId(), new IBusServiceCallback<BusRoutesResponse>() {
|
||||
BusServiceManager.getInstance().leaveStation(mContext,
|
||||
stationList.get(backgroundCurrentStationIndex).getSeq(),
|
||||
stationList.get(backgroundCurrentStationIndex).getSiteId(),
|
||||
currentLineId,
|
||||
new IBusServiceCallback<BusRoutesResponse>() {
|
||||
@Override
|
||||
public void onSuccess(BusRoutesResponse o) {
|
||||
if ( o.getResult() == null || o.getResult().getSites() == null || o.getResult().getSites().isEmpty() ) {
|
||||
return;
|
||||
}
|
||||
isArrivedStation = false;
|
||||
if (!isOneWayOver){
|
||||
CallerLogger.INSTANCE.d( M_BUS + TAG, "自动驾驶开启开往下一站====" );
|
||||
//需要更改当前站和下一站的状态 然后渲染
|
||||
leaveStationSuccess(o.getResult(),isRestart);
|
||||
}else {
|
||||
CallerLogger.INSTANCE.d( M_BUS + TAG, "单程真的结束了====" );
|
||||
isGoingToNextStation = false;
|
||||
backgroundCurrentStationIndex = 0;
|
||||
CallerAutoPilotManager.INSTANCE.cancelAutoPilot();
|
||||
queryBusRoutes();
|
||||
}
|
||||
CallerLogger.INSTANCE.d( M_BUS + TAG, "自动驾驶开启开往下一站====" );
|
||||
//需要更改当前站和下一站的状态 然后渲染
|
||||
leaveStationSuccess(o.getResult(),isRestart);
|
||||
}
|
||||
@Override
|
||||
public void onFail(String failMsg) {
|
||||
@@ -649,9 +644,11 @@ public class BusOrderModel {
|
||||
}
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG,"arriveSiteStation-currentStationIndex = "+ arrivedStationIndex);
|
||||
|
||||
BusServiceManager.getInstance().arriveSiteStation(mContext
|
||||
, stationList.get(arrivedStationIndex).getSeq(), stationList.get(arrivedStationIndex).getSiteId()
|
||||
, new IBusServiceCallback<BaseData>() {
|
||||
BusServiceManager.getInstance().arriveSiteStation(mContext ,
|
||||
stationList.get(arrivedStationIndex).getSeq(),
|
||||
stationList.get(arrivedStationIndex).getSiteId(),
|
||||
currentLineId ,
|
||||
new IBusServiceCallback<BaseData>() {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG,"arriveSiteStation success");
|
||||
@@ -810,7 +807,7 @@ public class BusOrderModel {
|
||||
travelOver();
|
||||
return;
|
||||
}
|
||||
leaveStation(false,isRestart);
|
||||
leaveStation(isRestart);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -984,7 +981,32 @@ public class BusOrderModel {
|
||||
CallerLogger.INSTANCE.d( M_BUS + TAG, "单程结束====" );
|
||||
CallerAutoPilotManager.INSTANCE.cancelAutoPilot();
|
||||
AIAssist.getInstance( mContext ).speakTTSVoice( "感谢您体验'蘑菇车联'无人驾驶小巴车,请您携带好随身物品,我们下次再见" );
|
||||
leaveStation(true,true);
|
||||
// leaveStation(true,true);
|
||||
endTask();
|
||||
}
|
||||
|
||||
/**
|
||||
* task正常结束
|
||||
*/
|
||||
private void endTask() {
|
||||
CallerLogger.INSTANCE.d( M_BUS + TAG, "任务正常走完endTask()");
|
||||
BusServiceManager.getInstance().endTask(mContext, currentLineId
|
||||
, new IBusServiceCallback<BusRoutesResponse>() {
|
||||
@Override
|
||||
public void onSuccess(BusRoutesResponse o) {
|
||||
CallerLogger.INSTANCE.d(M_BUS + TAG, "endTask success: " + o);
|
||||
if (o.code == 0){ // 重新获取任务
|
||||
isGoingToNextStation = false;
|
||||
backgroundCurrentStationIndex = 0;
|
||||
queryBusRoutes();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(String failMsg) {
|
||||
ToastUtils.showShort(failMsg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public boolean isWorking() {
|
||||
|
||||
@@ -10,8 +10,8 @@ import com.mogo.eagle.core.network.MoGoRetrofitFactory;
|
||||
import com.mogo.eagle.core.network.RequestOptions;
|
||||
import com.mogo.eagle.core.network.SubscribeImpl;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.och.bus.bean.BusCloseTaskRequest;
|
||||
import com.mogo.och.bus.bean.BusQueryLinesResponse;
|
||||
import com.mogo.och.bus.bean.BusResetLineStatusRequest;
|
||||
import com.mogo.och.bus.bean.BusRoutePlanningUpdateReqBean;
|
||||
import com.mogo.och.bus.bean.BusRoutesResponse;
|
||||
import com.mogo.och.bus.bean.CarHeartbeatReqBean;
|
||||
@@ -83,17 +83,31 @@ public class BusServiceManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* 结束当前路线,当前路线状态重置到始发站
|
||||
* 结束当前任务
|
||||
* @param context
|
||||
* @param lineId
|
||||
* @param taskId
|
||||
* @param callback
|
||||
*/
|
||||
public void resetCurrentLineStatus(Context context, int lineId, IBusServiceCallback<BusRoutesResponse> callback){
|
||||
mService.resetCurrentLineStatus(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
public void abortTask(Context context, int taskId, IBusServiceCallback<BusRoutesResponse> callback){
|
||||
mService.abortTask(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,new BusResetLineStatusRequest())
|
||||
,new BusCloseTaskRequest(taskId))
|
||||
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context,callback,"resetCurrentLineStatus"));
|
||||
.subscribe(getSubscribeImpl(context,callback,"abortTask"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 正常结束任务
|
||||
* @param context
|
||||
* @param taskId
|
||||
* @param callback
|
||||
*/
|
||||
public void endTask(Context context, int taskId, IBusServiceCallback<BusRoutesResponse> callback){
|
||||
mService.endTask(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,new BusCloseTaskRequest(taskId))
|
||||
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(getSubscribeImpl(context,callback,"endTask"));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -103,11 +117,10 @@ public class BusServiceManager {
|
||||
* @param siteId
|
||||
* @param callback
|
||||
*/
|
||||
public void leaveStation(Context context, int seq, int siteId, IBusServiceCallback<BusRoutesResponse> callback){
|
||||
public void leaveStation(Context context, int seq, int siteId,int taskId, IBusServiceCallback<BusRoutesResponse> callback){
|
||||
mService.leaveStation(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,new BusUpdateSiteStatusRequest(seq,siteId, BusOrderModel.getInstance().mLongitude
|
||||
, BusOrderModel.getInstance().mLatitude))
|
||||
,new BusUpdateSiteStatusRequest(taskId,siteId,seq))
|
||||
.subscribeOn( Schedulers.io() )
|
||||
.observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe(getSubscribeImpl(context,callback,"leaveStation"));
|
||||
@@ -120,11 +133,11 @@ public class BusServiceManager {
|
||||
* @param siteId
|
||||
* @param callback
|
||||
*/
|
||||
public void arriveSiteStation(Context context, int seq, int siteId, IBusServiceCallback<BaseData> callback){
|
||||
public void arriveSiteStation(Context context, int seq, int siteId,int taskId,
|
||||
IBusServiceCallback<BaseData> callback){
|
||||
mService.arriveSiteStation(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,new BusUpdateSiteStatusRequest(seq,siteId
|
||||
, BusOrderModel.getInstance().mLongitude, BusOrderModel.getInstance().mLatitude))
|
||||
,new BusUpdateSiteStatusRequest(taskId,siteId,seq))
|
||||
.subscribeOn( Schedulers.io() )
|
||||
.observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe(getSubscribeImpl(context,callback,"leaveStation"));
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.mogo.och.bus.net;
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.och.bus.bean.BusCloseTaskRequest;
|
||||
import com.mogo.och.bus.bean.BusOperationStatusRequest;
|
||||
import com.mogo.och.bus.bean.BusOrdersResponse;
|
||||
import com.mogo.och.bus.bean.BusQueryLinesResponse;
|
||||
import com.mogo.och.bus.bean.BusResetLineStatusRequest;
|
||||
import com.mogo.och.bus.bean.BusRoutePlanningUpdateReqBean;
|
||||
import com.mogo.och.bus.bean.BusRoutesResponse;
|
||||
import com.mogo.och.bus.bean.CarHeartbeatReqBean;
|
||||
@@ -59,7 +59,8 @@ public interface IBusApiService {
|
||||
*/
|
||||
@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("/autopilot-car-hailing/car/v2/driver/bus/driving/away")
|
||||
@POST("/autopilot-car-hailing/cab/flow/v1/bus/driver/bus/leave")
|
||||
// @POST("/mock/268/autopilot-car-hailing/bus/api/driving/away")
|
||||
Observable<BusRoutesResponse> leaveStation(@Header ("appId") String appId, @Header("ticket") String ticket, @Body BusUpdateSiteStatusRequest request);
|
||||
|
||||
@@ -70,7 +71,8 @@ public interface IBusApiService {
|
||||
*/
|
||||
@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("/autopilot-car-hailing/order/v2/driver/bus/driving/attachSite")
|
||||
@POST("/autopilot-car-hailing/cab/flow/v1/bus/driver/bus/arrive")
|
||||
// @POST("/mock/268/autopilot-car-hailing/bus/api/driving/attachSite")
|
||||
Observable< BaseData > arriveSiteStation(@Header ("appId") String appId,@Header("ticket") String ticket,@Body BusUpdateSiteStatusRequest request);
|
||||
|
||||
@@ -150,8 +152,30 @@ public interface IBusApiService {
|
||||
@POST( "/autopilot-car-hailing/location/v2/driver/bus/saveLineCoordinate" )
|
||||
Observable<BaseData> updateOrderRoute(@Header ("appId") String appId, @Header("ticket") String ticket, @Body BusRoutePlanningUpdateReqBean data);
|
||||
|
||||
// @Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
// @POST("/autopilot-car-hailing/operation/v1/driver/bus/line/resetStart")
|
||||
// Observable<BusRoutesResponse> resetCurrentLineStatus(@Header ("appId") String appId, @Header("ticket") String ticket, @Body BusResetLineStatusRequest data);
|
||||
|
||||
/**
|
||||
* 中止任务
|
||||
* @param appId
|
||||
* @param ticket
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
@POST("/autopilot-car-hailing/operation/v1/driver/bus/line/resetStart")
|
||||
Observable<BusRoutesResponse> resetCurrentLineStatus(@Header ("appId") String appId, @Header("ticket") String ticket, @Body BusResetLineStatusRequest data);
|
||||
@POST("/autopilot-car-hailing/cab/flow/v1/bus/driver/bus/abortTask")
|
||||
Observable<BusRoutesResponse> abortTask(@Header ("appId") String appId, @Header("ticket") String ticket, @Body BusCloseTaskRequest data);
|
||||
|
||||
/**
|
||||
* 任务正常跑完结束
|
||||
* @param appId
|
||||
* @param ticket
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
@POST("/autopilot-car-hailing/cab/flow/v1/bus/driver/bus/endTask")
|
||||
Observable<BusRoutesResponse> endTask(@Header ("appId") String appId, @Header("ticket") String ticket, @Body BusCloseTaskRequest data);
|
||||
}
|
||||
|
||||
|
||||
@@ -94,8 +94,8 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
BusOrderModel.getInstance().queryOperationStatus();
|
||||
}
|
||||
|
||||
public void resetCurrentLineStatus() {
|
||||
BusOrderModel.getInstance().resetCurrentLineStatus();
|
||||
public void abortTask() {
|
||||
BusOrderModel.getInstance().abortTask();
|
||||
}
|
||||
|
||||
public void autoDriveToNextStation(boolean isRestart) {
|
||||
|
||||
Reference in New Issue
Block a user