[5.2.8]
[shuttle_p] [网络请求合并]
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
package com.mogo.och.shuttle.passenger.bean;
|
||||
package com.mogo.och.shuttle.passenger.bean.request;
|
||||
|
||||
public
|
||||
/**
|
||||
@@ -7,10 +7,10 @@ public
|
||||
*
|
||||
* 根据车机行驶线路站点信息
|
||||
*/
|
||||
class BusPassengerQueryLineRequest {
|
||||
class PassengerQueryLineRequest {
|
||||
|
||||
private String sn;
|
||||
public BusPassengerQueryLineRequest(String sn) {
|
||||
public PassengerQueryLineRequest(String sn) {
|
||||
this.sn = sn;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.och.shuttle.passenger.bean;
|
||||
package com.mogo.och.shuttle.passenger.bean.response;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.mogo.eagle.core.data.BaseData;
|
||||
*
|
||||
* 小巴车运营状态返回参数
|
||||
*/
|
||||
public class BusPassengerOperationStatusResponse extends BaseData {
|
||||
public class PassengerOperationStatusResponse extends BaseData {
|
||||
|
||||
public Result data;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.och.shuttle.passenger.bean;
|
||||
package com.mogo.och.shuttle.passenger.bean.response;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.och.data.bean.BusRoutesResult;
|
||||
@@ -8,7 +8,7 @@ import com.mogo.och.data.bean.BusRoutesResult;
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class BusPassengerRoutesResponse extends BaseData {
|
||||
public class PassengerRoutesResponse extends BaseData {
|
||||
private BusRoutesResult data;
|
||||
|
||||
public BusRoutesResult getResult() {
|
||||
@@ -2,27 +2,27 @@ package com.mogo.och.shuttle.passenger.network
|
||||
|
||||
import android.content.Context
|
||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager.getServerToken
|
||||
import com.mogo.och.shuttle.passenger.bean.BusPassengerRoutesResponse
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.och.shuttle.passenger.bean.BusPassengerQueryLineRequest
|
||||
import com.mogo.och.shuttle.passenger.bean.BusPassengerOperationStatusResponse
|
||||
import com.mogo.eagle.core.network.MoGoRetrofitFactory
|
||||
import com.mogo.commons.storage.SharedPrefsMgr
|
||||
import com.mogo.och.common.module.biz.constant.OchCommonConst
|
||||
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback
|
||||
import com.mogo.och.common.module.biz.network.OchCommonSubscribeImpl
|
||||
import com.mogo.och.common.module.biz.network.interceptor.transformTry
|
||||
import com.mogo.och.shuttle.passenger.bean.request.PassengerQueryLineRequest
|
||||
import com.mogo.och.shuttle.passenger.bean.response.PassengerOperationStatusResponse
|
||||
import com.mogo.och.shuttle.passenger.bean.response.PassengerRoutesResponse
|
||||
|
||||
/**
|
||||
* Created on 2022/3/31
|
||||
*/
|
||||
object BusPassengerServiceManager {
|
||||
object PassengerServiceManager {
|
||||
|
||||
private var driverSnCache = ""
|
||||
|
||||
private var mShuttleBusPassengerServiceApi =
|
||||
MoGoRetrofitFactory.getInstance(OchCommonConst.getShuttleUrl()).create(
|
||||
ShettlePassengerServiceApi::class.java)
|
||||
ServiceApi::class.java)
|
||||
|
||||
/**
|
||||
* 获取Bus司机端的sn
|
||||
@@ -44,12 +44,12 @@ object BusPassengerServiceManager {
|
||||
*/
|
||||
@JvmStatic
|
||||
fun queryDriverSiteByCoordinate(
|
||||
context: Context, callback: OchCommonServiceCallback<BusPassengerRoutesResponse>?
|
||||
context: Context, callback: OchCommonServiceCallback<PassengerRoutesResponse>?
|
||||
) {
|
||||
mShuttleBusPassengerServiceApi.queryDriverSiteByCoordinate(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
BusPassengerQueryLineRequest(
|
||||
PassengerQueryLineRequest(
|
||||
driverAppSn
|
||||
)
|
||||
).transformTry()
|
||||
@@ -64,7 +64,7 @@ object BusPassengerServiceManager {
|
||||
@JvmStatic
|
||||
fun queryDriverOperationStatus(
|
||||
context: Context,
|
||||
callback: OchCommonServiceCallback<BusPassengerOperationStatusResponse>?
|
||||
callback: OchCommonServiceCallback<PassengerOperationStatusResponse>?
|
||||
) {
|
||||
mShuttleBusPassengerServiceApi.queryDriverOperationStatus(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.mogo.och.shuttle.passenger.network;
|
||||
|
||||
import com.mogo.och.shuttle.passenger.bean.PM2OperationStatusResponse;
|
||||
import com.mogo.och.shuttle.passenger.bean.PM2QueryLineRequest;
|
||||
import com.mogo.och.shuttle.passenger.bean.PM2RoutesResponse;
|
||||
import com.mogo.och.shuttle.passenger.bean.request.PassengerQueryLineRequest;
|
||||
import com.mogo.och.shuttle.passenger.bean.response.PassengerOperationStatusResponse;
|
||||
import com.mogo.och.shuttle.passenger.bean.response.PassengerRoutesResponse;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.Body;
|
||||
@@ -17,14 +17,14 @@ import retrofit2.http.Query;
|
||||
*
|
||||
* Bus乘客端接口定义
|
||||
*/
|
||||
public interface PM2ServiceApi {
|
||||
public interface ServiceApi {
|
||||
/**
|
||||
* 查询bus司机端绑定路线
|
||||
* @return 接口返回数据
|
||||
*/
|
||||
@Headers( {"Content-Type:application/json;charset=UTF-8"} )
|
||||
@POST( "/och-shuttle-cabin/api/business/v1/passenger/lineDataWithDriver/query" )
|
||||
Observable<PM2RoutesResponse> queryDriverSiteByCoordinate(@Header("appId") String appId, @Header("ticket") String ticket, @Body PM2QueryLineRequest request);
|
||||
Observable<PassengerRoutesResponse> queryDriverSiteByCoordinate(@Header("appId") String appId, @Header("ticket") String ticket, @Body PassengerQueryLineRequest request);
|
||||
|
||||
/**
|
||||
* 查询司机端的登陆状态
|
||||
@@ -34,7 +34,5 @@ public interface PM2ServiceApi {
|
||||
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||
// @GET("/autopilot-car-hailing/car/v2/driver/bus/passenger/takeOrderStatus/query")
|
||||
@GET("/och-shuttle-cabin/api/business/v1/passenger/loginStatus")
|
||||
Observable<PM2OperationStatusResponse> queryDriverOperationStatus(@Header ("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn);
|
||||
|
||||
|
||||
Observable<PassengerOperationStatusResponse> queryDriverOperationStatus(@Header ("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn);
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
package com.mogo.och.shuttle.passenger.bean;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 网约车小巴路线接口返回接口数据封装
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class BusPassengerRoutesResult {
|
||||
private List<BusPassengerStation> sites;
|
||||
private int lineId;
|
||||
private String name; //线路名称
|
||||
private int lineType; //线路类型,0:环形
|
||||
private String description;
|
||||
private int status;
|
||||
private String runningDur; //运营时间
|
||||
private long taskTime; //线路时间班次
|
||||
private long writeVersion;//更新时间戳
|
||||
|
||||
public List<BusPassengerStation> getSites() {
|
||||
return sites;
|
||||
}
|
||||
|
||||
public int getLineId() {
|
||||
return lineId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public int getLineType() {
|
||||
return lineType;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public String getRunningDur() {
|
||||
return runningDur;
|
||||
}
|
||||
|
||||
public long getWriteVersion() {
|
||||
return writeVersion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "BusPassengerRoutesResult{" +
|
||||
"sites=" + sites +
|
||||
", lineId=" + lineId +
|
||||
", name='" + name + '\'' +
|
||||
", lineType=" + lineType +
|
||||
", description='" + description + '\'' +
|
||||
", status=" + status +
|
||||
", writeVersion="+ writeVersion+
|
||||
", runningDur='" + runningDur + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
BusPassengerRoutesResult that = (BusPassengerRoutesResult) o;
|
||||
return lineId == that.lineId
|
||||
&& lineType == that.lineType
|
||||
&& status == that.status
|
||||
&& sites.equals(that.sites)
|
||||
&& name.equals(that.name)
|
||||
&& runningDur.equals(that.runningDur);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(sites, lineId, name, lineType, description, status, runningDur);
|
||||
}
|
||||
}
|
||||
@@ -1,173 +0,0 @@
|
||||
package com.mogo.och.shuttle.passenger.bean;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 单个网约车小巴车站信息
|
||||
*
|
||||
* @author wangmingjun
|
||||
*/
|
||||
public class BusPassengerStation {
|
||||
|
||||
private String name;
|
||||
private String description;
|
||||
private String cityCode;
|
||||
private double lon; //高精坐标
|
||||
private double lat; //高精坐标
|
||||
private double gcjLon; //高德坐标
|
||||
private double gcjLat; //高德坐标
|
||||
private int businessType; //站点类型,9:taxi,10:bus
|
||||
private int status;
|
||||
private int siteId;
|
||||
private int seq;
|
||||
private int drivingStatus;//行驶信息,0初始值;1已经过;2当前站;3未到站
|
||||
private int ifStop = 1; // 是否需要停靠、1需要、0不需要 // TODO: 2021/10/19 原来站点里有设计是否需要停靠字段,现设计暂无,默认都需要停靠
|
||||
private boolean leaving;
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public void setCityCode(String cityCode) {
|
||||
this.cityCode = cityCode;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public void setBusinessType(int businessType) {
|
||||
this.businessType = businessType;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public void setSiteId(int siteId) {
|
||||
this.siteId = siteId;
|
||||
}
|
||||
|
||||
public void setSeq(int seq) {
|
||||
this.seq = seq;
|
||||
}
|
||||
|
||||
public void setDrivingStatus(int drivingStatus) {
|
||||
this.drivingStatus = drivingStatus;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public String getCityCode() {
|
||||
return cityCode;
|
||||
}
|
||||
|
||||
public double getGcjLon() {
|
||||
return gcjLon;
|
||||
}
|
||||
|
||||
public double getGcjLat() {
|
||||
return gcjLat;
|
||||
}
|
||||
|
||||
public int getBusinessType() {
|
||||
return businessType;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public int getSiteId() {
|
||||
return siteId;
|
||||
}
|
||||
|
||||
public int getSeq() {
|
||||
return seq;
|
||||
}
|
||||
|
||||
public int getDrivingStatus() {
|
||||
return drivingStatus;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setIfStop(int ifStop) {
|
||||
this.ifStop = ifStop;
|
||||
}
|
||||
|
||||
public int getIfStop() {
|
||||
return ifStop;
|
||||
}
|
||||
|
||||
public void setLeaving(boolean leaving) {
|
||||
this.leaving = leaving;
|
||||
}
|
||||
|
||||
public boolean isLeaving() {
|
||||
return leaving;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OchBusStation{" +
|
||||
"name='" + name + '\'' +
|
||||
", description='" + description + '\'' +
|
||||
", cityCode='" + cityCode + '\'' +
|
||||
", lon=" + lon +
|
||||
", lat=" + lat +
|
||||
", businessType=" + businessType +
|
||||
", status=" + status +
|
||||
", siteId=" + siteId +
|
||||
", seq=" + seq +
|
||||
", drivingStatus=" + drivingStatus +
|
||||
", ifStop=" + ifStop +
|
||||
", leaving=" + leaving +
|
||||
'}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
BusPassengerStation that = (BusPassengerStation) o;
|
||||
return Double.compare(that.lon, lon) == 0
|
||||
&& Double.compare(that.lat, lat) == 0
|
||||
&& Double.compare(that.gcjLon, gcjLon) == 0
|
||||
&& Double.compare(that.gcjLat, gcjLat) == 0
|
||||
&& businessType == that.businessType
|
||||
&& status == that.status
|
||||
&& siteId == that.siteId
|
||||
&& seq == that.seq
|
||||
&& drivingStatus == that.drivingStatus
|
||||
&& ifStop == that.ifStop
|
||||
&& leaving == that.leaving
|
||||
&& Objects.equals(name, that.name)
|
||||
&& Objects.equals(cityCode, that.cityCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(name, description, cityCode, lon, lat, gcjLon, gcjLat, businessType, status, siteId, seq, drivingStatus, ifStop, leaving);
|
||||
}
|
||||
}
|
||||
@@ -28,8 +28,6 @@ import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant;
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils;
|
||||
import com.mogo.och.shuttle.passenger.R;
|
||||
import com.mogo.och.shuttle.passenger.bean.BusPassengerOperationStatusResponse;
|
||||
import com.mogo.och.shuttle.passenger.bean.BusPassengerRoutesResponse;
|
||||
import com.mogo.och.common.module.bean.dpmsg.AppConnectMsg;
|
||||
import com.mogo.och.common.module.bean.dpmsg.BaseDPMsg;
|
||||
import com.mogo.och.common.module.bean.dpmsg.DPMsgType;
|
||||
@@ -52,6 +50,8 @@ import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.commons.storage.SharedPrefsMgr;
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||
import com.mogo.och.shuttle.passenger.bean.response.PassengerOperationStatusResponse;
|
||||
import com.mogo.och.shuttle.passenger.bean.response.PassengerRoutesResponse;
|
||||
import com.mogo.och.shuttle.passenger.callback.IBusPassegerDriverStatusCallback;
|
||||
import com.mogo.och.shuttle.passenger.callback.IBusPassengerADASStatusCallback;
|
||||
import com.mogo.och.shuttle.passenger.callback.IBusPassengerAutopilotPlanningCallback;
|
||||
@@ -59,7 +59,6 @@ import com.mogo.och.shuttle.passenger.callback.IBusPassengerControllerStatusCall
|
||||
import com.mogo.och.shuttle.passenger.callback.IBusPassengerRouteLineInfoCallback;
|
||||
import com.mogo.och.shuttle.passenger.constant.BusPassengerConst;
|
||||
import com.mogo.och.shuttle.passenger.network.BusPassengerModelLoopManager;
|
||||
import com.mogo.och.shuttle.passenger.network.BusPassengerServiceManager;
|
||||
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback;
|
||||
import com.mogo.och.common.module.manager.AbnormalFactorsLoopManager;
|
||||
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil;
|
||||
@@ -67,6 +66,7 @@ import com.mogo.och.common.module.utils.RxUtils;
|
||||
import com.mogo.och.data.bean.BusRoutesResult;
|
||||
import com.mogo.och.data.bean.BusStationBean;
|
||||
import com.mogo.och.data.bean.BusTransferData;
|
||||
import com.mogo.och.shuttle.passenger.network.PassengerServiceManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -166,10 +166,10 @@ public class BusPassengerModel {
|
||||
}
|
||||
|
||||
private void queryDriverOperationStatus() {
|
||||
BusPassengerServiceManager.queryDriverOperationStatus(mContext
|
||||
, new OchCommonServiceCallback<BusPassengerOperationStatusResponse>() {
|
||||
PassengerServiceManager.queryDriverOperationStatus(mContext
|
||||
, new OchCommonServiceCallback<PassengerOperationStatusResponse>() {
|
||||
@Override
|
||||
public void onSuccess(BusPassengerOperationStatusResponse data) {
|
||||
public void onSuccess(PassengerOperationStatusResponse data) {
|
||||
if (data == null || data.data == null) return;
|
||||
if (mDriverStatusCallback != null) {
|
||||
CallerLogger.d( M_BUS_P + TAG, "queryDriverOperationStatus = %s", data.data.plateNumber );
|
||||
@@ -196,10 +196,10 @@ public class BusPassengerModel {
|
||||
}
|
||||
|
||||
public void queryDriverSiteByCoordinate(){
|
||||
BusPassengerServiceManager.queryDriverSiteByCoordinate(mContext
|
||||
, new OchCommonServiceCallback<BusPassengerRoutesResponse>() {
|
||||
PassengerServiceManager.queryDriverSiteByCoordinate(mContext
|
||||
, new OchCommonServiceCallback<PassengerRoutesResponse>() {
|
||||
@Override
|
||||
public void onSuccess(BusPassengerRoutesResponse data) {
|
||||
public void onSuccess(PassengerRoutesResponse data) {
|
||||
if ( data == null || data.getResult() == null) {
|
||||
CallerLogger.d( M_BUS_P + TAG, "queryDriverSiteByCoordinate = null");
|
||||
clearLocalRouteResult();
|
||||
@@ -225,18 +225,18 @@ public class BusPassengerModel {
|
||||
@Override
|
||||
public void onError() {
|
||||
CallerLogger.d( M_BUS_P + TAG, "queryDriverSiteByCoordinate = onError ="
|
||||
+ ", sn = " +BusPassengerServiceManager.INSTANCE.getDriverAppSn());
|
||||
+ ", sn = " +PassengerServiceManager.INSTANCE.getDriverAppSn());
|
||||
queryDriverByLocalDriver();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail(int code, String msg) {
|
||||
CallerLogger.d( M_BUS_P + TAG, "queryDriverSiteByCoordinate = %s", msg
|
||||
+ ", sn = " +BusPassengerServiceManager.INSTANCE.getDriverAppSn());
|
||||
+ ", sn = " +PassengerServiceManager.INSTANCE.getDriverAppSn());
|
||||
if (code == 1003){
|
||||
queryDriverOperationDelay();
|
||||
}
|
||||
if (BusPassengerServiceManager.INSTANCE.getDriverAppSn().isEmpty()){
|
||||
if (PassengerServiceManager.INSTANCE.getDriverAppSn().isEmpty()){
|
||||
//此处拦截是为了防止过程中乘客屏和司机端断连,拿不到司机端sn, 造成请求失败去刷新了界面
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -33,8 +33,6 @@ public class BusPassengerModelLoopManager {
|
||||
}
|
||||
|
||||
private Disposable mQueryLineDisposable; //心跳轮询
|
||||
private CompositeDisposable mRouteWipeDisposable;
|
||||
private CompositeDisposable mCalculateRouteDisposable; //每隔2s计算一次剩余里程和时间
|
||||
|
||||
public void startQueryDriverLineLoop() {
|
||||
if (mQueryLineDisposable != null && !mQueryLineDisposable.isDisposed()) {
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
package com.mogo.och.shuttle.passenger.network;
|
||||
|
||||
import com.mogo.och.shuttle.passenger.bean.BusPassengerOperationStatusResponse;
|
||||
import com.mogo.och.shuttle.passenger.bean.BusPassengerQueryLineRequest;
|
||||
import com.mogo.och.shuttle.passenger.bean.BusPassengerRoutesResponse;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Header;
|
||||
import retrofit2.http.Headers;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
/**
|
||||
* Created on 2022/3/31
|
||||
*
|
||||
* Bus乘客端接口定义
|
||||
*/
|
||||
interface ShettlePassengerServiceApi {
|
||||
/**
|
||||
* 查询bus司机端绑定路线
|
||||
* @return 接口返回数据
|
||||
*/
|
||||
@Headers( {"Content-Type:application/json;charset=UTF-8"} )
|
||||
@POST( "/och-shuttle-cabin/api/business/v1/passenger/lineDataWithDriver/query" )
|
||||
Observable<BusPassengerRoutesResponse> queryDriverSiteByCoordinate(@Header("appId") String appId, @Header("ticket") String ticket, @Body BusPassengerQueryLineRequest request);
|
||||
|
||||
/**
|
||||
* 查询司机端的登陆状态
|
||||
* @param sn
|
||||
* @return
|
||||
*/
|
||||
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||
// @GET("/autopilot-car-hailing/car/v2/driver/bus/passenger/takeOrderStatus/query")
|
||||
@GET("/och-shuttle-cabin/api/business/v1/passenger/loginStatus")
|
||||
Observable<BusPassengerOperationStatusResponse> queryDriverOperationStatus(@Header ("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn);
|
||||
|
||||
|
||||
}
|
||||
@@ -19,7 +19,7 @@ import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.commons.storage.SharedPrefsMgr;
|
||||
import com.mogo.och.shuttle.passenger.R;
|
||||
import com.mogo.och.shuttle.passenger.adapter.BusPassengerLineStationsAdapter;
|
||||
import com.mogo.och.shuttle.passenger.ui.adapter.BusPassengerLineStationsAdapter;
|
||||
import com.mogo.och.shuttle.passenger.constant.BusPassengerConst;
|
||||
import com.mogo.och.shuttle.passenger.presenter.BaseBusPassengerPresenter;
|
||||
import com.mogo.och.shuttle.passenger.ui.layoutmanager.CenterLayoutManager;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.och.shuttle.passenger.adapter;
|
||||
package com.mogo.och.shuttle.passenger.ui.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
@@ -1,21 +0,0 @@
|
||||
package com.mogo.och.shuttle.passenger.bean;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/3/22
|
||||
*
|
||||
* 小巴车运营状态返回参数
|
||||
*/
|
||||
public class PM2OperationStatusResponse extends BaseData {
|
||||
|
||||
public Result data;
|
||||
|
||||
public static class Result {
|
||||
private String sn; //司机屏sn
|
||||
private String phone; //司机手机号
|
||||
public String plateNumber; //车牌号
|
||||
public int driverStatus;//0:已收车,1:已出车
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package com.mogo.och.shuttle.passenger.bean;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.och.data.bean.BusRoutesResult;
|
||||
|
||||
/**
|
||||
* 网约车小巴路线接口请求响应结果 返回的是对应司机屏的线路信息
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class PM2RoutesResponse extends BaseData {
|
||||
private BusRoutesResult data;
|
||||
|
||||
public BusRoutesResult getResult() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setResult(BusRoutesResult data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OchBusRoutesResponse{" +
|
||||
"data=" + data +
|
||||
'}';
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
package com.mogo.och.shuttle.passenger.bean;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 网约车小巴路线接口返回接口数据封装
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class PM2RoutesResult {
|
||||
private List<PM2Station> sites;
|
||||
private int lineId;
|
||||
private String name; //线路名称
|
||||
private int lineType; //线路类型,0:环形
|
||||
private String description;
|
||||
private int status;
|
||||
private String runningDur; //运营时间
|
||||
private long taskTime; //线路时间班次
|
||||
|
||||
public List<PM2Station> getSites() {
|
||||
return sites;
|
||||
}
|
||||
|
||||
public int getLineId() {
|
||||
return lineId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public int getLineType() {
|
||||
return lineType;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public String getRunningDur() {
|
||||
return runningDur;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "BusPassengerRoutesResult{" +
|
||||
"sites=" + sites +
|
||||
", lineId=" + lineId +
|
||||
", name='" + name + '\'' +
|
||||
", lineType=" + lineType +
|
||||
", description='" + description + '\'' +
|
||||
", status=" + status +
|
||||
", runningDur='" + runningDur + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
PM2RoutesResult that = (PM2RoutesResult) o;
|
||||
return lineId == that.lineId
|
||||
&& lineType == that.lineType
|
||||
&& status == that.status
|
||||
&& sites.equals(that.sites)
|
||||
&& name.equals(that.name)
|
||||
&& runningDur.equals(that.runningDur);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(sites, lineId, name, lineType, description, status, runningDur);
|
||||
}
|
||||
}
|
||||
@@ -1,173 +0,0 @@
|
||||
package com.mogo.och.shuttle.passenger.bean;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 单个网约车小巴车站信息
|
||||
*
|
||||
* @author wangmingjun
|
||||
*/
|
||||
public class PM2Station {
|
||||
|
||||
private String name;
|
||||
private String description;
|
||||
private String cityCode;
|
||||
private double lon; //高精坐标
|
||||
private double lat; //高精坐标
|
||||
private double gcjLon; //高德坐标
|
||||
private double gcjLat; //高德坐标
|
||||
private int businessType; //站点类型,9:taxi,10:bus
|
||||
private int status;
|
||||
private int siteId;
|
||||
private int seq;
|
||||
private int drivingStatus;//行驶信息,0初始值;1已经过;2当前站;3未到站
|
||||
private int ifStop = 1; // 是否需要停靠、1需要、0不需要 // TODO: 2021/10/19 原来站点里有设计是否需要停靠字段,现设计暂无,默认都需要停靠
|
||||
private boolean leaving;
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public void setCityCode(String cityCode) {
|
||||
this.cityCode = cityCode;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public void setBusinessType(int businessType) {
|
||||
this.businessType = businessType;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public void setSiteId(int siteId) {
|
||||
this.siteId = siteId;
|
||||
}
|
||||
|
||||
public void setSeq(int seq) {
|
||||
this.seq = seq;
|
||||
}
|
||||
|
||||
public void setDrivingStatus(int drivingStatus) {
|
||||
this.drivingStatus = drivingStatus;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public String getCityCode() {
|
||||
return cityCode;
|
||||
}
|
||||
|
||||
public double getGcjLon() {
|
||||
return gcjLon;
|
||||
}
|
||||
|
||||
public double getGcjLat() {
|
||||
return gcjLat;
|
||||
}
|
||||
|
||||
public int getBusinessType() {
|
||||
return businessType;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public int getSiteId() {
|
||||
return siteId;
|
||||
}
|
||||
|
||||
public int getSeq() {
|
||||
return seq;
|
||||
}
|
||||
|
||||
public int getDrivingStatus() {
|
||||
return drivingStatus;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setIfStop(int ifStop) {
|
||||
this.ifStop = ifStop;
|
||||
}
|
||||
|
||||
public int getIfStop() {
|
||||
return ifStop;
|
||||
}
|
||||
|
||||
public void setLeaving(boolean leaving) {
|
||||
this.leaving = leaving;
|
||||
}
|
||||
|
||||
public boolean isLeaving() {
|
||||
return leaving;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OchBusStation{" +
|
||||
"name='" + name + '\'' +
|
||||
", description='" + description + '\'' +
|
||||
", cityCode='" + cityCode + '\'' +
|
||||
", lon=" + lon +
|
||||
", lat=" + lat +
|
||||
", businessType=" + businessType +
|
||||
", status=" + status +
|
||||
", siteId=" + siteId +
|
||||
", seq=" + seq +
|
||||
", drivingStatus=" + drivingStatus +
|
||||
", ifStop=" + ifStop +
|
||||
", leaving=" + leaving +
|
||||
'}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
PM2Station that = (PM2Station) o;
|
||||
return Double.compare(that.lon, lon) == 0
|
||||
&& Double.compare(that.lat, lat) == 0
|
||||
&& Double.compare(that.gcjLon, gcjLon) == 0
|
||||
&& Double.compare(that.gcjLat, gcjLat) == 0
|
||||
&& businessType == that.businessType
|
||||
&& status == that.status
|
||||
&& siteId == that.siteId
|
||||
&& seq == that.seq
|
||||
&& drivingStatus == that.drivingStatus
|
||||
&& ifStop == that.ifStop
|
||||
&& leaving == that.leaving
|
||||
&& Objects.equals(name, that.name)
|
||||
&& Objects.equals(cityCode, that.cityCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(name, description, cityCode, lon, lat, gcjLon, gcjLat, businessType, status, siteId, seq, drivingStatus, ifStop, leaving);
|
||||
}
|
||||
}
|
||||
@@ -33,11 +33,8 @@ import com.mogo.eagle.core.utilcode.util.NetworkUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.shuttle.passenger.R
|
||||
import com.mogo.och.shuttle.passenger.constant.BusPassengerConst
|
||||
import com.mogo.och.shuttle.passenger.bean.PM2OperationStatusResponse
|
||||
import com.mogo.och.shuttle.passenger.bean.PM2RoutesResponse
|
||||
import com.mogo.och.shuttle.passenger.callback.AutoPilotStatusCallback
|
||||
import com.mogo.och.shuttle.passenger.callback.DrivingInfoCallback
|
||||
import com.mogo.och.shuttle.passenger.model.PM2ServiceManager.driverAppSn
|
||||
import com.mogo.och.shuttle.passenger.network.PM2ModelLoopManager
|
||||
import com.mogo.och.common.module.bean.dpmsg.*
|
||||
import com.mogo.och.common.module.biz.common.socketmessage.OCHSocketMessageManager.pushAppOperationalMsgBox
|
||||
@@ -49,6 +46,9 @@ import com.mogo.och.common.module.utils.RxUtils
|
||||
import com.mogo.och.data.bean.BusRoutesResult
|
||||
import com.mogo.och.data.bean.BusStationBean
|
||||
import com.mogo.och.data.bean.BusTransferData
|
||||
import com.mogo.och.shuttle.passenger.bean.response.PassengerOperationStatusResponse
|
||||
import com.mogo.och.shuttle.passenger.bean.response.PassengerRoutesResponse
|
||||
import com.mogo.och.shuttle.passenger.network.PassengerServiceManager
|
||||
import io.reactivex.disposables.Disposable
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import kotlin.math.abs
|
||||
@@ -78,7 +78,7 @@ class PM2DrivingModel private constructor() {
|
||||
private var mDrivingInfoCallback: DrivingInfoCallback? = null //行程信息
|
||||
private var mAutoStatusCallback: AutoPilotStatusCallback? = null //自动驾驶状态
|
||||
|
||||
private var operationStatus: PM2OperationStatusResponse.Result? = null
|
||||
private var operationStatus: PassengerOperationStatusResponse.Result? = null
|
||||
|
||||
@Volatile
|
||||
private var globalPathTruncation: Disposable? = null
|
||||
@@ -328,17 +328,17 @@ class PM2DrivingModel private constructor() {
|
||||
|
||||
private fun queryDriverOperationStatus() {
|
||||
mContext?.let {
|
||||
PM2ServiceManager.queryDriverOperationStatus(
|
||||
PassengerServiceManager.queryDriverOperationStatus(
|
||||
it,
|
||||
object : OchCommonServiceCallback<PM2OperationStatusResponse> {
|
||||
override fun onSuccess(data: PM2OperationStatusResponse?) {
|
||||
object : OchCommonServiceCallback<PassengerOperationStatusResponse> {
|
||||
override fun onSuccess(data: PassengerOperationStatusResponse?) {
|
||||
if (data?.data == null) return
|
||||
if (data.data.driverStatus != operationStatus?.driverStatus
|
||||
|| data.data.plateNumber != operationStatus?.plateNumber){
|
||||
d(SceneConstant.M_BUS_P+TAG, "queryDriverOperationStatus ===== 车牌或者登陆状态有变更")
|
||||
mDrivingInfoCallback?.changeOperationStatus(data.data.driverStatus == 1)
|
||||
}
|
||||
operationStatus = data.data as PM2OperationStatusResponse.Result
|
||||
operationStatus = data.data as PassengerOperationStatusResponse.Result
|
||||
// mDrivingInfoCallback?.updatePlateNumber(data.data.plateNumber)
|
||||
}
|
||||
|
||||
@@ -362,9 +362,9 @@ class PM2DrivingModel private constructor() {
|
||||
|
||||
fun queryDriverSiteByCoordinate(){
|
||||
mContext?.let {
|
||||
PM2ServiceManager.queryDriverSiteByCoordinate(it,
|
||||
object : OchCommonServiceCallback<PM2RoutesResponse>{
|
||||
override fun onSuccess(data: PM2RoutesResponse?) {
|
||||
PassengerServiceManager.queryDriverSiteByCoordinate(it,
|
||||
object : OchCommonServiceCallback<PassengerRoutesResponse>{
|
||||
override fun onSuccess(data: PassengerRoutesResponse?) {
|
||||
|
||||
if (data == null || data.result == null){
|
||||
if (routesResult != null) {
|
||||
@@ -396,7 +396,7 @@ class PM2DrivingModel private constructor() {
|
||||
CallerLogger.d(
|
||||
SceneConstant.Companion.M_BUS_P + TAG,
|
||||
"queryDriverSiteByCoordinate = onError ="
|
||||
+ ", sn = " + driverAppSn
|
||||
+ ", sn = " + PassengerServiceManager.driverAppSn
|
||||
)
|
||||
queryDriverByLocalDriver()
|
||||
}
|
||||
@@ -406,7 +406,7 @@ class PM2DrivingModel private constructor() {
|
||||
if (code == 1003){
|
||||
queryDriverOperationDelay()
|
||||
}
|
||||
if (PM2ServiceManager.driverAppSn.isEmpty()){
|
||||
if (PassengerServiceManager.driverAppSn.isEmpty()){
|
||||
return
|
||||
}
|
||||
if (code == 1003) {
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
package com.mogo.och.shuttle.passenger.model
|
||||
|
||||
import android.content.Context
|
||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager.getServerToken
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.eagle.core.network.MoGoRetrofitFactory
|
||||
import com.mogo.commons.storage.SharedPrefsMgr
|
||||
import com.mogo.och.shuttle.passenger.bean.PM2OperationStatusResponse
|
||||
import com.mogo.och.shuttle.passenger.bean.PM2QueryLineRequest
|
||||
import com.mogo.och.shuttle.passenger.bean.PM2RoutesResponse
|
||||
import com.mogo.och.shuttle.passenger.network.PM2ServiceApi
|
||||
import com.mogo.och.common.module.biz.constant.OchCommonConst
|
||||
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback
|
||||
import com.mogo.och.common.module.biz.network.OchCommonSubscribeImpl
|
||||
import com.mogo.och.common.module.biz.network.interceptor.transformTry
|
||||
|
||||
/**
|
||||
* Created on 2022/3/31
|
||||
*/
|
||||
object PM2ServiceManager {
|
||||
|
||||
private var mBusPassengerServiceApi =
|
||||
MoGoRetrofitFactory.getInstance(OchCommonConst.getShuttleUrl()).create(PM2ServiceApi::class.java)
|
||||
|
||||
private var driverSnCache = ""
|
||||
/**
|
||||
* 获取Bus司机端的sn
|
||||
* @return
|
||||
*/
|
||||
public val driverAppSn: String
|
||||
get(){
|
||||
val serverToken = getServerToken()
|
||||
if (serverToken != driverSnCache && serverToken.isNotEmpty()) {
|
||||
driverSnCache = serverToken
|
||||
}
|
||||
return driverSnCache
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询绑定行驶的小巴车路线
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun queryDriverSiteByCoordinate(
|
||||
context: Context, callback: OchCommonServiceCallback<PM2RoutesResponse>?
|
||||
) {
|
||||
mBusPassengerServiceApi.queryDriverSiteByCoordinate(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
PM2QueryLineRequest(
|
||||
driverAppSn
|
||||
)
|
||||
).transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryDriverSiteByCoordinate=sn =$driverAppSn"))
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询司机端出车收车状态,以及车牌号
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun queryDriverOperationStatus(
|
||||
context: Context,
|
||||
callback: OchCommonServiceCallback<PM2OperationStatusResponse>?
|
||||
) {
|
||||
mBusPassengerServiceApi.queryDriverOperationStatus(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
driverAppSn
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryDriverOperationStatus=sn =$driverAppSn"))
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user