[6.6.0]
[fea] [离线接驳]
This commit is contained in:
@@ -62,7 +62,7 @@ import com.mogo.och.common.module.network.OchCommonServiceCallback;
|
||||
import com.mogo.och.common.module.callback.OchAdasStartFailureCallback;
|
||||
import com.mogo.och.common.module.manager.socket.cloud.AbnormalFactorsLoopManager;
|
||||
import com.mogo.och.common.module.manager.autopilot.OCHAdasAbilityManager;
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.ArrivedStation;
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.bean.ArrivedStation;
|
||||
import com.mogo.och.common.module.manager.autopilot.trajectory.ITrajectoryListListener;
|
||||
import com.mogo.och.common.module.manager.autopilot.trajectory.TrajectoryManager;
|
||||
import com.mogo.och.common.module.manager.distance.ITrajectoryListener;
|
||||
|
||||
@@ -13,7 +13,6 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.DateTimeUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.bus.bean.WriteOffPassenger;
|
||||
import com.mogo.och.bus.callback.IBusADASStatusCallback;
|
||||
@@ -29,7 +28,7 @@ import com.mogo.och.common.module.biz.login.ILoginCallback;
|
||||
import com.mogo.och.common.module.biz.login.LoginStatusEnum;
|
||||
import com.mogo.och.common.module.biz.login.LoginStatusManager;
|
||||
import com.mogo.och.common.module.manager.autopilot.OCHAdasAbilityManager;
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.ArrivedStation;
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.bean.ArrivedStation;
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.IOchAutopilotStatusListener;
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutoPilotStatusListenerManager;
|
||||
import com.mogo.och.data.bean.BusStationBean;
|
||||
|
||||
@@ -11,7 +11,6 @@ import com.magic.mogo.och.charter.model.DriverM1Model
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.util.DateTimeUtils
|
||||
@@ -20,7 +19,7 @@ import com.mogo.och.common.module.biz.login.LoginStatusEnum
|
||||
import com.mogo.och.common.module.biz.login.LoginStatusManager
|
||||
import com.mogo.och.common.module.manager.socket.cloud.OCHSocketMessageManager.OPERATION_ROAD_SIDE_TYPE
|
||||
import com.mogo.och.common.module.manager.autopilot.OCHAdasAbilityManager
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.ArrivedStation
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.bean.ArrivedStation
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.IOchAutopilotStatusListener
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutoPilotStatusListenerManager
|
||||
import com.mogo.och.common.module.manager.beautifymode.BeautifyManager
|
||||
@@ -28,7 +27,6 @@ import com.mogo.och.common.module.manager.stopside.OCHPlanningActionsCallback
|
||||
import com.mogo.och.common.module.manager.stopside.StopSideStatus
|
||||
import com.mogo.och.common.module.manager.stopside.StopSideManager
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import mogo_msg.MogoReportMsg
|
||||
|
||||
/**
|
||||
|
||||
@@ -41,7 +41,7 @@ import com.mogo.och.common.module.biz.login.LoginStatusManager
|
||||
import com.mogo.och.common.module.biz.login.ILoginCallback
|
||||
import com.mogo.och.common.module.biz.login.LoginStatusEnum
|
||||
import com.mogo.och.common.module.network.OchCommonServiceCallback
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.ArrivedStation
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.bean.ArrivedStation
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.IOchAutopilotStatusListener
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutoPilotManager
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutoPilotStatusListenerManager
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mogo.och.common.module.manager.autopilot.autopilot;
|
||||
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.ArrivedStation;
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.bean.ArrivedStation;
|
||||
import com.zhjt.mogo.adas.data.AdasConstants;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
@@ -11,8 +11,10 @@ import com.mogo.eagle.core.function.call.autopilot.CallerReceiveReceivedAckListe
|
||||
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.common.module.manager.autopilot.OCHAdasAbilityManager
|
||||
import com.mogo.och.data.bean.ContraiInfo
|
||||
import com.mogo.och.common.module.manager.autopilot.line.LineManager
|
||||
import com.mogo.och.common.module.manager.distance.TrajectoryAndDistanceManager
|
||||
import com.mogo.och.data.bean.BusStationBean
|
||||
import com.zhjt.mogo.adas.common.MessageType
|
||||
import com.zhjt.mogo.adas.data.bean.ReceivedAck
|
||||
import com.zhjt.mogo.adas.data.bean.ReceivedAck.Status
|
||||
@@ -20,6 +22,11 @@ import com.zhjt.mogo.adas.data.bean.ReceivedAck.Status
|
||||
object OchAutoPilotManager : IMoGoReceiveReceivedAckListener {
|
||||
|
||||
const val TAG = "OchAutoPilotManager"
|
||||
|
||||
var contraiInfo: ContraiInfo? = null
|
||||
var startStation: BusStationBean? = null
|
||||
var endStation: BusStationBean? = null
|
||||
|
||||
init {
|
||||
CallerReceiveReceivedAckListenerManager.addListener(TAG,this)
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListener
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.common.module.R
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.bean.ArrivedStation
|
||||
import com.mogo.och.common.module.manager.autopilot.trajectory.TrajectoryManager
|
||||
import com.mogo.och.common.module.utils.CallerBase
|
||||
import com.zhjt.mogo.adas.data.AdasConstants
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.och.common.module.manager.autopilot.autopilot;
|
||||
package com.mogo.och.common.module.manager.autopilot.autopilot.bean;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
|
||||
@@ -16,10 +16,13 @@ import com.zhjt.service.chain.ChainLog
|
||||
object OchChainLogManager {
|
||||
|
||||
private val TAG = OchChainLogManager::class.java.simpleName
|
||||
|
||||
// 通用 title changeinfo 日志
|
||||
const val EVENT_KEY_INFE_WITH_CHANGE = "event_key_och_common_info_and_changeinfo"
|
||||
|
||||
// 轨迹信息监控
|
||||
const val EVENT_KEY_INFE_WITH_TRAJECTORY = "event_key_och_trajectory_info"
|
||||
|
||||
// 音乐播放日志
|
||||
const val EVENT_KEY_INFE_WITH_MUSIC = "event_key_och_music_info"
|
||||
|
||||
@@ -40,6 +43,9 @@ object OchChainLogManager {
|
||||
// 局域网内socket 连接状态流转
|
||||
const val EVENT_KEY_INFO_SCANNER = "analytics_event_och_scanner"
|
||||
|
||||
// 局域网内socket 连接状态流转
|
||||
const val EVENT_KEY_INFO_AUTOPILOT = "analytics_event_och_autopilot"
|
||||
|
||||
|
||||
fun writeChainLogNet(mustUpdate: Boolean, title: String, info: String) {
|
||||
if(mustUpdate){
|
||||
@@ -52,6 +58,9 @@ object OchChainLogManager {
|
||||
fun writeChainLogScanner(title: String, changeInfo: String) {
|
||||
writeChainLog(title, changeInfo, true, EVENT_KEY_INFO_SCANNER)
|
||||
}
|
||||
fun writeChainLogAutopilot(title: String, changeInfo: String) {
|
||||
writeChainLog(title, changeInfo, true, EVENT_KEY_INFO_AUTOPILOT)
|
||||
}
|
||||
|
||||
fun writeChainLogInit(title: String, info: String) {
|
||||
writeChainLog(title,info,true,EVENT_KEY_INFO_INIT)
|
||||
|
||||
@@ -25,6 +25,10 @@ public class BusStationBean {
|
||||
return nameKr;
|
||||
}
|
||||
|
||||
public void setNameKr(String nameKr) {
|
||||
this.nameKr = nameKr;
|
||||
}
|
||||
|
||||
public int getSiteId() {
|
||||
return siteId;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.mogo.och.data.bean
|
||||
|
||||
data class ContraiInfo(
|
||||
/**
|
||||
* 线路id
|
||||
*/
|
||||
val lineId: Long,
|
||||
|
||||
/**
|
||||
* csv格式的轨迹文件
|
||||
*/
|
||||
val csvFileUrl: String,
|
||||
|
||||
/**
|
||||
* csv_file_url 文件的md5值
|
||||
*/
|
||||
val csvFileMd5: String,
|
||||
|
||||
/**
|
||||
* txt格式的轨迹文件
|
||||
*/
|
||||
val txtFileUrl: String,
|
||||
|
||||
/**
|
||||
* txt文件的md5
|
||||
*/
|
||||
val txtFileMd5: String,
|
||||
|
||||
/**
|
||||
* 文件的保存时间
|
||||
*/
|
||||
val contrailSaveTime: Long,
|
||||
)
|
||||
@@ -35,7 +35,7 @@ import com.mogo.och.common.module.manager.socket.lan.bean.BaseDPMsg;
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.DPMsgType;
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.TaskDetailsMsg;
|
||||
import com.mogo.och.common.module.biz.login.LoginStatusManager;
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.ArrivedStation;
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.bean.ArrivedStation;
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager;
|
||||
import com.mogo.och.common.module.utils.OCHThreadPoolManager;
|
||||
import com.mogo.och.data.bean.BusStationBean;
|
||||
|
||||
@@ -17,7 +17,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListener
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.common.module.biz.login.LoginStatusEnum;
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.ArrivedStation;
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.bean.ArrivedStation;
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.IOchAutopilotStatusListener;
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutoPilotStatusListenerManager;
|
||||
import com.mogo.och.data.bean.BusStationBean;
|
||||
|
||||
@@ -31,7 +31,7 @@ import com.mogo.och.common.module.biz.login.LoginStatusManager;
|
||||
import com.mogo.och.common.module.callback.OchAdasStartFailureCallback;
|
||||
import com.mogo.och.common.module.constant.OchCommonConst;
|
||||
import com.mogo.och.common.module.manager.autopilot.OCHAdasAbilityManager;
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.ArrivedStation;
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.bean.ArrivedStation;
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutoPilotManager;
|
||||
import com.mogo.och.common.module.manager.autopilot.line.LineManager;
|
||||
import com.mogo.och.common.module.manager.autopilot.location.OchLocationManager;
|
||||
|
||||
@@ -17,7 +17,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListener
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.common.module.biz.login.LoginStatusEnum;
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.ArrivedStation;
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.bean.ArrivedStation;
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.IOchAutopilotStatusListener;
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutoPilotStatusListenerManager;
|
||||
import com.mogo.och.data.bean.BusStationBean;
|
||||
|
||||
@@ -1,72 +1,57 @@
|
||||
package com.mogo.och.weaknet.bean;
|
||||
package com.mogo.och.weaknet.bean
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.och.data.bean.BusRoutesResult;
|
||||
import com.mogo.och.data.bean.BusStationBean;
|
||||
import com.mogo.och.weaknet.database.bean.ContrailDataBean;
|
||||
import com.mogo.och.weaknet.database.bean.SiteDataBean;
|
||||
import com.mogo.och.weaknet.database.repository.ContraiRepository;
|
||||
import com.mogo.och.weaknet.database.repository.SiteRepository;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.och.data.bean.BusRoutesResult
|
||||
import com.mogo.och.data.bean.BusStationBean
|
||||
import com.mogo.och.weaknet.database.bean.TaskSiteDataBean
|
||||
import java.lang.Boolean
|
||||
import kotlin.String
|
||||
|
||||
/**
|
||||
* 网约车小巴路线接口请求响应结果
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class BusRoutesResponse extends BaseData {
|
||||
private BusRoutesResult data;
|
||||
class BusRoutesResponse : BaseData() {
|
||||
var result: BusRoutesResult? = null
|
||||
|
||||
public BusRoutesResult getResult() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setResult(BusRoutesResult data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
override fun toString(): String {
|
||||
return "BusRoutesResponse{" +
|
||||
"data=" + data +
|
||||
'}';
|
||||
"data=" + result +
|
||||
'}'
|
||||
}
|
||||
|
||||
public static void save2Db(@NotNull BusRoutesResponse data) {
|
||||
List<SiteDataBean> result = new ArrayList<>();
|
||||
SiteDataBean temp = null;
|
||||
if (data != null && data.data != null) {
|
||||
for (BusStationBean site : data.data.getSites()) {
|
||||
temp = new SiteDataBean();
|
||||
temp.setSiteId((long) site.getSiteId());
|
||||
temp.setLineId((long) (data.data.getLineId()));
|
||||
temp.setPlayTts(site.isPlayTts());
|
||||
temp.setGcjLat(site.getGcjLat());
|
||||
temp.setGcjLon(site.getGcjLon());
|
||||
temp.setLat(site.getLat());
|
||||
temp.setLon(site.getLon());
|
||||
temp.setName(site.getName());
|
||||
temp.setNameKr(site.getNameKr());
|
||||
temp.setSeq(site.getSeq());
|
||||
temp.setIntroduction(site.getIntroduction());
|
||||
result.add(temp);
|
||||
}
|
||||
SiteRepository.INSTANCE.addOrUpdate(result);
|
||||
companion object {
|
||||
|
||||
List<ContrailDataBean> resultContrailDataBean = new ArrayList<>();
|
||||
ContrailDataBean tempContrailDataBean = new ContrailDataBean();
|
||||
tempContrailDataBean.setContrailSaveTime(data.data.contrailSaveTime);
|
||||
tempContrailDataBean.setLineId((long) data.data.getLineId());
|
||||
tempContrailDataBean.setCsvFileMd5(data.data.csvFileMd5);
|
||||
tempContrailDataBean.setCsvFileUrl(data.data.csvFileUrl);
|
||||
tempContrailDataBean.setTxtFileUrl(data.data.txtFileUrl);
|
||||
tempContrailDataBean.setTxtFileMd5(data.data.txtFileMd5);
|
||||
resultContrailDataBean.add(tempContrailDataBean);
|
||||
ContraiRepository.INSTANCE.addOrUpdate(resultContrailDataBean);
|
||||
fun db2Beans(runnintTaskAndSites: List<TaskSiteDataBean>?): Triple<MutableList<BusStationBean>,BusStationBean?,Int> {
|
||||
val result = mutableListOf<BusStationBean>()
|
||||
var temp: BusStationBean? = null
|
||||
var currentStation: BusStationBean? = null
|
||||
var currentStationIndex = -1
|
||||
if (runnintTaskAndSites.isNullOrEmpty()) {
|
||||
return Triple(result,null,currentStationIndex)
|
||||
}
|
||||
runnintTaskAndSites.forEachIndexed { index, taskAndsite ->
|
||||
temp = BusStationBean()
|
||||
temp?.drivingStatus = (taskAndsite.drivingStatus ?: 0)
|
||||
temp?.lat = (taskAndsite.lat ?: 0.0)
|
||||
temp?.lon = (taskAndsite.lon ?: 0.0)
|
||||
temp?.gcjLat = (taskAndsite.gcjLat ?: 0.0)
|
||||
temp?.gcjLon = (taskAndsite.gcjLon ?: 0.0)
|
||||
temp?.introduction = taskAndsite.introduction
|
||||
temp?.isLeaving = Boolean.TRUE == taskAndsite.leaving
|
||||
temp?.name = taskAndsite.name
|
||||
temp?.nameKr = taskAndsite.nameKr
|
||||
temp?.isPlayTts = Boolean.TRUE == taskAndsite.isPlayTts
|
||||
temp?.seq = (taskAndsite.seq ?: 0)
|
||||
temp?.siteId = if (taskAndsite.siteId == null) 0 else taskAndsite.siteId!!.toInt()
|
||||
result.add(temp!!)
|
||||
if (temp!!.drivingStatus == 2) {
|
||||
currentStation = temp
|
||||
currentStationIndex = index
|
||||
}
|
||||
}
|
||||
return Triple(result,currentStation,currentStationIndex)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,10 @@ package com.mogo.och.weaknet.database.bean
|
||||
import androidx.room.ColumnInfo
|
||||
import androidx.room.Entity
|
||||
import androidx.room.PrimaryKey
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutoPilotManager
|
||||
import com.mogo.och.data.bean.ContraiInfo
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||
|
||||
/**
|
||||
* 启动自驾的信息
|
||||
@@ -57,6 +61,17 @@ data class ContrailDataBean(
|
||||
) {
|
||||
companion object {
|
||||
const val ContrailDataTable: String = "contrail_data_table"
|
||||
|
||||
fun save2Common(contrail:ContrailDataBean?) {
|
||||
contrail?.apply {
|
||||
if (lineId == null || lineId!! < 0L||csvFileUrl.isNullOrEmpty()||csvFileMd5.isNullOrEmpty()||txtFileUrl.isNullOrEmpty()||txtFileMd5.isNullOrEmpty()) {
|
||||
ToastUtils.showLong("请设置轨迹信息")
|
||||
OchChainLogManager.writeChainLogAutopilot("轨迹错误",this.toString())
|
||||
return
|
||||
}
|
||||
OchAutoPilotManager.contraiInfo = ContraiInfo(lineId!!,csvFileUrl!!,csvFileMd5!!,txtFileUrl!!,txtFileMd5!!,contrailSaveTime!!)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
|
||||
@@ -53,5 +53,14 @@ data class EventDataBean(
|
||||
) {
|
||||
companion object {
|
||||
const val evnetDataTable: String = "event_data_table"
|
||||
|
||||
const val TaskStart = "TaskStart"
|
||||
const val TaskArriveSite = "TaskArriveSite"
|
||||
const val TaskLeaveSite = "TaskLeaveSite"
|
||||
const val TaskEnd = "TaskEnd"
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ interface TaskDataDao {
|
||||
|
||||
// 查询当天特定线路正在执行的任务
|
||||
@Query("SELECT * FROM ${TaskDataBean.taskDataTable} WHERE task_get_time > :zeroTime and status = ${TaskDataBean.useing}")
|
||||
fun queryRunningTaskByStatusRx(zeroTime:Long = DateTimeUtil.getCurrentDateZero()): Observable<List<TaskDataBean>?>
|
||||
fun queryRunningTaskByStatus(zeroTime:Long = DateTimeUtil.getCurrentDateZero()): List<TaskDataBean>?
|
||||
|
||||
@Query("SELECT * FROM ${TaskDataBean.taskDataTable} WHERE task_get_time > :zeroTime and status = ${TaskDataBean.unUse} and line_id = :lineId")
|
||||
fun queryUnuseTask(lineId: Long,zeroTime:Long = DateTimeUtil.getCurrentDateZero()): Observable<List<TaskDataBean>?>
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.mogo.och.weaknet.database.dao
|
||||
import androidx.room.Dao
|
||||
import androidx.room.Insert
|
||||
import androidx.room.OnConflictStrategy
|
||||
import androidx.room.Query
|
||||
import com.mogo.och.weaknet.database.bean.TaskSiteDataBean
|
||||
|
||||
@Dao
|
||||
@@ -10,4 +11,9 @@ interface TaskSiteDataDao {
|
||||
//插入数据
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
fun insert(vararg lineDataBean: TaskSiteDataBean):List<Long>
|
||||
|
||||
//查询当天插入的所有数据
|
||||
@Query("SELECT * FROM ${TaskSiteDataBean.usedTaskDataTable} WHERE task_id > :taskId")
|
||||
fun queryRunningTask(taskId: Long): List<TaskSiteDataBean>?
|
||||
|
||||
}
|
||||
|
||||
@@ -40,4 +40,8 @@ object ContraiRepository {
|
||||
contrailDao?.deleteByLineId(lineId)
|
||||
}
|
||||
|
||||
fun queryAutopilotInfoByLineid(lineId: Long): ContrailDataBean? {
|
||||
return contrailDao?.queryContrailByLineIdOne(lineId)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,21 +1,71 @@
|
||||
package com.mogo.och.weaknet.database.repository
|
||||
|
||||
import com.mogo.eagle.core.network.utils.digest.DigestUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||
import com.mogo.och.weaknet.database.MyDataBase
|
||||
import com.mogo.och.weaknet.database.bean.ContrailDataBean
|
||||
import com.mogo.och.weaknet.database.dao.ContrailDataDao
|
||||
import com.mogo.och.weaknet.database.bean.EventDataBean
|
||||
import com.mogo.och.weaknet.database.dao.EventDataDao
|
||||
|
||||
object EventRepository {
|
||||
|
||||
private var eventDataDao: EventDataDao?=null
|
||||
private var eventDataDao: EventDataDao? = null
|
||||
|
||||
var eventCallback: EventCallback? = null
|
||||
|
||||
init {
|
||||
eventDataDao = MyDataBase.instance.eventDataDao
|
||||
}
|
||||
|
||||
fun saveEventTaskStart(taskId: Long) {
|
||||
val event = EventDataBean()
|
||||
event.eventType = EventDataBean.TaskStart
|
||||
event.taskId = taskId
|
||||
event.businessTime = DateTimeUtil.getCurrentTimeStamp()
|
||||
event.writeVersion = DateTimeUtil.getCurrentTimeStamp()
|
||||
event.siteId = 0L
|
||||
event.seq = 0
|
||||
eventDataDao?.insert()
|
||||
eventCallback?.notify()
|
||||
}
|
||||
|
||||
fun saveEventTaskArriveSite(taskId: Long,siteId:Long,seq:Int) {
|
||||
val event = EventDataBean()
|
||||
event.eventType = EventDataBean.TaskArriveSite
|
||||
event.taskId = taskId
|
||||
event.businessTime = DateTimeUtil.getCurrentTimeStamp()
|
||||
event.writeVersion = DateTimeUtil.getCurrentTimeStamp()
|
||||
event.siteId = siteId
|
||||
event.seq = seq
|
||||
eventDataDao?.insert()
|
||||
eventCallback?.notify()
|
||||
}
|
||||
|
||||
fun saveEventTaskLeaveSite(taskId: Long,siteId:Long,seq:Int) {
|
||||
val event = EventDataBean()
|
||||
event.eventType = EventDataBean.TaskLeaveSite
|
||||
event.taskId = taskId
|
||||
event.businessTime = DateTimeUtil.getCurrentTimeStamp()
|
||||
event.writeVersion = DateTimeUtil.getCurrentTimeStamp()
|
||||
event.siteId = siteId
|
||||
event.seq = seq
|
||||
eventDataDao?.insert()
|
||||
eventCallback?.notify()
|
||||
}
|
||||
|
||||
fun saveEventTaskEnd(taskId: Long) {
|
||||
val event = EventDataBean()
|
||||
event.eventType = EventDataBean.TaskEnd
|
||||
event.taskId = taskId
|
||||
event.businessTime = DateTimeUtil.getCurrentTimeStamp()
|
||||
event.writeVersion = DateTimeUtil.getCurrentTimeStamp()
|
||||
event.siteId = 0L
|
||||
event.seq = 0
|
||||
eventDataDao?.insert()
|
||||
eventCallback?.notify()
|
||||
}
|
||||
|
||||
interface EventCallback {
|
||||
fun notify()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -99,8 +99,8 @@ object TaskRepository {
|
||||
taskDataDao?.deleteByLineId(lineId)
|
||||
}
|
||||
|
||||
fun queryRunningTask(): Observable<List<TaskDataBean>?>? {
|
||||
return taskDataDao?.queryRunningTaskByStatusRx()
|
||||
fun queryRunningTask(): List<TaskDataBean>? {
|
||||
return taskDataDao?.queryRunningTaskByStatus()
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package com.mogo.och.weaknet.database.repository
|
||||
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.och.weaknet.database.MyDataBase
|
||||
import com.mogo.och.weaknet.database.bean.LineDataBean
|
||||
import com.mogo.och.weaknet.database.bean.TaskDataBean
|
||||
import com.mogo.och.weaknet.database.bean.TaskSiteDataBean
|
||||
import com.mogo.och.weaknet.database.dao.TaskSiteDataDao
|
||||
import com.mogo.och.weaknet.database.exception.DataException
|
||||
@@ -46,4 +43,8 @@ object TaskSiteRepository {
|
||||
|
||||
}
|
||||
|
||||
fun queryRunningTask(taskId: Long): List<TaskSiteDataBean>? {
|
||||
return taskSiteDataDao?.queryRunningTask(taskId)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,21 +6,24 @@ import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.network.utils.digest.DigestUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
||||
import com.mogo.och.common.module.manager.loop.LoopInfo
|
||||
import com.mogo.och.common.module.network.OchCommonServiceCallback
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||
import com.mogo.och.shuttle.weaknet.R
|
||||
import com.mogo.och.data.bean.BusStationBean
|
||||
import com.mogo.och.weaknet.bean.BusQueryLineTaskResponse
|
||||
import com.mogo.och.weaknet.bean.BusQueryLinesResponse
|
||||
import com.mogo.och.weaknet.bean.BusRoutesResponse
|
||||
import com.mogo.och.weaknet.bean.CarExecutableTaskResponse
|
||||
import com.mogo.och.weaknet.callback.IBusLinesCallback
|
||||
import com.mogo.och.weaknet.database.bean.ContrailDataBean
|
||||
import com.mogo.och.weaknet.database.repository.ContraiRepository
|
||||
import com.mogo.och.weaknet.database.repository.EventRepository
|
||||
import com.mogo.och.weaknet.database.repository.LineRepository
|
||||
import com.mogo.och.weaknet.database.repository.TaskRepository
|
||||
import com.mogo.och.weaknet.database.repository.TaskSiteRepository
|
||||
import com.mogo.och.weaknet.database.transform.FRetryWithTime11
|
||||
import com.mogo.och.weaknet.database.transform.TransformTask
|
||||
import com.mogo.och.weaknet.database.transform.transform4DataBase
|
||||
@@ -39,19 +42,32 @@ object BusLineModel {
|
||||
private var mBusLinesCallback: IBusLinesCallback? = null
|
||||
private const val TAG = "BusLineModel"
|
||||
private const val LoopCarInfo = "LoopCarInfo"
|
||||
|
||||
// 判断接口是否变化
|
||||
private const val executableChangeMd5 = "EXECUTABLECHANGEMD5"
|
||||
|
||||
// 展示上一次刷新时间
|
||||
private const val executableChangeTime = "executablechangetime"
|
||||
|
||||
// 当前任务的站点列表
|
||||
private var stationList = mutableListOf<BusStationBean>()
|
||||
|
||||
// 当前站点
|
||||
private var startStation: BusStationBean? = null
|
||||
private var startStationIndex: Int = -1
|
||||
private var endStation: BusStationBean? = null
|
||||
|
||||
@JvmStatic
|
||||
fun init() {
|
||||
mContext = AbsMogoApplication.getApp()
|
||||
BizLoopManager.setLoopFunction("${TAG}_${LoopCarInfo}", LoopInfo(60, ::queryCarExecutableTaskList,immediately = true))
|
||||
BizLoopManager.setLoopFunction(
|
||||
"${TAG}_${LoopCarInfo}",
|
||||
LoopInfo(60, ::queryCarExecutableTaskList, immediately = true)
|
||||
)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun release(){
|
||||
fun release() {
|
||||
mContext = null
|
||||
mBusLinesCallback = null
|
||||
BizLoopManager.removeLoopFunction("${TAG}_${LoopCarInfo}")
|
||||
@@ -65,30 +81,37 @@ object BusLineModel {
|
||||
/**
|
||||
* 同步基础信息
|
||||
*/
|
||||
private fun queryCarExecutableTaskList(){
|
||||
private fun queryCarExecutableTaskList() {
|
||||
mContext?.let {
|
||||
OrderServiceManager.queryCarExecutableTaskList(it, object : OchCommonServiceCallback<CarExecutableTaskResponse> {
|
||||
override fun onSuccess(data: CarExecutableTaskResponse) {
|
||||
// 第一次过滤 请求返回值的md5
|
||||
val currentRequest = DigestUtils.md5Hex(data.data.toString())
|
||||
val lastChangeMd5 = SharedPrefsMgr.getInstance().getString(executableChangeMd5)
|
||||
SharedPrefsMgr.getInstance().putLong(executableChangeTime,DateTimeUtil.getCurrentTimeStamp())
|
||||
if(currentRequest==lastChangeMd5){
|
||||
return
|
||||
OrderServiceManager.queryCarExecutableTaskList(
|
||||
it,
|
||||
object : OchCommonServiceCallback<CarExecutableTaskResponse> {
|
||||
override fun onSuccess(data: CarExecutableTaskResponse) {
|
||||
// 第一次过滤 请求返回值的md5
|
||||
val currentRequest = DigestUtils.md5Hex(data.data.toString())
|
||||
val lastChangeMd5 =
|
||||
SharedPrefsMgr.getInstance().getString(executableChangeMd5)
|
||||
SharedPrefsMgr.getInstance()
|
||||
.putLong(executableChangeTime, DateTimeUtil.getCurrentTimeStamp())
|
||||
if (currentRequest == lastChangeMd5) {
|
||||
return
|
||||
}
|
||||
SharedPrefsMgr.getInstance().putString(executableChangeMd5, currentRequest)
|
||||
OchChainLogManager.writeChainLog(
|
||||
"数据发生变化",
|
||||
"接口信息发生变化 ${lastChangeMd5} new md5${currentRequest}"
|
||||
)
|
||||
CarExecutableTaskResponse.save2Db(data)
|
||||
}
|
||||
SharedPrefsMgr.getInstance().putString(executableChangeMd5,currentRequest)
|
||||
OchChainLogManager.writeChainLog("数据发生变化","接口信息发生变化 ${lastChangeMd5} new md5${currentRequest}")
|
||||
CarExecutableTaskResponse.save2Db(data)
|
||||
}
|
||||
|
||||
override fun onError() {
|
||||
override fun onError() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, failMsg: String) {
|
||||
override fun onFail(code: Int, failMsg: String) {
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
@@ -155,24 +178,55 @@ object BusLineModel {
|
||||
* 开始任务
|
||||
*/
|
||||
@JvmStatic
|
||||
fun commitSwitchLineId(taskId: Long, lineId: Long,lineName: String) {
|
||||
TaskRepository.startTask(taskId,lineId, lineName,object :TaskRepository.TaskStatusCallback{
|
||||
override fun startSuccess() {
|
||||
SharedPrefsMgr.getInstance().putLong(BusSwitchLineActivity.LASTCOMMITLINEID, lineId)
|
||||
if (mBusLinesCallback != null) {
|
||||
mBusLinesCallback!!.onChangeLineIdSuccess()
|
||||
fun commitSwitchLineId(taskId: Long, lineId: Long, lineName: String) {
|
||||
TaskRepository.startTask(
|
||||
taskId,
|
||||
lineId,
|
||||
lineName,
|
||||
object : TaskRepository.TaskStatusCallback {
|
||||
override fun startSuccess() {
|
||||
SharedPrefsMgr.getInstance()
|
||||
.putLong(BusSwitchLineActivity.LASTCOMMITLINEID, lineId)
|
||||
EventRepository.saveEventTaskStart(taskId)
|
||||
if (mBusLinesCallback != null) {
|
||||
mBusLinesCallback!!.onChangeLineIdSuccess()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun startFail(msg:String) {
|
||||
ToastUtils.showShort("选择任务失败:$msg")
|
||||
}
|
||||
override fun startFail(msg: String) {
|
||||
ToastUtils.showShort("选择任务失败:$msg")
|
||||
}
|
||||
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// 1、从别的数据库加载任务
|
||||
// 2、本地没有从远端恢复任务
|
||||
fun loadStartedTaskAndDefaultInfo(){
|
||||
TaskRepository.queryRunningTask()
|
||||
fun loadStartedTaskAndDefaultInfo() {
|
||||
val runningTaskInfo = TaskRepository.queryRunningTask()
|
||||
|
||||
if (runningTaskInfo.isNullOrEmpty()) {
|
||||
// todo: 尝试加载远程数据
|
||||
} else if (runningTaskInfo.size > 1) {
|
||||
// TODO: 1 清理本地数据 2 加载后台数据
|
||||
} else {
|
||||
val first = runningTaskInfo.first()
|
||||
// 恢复站点信息
|
||||
first.taskId?.let {
|
||||
val runnintTaskAndSites = TaskSiteRepository.queryRunningTask(it)
|
||||
val db2Beans = BusRoutesResponse.db2Beans(runnintTaskAndSites)
|
||||
stationList = db2Beans.first
|
||||
startStation = db2Beans.second
|
||||
startStationIndex = db2Beans.third
|
||||
if (startStationIndex < stationList.size) {
|
||||
endStation = stationList[startStationIndex + 1]
|
||||
}
|
||||
}
|
||||
// 设置自动驾驶信息
|
||||
first.lineId?.let {
|
||||
val contraiInfoTemp = ContraiRepository.queryAutopilotInfoByLineid(it)
|
||||
ContrailDataBean.save2Common(contraiInfoTemp)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,12 +13,8 @@ import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.cancelAutoPilot
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.isCanStartAutopilot
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.setIPCDemoMode
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.setIgnoreConditionDraw
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getState
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.e
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
@@ -32,7 +28,7 @@ import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.och.common.module.biz.login.LoginStatusManager
|
||||
import com.mogo.och.common.module.callback.OchAdasStartFailureCallback
|
||||
import com.mogo.och.common.module.manager.autopilot.OCHAdasAbilityManager
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.ArrivedStation
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.bean.ArrivedStation
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutoPilotManager.canStartAutoPilot
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutoPilotManager.canStartAutoPilotSSM
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutoPilotManager.startAutoPilot
|
||||
@@ -65,7 +61,6 @@ import com.mogo.och.common.module.voice.VoiceNotice.showNotice
|
||||
import com.mogo.och.data.bean.BusRoutesResult
|
||||
import com.mogo.och.data.bean.BusStationBean
|
||||
import com.mogo.och.data.bean.BusTransferData
|
||||
import com.mogo.och.data.manager.cache.CacheDataManager
|
||||
import com.mogo.och.shuttle.weaknet.R
|
||||
import com.mogo.och.weaknet.bean.BusRoutesResponse
|
||||
import com.mogo.och.weaknet.callback.IBusADASStatusCallback
|
||||
@@ -95,7 +90,7 @@ object OrderModel {
|
||||
var currentStationIndex: Int = 0 //A->B 此处值是A站点索引
|
||||
private set
|
||||
private var mContext: Context? = null
|
||||
private val stationList: MutableList<BusStationBean>? = ArrayList()
|
||||
private val stationList: MutableList<BusStationBean> = ArrayList()
|
||||
@JvmStatic
|
||||
var busRoutesResult: BusRoutesResult? = null
|
||||
private set
|
||||
@@ -135,13 +130,19 @@ object OrderModel {
|
||||
OCHAdasAbilityManager.getInstance().setAdasStartFailureCallback(mAdasStartFailureListener)
|
||||
|
||||
//监听运营消息
|
||||
OCHSocketMessageManager.registerSocketMessageListener(OCHSocketMessageManager.msgMonitorType, OperateAction(true))
|
||||
OCHSocketMessageManager.registerSocketMessageListener(
|
||||
OCHSocketMessageManager.msgMonitorType,
|
||||
OperateAction(true)
|
||||
)
|
||||
|
||||
// 长链接监听
|
||||
AbnormalFactorsLoopManager.startLoopAbnormalFactors(AbsMogoApplication.getApp())
|
||||
|
||||
//监听乘客屏发来的消息
|
||||
LanSocketManager.registerSocketMessageListener(DPMsgType.TYPE_TASK_DETAILS.type,taskDetailsMsgListener)
|
||||
LanSocketManager.registerSocketMessageListener(
|
||||
DPMsgType.TYPE_TASK_DETAILS.type,
|
||||
taskDetailsMsgListener
|
||||
)
|
||||
|
||||
RxUtils.errCatch()
|
||||
}
|
||||
@@ -160,7 +161,10 @@ object OrderModel {
|
||||
|
||||
AbnormalFactorsLoopManager.stopLoopAbnormalFactors()
|
||||
//监听乘客屏发来的消息
|
||||
LanSocketManager.unRegisterSocketMessageListener(DPMsgType.TYPE_TASK_DETAILS.type,taskDetailsMsgListener)
|
||||
LanSocketManager.unRegisterSocketMessageListener(
|
||||
DPMsgType.TYPE_TASK_DETAILS.type,
|
||||
taskDetailsMsgListener
|
||||
)
|
||||
}
|
||||
|
||||
// 乘客屏请求线路信息
|
||||
@@ -194,10 +198,7 @@ object OrderModel {
|
||||
override fun brakeStatusChanged(isBrakeAvailable: Boolean) {
|
||||
}
|
||||
|
||||
override fun onStartAutopilotFailure(
|
||||
startFailedCode: String,
|
||||
startFailedMessage: String
|
||||
) {
|
||||
override fun onStartAutopilotFailure(startFailedCode: String, startFailedMessage: String) {
|
||||
BusAnalyticsManager.triggerStartAutopilotFailureEventByAdas(
|
||||
startFailedCode,
|
||||
startFailedMessage,
|
||||
@@ -212,19 +213,20 @@ object OrderModel {
|
||||
|
||||
// 自车定位
|
||||
private val mMapLocationListener = object : IMoGoChassisLocationGCJ02Listener {
|
||||
override fun onChassisLocationGCJ02(mogoLocation: MogoLocation?) {
|
||||
if (null == mogoLocation) return
|
||||
override fun onChassisLocationGCJ02(mogoLocation: MogoLocation?) {
|
||||
if (null == mogoLocation) return
|
||||
|
||||
//是否到站的围栏判断 离站状态并且自动驾驶还未触发到站
|
||||
if (isGoingToNextStation && !isArrivedStation) {
|
||||
OCHThreadPoolManager.getsInstance().locationExecute { judgeArrivedStation(mogoLocation) }
|
||||
}
|
||||
//是否到站的围栏判断 离站状态并且自动驾驶还未触发到站
|
||||
if (isGoingToNextStation && !isArrivedStation) {
|
||||
OCHThreadPoolManager.getsInstance()
|
||||
.locationExecute { judgeArrivedStation(mogoLocation) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//根据围栏判断,是否到达站点
|
||||
private fun judgeArrivedStation(location: MogoLocation) {
|
||||
if (currentStationIndex + 1 > stationList!!.size - 1) {
|
||||
if (currentStationIndex + 1 > stationList.size - 1) {
|
||||
e(SceneConstant.M_BUS + TAG, "到站数组越界")
|
||||
return
|
||||
}
|
||||
@@ -246,111 +248,63 @@ object OrderModel {
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun queryBusCacheRoutes() {
|
||||
val loginStr = CacheDataManager.instance.getCacheData(
|
||||
mContext!!, BusCacheKey.BUS_LOGIN_STATUS_CACHE
|
||||
)
|
||||
if (!loginStr.isEmpty()) {
|
||||
val status = GsonUtils.fromJson(loginStr, LoginCacheStatus::class.java)
|
||||
LoginStatusManager.setLoginStatus(status.loginStatus)
|
||||
if (status.updateTime > DateTimeUtil.getTodayStartTime() &&
|
||||
status.loginStatus == 1
|
||||
) { //登陆
|
||||
|
||||
val cacheData = CacheDataManager.instance.getCacheData(
|
||||
mContext!!,
|
||||
BusCacheKey.BUS_LINE_CACHE
|
||||
)
|
||||
|
||||
if (cacheData == null || cacheData.isEmpty()) {
|
||||
queryBusRoutes()
|
||||
} else {
|
||||
val data = GsonUtils.fromJson(cacheData, BusTransferData::class.java)
|
||||
getCacheRouteSuccess(data.routesResult)
|
||||
}
|
||||
} else { // 未登陆
|
||||
CacheDataManager.instance.clearCacheData(
|
||||
mContext!!,
|
||||
BusCacheKey.BUS_LOGIN_STATUS_CACHE
|
||||
)
|
||||
sendTaskDetailsToClients()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun getCacheRouteSuccess(data: BusRoutesResult?) {
|
||||
if (data == null || data.sites == null || data.sites.isEmpty() || data.writeVersion < DateTimeUtil.getTodayStartTime()) {
|
||||
//当为空时,显示无绑定路线图
|
||||
queryBusRoutes()
|
||||
CacheDataManager.instance.clearCacheData(mContext!!, BusCacheKey.BUS_LINE_CACHE)
|
||||
return
|
||||
}
|
||||
d(SceneConstant.M_BUS + TAG, "获取到小巴路线数据: " + GsonUtils.toJson(data))
|
||||
updateBusStatus(data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询小巴路线
|
||||
*/
|
||||
@JvmStatic
|
||||
fun queryBusRoutes() {
|
||||
d(SceneConstant.M_BUS + TAG, "查询小巴路线")
|
||||
OrderServiceManager.queryBusRoutes(mContext!!, object : OchCommonServiceCallback<BusRoutesResponse> {
|
||||
override fun onSuccess(data: BusRoutesResponse) {
|
||||
if (data?.result == null || data.result.sites == null || data.result.sites.isEmpty()) {
|
||||
d(M_BUS + TAG, "查询小巴路线")
|
||||
OrderServiceManager.queryBusRoutes(
|
||||
mContext!!,
|
||||
object : OchCommonServiceCallback<BusRoutesResponse> {
|
||||
override fun onSuccess(data: BusRoutesResponse) {
|
||||
if (data.result == null || data.result!!.sites == null || data.result!!.sites.isEmpty()) {
|
||||
// //当为空时,显示无绑定路线图
|
||||
d(SceneConstant.M_BUS + TAG, "获取到小巴路线数据:空 ")
|
||||
if (refreshBusStationsCallback != null) {
|
||||
refreshBusStationsCallback!!.updateEmptyUi()
|
||||
d(M_BUS + TAG, "获取到小巴路线数据:空 ")
|
||||
if (refreshBusStationsCallback != null) {
|
||||
refreshBusStationsCallback!!.updateEmptyUi()
|
||||
}
|
||||
updateBusStatus(null)
|
||||
clearAutopilotControlParameters()
|
||||
closeBeautificationMode()
|
||||
clearStartAutopilotTag()
|
||||
removeTipRunnables()
|
||||
return
|
||||
}
|
||||
|
||||
if (busRoutesResult == null || busRoutesResult!!.writeVersion < data.result!!.writeVersion) {
|
||||
d(M_BUS + TAG, "更新小巴路线数据: $data")
|
||||
updateBusStatus(data.result)
|
||||
}
|
||||
updateBusStatus(null)
|
||||
clearAutopilotControlParameters()
|
||||
closeBeautificationMode()
|
||||
clearStartAutopilotTag()
|
||||
removeTipRunnables()
|
||||
CacheDataManager.instance.clearCacheData(mContext!!, BusCacheKey.BUS_LINE_CACHE)
|
||||
return
|
||||
}
|
||||
|
||||
BusRoutesResponse.save2Db(data)
|
||||
|
||||
if (busRoutesResult == null || busRoutesResult!!.writeVersion < data.result.writeVersion) {
|
||||
d(SceneConstant.M_BUS + TAG, "更新小巴路线数据: $data")
|
||||
updateBusStatus(data.result)
|
||||
pushCacheTransferData(data.result)
|
||||
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))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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))
|
||||
override fun onFail(code: Int, failMsg: String) {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
ToastUtils.showShort("网络异常,请稍后重试")
|
||||
} else {
|
||||
ToastUtils.showShort(failMsg)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, failMsg: String) {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
ToastUtils.showShort("网络异常,请稍后重试")
|
||||
} else {
|
||||
ToastUtils.showShort(failMsg)
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新正在运行的任务UI
|
||||
*
|
||||
* @param stations
|
||||
*/
|
||||
private fun updateBusTaskStatus(stations: List<BusStationBean>?) {
|
||||
private fun updateBusTaskStatus() {
|
||||
var arrivingOrArrivedStationIndex = 0 //已经到站或者即将到站的索引呢
|
||||
|
||||
for (i in stations!!.indices) {
|
||||
val station = stations[i]
|
||||
for (i in stationList.indices) {
|
||||
val station = stationList[i]
|
||||
|
||||
if (i == 0) { // 首发站 显示在最上面
|
||||
if (station.drivingStatus == BusConst.STATION_STATUS_STOPPED
|
||||
@@ -360,7 +314,7 @@ object OrderModel {
|
||||
break
|
||||
}
|
||||
} else {
|
||||
val preStation = stations[i - 1]
|
||||
val preStation = stationList[i - 1]
|
||||
if ((station.drivingStatus == BusConst.STATION_STATUS_STOPPED && !station.isLeaving)
|
||||
|| (station.drivingStatus == BusConst.STATION_STATUS_ARRIVING
|
||||
&& preStation.isLeaving)
|
||||
@@ -372,7 +326,7 @@ object OrderModel {
|
||||
}
|
||||
}
|
||||
|
||||
val arrivingOrArrivedStation = stations[arrivingOrArrivedStationIndex]
|
||||
val arrivingOrArrivedStation = stationList[arrivingOrArrivedStationIndex]
|
||||
|
||||
val lineTime = DateTimeUtil.formatLongToString(
|
||||
busRoutesResult!!.taskTime,
|
||||
@@ -421,7 +375,7 @@ object OrderModel {
|
||||
queryBusRoutes()
|
||||
removeTipRunnables()
|
||||
// 取消自驾
|
||||
cancelAutoPilot()
|
||||
CallerAutoPilotControlManager.cancelAutoPilot()
|
||||
setTrajectoryStation(null, null, -1L)
|
||||
}
|
||||
}
|
||||
@@ -461,7 +415,6 @@ object OrderModel {
|
||||
)
|
||||
}
|
||||
|
||||
CacheDataManager.instance.clearCacheData(mContext!!, BusCacheKey.BUS_LINE_CACHE)
|
||||
busRoutesResult = null
|
||||
|
||||
sendTaskDetailsToClients()
|
||||
@@ -483,7 +436,7 @@ object OrderModel {
|
||||
|
||||
if (busRoutesResult != null) {
|
||||
var isLastStop = false
|
||||
if (leaveIndex + 1 == stationList!!.size - 1) {
|
||||
if (leaveIndex + 1 == stationList.size - 1) {
|
||||
isLastStop = true
|
||||
}
|
||||
//给bus外屏发送
|
||||
@@ -499,10 +452,7 @@ object OrderModel {
|
||||
reBuildCacheRouteData(leaveIndex, BusConst.STATION_STATUS_STOPPED, true, writeVersion)
|
||||
}
|
||||
|
||||
private fun reBuildCacheRouteData(
|
||||
currentIndex: Int, currentDrivingStatus: Int, isLeaving: Boolean,
|
||||
writeVersion: Long
|
||||
) {
|
||||
private fun reBuildCacheRouteData(currentIndex: Int, currentDrivingStatus: Int, isLeaving: Boolean, writeVersion: Long) {
|
||||
if (busRoutesResult != null) {
|
||||
busRoutesResult!!.writeVersion = writeVersion
|
||||
val sites = busRoutesResult!!.sites
|
||||
@@ -517,8 +467,6 @@ object OrderModel {
|
||||
sites[currentIndex - 1] = beanPre
|
||||
}
|
||||
|
||||
pushCacheTransferData(busRoutesResult!!)
|
||||
|
||||
updateBusStatus(busRoutesResult)
|
||||
}
|
||||
}
|
||||
@@ -526,8 +474,7 @@ object OrderModel {
|
||||
private fun onStartAutopilot(leaveIndex: Int) {
|
||||
//开启自动驾驶 2.10.0: 如果自动驾驶状态下开启, 非自动驾驶状态下不开启,需手动点击自动驾驶按钮开启
|
||||
isGoingToNextStation = true
|
||||
if (getState()
|
||||
== IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
|
||||
if (CallerAutoPilotStatusListenerManager.getState() == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
|
||||
) {
|
||||
startAutopilot(false, leaveIndex)
|
||||
} else {
|
||||
@@ -560,7 +507,7 @@ object OrderModel {
|
||||
}
|
||||
}
|
||||
//2、6个条件判断
|
||||
if (!isCanStartAutopilot(true, 0)) {
|
||||
if (!CallerAutoPilotControlManager.isCanStartAutopilot(true, 0)) {
|
||||
return
|
||||
}
|
||||
// 3、距离轨迹15m计算
|
||||
@@ -568,7 +515,7 @@ object OrderModel {
|
||||
var resion = canStartAutoPilot(busRoutesResult!!.lineId)
|
||||
if (TrajectoryAndDistanceManager.errorTypeNoneLineId == resion) {
|
||||
val nextStationPoint = MogoLocation()
|
||||
if (currentStationIndex < stationList!!.size - 1) {
|
||||
if (currentStationIndex < stationList.size - 1) {
|
||||
val nextStation = stationList[currentStationIndex + 1]
|
||||
nextStationPoint.longitude = nextStation.gcjLon
|
||||
nextStationPoint.latitude = nextStation.gcjLat
|
||||
@@ -624,7 +571,7 @@ object OrderModel {
|
||||
*/
|
||||
private fun arriveSiteStation(changeInfo: String) {
|
||||
writeChainLog("触发进站", changeInfo)
|
||||
if (currentStationIndex + 1 > stationList!!.size - 1) { //到站短时间内调用多次
|
||||
if (currentStationIndex + 1 > stationList.size - 1) { //到站短时间内调用多次
|
||||
e(SceneConstant.M_BUS + TAG, "数组越界")
|
||||
return
|
||||
}
|
||||
@@ -713,16 +660,6 @@ object OrderModel {
|
||||
LanSocketManager.sendMsgToClient(msg)
|
||||
}
|
||||
|
||||
private fun pushCacheTransferData(result: BusRoutesResult) {
|
||||
val data = BusTransferData(if (LoginStatusManager.isLogin()) 1 else 0, result)
|
||||
d(M_BUS + TAG, "pushCacheTransferData = " + GsonUtils.toJson(data))
|
||||
CacheDataManager.instance.putCacheData(
|
||||
mContext!!,
|
||||
BusCacheKey.BUS_LINE_CACHE,
|
||||
GsonUtils.toJson(data)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 离站上报
|
||||
@@ -736,10 +673,10 @@ object OrderModel {
|
||||
var nextStationName = ""
|
||||
var nextStationNameKr = ""
|
||||
val nextStationPoint = MogoLocation()
|
||||
if (currentStationIndex < stationList!!.size - 1) {
|
||||
if (currentStationIndex < stationList.size - 1) {
|
||||
val nextStation = stationList[currentStationIndex + 1]
|
||||
nextStationName = nextStation.name
|
||||
nextStationNameKr = nextStation.nameKr?:""
|
||||
nextStationNameKr = nextStation.nameKr ?: ""
|
||||
nextStationPoint.longitude = nextStation.gcjLon
|
||||
nextStationPoint.latitude = nextStation.gcjLat
|
||||
}
|
||||
@@ -748,7 +685,7 @@ object OrderModel {
|
||||
val finalNextStationNameKr = nextStationNameKr
|
||||
|
||||
isArrivedStation = false
|
||||
d(SceneConstant.M_BUS + TAG, "行程日志-离站成功开往下一站====")
|
||||
d(M_BUS + TAG, "行程日志-离站成功开往下一站====")
|
||||
|
||||
val writeVersion = DateTimeUtil.getCurrentTimeStamp()
|
||||
leaveStationSuccess(
|
||||
@@ -803,8 +740,8 @@ object OrderModel {
|
||||
fun closeBeautificationMode() {
|
||||
if (FunctionBuildConfig.isDemoMode) { //收车结束美化
|
||||
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = false //是否强制绘制引导线
|
||||
setIgnoreConditionDraw(false) // 同步给乘客屏
|
||||
setIPCDemoMode(false) //是否自动启动自驾
|
||||
CallerAutoPilotControlManager.setIgnoreConditionDraw(false) // 同步给乘客屏
|
||||
CallerAutoPilotControlManager.setIPCDemoMode(false) //是否自动启动自驾
|
||||
d(SceneConstant.M_BUS + TAG, "美化模式-ignore:置为false")
|
||||
}
|
||||
}
|
||||
@@ -814,7 +751,7 @@ object OrderModel {
|
||||
*/
|
||||
@JvmStatic
|
||||
fun autoDriveToNextStation() {
|
||||
if (currentStationIndex >= stationList!!.size - 1) {
|
||||
if (currentStationIndex >= stationList.size - 1) {
|
||||
// 当前站是最后一站,结束当前行程
|
||||
travelOver()
|
||||
return
|
||||
@@ -836,15 +773,12 @@ object OrderModel {
|
||||
}
|
||||
busRoutesResult = result
|
||||
setLineId(busRoutesResult!!.lineId)
|
||||
stationList!!.clear()
|
||||
stationList.clear()
|
||||
stationList.addAll(result.sites)
|
||||
for (i in stationList.indices) {
|
||||
val s = stationList[i]
|
||||
|
||||
d(
|
||||
SceneConstant.M_BUS + "updateBusStationsStatus--",
|
||||
"Index=" + i + " ,name = " + s.name + " ," + s.isLeaving + "," + s.drivingStatus
|
||||
)
|
||||
d("${M_BUS}updateBusStationsStatus", "Index=$i ,name = ${s.name} ,${s.isLeaving},${s.drivingStatus}")
|
||||
|
||||
// 是否正在开往下一站
|
||||
if (s.isLeaving) {
|
||||
@@ -876,12 +810,7 @@ object OrderModel {
|
||||
|
||||
val currentStation = stationList[currentStationIndex]
|
||||
|
||||
d(
|
||||
SceneConstant.M_BUS + TAG,
|
||||
"行程日志-STATION_STATUS_STOPPED-backgroundCurrentStationIndex="
|
||||
+ currentStationIndex
|
||||
+ " isLeaving()=" + currentStation.isLeaving
|
||||
)
|
||||
d(M_BUS + TAG, "行程日志-STATION_STATUS_STOPPED-backgroundCurrentStationIndex=${currentStationIndex} isLeaving()=${currentStation.isLeaving}")
|
||||
|
||||
// 美化是否开始
|
||||
if (FunctionBuildConfig.isDemoMode && (currentStationIndex >= 0
|
||||
@@ -889,11 +818,11 @@ object OrderModel {
|
||||
) { //行驶过程中设置美化
|
||||
if (stationList[currentStationIndex].isLeaving) {
|
||||
startBeautificationMode()
|
||||
d(SceneConstant.M_BUS + TAG, "美化模式-ignore:置为true(每次滑动出发)")
|
||||
d(M_BUS + TAG, "美化模式-ignore:置为true(每次滑动出发)")
|
||||
} else if (currentStationIndex > 0 && currentStationIndex < stationList.size - 1) {
|
||||
//美化模式下 中间站点到站 引导线要一直绘制,所以此处不出强制绘制不传false
|
||||
setIPCDemoMode(false)
|
||||
d(SceneConstant.M_BUS + TAG, "美化模式-ignore:false(到达中间站)")
|
||||
CallerAutoPilotControlManager.setIPCDemoMode(false)
|
||||
d(M_BUS + TAG, "美化模式-ignore:false(到达中间站)")
|
||||
clearStartAutopilotTag()
|
||||
} else {
|
||||
closeBeautificationMode()
|
||||
@@ -909,7 +838,7 @@ object OrderModel {
|
||||
sendTaskDetailsToClients()
|
||||
|
||||
//更新bus路线面板
|
||||
updateBusTaskStatus(stationList)
|
||||
updateBusTaskStatus()
|
||||
|
||||
//需放在currentStationIndex赋值之后
|
||||
BusTrajectoryManager.getInstance().syncTrajectoryInfo()
|
||||
@@ -934,7 +863,7 @@ object OrderModel {
|
||||
}
|
||||
|
||||
private var tip3Runnable = Runnable {
|
||||
if (currentStationIndex == 0 && stationList!![0].drivingStatus == BusConst.STATION_STATUS_STOPPED && !stationList[0].isLeaving
|
||||
if (currentStationIndex == 0 && stationList[0].drivingStatus == BusConst.STATION_STATUS_STOPPED && !stationList[0].isLeaving
|
||||
) {
|
||||
tipStartTask("3")
|
||||
} else {
|
||||
@@ -942,8 +871,17 @@ object OrderModel {
|
||||
}
|
||||
}
|
||||
|
||||
private var tip1Runnable = Runnable {
|
||||
if (currentStationIndex == 0 && stationList[0].drivingStatus == BusConst.STATION_STATUS_STOPPED && !stationList[0].isLeaving
|
||||
) {
|
||||
tipStartTask("1")
|
||||
} else {
|
||||
removeTipRunnables()
|
||||
}
|
||||
}
|
||||
|
||||
private fun tipStartTask(s: String) {
|
||||
val tips = ResourcesUtils.getString(R.string.bus_before_tips_s,s)
|
||||
val tips = ResourcesUtils.getString(R.string.bus_before_tips_s, s)
|
||||
//展示在运营消息
|
||||
OCHSocketMessageManager.pushAppOperationalMsgBox(
|
||||
DateTimeUtil.getCurrentTimeStamp(),
|
||||
@@ -952,14 +890,7 @@ object OrderModel {
|
||||
ShuttleVoiceManager.showLeafTime(tips)
|
||||
}
|
||||
|
||||
private var tip1Runnable = Runnable {
|
||||
if (currentStationIndex == 0 && stationList != null && stationList[0].drivingStatus == BusConst.STATION_STATUS_STOPPED && !stationList[0].isLeaving
|
||||
) {
|
||||
tipStartTask("1")
|
||||
} else {
|
||||
removeTipRunnables()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun removeTipRunnables() {
|
||||
UiThreadHandler.removeCallbacks(tip3Runnable)
|
||||
@@ -972,8 +903,8 @@ object OrderModel {
|
||||
|
||||
private fun startBeautificationMode() {
|
||||
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = true
|
||||
setIgnoreConditionDraw(true)
|
||||
setIPCDemoMode(true)
|
||||
CallerAutoPilotControlManager.setIgnoreConditionDraw(true)
|
||||
CallerAutoPilotControlManager.setIPCDemoMode(true)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@@ -988,7 +919,7 @@ object OrderModel {
|
||||
*/
|
||||
@JvmStatic
|
||||
fun restartAutopilot() {
|
||||
d(SceneConstant.M_BUS + TAG, "行程日志-重启自动驾驶===$isGoingToNextStation")
|
||||
d(M_BUS + TAG, "行程日志-重启自动驾驶===$isGoingToNextStation")
|
||||
//只去启动自动驾驶,不再去上报离站
|
||||
startAutopilot(firstStartAutopilot >= 1, -1)
|
||||
}
|
||||
@@ -1001,12 +932,12 @@ object OrderModel {
|
||||
* 行程结束
|
||||
*/
|
||||
private fun travelOver() {
|
||||
if (currentStationIndex >= stationList!!.size) {
|
||||
if (currentStationIndex >= stationList.size) {
|
||||
e(SceneConstant.M_BUS + TAG, "travel over index out of station list")
|
||||
return
|
||||
}
|
||||
d(SceneConstant.M_BUS + TAG, "单程结束====")
|
||||
cancelAutoPilot()
|
||||
CallerAutoPilotControlManager.cancelAutoPilot()
|
||||
setTrajectoryStation(null, null, -1L)
|
||||
endTask()
|
||||
}
|
||||
@@ -1055,7 +986,7 @@ object OrderModel {
|
||||
*/
|
||||
@JvmStatic
|
||||
fun onArriveAt(data: ArrivedStation?, type: String) {
|
||||
if (currentStationIndex + 1 > stationList!!.size - 1) {
|
||||
if (currentStationIndex + 1 > stationList.size - 1) {
|
||||
e(SceneConstant.M_BUS + TAG, "行程日志-到站异常,取消后续操作结束")
|
||||
return
|
||||
}
|
||||
@@ -1093,7 +1024,7 @@ object OrderModel {
|
||||
|
||||
@JvmStatic
|
||||
fun triggerStartServiceEvent(isRestart: Boolean, send: Boolean) {
|
||||
if (stationList == null || currentStationIndex >= stationList.size - 1) {
|
||||
if (currentStationIndex >= stationList.size - 1) {
|
||||
return
|
||||
}
|
||||
val currentStation = stationList[currentStationIndex]
|
||||
@@ -1110,7 +1041,7 @@ object OrderModel {
|
||||
}
|
||||
|
||||
fun triggerUnableStartAPReasonEvent() {
|
||||
if (stationList == null || currentStationIndex >= stationList.size - 1) {
|
||||
if (currentStationIndex >= stationList.size - 1) {
|
||||
return
|
||||
}
|
||||
val currentStation = stationList[currentStationIndex]
|
||||
@@ -1124,7 +1055,7 @@ object OrderModel {
|
||||
val busNextStation: BusStationBean?
|
||||
get() {
|
||||
// A->B 的过程中A站点的信息
|
||||
if (stationList == null || currentStationIndex >= stationList.size - 1) {
|
||||
if (currentStationIndex >= stationList.size - 1) {
|
||||
return null
|
||||
}
|
||||
return stationList[currentStationIndex]
|
||||
@@ -1136,32 +1067,32 @@ object OrderModel {
|
||||
private fun updateAutopilotControlParameters() {
|
||||
val parameters = initAutopilotControlParameters(-1)
|
||||
if (null == parameters) {
|
||||
e(SceneConstant.M_BUS + TAG, "AutopilotControlParameters is empty.")
|
||||
e(M_BUS + TAG, "AutopilotControlParameters is empty.")
|
||||
return
|
||||
}
|
||||
d(SceneConstant.M_BUS + TAG, "AutopilotControlParameters is update.")
|
||||
updateAutopilotControlParameters(parameters)
|
||||
d(M_BUS + TAG, "AutopilotControlParameters is update.")
|
||||
CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(parameters)
|
||||
}
|
||||
|
||||
private fun clearAutopilotControlParameters() {
|
||||
d(SceneConstant.M_BUS + TAG, "AutopilotControlParameters is clear.")
|
||||
updateAutopilotControlParameters(null)
|
||||
d(M_BUS + TAG, "AutopilotControlParameters is clear.")
|
||||
CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(null)
|
||||
}
|
||||
|
||||
private fun initAutopilotControlParameters(leaveIndex: Int): AutopilotControlParameters? {
|
||||
var currentStation: BusStationBean? = null
|
||||
var nextStation: BusStationBean? = null
|
||||
val currentStation: BusStationBean?
|
||||
val nextStation: BusStationBean?
|
||||
|
||||
if (leaveIndex < 0) {
|
||||
if (currentStationIndex + 1 > stationList!!.size - 1 || !isGoingToNextStation) {
|
||||
e(SceneConstant.M_BUS + TAG, "行程日志-mismatch condition1.")
|
||||
if (currentStationIndex + 1 > stationList.size - 1 || !isGoingToNextStation) {
|
||||
e(M_BUS + TAG, "行程日志-mismatch condition1.")
|
||||
return null
|
||||
}
|
||||
currentStation = stationList[currentStationIndex]
|
||||
nextStation = stationList[currentStationIndex + 1]
|
||||
} else {
|
||||
if (leaveIndex + 1 > stationList!!.size - 1 || !isGoingToNextStation) {
|
||||
e(SceneConstant.M_BUS + TAG, "行程日志-mismatch condition2.")
|
||||
if (leaveIndex + 1 > stationList.size - 1 || !isGoingToNextStation) {
|
||||
e(M_BUS + TAG, "行程日志-mismatch condition2.")
|
||||
return null
|
||||
}
|
||||
currentStation = stationList[leaveIndex]
|
||||
|
||||
@@ -16,7 +16,7 @@ import com.mogo.och.common.module.biz.login.LoginStatusEnum
|
||||
import com.mogo.och.common.module.biz.login.LoginStatusManager
|
||||
import com.mogo.och.common.module.biz.login.LoginStatusManager.isLogin
|
||||
import com.mogo.och.common.module.manager.autopilot.OCHAdasAbilityManager
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.ArrivedStation
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.bean.ArrivedStation
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.IOchAutopilotStatusListener
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutoPilotStatusListenerManager
|
||||
import com.mogo.och.data.bean.BusStationBean
|
||||
@@ -26,14 +26,6 @@ import com.mogo.och.weaknet.callback.IRefreshBusStationsCallback
|
||||
import com.mogo.och.weaknet.callback.ISlidePannelHideCallback
|
||||
import com.mogo.och.weaknet.fragment.ShuttleFragment
|
||||
import com.mogo.och.weaknet.model.OrderModel
|
||||
import com.mogo.och.weaknet.model.OrderModel.closeBeautificationMode
|
||||
import com.mogo.och.weaknet.model.OrderModel.init
|
||||
import com.mogo.och.weaknet.model.OrderModel.isGoingToNextStation
|
||||
import com.mogo.och.weaknet.model.OrderModel.isRestartAutopilot
|
||||
import com.mogo.och.weaknet.model.OrderModel.onArriveAt
|
||||
import com.mogo.och.weaknet.model.OrderModel.queryBusCacheRoutes
|
||||
import com.mogo.och.weaknet.model.OrderModel.release
|
||||
import com.mogo.och.weaknet.model.OrderModel.triggerStartServiceEvent
|
||||
import com.mogo.och.weaknet.util.BusTrajectoryManager
|
||||
import mogo_msg.MogoReportMsg.MogoReportMessage
|
||||
|
||||
@@ -50,20 +42,19 @@ class BusPresenter(view: ShuttleFragment?) : Presenter<ShuttleFragment?>(view),
|
||||
|
||||
init {
|
||||
//2021.11.1 鹰眼架构整合,由IMoGoAutopilotStatusListener逐步替代IMogoAdasOCHCallback接口
|
||||
init()
|
||||
OrderModel.init()
|
||||
OCHAdasAbilityManager.getInstance().init(AbsMogoApplication.getApp())
|
||||
}
|
||||
|
||||
override fun onCreate(owner: LifecycleOwner) {
|
||||
super.onCreate(owner)
|
||||
initModelListener()
|
||||
|
||||
queryBusCacheRoutes()
|
||||
OrderModel.queryBusRoutes()
|
||||
}
|
||||
|
||||
override fun onDestroy(owner: LifecycleOwner) {
|
||||
super.onDestroy(owner)
|
||||
release()
|
||||
OrderModel.release()
|
||||
releaseListener()
|
||||
}
|
||||
|
||||
@@ -95,7 +86,7 @@ class BusPresenter(view: ShuttleFragment?) : Presenter<ShuttleFragment?>(view),
|
||||
}
|
||||
|
||||
fun restartAutopilot() {
|
||||
if (isGoingToNextStation) {
|
||||
if (OrderModel.isGoingToNextStation) {
|
||||
OrderModel.restartAutopilot()
|
||||
}
|
||||
}
|
||||
@@ -159,16 +150,14 @@ class BusPresenter(view: ShuttleFragment?) : Presenter<ShuttleFragment?>(view),
|
||||
}
|
||||
|
||||
fun arriveStation(arrivedStation: ArrivedStation?, type: String?) {
|
||||
onArriveAt(arrivedStation, type!!)
|
||||
OrderModel.onArriveAt(arrivedStation, type!!)
|
||||
}
|
||||
|
||||
override fun onAutopilotStatusResponse(state: Int) {
|
||||
when (state) {
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE, IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING, IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE -> {
|
||||
if (FunctionBuildConfig.isDemoMode
|
||||
&& ((mCurrentStation >= 0 && mCurrentStation <= mStationList.size - 1)
|
||||
&& isGoingToNextStation
|
||||
)
|
||||
&& ((mCurrentStation >= 0 && mCurrentStation <= mStationList.size - 1) && OrderModel.isGoingToNextStation)
|
||||
) {
|
||||
d(SceneConstant.M_BUS + "BusOrderModel=", "有美化功能")
|
||||
return
|
||||
@@ -182,9 +171,7 @@ class BusPresenter(view: ShuttleFragment?) : Presenter<ShuttleFragment?>(view),
|
||||
}
|
||||
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING -> {
|
||||
triggerStartServiceEvent(
|
||||
isRestartAutopilot, true
|
||||
)
|
||||
OrderModel.triggerStartServiceEvent(OrderModel.isRestartAutopilot, true)
|
||||
// 改变UI自动驾驶状态
|
||||
UiThreadHandler.post({
|
||||
if (mView != null) {
|
||||
@@ -235,7 +222,7 @@ class BusPresenter(view: ShuttleFragment?) : Presenter<ShuttleFragment?>(view),
|
||||
override fun onStatusChange(currentStatus: LoginStatusEnum) {
|
||||
d(SceneConstant.M_BUS + TAG, " loginStatus =" + isLogin())
|
||||
if (isLogin()) {
|
||||
queryBusCacheRoutes()
|
||||
OrderModel.queryBusRoutes()
|
||||
} else {
|
||||
BusTrajectoryManager.getInstance().stopTrajReqLoop()
|
||||
BusTrajectoryManager.getInstance().stopTrajReqLoop()
|
||||
@@ -243,7 +230,7 @@ class BusPresenter(view: ShuttleFragment?) : Presenter<ShuttleFragment?>(view),
|
||||
if (mView != null) {
|
||||
mView!!.hideSlidePanel()
|
||||
}
|
||||
closeBeautificationMode()
|
||||
OrderModel.closeBeautificationMode()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ import androidx.annotation.Nullable;
|
||||
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.elegant.network.utils.GsonUtil;
|
||||
import com.mogo.aicloud.services.socket.IMogoOnMessageListener;
|
||||
import com.mogo.commons.module.intent.IMogoIntentListener;
|
||||
import com.mogo.commons.module.intent.IntentManager;
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
@@ -38,7 +37,7 @@ import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.StringUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.ArrivedStation;
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.bean.ArrivedStation;
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.IOchAutopilotStatusListener;
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutoPilotManager;
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutoPilotStatusListenerManager;
|
||||
|
||||
@@ -19,7 +19,7 @@ import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.common.module.manager.autopilot.OCHAdasAbilityManager
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.ArrivedStation
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.bean.ArrivedStation
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.IOchAutopilotStatusListener
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutoPilotManager
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutoPilotStatusListenerManager
|
||||
|
||||
@@ -4,7 +4,6 @@ import android.content.Context
|
||||
import android.net.ConnectivityManager
|
||||
import android.text.TextUtils
|
||||
import com.amap.api.maps.model.LatLng
|
||||
import com.mogo.aicloud.services.socket.IMogoOnMessageListener
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.module.intent.IMogoIntentListener
|
||||
import com.mogo.commons.module.intent.IntentManager
|
||||
@@ -41,7 +40,7 @@ import com.mogo.och.common.module.biz.order.OrderModel
|
||||
import com.mogo.och.common.module.biz.order.TaxiOrderStatusEnum
|
||||
import com.mogo.och.common.module.callback.OchAdasStartFailureCallback
|
||||
import com.mogo.och.common.module.manager.autopilot.OCHAdasAbilityManager
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.ArrivedStation
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.bean.ArrivedStation
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.IOchAutopilotStatusListener
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutoPilotManager
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutoPilotStatusListenerManager
|
||||
@@ -58,7 +57,6 @@ import com.mogo.och.common.module.network.OchCommonServiceCallback
|
||||
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil.coordinateConverterWgsToGcjLocations
|
||||
import com.mogo.och.common.module.utils.OCHThreadPoolManager
|
||||
import com.mogo.och.common.module.voice.VoiceNotice
|
||||
import com.mogo.och.data.bean.BusStationBean
|
||||
import com.mogo.och.data.taxi.QueryCarOrderByNoRespBean
|
||||
import com.mogo.och.unmanned.taxi.bean.PrepareTaskRespBean
|
||||
import com.mogo.och.unmanned.taxi.bean.QueryCurrentTaskRespBean
|
||||
|
||||
Reference in New Issue
Block a user