[6.0.0] 部分接口逻辑处理 opt
This commit is contained in:
@@ -1,14 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package com.mogo.och.taxi.bean
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/7/26
|
||||
*/
|
||||
data class OrderDetail(var orderId: Long)
|
||||
@@ -1,16 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
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
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
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:非法,不是选择的自己
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -1,105 +0,0 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
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; //待服务订单
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
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集合
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
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;
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package com.mogo.och.taxi.bean
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/7/26
|
||||
*/
|
||||
data class TaskDetail(var taskId: Int)
|
||||
@@ -1,12 +0,0 @@
|
||||
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;
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package com.mogo.och.taxi.bean;
|
||||
|
||||
/**
|
||||
* Created by pangfan on 2021/8/19
|
||||
* 司机端准备好或者乘客已验证上车请求参数
|
||||
*/
|
||||
public class TaxiOrPassengerReadyReqBean {
|
||||
|
||||
public String orderNo;
|
||||
public String sn;
|
||||
public Result loc;
|
||||
|
||||
public static class Result {
|
||||
public Double lat;
|
||||
public Double lon;
|
||||
}
|
||||
|
||||
public TaxiOrPassengerReadyReqBean(String sn, String orderNo, Result point) {
|
||||
this.sn = sn;
|
||||
this.orderNo = orderNo;
|
||||
this.loc = point;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.mogo.och.taxi.bean
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/8/2
|
||||
*/
|
||||
|
||||
data class GcjLatLon(var gcjLat: Double, var gcjLon: Double)
|
||||
|
||||
data class UnmannedLoginReqBean(
|
||||
var phone: String?,
|
||||
var captcha: String?,
|
||||
var sn: String,
|
||||
var loc: GcjLatLon?
|
||||
)
|
||||
data class UnmannedLogoutReqBean(var sn: String, var loc: GcjLatLon?)
|
||||
|
||||
data class StartServiceReqBean(var sn: String, var gcjLat: Double, var gcjLon: Double)
|
||||
|
||||
data class StartServiceRespBean(var data: Result?): BaseData(){
|
||||
data class Result(var siteId: Int,var siteName: String,var gcjLat: Double, var gcjLon: Double)
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.mogo.och.taxi.bean
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/8/2
|
||||
*/
|
||||
data class UnmannedLoginReqBean(
|
||||
var phone: String?,
|
||||
var captcha: String?,
|
||||
var sn: String,
|
||||
var loc: UnmannedLocation4Login?
|
||||
) {
|
||||
data class UnmannedLocation4Login(var gcjLat: Double, var gcjLon: Double)
|
||||
}
|
||||
data class UnmannedLogoutReqBean(var sn: String, var loc: UnmannedLocation4Login?) {
|
||||
data class UnmannedLocation4Login(var gcjLat: Double, var gcjLon: Double)
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.mogo.och.taxi.bean
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/8/4
|
||||
*/
|
||||
|
||||
data class OrderDetail(var orderNo: String,
|
||||
var orderStatus: Int,
|
||||
var orderStartSite: Site?,
|
||||
var orderEndSite: Site?,
|
||||
var planningLines: Array<Int>) {
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as OrderDetail
|
||||
|
||||
if (orderNo != other.orderNo) return false
|
||||
if (orderStatus != other.orderStatus) return false
|
||||
if (orderStartSite != other.orderStartSite) return false
|
||||
if (orderEndSite != other.orderEndSite) return false
|
||||
if (!planningLines.contentEquals(other.planningLines)) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = orderNo.hashCode()
|
||||
result = 31 * result + orderStatus
|
||||
result = 31 * result + orderStartSite.hashCode()
|
||||
result = 31 * result + orderEndSite.hashCode()
|
||||
result = 31 * result + planningLines.contentHashCode()
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
data class Site(var siteId: Int,var siteName: String,var gcjLat: Double, var gcjLon: Double) {
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as Site
|
||||
|
||||
if (siteId != other.siteId) return false
|
||||
if (siteName != other.siteName) return false
|
||||
if (gcjLat != other.gcjLat) return false
|
||||
if (gcjLon != other.gcjLon) return false
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
data class QueryCurrentTaskRespBean(var data: Result?)
|
||||
:BaseData(){
|
||||
data class Result(var sn: String,var lineId: Int,var serviceStatus: Int,var currentStatus: Int,
|
||||
var taskType: Int,var endSite: Site,var order: OrderDetail){
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as Result
|
||||
|
||||
if (lineId != other.lineId) return false
|
||||
if (serviceStatus != other.serviceStatus) return false
|
||||
if (currentStatus != other.currentStatus) return false
|
||||
if (taskType != other.taskType) return false
|
||||
if (endSite != other.endSite) return false
|
||||
if (order != other.order) return false
|
||||
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data class StartTaskReqBean(var sn: String,var lineId: Int)
|
||||
|
||||
data class ArriveSiteReqBean(var sn: String,var siteId: Int)
|
||||
data class PrepareTaskReqBean(var sn: String,var siteId: Int)
|
||||
data class PrepareTaskRespBean(var lineId: Int,var cityCode: Int,var taskType: Int,
|
||||
var startSite: Site, var endSite: Site) //taskType 1:虚拟任务 2:接驾任务3:送驾任务
|
||||
:BaseData()
|
||||
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,5 @@
|
||||
package com.mogo.och.taxi.callback;
|
||||
|
||||
import com.mogo.och.taxi.bean.OrderQueryRespBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created on 2021/9/8
|
||||
*
|
||||
@@ -12,6 +8,4 @@ import java.util.List;
|
||||
public interface ITaxiCarOperationalCallback {
|
||||
|
||||
void onServiceDataUpdate(long dailyTimeDuration, long dailyOrderNum);
|
||||
|
||||
void onOrdersListPageRefresh(List<OrderQueryRespBean.Result> ordersList);
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager.addListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.e
|
||||
@@ -67,17 +68,26 @@ import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil.coordinateC
|
||||
import com.mogo.och.common.module.utils.PinYinUtil
|
||||
import com.mogo.och.common.module.utils.ToastUtilsOch
|
||||
import com.mogo.och.taxi.R
|
||||
import com.mogo.och.taxi.bean.OrderQueryRespBean
|
||||
import com.mogo.och.taxi.bean.OrderDetail
|
||||
import com.mogo.och.taxi.bean.PrepareTaskRespBean
|
||||
import com.mogo.och.taxi.bean.QueryCurrentTaskRespBean
|
||||
import com.mogo.och.taxi.bean.Site
|
||||
import com.mogo.och.taxi.bean.StartServiceRespBean
|
||||
import com.mogo.och.taxi.callback.IOCHTaxiAutopilotPlanningCallback
|
||||
import com.mogo.och.taxi.callback.ITaxiADASStatusCallback
|
||||
import com.mogo.och.taxi.callback.ITaxiCarOperationalCallback
|
||||
import com.mogo.och.taxi.callback.ITaxiControllerStatusCallback
|
||||
import com.mogo.och.taxi.callback.ITaxiOrderStatusCallback
|
||||
import com.mogo.och.taxi.constant.TaxiUnmannedConst
|
||||
import com.mogo.och.taxi.constant.TaxiOrderStatusEnum
|
||||
import com.mogo.och.taxi.constant.TaxiOrderStatusEnum.Companion.valueOf
|
||||
import com.mogo.och.taxi.constant.TaxiUnmannedConst
|
||||
import com.mogo.och.taxi.constant.TaxtServingStatusManager.isOpeningOrderStatus
|
||||
import com.mogo.och.taxi.network.TaxiServiceManager.changeOrderServing
|
||||
import com.mogo.och.taxi.network.CarServiceManager.arriveSite
|
||||
import com.mogo.och.taxi.network.CarServiceManager.endService
|
||||
import com.mogo.och.taxi.network.CarServiceManager.prepareTask
|
||||
import com.mogo.och.taxi.network.CarServiceManager.queryCurrentTask
|
||||
import com.mogo.och.taxi.network.CarServiceManager.startService
|
||||
import com.mogo.och.taxi.network.CarServiceManager.startTask
|
||||
import com.mogo.och.taxi.utils.TaxiAnalyticsManager
|
||||
import com.mogo.och.taxi.utils.TaxiTrajectoryManager
|
||||
import com.zhjt.service.chain.ChainLog
|
||||
@@ -102,16 +112,9 @@ object TaxiModel {
|
||||
|
||||
private var mContext: Context? = null
|
||||
|
||||
@Volatile
|
||||
private var mCurrentOCHOrder //当前订单
|
||||
: OrderQueryRespBean.Result? = null
|
||||
|
||||
@Volatile
|
||||
private var mInServiceList = mutableListOf<OrderQueryRespBean.Result>() //进行中订单
|
||||
|
||||
@Volatile
|
||||
private var mWaitServiceList = mutableListOf<OrderQueryRespBean.Result>() //待服务订单
|
||||
private var mCurrentTaskAndOrder : QueryCurrentTaskRespBean.Result? = null //当前任务和订单
|
||||
|
||||
private var mVirtualTask : StartServiceRespBean.Result? = null
|
||||
|
||||
private var mADASStatusCallback //Model->Presenter:自动驾驶状态相关
|
||||
: ITaxiADASStatusCallback? = null
|
||||
@@ -127,7 +130,6 @@ object TaxiModel {
|
||||
private var isRestartAutopilot = false
|
||||
|
||||
private val mRoutePoints: MutableList<MogoLocation>? = ArrayList()
|
||||
private val mPreRouteIndex = 0
|
||||
|
||||
private var mLongitude = 0.0
|
||||
private var mLatitude = 0.0
|
||||
@@ -161,12 +163,6 @@ object TaxiModel {
|
||||
loginService =
|
||||
ARouter.getInstance().build(OchCommonConst.LOGINSERVICE).navigation() as LoginService
|
||||
|
||||
// TODO: 2021/8/27 因需要通过此回调的location进行坐标上传,暂改为全程监听,退出后再反注册,
|
||||
// 待后续整体调整location获取来源
|
||||
// if (DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_SELF_INNOVATE) {
|
||||
// apis.getLocationInfoApi().start();
|
||||
// }
|
||||
|
||||
//2022.1.28
|
||||
// 调用Disposable.dispose() 时候会出现InterruptedException 导致出现崩溃
|
||||
// The exception could not be delivered to the consumer because it has already canceled/disposed the flow or the excTeption has nowhere to go to begin with
|
||||
@@ -281,25 +277,53 @@ object TaxiModel {
|
||||
fun startOrStopOrderLoop(start: Boolean) {
|
||||
d(SceneConstant.M_TAXI + TAG, "startOrStopOrderLoop() $start")
|
||||
if (start) {
|
||||
TaxiModelLoopManager.getInstance().startInAndWaitOrdersLoop()
|
||||
TaxiModelLoopManager.getInstance().startInAndWaitCurrentTaskLoop()
|
||||
} else {
|
||||
TaxiModelLoopManager.getInstance().stopInAndWaitOrdersLoop()
|
||||
TaxiModelLoopManager.getInstance().stopInAndWaitCurrentTaskLoop()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询当前任务订单
|
||||
*/
|
||||
fun queryCurrentTaskOnce(){
|
||||
queryCurrentTask(mContext!!, object : OchCommonServiceCallback<QueryCurrentTaskRespBean>{
|
||||
override fun onSuccess(data: QueryCurrentTaskRespBean?) {
|
||||
if (data === null) return
|
||||
if (data.data === null) return
|
||||
if (data.code != 0) return
|
||||
|
||||
val result = data.data
|
||||
|
||||
if (mCurrentTaskAndOrder != null && mCurrentTaskAndOrder!! === result) return
|
||||
|
||||
mCurrentTaskAndOrder = result
|
||||
|
||||
// TODO: 去更新当前任务和订单
|
||||
TaxiUnmannedViewModel.updateCurrentTaskAndOrder(mCurrentTaskAndOrder)
|
||||
|
||||
updateNativeCurrentOrder(result)
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String?) {
|
||||
d(TAG,"queryCurrentTaskOnce = $code, $msg")
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
//更新接单状态
|
||||
fun updateCarStatus() {
|
||||
if (!isLogin()) {
|
||||
loginService!!.queryLoginStatusByNet()
|
||||
return
|
||||
}
|
||||
changeOrderServing(
|
||||
mContext!!, isOpeningOrderStatus(),
|
||||
object : OchCommonServiceCallback<BaseData> {
|
||||
override fun onSuccess(data: BaseData) {
|
||||
if (null != data && 0 == data.code) {
|
||||
loginService!!.queryLoginStatusByNet()
|
||||
}
|
||||
if (isOpeningOrderStatus()){//接单状态下,去结束
|
||||
endService(mContext!!,object : OchCommonServiceCallback<BaseData>{
|
||||
override fun onSuccess(data: BaseData?) {
|
||||
loginService!!.queryLoginStatusByNet()
|
||||
//需要将虚拟任务停掉, 虚拟任务会再开始接单后获取新的
|
||||
updateVirtualTask(null)
|
||||
}
|
||||
|
||||
override fun onError() {
|
||||
@@ -313,34 +337,68 @@ object TaxiModel {
|
||||
override fun onFail(code: Int, msg: String) {
|
||||
ToastUtilsOch.showWithCodeMessage(code, msg)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
}else{//暂停接单状态下,去接单
|
||||
startService(mContext!!,
|
||||
getChassisLocationGCJ02().latitude,
|
||||
getChassisLocationGCJ02().longitude,
|
||||
object: OchCommonServiceCallback<StartServiceRespBean>{
|
||||
override fun onSuccess(data: StartServiceRespBean?) {
|
||||
if (data == null || data.code != 0) return
|
||||
loginService!!.queryLoginStatusByNet()
|
||||
//虚拟任务要开启到站围栏
|
||||
updateVirtualTask(data.data)
|
||||
// TODO: 可以轮询当前任务去获取到这个任务站点, 显示界面
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String?) {
|
||||
ToastUtilsOch.showWithCodeMessage(code, msg)
|
||||
}
|
||||
|
||||
override fun onError() {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
ToastUtils.showShort(mContext!!.getString(R.string.network_error_tip))
|
||||
} else {
|
||||
ToastUtils.showShort(mContext!!.getString(R.string.request_error_tip))
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 获取当前订单
|
||||
fun getCurrentOCHOrder(): OrderQueryRespBean.Result? {
|
||||
return TaxiUnmannedViewModel.getCurrentOCHOrder()
|
||||
private fun updateVirtualTask(result: StartServiceRespBean.Result?) {
|
||||
mVirtualTask = result
|
||||
}
|
||||
|
||||
private fun startVirtualTask() {
|
||||
|
||||
}
|
||||
|
||||
// 获取当前订单状态
|
||||
fun getCurOrderStatus(): TaxiOrderStatusEnum? {
|
||||
val order: OrderQueryRespBean.Result =
|
||||
getCurrentOCHOrder()
|
||||
?: return TaxiOrderStatusEnum.None
|
||||
if (mCurrentTaskAndOrder == null) TaxiOrderStatusEnum.None
|
||||
val order: OrderDetail = mCurrentTaskAndOrder!!.order
|
||||
return valueOf(order.orderStatus)
|
||||
}
|
||||
|
||||
//更新本地currentOrder信息,并保存订单到本地避免车机重启丢失数据
|
||||
private fun updateNativeCurrentOrder(data: OrderQueryRespBean.Result?) {
|
||||
private fun updateNativeCurrentOrder(data: QueryCurrentTaskRespBean.Result?) {
|
||||
if (data == null) {
|
||||
return
|
||||
}
|
||||
mCurrentOCHOrder = data
|
||||
mCurrentTaskAndOrder = data
|
||||
TaxiTrajectoryManager.getInstance().syncTrajectoryInfo()
|
||||
SharedPrefsMgr.getInstance(mContext!!).putString(
|
||||
TaxiUnmannedConst.SP_KEY_OCH_TAXI_ORDER,
|
||||
GsonUtil.jsonFromObject(data)
|
||||
)
|
||||
if (mCurrentOCHOrder!!.orderStatus == TaxiOrderStatusEnum.OnTheWayToEnd.code) {
|
||||
|
||||
val currentOrder = mCurrentTaskAndOrder!!.order
|
||||
|
||||
if (currentOrder.orderStatus == TaxiOrderStatusEnum.OnTheWayToEnd.code) {
|
||||
if (FunctionBuildConfig.isDemoMode) {
|
||||
// 当美化模式(演示模式)开启时: 订单对应自动驾驶开启后,置true
|
||||
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = true
|
||||
@@ -350,7 +408,7 @@ object TaxiModel {
|
||||
}
|
||||
updateAutopilotControlParameters()
|
||||
}
|
||||
if (mCurrentOCHOrder!!.orderStatus == TaxiOrderStatusEnum.ArriveAtEnd.code) {
|
||||
if (currentOrder.orderStatus == TaxiOrderStatusEnum.ArriveAtEnd.code) {
|
||||
if (FunctionBuildConfig.isDemoMode) {
|
||||
d(SceneConstant.M_TAXI + TAG, "setIPCDemoMode:false")
|
||||
setIPCDemoMode(false)
|
||||
@@ -377,10 +435,10 @@ object TaxiModel {
|
||||
updateAutopilotControlParameters(null)
|
||||
}
|
||||
|
||||
//清除订单信息
|
||||
//清除任务订单信息
|
||||
fun clearCurrentOCHOrder() {
|
||||
startOrStopCalculateRouteInfo(false)
|
||||
mCurrentOCHOrder = null
|
||||
mCurrentTaskAndOrder = null
|
||||
clearAutopilotControlParameters()
|
||||
TaxiTrajectoryManager.getInstance().syncTrajectoryInfo()
|
||||
SharedPrefsMgr.getInstance(mContext!!).remove(TaxiUnmannedConst.SP_KEY_OCH_TAXI_ORDER)
|
||||
@@ -395,10 +453,10 @@ object TaxiModel {
|
||||
}
|
||||
|
||||
//检测当前订单
|
||||
fun checkCurrentOCHOrder(): Boolean {
|
||||
return (mCurrentOCHOrder != null
|
||||
) && (mCurrentOCHOrder!!.startSiteGcjPoint != null
|
||||
) && (mCurrentOCHOrder!!.endSiteGcjPoint != null)
|
||||
fun checkCurrentOrder(): Boolean {
|
||||
// return mCurrentOrder != null && mCurrentOrder!!.orderStartSite != null
|
||||
// && mCurrentOrder!!.orderStartSite != null
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -411,105 +469,107 @@ object TaxiModel {
|
||||
paramIndexes = [-1]
|
||||
)
|
||||
fun startAutoPilot() {
|
||||
if (!checkCurrentOCHOrder()) {
|
||||
if (!checkCurrentOrder()) {
|
||||
e(SceneConstant.M_TAXI + TAG, "no order or order is empty.")
|
||||
ToastUtils.showShort("当前订单不存在或异常!")
|
||||
return
|
||||
}
|
||||
|
||||
//根据开关和后台是否发布轨迹启动自驾
|
||||
if (FunctionBuildConfig.isPassStartAutopilotCommand && TextUtils.isEmpty(
|
||||
mCurrentOCHOrder!!.csvFileUrl
|
||||
)
|
||||
&& TextUtils.isEmpty(mCurrentOCHOrder!!.csvFileUrlDPQP)
|
||||
) {
|
||||
ToastUtils.showLong("无发布轨迹, 请发布后重试")
|
||||
e(
|
||||
SceneConstant.M_TAXI + TAG, "isPassStartAutopilotCommand = " +
|
||||
FunctionBuildConfig.isPassStartAutopilotCommand
|
||||
+ "busRoutesResult.csvFileUrl = " + mCurrentOCHOrder!!.csvFileUrl
|
||||
+ "busRoutesResult.csvFileUrlDPQP = " + mCurrentOCHOrder!!.csvFileUrlDPQP
|
||||
)
|
||||
return
|
||||
}
|
||||
e(
|
||||
SceneConstant.M_TAXI + TAG, "isPassStartAutopilotCommand = " +
|
||||
FunctionBuildConfig.isPassStartAutopilotCommand
|
||||
)
|
||||
if (!FunctionBuildConfig.isDemoMode && !OCHAdasAbilityManager.getInstance().autopilotAbilityStatus) {
|
||||
ToastUtils.showLong(
|
||||
OCHAdasAbilityManager.getInstance().autopilotUnAbilityReason +
|
||||
", 请稍候重试"
|
||||
)
|
||||
TaxiAnalyticsManager.getInstance().triggerUnableStartAPReasonEvent(
|
||||
mCurrentOCHOrder!!.startSiteAddr,
|
||||
mCurrentOCHOrder!!.endSiteAddr,
|
||||
mCurrentOCHOrder!!.orderNo,
|
||||
OCHAdasAbilityManager.getInstance().autopilotUnAbilityReason
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
//点击开始自动驾驶按钮订单状态去流转, 不再与自动驾驶是否启动成功挂钩
|
||||
isRestartAutopilot = mCurrentOCHOrder!!.orderStatus != TaxiOrderStatusEnum.UserArriveAtStart.code
|
||||
|
||||
val parameters = initAutopilotControlParameters()
|
||||
if (null == parameters) {
|
||||
e(SceneConstant.M_TAXI + TAG, "AutopilotControlParameters is empty.")
|
||||
return
|
||||
}
|
||||
startAutoPilot(parameters)
|
||||
d(
|
||||
SceneConstant.M_TAXI + TAG, "start autopilot with parameter: %s",
|
||||
GsonUtil.jsonFromObject(parameters)
|
||||
+ " ,startSiteName=" + mCurrentOCHOrder!!.startSiteAddr
|
||||
+ " ,endSiteName=" + mCurrentOCHOrder!!.endSiteAddr
|
||||
+ "isRestartAutopilot = " + isRestartAutopilot
|
||||
)
|
||||
TaxiAnalyticsManager.getInstance().triggerStartAutopilotEvent(
|
||||
isRestartAutopilot,
|
||||
false,
|
||||
mCurrentOCHOrder!!.startSiteAddr,
|
||||
mCurrentOCHOrder!!.endSiteAddr,
|
||||
mCurrentOCHOrder!!.lineId,
|
||||
mCurrentOCHOrder!!.orderNo
|
||||
)
|
||||
if (mControllerStatusCallback != null) {
|
||||
mControllerStatusCallback!!.startOpenAutopilot()
|
||||
}
|
||||
|
||||
// TODO: 2021/8/20 无工控机环境, 手动调起自动驾驶开启返回结果,有工控机环境要删除
|
||||
// OCHTaxiUiController.getInstance().onAutoPilotStatusChanged( IMogoAdasOCHCallback.STATUS_AUTOPILOT_RUNNING, "开启自动驾驶" );
|
||||
// // TODO: 轨迹信息需要另一个接口去查一下
|
||||
// //根据开关和后台是否发布轨迹启动自驾
|
||||
// if (FunctionBuildConfig.isPassStartAutopilotCommand && TextUtils.isEmpty(
|
||||
// mCurrentTaskAndOrder!!.csvFileUrl
|
||||
// )
|
||||
// && TextUtils.isEmpty(mCurrentTaskAndOrder!!.csvFileUrlDPQP)
|
||||
// ) {
|
||||
// ToastUtils.showLong("无发布轨迹, 请发布后重试")
|
||||
// e(
|
||||
// SceneConstant.M_TAXI + TAG, "isPassStartAutopilotCommand = " +
|
||||
// FunctionBuildConfig.isPassStartAutopilotCommand
|
||||
// + "busRoutesResult.csvFileUrl = " + mCurrentTaskAndOrder!!.csvFileUrl
|
||||
// + "busRoutesResult.csvFileUrlDPQP = " + mCurrentTaskAndOrder!!.csvFileUrlDPQP
|
||||
// )
|
||||
// return
|
||||
// }
|
||||
// e(
|
||||
// SceneConstant.M_TAXI + TAG, "isPassStartAutopilotCommand = " +
|
||||
// FunctionBuildConfig.isPassStartAutopilotCommand
|
||||
// )
|
||||
// if (!FunctionBuildConfig.isDemoMode && !OCHAdasAbilityManager.getInstance().autopilotAbilityStatus) {
|
||||
// ToastUtils.showLong(
|
||||
// OCHAdasAbilityManager.getInstance().autopilotUnAbilityReason +
|
||||
// ", 请稍候重试"
|
||||
// )
|
||||
// TaxiAnalyticsManager.getInstance().triggerUnableStartAPReasonEvent(
|
||||
// mCurrentOrder!!.orderStartSite!!.siteName,
|
||||
// mCurrentOrder!!.orderEndSite!!.siteName,
|
||||
// mCurrentOrder!!.orderNo,
|
||||
// OCHAdasAbilityManager.getInstance().autopilotUnAbilityReason
|
||||
// )
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// //点击开始自动驾驶按钮订单状态去流转, 不再与自动驾驶是否启动成功挂钩
|
||||
// isRestartAutopilot = mCurrentOrder!!.orderStatus != TaxiOrderStatusEnum.UserArriveAtStart.code
|
||||
//
|
||||
// val parameters = initAutopilotControlParameters()
|
||||
// if (null == parameters) {
|
||||
// e(SceneConstant.M_TAXI + TAG, "AutopilotControlParameters is empty.")
|
||||
// return
|
||||
// }
|
||||
// startAutoPilot(parameters)
|
||||
// d(
|
||||
// SceneConstant.M_TAXI + TAG, "start autopilot with parameter: %s",
|
||||
// GsonUtil.jsonFromObject(parameters)
|
||||
// + " ,startSiteName=" + mCurrentOrder!!.orderStartSite!!.siteName
|
||||
// + " ,endSiteName=" + mCurrentOrder!!.orderEndSite!!.siteName
|
||||
// + "isRestartAutopilot = " + isRestartAutopilot
|
||||
// )
|
||||
// TaxiAnalyticsManager.getInstance().triggerStartAutopilotEvent(
|
||||
// isRestartAutopilot,
|
||||
// false,
|
||||
// mCurrentOrder!!.orderStartSite!!.siteName,
|
||||
// mCurrentOrder!!.orderEndSite!!.siteName,
|
||||
// mCurrentOrder!!.lineId,
|
||||
// mCurrentOrder!!.orderNo
|
||||
// )
|
||||
// if (mControllerStatusCallback != null) {
|
||||
// mControllerStatusCallback!!.startOpenAutopilot()
|
||||
// }
|
||||
//
|
||||
}
|
||||
|
||||
private fun initAutopilotControlParameters(): AutopilotControlParameters? {
|
||||
if (!checkCurrentOCHOrder()) {
|
||||
if (!checkCurrentOrder()) {
|
||||
e(SceneConstant.M_TAXI + TAG, "no order or order is empty.")
|
||||
return null
|
||||
}
|
||||
val parameters = AutopilotControlParameters()
|
||||
val startWgsLon = mCurrentOCHOrder!!.startSitePoint[0]
|
||||
val startWgsLat = mCurrentOCHOrder!!.startSitePoint[1]
|
||||
val endWgsLon = mCurrentOCHOrder!!.endSitePoint[0]
|
||||
val endWgsLat = mCurrentOCHOrder!!.endSitePoint[1]
|
||||
parameters.vehicleType = mCurrentOCHOrder!!.businessType
|
||||
parameters.startName =
|
||||
PinYinUtil.getPinYinHeadChar(mCurrentOCHOrder!!.startSiteAddr) // 起点名称拼音首字母大写:科学城B区2号门(KXCBQ2HM)
|
||||
parameters.endName =
|
||||
PinYinUtil.getPinYinHeadChar(mCurrentOCHOrder!!.endSiteAddr) // 终点名称拼音首字母大写:科学城C区三号门(KXCCQSHM)
|
||||
parameters.startLatLon = AutoPilotLonLat(startWgsLat, startWgsLon)
|
||||
parameters.endLatLon = AutoPilotLonLat(endWgsLat, endWgsLon)
|
||||
if (parameters.autoPilotLine == null) {
|
||||
parameters.autoPilotLine = AutoPilotLine(
|
||||
mCurrentOCHOrder!!.lineId,
|
||||
mCurrentOCHOrder!!.csvFileUrl, mCurrentOCHOrder!!.csvFileMd5,
|
||||
mCurrentOCHOrder!!.txtFileUrl, mCurrentOCHOrder!!.txtFileMd5,
|
||||
mCurrentOCHOrder!!.contrailSaveTime, mCurrentOCHOrder!!.carModel,
|
||||
mCurrentOCHOrder!!.csvFileUrlDPQP, mCurrentOCHOrder!!.csvFileMd5DPQP,
|
||||
mCurrentOCHOrder!!.txtFileUrlDPQP, mCurrentOCHOrder!!.txtFileMd5DPQP,
|
||||
mCurrentOCHOrder!!.contrailSaveTimeDPQP
|
||||
)
|
||||
}
|
||||
|
||||
// TODO: 重新去构造参数
|
||||
|
||||
// val startWgsLon = mCurrentTaskAndOrder!!.startSitePoint[0]
|
||||
// val startWgsLat = mCurrentTaskAndOrder!!.startSitePoint[1]
|
||||
// val endWgsLon = mCurrentTaskAndOrder!!.endSitePoint[0]
|
||||
// val endWgsLat = mCurrentTaskAndOrder!!.endSitePoint[1]
|
||||
// parameters.vehicleType = mCurrentTaskAndOrder!!.businessType
|
||||
// parameters.startName =
|
||||
// PinYinUtil.getPinYinHeadChar(mCurrentTaskAndOrder!!.startSiteAddr) // 起点名称拼音首字母大写:科学城B区2号门(KXCBQ2HM)
|
||||
// parameters.endName =
|
||||
// PinYinUtil.getPinYinHeadChar(mCurrentTaskAndOrder!!.endSiteAddr) // 终点名称拼音首字母大写:科学城C区三号门(KXCCQSHM)
|
||||
// parameters.startLatLon = AutoPilotLonLat(startWgsLat, startWgsLon)
|
||||
// parameters.endLatLon = AutoPilotLonLat(endWgsLat, endWgsLon)
|
||||
// if (parameters.autoPilotLine == null) {
|
||||
// parameters.autoPilotLine = AutoPilotLine(
|
||||
// mCurrentTaskAndOrder!!.lineId,
|
||||
// mCurrentTaskAndOrder!!.csvFileUrl, mCurrentTaskAndOrder!!.csvFileMd5,
|
||||
// mCurrentTaskAndOrder!!.txtFileUrl, mCurrentTaskAndOrder!!.txtFileMd5,
|
||||
// mCurrentTaskAndOrder!!.contrailSaveTime, mCurrentTaskAndOrder!!.carModel,
|
||||
// mCurrentTaskAndOrder!!.csvFileUrlDPQP, mCurrentTaskAndOrder!!.csvFileMd5DPQP,
|
||||
// mCurrentTaskAndOrder!!.txtFileUrlDPQP, mCurrentTaskAndOrder!!.txtFileMd5DPQP,
|
||||
// mCurrentTaskAndOrder!!.contrailSaveTimeDPQP
|
||||
// )
|
||||
// }
|
||||
return parameters
|
||||
}
|
||||
|
||||
@@ -525,21 +585,22 @@ object TaxiModel {
|
||||
|
||||
//根据围栏判断,是否到达起点
|
||||
private fun judgeStartStation(location: MogoLocation) {
|
||||
if ((mCurrentOCHOrder == null) || (mCurrentOCHOrder!!.startSiteGcjPoint == null
|
||||
) || (mCurrentOCHOrder!!.startSiteGcjPoint.size < 2)
|
||||
) {
|
||||
return
|
||||
}
|
||||
val startLon = mCurrentOCHOrder!!.startSiteGcjPoint[0]
|
||||
val startLat = mCurrentOCHOrder!!.startSiteGcjPoint[1]
|
||||
val distance = CoordinateUtils.calculateLineDistance(
|
||||
startLon, startLat,
|
||||
location.longitude, location.latitude
|
||||
).toDouble()
|
||||
i(SceneConstant.M_TAXI + TAG, "judgeStartStation() distance = $distance")
|
||||
if (distance <= TaxiUnmannedConst.ARRIVE_AT_START_STATION_DISTANCE) {
|
||||
// TODO: 调用到达上车点 arrivedStartPoint()
|
||||
}
|
||||
// TODO: 重新去构造
|
||||
// if ((mCurrentTaskAndOrder == null) || (mCurrentTaskAndOrder!!.startSiteGcjPoint == null
|
||||
// ) || (mCurrentTaskAndOrder!!.startSiteGcjPoint.size < 2)
|
||||
// ) {
|
||||
// return
|
||||
// }
|
||||
// val startLon = mCurrentTaskAndOrder!!.startSiteGcjPoint[0]
|
||||
// val startLat = mCurrentTaskAndOrder!!.startSiteGcjPoint[1]
|
||||
// val distance = CoordinateUtils.calculateLineDistance(
|
||||
// startLon, startLat,
|
||||
// location.longitude, location.latitude
|
||||
// ).toDouble()
|
||||
// i(SceneConstant.M_TAXI + TAG, "judgeStartStation() distance = $distance")
|
||||
// if (distance <= TaxiUnmannedConst.ARRIVE_AT_START_STATION_DISTANCE) {
|
||||
// // TODO: 调用到达上车点 arrivedStartPoint()
|
||||
// }
|
||||
}
|
||||
|
||||
//监听网络变化,避免启动机器时无网导致无法更新订单信息
|
||||
@@ -589,7 +650,12 @@ object TaxiModel {
|
||||
override fun onChassisLocationGCJ02(mogoLocation: MogoLocation?) {
|
||||
//位置变化时,通过围栏判断是否到达x点
|
||||
if (null == mogoLocation) return
|
||||
if (checkCurrentOCHOrder()) {
|
||||
|
||||
if (mVirtualTask != null){
|
||||
judgeVirtualStation(mVirtualTask,mogoLocation)
|
||||
}
|
||||
|
||||
if (checkCurrentOrder()) {
|
||||
if (getCurOrderStatus() === TaxiOrderStatusEnum.OnTheWayToStart) {
|
||||
judgeStartStation(mogoLocation)
|
||||
}
|
||||
@@ -608,73 +674,114 @@ object TaxiModel {
|
||||
}
|
||||
}
|
||||
|
||||
private fun judgeEndStation(currentLocation: MogoLocation) {
|
||||
if ((mCurrentOCHOrder == null) || (mCurrentOCHOrder!!.endSiteGcjPoint == null
|
||||
) || (mCurrentOCHOrder!!.endSiteGcjPoint.size < 2)
|
||||
) {
|
||||
return
|
||||
}
|
||||
val endLon = mCurrentOCHOrder!!.endSiteGcjPoint[0]
|
||||
val endLat = mCurrentOCHOrder!!.endSiteGcjPoint[1]
|
||||
private fun judgeVirtualStation(virtualTask: StartServiceRespBean.Result?,currentLocation: MogoLocation) {
|
||||
if (mVirtualTask == null || virtualTask == null) return
|
||||
val distance = CoordinateUtils.calculateLineDistance(
|
||||
endLon, endLat,
|
||||
virtualTask.gcjLon, virtualTask.gcjLat,
|
||||
currentLocation.longitude, currentLocation.latitude
|
||||
).toDouble()
|
||||
i(SceneConstant.M_TAXI + TAG, "judgeEndStation() distance = $distance")
|
||||
if (distance <= TaxiUnmannedConst.ARRIVE_AT_START_STATION_DISTANCE) { //1、当前位置和站点围栏15m内
|
||||
if ((!checkCurrentOCHOrder()
|
||||
|| (getCurOrderStatus() === TaxiOrderStatusEnum.ArriveAtEnd))
|
||||
) {
|
||||
i(SceneConstant.M_TAXI + TAG, "order exception or order ArriveAtEnd")
|
||||
return
|
||||
}
|
||||
|
||||
//2、开始计算当前位置和站点的向量角度 < 90度 未经过 >90度 经过
|
||||
val stationAngle = DrivingDirectionUtils.getDegreeOfCar2Poi(
|
||||
currentLocation.longitude,
|
||||
currentLocation.latitude,
|
||||
endLon,
|
||||
endLat, currentLocation.heading.toInt()
|
||||
).toDouble()
|
||||
i(
|
||||
SceneConstant.M_TAXI + TAG,
|
||||
"judgeEndStation() stationAngle = $stationAngle"
|
||||
)
|
||||
|
||||
//3、刚过站且过站距离在15m内, 提交到站
|
||||
if (stationAngle > 90 && distance <= TaxiUnmannedConst.ARRIVE_AT_START_STATION_DISTANCE) {
|
||||
if ((!checkCurrentOCHOrder()
|
||||
|| (getCurOrderStatus() === TaxiOrderStatusEnum.ArriveAtEnd))
|
||||
) {
|
||||
i(SceneConstant.M_TAXI + TAG, "order exception or order ArriveAtEnd")
|
||||
return
|
||||
}
|
||||
i(SceneConstant.M_TAXI + TAG, "judgeEndStation() = 刚过站且在15m内")
|
||||
// TODO: 调用到达目的地 arriveTerminal()
|
||||
}
|
||||
i(SceneConstant.M_TAXI + TAG, "judgeEndStation() ${virtualTask.siteName} distance = $distance")
|
||||
if (distance <= TaxiUnmannedConst.ARRIVE_AT_START_STATION_DISTANCE) { // 15米内到站
|
||||
arriveVirtualSite(virtualTask.siteId)
|
||||
}
|
||||
}
|
||||
|
||||
private fun arriveVirtualSite(siteId: Int) {
|
||||
arriveSite(mContext!!,siteId,object : OchCommonServiceCallback<BaseData>{
|
||||
override fun onSuccess(data: BaseData?) {
|
||||
if (data == null || data.code != 0) return
|
||||
//到站后去查询下一个任务
|
||||
startPrepareTask(siteId)
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String?) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
private fun startPrepareTask(siteId: Int) {
|
||||
prepareTask(mContext!!,siteId,object : OchCommonServiceCallback<PrepareTaskRespBean>{
|
||||
override fun onSuccess(data: PrepareTaskRespBean?) {
|
||||
TODO("送驾任务不显示,普通演练任务要显示")
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String?) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
private fun judgeEndStation(currentLocation: MogoLocation) {
|
||||
// TODO: 重新去构造
|
||||
// if ((mCurrentTaskAndOrder == null) || (mCurrentTaskAndOrder!!.endSiteGcjPoint == null
|
||||
// ) || (mCurrentTaskAndOrder!!.endSiteGcjPoint.size < 2)
|
||||
// ) {
|
||||
// return
|
||||
// }
|
||||
// val endLon = mCurrentTaskAndOrder!!.endSiteGcjPoint[0]
|
||||
// val endLat = mCurrentTaskAndOrder!!.endSiteGcjPoint[1]
|
||||
// val distance = CoordinateUtils.calculateLineDistance(
|
||||
// endLon, endLat,
|
||||
// currentLocation.longitude, currentLocation.latitude
|
||||
// ).toDouble()
|
||||
// i(SceneConstant.M_TAXI + TAG, "judgeEndStation() distance = $distance")
|
||||
// if (distance <= TaxiUnmannedConst.ARRIVE_AT_START_STATION_DISTANCE) { //1、当前位置和站点围栏15m内
|
||||
// if ((!checkCurrentOrder()
|
||||
// || (getCurOrderStatus() === TaxiOrderStatusEnum.ArriveAtEnd))
|
||||
// ) {
|
||||
// i(SceneConstant.M_TAXI + TAG, "order exception or order ArriveAtEnd")
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// //2、开始计算当前位置和站点的向量角度 < 90度 未经过 >90度 经过
|
||||
// val stationAngle = DrivingDirectionUtils.getDegreeOfCar2Poi(
|
||||
// currentLocation.longitude,
|
||||
// currentLocation.latitude,
|
||||
// endLon,
|
||||
// endLat, currentLocation.heading.toInt()
|
||||
// ).toDouble()
|
||||
// i(
|
||||
// SceneConstant.M_TAXI + TAG,
|
||||
// "judgeEndStation() stationAngle = $stationAngle"
|
||||
// )
|
||||
//
|
||||
// //3、刚过站且过站距离在15m内, 提交到站
|
||||
// if (stationAngle > 90 && distance <= TaxiUnmannedConst.ARRIVE_AT_START_STATION_DISTANCE) {
|
||||
// if ((!checkCurrentOrder()
|
||||
// || (getCurOrderStatus() === TaxiOrderStatusEnum.ArriveAtEnd))
|
||||
// ) {
|
||||
// i(SceneConstant.M_TAXI + TAG, "order exception or order ArriveAtEnd")
|
||||
// return
|
||||
// }
|
||||
// i(SceneConstant.M_TAXI + TAG, "judgeEndStation() = 刚过站且在15m内")
|
||||
// // TODO: 调用到达目的地 arriveTerminal()
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单流转debug START
|
||||
*/
|
||||
fun setArriveAtStartStation() {
|
||||
if ((mCurrentOCHOrder == null
|
||||
|| mCurrentOCHOrder!!.orderStatus != TaxiOrderStatusEnum.OnTheWayToStart.code)
|
||||
) {
|
||||
ToastUtils.showShort("订单状态不匹配该操作!")
|
||||
return
|
||||
}
|
||||
// if ((mCurrentOrder == null
|
||||
// || mCurrentOrder!!.orderStatus != TaxiOrderStatusEnum.OnTheWayToStart.code)
|
||||
// ) {
|
||||
// ToastUtils.showShort("订单状态不匹配该操作!")
|
||||
// return
|
||||
// }
|
||||
// TODO: 调用到达起点 arrivedStartPoint()
|
||||
}
|
||||
|
||||
fun setArriveAtEndStation() {
|
||||
if ((mCurrentOCHOrder == null
|
||||
|| mCurrentOCHOrder!!.orderStatus != TaxiOrderStatusEnum.OnTheWayToEnd.code)
|
||||
) {
|
||||
ToastUtils.showShort("订单状态不匹配该操作!")
|
||||
return
|
||||
}
|
||||
// if ((mCurrentOrder == null
|
||||
// || mCurrentOrder!!.orderStatus != TaxiOrderStatusEnum.OnTheWayToEnd.code)
|
||||
// ) {
|
||||
// ToastUtils.showShort("订单状态不匹配该操作!")
|
||||
// return
|
||||
// }
|
||||
// TODO: 调用到达目的地 arriveTerminal()
|
||||
}
|
||||
|
||||
@@ -682,11 +789,11 @@ object TaxiModel {
|
||||
* 测试开启自动驾驶
|
||||
*/
|
||||
fun setOnTheWayToEndStation() {
|
||||
if ((mCurrentOCHOrder == null
|
||||
|| mCurrentOCHOrder!!.orderStatus != TaxiOrderStatusEnum.UserArriveAtStart.code)
|
||||
) {
|
||||
ToastUtils.showShort("订单状态不匹配该操作!")
|
||||
}
|
||||
// if ((mCurrentOrder == null
|
||||
// || mCurrentOrder!!.orderStatus != TaxiOrderStatusEnum.UserArriveAtStart.code)
|
||||
// ) {
|
||||
// ToastUtils.showShort("订单状态不匹配该操作!")
|
||||
// }
|
||||
// TODO: 调用开始任务 startServicePilotDone()
|
||||
}
|
||||
|
||||
@@ -705,31 +812,31 @@ object TaxiModel {
|
||||
if (mADASStatusCallback != null) {
|
||||
mADASStatusCallback!!.onAutopilotRunning()
|
||||
}
|
||||
if ((mCurrentOCHOrder != null
|
||||
&& TaxiOrderStatusEnum.OnTheWayToEnd.code == mCurrentOCHOrder!!.orderStatus)
|
||||
) {
|
||||
TaxiAnalyticsManager.getInstance().triggerStartAutopilotEvent(
|
||||
isRestartAutopilot,
|
||||
true,
|
||||
mCurrentOCHOrder!!.startSiteAddr,
|
||||
mCurrentOCHOrder!!.endSiteAddr,
|
||||
mCurrentOCHOrder!!.lineId,
|
||||
mCurrentOCHOrder!!.orderNo
|
||||
)
|
||||
if (FunctionBuildConfig.isDemoMode) {
|
||||
// 当美化模式(演示模式)开启时: 订单对应自动驾驶开启后,置true
|
||||
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = true
|
||||
setIgnoreConditionDraw(true)
|
||||
setIPCDemoMode(true)
|
||||
d(
|
||||
SceneConstant.M_TAXI + TAG,
|
||||
"美化模式-ignore:置为true(到达出发点且已开启自动驾驶)"
|
||||
)
|
||||
}
|
||||
}
|
||||
// if ((mCurrentOrder != null
|
||||
// && TaxiOrderStatusEnum.OnTheWayToEnd.code == mCurrentOrder!!.orderStatus)
|
||||
// ) {
|
||||
// TaxiAnalyticsManager.getInstance().triggerStartAutopilotEvent(
|
||||
// isRestartAutopilot,
|
||||
// true,
|
||||
// mCurrentOrder!!.orderStartSite!!.siteName,
|
||||
// mCurrentOrder!!.orderEndSite!!.siteName,
|
||||
// mCurrentOrder!!.lineId,
|
||||
// mCurrentOrder!!.orderNo
|
||||
// )
|
||||
// if (FunctionBuildConfig.isDemoMode) {
|
||||
// // 当美化模式(演示模式)开启时: 订单对应自动驾驶开启后,置true
|
||||
// FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = true
|
||||
// setIgnoreConditionDraw(true)
|
||||
// setIPCDemoMode(true)
|
||||
// d(
|
||||
// SceneConstant.M_TAXI + TAG,
|
||||
// "美化模式-ignore:置为true(到达出发点且已开启自动驾驶)"
|
||||
// )
|
||||
// }
|
||||
// }
|
||||
} else if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE) {
|
||||
if ((FunctionBuildConfig.isDemoMode
|
||||
&& checkCurrentOCHOrder()
|
||||
&& checkCurrentOrder()
|
||||
&& ((getCurOrderStatus() === TaxiOrderStatusEnum.OnTheWayToEnd
|
||||
|| getCurOrderStatus() === TaxiOrderStatusEnum.ArriveAtEnd)))
|
||||
) {
|
||||
@@ -741,7 +848,7 @@ object TaxiModel {
|
||||
}
|
||||
} else if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE) {
|
||||
if ((FunctionBuildConfig.isDemoMode
|
||||
&& checkCurrentOCHOrder()
|
||||
&& checkCurrentOrder()
|
||||
&& ((getCurOrderStatus() === TaxiOrderStatusEnum.OnTheWayToEnd
|
||||
|| getCurOrderStatus() === TaxiOrderStatusEnum.ArriveAtEnd)))
|
||||
) {
|
||||
@@ -753,7 +860,7 @@ object TaxiModel {
|
||||
}
|
||||
} else if (state == IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING) {
|
||||
if (FunctionBuildConfig.isDemoMode) {
|
||||
if ((checkCurrentOCHOrder()
|
||||
if ((checkCurrentOrder()
|
||||
&& (getCurOrderStatus() === TaxiOrderStatusEnum.OnTheWayToEnd
|
||||
|| getCurOrderStatus() === TaxiOrderStatusEnum.ArriveAtEnd))
|
||||
) { //订单中
|
||||
@@ -774,7 +881,7 @@ object TaxiModel {
|
||||
override fun onAutopilotSNRequest() {}
|
||||
override fun onAutopilotArriveAtStation(arrivalNotification: ArrivalNotification?) {
|
||||
i(SceneConstant.M_TAXI + TAG, "onAutopilotArriveAtStation = " + arrivalNotification.toString())
|
||||
if (((arrivalNotification == null) || !checkCurrentOCHOrder()
|
||||
if (((arrivalNotification == null) || !checkCurrentOrder()
|
||||
|| (getCurOrderStatus() === TaxiOrderStatusEnum.ArriveAtEnd))
|
||||
) {
|
||||
return
|
||||
@@ -813,27 +920,27 @@ object TaxiModel {
|
||||
*
|
||||
*/
|
||||
fun setRouteLineMarker() {
|
||||
val currentOCHOrder = getCurrentOCHOrder()
|
||||
if (currentOCHOrder != null) {
|
||||
if ((currentOCHOrder.startSiteGcjPoint == null) || currentOCHOrder.startSiteGcjPoint.isEmpty() || (currentOCHOrder.startSiteGcjPoint.size < 2) || (
|
||||
currentOCHOrder.endSiteGcjPoint == null) || currentOCHOrder.endSiteGcjPoint.isEmpty() || (currentOCHOrder.endSiteGcjPoint.size < 2)
|
||||
) {
|
||||
cleanLineMarker()
|
||||
return
|
||||
}
|
||||
val startStation = LatLng(
|
||||
currentOCHOrder.startSiteGcjPoint[1],
|
||||
currentOCHOrder.startSiteGcjPoint[0]
|
||||
)
|
||||
val endStation = LatLng(
|
||||
currentOCHOrder.endSiteGcjPoint[1],
|
||||
currentOCHOrder.endSiteGcjPoint[0]
|
||||
)
|
||||
if (mAutopilotPlanningCallback != null) {
|
||||
mAutopilotPlanningCallback!!.setLineMarker(startStation, endStation)
|
||||
}
|
||||
// TODO: 设置地图上的marker 只设置有明确站点marker ,当前执行的任务或者订单的,但是不设置虚拟任务的
|
||||
// val currentOCHOrder = getCurrentOrder()
|
||||
// if (currentOCHOrder != null) {
|
||||
// if ((currentOCHOrder.startSiteGcjPoint == null) || currentOCHOrder.startSiteGcjPoint.isEmpty() || (currentOCHOrder.startSiteGcjPoint.size < 2) || (
|
||||
// currentOCHOrder.endSiteGcjPoint == null) || currentOCHOrder.endSiteGcjPoint.isEmpty() || (currentOCHOrder.endSiteGcjPoint.size < 2)
|
||||
// ) {
|
||||
// cleanLineMarker()
|
||||
// return
|
||||
// }
|
||||
// val startStation = LatLng(
|
||||
// currentOCHOrder.startSiteGcjPoint[1],
|
||||
// currentOCHOrder.startSiteGcjPoint[0]
|
||||
// )
|
||||
// val endStation = LatLng(
|
||||
// currentOCHOrder.endSiteGcjPoint[1],
|
||||
// currentOCHOrder.endSiteGcjPoint[0]
|
||||
// )
|
||||
// if (mAutopilotPlanningCallback != null) {
|
||||
// mAutopilotPlanningCallback!!.setLineMarker(startStation, endStation)
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
fun cleanLineMarker() {
|
||||
if (mAutopilotPlanningCallback != null) {
|
||||
@@ -847,30 +954,30 @@ object TaxiModel {
|
||||
* @param models
|
||||
*/
|
||||
fun updateOrderRouteInfo(models: List<MessagePad.Location>) {
|
||||
if (models.isEmpty()) return
|
||||
if (mCurrentOCHOrder == null) return
|
||||
d(SceneConstant.M_TAXI + TAG, "--------计算出sumLength开始---------- ")
|
||||
|
||||
//转换成高德坐标系
|
||||
if (mRoutePoints!!.size > 0) {
|
||||
mRoutePoints.clear()
|
||||
}
|
||||
mRoutePoints.addAll(coordinateConverterWgsToGcjLocations(mContext, models))
|
||||
startDynamicCalculateRouteInfo()
|
||||
// if (models.isEmpty()) return
|
||||
// if (mCurrentOrder == null) return
|
||||
// d(SceneConstant.M_TAXI + TAG, "--------计算出sumLength开始---------- ")
|
||||
//
|
||||
// //转换成高德坐标系
|
||||
// if (mRoutePoints!!.size > 0) {
|
||||
// mRoutePoints.clear()
|
||||
// }
|
||||
// mRoutePoints.addAll(coordinateConverterWgsToGcjLocations(mContext, models))
|
||||
// startDynamicCalculateRouteInfo()
|
||||
}
|
||||
|
||||
private fun startDynamicCalculateRouteInfo() {
|
||||
d(
|
||||
SceneConstant.M_TAXI + TAG,
|
||||
"--------mCurrentOCHOrder---------- $mCurrentOCHOrder"
|
||||
)
|
||||
d(SceneConstant.M_TAXI + TAG, "--------mRoutePoints.size---------- " + mRoutePoints!!.size)
|
||||
//开启实时计算剩余距离,剩余时间,预计时间
|
||||
startOrStopCalculateRouteInfo(true)
|
||||
AmapNaviToDestinationModel.getInstance(mContext).destroyAmaNavi()
|
||||
if (mOrderStatusCallback != null) {
|
||||
mOrderStatusCallback!!.onNaviToEnd(false, false)
|
||||
}
|
||||
// d(
|
||||
// SceneConstant.M_TAXI + TAG,
|
||||
// "--------mCurrentOCHOrder---------- $mCurrentOrder"
|
||||
// )
|
||||
// d(SceneConstant.M_TAXI + TAG, "--------mRoutePoints.size---------- " + mRoutePoints!!.size)
|
||||
// //开启实时计算剩余距离,剩余时间,预计时间
|
||||
// startOrStopCalculateRouteInfo(true)
|
||||
// AmapNaviToDestinationModel.getInstance(mContext).destroyAmaNavi()
|
||||
// if (mOrderStatusCallback != null) {
|
||||
// mOrderStatusCallback!!.onNaviToEnd(false, false)
|
||||
// }
|
||||
}
|
||||
|
||||
private fun updateDistance(lastSumLength: Float) {
|
||||
@@ -880,15 +987,15 @@ object TaxiModel {
|
||||
("---lastSumLength: " + lastSumLength + "----lastTime : " + lastTime
|
||||
+ " thread = " + Thread.currentThread().name)
|
||||
)
|
||||
if (mCurrentOCHOrder != null) {
|
||||
mCurrentOCHOrder!!.decreaseTravelDistance(lastSumLength.toDouble())
|
||||
}
|
||||
if (mOrderStatusCallback != null) {
|
||||
mOrderStatusCallback!!.onCurrentOrderDistToEndChanged(
|
||||
lastSumLength.toLong(),
|
||||
lastTime.toLong()
|
||||
)
|
||||
}
|
||||
// if (mCurrentOrder != null) {
|
||||
// mCurrentOrder!!.decreaseTravelDistance(lastSumLength.toDouble())
|
||||
// }
|
||||
// if (mOrderStatusCallback != null) {
|
||||
// mOrderStatusCallback!!.onCurrentOrderDistToEndChanged(
|
||||
// lastSumLength.toLong(),
|
||||
// lastTime.toLong()
|
||||
// )
|
||||
// }
|
||||
}
|
||||
|
||||
private val distanceListener: IDistanceListener = object : IDistanceListener {
|
||||
@@ -976,16 +1083,16 @@ object TaxiModel {
|
||||
}
|
||||
|
||||
fun setStation() {
|
||||
val currentOCHOrder = getCurrentOCHOrder()
|
||||
if (currentOCHOrder != null) {
|
||||
val startStation = MogoLocation()
|
||||
startStation.longitude = currentOCHOrder.startSiteGcjPoint[0]
|
||||
startStation.latitude = currentOCHOrder.startSiteGcjPoint[1]
|
||||
val endStation = MogoLocation()
|
||||
endStation.longitude = currentOCHOrder.endSiteGcjPoint[0]
|
||||
endStation.latitude = currentOCHOrder.endSiteGcjPoint[1]
|
||||
setStationPoint(startStation, endStation, currentOCHOrder.lineId)
|
||||
}
|
||||
// val currentOCHOrder = getCurrentOrder()
|
||||
// if (currentOCHOrder != null) {
|
||||
// val startStation = MogoLocation()
|
||||
// startStation.longitude = currentOCHOrder.startSiteGcjPoint[0]
|
||||
// startStation.latitude = currentOCHOrder.startSiteGcjPoint[1]
|
||||
// val endStation = MogoLocation()
|
||||
// endStation.longitude = currentOCHOrder.endSiteGcjPoint[0]
|
||||
// endStation.latitude = currentOCHOrder.endSiteGcjPoint[1]
|
||||
// setStationPoint(startStation, endStation, currentOCHOrder.lineId)
|
||||
// }
|
||||
}
|
||||
|
||||
fun cleanStation() {
|
||||
|
||||
@@ -39,7 +39,7 @@ public class TaxiModelLoopManager {
|
||||
private Disposable mHeartbeatDisposable; //心跳轮询
|
||||
private CompositeDisposable mCalculateRouteDisposable; //每隔2s计算一次剩余里程和时间
|
||||
|
||||
public void startInAndWaitOrdersLoop() {
|
||||
public void startInAndWaitCurrentTaskLoop() {
|
||||
if (mInAndWaitServiceDisposable != null && !mInAndWaitServiceDisposable.isDisposed()) {
|
||||
return;
|
||||
}
|
||||
@@ -49,10 +49,12 @@ public class TaxiModelLoopManager {
|
||||
.map((aLong -> aLong + 1))
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(aLong -> {});
|
||||
.subscribe(aLong -> {
|
||||
TaxiModel.INSTANCE.queryCurrentTaskOnce();
|
||||
});
|
||||
}
|
||||
|
||||
public void stopInAndWaitOrdersLoop() {
|
||||
public void stopInAndWaitCurrentTaskLoop() {
|
||||
if (mInAndWaitServiceDisposable != null) {
|
||||
CallerLogger.INSTANCE.i(M_TAXI + TAG, "stopInAndWaitOrdersLoop()");
|
||||
mInAndWaitServiceDisposable.dispose();
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.mogo.och.taxi.model
|
||||
|
||||
import com.mogo.och.taxi.base.BaseViewModel
|
||||
import com.mogo.och.taxi.base.IUiIntent
|
||||
import com.mogo.och.taxi.bean.OrderQueryRespBean
|
||||
import com.mogo.och.taxi.bean.QueryCurrentTaskRespBean
|
||||
import com.mogo.och.taxi.ui.unmanned.OrderUiState
|
||||
import com.mogo.och.taxi.ui.unmanned.TaskUiState
|
||||
import com.mogo.och.taxi.ui.unmanned.UnmannedIntent
|
||||
@@ -14,7 +14,7 @@ import com.mogo.och.taxi.ui.unmanned.UnmannedState
|
||||
*/
|
||||
object TaxiUnmannedViewModel : BaseViewModel<UnmannedState, UnmannedIntent>(){
|
||||
|
||||
private var mCurrentOrder:OrderQueryRespBean.Result? = null
|
||||
private var mCurrentTaskAndOrder: QueryCurrentTaskRespBean.Result? = null
|
||||
|
||||
override fun initUiState(): UnmannedState {
|
||||
return UnmannedState(TaskUiState.INIT, OrderUiState.INIT)
|
||||
@@ -85,7 +85,7 @@ object TaxiUnmannedViewModel : BaseViewModel<UnmannedState, UnmannedIntent>(){
|
||||
}
|
||||
}
|
||||
|
||||
fun getCurrentOCHOrder(): OrderQueryRespBean.Result? {
|
||||
return mCurrentOrder
|
||||
fun updateCurrentTaskAndOrder(currentTaskAndOrder: QueryCurrentTaskRespBean.Result?){
|
||||
mCurrentTaskAndOrder = currentTaskAndOrder
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
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.*
|
||||
|
||||
/**
|
||||
* Created by pangfan on 2021/8/19
|
||||
*/
|
||||
object CarServiceManager {
|
||||
|
||||
|
||||
private var mOCHTaxiServiceApi: UnmannedTaskServiceApi =
|
||||
MoGoRetrofitFactory.getInstance(OchCommonConst.getBaseUrl()).create(
|
||||
UnmannedTaskServiceApi::class.java
|
||||
)
|
||||
|
||||
/**
|
||||
* 开始接单
|
||||
*/
|
||||
@JvmStatic
|
||||
fun startService(
|
||||
context: Context,gcjLat: Double,gcjLon: Double,
|
||||
callback: OchCommonServiceCallback<StartServiceRespBean>?
|
||||
){
|
||||
mOCHTaxiServiceApi.startService(MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
StartServiceReqBean(MoGoAiCloudClientConfig.getInstance().sn,gcjLat, gcjLon)
|
||||
).transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "startService"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 暂停接单
|
||||
*/
|
||||
@JvmStatic
|
||||
fun endService(context: Context,callback: OchCommonServiceCallback<BaseData>?){
|
||||
mOCHTaxiServiceApi.endService(MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
MoGoAiCloudClientConfig.getInstance().sn)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "endService"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询当前任务或者订单
|
||||
*/
|
||||
@JvmStatic
|
||||
fun queryCurrentTask(context: Context,callback: OchCommonServiceCallback<QueryCurrentTaskRespBean>?){
|
||||
mOCHTaxiServiceApi.queryCurrentTask(MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
MoGoAiCloudClientConfig.getInstance().sn)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryCurrentTask"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始任务
|
||||
*/
|
||||
@JvmStatic
|
||||
fun startTask(
|
||||
context: Context,lineId: Int,
|
||||
callback: OchCommonServiceCallback<BaseData>?
|
||||
){
|
||||
mOCHTaxiServiceApi.startTask(MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
StartTaskReqBean(MoGoAiCloudClientConfig.getInstance().sn,lineId)
|
||||
).transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "startTask"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 到达站点
|
||||
*/
|
||||
@JvmStatic
|
||||
fun arriveSite(
|
||||
context: Context,siteId: Int,
|
||||
callback: OchCommonServiceCallback<BaseData>?
|
||||
){
|
||||
mOCHTaxiServiceApi.arriveSite(MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
ArriveSiteReqBean(MoGoAiCloudClientConfig.getInstance().sn,siteId)
|
||||
).transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "arriveSite"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询下一个任务
|
||||
*/
|
||||
@JvmStatic
|
||||
fun prepareTask(
|
||||
context: Context,siteId: Int,
|
||||
callback: OchCommonServiceCallback<PrepareTaskRespBean>?
|
||||
){
|
||||
mOCHTaxiServiceApi.prepareTask(MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
MoGoAiCloudClientConfig.getInstance().token,
|
||||
PrepareTaskReqBean(MoGoAiCloudClientConfig.getInstance().sn,siteId)
|
||||
).transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "prepareTask"))
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@ import com.mogo.eagle.core.network.utils.GsonUtil
|
||||
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.GcjLatLon
|
||||
import com.mogo.och.taxi.bean.UnmannedLoginReqBean
|
||||
import com.mogo.och.taxi.bean.UnmannedLogoutReqBean
|
||||
|
||||
@@ -63,7 +64,7 @@ object OchCommonServiceManager {
|
||||
) {
|
||||
//新saas 接口变换, 参数变换, 重新组装
|
||||
val unmannedLocation4Login = location4Login?.let {
|
||||
UnmannedLoginReqBean.UnmannedLocation4Login(
|
||||
GcjLatLon(
|
||||
it.lat,it.lon
|
||||
)
|
||||
}
|
||||
@@ -87,7 +88,7 @@ object OchCommonServiceManager {
|
||||
) {
|
||||
//新saas 接口变换, 参数变换, 重新组装
|
||||
val unmannedLocation4Login = location4Login?.let {
|
||||
UnmannedLogoutReqBean.UnmannedLocation4Login(
|
||||
GcjLatLon(
|
||||
it.lat,it.lon
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
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: TaxiUnmannedServiceApi =
|
||||
MoGoRetrofitFactory.getInstance(OchCommonConst.getBaseUrl()).create(
|
||||
TaxiUnmannedServiceApi::class.java
|
||||
)
|
||||
|
||||
/**
|
||||
* 暂停接单
|
||||
* @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"))
|
||||
}
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
package com.mogo.och.taxi.network
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.och.taxi.bean.DriverServiceDataRespBean
|
||||
import com.mogo.och.taxi.bean.DriverStatusUpdateReqBean
|
||||
import com.mogo.och.taxi.bean.OrdersListQueryReqBean
|
||||
import com.mogo.och.taxi.bean.OrdersListQueryRespBean
|
||||
import com.mogo.och.taxi.bean.QueryOrderRouteResp
|
||||
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
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/7/26
|
||||
*/
|
||||
interface TaxiUnmannedServiceApi {
|
||||
|
||||
/**
|
||||
* 开始接单
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Headers("Content-type:application/json;charset=UTF-8")
|
||||
@POST("/autopilot-car-hailing/cab/flow/v1/driver/taxi/stopOrderServing")
|
||||
fun stopOrderServing(
|
||||
@Header("appId") appId: String?,
|
||||
@Header("ticket") ticket: String?,
|
||||
@Body data: DriverStatusUpdateReqBean?
|
||||
): Observable<BaseData>
|
||||
|
||||
/**
|
||||
* 暂停接单
|
||||
* @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")
|
||||
fun resetOrderServing(
|
||||
@Header("appId") appId: String?,
|
||||
@Header("ticket") ticket: String?,
|
||||
@Body data: DriverStatusUpdateReqBean?
|
||||
): Observable<BaseData>
|
||||
|
||||
|
||||
//登陆成功后查询 开始接单/暂停接单的状态
|
||||
|
||||
//点击开始接单,获取要前往的站点
|
||||
|
||||
//登陆成功后查询当前任务
|
||||
|
||||
//任务到站
|
||||
|
||||
//到达任务站点后查询下一站任务(包含是否有订单和订单状态)
|
||||
|
||||
//轮询订单接口
|
||||
|
||||
//到达乘客上车点
|
||||
|
||||
//开启自驾
|
||||
|
||||
//服务完成
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package com.mogo.och.taxi.network
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.och.taxi.bean.ArriveSiteReqBean
|
||||
import com.mogo.och.taxi.bean.PrepareTaskReqBean
|
||||
import com.mogo.och.taxi.bean.PrepareTaskRespBean
|
||||
import com.mogo.och.taxi.bean.QueryCurrentTaskRespBean
|
||||
import com.mogo.och.taxi.bean.StartServiceReqBean
|
||||
import com.mogo.och.taxi.bean.StartServiceRespBean
|
||||
import com.mogo.och.taxi.bean.StartTaskReqBean
|
||||
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
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/7/26
|
||||
*/
|
||||
interface UnmannedTaskServiceApi {
|
||||
|
||||
/**
|
||||
* 开始接单
|
||||
* @param
|
||||
* @return 返回要前往的虚拟上车点
|
||||
*/
|
||||
@Headers("Content-type:application/json;charset=UTF-8")
|
||||
@POST("/och-taxi-cabin/api/flow/v1/startService")
|
||||
fun startService(
|
||||
@Header("appId") appId: String?,
|
||||
@Header("ticket") ticket: String?,
|
||||
@Body data: StartServiceReqBean?
|
||||
): Observable<StartServiceRespBean>
|
||||
|
||||
/**
|
||||
* 暂停接单
|
||||
*/
|
||||
@Headers("Content-type:application/json;charset=UTF-8")
|
||||
@GET("/och-taxi-cabin/api/flow/v1/endService")
|
||||
fun endService(
|
||||
@Header("appId") appId: String?, @Header("ticket") ticket: String?, @Query("sn") sn: String?
|
||||
): Observable<BaseData>
|
||||
|
||||
/**
|
||||
* 查询当前任务(包含是否有订单和订单状态)
|
||||
*/
|
||||
@Headers("Content-type:application/json;charset=UTF-8")
|
||||
@GET("/och-taxi-cabin/api/flow/v1/queryCurrentTask")
|
||||
fun queryCurrentTask(@Header("appId") appId: String?, @Header("ticket") ticket: String?, @Query("sn") sn: String?
|
||||
):Observable<QueryCurrentTaskRespBean>
|
||||
|
||||
/**
|
||||
* 开始任务(伪任务手动开, 演练任务和订单手动或者自驾)
|
||||
*/
|
||||
@Headers("Content-type:application/json;charset=UTF-8")
|
||||
@POST("/och-taxi-cabin/api/flow/v1/startTask")
|
||||
fun startTask(
|
||||
@Header("appId") appId: String?,
|
||||
@Header("ticket") ticket: String?,
|
||||
@Body data: StartTaskReqBean?
|
||||
): Observable<BaseData>
|
||||
|
||||
/**
|
||||
* 任务到站点/或者订单到达乘客上车点,下车点
|
||||
*/
|
||||
@Headers("Content-type:application/json;charset=UTF-8")
|
||||
@POST("/och-taxi-cabin/api/flow/v1/arriveSite")
|
||||
fun arriveSite(
|
||||
@Header("appId") appId: String?,
|
||||
@Header("ticket") ticket: String?,
|
||||
@Body data: ArriveSiteReqBean?
|
||||
): Observable<BaseData>
|
||||
|
||||
/**
|
||||
* 到达站点后查询下一个任务
|
||||
*/
|
||||
@Headers("Content-type:application/json;charset=UTF-8")
|
||||
@POST("/och-taxi-cabin/api/flow/v1/prepareTask")
|
||||
fun prepareTask(
|
||||
@Header("appId") appId: String?,
|
||||
@Header("ticket") ticket: String?,
|
||||
@Body data: PrepareTaskReqBean?
|
||||
): Observable<PrepareTaskRespBean>
|
||||
|
||||
//
|
||||
// //服务完成
|
||||
// /och-taxi-cabin/api/flow/v1/orderCompleted
|
||||
//
|
||||
// //取消订单
|
||||
// /och-taxi-cabin/api/flow/v1/cancelOrder
|
||||
//
|
||||
// //批量查询轨迹
|
||||
// /och-taxi-cabin/api/business/v1/contrail
|
||||
//
|
||||
// //司机手动点击跳过乘客验证
|
||||
// /och-taxi-cabin/api/flow/v1/ready/passenger
|
||||
}
|
||||
@@ -17,7 +17,6 @@ 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.callback.ITaxiADASStatusCallback;
|
||||
import com.mogo.och.taxi.callback.ITaxiCarOperationalCallback;
|
||||
import com.mogo.och.taxi.callback.ITaxiControllerStatusCallback;
|
||||
@@ -29,8 +28,6 @@ import com.mogo.och.taxi.constant.TaxtServingStatusManager;
|
||||
import com.mogo.och.taxi.model.TaxiModel;
|
||||
import com.mogo.och.taxi.ui.TaxiFragment;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/1/18
|
||||
@@ -223,9 +220,4 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
|
||||
public void onServiceDataUpdate(long dailyTimeDuration, long dailyOrderNum) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOrdersListPageRefresh(List<OrderQueryRespBean.Result> ordersList) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,8 +35,8 @@ import com.mogo.och.common.module.utils.OCHThreadPoolManager
|
||||
import com.mogo.och.common.module.voice.VoiceNotice.showNotice
|
||||
import com.mogo.och.common.module.wigets.OCHCommitDialog
|
||||
import com.mogo.och.taxi.R
|
||||
import com.mogo.och.taxi.bean.OrderQueryRespBean
|
||||
import com.mogo.och.taxi.bean.OrderQueryRouteInfoRespBean
|
||||
import com.mogo.och.taxi.bean.QueryCurrentTaskRespBean
|
||||
import com.mogo.och.taxi.constant.TaxiUnmannedConst
|
||||
import com.mogo.och.taxi.constant.TaxiOrderStatusEnum
|
||||
import com.mogo.och.taxi.constant.TaxiOrderStatusEnum.Companion.valueOf
|
||||
@@ -52,7 +52,6 @@ import kotlinx.android.synthetic.main.unmanned_being_order.orderPhoneAndNum
|
||||
import kotlinx.android.synthetic.main.unmanned_being_order.taskClickBtn
|
||||
import kotlinx.android.synthetic.main.unmanned_being_order.taskOtherInfo
|
||||
import kotlinx.android.synthetic.main.unmanned_being_order.taskStatus
|
||||
import kotlinx.coroutines.flow.collect
|
||||
import kotlinx.coroutines.flow.map
|
||||
import java.util.Calendar
|
||||
import kotlin.math.ceil
|
||||
@@ -70,7 +69,7 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
|
||||
@Volatile
|
||||
private var mTtsLessThan200Tip = 0 //离终点200米提示播报
|
||||
private var mCurrentOrder: OrderQueryRespBean.Result? = null
|
||||
private var mCurrentOrder: QueryCurrentTaskRespBean.Result? = null
|
||||
private var isFirstStartAutopilotDone = true
|
||||
private var mBeingOrderLayout: ConstraintLayout? = null
|
||||
private var mPassengerInfoLayout: ConstraintLayout? = null
|
||||
@@ -154,18 +153,18 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
*/
|
||||
@SuppressLint("SetTextI18n")
|
||||
@RequiresApi(api = Build.VERSION_CODES.P)
|
||||
fun updateCurrentOrderStatusChanged(order: OrderQueryRespBean.Result?) {
|
||||
fun updateCurrentOrderStatusChanged(order: QueryCurrentTaskRespBean.Result?) {
|
||||
try {
|
||||
if (order == null) return
|
||||
if (order.orderStatus == TaxiOrderStatusEnum.JourneyCompleted.code) {
|
||||
if (order.order.orderStatus == TaxiOrderStatusEnum.JourneyCompleted.code) {
|
||||
mCurrentOrder = null
|
||||
isHaveBeingOrder(false)
|
||||
taskOtherInfo.text = "距离 - - 公里,用时 - - 分"
|
||||
return
|
||||
}
|
||||
mOrderNo = order.orderNo
|
||||
mOrderNo = order.order.orderNo
|
||||
onOrderStatusChanged(order)
|
||||
if (TaxiOrderStatusEnum.ArriveAtEnd.code == order.orderStatus) {
|
||||
if (TaxiOrderStatusEnum.ArriveAtEnd.code == order.order.orderStatus) {
|
||||
d(SceneConstant.M_TAXI + TAG, "已经达到终点")
|
||||
taskStatus.setText(R.string.module_och_taxi_arrive_at_end_station2)
|
||||
updateOrderBottomBtn(
|
||||
@@ -175,8 +174,8 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
true
|
||||
)
|
||||
taskStatus.text = "送乘客至"
|
||||
endStationName.text = order.endSiteAddr
|
||||
} else if (TaxiOrderStatusEnum.OnTheWayToEnd.code == order.orderStatus) {
|
||||
// endStationName.text = order.endSiteAddr
|
||||
} else if (TaxiOrderStatusEnum.OnTheWayToEnd.code == order.order.orderStatus) {
|
||||
d(SceneConstant.M_TAXI + TAG, "已经去往终点")
|
||||
taskStatus.setText(R.string.module_och_taxi_on_the_way_2_end_station)
|
||||
updateOrderBottomBtn(
|
||||
@@ -186,9 +185,9 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
true
|
||||
)
|
||||
taskStatus.text= "送乘客至"
|
||||
endStationName.text = order.endSiteAddr
|
||||
} else if (TaxiOrderStatusEnum.UserArriveAtStart.code == order.orderStatus
|
||||
|| TaxiOrderStatusEnum.ArriveAtStart.code == order.orderStatus
|
||||
// endStationName.text = order.endSiteAddr
|
||||
} else if (TaxiOrderStatusEnum.UserArriveAtStart.code == order.order.orderStatus
|
||||
|| TaxiOrderStatusEnum.ArriveAtStart.code == order.order.orderStatus
|
||||
) {
|
||||
val currentCale = DateTimeUtils.getCurrentDateTime()
|
||||
// val currentHM = DateTimeUtil.formatCalendarToString(currentCale, DateTimeUtil.HH_mm)
|
||||
@@ -196,7 +195,7 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
DateTimeUtil.formatCalendarToString(currentCale, DateTimeUtil.yyyy_MM_dd)
|
||||
|
||||
taskStatus.text = "送乘客至"
|
||||
endStationName.text = order.endSiteAddr
|
||||
// endStationName.text = order.endSiteAddr
|
||||
currentCale.add(Calendar.MINUTE, 10)
|
||||
val strHtml13: String = if (currentDay == DateTimeUtil.formatCalendarToString(
|
||||
currentCale,
|
||||
@@ -216,10 +215,10 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
) + "</big></font>")
|
||||
}
|
||||
taskOtherInfo.text = Html.fromHtml(strHtml13,Html.FROM_HTML_MODE_LEGACY)
|
||||
if (TaxiOrderStatusEnum.ArriveAtStart.code == order.orderStatus) {
|
||||
if (TaxiOrderStatusEnum.ArriveAtStart.code == order.order.orderStatus) {
|
||||
d(SceneConstant.M_TAXI + TAG, "车辆已经达到起点")
|
||||
mPassengerInfoLayout!!.visibility = View.VISIBLE
|
||||
orderPhoneAndNum.text = order.passengerPhone + " | "+ order.passengerNum + "人"
|
||||
// orderPhoneAndNum.text = order.passengerPhone + " | "+ order.passengerNum + "人"
|
||||
taskStatus.setText(R.string.module_och_taxi_waiting)
|
||||
updateOrderBottomBtn(
|
||||
getString(R.string.module_och_taxi_order_server_start_wait_check),
|
||||
@@ -227,7 +226,7 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
Color.parseColor("#FF1D5EF3"),
|
||||
true
|
||||
)
|
||||
} else if (TaxiOrderStatusEnum.UserArriveAtStart.code == order.orderStatus) {
|
||||
} else if (TaxiOrderStatusEnum.UserArriveAtStart.code == order.order.orderStatus) {
|
||||
d(SceneConstant.M_TAXI + TAG, "乘客已上车验证成功")
|
||||
mPassengerInfoLayout!!.visibility = View.GONE
|
||||
taskStatus.setText(R.string.module_och_taxi_user_check_success)
|
||||
@@ -238,10 +237,10 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
true
|
||||
)
|
||||
}
|
||||
} else if (TaxiModel.checkCurrentOCHOrder()) {
|
||||
} else if (TaxiModel.checkCurrentOrder()) {
|
||||
d(SceneConstant.M_TAXI + TAG, "前往乘客上车地点")
|
||||
|
||||
orderPhoneAndNum.text = order.passengerPhone + " | "+ order.passengerNum + "人"
|
||||
// orderPhoneAndNum.text = order.passengerPhone + " | "+ order.passengerNum + "人"
|
||||
|
||||
taskStatus.setText(R.string.module_och_taxi_new_order)
|
||||
updateOrderBottomBtn(
|
||||
@@ -252,7 +251,8 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
)
|
||||
|
||||
val currentCale = DateTimeUtils.getCurrentDateTime()
|
||||
val startCale = DateTimeUtil.formatLongToCalendar(order.bookingTime)
|
||||
// val startCale = DateTimeUtil.formatLongToCalendar(order.bookingTime)
|
||||
val startCale = null
|
||||
val currentDay =
|
||||
DateTimeUtil.formatCalendarToString(currentCale, DateTimeUtil.yyyy_MM_dd)
|
||||
val startDay =
|
||||
@@ -325,12 +325,12 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
("<font color=\"#CAD6FF\">里程 </font>" + "<b><font color=\"#FFFFFF\">" + dis + "</font></b>" + "<font color=\"#CAD6FF\"> " + disUnit + "</font>"
|
||||
+ "<font color=\"#CAD6FF\">,剩余 </font>" + "<b><font color=\"#FFFFFF\">" + min + "</font></b>" + "<font color=\"#CAD6FF\"> 分钟</font>")
|
||||
try {
|
||||
if (mCurrentOrder != null && mCurrentOrder!!.orderStatus == TaxiOrderStatusEnum.OnTheWayToStart.code) { //前往上车点
|
||||
if (mCurrentOrder != null && mCurrentOrder!!.order.orderStatus == TaxiOrderStatusEnum.OnTheWayToStart.code) { //前往上车点
|
||||
taskOtherInfo.text = Html.fromHtml(strHtml2,Html.FROM_HTML_MODE_LEGACY)
|
||||
if (naviToStart.visibility == View.GONE) {
|
||||
naviToStart.visibility = View.VISIBLE
|
||||
}
|
||||
} else if (mCurrentOrder != null && mCurrentOrder!!.orderStatus == TaxiOrderStatusEnum.OnTheWayToEnd.code) { //前往终点 时间单位是分钟
|
||||
} else if (mCurrentOrder != null && mCurrentOrder!!.order.orderStatus == TaxiOrderStatusEnum.OnTheWayToEnd.code) { //前往终点 时间单位是分钟
|
||||
if (naviToEnd.visibility == View.GONE) {
|
||||
naviToEnd.visibility = View.VISIBLE
|
||||
}
|
||||
@@ -384,11 +384,11 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
|
||||
private fun startOrEndService() {
|
||||
if (mCurrentOrder == null) return
|
||||
if (TaxiOrderStatusEnum.ArriveAtStart.code == mCurrentOrder!!.orderStatus) { //到达乘客上车点,司机可跳过乘客屏认证
|
||||
if (TaxiOrderStatusEnum.ArriveAtStart.code == mCurrentOrder!!.order.orderStatus) { //到达乘客上车点,司机可跳过乘客屏认证
|
||||
mViewModel.sendUiIntent(UnmannedIntent.JumpPassengerCheckDone)
|
||||
} else if (TaxiOrderStatusEnum.ArriveAtEnd.code == mCurrentOrder!!.orderStatus) { //点击了完成服务,结束订单并更新订单信息
|
||||
} else if (TaxiOrderStatusEnum.ArriveAtEnd.code == mCurrentOrder!!.order.orderStatus) { //点击了完成服务,结束订单并更新订单信息
|
||||
mViewModel.sendUiIntent(UnmannedIntent.JourneyCompleted)
|
||||
} else if (TaxiOrderStatusEnum.OnTheWayToEnd.code == mCurrentOrder!!.orderStatus) { //前往目的地过程中可提前结束行程
|
||||
} else if (TaxiOrderStatusEnum.OnTheWayToEnd.code == mCurrentOrder!!.order.orderStatus) { //前往目的地过程中可提前结束行程
|
||||
//自驾中提示,接管后才能结束
|
||||
if (getState()
|
||||
== IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
|
||||
@@ -420,8 +420,8 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
closeOrderDialog.show()
|
||||
}
|
||||
|
||||
private fun onOrderStatusChanged(order: OrderQueryRespBean.Result) {
|
||||
val status = order.orderStatus
|
||||
private fun onOrderStatusChanged(order: QueryCurrentTaskRespBean.Result) {
|
||||
val status = order.order.orderStatus
|
||||
d(
|
||||
SceneConstant.M_TAXI + TAG,
|
||||
"status==$status"
|
||||
@@ -448,21 +448,21 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
)
|
||||
mTtsLessThan200Tip = 0
|
||||
isFirstStartAutopilotDone = true
|
||||
val orderStartStationLat = order.startSiteGcjPoint[1]
|
||||
val orderStartStationLng = order.startSiteGcjPoint[0]
|
||||
val orderStartStationLat = order.order.orderStartSite!!.gcjLat
|
||||
val orderStartStationLng = order.order.orderStartSite!!.gcjLon
|
||||
startNaviToStation(false, orderStartStationLat, orderStartStationLng)
|
||||
setOrRemoveMapMaker(
|
||||
true,
|
||||
TaxiUnmannedConst.TAXI_START_MAP_MAKER,
|
||||
order.startSitePoint,
|
||||
R.raw.star_marker
|
||||
)
|
||||
setOrRemoveMapMaker(
|
||||
true,
|
||||
TaxiUnmannedConst.TAXI_END_MAP_MAKER,
|
||||
order.endSitePoint,
|
||||
R.raw.end_marker
|
||||
)
|
||||
// setOrRemoveMapMaker(
|
||||
// true,
|
||||
// TaxiUnmannedConst.TAXI_START_MAP_MAKER,
|
||||
// order.order.orderStartSite,
|
||||
// R.raw.star_marker
|
||||
// )
|
||||
// setOrRemoveMapMaker(
|
||||
// true,
|
||||
// TaxiUnmannedConst.TAXI_END_MAP_MAKER,
|
||||
// order.endSitePoint,
|
||||
// R.raw.end_marker
|
||||
// )
|
||||
}
|
||||
|
||||
TaxiOrderStatusEnum.Cancel -> {
|
||||
@@ -472,18 +472,18 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
cancelOrder.visibility = View.VISIBLE
|
||||
//VoiceNotice.showNotice(mActivity.getString(R.string.module_och_taxi_order_cancel));
|
||||
showOrHideNavi()
|
||||
setOrRemoveMapMaker(
|
||||
false,
|
||||
TaxiUnmannedConst.TAXI_START_MAP_MAKER,
|
||||
order.startSitePoint,
|
||||
R.raw.star_marker
|
||||
)
|
||||
setOrRemoveMapMaker(
|
||||
false,
|
||||
TaxiUnmannedConst.TAXI_END_MAP_MAKER,
|
||||
order.endSitePoint,
|
||||
R.raw.end_marker
|
||||
)
|
||||
// setOrRemoveMapMaker(
|
||||
// false,
|
||||
// TaxiUnmannedConst.TAXI_START_MAP_MAKER,
|
||||
// order.startSitePoint,
|
||||
// R.raw.star_marker
|
||||
// )
|
||||
// setOrRemoveMapMaker(
|
||||
// false,
|
||||
// TaxiUnmannedConst.TAXI_END_MAP_MAKER,
|
||||
// order.endSitePoint,
|
||||
// R.raw.end_marker
|
||||
// )
|
||||
clearSmallMapRouteLine()
|
||||
}
|
||||
|
||||
@@ -505,18 +505,18 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
)
|
||||
}
|
||||
showOrHideNavi()
|
||||
setOrRemoveMapMaker(
|
||||
true,
|
||||
TaxiUnmannedConst.TAXI_START_MAP_MAKER,
|
||||
order.startSitePoint,
|
||||
R.raw.star_marker
|
||||
)
|
||||
setOrRemoveMapMaker(
|
||||
true,
|
||||
TaxiUnmannedConst.TAXI_END_MAP_MAKER,
|
||||
order.endSitePoint,
|
||||
R.raw.end_marker
|
||||
)
|
||||
// setOrRemoveMapMaker(
|
||||
// true,
|
||||
// TaxiUnmannedConst.TAXI_START_MAP_MAKER,
|
||||
// order.startSitePoint,
|
||||
// R.raw.star_marker
|
||||
// )
|
||||
// setOrRemoveMapMaker(
|
||||
// true,
|
||||
// TaxiUnmannedConst.TAXI_END_MAP_MAKER,
|
||||
// order.endSitePoint,
|
||||
// R.raw.end_marker
|
||||
// )
|
||||
}
|
||||
|
||||
TaxiOrderStatusEnum.OnTheWayToEnd -> {
|
||||
@@ -526,18 +526,18 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
if (mTaxiFragment != null) {
|
||||
showNaviToEndStationFragment(false)
|
||||
}
|
||||
setOrRemoveMapMaker(
|
||||
false,
|
||||
TaxiUnmannedConst.TAXI_START_MAP_MAKER,
|
||||
order.startSitePoint,
|
||||
R.raw.star_marker
|
||||
)
|
||||
setOrRemoveMapMaker(
|
||||
true,
|
||||
TaxiUnmannedConst.TAXI_END_MAP_MAKER,
|
||||
order.endSitePoint,
|
||||
R.raw.end_marker
|
||||
)
|
||||
// setOrRemoveMapMaker(
|
||||
// false,
|
||||
// TaxiUnmannedConst.TAXI_START_MAP_MAKER,
|
||||
// order.startSitePoint,
|
||||
// R.raw.star_marker
|
||||
// )
|
||||
// setOrRemoveMapMaker(
|
||||
// true,
|
||||
// TaxiUnmannedConst.TAXI_END_MAP_MAKER,
|
||||
// order.endSitePoint,
|
||||
// R.raw.end_marker
|
||||
// )
|
||||
}
|
||||
|
||||
TaxiOrderStatusEnum.ArriveAtEnd -> {
|
||||
@@ -549,18 +549,18 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
)
|
||||
)
|
||||
showOrHideNavi()
|
||||
setOrRemoveMapMaker(
|
||||
false,
|
||||
TaxiUnmannedConst.TAXI_START_MAP_MAKER,
|
||||
order.startSitePoint,
|
||||
R.raw.star_marker
|
||||
)
|
||||
setOrRemoveMapMaker(
|
||||
false,
|
||||
TaxiUnmannedConst.TAXI_END_MAP_MAKER,
|
||||
order.endSitePoint,
|
||||
R.raw.end_marker
|
||||
)
|
||||
// setOrRemoveMapMaker(
|
||||
// false,
|
||||
// TaxiUnmannedConst.TAXI_START_MAP_MAKER,
|
||||
// order.startSitePoint,
|
||||
// R.raw.star_marker
|
||||
// )
|
||||
// setOrRemoveMapMaker(
|
||||
// false,
|
||||
// TaxiUnmannedConst.TAXI_END_MAP_MAKER,
|
||||
// order.endSitePoint,
|
||||
// R.raw.end_marker
|
||||
// )
|
||||
clearSmallMapRouteLine()
|
||||
}
|
||||
|
||||
@@ -634,12 +634,12 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
**/
|
||||
private fun showNaviToStartStationFragment() {
|
||||
if (mCurrentOrder != null &&
|
||||
mCurrentOrder!!.orderStatus == TaxiOrderStatusEnum.OnTheWayToStart.code
|
||||
mCurrentOrder!!.order.orderStatus == TaxiOrderStatusEnum.OnTheWayToStart.code
|
||||
) {
|
||||
val orderStartStationLat = mCurrentOrder!!.startSiteGcjPoint[1]
|
||||
val orderStartStationLng = mCurrentOrder!!.startSiteGcjPoint[0]
|
||||
mTaxiFragment!!.showAmapNaviToStationFragment(true)
|
||||
startNaviToStation(true, orderStartStationLat, orderStartStationLng)
|
||||
// val orderStartStationLat = mCurrentOrder!!.startSiteGcjPoint[1]
|
||||
// val orderStartStationLng = mCurrentOrder!!.startSiteGcjPoint[0]
|
||||
// mTaxiFragment!!.showAmapNaviToStationFragment(true)
|
||||
// startNaviToStation(true, orderStartStationLat, orderStartStationLng)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -655,18 +655,18 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
fun onCurrentOrderCancelDone() {
|
||||
//去除起终点
|
||||
if (mCurrentOrder != null) {
|
||||
setOrRemoveMapMaker(
|
||||
false,
|
||||
TaxiUnmannedConst.TAXI_START_MAP_MAKER,
|
||||
mCurrentOrder!!.startSitePoint,
|
||||
R.raw.star_marker
|
||||
)
|
||||
setOrRemoveMapMaker(
|
||||
false,
|
||||
TaxiUnmannedConst.TAXI_END_MAP_MAKER,
|
||||
mCurrentOrder!!.endSitePoint,
|
||||
R.raw.end_marker
|
||||
)
|
||||
// setOrRemoveMapMaker(
|
||||
// false,
|
||||
// TaxiUnmannedConst.TAXI_START_MAP_MAKER,
|
||||
// mCurrentOrder!!.startSitePoint,
|
||||
// R.raw.star_marker
|
||||
// )
|
||||
// setOrRemoveMapMaker(
|
||||
// false,
|
||||
// TaxiUnmannedConst.TAXI_END_MAP_MAKER,
|
||||
// mCurrentOrder!!.endSitePoint,
|
||||
// R.raw.end_marker
|
||||
// )
|
||||
}
|
||||
clearSmallMapRouteLine()
|
||||
//提交取消订单后的回调
|
||||
@@ -695,7 +695,7 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
override fun onCurrentNaviDistAndTimeChanged(meters: Int, timeInSecond: Long) {
|
||||
updateDistanceAndTime(meters.toLong(), timeInSecond)
|
||||
if (mCurrentOrder != null
|
||||
&& mCurrentOrder!!.orderStatus == TaxiOrderStatusEnum.OnTheWayToEnd.code
|
||||
&& mCurrentOrder!!.order.orderStatus == TaxiOrderStatusEnum.OnTheWayToEnd.code
|
||||
) {
|
||||
mTaxiFragment!!.reportToEndDisAndTime(meters, timeInSecond)
|
||||
}
|
||||
@@ -712,23 +712,23 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
}
|
||||
UiThreadHandler.postDelayed({
|
||||
if (mCurrentOrder != null &&
|
||||
mCurrentOrder!!.orderStatus == TaxiOrderStatusEnum.OnTheWayToStart.code
|
||||
mCurrentOrder!!.order.orderStatus == TaxiOrderStatusEnum.OnTheWayToStart.code
|
||||
) {
|
||||
val orderStartStationLat = mCurrentOrder!!.startSiteGcjPoint[1]
|
||||
val orderStartStationLng = mCurrentOrder!!.startSiteGcjPoint[0]
|
||||
startNaviToStation(false, orderStartStationLat, orderStartStationLng)
|
||||
// val orderStartStationLat = mCurrentOrder!!.startSiteGcjPoint[1]
|
||||
// val orderStartStationLng = mCurrentOrder!!.startSiteGcjPoint[0]
|
||||
// startNaviToStation(false, orderStartStationLat, orderStartStationLng)
|
||||
}
|
||||
}, 2000)
|
||||
UiThreadHandler.postDelayed({
|
||||
if (mCurrentOrder != null &&
|
||||
mCurrentOrder!!.orderStatus == TaxiOrderStatusEnum.OnTheWayToStart.code
|
||||
mCurrentOrder!!.order.orderStatus == TaxiOrderStatusEnum.OnTheWayToStart.code
|
||||
) {
|
||||
if (naviToStart.visibility == View.GONE) {
|
||||
naviToStart.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
if (mCurrentOrder != null &&
|
||||
mCurrentOrder!!.orderStatus == TaxiOrderStatusEnum.OnTheWayToEnd.code
|
||||
mCurrentOrder!!.order.orderStatus == TaxiOrderStatusEnum.OnTheWayToEnd.code
|
||||
) {
|
||||
if (naviToEnd.visibility == View.GONE) {
|
||||
naviToEnd.visibility = View.VISIBLE
|
||||
@@ -738,14 +738,14 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
}
|
||||
|
||||
fun onNaviToEndAmap(isShow: Boolean) {
|
||||
if (mCurrentOrder != null &&
|
||||
mCurrentOrder!!.orderStatus == TaxiOrderStatusEnum.OnTheWayToEnd.code
|
||||
) {
|
||||
val orderEndStationLat = mCurrentOrder!!.endSiteGcjPoint[1]
|
||||
val orderEndStationLng = mCurrentOrder!!.endSiteGcjPoint[0]
|
||||
mTaxiFragment!!.showAmapNaviToStationFragment(isShow)
|
||||
startNaviToStation(isShow, orderEndStationLat, orderEndStationLng)
|
||||
}
|
||||
// if (mCurrentOrder != null &&
|
||||
// mCurrentOrder!!.orderStatus == TaxiOrderStatusEnum.OnTheWayToEnd.code
|
||||
// ) {
|
||||
// val orderEndStationLat = mCurrentOrder!!.endSiteGcjPoint[1]
|
||||
// val orderEndStationLng = mCurrentOrder!!.endSiteGcjPoint[0]
|
||||
// mTaxiFragment!!.showAmapNaviToStationFragment(isShow)
|
||||
// startNaviToStation(isShow, orderEndStationLat, orderEndStationLng)
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -754,68 +754,68 @@ class TaxiBeingTaskFragment : BaseFragment(),
|
||||
* @param uuid
|
||||
* @param station
|
||||
*/
|
||||
private fun setOrRemoveMapMaker(
|
||||
isAdd: Boolean,
|
||||
uuid: String,
|
||||
station: List<Double>,
|
||||
resourceId: Int
|
||||
) {
|
||||
if (isAdd) {
|
||||
//开启线程执行起终点marker设置
|
||||
val setMapMarkerRunnable = Runnable {
|
||||
d(
|
||||
SceneConstant.M_TAXI + "setMapMaker= " + Thread.currentThread()
|
||||
.name,
|
||||
uuid + "=latitude=" + station[1] + ",longitude=" + station[0]
|
||||
)
|
||||
val builder =
|
||||
Point.Options.Builder(
|
||||
TaxiUnmannedConst.TYPE_MARKER_TAXI_ORDER,
|
||||
Level.MAP_MARKER
|
||||
)
|
||||
.setId(uuid)
|
||||
.anchor(0.5f, 0.5f)
|
||||
.set3DMode(true)
|
||||
.isUseGps(true)
|
||||
.controlAngle(true)
|
||||
.icon3DRes(resourceId)
|
||||
.latitude(station[1])
|
||||
.longitude(station[0])
|
||||
val mapUIController =
|
||||
getMapUIController()
|
||||
if (mapUIController != null) {
|
||||
val centerLine =
|
||||
mapUIController.getCenterLineInfo(
|
||||
station[0], station[1], -1f
|
||||
)
|
||||
if (null != centerLine) { // 有可能鹰眼map为空没有角度。判空使用后可能造成maker角度跟道路角度不一致
|
||||
val angle = centerLine.angle
|
||||
if (angle != null) {
|
||||
builder.rotate(angle.toFloat())
|
||||
}
|
||||
}
|
||||
}
|
||||
val overlayManager =
|
||||
getOverlayManager()
|
||||
overlayManager?.showOrUpdatePoint(builder.build())
|
||||
}
|
||||
OCHThreadPoolManager.getsInstance().execute(setMapMarkerRunnable)
|
||||
} else {
|
||||
//开启线程移除起终点marker设置
|
||||
val removeMapMarkerRunnable = Runnable {
|
||||
d(
|
||||
SceneConstant.M_TAXI + "RemoveMapMaker=" + Thread.currentThread()
|
||||
.name,
|
||||
uuid + "=latitude=" + station[1] + ",longitude=" + station[0]
|
||||
)
|
||||
// Objects.requireNonNull(CallerMapUIServiceManager.INSTANCE.getMarkerManager(AbsMogoApplication.getApp())).removeMarkers(uuid);
|
||||
val overlayManager =
|
||||
getOverlayManager()
|
||||
overlayManager?.removePoint(uuid)
|
||||
}
|
||||
OCHThreadPoolManager.getsInstance().execute(removeMapMarkerRunnable)
|
||||
}
|
||||
}
|
||||
// private fun setOrRemoveMapMaker(
|
||||
// isAdd: Boolean,
|
||||
// uuid: String,
|
||||
// station: List<Double>,
|
||||
// resourceId: Int
|
||||
// ) {
|
||||
// if (isAdd) {
|
||||
// //开启线程执行起终点marker设置
|
||||
// val setMapMarkerRunnable = Runnable {
|
||||
// d(
|
||||
// SceneConstant.M_TAXI + "setMapMaker= " + Thread.currentThread()
|
||||
// .name,
|
||||
// uuid + "=latitude=" + station[1] + ",longitude=" + station[0]
|
||||
// )
|
||||
// val builder =
|
||||
// Point.Options.Builder(
|
||||
// TaxiUnmannedConst.TYPE_MARKER_TAXI_ORDER,
|
||||
// Level.MAP_MARKER
|
||||
// )
|
||||
// .setId(uuid)
|
||||
// .anchor(0.5f, 0.5f)
|
||||
// .set3DMode(true)
|
||||
// .isUseGps(true)
|
||||
// .controlAngle(true)
|
||||
// .icon3DRes(resourceId)
|
||||
// .latitude(station[1])
|
||||
// .longitude(station[0])
|
||||
// val mapUIController =
|
||||
// getMapUIController()
|
||||
// if (mapUIController != null) {
|
||||
// val centerLine =
|
||||
// mapUIController.getCenterLineInfo(
|
||||
// station[0], station[1], -1f
|
||||
// )
|
||||
// if (null != centerLine) { // 有可能鹰眼map为空没有角度。判空使用后可能造成maker角度跟道路角度不一致
|
||||
// val angle = centerLine.angle
|
||||
// if (angle != null) {
|
||||
// builder.rotate(angle.toFloat())
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// val overlayManager =
|
||||
// getOverlayManager()
|
||||
// overlayManager?.showOrUpdatePoint(builder.build())
|
||||
// }
|
||||
// OCHThreadPoolManager.getsInstance().execute(setMapMarkerRunnable)
|
||||
// } else {
|
||||
// //开启线程移除起终点marker设置
|
||||
// val removeMapMarkerRunnable = Runnable {
|
||||
// d(
|
||||
// SceneConstant.M_TAXI + "RemoveMapMaker=" + Thread.currentThread()
|
||||
// .name,
|
||||
// uuid + "=latitude=" + station[1] + ",longitude=" + station[0]
|
||||
// )
|
||||
// // Objects.requireNonNull(CallerMapUIServiceManager.INSTANCE.getMarkerManager(AbsMogoApplication.getApp())).removeMarkers(uuid);
|
||||
// val overlayManager =
|
||||
// getOverlayManager()
|
||||
// overlayManager?.removePoint(uuid)
|
||||
// }
|
||||
// OCHThreadPoolManager.getsInstance().execute(removeMapMarkerRunnable)
|
||||
// }
|
||||
// }
|
||||
|
||||
fun updateOrderBottomBtnUI() {
|
||||
mViewModel.sendUiIntent(UnmannedIntent.StartTask)
|
||||
|
||||
@@ -20,7 +20,7 @@ import com.mogo.och.common.module.biz.constant.OchCommonConst
|
||||
import com.mogo.och.common.module.biz.provider.LoginService
|
||||
import com.mogo.och.taxi.R
|
||||
import com.mogo.och.taxi.base.BaseTaxiTabFragment
|
||||
import com.mogo.och.taxi.bean.OrderQueryRespBean
|
||||
import com.mogo.och.taxi.bean.QueryCurrentTaskRespBean
|
||||
import com.mogo.och.taxi.constant.TaxiOrderStatusEnum
|
||||
import com.mogo.och.taxi.model.TaxiModel
|
||||
import com.mogo.och.taxi.network.LoginBusImpl
|
||||
@@ -168,7 +168,7 @@ public class TaxiFragment : BaseTaxiTabFragment<TaxiFragment, TaxiPresenter>(),
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.P)
|
||||
fun updateCurrentOrderStatusChanged(order: OrderQueryRespBean.Result?) {
|
||||
fun updateCurrentOrderStatusChanged(order: QueryCurrentTaskRespBean.Result?) {
|
||||
if (serverOrdersFragmentWR != null && serverOrdersFragmentWR!!.get() != null) {
|
||||
serverOrdersFragmentWR!!.get()!!.updateCurrentOrderStatusChanged(order)
|
||||
}
|
||||
@@ -253,44 +253,44 @@ public class TaxiFragment : BaseTaxiTabFragment<TaxiFragment, TaxiPresenter>(),
|
||||
private var testCurStopMd5DPQP: TextView? = null
|
||||
@SuppressLint("SetTextI18n")
|
||||
fun clickTestBar() {
|
||||
if (testBar == null) {
|
||||
testBar = findViewById<View>(R.id.module_och_taxi_order_status_change_test_bar)
|
||||
testCurOrderId = findViewById<TextView>(R.id.test_bar_current_order_id)
|
||||
testCurLineId = findViewById<TextView>(R.id.test_bar_current_line_id)
|
||||
testCurTrajMd5 = findViewById<TextView>(R.id.test_bar_current_traj_md5)
|
||||
testCurStopMd5 = findViewById<TextView>(R.id.test_bar_current_stop_md5)
|
||||
testCurTrajMd5DPQP = findViewById<TextView>(R.id.test_bar_current_traj_md5_dpqp)
|
||||
testCurStopMd5DPQP = findViewById<TextView>(R.id.test_bar_current_stop_md5_dpqp)
|
||||
}
|
||||
if (testBar!!.visibility == View.VISIBLE) {
|
||||
testBar!!.visibility = View.GONE
|
||||
} else {
|
||||
val order = TaxiModel.getCurrentOCHOrder()
|
||||
testCurOrderId!!.text = "orderNo:" + (order?.orderNo?.toString() ?: "")
|
||||
testCurLineId!!.text = "lineId:" + (order?.lineId?.toString() ?: "")
|
||||
testCurTrajMd5!!.text = "TMd5:" + if (order == null) "" else order.csvFileMd5
|
||||
testCurStopMd5!!.text = "SMd5:" + if (order == null) "" else order.txtFileMd5
|
||||
testCurTrajMd5DPQP!!.text =
|
||||
"TMd5DPQP:" + if (order == null) "" else order.csvFileMd5DPQP
|
||||
testCurStopMd5DPQP!!.text =
|
||||
"SMd5DPQP:" + if (order == null) "" else order.txtFileMd5DPQP
|
||||
testBar!!.visibility = View.VISIBLE
|
||||
}
|
||||
// if (testBar == null) {
|
||||
// testBar = findViewById<View>(R.id.module_och_taxi_order_status_change_test_bar)
|
||||
// testCurOrderId = findViewById<TextView>(R.id.test_bar_current_order_id)
|
||||
// testCurLineId = findViewById<TextView>(R.id.test_bar_current_line_id)
|
||||
// testCurTrajMd5 = findViewById<TextView>(R.id.test_bar_current_traj_md5)
|
||||
// testCurStopMd5 = findViewById<TextView>(R.id.test_bar_current_stop_md5)
|
||||
// testCurTrajMd5DPQP = findViewById<TextView>(R.id.test_bar_current_traj_md5_dpqp)
|
||||
// testCurStopMd5DPQP = findViewById<TextView>(R.id.test_bar_current_stop_md5_dpqp)
|
||||
// }
|
||||
// if (testBar!!.visibility == View.VISIBLE) {
|
||||
// testBar!!.visibility = View.GONE
|
||||
// } else {
|
||||
// val order = TaxiModel.getCurrentOrder()
|
||||
// testCurOrderId!!.text = "orderNo:" + (order?.orderNo?.toString() ?: "")
|
||||
// testCurLineId!!.text = "lineId:" + (order?.lineId?.toString() ?: "")
|
||||
// testCurTrajMd5!!.text = "TMd5:" + if (order == null) "" else order.csvFileMd5
|
||||
// testCurStopMd5!!.text = "SMd5:" + if (order == null) "" else order.txtFileMd5
|
||||
// testCurTrajMd5DPQP!!.text =
|
||||
// "TMd5DPQP:" + if (order == null) "" else order.csvFileMd5DPQP
|
||||
// testCurStopMd5DPQP!!.text =
|
||||
// "SMd5DPQP:" + if (order == null) "" else order.txtFileMd5DPQP
|
||||
// testBar!!.visibility = View.VISIBLE
|
||||
// }
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
private fun updateTaxiTestBarInfo() {
|
||||
if (testBar != null && testBar!!.visibility == View.VISIBLE) {
|
||||
val order = TaxiModel.getCurrentOCHOrder()
|
||||
testCurOrderId!!.text = "orderNo:" + (order?.orderNo?.toString() ?: "")
|
||||
testCurLineId!!.text = "lineId:" + (order?.lineId?.toString() ?: "")
|
||||
testCurTrajMd5!!.text = "TMd5:" + if (order == null) "" else order.csvFileMd5
|
||||
testCurStopMd5!!.text = "SMd5:" + if (order == null) "" else order.txtFileMd5
|
||||
testCurTrajMd5DPQP!!.text =
|
||||
"TMd5DPQP:" + if (order == null) "" else order.csvFileMd5DPQP
|
||||
testCurStopMd5DPQP!!.text =
|
||||
"SMd5DPQP:" + if (order == null) "" else order.txtFileMd5DPQP
|
||||
}
|
||||
// if (testBar != null && testBar!!.visibility == View.VISIBLE) {
|
||||
// val order = TaxiModel.getCurrentOrder()
|
||||
// testCurOrderId!!.text = "orderNo:" + (order?.orderNo?.toString() ?: "")
|
||||
// testCurLineId!!.text = "lineId:" + (order?.lineId?.toString() ?: "")
|
||||
// testCurTrajMd5!!.text = "TMd5:" + if (order == null) "" else order.csvFileMd5
|
||||
// testCurStopMd5!!.text = "SMd5:" + if (order == null) "" else order.txtFileMd5
|
||||
// testCurTrajMd5DPQP!!.text =
|
||||
// "TMd5DPQP:" + if (order == null) "" else order.csvFileMd5DPQP
|
||||
// testCurStopMd5DPQP!!.text =
|
||||
// "SMd5DPQP:" + if (order == null) "" else order.txtFileMd5DPQP
|
||||
// }
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -32,7 +32,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||
import com.mogo.och.taxi.R
|
||||
import com.mogo.och.taxi.base.AvoidLeakDialog
|
||||
import com.mogo.och.taxi.bean.OrderQueryRespBean
|
||||
import com.mogo.och.taxi.bean.QueryCurrentTaskRespBean
|
||||
import com.mogo.och.taxi.constant.TaxiOrderStatusEnum.*
|
||||
import com.mogo.och.taxi.constant.TaxiOrderStatusEnum.Companion.valueOf
|
||||
import com.mogo.och.taxi.constant.TaxiOrderTypeEnum
|
||||
@@ -55,7 +55,7 @@ import java.util.Calendar
|
||||
class TaxiPersonalDialogFragment :
|
||||
MvpDialogFragment<TaxiPersonalDialogFragment?, TaxiOperationalPresenter?>(),
|
||||
View.OnClickListener {
|
||||
private val orders: MutableList<OrderQueryRespBean.Result> = ArrayList()
|
||||
private val orders: MutableList<QueryCurrentTaskRespBean.Result> = ArrayList()
|
||||
private val mTabTitles = arrayOf("在线时长", "订单完成数")
|
||||
private val fragments: MutableList<TaxiOperationDatasFragment> = ArrayList()
|
||||
private var mNextPage = 1 //订单列表分页从1开始
|
||||
@@ -237,7 +237,7 @@ class TaxiPersonalDialogFragment :
|
||||
}
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
fun onOrdersListPageRefresh(ordersList: List<OrderQueryRespBean.Result>) {
|
||||
fun onOrdersListPageRefresh(ordersList: List<QueryCurrentTaskRespBean.Result>) {
|
||||
try {
|
||||
if (mNextPage == 0 || ordersList.isEmpty()) { //无数据
|
||||
module_och_taxi_order_list.visibility = View.GONE
|
||||
@@ -267,7 +267,7 @@ class TaxiPersonalDialogFragment :
|
||||
|
||||
internal inner class OrderAdapter(
|
||||
private val context: Context,
|
||||
private var orders: List<OrderQueryRespBean.Result>
|
||||
private var orders: List<QueryCurrentTaskRespBean.Result>
|
||||
) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
|
||||
@@ -283,50 +283,50 @@ class TaxiPersonalDialogFragment :
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
|
||||
val queryRespBean = orders[position]
|
||||
?: return
|
||||
if (holder is DayGroupViewHolder) {
|
||||
holder.dayGroupTv.text = DateTimeUtil.getYMDTime(queryRespBean.createTime)
|
||||
bindOrderDetailData(
|
||||
queryRespBean,
|
||||
holder.orderTimeTv,
|
||||
holder.startStationTv,
|
||||
holder.endStationTv,
|
||||
holder.orderStatusBt,
|
||||
holder.orderTypeBt,
|
||||
holder.orderNumTv
|
||||
)
|
||||
if (isNoLineItem(position)) {
|
||||
holder.dividerLine.visibility = View.VISIBLE
|
||||
} else {
|
||||
holder.dividerLine.visibility = View.GONE
|
||||
}
|
||||
if (position == orders.size - 1 && serverHadNoData) {
|
||||
holder.mBootNoDataView.visibility = View.VISIBLE
|
||||
} else {
|
||||
holder.mBootNoDataView.visibility = View.GONE
|
||||
}
|
||||
} else if (holder is OrderDetailViewHolder) {
|
||||
bindOrderDetailData(
|
||||
queryRespBean,
|
||||
holder.orderTimeTv,
|
||||
holder.startStationTv,
|
||||
holder.endStationTv,
|
||||
holder.orderStatusBt,
|
||||
holder.orderTypeBt,
|
||||
holder.orderNumTv
|
||||
)
|
||||
if (isNoLineItem(position)) {
|
||||
holder.dividerLine.visibility = View.VISIBLE
|
||||
} else {
|
||||
holder.dividerLine.visibility = View.GONE
|
||||
}
|
||||
if (position == orders.size - 1 && serverHadNoData) {
|
||||
holder.mBootNoDataView.visibility = View.VISIBLE
|
||||
} else {
|
||||
holder.mBootNoDataView.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
// val queryRespBean = orders[position]
|
||||
// ?: return
|
||||
// if (holder is DayGroupViewHolder) {
|
||||
// holder.dayGroupTv.text = DateTimeUtil.getYMDTime(queryRespBean.createTime)
|
||||
// bindOrderDetailData(
|
||||
// queryRespBean,
|
||||
// holder.orderTimeTv,
|
||||
// holder.startStationTv,
|
||||
// holder.endStationTv,
|
||||
// holder.orderStatusBt,
|
||||
// holder.orderTypeBt,
|
||||
// holder.orderNumTv
|
||||
// )
|
||||
// if (isNoLineItem(position)) {
|
||||
// holder.dividerLine.visibility = View.VISIBLE
|
||||
// } else {
|
||||
// holder.dividerLine.visibility = View.GONE
|
||||
// }
|
||||
// if (position == orders.size - 1 && serverHadNoData) {
|
||||
// holder.mBootNoDataView.visibility = View.VISIBLE
|
||||
// } else {
|
||||
// holder.mBootNoDataView.visibility = View.GONE
|
||||
// }
|
||||
// } else if (holder is OrderDetailViewHolder) {
|
||||
// bindOrderDetailData(
|
||||
// queryRespBean,
|
||||
// holder.orderTimeTv,
|
||||
// holder.startStationTv,
|
||||
// holder.endStationTv,
|
||||
// holder.orderStatusBt,
|
||||
// holder.orderTypeBt,
|
||||
// holder.orderNumTv
|
||||
// )
|
||||
// if (isNoLineItem(position)) {
|
||||
// holder.dividerLine.visibility = View.VISIBLE
|
||||
// } else {
|
||||
// holder.dividerLine.visibility = View.GONE
|
||||
// }
|
||||
// if (position == orders.size - 1 && serverHadNoData) {
|
||||
// holder.mBootNoDataView.visibility = View.VISIBLE
|
||||
// } else {
|
||||
// holder.mBootNoDataView.visibility = View.GONE
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
override fun getItemId(position: Int): Long {
|
||||
@@ -335,27 +335,29 @@ class TaxiPersonalDialogFragment :
|
||||
|
||||
override fun getItemViewType(position: Int): Int {
|
||||
//第一个要显示时间
|
||||
if (position == 0) {
|
||||
return Companion.DAY_GROUP_ITEM
|
||||
}
|
||||
val currentDate = DateTimeUtil.getYMDTime(orders[position].createTime) //获取当前订单时间
|
||||
val prevIndex = position - 1
|
||||
val preDate = DateTimeUtil.getYMDTime(orders[prevIndex].createTime)
|
||||
val isDifferent = preDate != currentDate //前一个订单的日期跟第二个订单的日期是否一致
|
||||
return if (isDifferent) DAY_GROUP_ITEM else ORDER_DETAIL_ITEM //一样订单详情, 不一样新添加分组
|
||||
// if (position == 0) {
|
||||
// return Companion.DAY_GROUP_ITEM
|
||||
// }
|
||||
// val currentDate = DateTimeUtil.getYMDTime(orders[position].createTime) //获取当前订单时间
|
||||
// val prevIndex = position - 1
|
||||
// val preDate = DateTimeUtil.getYMDTime(orders[prevIndex].createTime)
|
||||
// val isDifferent = preDate != currentDate //前一个订单的日期跟第二个订单的日期是否一致
|
||||
// return if (isDifferent) DAY_GROUP_ITEM else ORDER_DETAIL_ITEM //一样订单详情, 不一样新添加分组
|
||||
return 0
|
||||
}
|
||||
|
||||
private fun isNoLineItem(position: Int): Boolean {
|
||||
return if (position == orders.size - 1) {
|
||||
false
|
||||
} else {
|
||||
val currentDate =
|
||||
DateTimeUtil.getYMDTime(orders[position].createTime) //获取当前订单时间
|
||||
val nextIndex = position + 1
|
||||
val preDate =
|
||||
DateTimeUtil.getYMDTime(orders[nextIndex].createTime)
|
||||
preDate == currentDate //一样有划分线, 不一样没有划分线
|
||||
}
|
||||
// return if (position == orders.size - 1) {
|
||||
// false
|
||||
// } else {
|
||||
// val currentDate =
|
||||
// DateTimeUtil.getYMDTime(orders[position].createTime) //获取当前订单时间
|
||||
// val nextIndex = position + 1
|
||||
// val preDate =
|
||||
// DateTimeUtil.getYMDTime(orders[nextIndex].createTime)
|
||||
// preDate == currentDate //一样有划分线, 不一样没有划分线
|
||||
// }
|
||||
return false
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
@@ -364,7 +366,7 @@ class TaxiPersonalDialogFragment :
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
private fun bindOrderDetailData(
|
||||
queryRespBean: OrderQueryRespBean.Result,
|
||||
queryRespBean: QueryCurrentTaskRespBean.Result,
|
||||
orderTimeTv: TextView,
|
||||
startStationTv: TextView,
|
||||
endStationTv: TextView,
|
||||
@@ -372,14 +374,14 @@ class TaxiPersonalDialogFragment :
|
||||
orderTypeBt: Button,
|
||||
orderNumTv: TextView
|
||||
) {
|
||||
val calendar = Calendar.getInstance()
|
||||
calendar.timeInMillis = queryRespBean.createTime
|
||||
orderTimeTv.text = DateTimeUtil.formatCalendarToString(calendar, DateTimeUtil.HH_mm)
|
||||
startStationTv.text = queryRespBean.startSiteAddr
|
||||
endStationTv.text = queryRespBean.endSiteAddr
|
||||
orderStatusBt.text = getOrderStatus(queryRespBean.orderStatus, orderStatusBt)
|
||||
orderTypeBt.text = getOrderType(queryRespBean.orderType, orderTypeBt)
|
||||
orderNumTv.text = "订单编号:" + queryRespBean.orderNo.toString()
|
||||
// val calendar = Calendar.getInstance()
|
||||
// calendar.timeInMillis = queryRespBean.createTime
|
||||
// orderTimeTv.text = DateTimeUtil.formatCalendarToString(calendar, DateTimeUtil.HH_mm)
|
||||
// startStationTv.text = queryRespBean.startSiteAddr
|
||||
// endStationTv.text = queryRespBean.endSiteAddr
|
||||
// orderStatusBt.text = getOrderStatus(queryRespBean.orderStatus, orderStatusBt)
|
||||
// orderTypeBt.text = getOrderType(queryRespBean.orderType, orderTypeBt)
|
||||
// orderNumTv.text = "订单编号:" + queryRespBean.orderNo.toString()
|
||||
}
|
||||
|
||||
@SuppressLint("UseCompatLoadingForDrawables")
|
||||
|
||||
@@ -10,10 +10,9 @@ import androidx.lifecycle.lifecycleScope
|
||||
import com.mogo.commons.mvp.BaseFragment
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.och.taxi.R
|
||||
import com.mogo.och.taxi.bean.OrderQueryRespBean
|
||||
import com.mogo.och.taxi.bean.QueryCurrentTaskRespBean
|
||||
import com.mogo.och.taxi.model.TaxiUnmannedViewModel
|
||||
import com.mogo.och.taxi.ui.unmanned.OrderUiState
|
||||
import kotlinx.coroutines.flow.collect
|
||||
import kotlinx.coroutines.flow.map
|
||||
|
||||
/**
|
||||
@@ -21,7 +20,7 @@ import kotlinx.coroutines.flow.map
|
||||
* @date: 2023/7/24
|
||||
*/
|
||||
class TaxiReserveOrderFragment : BaseFragment() {
|
||||
private val mData: MutableList<OrderQueryRespBean.Result> = ArrayList()
|
||||
private val mData: MutableList<QueryCurrentTaskRespBean.Result> = ArrayList()
|
||||
|
||||
private val mViewModel by viewModels<TaxiUnmannedViewModel>()
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ import com.mogo.commons.mvp.BaseFragment
|
||||
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.bean.OrderQueryRespBean
|
||||
import com.mogo.och.taxi.bean.QueryCurrentTaskRespBean
|
||||
import kotlinx.android.synthetic.main.taxi_server_orders_panel.module_och_taxi_tab
|
||||
import kotlinx.android.synthetic.main.taxi_server_orders_panel.module_och_taxi_view_pager
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
@@ -154,7 +154,7 @@ class TaxiServerOrdersFragment : BaseFragment(){
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.P)
|
||||
fun updateCurrentOrderStatusChanged(order: OrderQueryRespBean.Result?) {
|
||||
fun updateCurrentOrderStatusChanged(order: QueryCurrentTaskRespBean.Result?) {
|
||||
if (beingTaskFragment != null) {
|
||||
module_och_taxi_tab.getTabAt(0)?.select()
|
||||
beingTaskFragment!!.updateCurrentOrderStatusChanged(order)
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.mogo.och.taxi.ui.unmanned
|
||||
|
||||
import com.mogo.och.taxi.base.IUiState
|
||||
import com.mogo.och.taxi.bean.OrderDetail
|
||||
import com.mogo.och.taxi.bean.TaskDetail
|
||||
import com.mogo.och.taxi.bean.Site
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
@@ -12,7 +12,7 @@ data class UnmannedState(val taskUiState: TaskUiState,val orderUiState: OrderUiS
|
||||
|
||||
sealed class TaskUiState{
|
||||
object INIT : TaskUiState()
|
||||
data class SUCCESS(val models: List<TaskDetail>) : TaskUiState()
|
||||
data class SUCCESS(val models: List<Site>) : TaskUiState()
|
||||
}
|
||||
|
||||
sealed class OrderUiState{
|
||||
|
||||
@@ -6,10 +6,7 @@ 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.TaxiUnmannedConst;
|
||||
import com.mogo.och.taxi.constant.TaxiOrderStatusEnum;
|
||||
import com.mogo.och.taxi.model.TaxiModel;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -50,19 +47,19 @@ public class TaxiTrajectoryManager {
|
||||
* 同步订单信息
|
||||
*/
|
||||
public void syncTrajectoryInfo() {
|
||||
OrderQueryRespBean.Result orderInfo = TaxiModel.INSTANCE.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();
|
||||
}
|
||||
}
|
||||
// OrderQueryRespBean.Result orderInfo = TaxiModel.INSTANCE.getCurrentOrder();
|
||||
// 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();
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -99,33 +96,33 @@ public class TaxiTrajectoryManager {
|
||||
}
|
||||
|
||||
private void setupAutoPilotLine() {
|
||||
OrderQueryRespBean.Result order = TaxiModel.INSTANCE.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);
|
||||
}
|
||||
}
|
||||
// OrderQueryRespBean.Result order = TaxiModel.INSTANCE.getCurrentOrder();
|
||||
// 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() {
|
||||
|
||||
Reference in New Issue
Block a user