[fix] token获取中状态接口暂停3s后重新获取状态、修改注释
This commit is contained in:
@@ -5,14 +5,14 @@ import com.mogo.eagle.core.data.BaseData;
|
||||
/**
|
||||
* Created by pangfan on 2021/8/19
|
||||
*
|
||||
* 收车/出车状态查询返回数据结构
|
||||
* 状态查询返回数据结构
|
||||
*/
|
||||
public class DriverStatusQueryRespBean extends BaseData {
|
||||
public Result data;
|
||||
|
||||
public static class Result {
|
||||
public int servingStatus; //0收车,1出车
|
||||
public int driverStatus; //0收车,1出车
|
||||
public int servingStatus; //1接单,1暂停接单
|
||||
public int driverStatus; //1登录,0登出
|
||||
public String orderNo;
|
||||
public int purpose; // 1 运营, 2 测试, 3演示
|
||||
}
|
||||
|
||||
@@ -3,14 +3,12 @@ package com.mogo.och.taxi.bean;
|
||||
/**
|
||||
* Created by pangfan on 2021/8/19
|
||||
*
|
||||
* 收车/出车状态更新请求数据结构
|
||||
* 状态更新请求数据结构
|
||||
*/
|
||||
public class DriverStatusUpdateReqBean {
|
||||
public String sn;
|
||||
public int status; //0收车,1出车
|
||||
|
||||
public DriverStatusUpdateReqBean(String sn, int status) {
|
||||
public DriverStatusUpdateReqBean(String sn) {
|
||||
this.sn = sn;
|
||||
this.status = status;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.mogo.och.taxi.callback;
|
||||
/**
|
||||
* Created on 2021/9/8
|
||||
*
|
||||
* Model->Presenter回调:出车/收车状态变更
|
||||
* Model->Presenter回调:接单车状态变更 登录状态变更
|
||||
*/
|
||||
public interface ITaxiCarStatusCallback {
|
||||
void onCarStatusChanged(boolean inOperation,String role);
|
||||
|
||||
@@ -80,5 +80,7 @@ class TaxiConst {
|
||||
const val TYPE_MARKER_TAXI_ORDER = "TYPE_MARKER_TAXI_ORDER"
|
||||
|
||||
const val TIMER_START_AUTOPILOT_INTERVAL = 20 * 1000L
|
||||
|
||||
const val WAIT_TAKEN = 100046
|
||||
}
|
||||
}
|
||||
@@ -116,7 +116,7 @@ public class TaxiModel {
|
||||
private volatile List<OrderQueryRespBean.Result> mWaitServiceList = Collections.emptyList(); //待服务订单
|
||||
|
||||
private ITaxiADASStatusCallback mADASStatusCallback; //Model->Presenter:自动驾驶状态相关
|
||||
private ITaxiCarStatusCallback mCarStatusCallback; //Model->Presenter:出车/收车状态
|
||||
private ITaxiCarStatusCallback mCarStatusCallback; //Model->Presenter:接单状态、登录状态和司机今日接单状态
|
||||
private ITaxiControllerStatusCallback mControllerStatusCallback; //Model->Presenter:VR mode等
|
||||
private ITaxiOrderStatusCallback mOrderStatusCallback; //Model->Presenter:订单变更
|
||||
private Disposable subscribe;
|
||||
@@ -262,7 +262,7 @@ public class TaxiModel {
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询出车/收车状态
|
||||
* 接单状态和登录状态查询
|
||||
* 1、初始化查下状态
|
||||
* 2、点击更新接单状态 如果是初始化状态就查下状态
|
||||
* 3、点击更新接单状态后 查询状态
|
||||
@@ -311,14 +311,20 @@ public class TaxiModel {
|
||||
@Override
|
||||
public void onFail(int code, String msg) {
|
||||
ToastUtilsOch.showWithCodeMessage(code,msg);
|
||||
if(mCarStatusCallback!=null) {
|
||||
mCarStatusCallback.onCarLoginStatusChange(StatusManager.isLogin());
|
||||
if(code==TaxiConst.WAIT_TAKEN){
|
||||
subscribe = Observable.timer(3, TimeUnit.SECONDS).subscribe(aLong -> {
|
||||
queryCarStatus();
|
||||
});
|
||||
}else {
|
||||
if (mCarStatusCallback != null) {
|
||||
mCarStatusCallback.onCarLoginStatusChange(StatusManager.isLogin());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//更新出车收车状态
|
||||
//更新接单状态
|
||||
public void updateCarStatus() {
|
||||
if(!StatusManager.isLogin()){
|
||||
queryCarStatus();
|
||||
|
||||
@@ -154,28 +154,6 @@ interface TaxiServiceApiNew {
|
||||
Observable<BaseData> updateOrderStatus(@Header ("appId") String appId,@Header("ticket") String ticket
|
||||
,@Body OrderStatusUpdateReqBean data);
|
||||
|
||||
/**
|
||||
* 收车/出车状态更新
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
// @POST( "/autopilot-car-hailing/api/v1/driver/serviceStatus/update" )
|
||||
@POST( "/autopilot-car-hailing/car/v2/driver/taxi/serviceStatus/update" )
|
||||
Observable<BaseData> updateDriverServiceStatus(@Header ("appId") String appId,@Header("ticket") String ticket
|
||||
,@Body DriverStatusUpdateReqBean data);
|
||||
|
||||
/**
|
||||
* 收车/出车状态查询
|
||||
* @param sn
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
// @GET( "/autopilot-car-hailing/api/v1/driver/serviceStatus/query" )
|
||||
@GET( "/autopilot-car-hailing/car/v2/driver/taxi/serviceStatus/query" )
|
||||
Observable<DriverStatusQueryRespBean> queryDriverServiceStatus(@Header ("appId") String appId
|
||||
,@Header("ticket") String ticket,@Query("sn") String sn);
|
||||
|
||||
/**
|
||||
* 车机端上传心跳数据(只在出车状态时上传):包含高德坐标系经纬度
|
||||
* @param data
|
||||
@@ -362,7 +340,7 @@ interface TaxiServiceApiNew {
|
||||
Observable<BaseData> resetOrderServing(@Header ("appId") String appId,@Header("ticket") String ticket
|
||||
,@Body DriverStatusUpdateReqBean data);
|
||||
/**
|
||||
* 收车/出车状态和登录状态查询
|
||||
* 接单状态和登录状态查询
|
||||
* @param sn
|
||||
* @return
|
||||
*/
|
||||
|
||||
@@ -4,6 +4,7 @@ import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAX
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.eagle.core.network.MoGoRetrofitFactory;
|
||||
@@ -237,22 +238,6 @@ public class TaxiServiceManager {
|
||||
.subscribe(getSubscribeImpl(context, callback, "updateOrderStatus"));
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 收车/出车状态更新
|
||||
// * @param context
|
||||
// * @param status
|
||||
// * @param callback
|
||||
// */
|
||||
// public void updateDriverServiceStatus(Context context, int status,
|
||||
// TaxiServiceCallback<BaseData> callback) {
|
||||
// mOCHTaxiServiceApi.updateDriverServiceStatus(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
// ,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
// ,new DriverStatusUpdateReqBean(
|
||||
// MoGoAiCloudClientConfig.getInstance().getSn(), status))
|
||||
// .subscribeOn(Schedulers.io())
|
||||
// .observeOn(AndroidSchedulers.mainThread())
|
||||
// .subscribe(getSubscribeImpl(context, callback, "updateDriverServiceStatus"));
|
||||
// }
|
||||
|
||||
/**
|
||||
* 暂停接单
|
||||
@@ -266,12 +251,12 @@ public class TaxiServiceManager {
|
||||
baseDataObservable = mOCHTaxiServiceApi.stopOrderServing(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
, MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
, new DriverStatusUpdateReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().getSn(), 0));
|
||||
MoGoAiCloudClientConfig.getInstance().getSn()));
|
||||
}else {// 没有接单去接单
|
||||
baseDataObservable = mOCHTaxiServiceApi.resetOrderServing(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
, MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
, new DriverStatusUpdateReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().getSn(), 0));
|
||||
MoGoAiCloudClientConfig.getInstance().getSn()));
|
||||
}
|
||||
baseDataObservable.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
@@ -279,12 +264,17 @@ public class TaxiServiceManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* 收车/出车状态查询
|
||||
* 接单状态和登录状态查询
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
public void queryDriverServiceStatus(Context context,
|
||||
TaxiServiceCallback<DriverStatusQueryRespBean> callback) {
|
||||
if(MoGoAiCloudClientConfig.getInstance().getToken().isEmpty()){
|
||||
callback.onFail(TaxiConst.WAIT_TAKEN,"等待令牌中请稍等");
|
||||
MoGoAiCloudClient.getInstance().refreshToken();
|
||||
return;
|
||||
}
|
||||
mOCHTaxiServiceApi.queryDriverServiceStatusAndLoginStatus(MoGoAiCloudClientConfig.getInstance().getServiceAppId()
|
||||
,MoGoAiCloudClientConfig.getInstance().getToken()
|
||||
,MoGoAiCloudClientConfig.getInstance().getSn())
|
||||
@@ -466,7 +456,7 @@ public class TaxiServiceManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* 收车/出车状态查询
|
||||
* 获取手机验证码
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
@@ -480,7 +470,7 @@ public class TaxiServiceManager {
|
||||
.subscribe(getSubscribeImpl(context, callback, "getPhoneCode"));
|
||||
}
|
||||
/**
|
||||
* 收车/出车状态查询
|
||||
* 通过验证码登录
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
|
||||
@@ -126,7 +126,7 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
|
||||
TaxiModel.getInstance().confirmAutopilotConditionByDriver();
|
||||
}
|
||||
|
||||
// 更新出车/收车状态
|
||||
// 更新接单状态
|
||||
public void updateCarStatus() {
|
||||
TaxiModel.getInstance().updateCarStatus();
|
||||
}
|
||||
|
||||
@@ -65,7 +65,6 @@ public abstract class BaseTaxiTabFragment<V extends IView, P extends Presenter<V
|
||||
private ImageView mAnimFlowIv;
|
||||
protected TextView tvOperationStatus;
|
||||
protected TextView mDriverRole;
|
||||
public boolean isOperationStatus;//false-收车,true-出车
|
||||
protected FrameLayout flStationPanelContainer;
|
||||
private FrameLayout flNaviPanelContainer;
|
||||
private Group groupTestPanel;
|
||||
|
||||
@@ -176,7 +176,6 @@ public class TaxiFragment extends BaseTaxiTabFragment<TaxiFragment, TaxiPresente
|
||||
*/
|
||||
public void updateOperationStatus(boolean inOperation,String role) {
|
||||
CallerLogger.INSTANCE.e(M_TAXI + TAG, "onOperationChanged:" + inOperation);
|
||||
isOperationStatus = inOperation;
|
||||
if (inOperation) {
|
||||
if (!TextUtils.isEmpty(role)){
|
||||
mDriverRole.setVisibility(View.VISIBLE);
|
||||
@@ -190,7 +189,7 @@ public class TaxiFragment extends BaseTaxiTabFragment<TaxiFragment, TaxiPresente
|
||||
showPanel();
|
||||
} else {
|
||||
mDriverRole.setVisibility(View.GONE);
|
||||
// AIAssist.getInstance(getContext()).speakTTSVoice("已收车");
|
||||
// AIAssist.getInstance(getContext()).speakTTSVoice("已接单");
|
||||
tvOperationStatus.setText("接单");
|
||||
tvOperationStatus.setCompoundDrawablesWithIntrinsicBounds(getResources().getDrawable(R.drawable.taxi_out_btn), null, null, null);
|
||||
mPersonalBtn.setVisibility(View.GONE);
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
android:gravity="center"
|
||||
android:paddingLeft="46px"
|
||||
android:paddingRight="50px"
|
||||
android:text="出车"
|
||||
android:text="--"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/taxi_autopilot_text_color_selector"
|
||||
android:textSize="20sp"
|
||||
|
||||
Reference in New Issue
Block a user