Duplicate OCH/mogo-och-taxi history in OCH/mogo-och-taxi-unmanned1 history.
@@ -0,0 +1,7 @@
|
||||
package com.mogo.och.taxi.base
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/7/24
|
||||
*/class AvoidLeakDialog {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.mogo.och.taxi.base
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/7/24
|
||||
*/class BaseTaxiTabFragment {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.mogo.och.taxi.base
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/7/24
|
||||
*/class BaseTaxiUIFragment {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.mogo.och.taxi.model
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/7/25
|
||||
*/class TaxiModel {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.mogo.och.taxi.ui
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/7/24
|
||||
*/interface ITaxiMapDirectionView {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.mogo.och.taxi.ui
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/7/24
|
||||
*/class TaxiAmapNaviFragment {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.mogo.och.taxi.ui
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/7/24
|
||||
*/class TaxiBeingServedOrdersFragment {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.mogo.och.taxi.ui
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/7/24
|
||||
*/class TaxiFragment {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.mogo.och.taxi.ui
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/7/24
|
||||
*/class TaxiOperationDatasFragment {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.mogo.och.taxi.ui
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/7/24
|
||||
*/class TaxiPersonalDialogFragment {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.mogo.och.taxi.ui
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/7/24
|
||||
*/class TaxiReserveOrdersFragment {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.mogo.och.taxi.ui
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/7/24
|
||||
*/class TaxiRottingNaviFragment {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.mogo.och.taxi.ui
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/7/25
|
||||
*/class TaxiServerOrdersFragment {
|
||||
}
|
||||
1
OCH/mogo-och-taxi-unmanned1/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
63
OCH/mogo-och-taxi-unmanned1/build.gradle
Normal file
@@ -0,0 +1,63 @@
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
// buildToolsVersion rootProject.ext.android.buildToolsVersion
|
||||
defaultConfig {
|
||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||
versionCode Integer.valueOf(VERSION_CODE)
|
||||
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
|
||||
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles "consumer-rules.pro"
|
||||
|
||||
javaCompileOptions {
|
||||
annotationProcessorOptions {
|
||||
arguments = [AROUTER_MODULE_NAME: project.getName()]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
lintOptions {
|
||||
abortOnError false
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
debug {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||
implementation rootProject.ext.dependencies.kotlinstdlibjdk7
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
implementation rootProject.ext.dependencies.androidxrecyclerview
|
||||
implementation rootProject.ext.dependencies.material
|
||||
annotationProcessor rootProject.ext.dependencies.aroutercompiler
|
||||
implementation rootProject.ext.dependencies.rxandroid
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
implementation rootProject.ext.dependencies.amapnavi3dmap
|
||||
|
||||
implementation project(":OCH:mogo-och-common-module")
|
||||
compileOnly project(":libraries:mogo-map")
|
||||
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
0
OCH/mogo-och-taxi-unmanned1/consumer-rules.pro
Normal file
3
OCH/mogo-och-taxi-unmanned1/gradle.properties
Normal file
@@ -0,0 +1,3 @@
|
||||
GROUP=com.mogo.och
|
||||
POM_ARTIFACT_ID=och-taxi
|
||||
VERSION_CODE=1
|
||||
21
OCH/mogo-och-taxi-unmanned1/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
5
OCH/mogo-och-taxi-unmanned1/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.och.taxi">
|
||||
|
||||
/
|
||||
</manifest>
|
||||
BIN
OCH/mogo-och-taxi-unmanned1/src/main/assets/map_style.data
Normal file
BIN
OCH/mogo-och-taxi-unmanned1/src/main/assets/map_style_extra.data
Normal file
@@ -0,0 +1,24 @@
|
||||
package com.mogo.och.taxi;
|
||||
|
||||
import androidx.annotation.IdRes;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import com.mogo.eagle.core.function.api.base.IMoGoFunctionProvider;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/1/15
|
||||
*
|
||||
* 网约车抽象接口
|
||||
*/
|
||||
interface IMogoOCH extends IMoGoFunctionProvider {
|
||||
|
||||
/**
|
||||
* 初始化网约车容器
|
||||
*
|
||||
* @param activity
|
||||
* @param containerId 容器ID
|
||||
*/
|
||||
void createCoverage(FragmentActivity activity, @IdRes int containerId);
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package com.mogo.och.taxi;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAXI;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.eagle.core.function.call.setting.CallerMoGoUiSettingManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.och.taxi.constant.TaxiConst;
|
||||
import com.mogo.och.taxi.ui.TaxiFragment;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/1/15
|
||||
* <p>
|
||||
* 网约车-出租车
|
||||
*/
|
||||
@Route( path = TaxiConst.PATH )
|
||||
class TaxiProvider implements IMogoOCH {
|
||||
|
||||
private static final String TAG = "TaxiProvider";
|
||||
private TaxiFragment ochTaxiFragment;
|
||||
private FragmentActivity mActivity;
|
||||
private int mContainerId;
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
CallerLogger.INSTANCE.d( M_TAXI + TAG, "init" );
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入鹰眼模式,设置手势缩放地图失效
|
||||
*/
|
||||
private void stepIntoVrMode() {
|
||||
CallerLogger.INSTANCE.d( M_TAXI + TAG, "进入vr模式" );
|
||||
CallerMoGoUiSettingManager.INSTANCE.stepInNightMode();//夜间模式 状态栏字体颜色变黑
|
||||
}
|
||||
|
||||
private void showFragment() {
|
||||
FragmentManager supportFragmentManager = mActivity.getSupportFragmentManager();
|
||||
if (ochTaxiFragment == null) {
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "准备add fragment======");
|
||||
Fragment fragmentByTag = supportFragmentManager.findFragmentByTag(TaxiFragment.TAG);
|
||||
if (fragmentByTag instanceof TaxiFragment){
|
||||
ochTaxiFragment = (TaxiFragment) fragmentByTag;
|
||||
}else {
|
||||
ochTaxiFragment = new TaxiFragment();
|
||||
}
|
||||
|
||||
if (!ochTaxiFragment.isAdded()){
|
||||
supportFragmentManager.beginTransaction().add(mContainerId, ochTaxiFragment
|
||||
,TaxiFragment.TAG).commitAllowingStateLoss();
|
||||
}
|
||||
return;
|
||||
}
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "准备show fragment");
|
||||
supportFragmentManager.beginTransaction().show(ochTaxiFragment).commitAllowingStateLoss();
|
||||
}
|
||||
|
||||
private void hideFragment(){
|
||||
if (ochTaxiFragment != null){
|
||||
mActivity.getSupportFragmentManager().beginTransaction().hide(ochTaxiFragment).commitAllowingStateLoss();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createCoverage(FragmentActivity activity, int containerId) {
|
||||
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getFunctionName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Fragment createCoverage(@Nullable FragmentActivity fragmentActivity, @Nullable Integer integer) {
|
||||
this.mActivity = fragmentActivity;
|
||||
this.mContainerId = integer;
|
||||
showFragment();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
//若不调用finish, 设置中打开关闭UITouch,会造成och fragment 重叠
|
||||
if (mActivity == null) return;
|
||||
mActivity.finish();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.mogo.och.taxi.bean;
|
||||
|
||||
import com.mogo.och.taxi.constant.TaxiConst;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Created on 2021/9/16
|
||||
*
|
||||
* 上传车机心跳信息请求数据
|
||||
*/
|
||||
public class CarHeartbeatReqBean {
|
||||
public String sn;
|
||||
public double lon; //经度
|
||||
public double lat; //纬度
|
||||
public String msgId; //心跳信息唯一标识
|
||||
public int interval; //上报间隔,单位秒,非必传,默认60秒
|
||||
|
||||
public CarHeartbeatReqBean(String sn, double lon, double lat) {
|
||||
this.sn = sn;
|
||||
this.lon = lon;
|
||||
this.lat = lat;
|
||||
this.msgId = UUID.randomUUID().toString();
|
||||
this.interval = (int) (TaxiConst.LOOP_PERIOD_60S / 1000);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.mogo.och.taxi.bean;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
/**
|
||||
* Created on 2021/9/17
|
||||
*
|
||||
* 司机运营数据返回数据结构
|
||||
*/
|
||||
public class DriverServiceDataRespBean extends BaseData {
|
||||
public Result data;
|
||||
|
||||
public static class Result {
|
||||
public long timeDuration; //当日在线时长,单位秒
|
||||
public long orderNum; //当日完成订单数
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.mogo.och.taxi.bean;
|
||||
|
||||
/**
|
||||
* Created by pangfan on 2021/8/19
|
||||
*
|
||||
* 状态更新请求数据结构
|
||||
*/
|
||||
public class DriverStatusUpdateReqBean {
|
||||
public String sn;
|
||||
|
||||
public DriverStatusUpdateReqBean(String sn) {
|
||||
this.sn = sn;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.mogo.och.taxi.bean;
|
||||
|
||||
/**
|
||||
* Created by pangfan on 2021/8/19
|
||||
*
|
||||
* 司机取消订单请求的数据结构
|
||||
*/
|
||||
public class OrderCancelReqBean {
|
||||
public String sn;
|
||||
public String orderNo; //订单号(必须)
|
||||
public int cancelType; //取消类型(必须)
|
||||
public String cancelReason; //取消原因(必须)
|
||||
|
||||
public OrderCancelReqBean(String sn, String orderNo, int cancelType, String cancelReason) {
|
||||
this.sn = sn;
|
||||
this.orderNo = orderNo;
|
||||
this.cancelType = cancelType;
|
||||
this.cancelReason = cancelReason;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.mogo.och.taxi.bean;
|
||||
|
||||
/**
|
||||
* Created on 2021/9/7
|
||||
*
|
||||
* (预约单)抢单动作的请求数据结构
|
||||
*/
|
||||
public class OrderGrabReqBean {
|
||||
public String sn;
|
||||
public String orderNo;
|
||||
|
||||
public OrderGrabReqBean(String sn, String orderNo) {
|
||||
this.sn = sn;
|
||||
this.orderNo = orderNo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.mogo.och.taxi.bean;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
/**
|
||||
* Created on 2021/9/7
|
||||
*
|
||||
* (预约单)抢单动作的返回数据结构
|
||||
*/
|
||||
public class OrderGrabRespBean extends BaseData {
|
||||
public String data; // 暂不使用 返回的orderNo,不再是orderId
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.mogo.och.taxi.bean;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
/**
|
||||
* Created on 2021/9/7
|
||||
*
|
||||
* (预约单)查询抢单结果的返回数据结构
|
||||
*/
|
||||
public class OrderGrabStatusQueryRespBean extends BaseData {
|
||||
public Result data;
|
||||
|
||||
public static class Result {
|
||||
public int grabStatus; //0:抢单中; 1:抢单结束,匹配; 2:抢单结束,匹配到其他司机;3:订单已取消;4:非法,不是选择的自己
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.mogo.och.taxi.bean;
|
||||
|
||||
/**
|
||||
* Created by pangfan on 2021/8/19
|
||||
*
|
||||
* 查询订单信息请求数据结构
|
||||
*/
|
||||
public class OrderQueryReqBean {
|
||||
|
||||
public String sn;
|
||||
public String orderNo;
|
||||
|
||||
public OrderQueryReqBean(String sn, String orderNo) {
|
||||
this.sn = sn;
|
||||
this.orderNo = orderNo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package com.mogo.och.taxi.bean;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Created by pangfan on 2021/8/19
|
||||
*
|
||||
* 查询订单返回数据结构
|
||||
*/
|
||||
public class OrderQueryRespBean extends BaseData {
|
||||
public Result data;
|
||||
|
||||
public static class Result implements Comparable<Result>{
|
||||
// 订单no
|
||||
public String orderNo;
|
||||
// 订单类型
|
||||
public int orderType; //1即时单 2预约单
|
||||
// 订单状态
|
||||
public int orderStatus;
|
||||
// 订单运营类型 (9出租车,10小巴)
|
||||
public int businessType;
|
||||
// 起始站点id
|
||||
public int startSiteId;
|
||||
// 起始站点名称
|
||||
public String startSiteAddr;
|
||||
// 起始站点坐标
|
||||
public List<Double> startSitePoint; //wgs坐标,用于自动驾驶 [lon,lat]
|
||||
public List<Double> startSiteGcjPoint; //高德坐标,用于本地计算距离 [lon,lat]
|
||||
// 终点站点id
|
||||
public int endSiteId;
|
||||
// 终点站点名称
|
||||
public String endSiteAddr;
|
||||
// 终点站点坐标
|
||||
public List<Double> endSitePoint; //wgs坐标,用于自动驾驶 [lon,lat]
|
||||
public List<Double> endSiteGcjPoint; //高德坐标,用于计算距离 [lon,lat]
|
||||
|
||||
// 车牌号
|
||||
public String carNumber;
|
||||
//订单创建时间戳
|
||||
public long createTime;
|
||||
//开始服务时间戳:司机点击'开始服务'后订单状态更新成功的时间
|
||||
public long startTime;
|
||||
//预计用车时间:预约单=下单时的预约用车时间;即时单=派单成功的时间+预估的达到上车点的时间
|
||||
public long bookingTime;
|
||||
//乘客手机号
|
||||
public String passengerPhone;
|
||||
//订单多少乘客
|
||||
public String passengerNum;
|
||||
|
||||
//线路轨迹相关字段
|
||||
public long lineId = -1; //路线id,默认-1
|
||||
public String csvFileUrl = ""; //轨迹文件下载的cos url,默认“”
|
||||
public String csvFileMd5 = ""; //轨迹文件md5,默认“”
|
||||
public String txtFileUrl = ""; //打点文件下载的cos url,默认“”
|
||||
public String txtFileMd5 = ""; //轨迹文件md5,默认“”
|
||||
public long contrailSaveTime; //上传轨迹完成时间戳ms:用于MEC本地手动导入轨迹验证时不会被云端轨迹覆盖
|
||||
public String carModel = ""; //[optional] 车型号(如红旗H9),默认“”,暂不加入校验逻辑、用于人工排查问题
|
||||
public String csvFileUrlDPQP = ""; //轨迹文件下载的cos url,默认“”
|
||||
public String csvFileMd5DPQP = ""; //轨迹文件md5,默认“”
|
||||
public String txtFileUrlDPQP = ""; //打点文件下载的cos url,默认“”
|
||||
public String txtFileMd5DPQP = ""; //轨迹文件md5,默认“”
|
||||
public long contrailSaveTimeDPQP; //上传轨迹完成时间戳ms:用于MEC本地手动导入轨迹验证时不会被云端轨迹覆盖
|
||||
|
||||
// !!!接口中暂无此字段,仅用于本地实现逻辑使用:起始站目的站距离km
|
||||
public double travelDistance;
|
||||
|
||||
/**
|
||||
* @param distance
|
||||
*/
|
||||
public void decreaseTravelDistance( double distance ) {
|
||||
travelDistance = ( ( float ) distance / 1000f );
|
||||
if ( travelDistance < 0 ) {
|
||||
travelDistance = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Result o) {
|
||||
boolean isEqual = this.orderNo.equals(o.orderNo);
|
||||
return isEqual ? 0 : 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
Result result = (Result) o;
|
||||
return Objects.equals(orderNo, result.orderNo) &&
|
||||
orderType == result.orderType &&
|
||||
orderStatus == result.orderStatus &&
|
||||
businessType == result.businessType;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(orderNo, orderType, orderStatus, businessType, startSiteId,
|
||||
startSiteAddr, startSitePoint, startSiteGcjPoint, endSiteId, endSiteAddr,
|
||||
endSitePoint, endSiteGcjPoint, carNumber, createTime, startTime, travelDistance);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.mogo.och.taxi.bean;
|
||||
|
||||
/**
|
||||
* Created on 2021/9/7
|
||||
*
|
||||
* 查询订单路径信息(起始点里程、预估时间等)请求数据结构
|
||||
*/
|
||||
public class OrderQueryRouteInfoReqBean {
|
||||
public String sn;
|
||||
public String orderNo;
|
||||
|
||||
public OrderQueryRouteInfoReqBean(String sn, String orderNo) {
|
||||
this.sn = sn;
|
||||
this.orderNo = orderNo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.mogo.och.taxi.bean;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
/**
|
||||
* Created on 2021/9/7
|
||||
*
|
||||
* 查询订单路径信息(起始点里程、预估时间等)返回数据结构
|
||||
*/
|
||||
public class OrderQueryRouteInfoRespBean extends BaseData {
|
||||
public Result data;
|
||||
|
||||
public static class Result {
|
||||
// 到上车点
|
||||
public long durationToStart; //司机绑定时的位置距离上车点时长,单位:秒
|
||||
public long distanceToStart; //司机绑定时的位置距离上车点距离,单位:米
|
||||
|
||||
// 起点至终点
|
||||
public long durationToEnd; //订单上车点到目的地的时长,单位:秒
|
||||
public long distanceToEnd; //订单上车点到目的地的距离,单位:米
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.mogo.och.taxi.bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by pangfan on 2021/8/19
|
||||
*
|
||||
* 订单状态更新请求数据结构
|
||||
*/
|
||||
public class OrderRouteUpdateReqBean {
|
||||
public String orderNo;
|
||||
public List<Result> points;
|
||||
|
||||
public static class Result {
|
||||
public Double latitude;
|
||||
public Double longitude;
|
||||
}
|
||||
|
||||
public OrderRouteUpdateReqBean(String orderNo, List<Result> points) {
|
||||
this.orderNo = orderNo;
|
||||
this.points = points;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.mogo.och.taxi.bean;
|
||||
|
||||
/**
|
||||
* Created by pangfan on 2021/8/19
|
||||
*
|
||||
* 订单状态更新请求数据结构
|
||||
*/
|
||||
public class OrderStatusUpdateReqBean {
|
||||
public String sn;
|
||||
public String orderNo;
|
||||
public int orderStatus;
|
||||
|
||||
public OrderStatusUpdateReqBean(String sn, String orderNo, int orderStatus) {
|
||||
this.sn = sn;
|
||||
this.orderNo = orderNo;
|
||||
this.orderStatus = orderStatus;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.mogo.och.taxi.bean;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created on 2021/9/8
|
||||
*
|
||||
* 查询全部服务中/待服务订单的返回数据
|
||||
*/
|
||||
public class OrdersInServiceQueryRespBean extends BaseData {
|
||||
public Result data;
|
||||
|
||||
public static class Result {
|
||||
public List<OrderQueryRespBean.Result> servicing; //服务中订单
|
||||
public List<OrderQueryRespBean.Result> waitService; //待服务订单
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.mogo.och.taxi.bean;
|
||||
|
||||
/**
|
||||
* Created by pangfan on 2021/8/19
|
||||
*
|
||||
* 查询订单列表请求数据结构
|
||||
*/
|
||||
public class OrdersListQueryReqBean {
|
||||
|
||||
public String sn;
|
||||
public int page; //页码,从0开始
|
||||
public int size; //每页条数
|
||||
|
||||
public OrdersListQueryReqBean(String sn, int page, int size) {
|
||||
this.sn = sn;
|
||||
this.page = page;
|
||||
this.size = size;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.mogo.och.taxi.bean;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by pangfan on 2021/8/19
|
||||
*/
|
||||
public class OrdersListQueryRespBean extends BaseData {
|
||||
public Result data;
|
||||
|
||||
public static class Result {
|
||||
public List<OrderQueryRespBean.Result> orders;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.mogo.och.taxi.bean;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created on 2021/9/8
|
||||
*
|
||||
* 查询新到的预约单的返回数据结构
|
||||
*/
|
||||
public class OrdersNewBookingQueryRespBean extends BaseData {
|
||||
public Result data;
|
||||
|
||||
public static class Result {
|
||||
public List<String> orders; // 返回的是order的orderNo集合, 不再是orderId集合
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.mogo.och.taxi.bean;
|
||||
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by pangfan on 2021/8/19
|
||||
*/
|
||||
public class QueryOrderRouteResp extends BaseData {
|
||||
public List<LatLng> data;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.mogo.och.taxi.bean;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
/**
|
||||
* Created by pangfan on 2021/8/19
|
||||
*
|
||||
* 查询订单返回数据结构
|
||||
*/
|
||||
public class TaxiDataBaseRespBean extends BaseData {
|
||||
public Object data;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.mogo.och.taxi.bean;
|
||||
|
||||
/**
|
||||
* Created by pangfan on 2021/8/19
|
||||
* 司机端准备好或者乘客已验证上车请求参数
|
||||
*/
|
||||
public class TaxiOrPassengerReadyReqBean {
|
||||
|
||||
public String orderNo;
|
||||
public String sn;
|
||||
public TaxiOrPassengerReadyReqBean.Result loc;
|
||||
|
||||
public static class Result {
|
||||
public Double lat;
|
||||
public Double lon;
|
||||
}
|
||||
|
||||
public TaxiOrPassengerReadyReqBean(String sn, String orderNo, TaxiOrPassengerReadyReqBean.Result point) {
|
||||
this.sn = sn;
|
||||
this.orderNo = orderNo;
|
||||
this.loc = point;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.mogo.och.taxi.bean;
|
||||
|
||||
|
||||
public class UpdateOrderDisAndTimeReqBean {
|
||||
public String orderNo; //订单号(必须)
|
||||
public long distance; //剩余里程 单位米(必须)
|
||||
public long duration; //剩余时间 单位秒(必须)
|
||||
|
||||
public UpdateOrderDisAndTimeReqBean(String orderNo, long distance, long duration) {
|
||||
this.orderNo = orderNo;
|
||||
this.distance = distance;
|
||||
this.duration = duration;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.mogo.och.taxi.callback;
|
||||
|
||||
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/11/1
|
||||
*/
|
||||
public interface IOCHTaxiAutopilotPlanningCallback {
|
||||
void setLineMarker(LatLng startStation,LatLng endStation);
|
||||
void routeResult(List<LatLng> routeArrivied,List<LatLng> routeArriving, MogoLocation location);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.mogo.och.taxi.callback;
|
||||
|
||||
/**
|
||||
* Created on 2021/9/8
|
||||
*
|
||||
* Model->Presenter回调:ADAS相关(自动驾驶状态回调,到达终点等等)
|
||||
*/
|
||||
public interface ITaxiADASStatusCallback {
|
||||
// 自动驾驶触发的已到达目的地:暂未用到
|
||||
void onAutopilotArriveEnd();
|
||||
|
||||
// 自动驾驶可用状态
|
||||
void onAutopilotEnable();
|
||||
|
||||
// 自动驾驶不可用状态
|
||||
void onAutopilotDisable();
|
||||
|
||||
// 自动驾驶运行中
|
||||
void onAutopilotRunning();
|
||||
|
||||
//人机共驾
|
||||
void onManMachineCoDriving();
|
||||
|
||||
//自驾返回失败
|
||||
void onStartAdasFailure();
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.mogo.och.taxi.callback;
|
||||
|
||||
import com.mogo.och.taxi.bean.OrderQueryRespBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created on 2021/9/8
|
||||
*
|
||||
* Model->Presenter回调:接单车状态变更 登录状态变更
|
||||
*/
|
||||
public interface ITaxiCarOperationalCallback {
|
||||
|
||||
void onServiceDataUpdate(long dailyTimeDuration, long dailyOrderNum);
|
||||
|
||||
void onOrdersListPageRefresh(List<OrderQueryRespBean.Result> ordersList);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.mogo.och.taxi.callback;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
|
||||
/**
|
||||
* Created on 2021/9/10
|
||||
*
|
||||
* Model->Presenter回调:状态控制器监听(accOn、adas ui show、voice ui show、push ui show、v2x ui show等等)
|
||||
*/
|
||||
public interface ITaxiControllerStatusCallback {
|
||||
// 是否vr map模式
|
||||
void onVRModeChanged(boolean isVRMode);
|
||||
// 自车定位
|
||||
void onCarLocationChanged(MogoLocation location);
|
||||
//开始开启自动驾驶
|
||||
void startOpenAutopilot();
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.mogo.och.taxi.callback;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.mogo.och.taxi.bean.OrderQueryRespBean;
|
||||
import com.mogo.och.taxi.bean.OrderQueryRouteInfoRespBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created on 2021/9/8
|
||||
*
|
||||
* Model->Presenter回调:订单相关(进行中/待服务单变更,当前进行单状态变更,新到预约单,抢单,抢单结果状态等等)
|
||||
*/
|
||||
public interface ITaxiOrderStatusCallback {
|
||||
// 进行中单变更:暂未用到
|
||||
void onOrdersInServiceChanged(@NonNull List<OrderQueryRespBean.Result> inServiceList);
|
||||
// 待服务单变更
|
||||
void onOrdersWaitServiceChanged(@NonNull List<OrderQueryRespBean.Result> waitServiceList);
|
||||
|
||||
// 当前进行单状态变更:新到进行中订单、进行中单状态变更
|
||||
void onCurrentOrderStatusChanged(OrderQueryRespBean.Result order);
|
||||
// 当前订单取消完成:用于司机主动取消订单的结果反馈
|
||||
void onCurrentOrderCancelDone();
|
||||
// 待服务单被取消
|
||||
void onOrderCancelDone(String orderNo);
|
||||
// 当前订单route信息查询反馈
|
||||
void onCurrentOrderRouteInfoGot(OrderQueryRouteInfoRespBean.Result routeInfo);
|
||||
// 当前位置距离上车点的距离(米)、预估时间(秒)
|
||||
void onCurrentOrderDistToStartChanged(long meters, long timeInSecond);
|
||||
// 当前位置距离上车点的距离(米)、预估时间(秒)
|
||||
void onCurrentOrderDistToEndChanged(long meters, long timeInSecond);
|
||||
|
||||
// 新到预约单
|
||||
void onNewBookingOrderGot(OrderQueryRespBean.Result order);
|
||||
|
||||
// 执行抢单动作完成:可进入抢单中状态
|
||||
void onGrabOrderExecuteDone();
|
||||
|
||||
// 抢到预约单
|
||||
void onGrabOrderSuccess(OrderQueryRespBean.Result order);
|
||||
|
||||
// 未抢到预约单
|
||||
void onGrabOrderFailed(OrderQueryRespBean.Result order);
|
||||
|
||||
// 司机已确认开启自动驾驶环境
|
||||
void onDriverHasCheckedPilotCondition(boolean isSafe);
|
||||
|
||||
/**
|
||||
* 导航到目的地
|
||||
* @param isAmap 是否是高德导航
|
||||
* @param isShow 是否显示导航地图(否播报声音)
|
||||
*/
|
||||
void onNaviToEnd(boolean isAmap, boolean isShow);
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.mogo.och.taxi.constant
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
|
||||
/**
|
||||
* Created on 2021/12/6
|
||||
*/
|
||||
class TaxiConst {
|
||||
companion object {
|
||||
|
||||
// OCH arouter 路由path
|
||||
const val PATH = "/driver/api"
|
||||
|
||||
// 到达起始点围栏
|
||||
const val ARRIVE_AT_START_STATION_DISTANCE = 15 //围栏由20m改为50m 再次改为15m
|
||||
|
||||
// 上报心跳轮询ms
|
||||
const val LOOP_PERIOD_60S = 60 * 1000L
|
||||
// 开始服务启动自动驾驶等待时间(埋点上传)
|
||||
const val LOOP_PERIOD_15S = 15 * 1000L
|
||||
// 轮询查询进行中/待服务订单的间隔时间 2秒
|
||||
const val LOOP_PERIOD_2S = 2 * 1000L
|
||||
// 轮询查询新到预约单 1秒
|
||||
const val LOOP_PERIOD_1S = 1 * 1000L
|
||||
const val LOOP_DELAY = 100L
|
||||
|
||||
// 下发给MEC轨迹信息间隔时间 10秒
|
||||
const val LOOP_PERIOD_10S = 10 * 1000L
|
||||
// 尝试下发给MEC轨迹最多10次
|
||||
const val LOOP_SEND_TRAJ_TIMES = 10
|
||||
|
||||
// 订单信息
|
||||
const val SP_KEY_OCH_TAXI_ORDER = "SP_KEY_OCH_TAXI_ORDER"
|
||||
|
||||
//起点UUID
|
||||
const val TAXI_START_MAP_MAKER = "taxi_start_map_maker"
|
||||
//终点UUID
|
||||
const val TAXI_END_MAP_MAKER = "taxi_end_map_maker"
|
||||
|
||||
//演示:V 测试:内测
|
||||
const val DEMO_USER = "V"
|
||||
const val TEST_USER = "内测"
|
||||
|
||||
// 埋点key:接管后点击'自动驾驶'按钮启动
|
||||
const val EVENT_KEY_RESTART_AUTOPILOT = "event_key_och_taxi_restart_autopilot"
|
||||
// 埋点key:开始服务开启自动驾驶(成功/失败)
|
||||
const val EVENT_KEY_START_SERVICE = "event_key_och_taxi_start_service"
|
||||
const val EVENT_PARAM_SN = "sn"
|
||||
const val EVENT_PARAM_TIME = "time"
|
||||
const val EVENT_PARAM_START_NAME = "start_name"
|
||||
const val EVENT_PARAM_END_NAME = "end_name"
|
||||
const val EVENT_PARAM_LINE_ID = "line_id"
|
||||
const val EVENT_PARAM_ORDER_NUMBER = "order_num"
|
||||
const val EVENT_PARAM_START_RESULT = "start_autopilot" // true/false
|
||||
const val EVENT_PARAM_START_FAILURE_CODE = "start_autopilot_failure_code" // 启动自驾失败code
|
||||
const val EVENT_PARAM_START_FAILURE_MSG = "start_autopilot_failure_msg" // 启动自驾失败原因
|
||||
const val EVENT_PARAM_PLATE_NUM = "plate_number" // 车牌号
|
||||
const val EVENT_PARAM_ENV_ONLINE = "env_online" // 是否线上环境:true/false
|
||||
// 埋点key:开启自动驾驶前已识别的异常,会导致无法开启自驾
|
||||
const val EVENT_KEY_AP_UNABLE_START_REASON = "event_key_och_taxi_ap_unable_start_reason"
|
||||
const val EVENT_PARAM_UNABLE_START_REASON = "unable_start_reason";
|
||||
|
||||
// 实时计算当前剩余里程和时间 间隔 2秒
|
||||
const val LOOP_CALCULATEROUTE_2S = 2 * 1000L
|
||||
|
||||
//总里程/平均车速。(bus的平均里程:25km/h,taxi的平均里程:38km/h),单位为:分钟,不足1分钟时,显示1分钟。
|
||||
const val TAXI_AVERAGE_SPEED = 38
|
||||
|
||||
/**
|
||||
* 订单起终点Marker类型
|
||||
*/
|
||||
const val TYPE_MARKER_TAXI_ORDER = "TYPE_MARKER_TAXI_ORDER"
|
||||
|
||||
const val TIMER_START_AUTOPILOT_INTERVAL = 20 * 1000L
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.mogo.och.taxi.constant
|
||||
|
||||
/**
|
||||
* Created on 2021/12/7
|
||||
* 1 运营, 2 测试, 3演示
|
||||
*/
|
||||
enum class TaxiDriverRoleEnum(val code: Int) {
|
||||
OPERATION( 1),
|
||||
TEST( 2),
|
||||
DEMO( 3);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.mogo.och.taxi.constant
|
||||
|
||||
/**
|
||||
* Created on 2022/08/19
|
||||
*
|
||||
*
|
||||
* 0 初始状态,
|
||||
* 10 接单状态 可接单,
|
||||
* 20 暂停接到哪 不可接单,
|
||||
*/
|
||||
enum class TaxiOpenOrderStatusEnum(val code: Int) {
|
||||
None( 0 ),
|
||||
Ordering( 10),
|
||||
UnOrdering( 20),;
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun valueOf(code: Int): TaxiOpenOrderStatusEnum? {
|
||||
for (value in values()) {
|
||||
if (value.code == code) {
|
||||
return value
|
||||
}
|
||||
}
|
||||
return None
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.mogo.och.taxi.constant
|
||||
|
||||
/**
|
||||
* 司机端取消订单的原因定义
|
||||
* Created on 2021/12/7
|
||||
*
|
||||
* * String int
|
||||
* 进行中订单:
|
||||
* 车况异常 0
|
||||
* 设备异常 1
|
||||
* 电量不足 2
|
||||
* 身体不适 3
|
||||
* 乘客未到 4
|
||||
* 乘客中途下车 5
|
||||
* 1099前都可用
|
||||
*
|
||||
* 待服务订单:
|
||||
* 2000 车辆故障
|
||||
* 2001 乘客联系取消
|
||||
* 2002 行程冲突
|
||||
* 2003 车电量不足
|
||||
* 2004 其他
|
||||
*/
|
||||
enum class TaxiOrderCancelReasons(val type: Int, val msg: String) {
|
||||
CarBroken(1000, "车况异常"),
|
||||
DeviceBroken(1001, "设备异常"),
|
||||
BatteryLow(1002, "电量不足"),
|
||||
DriverIsIll(1003, "身体不适"),
|
||||
PassengerNotArrive(1004, "乘客未到"),
|
||||
PassengerStopOver(1005, "乘客中途下车"),
|
||||
PassengerCancel(1006, "乘客联系安全员取消"),
|
||||
UnContractPassenger(1007, "联系不上乘客"),
|
||||
JourneyConflict(1008, "行程冲突"),
|
||||
StartStationFaraway(1009,"距离过远 无法接单"),
|
||||
Other( 1010, "其他原因"),
|
||||
|
||||
BookCarBroken(2000, "车辆故障"),
|
||||
BookPassengerCancel(2001, "乘客联系取消"),
|
||||
BookJourneyConflict(2002, "行程冲突"),
|
||||
BookBatteryLow(2003, "车电量不足"),
|
||||
BookOther(2004, "其他");
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun getType(msg: String): Int {
|
||||
for (value in values()) {
|
||||
if (value.msg == msg) {
|
||||
return value.type
|
||||
}
|
||||
}
|
||||
return 0
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.mogo.och.taxi.constant
|
||||
|
||||
/**
|
||||
* Created on 2021/12/7
|
||||
*
|
||||
* * Old code:START
|
||||
* 未派单 0
|
||||
* 去往上车站点 1
|
||||
* 车辆已到达上车站点 2
|
||||
* 乘客已到达上车站点 3
|
||||
* 去往下车站点 4
|
||||
* 到达下车站点 5
|
||||
* 已完成 6
|
||||
* 已取消 7
|
||||
* Old code:END
|
||||
*
|
||||
* 0 订单创建(为派单),
|
||||
* 10 已派上司机(司机去往上车点),
|
||||
* 20 司机到达上车点,
|
||||
* 30 乘客到达上车点,
|
||||
* 40 服务中(去往目的地),
|
||||
* 50 到达目的地,
|
||||
* 60 已完成,
|
||||
* 70 已取消
|
||||
*/
|
||||
enum class TaxiOrderStatusEnum(val code: Int) {
|
||||
None( 0 ),
|
||||
OnTheWayToStart( 10),
|
||||
ArriveAtStart( 20),
|
||||
UserArriveAtStart( 30),
|
||||
OnTheWayToEnd( 40),
|
||||
ArriveAtEnd( 50),
|
||||
JourneyCompleted(60),//行程完成
|
||||
Cancel( 70);
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun valueOf(code: Int): TaxiOrderStatusEnum? {
|
||||
for (value in values()) {
|
||||
if (value.code == code) {
|
||||
return value
|
||||
}
|
||||
}
|
||||
return None
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.mogo.och.taxi.constant
|
||||
|
||||
/**
|
||||
* RoboTaxi订单类型声明
|
||||
*
|
||||
* Created on 2021/12/6
|
||||
*/
|
||||
enum class TaxiOrderTypeEnum(val type: Int) {
|
||||
Instant(1), // 即时单
|
||||
Reserved(2) // 预约单
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.mogo.och.taxi.constant
|
||||
|
||||
object TaxtServingStatusManager {
|
||||
|
||||
/**
|
||||
* 接单状态
|
||||
*/
|
||||
private var openOrderStatus: TaxiOpenOrderStatusEnum = TaxiOpenOrderStatusEnum.None
|
||||
|
||||
// region 是否可用接单
|
||||
@JvmStatic
|
||||
fun isOpeningOrderStatus():Boolean{
|
||||
if(openOrderStatus==TaxiOpenOrderStatusEnum.Ordering){
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
@JvmStatic
|
||||
fun setOpenOrderStatus(status: Int) {
|
||||
when (status) {
|
||||
0 -> {
|
||||
this.openOrderStatus = TaxiOpenOrderStatusEnum.UnOrdering
|
||||
}
|
||||
1 -> {
|
||||
this.openOrderStatus = TaxiOpenOrderStatusEnum.Ordering
|
||||
}
|
||||
else -> {
|
||||
this.openOrderStatus = TaxiOpenOrderStatusEnum.None
|
||||
}
|
||||
}
|
||||
}
|
||||
@JvmStatic
|
||||
fun getOpenOrderStatus(): TaxiOpenOrderStatusEnum {
|
||||
return openOrderStatus
|
||||
}
|
||||
|
||||
//endregion
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
package com.mogo.och.taxi.model;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAXI;
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAXI_P;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.och.taxi.constant.TaxiConst;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.ObservableEmitter;
|
||||
import io.reactivex.ObservableOnSubscribe;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.CompositeDisposable;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* Created on 2021/9/10
|
||||
*
|
||||
* 管理轮询逻辑(订单轮询、新单轮询、新单抢单结果轮询等等)
|
||||
*/
|
||||
public class TaxiModelLoopManager {
|
||||
|
||||
private static final String TAG = TaxiModelLoopManager.class.getSimpleName();
|
||||
|
||||
private static final class SingletonHolder {
|
||||
private static final TaxiModelLoopManager INSTANCE = new TaxiModelLoopManager();
|
||||
}
|
||||
|
||||
public static TaxiModelLoopManager getInstance() {
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private Disposable mInAndWaitServiceDisposable; //进行中、待服务订单列表轮询
|
||||
private Disposable mNewBookingOrderDisposable; //新到待抢预约单轮询
|
||||
private Disposable mGrabResultDisposable; //抢单结果轮询
|
||||
private Disposable mHeartbeatDisposable; //心跳轮询
|
||||
private CompositeDisposable mCalculateRouteDisposable; //每隔2s计算一次剩余里程和时间
|
||||
|
||||
public void startInAndWaitOrdersLoop() {
|
||||
if (mInAndWaitServiceDisposable != null && !mInAndWaitServiceDisposable.isDisposed()) {
|
||||
return;
|
||||
}
|
||||
CallerLogger.INSTANCE.i(M_TAXI + TAG, "startInAndWaitOrdersLoop()");
|
||||
mInAndWaitServiceDisposable = Observable.interval(TaxiConst.LOOP_DELAY,
|
||||
TaxiConst.LOOP_PERIOD_2S, TimeUnit.MILLISECONDS)
|
||||
.map((aLong -> aLong + 1))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(aLong -> TaxiModel.getInstance().queryInAndWaitOrders());
|
||||
}
|
||||
|
||||
public void stopInAndWaitOrdersLoop() {
|
||||
if (mInAndWaitServiceDisposable != null) {
|
||||
CallerLogger.INSTANCE.i(M_TAXI + TAG, "stopInAndWaitOrdersLoop()");
|
||||
mInAndWaitServiceDisposable.dispose();
|
||||
mInAndWaitServiceDisposable = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void startNewBookingOrderLoop() {
|
||||
if (mNewBookingOrderDisposable != null && !mNewBookingOrderDisposable.isDisposed()) {
|
||||
return;
|
||||
}
|
||||
CallerLogger.INSTANCE.i(M_TAXI + TAG, "startNewBookingOrderLoop()");
|
||||
mNewBookingOrderDisposable = Observable.interval(TaxiConst.LOOP_DELAY,
|
||||
TaxiConst.LOOP_PERIOD_1S, TimeUnit.MILLISECONDS)
|
||||
.map((aLong -> aLong + 1))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(aLong -> TaxiModel.getInstance().queryNewBookingOrder());
|
||||
}
|
||||
|
||||
public void stopNewBookingOrderLoop() {
|
||||
if (mNewBookingOrderDisposable != null) {
|
||||
CallerLogger.INSTANCE.i(M_TAXI + TAG, "stopNewBookingOrderLoop()");
|
||||
mNewBookingOrderDisposable.dispose();
|
||||
mNewBookingOrderDisposable = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void startGrabResultLoop() {
|
||||
if (mGrabResultDisposable != null && !mGrabResultDisposable.isDisposed()) {
|
||||
return;
|
||||
}
|
||||
CallerLogger.INSTANCE.i(M_TAXI + TAG, "startGrabResultLoop()");
|
||||
mGrabResultDisposable = Observable.interval(TaxiConst.LOOP_DELAY,
|
||||
TaxiConst.LOOP_PERIOD_1S, TimeUnit.MILLISECONDS)
|
||||
.map((aLong -> aLong + 1))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(aLong -> TaxiModel.getInstance().queryOrderGrabStatus());
|
||||
}
|
||||
|
||||
public void stopGrabResultLoop() {
|
||||
if (mGrabResultDisposable != null) {
|
||||
CallerLogger.INSTANCE.i(M_TAXI + TAG, "stopGrabResultLoop()");
|
||||
mGrabResultDisposable.dispose();
|
||||
mGrabResultDisposable = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void startHeartbeatLoop() {
|
||||
if (mHeartbeatDisposable != null && !mHeartbeatDisposable.isDisposed()) {
|
||||
return;
|
||||
}
|
||||
CallerLogger.INSTANCE.i(M_TAXI + TAG, "startHeartbeatLoop()");
|
||||
mHeartbeatDisposable = Observable.interval(TaxiConst.LOOP_DELAY,
|
||||
TaxiConst.LOOP_PERIOD_60S, TimeUnit.MILLISECONDS)
|
||||
.map((aLong -> aLong + 1))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(aLong -> TaxiModel.getInstance().runCarHeartbeat());
|
||||
}
|
||||
|
||||
public void stopHeartbeatLoop() {
|
||||
if (mHeartbeatDisposable != null) {
|
||||
CallerLogger.INSTANCE.i(M_TAXI + TAG, "stopHeartbeatLoop()");
|
||||
mHeartbeatDisposable.dispose();
|
||||
mHeartbeatDisposable = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void startCalculateRouteInfoLoop() {
|
||||
|
||||
CallerLogger.INSTANCE.i(M_TAXI + TAG, "startCalculateRouteInfoLoop()");
|
||||
if (mCalculateRouteDisposable != null) return;
|
||||
|
||||
mCalculateRouteDisposable = new CompositeDisposable();
|
||||
|
||||
Disposable disposable = loopDynamicCalculateRouteInfo()
|
||||
.doOnSubscribe(new Consumer<Disposable>() {
|
||||
@Override
|
||||
public void accept(Disposable disposable) throws Exception {
|
||||
|
||||
}
|
||||
}).doOnError(new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) throws Exception {
|
||||
}
|
||||
})
|
||||
.delay(TaxiConst.LOOP_CALCULATEROUTE_2S, TimeUnit.MILLISECONDS, true) // 设置delayError为true,表示出现错误的时候也需要延迟5s进行通知,达到无论是请求正常还是请求失败,都是5s后重新订阅,即重新请求。
|
||||
.subscribeOn(Schedulers.io())
|
||||
.repeat() // repeat保证请求成功后能够重新订阅。
|
||||
.retry() // retry保证请求失败后能重新订阅
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<Integer>() {
|
||||
@Override
|
||||
public void accept(Integer integer) throws Exception {
|
||||
}
|
||||
});
|
||||
mCalculateRouteDisposable.add(disposable);
|
||||
}
|
||||
|
||||
private Observable<Integer> loopDynamicCalculateRouteInfo(){
|
||||
return Observable.create(new ObservableOnSubscribe<Integer>() {
|
||||
@Override
|
||||
public void subscribe(ObservableEmitter<Integer> emitter) throws Exception {
|
||||
if (emitter.isDisposed()) return;
|
||||
TaxiModel.getInstance().dynamicCalculateRouteInfo();
|
||||
emitter.onComplete();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void stopCalculateRouteInfoLoop() {
|
||||
if (mCalculateRouteDisposable != null) {
|
||||
CallerLogger.INSTANCE.i(M_TAXI + TAG, "stopCalculateRouteInfoLoop()");
|
||||
mCalculateRouteDisposable.dispose();
|
||||
mCalculateRouteDisposable = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.mogo.och.taxi.network
|
||||
|
||||
import android.content.Context
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.och.common.module.biz.bean.DriverStatusQueryRespBean
|
||||
import com.mogo.och.common.module.biz.bean.TaxiLoginReqBean
|
||||
import com.mogo.och.common.module.biz.bean.TaxiLoginRespBean
|
||||
import com.mogo.och.common.module.biz.bean.TaxiLogoutReqBean
|
||||
import com.mogo.och.common.module.biz.network.LoginDefaultManage
|
||||
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback
|
||||
|
||||
class LoginBusImpl: LoginDefaultManage {
|
||||
|
||||
override fun getPhoneCode(
|
||||
context: Context, phone: String?,
|
||||
callback: OchCommonServiceCallback<BaseData>?
|
||||
) {
|
||||
OchCommonServiceManager.getPhoneCode(context,phone,callback)
|
||||
}
|
||||
|
||||
override fun gotoLoginBycode(
|
||||
context: Context,
|
||||
phone: String?,
|
||||
code: String?,
|
||||
location4Login: TaxiLoginReqBean.Location4Login?,
|
||||
callback: OchCommonServiceCallback<TaxiLoginRespBean>?
|
||||
) {
|
||||
OchCommonServiceManager.gotoLoginBycode(context,phone,code,location4Login,callback)
|
||||
}
|
||||
|
||||
override fun logout(
|
||||
context: Context,
|
||||
location4Login: TaxiLogoutReqBean.Location4Login?,
|
||||
callback: OchCommonServiceCallback<BaseData>?
|
||||
) {
|
||||
OchCommonServiceManager.logout(context,location4Login,callback)
|
||||
}
|
||||
|
||||
override fun queryDriverServiceStatus(
|
||||
context: Context,
|
||||
callback: OchCommonServiceCallback<DriverStatusQueryRespBean>?
|
||||
) {
|
||||
OchCommonServiceManager.queryDriverServiceStatus(context,callback)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package com.mogo.och.taxi.network
|
||||
|
||||
import android.content.Context
|
||||
import com.mogo.och.common.module.biz.constant.OchCommonConst.Companion.getBaseUrl
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.och.common.module.biz.bean.TaxiLoginSmsReqBean
|
||||
import com.mogo.och.common.module.biz.bean.TaxiLoginReqBean
|
||||
import com.mogo.och.common.module.biz.bean.TaxiLoginRespBean
|
||||
import com.mogo.och.common.module.biz.bean.TaxiLogoutReqBean
|
||||
import com.mogo.och.common.module.biz.bean.DriverStatusQueryRespBean
|
||||
import com.mogo.och.common.module.biz.constant.OchCommonConst
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.eagle.core.network.MoGoRetrofitFactory
|
||||
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 by pangfan on 2021/8/19
|
||||
*/
|
||||
object OchCommonServiceManager {
|
||||
|
||||
private const val TAG = "OchCommonServiceManager"
|
||||
|
||||
private val mOCHTaxiServiceApi: OchLoginServiceApi =
|
||||
MoGoRetrofitFactory.getInstance(getBaseUrl()).create(
|
||||
OchLoginServiceApi::class.java
|
||||
)
|
||||
|
||||
/**
|
||||
* 获取手机验证码
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun getPhoneCode(
|
||||
context: Context, phone: String?,
|
||||
callback: OchCommonServiceCallback<BaseData>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.getPhoneCode(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
TaxiLoginSmsReqBean(phone)
|
||||
).transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "getPhoneCode"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过验证码登录
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun gotoLoginBycode(
|
||||
context: Context, phone: String?, code: String?,
|
||||
location4Login: TaxiLoginReqBean.Location4Login?,
|
||||
callback: OchCommonServiceCallback<TaxiLoginRespBean>?
|
||||
) {
|
||||
val sn = MoGoAiCloudClientConfig.getInstance().sn
|
||||
mOCHTaxiServiceApi.gotoLoginBycode4Taxi(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
TaxiLoginReqBean(phone, code, sn, location4Login)
|
||||
).transformTry().subscribe(OchCommonSubscribeImpl(context, callback, "gotoLoginBycode"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 登出
|
||||
*/
|
||||
@JvmStatic
|
||||
fun logout(
|
||||
context: Context,
|
||||
location4Login: TaxiLogoutReqBean.Location4Login?,
|
||||
callback: OchCommonServiceCallback<BaseData>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.logout4Taxi(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
TaxiLogoutReqBean(MoGoAiCloudClientConfig.getInstance().sn, location4Login)
|
||||
).transformTry().subscribe(OchCommonSubscribeImpl(context, callback, "logout"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 接单状态和登录状态查询
|
||||
*
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun queryDriverServiceStatus(
|
||||
context: Context,
|
||||
callback: OchCommonServiceCallback<DriverStatusQueryRespBean>?
|
||||
) {
|
||||
if (MoGoAiCloudClientConfig.getInstance().token.isEmpty()) {
|
||||
callback?.onFail(OchCommonConst.WAIT_TAKEN, "等待令牌中请稍等")
|
||||
MoGoAiCloudClient.getInstance().refreshToken()
|
||||
return
|
||||
}
|
||||
mOCHTaxiServiceApi.queryDriverServiceStatusAndLoginStatus(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
MoGoAiCloudClientConfig.getInstance().sn
|
||||
).transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryDriverServiceStatus"))
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.mogo.och.taxi.network;
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.och.common.module.biz.bean.DriverStatusQueryRespBean;
|
||||
import com.mogo.och.common.module.biz.bean.TaxiLoginReqBean;
|
||||
import com.mogo.och.common.module.biz.bean.TaxiLoginRespBean;
|
||||
import com.mogo.och.common.module.biz.bean.TaxiLoginSmsReqBean;
|
||||
import com.mogo.och.common.module.biz.bean.TaxiLogoutReqBean;
|
||||
|
||||
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 by pangfan on 2021/8/19
|
||||
*
|
||||
* 网约车-出租车接口定义
|
||||
*/
|
||||
interface OchLoginServiceApi {
|
||||
/**
|
||||
* 获取手机验证码
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
@POST( "/autopilot-car-hailing/driver/v2/driver/taxi/sendSms" )
|
||||
Observable<DriverStatusQueryRespBean> getPhoneCode(@Header("appId") String appId
|
||||
, @Header("ticket") String ticket, @Body TaxiLoginSmsReqBean data);
|
||||
/**
|
||||
* 通过验证码登录
|
||||
* @param appId
|
||||
* @param ticket
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
@POST( "/autopilot-car-hailing/cab/flow/v1/driver/taxi/startOperation" )
|
||||
Observable<TaxiLoginRespBean> gotoLoginBycode4Taxi(@Header("appId") String appId
|
||||
, @Header("ticket") String ticket, @Body TaxiLoginReqBean data);
|
||||
|
||||
/**
|
||||
* 登出接口
|
||||
*/
|
||||
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||
@POST("/autopilot-car-hailing/cab/flow/v1/driver/taxi/endOperation")
|
||||
Observable<BaseData> logout4Taxi(@Header("appId") String appId, @Header("ticket") String ticket,
|
||||
@Body TaxiLogoutReqBean data);
|
||||
|
||||
/**
|
||||
* 接单状态和登录状态查询 出租车司机端、小巴车司机端、小巴车乘客端
|
||||
* @param sn
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
@GET( "/autopilot-car-hailing/operation/v1/driver/taxi/loginStatus")
|
||||
Observable<DriverStatusQueryRespBean> queryDriverServiceStatusAndLoginStatus(@Header ("appId") String appId
|
||||
, @Header("ticket") String ticket, @Query("sn") String sn);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,308 @@
|
||||
package com.mogo.och.taxi.network;
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.och.taxi.bean.CarHeartbeatReqBean;
|
||||
import com.mogo.och.taxi.bean.DriverServiceDataRespBean;
|
||||
import com.mogo.och.taxi.bean.DriverStatusUpdateReqBean;
|
||||
import com.mogo.och.taxi.bean.OrderCancelReqBean;
|
||||
import com.mogo.och.taxi.bean.OrderGrabReqBean;
|
||||
import com.mogo.och.taxi.bean.OrderGrabRespBean;
|
||||
import com.mogo.och.taxi.bean.OrderGrabStatusQueryRespBean;
|
||||
import com.mogo.och.taxi.bean.OrderQueryReqBean;
|
||||
import com.mogo.och.taxi.bean.OrderQueryRespBean;
|
||||
import com.mogo.och.taxi.bean.OrderQueryRouteInfoReqBean;
|
||||
import com.mogo.och.taxi.bean.OrderQueryRouteInfoRespBean;
|
||||
import com.mogo.och.taxi.bean.OrderRouteUpdateReqBean;
|
||||
import com.mogo.och.taxi.bean.OrderStatusUpdateReqBean;
|
||||
import com.mogo.och.taxi.bean.OrdersInServiceQueryRespBean;
|
||||
import com.mogo.och.taxi.bean.OrdersListQueryReqBean;
|
||||
import com.mogo.och.taxi.bean.OrdersListQueryRespBean;
|
||||
import com.mogo.och.taxi.bean.OrdersNewBookingQueryRespBean;
|
||||
import com.mogo.och.taxi.bean.QueryOrderRouteResp;
|
||||
import com.mogo.och.taxi.bean.TaxiDataBaseRespBean;
|
||||
import com.mogo.och.taxi.bean.TaxiOrPassengerReadyReqBean;
|
||||
import com.mogo.och.taxi.bean.UpdateOrderDisAndTimeReqBean;
|
||||
|
||||
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 by pangfan on 2021/8/19
|
||||
*
|
||||
* 网约车-出租车接口定义
|
||||
*/
|
||||
interface TaxiServiceApiNew {
|
||||
|
||||
/**
|
||||
* 查询全部服务中/待服务订单(没有的时候返回code 0,空列表)
|
||||
* @param sn
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
// @GET("/autopilot-car-hailing/api/v1/driver/orderInService/query")
|
||||
@GET("/autopilot-car-hailing/order/v2/driver/taxi/orderInService/query")
|
||||
Observable<OrdersInServiceQueryRespBean> queryOrdersInAndWaitService(@Header("appId") String appId
|
||||
, @Header("ticket") String ticket, @Query("sn") String sn);
|
||||
|
||||
/**
|
||||
* 查询新到的预约单
|
||||
* @param sn
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
// @GET( "/autopilot-car-hailing/api/v1/driver/newBookingOrder/query" )
|
||||
@GET( "/autopilot-car-hailing/order/v2/driver/taxi/newBookingOrder/query" )
|
||||
Observable<OrdersNewBookingQueryRespBean> queryNewBookingOrder(@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/api/v1/driver/grabOrder" )
|
||||
@POST( "/autopilot-car-hailing/order/v2/driver/taxi/grabOrder" )
|
||||
Observable<OrderGrabRespBean> grabOrder(@Header ("appId") String appId,@Header("ticket") String ticket
|
||||
,@Body OrderGrabReqBean data);
|
||||
|
||||
/**
|
||||
* (预约单)查询抢单结果
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
// @POST( "/autopilot-car-hailing/api/v1/driver/grabStatus/query" )
|
||||
@POST( "/autopilot-car-hailing/order/v2/driver/taxi/grabStatus/query" )
|
||||
Observable<OrderGrabStatusQueryRespBean> queryOrderGrabStatus(@Header ("appId") String appId,@Header("ticket") String ticket
|
||||
,@Body OrderGrabReqBean data);
|
||||
|
||||
/**
|
||||
* 查询订单路径规划信息(到上车点、起始点间的距离和预估时间)
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
// @POST( "/autopilot-car-hailing/api/v1/driver/routeInfo/query" )
|
||||
@POST( "/autopilot-car-hailing/order/v2/driver/taxi/routeInfo/query" )
|
||||
Observable<OrderQueryRouteInfoRespBean> queryOrderRouteInfo(@Header ("appId") String appId,@Header("ticket") String ticket
|
||||
,@Body OrderQueryRouteInfoReqBean data);
|
||||
|
||||
/**
|
||||
* 通过orderId查询订单信息(用于本地已经有orderId时)
|
||||
* @param data
|
||||
* @return
|
||||
* @deprecated v2.1_0930需求中暂不再使用此接口
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
// @POST( "/autopilot-car-hailing/api/v1/driver/queryOrderById" )
|
||||
@POST( "/autopilot-car-hailing/order/v2/driver/taxi/queryOrderById" )
|
||||
Observable<OrderQueryRespBean> queryOrderById(@Header ("appId") String appId,@Header("ticket") String ticket
|
||||
,@Body OrderQueryReqBean data);
|
||||
|
||||
/**
|
||||
* 查询服务中订单信息(用于本地无orderId时)
|
||||
* 如果有多条,只会返回时间最近的一条
|
||||
* @param sn
|
||||
* @return
|
||||
* @deprecated v2.1_0930需求中暂不再使用此接口
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
// @GET( "/autopilot-car-hailing/api/v1/driver/queryOrderInService" )
|
||||
@GET( "/autopilot-car-hailing/order/v2/driver/taxi/queryOrderInService" )
|
||||
Observable<OrderQueryRespBean> queryOrderInService(@Header ("appId") String appId,@Header("ticket") String ticket
|
||||
,@Query("sn") String sn);
|
||||
|
||||
/**
|
||||
* 取消订单
|
||||
*/
|
||||
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||
// @POST("/autopilot-car-hailing/api/v1/driver/cancelOrder")
|
||||
@POST("/autopilot-car-hailing/order/v2/driver/taxi/cancelOrder")
|
||||
Observable<BaseData> cancelOrder(@Header ("appId") String appId,@Header("ticket") String ticket
|
||||
,@Body OrderCancelReqBean data);
|
||||
|
||||
/**
|
||||
* 订单列表获取
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
// @POST( "/autopilot-car-hailing/api/v1/driver/queryOrders" )
|
||||
@POST( "/autopilot-car-hailing/order/v2/driver/taxi/queryOrders" )
|
||||
Observable<OrdersListQueryRespBean> queryOrdersList(@Header ("appId") String appId,@Header("ticket") String ticket
|
||||
,@Body OrdersListQueryReqBean data);
|
||||
|
||||
/**
|
||||
* 订单状态更新
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
// @POST( "/autopilot-car-hailing/api/v1/driver/order/updateStatus" )
|
||||
// @POST( "/autopilot-car-hailing/order/v2/driver/taxi/order/updateStatus" )
|
||||
@POST( "/autopilot-car-hailing/order/v2/vehicle/taxi/driver/updateStatus" )
|
||||
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/heartbeat" )
|
||||
@POST( "/autopilot-car-hailing/location/v2/driver/taxi/heartbeat" )
|
||||
Observable<BaseData> runCarHeartbeat(@Header ("appId") String appId,@Header("ticket") String ticket
|
||||
,@Body CarHeartbeatReqBean data);
|
||||
|
||||
/**
|
||||
* 查询司机服务数据
|
||||
* @param sn
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
// @GET( "/autopilot-car-hailing/api/v1/driver/serviceData/query" )
|
||||
@GET( "/autopilot-car-hailing/order/v2/driver/taxi/serviceData/query" )
|
||||
Observable<DriverServiceDataRespBean> queryServiceData(@Header ("appId") String appId
|
||||
,@Header("ticket") String ticket,@Query("sn") String sn);
|
||||
|
||||
/**
|
||||
* 上传工控机返回的全路径规划数据
|
||||
* @param appId
|
||||
* @param ticket
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
@POST("/autopilot-car-hailing/order/v2/driver/taxi/saveOrderRoute")
|
||||
// @POST("/mock/268/autopilot-car-hailing/order/v2/driver/taxi/orderRoute")
|
||||
Observable<BaseData> updateOrderRoute(@Header ("appId") String appId
|
||||
, @Header("ticket") String ticket, @Body OrderRouteUpdateReqBean data);
|
||||
|
||||
/**
|
||||
* 上报订单剩余里程和剩余时间
|
||||
* @param appId
|
||||
* @param ticket
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
@POST("/autopilot-car-hailing/order/v2/driver/taxi/reportOrderRemain")
|
||||
Observable<BaseData> reportOrderRemain(@Header ("appId") String appId
|
||||
, @Header("ticket") String ticket, @Body UpdateOrderDisAndTimeReqBean data);
|
||||
|
||||
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
// @GET( "/autopilot-car-hailing/api/v1/driver/serviceStatus/query" )
|
||||
@GET( "/autopilot-car-hailing/order/v2/driver/taxi/orderRoute" )
|
||||
Observable<QueryOrderRouteResp> queryOrderRoute(@Header ("appId") String appId
|
||||
, @Header("ticket") String ticket, @Query("orderNo") String orderNo);
|
||||
|
||||
/**
|
||||
* 司机端跳过乘客验证,订单状态流转为乘客已上车
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
@POST( "/autopilot-car-hailing/cab/flow/v1/driver/taxi/ready/passenger" )
|
||||
Observable<TaxiDataBaseRespBean> updatePassengerHasBoardedStatus(@Header ("appId") String appId
|
||||
, @Header("ticket") String ticket, @Body TaxiOrPassengerReadyReqBean data);
|
||||
|
||||
/**
|
||||
* 司机端确认可开启自动驾驶
|
||||
* @param appId
|
||||
* @param ticket
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
@POST( "/autopilot-car-hailing/cab/flow/v1/driver/taxi/ready/pilot" )
|
||||
Observable<TaxiDataBaseRespBean> confirmAutopilotConditionByDriver(@Header ("appId") String appId
|
||||
, @Header("ticket") String ticket,@Body TaxiOrPassengerReadyReqBean data);
|
||||
|
||||
/**
|
||||
* 查询司机是否已确认可开启自动驾驶
|
||||
* @param appId
|
||||
* @param ticket
|
||||
* @param orderNo
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
@GET( "/autopilot-car-hailing/cab/flow/v1/driver/taxi/pilot/status" )
|
||||
Observable<TaxiDataBaseRespBean> queryPilotStatus(@Header ("appId") String appId
|
||||
, @Header("ticket") String ticket,@Query("orderNo") String orderNo);
|
||||
|
||||
/**
|
||||
* 开启自动驾驶成功
|
||||
* @param appId
|
||||
* @param ticket
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
@POST( "/autopilot-car-hailing/cab/flow/v1/driver/taxi/startServicePilot" )
|
||||
Observable<TaxiDataBaseRespBean> startServicePilotDone(@Header ("appId") String appId
|
||||
, @Header("ticket") String ticket,@Body TaxiOrPassengerReadyReqBean data);
|
||||
|
||||
/**
|
||||
* 达到乘客上车点
|
||||
* @param appId
|
||||
* @param ticket
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
@POST( "/autopilot-car-hailing/cab/flow/v1/driver/taxi/passenger/arriveStartPoint" )
|
||||
Observable<TaxiDataBaseRespBean> arrivedStartPoint(@Header ("appId") String appId
|
||||
, @Header("ticket") String ticket,@Body TaxiOrPassengerReadyReqBean data);
|
||||
|
||||
/**
|
||||
* 到达乘客目的地
|
||||
* @param appId
|
||||
* @param ticket
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
@POST( "/autopilot-car-hailing/cab/flow/v1/driver/taxi/arriveTerminal" )
|
||||
Observable<TaxiDataBaseRespBean> arriveTerminal(@Header ("appId") String appId
|
||||
, @Header("ticket") String ticket,@Body TaxiOrPassengerReadyReqBean data);
|
||||
|
||||
/**
|
||||
* 订单完成
|
||||
* @param appId
|
||||
* @param ticket
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
@POST( "/autopilot-car-hailing/cab/flow/v1/driver/taxi/orderCompleted" )
|
||||
Observable<TaxiDataBaseRespBean> orderCompleted(@Header ("appId") String appId
|
||||
, @Header("ticket") String ticket,@Body TaxiOrPassengerReadyReqBean 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/cab/flow/v1/driver/taxi/stopOrderServing" )
|
||||
Observable<BaseData> stopOrderServing(@Header ("appId") String appId,@Header("ticket") String ticket
|
||||
,@Body DriverStatusUpdateReqBean 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/cab/flow/v1/driver/taxi/resetOrderServing" )
|
||||
Observable<BaseData> resetOrderServing(@Header ("appId") String appId,@Header("ticket") String ticket
|
||||
,@Body DriverStatusUpdateReqBean data);
|
||||
}
|
||||
@@ -0,0 +1,497 @@
|
||||
package com.mogo.och.taxi.network
|
||||
|
||||
import android.content.Context
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.eagle.core.network.MoGoRetrofitFactory
|
||||
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.taxi.bean.*
|
||||
import io.reactivex.Observable
|
||||
|
||||
/**
|
||||
* Created by pangfan on 2021/8/19
|
||||
*/
|
||||
object TaxiServiceManager {
|
||||
|
||||
|
||||
private var mOCHTaxiServiceApi: TaxiServiceApiNew =
|
||||
MoGoRetrofitFactory.getInstance(OchCommonConst.getBaseUrl()).create(
|
||||
TaxiServiceApiNew::class.java
|
||||
)
|
||||
|
||||
/**
|
||||
* 查询全部服务中/待服务订单列表
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun queryOrdersInAndWaitService(
|
||||
context: Context,
|
||||
callback: OchCommonServiceCallback<OrdersInServiceQueryRespBean>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.queryOrdersInAndWaitService(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
MoGoAiCloudClientConfig.getInstance().sn
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryOrdersInAndWaitService"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询新到的预约单
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun queryNewBookingOrder(
|
||||
context: Context,
|
||||
callback: OchCommonServiceCallback<OrdersNewBookingQueryRespBean>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.queryNewBookingOrder(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
MoGoAiCloudClientConfig.getInstance().sn
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryNewBookingOrder"))
|
||||
}
|
||||
|
||||
/**
|
||||
* (预约单)执行抢单动作
|
||||
* @param context
|
||||
* @param orderNo
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun grabOrder(
|
||||
context: Context, orderNo: String?,
|
||||
callback: OchCommonServiceCallback<OrderGrabRespBean>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.grabOrder(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
OrderGrabReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().sn, orderNo
|
||||
)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "grabOrder"))
|
||||
}
|
||||
|
||||
/**
|
||||
* (预约单)查询抢单结果
|
||||
* @param context
|
||||
* @param orderNo
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun queryOrderGrabStatus(
|
||||
context: Context, orderNo: String?,
|
||||
callback: OchCommonServiceCallback<OrderGrabStatusQueryRespBean>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.queryOrderGrabStatus(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
OrderGrabReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().sn, orderNo
|
||||
)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryOrderGrabStatus"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询订单路径规划信息(到上车点、起始点间的距离和预估时间)
|
||||
* @param context
|
||||
* @param orderNo
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun queryOrderRouteInfo(
|
||||
context: Context, orderNo: String?,
|
||||
callback: OchCommonServiceCallback<OrderQueryRouteInfoRespBean>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.queryOrderRouteInfo(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
OrderQueryRouteInfoReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().sn, orderNo
|
||||
)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryOrderRouteInfo"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过orderId查询订单信息(用于本地已经有orderId时)
|
||||
* @param context
|
||||
* @param orderNo
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
@Deprecated("v2.1_0930需求中暂不再使用此接口")
|
||||
fun queryOrderById(
|
||||
context: Context, orderNo: String?,
|
||||
callback: OchCommonServiceCallback<OrderQueryRespBean>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.queryOrderById(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
OrderQueryReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().sn, orderNo
|
||||
)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryOrderById"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询未完成态订单信息(用于本地无orderId时)
|
||||
* 如果有多条,只会返回时间最近的一条
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
@Deprecated("v2.1_0930需求中暂不再使用此接口")
|
||||
fun queryOrderInService(
|
||||
context: Context,
|
||||
callback: OchCommonServiceCallback<OrderQueryRespBean>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.queryOrderInService(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
MoGoAiCloudClientConfig.getInstance().sn
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryOrderInService"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 司机取消订单
|
||||
* @param context
|
||||
* @param orderNo
|
||||
* @param cancelType
|
||||
* @param cancelReason
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun cancelOrder(
|
||||
context: Context, orderNo: String?, cancelType: Int, cancelReason: String?,
|
||||
callback: OchCommonServiceCallback<BaseData>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.cancelOrder(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
OrderCancelReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().sn, orderNo, cancelType, cancelReason
|
||||
)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "cancelOrder"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单列表获取
|
||||
* @param context
|
||||
* @param page
|
||||
* @param size
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun queryOrdersList(
|
||||
context: Context, page: Int, size: Int,
|
||||
callback: OchCommonServiceCallback<OrdersListQueryRespBean>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.queryOrdersList(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
OrdersListQueryReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().sn, page, size
|
||||
)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryOrdersList"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单状态更新
|
||||
* @param context
|
||||
* @param orderNo
|
||||
* @param orderStatus
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun updateOrderStatus(
|
||||
context: Context, orderNo: String?, orderStatus: Int,
|
||||
callback: OchCommonServiceCallback<BaseData>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.updateOrderStatus(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
OrderStatusUpdateReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().sn, orderNo, orderStatus
|
||||
)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "updateOrderStatus"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 暂停接单
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun changeOrderServing(
|
||||
context: Context, isOrdering: Boolean,
|
||||
callback: OchCommonServiceCallback<BaseData>?
|
||||
) {
|
||||
val baseDataObservable: Observable<BaseData> = if (isOrdering) { // 正在接单去暂停
|
||||
mOCHTaxiServiceApi.stopOrderServing(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
DriverStatusUpdateReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().sn
|
||||
)
|
||||
).transformTry()
|
||||
} else { // 没有接单去接单
|
||||
mOCHTaxiServiceApi.resetOrderServing(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
DriverStatusUpdateReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().sn
|
||||
)
|
||||
).transformTry()
|
||||
}
|
||||
baseDataObservable
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "updateDriverServiceStatus"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 车机端上传心跳数据(只在出车状态时上传):包含高德坐标系经纬度
|
||||
* @param context
|
||||
* @param lon
|
||||
* @param lat
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun runCarHeartbeat(
|
||||
context: Context, lon: Double, lat: Double,
|
||||
callback: OchCommonServiceCallback<BaseData>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.runCarHeartbeat(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
CarHeartbeatReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().sn, lon, lat
|
||||
)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "runCarHeartbeat"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询司机服务数据
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun queryDriverServiceData(
|
||||
context: Context,
|
||||
callback: OchCommonServiceCallback<DriverServiceDataRespBean>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.queryServiceData(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
MoGoAiCloudClientConfig.getInstance().sn
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryDriverServiceData"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据订单上传工控机返回的全路径规划数据
|
||||
* @param context
|
||||
* @param orderNo
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun updateOrderRoute(
|
||||
context: Context, orderNo: String?, points: List<OrderRouteUpdateReqBean.Result?>?,
|
||||
callback: OchCommonServiceCallback<BaseData>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.updateOrderRoute(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
OrderRouteUpdateReqBean(orderNo, points)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "updateOrderRoute"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 上报剩余里程,时间
|
||||
* @param context
|
||||
* @param orderNo
|
||||
* @param distance
|
||||
* @param duration
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun reportOrderRemain(
|
||||
context: Context,
|
||||
orderNo: String?,
|
||||
distance: Long,
|
||||
duration: Long,
|
||||
callback: OchCommonServiceCallback<BaseData>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.reportOrderRemain(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
UpdateOrderDisAndTimeReqBean(orderNo, distance, duration)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "reportOrderRemain"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询订单全路径
|
||||
* @param context
|
||||
* @param orderNo
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun queryOrderRoute(
|
||||
context: Context,
|
||||
orderNo: String?,
|
||||
callback: OchCommonServiceCallback<QueryOrderRouteResp>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.queryOrderRoute(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
orderNo
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryOrderRoute"))
|
||||
}
|
||||
@JvmStatic
|
||||
fun confirmAutopilotConditionByDriver(
|
||||
context: Context,
|
||||
orderNo: String?,
|
||||
loc: TaxiOrPassengerReadyReqBean.Result?,
|
||||
callback: OchCommonServiceCallback<TaxiDataBaseRespBean>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.confirmAutopilotConditionByDriver(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
TaxiOrPassengerReadyReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().sn, orderNo, loc
|
||||
)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "confirmAutopilotConditionByDriver"))
|
||||
}
|
||||
@JvmStatic
|
||||
fun queryAutopilotStatus(
|
||||
context: Context, orderNo: String?,
|
||||
callback: OchCommonServiceCallback<TaxiDataBaseRespBean>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.queryPilotStatus(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
orderNo
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryAutopilotStatus"))
|
||||
}
|
||||
@JvmStatic
|
||||
fun updatePassengerHasBoardedStatus(
|
||||
context: Context,
|
||||
orderNo: String?,
|
||||
loc: TaxiOrPassengerReadyReqBean.Result?,
|
||||
callback: OchCommonServiceCallback<TaxiDataBaseRespBean>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.updatePassengerHasBoardedStatus(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
TaxiOrPassengerReadyReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().sn, orderNo, loc
|
||||
)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "updatePassengerHasBoardedStatus"))
|
||||
}
|
||||
@JvmStatic
|
||||
fun startServicePilotDone(
|
||||
context: Context,
|
||||
orderNo: String?,
|
||||
loc: TaxiOrPassengerReadyReqBean.Result?,
|
||||
callback: OchCommonServiceCallback<TaxiDataBaseRespBean>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.startServicePilotDone(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
TaxiOrPassengerReadyReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().sn, orderNo, loc
|
||||
)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "startServicePilotDone"))
|
||||
}
|
||||
@JvmStatic
|
||||
fun arrivedStartPoint(
|
||||
context: Context,
|
||||
orderNo: String?,
|
||||
loc: TaxiOrPassengerReadyReqBean.Result?,
|
||||
callback: OchCommonServiceCallback<TaxiDataBaseRespBean>?
|
||||
) {
|
||||
mOCHTaxiServiceApi.arrivedStartPoint(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
TaxiOrPassengerReadyReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().sn, orderNo, loc
|
||||
)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "arrivedStartPoint"))
|
||||
}
|
||||
@JvmStatic
|
||||
fun arriveTerminal(
|
||||
context: Context,
|
||||
orderNo: String?,
|
||||
loc: TaxiOrPassengerReadyReqBean.Result?,
|
||||
callback: OchCommonServiceCallback<TaxiDataBaseRespBean>
|
||||
) {
|
||||
mOCHTaxiServiceApi.arriveTerminal(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
TaxiOrPassengerReadyReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().sn, orderNo, loc
|
||||
)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "arriveTerminal"))
|
||||
}
|
||||
@JvmStatic
|
||||
fun orderCompleted(
|
||||
context: Context,
|
||||
orderNo: String?,
|
||||
loc: TaxiOrPassengerReadyReqBean.Result?,
|
||||
callback: OchCommonServiceCallback<TaxiDataBaseRespBean>
|
||||
) {
|
||||
mOCHTaxiServiceApi.orderCompleted(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
TaxiOrPassengerReadyReqBean(
|
||||
MoGoAiCloudClientConfig.getInstance().sn, orderNo, loc
|
||||
)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "orderCompleted"))
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.mogo.och.taxi.presenter;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAXI;
|
||||
|
||||
import android.os.Looper;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.taxi.callback.IOCHTaxiAutopilotPlanningCallback;
|
||||
import com.mogo.och.taxi.model.TaxiModel;
|
||||
import com.mogo.och.taxi.ui.TaxiRottingNaviFragment;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/1/18
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
public class NaviPresenter extends Presenter<TaxiRottingNaviFragment> implements IOCHTaxiAutopilotPlanningCallback {
|
||||
|
||||
private static final String TAG = NaviPresenter.class.getSimpleName();
|
||||
|
||||
public NaviPresenter(TaxiRottingNaviFragment view) {
|
||||
super(view);
|
||||
TaxiModel.getInstance().init(AbsMogoApplication.getApp());
|
||||
initListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate( @NonNull LifecycleOwner owner ) {
|
||||
super.onCreate( owner );
|
||||
CallerLogger.INSTANCE.d( M_TAXI + TAG, " onCreate" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy( @NonNull LifecycleOwner owner ) {
|
||||
super.onDestroy( owner );
|
||||
}
|
||||
|
||||
private void initListeners() {
|
||||
TaxiModel.getInstance().setMoGoAutopilotPlanningListener(this);
|
||||
}
|
||||
|
||||
private void releaseListeners() {
|
||||
TaxiModel.getInstance().setMoGoAutopilotPlanningListener(null);
|
||||
}
|
||||
|
||||
private void runOnUIThread( Runnable executor ) {
|
||||
if ( executor == null ) {
|
||||
return;
|
||||
}
|
||||
if ( Looper.myLooper() != Looper.getMainLooper() ) {
|
||||
UiThreadHandler.post( executor );
|
||||
} else {
|
||||
executor.run();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLineMarker(LatLng startStation, LatLng endStation) {
|
||||
runOnUIThread(() -> mView.setLineMarker(startStation,endStation));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void routeResult(List<LatLng> routeArrivied, List<LatLng> routeArriving, MogoLocation location) {
|
||||
mView.routeResult(routeArrivied,routeArriving,location);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.mogo.och.taxi.presenter;
|
||||
|
||||
import android.os.Looper;
|
||||
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.taxi.bean.OrderQueryRespBean;
|
||||
import com.mogo.och.taxi.callback.ITaxiCarOperationalCallback;
|
||||
import com.mogo.och.taxi.model.TaxiModel;
|
||||
import com.mogo.och.taxi.ui.TaxiPersonalDialogFragment;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
public class TaxiOperationalPresenter extends Presenter<TaxiPersonalDialogFragment>
|
||||
implements ITaxiCarOperationalCallback {
|
||||
public TaxiOperationalPresenter(TaxiPersonalDialogFragment view) {
|
||||
super(view);
|
||||
initListener();
|
||||
}
|
||||
|
||||
private void initListener() {
|
||||
TaxiModel.getInstance().setCarStatusCallback(this);
|
||||
}
|
||||
|
||||
private void releaseListener(){
|
||||
TaxiModel.getInstance().setCarStatusCallback(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy(@NonNull LifecycleOwner owner) {
|
||||
super.onDestroy(owner);
|
||||
releaseListener();
|
||||
}
|
||||
|
||||
// 获取全部订单列表
|
||||
public void queryOrdersList(int page, int size) {
|
||||
TaxiModel.getInstance().queryOrdersList(page, size);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onServiceDataUpdate(long dailyTimeDuration, long dailyOrderNum) {
|
||||
runOnUIThread(() -> mView.onServiceDataUpdate(dailyTimeDuration,dailyOrderNum));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOrdersListPageRefresh(List<OrderQueryRespBean.Result> ordersList) {
|
||||
runOnUIThread(() -> mView.onOrdersListPageRefresh(ordersList));
|
||||
}
|
||||
|
||||
private void runOnUIThread( Runnable executor ) {
|
||||
if ( executor == null ) {
|
||||
return;
|
||||
}
|
||||
if ( Looper.myLooper() != Looper.getMainLooper() ) {
|
||||
UiThreadHandler.post( executor );
|
||||
} else {
|
||||
executor.run();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,370 @@
|
||||
package com.mogo.och.taxi.presenter;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAXI;
|
||||
|
||||
import android.os.Build;
|
||||
import android.os.Looper;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.function.call.order.CallerOrderListenerManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.common.module.biz.bean.DriverStatusQueryRespBean;
|
||||
import com.mogo.och.common.module.biz.callback.ILoginCallback;
|
||||
import com.mogo.och.common.module.biz.constant.LoginStatusManager;
|
||||
import com.mogo.och.common.module.manager.OCHAdasAbilityManager;
|
||||
import com.mogo.och.taxi.bean.OrderQueryRespBean;
|
||||
import com.mogo.och.taxi.bean.OrderQueryRouteInfoRespBean;
|
||||
import com.mogo.och.taxi.callback.ITaxiADASStatusCallback;
|
||||
import com.mogo.och.taxi.callback.ITaxiControllerStatusCallback;
|
||||
import com.mogo.och.taxi.callback.ITaxiOrderStatusCallback;
|
||||
import com.mogo.och.taxi.constant.TaxiConst;
|
||||
import com.mogo.och.taxi.constant.TaxiDriverRoleEnum;
|
||||
import com.mogo.och.taxi.constant.TaxiOrderStatusEnum;
|
||||
import com.mogo.och.taxi.constant.TaxtServingStatusManager;
|
||||
import com.mogo.och.taxi.model.TaxiModel;
|
||||
import com.mogo.och.taxi.ui.TaxiFragment;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/1/18
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASStatusCallback,
|
||||
ITaxiOrderStatusCallback, ITaxiControllerStatusCallback, ILoginCallback {
|
||||
|
||||
private static final String TAG = TaxiPresenter.class.getSimpleName();
|
||||
|
||||
private int preAutopilotStatus = 0;
|
||||
|
||||
public TaxiPresenter(TaxiFragment view) {
|
||||
super(view);
|
||||
TaxiModel.getInstance().init(AbsMogoApplication.getApp());
|
||||
OCHAdasAbilityManager.getInstance().init(AbsMogoApplication.getApp());
|
||||
initListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate( @NonNull LifecycleOwner owner ) {
|
||||
super.onCreate( owner );
|
||||
CallerLogger.INSTANCE.d( M_TAXI + TAG, "网约车-出租车拿到订单" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy( @NonNull LifecycleOwner owner ) {
|
||||
super.onDestroy( owner );
|
||||
|
||||
releaseListeners();
|
||||
TaxiModel.getInstance().release();
|
||||
}
|
||||
|
||||
private void initListeners() {
|
||||
TaxiModel.getInstance().setADASStatusCallback(this);
|
||||
TaxiModel.getInstance().setControllerStatusCallback(this);
|
||||
TaxiModel.getInstance().setOrderStatusCallback(this);
|
||||
}
|
||||
|
||||
private void releaseListeners() {
|
||||
TaxiModel.getInstance().setADASStatusCallback(null);
|
||||
TaxiModel.getInstance().setControllerStatusCallback(null);
|
||||
TaxiModel.getInstance().setOrderStatusCallback(null);
|
||||
OCHAdasAbilityManager.getInstance().release();
|
||||
TaxiModel.getInstance().setMoGoAutopilotPlanningListener(null);
|
||||
}
|
||||
|
||||
private void runOnUIThread( Runnable executor ) {
|
||||
if ( executor == null ) {
|
||||
return;
|
||||
}
|
||||
if ( Looper.myLooper() != Looper.getMainLooper() ) {
|
||||
UiThreadHandler.post( executor );
|
||||
} else {
|
||||
executor.run();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启自动驾驶 自驾模式
|
||||
*/
|
||||
public void startAutoPilot() {
|
||||
TaxiModel.getInstance().startAutoPilot();
|
||||
}
|
||||
|
||||
/**
|
||||
* 人工模式
|
||||
*/
|
||||
public void startManualDrive(){
|
||||
TaxiModel.getInstance().startServicePilotDone();
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳过乘客验证环节
|
||||
*/
|
||||
public void jumpPassengerCheckDone(){
|
||||
TaxiModel.getInstance().jumpPassengerCheckDone();
|
||||
}
|
||||
|
||||
/**
|
||||
* 司机确认车辆环境可开启自动驾驶
|
||||
*/
|
||||
public void confirmAutopilotConditionByDriver() {
|
||||
TaxiModel.getInstance().confirmAutopilotConditionByDriver();
|
||||
}
|
||||
|
||||
// 更新接单状态
|
||||
public void updateCarStatus() {
|
||||
TaxiModel.getInstance().updateCarStatus();
|
||||
}
|
||||
|
||||
|
||||
// 获取当前订单状态
|
||||
public TaxiOrderStatusEnum getCurOrderStatus() {
|
||||
return TaxiModel.getInstance().getCurOrderStatus();
|
||||
}
|
||||
|
||||
// 取消当前订单
|
||||
public void cancelCurOrder(int reasonType, String reason) {
|
||||
TaxiModel.getInstance().cancelCurrentOrder(reasonType, reason);
|
||||
}
|
||||
|
||||
// 取消待服务中订单
|
||||
public void cancelOrderById(String orderNo, int reasonType, String reason) {
|
||||
TaxiModel.getInstance().cancelOrderById(orderNo, reasonType, reason);
|
||||
}
|
||||
|
||||
// 查询当前订单route信息:预估时间、里程等
|
||||
public void queryCurOrderRouteInfo() {
|
||||
TaxiModel.getInstance().queryCurOrderRouteInfo();
|
||||
}
|
||||
|
||||
// 执行抢单动作
|
||||
public void grabOrder() {
|
||||
TaxiModel.getInstance().grabOrder();
|
||||
}
|
||||
|
||||
// 关闭新到预约单
|
||||
public void cancelNewBookingOrder() {
|
||||
TaxiModel.getInstance().cancelNewBookingOrder();
|
||||
}
|
||||
|
||||
//更新订单已完成状态
|
||||
public void completeOrderService() {
|
||||
TaxiModel.getInstance().orderCompleted();
|
||||
}
|
||||
|
||||
// 登出
|
||||
public void logout() {
|
||||
TaxiModel.getInstance().logout();
|
||||
}
|
||||
|
||||
//导航去订单目的地
|
||||
public void startNaviToEndStation(boolean isShow){
|
||||
TaxiModel.getInstance().startNaviToEndStation(isShow);
|
||||
}
|
||||
|
||||
public void reportToEndDisAndTime(long lastSumLength, long duration){//米/秒
|
||||
TaxiModel.getInstance().reportOrderRemain(lastSumLength,duration);
|
||||
}
|
||||
|
||||
public void closeOrderByMan(){
|
||||
TaxiModel.getInstance().arriveTerminal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotArriveEnd() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotEnable() {
|
||||
runOnUIThread(() -> mView.updateAutopilotStatus(
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE));
|
||||
preAutopilotStatus = IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotDisable() {
|
||||
runOnUIThread(() -> mView.updateAutopilotStatus(
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE));
|
||||
preAutopilotStatus = IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotRunning() {
|
||||
if (preAutopilotStatus != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING){
|
||||
runOnUIThread(() -> mView.updateAutopilotStatus(
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING));
|
||||
}
|
||||
preAutopilotStatus = IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onManMachineCoDriving() {
|
||||
runOnUIThread(() -> mView.onManMachineCoDriving(IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING));
|
||||
preAutopilotStatus = IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartAdasFailure() {
|
||||
runOnUIThread(() -> mView.stopAnimAndUpdateBtnStatus());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOrdersInServiceChanged(@NonNull @NotNull List<OrderQueryRespBean.Result> inServiceList) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOrdersWaitServiceChanged(@NonNull @NotNull List<OrderQueryRespBean.Result> waitServiceList) {
|
||||
runOnUIThread(() -> mView.onOrdersWaitServiceChanged(waitServiceList));
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.P)
|
||||
@Override
|
||||
public void onCurrentOrderStatusChanged(OrderQueryRespBean.Result order) {
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG,"order = "+order.toString());
|
||||
if (TaxiOrderStatusEnum.UserArriveAtStart.getCode() == order.orderStatus){
|
||||
TaxiModel.getInstance().queryAutopilotStatus(true);
|
||||
TaxiModel.getInstance().setStation();
|
||||
}
|
||||
|
||||
if (TaxiOrderStatusEnum.OnTheWayToEnd.getCode() == order.orderStatus){
|
||||
TaxiModel.getInstance().startDynamicCalculateRouteInfo();
|
||||
TaxiModel.getInstance().setStation();
|
||||
runOnUIThread(() -> {
|
||||
mView.updateCtvAutopilotStatusTag(true);
|
||||
CallerOrderListenerManager.INSTANCE.invokeOrderStatus(true);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
if (TaxiOrderStatusEnum.ArriveAtEnd.getCode() == order.orderStatus ||
|
||||
TaxiOrderStatusEnum.Cancel.getCode() == order.orderStatus ||
|
||||
TaxiOrderStatusEnum.JourneyCompleted.getCode() == order.orderStatus){
|
||||
TaxiModel.getInstance().startOrStopCalculateRouteInfo(false);
|
||||
TaxiModel.getInstance().cleanLineMarker();
|
||||
TaxiModel.getInstance().cleanStation();
|
||||
runOnUIThread(() -> {
|
||||
if(TaxiOrderStatusEnum.ArriveAtEnd.getCode() == order.orderStatus){
|
||||
CallerOrderListenerManager.INSTANCE.invokeOrderStatus(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
runOnUIThread(() -> mView.updateCurrentOrderStatusChanged(order));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCurrentOrderCancelDone() {
|
||||
runOnUIThread(() -> mView.onCurrentOrderCancelDone());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOrderCancelDone(String orderNo) {
|
||||
runOnUIThread(() -> mView.onOrderCancelDone(orderNo));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCurrentOrderRouteInfoGot(OrderQueryRouteInfoRespBean.Result routeInfo) {
|
||||
runOnUIThread(() -> mView.onCurrentOrderRouteInfoGot(routeInfo));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCurrentOrderDistToStartChanged(long meters, long timeInSecond) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCurrentOrderDistToEndChanged(long meters, long timeInSecond) {
|
||||
runOnUIThread(() -> mView.onCurrentOrderDistToEndChanged(meters,timeInSecond));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNewBookingOrderGot(OrderQueryRespBean.Result order) {
|
||||
runOnUIThread(() -> mView.onNewBookingOrderGot(order));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGrabOrderExecuteDone() {
|
||||
runOnUIThread(() -> mView.onGrabOrderExecuteDone());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGrabOrderSuccess(OrderQueryRespBean.Result order) {
|
||||
runOnUIThread(() -> mView.onGrabOrderSuccess(order));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGrabOrderFailed(OrderQueryRespBean.Result order) {
|
||||
runOnUIThread(() -> mView.onGrabOrderFailed(order));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDriverHasCheckedPilotCondition(boolean isSafe) {
|
||||
runOnUIThread(() -> mView.onCheckPilotConditionSafe(isSafe));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviToEnd(boolean isAmap, boolean isShow) {
|
||||
runOnUIThread( () -> mView.onNaviToEnd(isAmap,isShow));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVRModeChanged(boolean isVRMode) {
|
||||
runOnUIThread(() -> mView.switchVRFlatMode(isVRMode));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged(MogoLocation location) {
|
||||
if (null != location){
|
||||
runOnUIThread(() -> {
|
||||
mView.updateSpeedView((float) location.getGnssSpeed());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startOpenAutopilot() {
|
||||
runOnUIThread(() -> {
|
||||
mView.startOrStopLoadingAnim(true);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loginSuccess(DriverStatusQueryRespBean data) {
|
||||
//设置 接单状态
|
||||
TaxtServingStatusManager.setOpenOrderStatus(data.data.servingStatus);
|
||||
//设置 是否启动订单轮训
|
||||
TaxiModel.getInstance().startOrStopOrderLoop(LoginStatusManager.isLogin()&&TaxtServingStatusManager.isOpeningOrderStatus());
|
||||
|
||||
// 设置当前用户角色
|
||||
String role = "";
|
||||
if (TaxiDriverRoleEnum.DEMO.getCode() == data.data.purpose) {
|
||||
role = TaxiConst.DEMO_USER;
|
||||
} else if (TaxiDriverRoleEnum.TEST.getCode() == data.data.purpose) {
|
||||
role = TaxiConst.TEST_USER;
|
||||
}
|
||||
String finalRole = role;
|
||||
runOnUIThread(() -> {
|
||||
mView.updateOperationStatus(TaxtServingStatusManager.isOpeningOrderStatus(), finalRole);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loginFail(boolean isLogin) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.mogo.och.taxi.ui;
|
||||
|
||||
import com.mogo.commons.mvp.IView;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/1/18
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
interface ITaxiView extends IView {
|
||||
}
|
||||
@@ -0,0 +1,289 @@
|
||||
package com.mogo.och.taxi.ui
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.MotionEvent
|
||||
import android.widget.RelativeLayout
|
||||
import com.amap.api.maps.AMap
|
||||
import com.amap.api.maps.CameraUpdateFactory
|
||||
import com.amap.api.maps.TextureMapView
|
||||
import com.amap.api.maps.model.BitmapDescriptor
|
||||
import com.amap.api.maps.model.BitmapDescriptorFactory
|
||||
import com.amap.api.maps.model.CameraPosition
|
||||
import com.amap.api.maps.model.CustomMapStyleOptions
|
||||
import com.amap.api.maps.model.LatLng
|
||||
import com.amap.api.maps.model.LatLngBounds
|
||||
import com.amap.api.maps.model.Marker
|
||||
import com.amap.api.maps.model.MarkerOptions
|
||||
import com.amap.api.maps.model.Polyline
|
||||
import com.amap.api.maps.model.PolylineOptions
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.och.taxi.R
|
||||
import com.mogo.och.taxi.utils.TaxiMapAssetStyleUtil
|
||||
|
||||
/**
|
||||
* taxi司机端前往目的地小地图导航
|
||||
*/
|
||||
class TaxiMapDirectionView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : RelativeLayout(context, attrs, defStyleAttr), IMoGoChassisLocationGCJ02Listener,
|
||||
ITaxiMapDirectionView, AMap.OnCameraChangeListener {
|
||||
private lateinit var mAMapNaviView: TextureMapView
|
||||
private lateinit var mAMap: AMap
|
||||
private var mCarMarker: Marker? = null
|
||||
private lateinit var mStartMarker: Marker
|
||||
private lateinit var mEndMarker: Marker
|
||||
private val zoomLevel = 13
|
||||
private val routeArrivied: MutableList<LatLng> = ArrayList()
|
||||
private val routeArriving: MutableList<LatLng> = ArrayList()
|
||||
private var location: MogoLocation? = null
|
||||
private var startStation: LatLng? = null
|
||||
private var endStation: LatLng? = null
|
||||
private var mPolyline: Polyline? = null
|
||||
var textureList: MutableList<BitmapDescriptor?> = ArrayList()
|
||||
var texIndexList: MutableList<Int> = ArrayList()
|
||||
private var mArrivedRes: BitmapDescriptor? = null
|
||||
private var mUnArrivedRes: BitmapDescriptor? = null
|
||||
|
||||
init {
|
||||
try {
|
||||
initView(context)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
private fun initView(context: Context) {
|
||||
d(SceneConstant.M_TAXI + TAG, "initView")
|
||||
val smpView = LayoutInflater.from(context).inflate(R.layout.taxi_map_view, this)
|
||||
mAMapNaviView = smpView.findViewById(R.id.taxi_amap_view)
|
||||
initAMapView()
|
||||
|
||||
// 注册定位监听
|
||||
CallerChassisLocationGCJ02ListenerManager.addListener(TAG, 10, this)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
// 注册定位监听
|
||||
CallerChassisLocationGCJ02ListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
private fun initAMapView() {
|
||||
val mCameraUpdate = CameraUpdateFactory.zoomTo(zoomLevel.toFloat())
|
||||
mAMap = mAMapNaviView.map
|
||||
// 设置导航地图模式,aMap是地图控制器对象。
|
||||
mAMap.mapType = AMap.MAP_TYPE_NIGHT
|
||||
|
||||
// 关闭显示实时路况图层,aMap是地图控制器对象。
|
||||
mAMap.isTrafficEnabled = false
|
||||
|
||||
// 设置 锚点 图标
|
||||
mCarMarker = mAMap.addMarker(MarkerOptions().icon(BitmapDescriptorFactory.fromResource(R.drawable.taxi_map_car)).anchor(0.5f, 0.5f))
|
||||
mStartMarker = mAMap.addMarker(MarkerOptions().icon(BitmapDescriptorFactory.fromResource(R.drawable.taxi_map_view_dir_start)))
|
||||
mEndMarker = mAMap.addMarker(MarkerOptions().icon(BitmapDescriptorFactory.fromResource(R.drawable.taxi_map_view_dir_end)))
|
||||
mStartMarker.isVisible = false
|
||||
mEndMarker.isVisible = false
|
||||
mArrivedRes = BitmapDescriptorFactory.fromResource(R.drawable.taxi_map_arrow_arrived)
|
||||
mUnArrivedRes = BitmapDescriptorFactory.fromResource(R.drawable.taxi_map_arrow_un_arrive)
|
||||
|
||||
// 加载自定义样式
|
||||
val customMapStyleOptions = CustomMapStyleOptions()
|
||||
.setEnable(true)
|
||||
.setStyleData(TaxiMapAssetStyleUtil.getAssetsStyle(context, "map_style.data"))
|
||||
.setStyleExtraData(
|
||||
TaxiMapAssetStyleUtil.getAssetsExtraStyle(
|
||||
context,
|
||||
"map_style_extra.data"
|
||||
)
|
||||
)
|
||||
// 设置自定义样式
|
||||
mAMap.setCustomMapStyle(customMapStyleOptions)
|
||||
|
||||
//设置希望展示的地图缩放级别
|
||||
mAMap.moveCamera(mCameraUpdate)
|
||||
|
||||
// 设置地图的样式
|
||||
mAMap.uiSettings.apply {
|
||||
isZoomControlsEnabled = false // 地图缩放级别的交换按钮
|
||||
setAllGesturesEnabled(false) // 所有手势
|
||||
isMyLocationButtonEnabled = false // 显示默认的定位按钮
|
||||
setLogoBottomMargin(-150) //设置Logo下边界距离屏幕底部的边距,设置为负值即可
|
||||
}
|
||||
mAMap.setOnMapLoadedListener(AMap.OnMapLoadedListener {
|
||||
d(SceneConstant.M_TAXI + TAG, "smp---onMapLoaded")
|
||||
// 加载自定义样式
|
||||
val customMapStyleOptions = CustomMapStyleOptions()
|
||||
.setEnable(true)
|
||||
.setStyleData(TaxiMapAssetStyleUtil.getAssetsStyle(context, "map_style.data"))
|
||||
.setStyleExtraData(
|
||||
TaxiMapAssetStyleUtil.getAssetsExtraStyle(
|
||||
context,
|
||||
"map_style_extra.data"
|
||||
)
|
||||
)
|
||||
// 设置自定义样式
|
||||
mAMap.setCustomMapStyle(customMapStyleOptions)
|
||||
mAMapNaviView.map.setPointToCenter(
|
||||
mAMapNaviView.width / 2,
|
||||
mAMapNaviView.height / 2
|
||||
)
|
||||
})
|
||||
|
||||
//设置地图状态的监听接口
|
||||
mAMap.setOnCameraChangeListener(this)
|
||||
}
|
||||
|
||||
override fun onInterceptTouchEvent(ev: MotionEvent): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onChassisLocationGCJ02(mogoLocation: MogoLocation?) {
|
||||
if (mogoLocation == null) {
|
||||
return
|
||||
}
|
||||
try {
|
||||
val currentLatLng = LatLng(mogoLocation.latitude, mogoLocation.longitude)
|
||||
if (mPolyline != null && mPolyline!!.points.size > 1) {
|
||||
val points = mPolyline!!.points
|
||||
//圈定地图显示范围
|
||||
val endLatLng = points[points.size - 1]
|
||||
//存放经纬度
|
||||
val boundsBuilder = LatLngBounds.Builder()
|
||||
boundsBuilder.include(currentLatLng)
|
||||
boundsBuilder.include(endLatLng)
|
||||
//第二个参数为四周留空宽度
|
||||
mAMap.moveCamera(
|
||||
CameraUpdateFactory.newLatLngBoundsRect(boundsBuilder.build(), 100, 100, 100, 100)
|
||||
)
|
||||
} else {
|
||||
//设置希望展示的地图缩放级别
|
||||
val cameraPosition = CameraPosition.Builder()
|
||||
.target(mCarMarker!!.position).tilt(0f).bearing(mogoLocation.heading.toFloat())
|
||||
.zoom(zoomLevel.toFloat()).build()
|
||||
mAMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition))
|
||||
}
|
||||
//更新车辆位置
|
||||
if (mCarMarker != null) {
|
||||
mCarMarker!!.rotateAngle = (360 - mogoLocation.heading).toFloat()
|
||||
mCarMarker!!.position = currentLatLng
|
||||
mCarMarker!!.setToTop()
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
override fun setLineMarker() {
|
||||
if (mStartMarker.isVisible && mEndMarker.isVisible
|
||||
) {
|
||||
return
|
||||
}
|
||||
if (startStation != null && endStation != null) {
|
||||
// 设置开始结束Marker位置
|
||||
mStartMarker.position = startStation
|
||||
mStartMarker.isVisible = true
|
||||
mEndMarker.position = endStation
|
||||
mEndMarker.isVisible = true
|
||||
}
|
||||
}
|
||||
|
||||
override fun drawablePolyline() {
|
||||
if (routeArrivied.isEmpty() && routeArriving.isEmpty()) {
|
||||
d(SceneConstant.M_TAXI + TAG, "没有点")
|
||||
return
|
||||
}
|
||||
texIndexList.clear()
|
||||
val allPoints = ArrayList(routeArrivied)
|
||||
for (i in routeArrivied.indices) {
|
||||
if (routeArrivied.size > 1 && i < routeArrivied.size - 1) {
|
||||
texIndexList.add(0)
|
||||
}
|
||||
}
|
||||
texIndexList.add(0)
|
||||
allPoints.add(LatLng(location!!.latitude, location!!.longitude))
|
||||
allPoints.addAll(routeArriving)
|
||||
for (ignored in routeArrivied) {
|
||||
texIndexList.add(1)
|
||||
}
|
||||
if (mPolyline != null) {
|
||||
mPolyline!!.points = allPoints
|
||||
mPolyline!!.options.customTextureIndex = texIndexList
|
||||
return
|
||||
}
|
||||
if(textureList.isEmpty()) {
|
||||
textureList.add(mArrivedRes)
|
||||
textureList.add(mUnArrivedRes)
|
||||
}
|
||||
//设置线段纹理
|
||||
val polylineOptions = PolylineOptions().apply {
|
||||
addAll(allPoints)
|
||||
isUseTexture = true
|
||||
width(15f)
|
||||
lineCapType(PolylineOptions.LineCapType.LineCapRound)
|
||||
customTextureList = textureList
|
||||
customTextureIndex = texIndexList
|
||||
}
|
||||
|
||||
// 绘制线
|
||||
mPolyline = mAMap.addPolyline(polylineOptions)
|
||||
}
|
||||
|
||||
override fun clearPolyline() {
|
||||
if (mPolyline != null) {
|
||||
mPolyline!!.remove()
|
||||
mPolyline = null
|
||||
}
|
||||
mStartMarker.isVisible = false
|
||||
mEndMarker.isVisible = false
|
||||
}
|
||||
|
||||
fun onCreateView(savedInstanceState: Bundle?) {
|
||||
mAMapNaviView.onCreate(savedInstanceState)
|
||||
}
|
||||
|
||||
fun onResume() {
|
||||
mAMapNaviView.onResume()
|
||||
}
|
||||
|
||||
fun onPause() {
|
||||
mAMapNaviView.onPause()
|
||||
}
|
||||
|
||||
fun onDestroy() {
|
||||
mAMapNaviView.onDestroy()
|
||||
}
|
||||
|
||||
fun setStartMarkAndEndMark(startStation: LatLng?, endStation: LatLng?) {
|
||||
this.startStation = startStation
|
||||
this.endStation = endStation
|
||||
}
|
||||
|
||||
fun setCoordinatesLatLng(
|
||||
routeArrivied: List<LatLng>?,
|
||||
routeArriving: List<LatLng>?,
|
||||
location: MogoLocation?
|
||||
) {
|
||||
this.routeArrivied.clear()
|
||||
this.routeArrivied.addAll(routeArrivied!!)
|
||||
this.routeArriving.clear()
|
||||
this.routeArriving.addAll(routeArriving!!)
|
||||
this.location = location
|
||||
}
|
||||
|
||||
override fun onCameraChange(cameraPosition: CameraPosition) {}
|
||||
override fun onCameraChangeFinish(cameraPosition: CameraPosition) {}
|
||||
|
||||
companion object {
|
||||
//小地图名称
|
||||
const val TAG = "TaxiMapDirectionView"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,231 @@
|
||||
package com.mogo.och.taxi.ui;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAXI;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.Display;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.GridView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils;
|
||||
import com.mogo.och.taxi.constant.TaxiOrderStatusEnum;
|
||||
import com.mogo.och.taxi.R;
|
||||
import com.mogo.och.taxi.constant.TaxiOrderCancelReasons;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/8/18
|
||||
*/
|
||||
public class TaxiOrderCancelDialog extends AlertDialog implements View.OnClickListener,AdapterView.OnItemClickListener {
|
||||
|
||||
private static final String TAG = "OCHTaxiOrderCancelDial";
|
||||
protected WeakReference<Context> contextWeakReference;
|
||||
private GridView mContentView;
|
||||
private TextView mCancelCommitTv;
|
||||
private TextView mDialogCancelTv;
|
||||
private String mCurrentReason = "";
|
||||
private ContentAdapter mContentAdapter;
|
||||
private int mOrderStatus;//1:预约单,其他为即时单的状态, 主要是控制乘客上车 乘客下车这几个选项的显示
|
||||
private String[] mContentArrays;
|
||||
private WeakReference<TaxiFragment> mOchTaxiFragmentWeak;
|
||||
private String mOrderNo;
|
||||
|
||||
protected TaxiOrderCancelDialog(TaxiFragment fragment, Context context, String orderNo, int orderStatus) {
|
||||
super(context,R.style.OrderCancelDialog);
|
||||
mOrderNo = orderNo;
|
||||
mOchTaxiFragmentWeak = new WeakReference<>(fragment);
|
||||
this.mOrderStatus = orderStatus;
|
||||
contextWeakReference = new WeakReference<>(context);
|
||||
initReasonArray();
|
||||
}
|
||||
|
||||
private void initReasonArray() {
|
||||
if (1 == mOrderStatus) {
|
||||
mContentArrays = new String[]{TaxiOrderCancelReasons.BookPassengerCancel.getMsg(), TaxiOrderCancelReasons.CarBroken.getMsg(),
|
||||
TaxiOrderCancelReasons.BookJourneyConflict.getMsg(), TaxiOrderCancelReasons.BatteryLow.getMsg(),
|
||||
TaxiOrderCancelReasons.BookOther.getMsg()};
|
||||
return;
|
||||
}
|
||||
TaxiOrderStatusEnum ochStatus = TaxiOrderStatusEnum.valueOf(mOrderStatus);
|
||||
switch (ochStatus) {
|
||||
case OnTheWayToStart:
|
||||
mContentArrays = new String[]{TaxiOrderCancelReasons.CarBroken.getMsg(), TaxiOrderCancelReasons.DeviceBroken.getMsg(),
|
||||
TaxiOrderCancelReasons.BatteryLow.getMsg(), TaxiOrderCancelReasons.DriverIsIll.getMsg(),
|
||||
TaxiOrderCancelReasons.StartStationFaraway.getMsg(), TaxiOrderCancelReasons.Other.getMsg(),
|
||||
TaxiOrderCancelReasons.PassengerCancel.getMsg()};
|
||||
break;
|
||||
case ArriveAtStart:
|
||||
mContentArrays = new String[]{TaxiOrderCancelReasons.CarBroken.getMsg(), TaxiOrderCancelReasons.DeviceBroken.getMsg(),
|
||||
TaxiOrderCancelReasons.BatteryLow.getMsg(), TaxiOrderCancelReasons.DriverIsIll.getMsg(),
|
||||
TaxiOrderCancelReasons.PassengerNotArrive.getMsg(),TaxiOrderCancelReasons.UnContractPassenger.getMsg(),
|
||||
TaxiOrderCancelReasons.PassengerCancel.getMsg(),TaxiOrderCancelReasons.Other.getMsg()};
|
||||
break;
|
||||
case OnTheWayToEnd:
|
||||
case ArriveAtEnd:
|
||||
mContentArrays = new String[]{TaxiOrderCancelReasons.CarBroken.getMsg(), TaxiOrderCancelReasons.DeviceBroken.getMsg(),
|
||||
TaxiOrderCancelReasons.BatteryLow.getMsg(), TaxiOrderCancelReasons.DriverIsIll.getMsg(),
|
||||
TaxiOrderCancelReasons.PassengerStopOver.getMsg(),TaxiOrderCancelReasons.Other.getMsg()};
|
||||
break;
|
||||
default:
|
||||
mContentArrays = new String[]{TaxiOrderCancelReasons.CarBroken.getMsg(), TaxiOrderCancelReasons.DeviceBroken.getMsg(),
|
||||
TaxiOrderCancelReasons.BatteryLow.getMsg(), TaxiOrderCancelReasons.DriverIsIll.getMsg(),
|
||||
TaxiOrderCancelReasons.PassengerNotArrive.getMsg(), TaxiOrderCancelReasons.PassengerStopOver.getMsg(),
|
||||
TaxiOrderCancelReasons.Other.getMsg()};
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected TaxiOrderCancelDialog(Context context, boolean cancelable, OnCancelListener cancelListener) {
|
||||
super(context, cancelable, cancelListener);
|
||||
}
|
||||
|
||||
protected TaxiOrderCancelDialog(Context context, int themeResId) {
|
||||
super(context, themeResId);
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.M)
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
getWindow().setBackgroundDrawableResource(R.drawable.taxi_order_cancel_dialog_bg);
|
||||
setContentView(R.layout.taxi_order_cancel_view);
|
||||
initView();
|
||||
setCancelable(false);
|
||||
setCanceledOnTouchOutside(false);
|
||||
|
||||
initWindowView();
|
||||
}
|
||||
|
||||
private void initWindowView() {
|
||||
Window window = getWindow();
|
||||
//dialog padding 去掉
|
||||
window.getDecorView().setPadding(0,0,0,0);
|
||||
window.setDimAmount(0.5f);
|
||||
window.getDecorView().setBackgroundColor(Color.parseColor("#00FFFFFF"));//设置背景, 不然显示不全
|
||||
|
||||
WindowManager.LayoutParams params = window.getAttributes();
|
||||
window.setGravity(Gravity.CENTER);
|
||||
WindowManager m = window.getWindowManager();
|
||||
Display d = m.getDefaultDisplay();
|
||||
params.height = d.getHeight() - 500;
|
||||
window.setAttributes(params);
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.M)
|
||||
private void initView() {
|
||||
mContentView = findViewById(R.id.module_och_taxi_order_cancel_content_gv);
|
||||
mCancelCommitTv = findViewById(R.id.order_cancel_commit_tv);
|
||||
mDialogCancelTv = findViewById(R.id.order_dialog_cancel_tv);
|
||||
mContentAdapter = new ContentAdapter(contextWeakReference.get(), mContentArrays);
|
||||
mContentView.setAdapter(mContentAdapter);
|
||||
mContentView.setSelector(new ColorDrawable(Color.TRANSPARENT));
|
||||
mContentView.setOnItemClickListener(this);
|
||||
mCancelCommitTv.setOnClickListener(this);
|
||||
mDialogCancelTv.setOnClickListener(this);
|
||||
mContentView.setOnItemClickListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (v.getId() == R.id.order_cancel_commit_tv) {//bt commit
|
||||
if (!TextUtils.isEmpty(mCurrentReason) && TaxiOrderCancelReasons.getType(mCurrentReason) != 0) {
|
||||
if (1 == mOrderStatus){//预约单
|
||||
mOchTaxiFragmentWeak.get().cancelOrderById(mOrderNo, TaxiOrderCancelReasons.getType(mCurrentReason),mCurrentReason);
|
||||
}else {//即时单
|
||||
mOchTaxiFragmentWeak.get().cancelCurOrder(TaxiOrderCancelReasons.getType(mCurrentReason),mCurrentReason);
|
||||
}
|
||||
dismiss();
|
||||
}else {
|
||||
ToastUtils.showShort("取消原因不能为空");
|
||||
}
|
||||
}else if (v.getId() == R.id.order_dialog_cancel_tv){//close icon
|
||||
mCurrentReason = "";
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG,"mCurrentReason ="+ mContentArrays[position]);
|
||||
mCurrentReason = mContentArrays[position];
|
||||
// GradientDrawable background = (GradientDrawable) mCancelBt.getBackground();//GradientDrawable是Drawable的子类
|
||||
// background.setColor(Color.parseColor("#2B6EFF"));
|
||||
// mCancelBt.setTextColor(Color.parseColor("#FFFFFF"));
|
||||
// mCancelBt.setClickable(true);
|
||||
mContentAdapter.notifyCurrentReasons(mCurrentReason);
|
||||
}
|
||||
|
||||
class ContentAdapter extends BaseAdapter{
|
||||
|
||||
private Context context;
|
||||
private String[] datas;
|
||||
private LayoutInflater layoutInflater;
|
||||
private String currentReasons = "";
|
||||
|
||||
public ContentAdapter(Context context, String[] array){
|
||||
this.context = context;
|
||||
datas = array;
|
||||
layoutInflater = LayoutInflater.from(context);
|
||||
}
|
||||
@Override
|
||||
public int getCount() {
|
||||
return datas.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return datas[position];
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
ViewHolder viewHolder = null;
|
||||
if (convertView == null){
|
||||
convertView = layoutInflater.inflate(R.layout.taxi_order_checkbox_item,null);
|
||||
viewHolder = new ViewHolder();
|
||||
viewHolder.checkBoxTv = convertView.findViewById(R.id.item_checkbox);
|
||||
convertView.setTag(viewHolder);
|
||||
}else {
|
||||
viewHolder = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
viewHolder.checkBoxTv.setText(datas[position]);
|
||||
if(viewHolder.checkBoxTv.getText().toString().equals(currentReasons)){
|
||||
viewHolder.checkBoxTv.setCompoundDrawablesWithIntrinsicBounds(context.getResources().getDrawable(R.drawable.shape_size_taxi_selected_btn),null,null,null);
|
||||
}else {
|
||||
viewHolder.checkBoxTv.setCompoundDrawablesWithIntrinsicBounds(context.getResources().getDrawable(R.drawable.shape_size_taxi_unselected_btn),null,null,null);
|
||||
}
|
||||
return convertView;
|
||||
}
|
||||
public void notifyCurrentReasons(String reason){
|
||||
currentReasons = reason;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
class ViewHolder {
|
||||
TextView checkBoxTv;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.mogo.och.taxi.utils
|
||||
|
||||
import android.content.res.Resources
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/1/21
|
||||
*/
|
||||
object DimenUtil{
|
||||
fun dp2px(value:Float):Float{
|
||||
return (0.5f + value * Resources.getSystem().displayMetrics.density)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.mogo.och.taxi.utils;
|
||||
|
||||
import com.mogo.och.taxi.bean.OrderQueryRespBean;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created on 2021/9/11
|
||||
*/
|
||||
public class OrderUtil {
|
||||
|
||||
// 判断两个list中的订单是否相同:依据orderId
|
||||
public static boolean haveSameOrders(List<OrderQueryRespBean.Result> list1,
|
||||
List<OrderQueryRespBean.Result> list2) {
|
||||
OrderQueryRespBean.Result[] arr1 = list1.toArray(new OrderQueryRespBean.Result[]{});
|
||||
OrderQueryRespBean.Result[] arr2 = list2.toArray(new OrderQueryRespBean.Result[]{});
|
||||
Arrays.sort(arr1);
|
||||
Arrays.sort(arr1);
|
||||
return Arrays.equals(arr1,arr2);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.mogo.och.taxi.utils;
|
||||
|
||||
import android.app.AppOpsManager;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.location.LocationManager;
|
||||
import android.os.Build;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/12/7
|
||||
*/
|
||||
public class PermissionUtil {
|
||||
|
||||
public static boolean checkPermission(Context context,String... permissons) {
|
||||
|
||||
for (String permisson : permissons) {
|
||||
if ((ContextCompat.checkSelfPermission(context,
|
||||
permisson) != PackageManager.PERMISSION_GRANTED)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isLocServiceEnable(Context context) {
|
||||
LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
|
||||
boolean gps = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
|
||||
boolean network = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
|
||||
if (gps || network) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
package com.mogo.och.taxi.utils;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAXI;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.eagle.core.data.app.AppConfigInfo;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.commons.utils.MogoAnalyticUtils;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.DateTimeUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.taxi.constant.TaxiConst;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* OCH Taxi埋点工具
|
||||
*
|
||||
* Created on 2022/3/24
|
||||
*/
|
||||
public class TaxiAnalyticsManager {
|
||||
|
||||
private static final class SingletonHolder {
|
||||
private static final TaxiAnalyticsManager INSTANCE = new TaxiAnalyticsManager();
|
||||
}
|
||||
|
||||
public static TaxiAnalyticsManager getInstance() {
|
||||
return TaxiAnalyticsManager.SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private String mStartAutopilotKey;
|
||||
private HashMap<String, Object> mStartAutopilotParams = new HashMap<>();
|
||||
|
||||
private Runnable startAutopilotRunnable = () -> {
|
||||
// 15s内未开启,上报失败埋点
|
||||
triggerStartAutopilotFailureEvent("", "15s后app等待超时");
|
||||
};
|
||||
|
||||
public void triggerStartAutopilotFailureEventByAdas(String failCode, String failMsg){
|
||||
removeWaitingCallback();
|
||||
triggerStartAutopilotFailureEvent(failCode, failMsg);
|
||||
}
|
||||
|
||||
private void removeWaitingCallback() {
|
||||
if (startAutopilotRunnable != null) {
|
||||
UiThreadHandler.removeCallbacks(startAutopilotRunnable);
|
||||
}
|
||||
}
|
||||
|
||||
private void triggerStartAutopilotFailureEvent(String failCode, String failMsg){
|
||||
if (mStartAutopilotParams.isEmpty()) return;
|
||||
|
||||
CallerLogger.INSTANCE.e(M_TAXI + "triggerStartAutopilotFailureEvent", failMsg);
|
||||
if (CallerAutoPilotStatusListenerManager.INSTANCE.getState() !=
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING){
|
||||
mStartAutopilotParams.put(TaxiConst.EVENT_PARAM_START_FAILURE_CODE, failCode);
|
||||
mStartAutopilotParams.put(TaxiConst.EVENT_PARAM_START_FAILURE_MSG,
|
||||
failMsg);
|
||||
}
|
||||
mStartAutopilotParams.put(TaxiConst.EVENT_PARAM_START_RESULT,
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.getState() ==
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING);
|
||||
MogoAnalyticUtils.INSTANCE.track(mStartAutopilotKey, mStartAutopilotParams);
|
||||
|
||||
clearStartAutopilotParams();//清空参数数据,防止误传
|
||||
}
|
||||
|
||||
private void clearStartAutopilotParams(){
|
||||
mStartAutopilotParams.clear();
|
||||
}
|
||||
|
||||
public void clearStartAutopilotFailureMSG(){
|
||||
mStartAutopilotParams.put(TaxiConst.EVENT_PARAM_START_FAILURE_CODE, "");
|
||||
mStartAutopilotParams.put(TaxiConst.EVENT_PARAM_START_FAILURE_MSG, "");
|
||||
}
|
||||
|
||||
/**
|
||||
* 触发'开启自动驾驶'埋点流程
|
||||
* 开启自动驾驶,15s内成功则发送成功埋点,否则发送失败埋点
|
||||
* @param restart false(点击'开始服务'启动)/true(接管后点击'自动驾驶'按钮启动)
|
||||
* @param send 是否直接发送埋点(15s内开启成功则直接发送成功埋点)
|
||||
*/
|
||||
public void triggerStartAutopilotEvent(
|
||||
boolean restart, boolean send, String startName, String endName, long lineId, String orderNo) {
|
||||
mStartAutopilotKey = restart ?
|
||||
TaxiConst.EVENT_KEY_RESTART_AUTOPILOT : TaxiConst.EVENT_KEY_START_SERVICE;
|
||||
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
String plateNum = AppConfigInfo.INSTANCE.getPlateNumber();
|
||||
String dateTime = DateTimeUtils.getTimeText(
|
||||
System.currentTimeMillis(), DateTimeUtils.yyyy_MM_dd_HH_mm_ss);
|
||||
|
||||
mStartAutopilotParams.put(TaxiConst.EVENT_PARAM_SN, sn);
|
||||
mStartAutopilotParams.put(TaxiConst.EVENT_PARAM_PLATE_NUM, TextUtils.isEmpty(plateNum) ? "" : plateNum);
|
||||
mStartAutopilotParams.put(TaxiConst.EVENT_PARAM_ENV_ONLINE,
|
||||
DebugConfig.getNetMode() == DebugConfig.NET_MODE_RELEASE ? true : false);
|
||||
mStartAutopilotParams.put(TaxiConst.EVENT_PARAM_TIME, dateTime);
|
||||
mStartAutopilotParams.put(TaxiConst.EVENT_PARAM_START_NAME, startName);
|
||||
mStartAutopilotParams.put(TaxiConst.EVENT_PARAM_END_NAME, endName);
|
||||
mStartAutopilotParams.put(TaxiConst.EVENT_PARAM_LINE_ID, lineId);
|
||||
mStartAutopilotParams.put(TaxiConst.EVENT_PARAM_ORDER_NUMBER, orderNo);
|
||||
|
||||
// CallerLogger.INSTANCE.d(M_TAXI + "埋点==","restart = "+restart+", send= "+send);
|
||||
|
||||
if (send) {
|
||||
if (mStartAutopilotParams.isEmpty()) return;
|
||||
// 开启成功,上报埋点
|
||||
clearStartAutopilotFailureMSG();
|
||||
removeWaitingCallback();
|
||||
mStartAutopilotParams.put(TaxiConst.EVENT_PARAM_START_RESULT, true);
|
||||
MogoAnalyticUtils.INSTANCE.track(mStartAutopilotKey, mStartAutopilotParams);
|
||||
|
||||
clearStartAutopilotParams();//清空参数数据,防止误传
|
||||
} else {
|
||||
UiThreadHandler.postDelayed(startAutopilotRunnable, TaxiConst.LOOP_PERIOD_15S);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 触发"无法开启自驾已知异常"埋点
|
||||
* @param startName
|
||||
* @param endName
|
||||
* @param orderNo
|
||||
*/
|
||||
public void triggerUnableStartAPReasonEvent(String startName, String endName, String orderNo,
|
||||
String reason) {
|
||||
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
String plateNum = AppConfigInfo.INSTANCE.getPlateNumber();
|
||||
String dateTime = DateTimeUtils.getTimeText(
|
||||
System.currentTimeMillis(), DateTimeUtils.yyyy_MM_dd_HH_mm_ss);
|
||||
|
||||
HashMap<String, Object> params = new HashMap<>();
|
||||
|
||||
params.put(TaxiConst.EVENT_PARAM_SN, sn);
|
||||
params.put(TaxiConst.EVENT_PARAM_PLATE_NUM, TextUtils.isEmpty(plateNum) ? "" : plateNum);
|
||||
params.put(TaxiConst.EVENT_PARAM_ENV_ONLINE,
|
||||
DebugConfig.getNetMode() == DebugConfig.NET_MODE_RELEASE ? true : false);
|
||||
params.put(TaxiConst.EVENT_PARAM_TIME, dateTime);
|
||||
params.put(TaxiConst.EVENT_PARAM_START_NAME, startName);
|
||||
params.put(TaxiConst.EVENT_PARAM_END_NAME, endName);
|
||||
params.put(TaxiConst.EVENT_PARAM_ORDER_NUMBER, orderNo);
|
||||
params.put(TaxiConst.EVENT_PARAM_UNABLE_START_REASON, reason);
|
||||
MogoAnalyticUtils.INSTANCE.track(TaxiConst.EVENT_KEY_AP_UNABLE_START_REASON, params);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.mogo.och.taxi.utils;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
* @date 12/18/20 5:37 PM
|
||||
*/
|
||||
public class TaxiMapAssetStyleUtil {
|
||||
|
||||
public static byte[] getAssetsStyle(Context context,String fileName) {
|
||||
byte[] buffer1 = null;
|
||||
InputStream is1 = null;
|
||||
try {
|
||||
is1 = context.getResources().getAssets().open(fileName); //eg. over_view_style.data
|
||||
int lenght1 = is1.available();
|
||||
buffer1 = new byte[lenght1];
|
||||
is1.read(buffer1);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
if (is1 != null) {
|
||||
is1.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return buffer1;
|
||||
}
|
||||
|
||||
|
||||
public static byte[] getAssetsExtraStyle(Context context, String fileName) {
|
||||
byte[] buffer1 = null;
|
||||
InputStream is1 = null;
|
||||
try {
|
||||
is1 = context.getResources().getAssets().open(fileName); //eg. over_view_style_extra.data
|
||||
int lenght1 = is1.available();
|
||||
buffer1 = new byte[lenght1];
|
||||
is1.read(buffer1);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
if (is1 != null) {
|
||||
is1.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return buffer1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,207 @@
|
||||
package com.mogo.och.taxi.utils;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils;
|
||||
import com.mogo.och.taxi.bean.OrderQueryRespBean;
|
||||
import com.mogo.och.taxi.constant.TaxiConst;
|
||||
import com.mogo.och.taxi.constant.TaxiOrderStatusEnum;
|
||||
import com.mogo.och.taxi.model.TaxiModel;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import mogo_msg.MogoReportMsg;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAXI;
|
||||
|
||||
/**
|
||||
* Taxi轨迹管理:给MEC下发用于轨迹下载的信息
|
||||
* Created on 2022/6/22
|
||||
*/
|
||||
public class TaxiTrajectoryManager {
|
||||
private static final String TAG = TaxiTrajectoryManager.class.getSimpleName();
|
||||
|
||||
private static final class SingletonHolder {
|
||||
private static final TaxiTrajectoryManager INSTANCE = new TaxiTrajectoryManager();
|
||||
}
|
||||
|
||||
public static TaxiTrajectoryManager getInstance() {
|
||||
return TaxiTrajectoryManager.SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private AutopilotControlParameters.AutoPilotLine mAutoPilotLine = null;
|
||||
private Disposable mSendReqDisposable = null;
|
||||
private String mPrevOrderNo = "";
|
||||
|
||||
public TaxiTrajectoryManager() {
|
||||
mAutoPilotLine = new AutopilotControlParameters.AutoPilotLine(-1,
|
||||
"", "", "", "", 0, "",
|
||||
"", "", "", "", 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步订单信息
|
||||
*/
|
||||
public void syncTrajectoryInfo() {
|
||||
OrderQueryRespBean.Result orderInfo = TaxiModel.getInstance().getCurrentOCHOrder();
|
||||
if (orderInfo == null || orderInfo.orderStatus >= TaxiOrderStatusEnum.OnTheWayToEnd.getCode()) {
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "syncTrajectoryInfo() stop.");
|
||||
stopTrajReqLoop();
|
||||
} else {
|
||||
if (mPrevOrderNo.equals(orderInfo.orderNo)) {
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "syncTrajectoryInfo() 重复订单.");
|
||||
} else {
|
||||
mPrevOrderNo = orderInfo.orderNo;
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "syncTrajectoryInfo() start.");
|
||||
startTrajReqLoop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 接口MEC反馈的常规信息(MAP v2.5.0新增轨迹相关信息)
|
||||
* @param guardianInfo
|
||||
*/
|
||||
public void onAutopilotGuardian(@Nullable MogoReportMsg.MogoReportMessage guardianInfo) {
|
||||
if (guardianInfo == null || !guardianInfo.hasCode()) return;
|
||||
if ("ISYS_INIT_TRAJECTORY_START".equals(guardianInfo.getCode())) {
|
||||
// 1. 轨迹管理_轨迹开始下载(本地已有对应轨迹也触发)
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "onAutopilotGuardian() 轨迹开始下载");
|
||||
// ToastUtils.showShort("轨迹开始下载");
|
||||
stopTrajReqLoop();
|
||||
} else if ("ISYS_INIT_TRAJECTORY_SUCCESS".equals(guardianInfo.getCode())) {
|
||||
// 2. 轨迹管理_轨迹下载成功(本地已有对应轨迹也触发)
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "onAutopilotGuardian() 轨迹下载成功");
|
||||
// ToastUtils.showShort("轨迹下载成功");
|
||||
stopTrajReqLoop();
|
||||
} else if ("ISYS_INIT_TRAJECTORY_FAILURE".equals(guardianInfo.getCode())) {
|
||||
// 3. 轨迹管理_轨迹下载失败,本地无对应轨迹
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "onAutopilotGuardian() " +
|
||||
"轨迹下载失败,本地无对应轨迹");
|
||||
// ToastUtils.showShort("轨迹下载失败,本地无对应轨迹");
|
||||
} else if ("ISYS_INIT_TRAJECTORY_WARNING".equals(guardianInfo.getCode())) {
|
||||
// 4. 轨迹管理_轨迹下载失败,本地有对应轨迹,认为成功
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "onAutopilotGuardian() " +
|
||||
"轨迹下载失败,本地有对应轨迹,认为成功");
|
||||
// ToastUtils.showShort("轨迹下载失败,本地有对应轨迹,认为成功");
|
||||
} else if ("ISYS_INIT_TRAJECTORY_TIMEOUT".equals(guardianInfo.getCode())) {
|
||||
// 5. 轨迹管理_轨迹下载超时
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "onAutopilotGuardian() 轨迹下载超时");
|
||||
// ToastUtils.showShort("轨迹下载超时");
|
||||
}
|
||||
}
|
||||
|
||||
private void setupAutoPilotLine() {
|
||||
OrderQueryRespBean.Result order = TaxiModel.getInstance().getCurrentOCHOrder();
|
||||
if (order == null) {
|
||||
CallerLogger.INSTANCE.e(M_TAXI + TAG,
|
||||
"setupAutoPilotLine(): orderInfo is null.");
|
||||
return;
|
||||
} else {
|
||||
if (mAutoPilotLine == null) {
|
||||
mAutoPilotLine = new AutopilotControlParameters.AutoPilotLine(order.lineId,
|
||||
order.csvFileUrl, order.csvFileMd5, order.txtFileUrl, order.txtFileMd5,
|
||||
order.contrailSaveTime, order.carModel,
|
||||
order.csvFileUrlDPQP, order.csvFileMd5DPQP, order.txtFileUrlDPQP, order.txtFileMd5DPQP,
|
||||
order.contrailSaveTimeDPQP);
|
||||
} else {
|
||||
mAutoPilotLine.setLineId(order.lineId);
|
||||
mAutoPilotLine.setTrajUrl(order.csvFileUrl);
|
||||
mAutoPilotLine.setTrajMd5(order.csvFileMd5);
|
||||
mAutoPilotLine.setStopUrl(order.txtFileUrl);
|
||||
mAutoPilotLine.setStopMd5(order.txtFileMd5);
|
||||
mAutoPilotLine.setTimestamp(order.contrailSaveTime);
|
||||
mAutoPilotLine.setVehicleModel(order.carModel);
|
||||
mAutoPilotLine.setTrajUrl_dpqp(order.csvFileUrlDPQP);
|
||||
mAutoPilotLine.setTrajMd5_dpqp(order.csvFileMd5DPQP);
|
||||
mAutoPilotLine.setStopUrl_dpqp(order.txtFileUrlDPQP);
|
||||
mAutoPilotLine.setStopMd5_dpqp(order.txtFileMd5DPQP);
|
||||
mAutoPilotLine.setTimestamp_dpqp(order.contrailSaveTimeDPQP);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void clearAutoPilotLine() {
|
||||
if (mAutoPilotLine == null) return;
|
||||
mAutoPilotLine.setLineId(-1);
|
||||
mAutoPilotLine.setTrajUrl("");
|
||||
mAutoPilotLine.setTrajMd5("");
|
||||
mAutoPilotLine.setStopUrl("");
|
||||
mAutoPilotLine.setStopMd5("");
|
||||
mAutoPilotLine.setTimestamp(0);
|
||||
mAutoPilotLine.setVehicleModel("");
|
||||
mAutoPilotLine.setTrajUrl_dpqp("");
|
||||
mAutoPilotLine.setTrajMd5_dpqp("");
|
||||
mAutoPilotLine.setStopUrl_dpqp("");
|
||||
mAutoPilotLine.setStopMd5_dpqp("");
|
||||
mAutoPilotLine.setTimestamp_dpqp(0);
|
||||
}
|
||||
|
||||
private void startTrajReqLoop() {
|
||||
if (mSendReqDisposable != null && !mSendReqDisposable.isDisposed()) {
|
||||
return;
|
||||
}
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "startTrajReqLoop()");
|
||||
setupAutoPilotLine();
|
||||
mSendReqDisposable = Observable.interval(TaxiConst.LOOP_DELAY,
|
||||
TaxiConst.LOOP_PERIOD_10S, TimeUnit.MILLISECONDS)
|
||||
.map((aLong -> aLong + 1))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(aLong -> {
|
||||
if (aLong > TaxiConst.LOOP_SEND_TRAJ_TIMES) {
|
||||
mPrevOrderNo = ""; //重发超时后将mPrevOrderNo置空,这样订单进入下个状态时还可以重发
|
||||
stopTrajReqLoop();
|
||||
return;
|
||||
}
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "loop sendTrajectoryReq: " + aLong);
|
||||
sendTrajectoryReq();
|
||||
});
|
||||
}
|
||||
|
||||
private void stopTrajReqLoop() {
|
||||
if (mSendReqDisposable != null) {
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "stopTrajReqLoop()");
|
||||
mSendReqDisposable.dispose();
|
||||
mSendReqDisposable = null;
|
||||
clearAutoPilotLine();
|
||||
}
|
||||
}
|
||||
|
||||
private void sendTrajectoryReq() {
|
||||
if (mAutoPilotLine == null) {
|
||||
CallerLogger.INSTANCE.e(M_TAXI + TAG, "sendTrajectoryReq(): mAutoPilotLine is null!!!");
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: 2022/6/24
|
||||
// test1
|
||||
// mAutoPilotLine.setLineId(148);
|
||||
// mAutoPilotLine.setTrajUrl("http://file-qa.zhidaozhixing.com/fileServer/upload/downloadFileStream?key=fileServer/online_car_hailing/e27c20c2da32481021d934c3ef084536/traj_148.csv");
|
||||
// mAutoPilotLine.setTrajMd5("e27c20c2da32481021d934c3ef084536");
|
||||
// mAutoPilotLine.setStopUrl("http://file-qa.zhidaozhixing.com/fileServer/upload/downloadFileStream?key=fileServer/online_car_hailing/6224c9dd2c0e2bd990c6482c0464de45/stop_148.txt");
|
||||
// mAutoPilotLine.setStopMd5("6224c9dd2c0e2bd990c6482c0464de45");
|
||||
// mAutoPilotLine.setTimestamp(1654596000000L); //20220607 18:00
|
||||
// mAutoPilotLine.setVehicleModel("红旗H9");
|
||||
|
||||
// test2
|
||||
// mAutoPilotLine.setLineId(148);
|
||||
// mAutoPilotLine.setTrajUrl("http://file-qa.zhidaozhixing.com/fileServer/upload/downloadFileStream?key=fileServer/online_car_hailing/8654497cf918be461a59c7ad8e22920d/traj_148.csv");
|
||||
// mAutoPilotLine.setTrajMd5("8654497cf918be461a59c7ad8e22920d");
|
||||
// mAutoPilotLine.setStopUrl("http://file-qa.zhidaozhixing.com/fileServer/upload/downloadFileStream?key=fileServer/online_car_hailing/1bb098b244922649bf3e7bada0d3950f/stop_148.txt");
|
||||
// mAutoPilotLine.setStopMd5("1bb098b244922649bf3e7bada0d3950f");
|
||||
// mAutoPilotLine.setTimestamp(1654761600000L); //20220609 16:00
|
||||
// mAutoPilotLine.setVehicleModel("红旗H9");
|
||||
|
||||
CallerAutoPilotControlManager.INSTANCE.sendTrajectoryDownloadReq(mAutoPilotLine);
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "sendTrajectoryReq(): "
|
||||
+ GsonUtils.toJson(mAutoPilotLine));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="@color/taxi_autopilot_text_color_normal"/>
|
||||
</selector>
|
||||
BIN
OCH/mogo-och-taxi-unmanned1/src/main/res/drawable-xhdpi/end_maker_icon.png
Executable file
|
After Width: | Height: | Size: 5.0 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 49 KiB |
|
After Width: | Height: | Size: 49 KiB |
|
After Width: | Height: | Size: 49 KiB |
|
After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 52 KiB |