[6.8.4]
[fea] [添加orderid]
This commit is contained in:
@@ -64,6 +64,10 @@ object OchChainLogManager {
|
||||
|
||||
const val EVENT_KEY_INFO_MAP = "analytics_event_och_map"
|
||||
|
||||
// 轨迹方面的日志
|
||||
fun writeChainLogTrajectory(title: String, info: String) {
|
||||
writeChainLog(title, info, true, EVENT_KEY_INFE_WITH_TRAJECTORY)
|
||||
}
|
||||
|
||||
fun writeChainLogMap(title: String, info: String) {
|
||||
writeChainLog(title, info, true, EVENT_KEY_INFO_MAP)
|
||||
@@ -72,9 +76,11 @@ object OchChainLogManager {
|
||||
fun writeChainLogDb(title: String, info: String) {
|
||||
writeChainLog(title, info, true, EVENT_KEY_INFO_DB)
|
||||
}
|
||||
|
||||
fun writeChainLogBluetooth(title: String, info: String) {
|
||||
writeChainLog(title, info, true, EVENT_KEY_INFO_BLUETOOTH)
|
||||
}
|
||||
|
||||
fun writeChainLogWriteOff(title: String, info: String) {
|
||||
writeChainLog(title, info, true, EVENT_KEY_INFO_WRITEOFF)
|
||||
}
|
||||
|
||||
@@ -25,12 +25,15 @@ import com.mogo.och.bridge.autopilot.autopilot.OchAutoPilotManager;
|
||||
import com.mogo.och.bridge.autopilot.autopilot.OchAutopilotAnalytics;
|
||||
import com.mogo.och.bridge.autopilot.autopilot.bean.ArrivedStation;
|
||||
import com.mogo.och.bridge.autopilot.callback.OchAdasStartFailureCallback;
|
||||
import com.mogo.och.bridge.autopilot.line.LineManager;
|
||||
import com.mogo.och.bridge.distance.TrajectoryAndDistanceManager;
|
||||
import com.mogo.och.common.module.manager.socket.cloud.action.OperateAction;
|
||||
import com.mogo.och.common.module.manager.socket.lan.LanSocketManager;
|
||||
import com.mogo.och.common.module.manager.socket.lan.LedScreenManager;
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.BusinessType;
|
||||
import com.mogo.och.common.module.voice.VoiceNotice;
|
||||
import com.mogo.och.data.bean.ContraiInfo;
|
||||
import com.mogo.och.data.bean.LineInfo;
|
||||
import com.mogo.och.offline.R;
|
||||
import com.mogo.och.offline.callback.IBusADASStatusCallback;
|
||||
import com.mogo.och.offline.util.ShuttleVoiceManager;
|
||||
@@ -72,6 +75,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.exceptions.UndeliverableException;
|
||||
@@ -309,8 +313,11 @@ public class OrderModel {
|
||||
|
||||
if (!StringUtils.isEmpty(cacheData)) {
|
||||
BusTransferData data = GsonUtils.fromJson(cacheData, BusTransferData.class);
|
||||
getCacheRouteSuccess(data.getRoutesResult());
|
||||
BusRoutesResult routesResult = data.getRoutesResult();
|
||||
getCacheRouteSuccess(routesResult);
|
||||
}else {
|
||||
LineManager.INSTANCE.setContraiInfo(null);
|
||||
LineManager.setLineInfo(null);
|
||||
if (refreshBusStationsCallback != null) {
|
||||
refreshBusStationsCallback.updateEmptyUi();
|
||||
}
|
||||
@@ -535,17 +542,12 @@ public class OrderModel {
|
||||
//3、距离轨迹15m计算
|
||||
String resion = TrajectoryAndDistanceManager.INSTANCE.canStartAutopilot((long) busRoutesResult.getLineId());
|
||||
if (TrajectoryAndDistanceManager.errorTypeNoneLineId.equals(resion)) {
|
||||
MogoLocation nextStationPoint = new MogoLocation();
|
||||
BusStationBean nextStation = new BusStationBean();
|
||||
if (backgroundCurrentStationIndex < stationList.size() - 1) {
|
||||
BusStationBean nextStation = stationList.get(backgroundCurrentStationIndex + 1);
|
||||
nextStationPoint.setLongitude(nextStation.getGcjLon());
|
||||
nextStationPoint.setLatitude(nextStation.getGcjLat());
|
||||
nextStation = stationList.get(backgroundCurrentStationIndex + 1);
|
||||
}
|
||||
BusStationBean busStationBean = stationList.get(backgroundCurrentStationIndex);
|
||||
MogoLocation currentStationPoint = new MogoLocation();
|
||||
currentStationPoint.setLongitude(busStationBean.getGcjLon());
|
||||
currentStationPoint.setLatitude(busStationBean.getGcjLat());
|
||||
setTrajectoryStation(currentStationPoint, nextStationPoint, (long) busRoutesResult.getLineId());
|
||||
setTrajectoryStation(busStationBean, nextStation, (long) busRoutesResult.getLineId());
|
||||
resion = TrajectoryAndDistanceManager.INSTANCE.canStartAutopilot((long) busRoutesResult.getLineId());
|
||||
}
|
||||
if (!StringUtils.isEmpty(resion)) {
|
||||
@@ -681,13 +683,11 @@ public class OrderModel {
|
||||
}
|
||||
String nextStationName = "";
|
||||
String nextStationNameKr = "";
|
||||
MogoLocation nextStationPoint = new MogoLocation();
|
||||
BusStationBean nextStation = new BusStationBean();
|
||||
if (backgroundCurrentStationIndex < stationList.size() - 1) {
|
||||
BusStationBean nextStation = stationList.get(backgroundCurrentStationIndex + 1);
|
||||
nextStation = stationList.get(backgroundCurrentStationIndex + 1);
|
||||
nextStationName = nextStation.getName();
|
||||
nextStationNameKr = nextStation.getNameKr();
|
||||
nextStationPoint.setLongitude(nextStation.getGcjLon());
|
||||
nextStationPoint.setLatitude(nextStation.getGcjLat());
|
||||
}
|
||||
final String currentStationName = stationList.get(backgroundCurrentStationIndex).getName();
|
||||
String finalNextStationName = nextStationName;
|
||||
@@ -700,10 +700,7 @@ public class OrderModel {
|
||||
finalNextStationName, finalNextStationNameKr);
|
||||
|
||||
BusStationBean busStationBean = stationList.get(backgroundCurrentStationIndex);
|
||||
MogoLocation currentStationPoint = new MogoLocation();
|
||||
currentStationPoint.setLongitude(busStationBean.getGcjLon());
|
||||
currentStationPoint.setLatitude(busStationBean.getGcjLat());
|
||||
setTrajectoryStation(currentStationPoint, nextStationPoint, (long) busRoutesResult.getLineId());
|
||||
setTrajectoryStation(busStationBean, nextStation, (long) busRoutesResult.getLineId());
|
||||
|
||||
String changeInfo = "taskId:" + busRoutesResult.getTaskId() + "--lineId:" + busRoutesResult.getLineId() +
|
||||
"--currentStationName:" + currentStationName + "--finalNextStationName:" + finalNextStationName;
|
||||
@@ -755,6 +752,13 @@ public class OrderModel {
|
||||
*/
|
||||
private void updateBusStatus(BusRoutesResult result) {
|
||||
if (result == null) return;
|
||||
LineManager.INSTANCE.setContraiInfo(new ContraiInfo(result.getLineId(),result.csvFileUrl,result.csvFileMd5,result.txtFileUrl,result.txtFileMd5,result.contrailSaveTime,null,null,1));
|
||||
HashMap<String,String> map = new HashMap<String,String>();
|
||||
String taskInfo = DateTimeUtil.formatLongToString(
|
||||
result.getTaskTime(), DateTimeUtil.HH_mm
|
||||
);
|
||||
map.put("taskInfo",taskInfo);
|
||||
LineManager.setLineInfo(new LineInfo(result.getLineId(),result.getName(),map,result.getTaskId()+""));
|
||||
busRoutesResult = result;
|
||||
stationList.clear();
|
||||
stationList.addAll(result.getSites());
|
||||
@@ -1109,8 +1113,17 @@ public class OrderModel {
|
||||
return parameters;
|
||||
}
|
||||
|
||||
public void setTrajectoryStation(MogoLocation startStation, MogoLocation endStation, Long lineId) {
|
||||
TrajectoryAndDistanceManager.INSTANCE.setStationPoint(startStation, endStation, lineId);
|
||||
public void setTrajectoryStation(BusStationBean startStation, BusStationBean endStation, Long lineId) {
|
||||
|
||||
LineManager.INSTANCE.setStartAndEndStation(startStation,endStation);
|
||||
|
||||
MogoLocation startStationMogoLocation = new MogoLocation();
|
||||
startStationMogoLocation.setLongitude(startStation.getGcjLon());
|
||||
startStationMogoLocation.setLatitude(startStation.getGcjLat());
|
||||
MogoLocation endStationMogoLocation = new MogoLocation();
|
||||
endStationMogoLocation.setLongitude(endStation.getGcjLon());
|
||||
endStationMogoLocation.setLatitude(endStation.getGcjLat());
|
||||
TrajectoryAndDistanceManager.INSTANCE.setStationPoint(startStationMogoLocation, endStationMogoLocation, lineId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
package com.mogo.och.offline.util
|
||||
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters.AutoPilotLine
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.sendTrajectoryDownloadReq
|
||||
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.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.e
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||
import com.mogo.och.bridge.autopilot.line.LineManager
|
||||
import com.mogo.och.bridge.autopilot.trajectory.TrajectoryManager
|
||||
import com.mogo.och.common.module.biz.login.LoginStatusManager.isLogin
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||
@@ -25,17 +26,13 @@ import java.util.concurrent.TimeUnit
|
||||
*/
|
||||
object OffLineTrajectoryManager : com.mogo.och.bridge.autopilot.trajectory.ITrajectoryListListener {
|
||||
|
||||
private var mAutoPilotLine: AutoPilotLine? = null
|
||||
private var mAutopilotControlParameters: AutopilotControlParameters? = null
|
||||
private var mSendReqDisposable: Disposable? = null
|
||||
|
||||
private val TAG: String = OffLineTrajectoryManager::class.java.simpleName
|
||||
|
||||
init {
|
||||
mAutoPilotLine = AutoPilotLine(
|
||||
-1, "",
|
||||
"", "", "", "", 0, "",
|
||||
"", "", "", "", 0
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
fun load(){
|
||||
@@ -83,49 +80,13 @@ object OffLineTrajectoryManager : com.mogo.och.bridge.autopilot.trajectory.ITraj
|
||||
)
|
||||
return
|
||||
} else {
|
||||
if (mAutoPilotLine == null) {
|
||||
mAutoPilotLine = AutoPilotLine(
|
||||
routesResult.lineId.toLong(), routesResult.name,
|
||||
routesResult.csvFileUrl, routesResult.csvFileMd5,
|
||||
routesResult.txtFileUrl, routesResult.txtFileMd5,
|
||||
routesResult.contrailSaveTime, routesResult.carModel,
|
||||
routesResult.csvFileUrlDPQP, routesResult.csvFileMd5DPQP,
|
||||
routesResult.txtFileUrlDPQP, routesResult.txtFileMd5DPQP,
|
||||
routesResult.contrailSaveTimeDPQP
|
||||
)
|
||||
} else {
|
||||
mAutoPilotLine!!.lineId = routesResult.lineId.toLong()
|
||||
mAutoPilotLine!!.lineName = routesResult.name
|
||||
mAutoPilotLine!!.trajUrl =
|
||||
if (routesResult.csvFileUrl == null) "" else routesResult.csvFileUrl
|
||||
mAutoPilotLine!!.trajMd5 =
|
||||
if (routesResult.csvFileMd5 == null) "" else routesResult.csvFileMd5
|
||||
mAutoPilotLine!!.stopUrl =
|
||||
if (routesResult.txtFileUrl == null) "" else routesResult.txtFileUrl
|
||||
mAutoPilotLine!!.stopMd5 =
|
||||
if (routesResult.txtFileMd5 == null) "" else routesResult.txtFileMd5
|
||||
mAutoPilotLine!!.timestamp = routesResult.contrailSaveTime
|
||||
mAutoPilotLine!!.vehicleModel =
|
||||
if (routesResult.carModel == null) "" else routesResult.carModel
|
||||
}
|
||||
mAutopilotControlParameters = LineManager.initAutopilotControlParameters()
|
||||
}
|
||||
}
|
||||
|
||||
private fun clearAutoPilotLine() {
|
||||
if (mAutoPilotLine == null) return
|
||||
mAutoPilotLine!!.lineId = -1
|
||||
mAutoPilotLine!!.lineName = ""
|
||||
mAutoPilotLine!!.trajUrl = ""
|
||||
mAutoPilotLine!!.trajMd5 = ""
|
||||
mAutoPilotLine!!.stopUrl = ""
|
||||
mAutoPilotLine!!.stopMd5 = ""
|
||||
mAutoPilotLine!!.timestamp = 0
|
||||
mAutoPilotLine!!.vehicleModel = ""
|
||||
mAutoPilotLine!!.trajUrl_dpqp = ""
|
||||
mAutoPilotLine!!.trajMd5_dpqp = ""
|
||||
mAutoPilotLine!!.stopUrl_dpqp = ""
|
||||
mAutoPilotLine!!.stopMd5_dpqp = ""
|
||||
mAutoPilotLine!!.timestamp_dpqp = 0
|
||||
if (mAutopilotControlParameters == null) return
|
||||
mAutopilotControlParameters = null
|
||||
}
|
||||
|
||||
private fun startTrajReqLoop() {
|
||||
@@ -161,20 +122,20 @@ object OffLineTrajectoryManager : com.mogo.och.bridge.autopilot.trajectory.ITraj
|
||||
}
|
||||
|
||||
private fun sendTrajectoryReq() {
|
||||
if (mAutoPilotLine == null) {
|
||||
if (mAutopilotControlParameters == null||mAutopilotControlParameters!!.autoPilotLine==null) {
|
||||
e(SceneConstant.M_BUS + TAG, "sendTrajectoryReq(): mAutoPilotLine is null!!!")
|
||||
return
|
||||
}
|
||||
writeChainLog(
|
||||
"轨迹监控",
|
||||
"sendTrajectoryReq() 下发轨迹 轨迹id" + mAutoPilotLine!!.lineId,
|
||||
"sendTrajectoryReq() 下发轨迹 轨迹id" + mAutopilotControlParameters!!.autoPilotLine!!.lineId,
|
||||
true,
|
||||
OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY
|
||||
)
|
||||
sendTrajectoryDownloadReq(mAutoPilotLine!!)
|
||||
CallerAutoPilotControlManager.sendTrajectoryDownloadReq(mAutopilotControlParameters!!.autoPilotLine!!,0,mAutopilotControlParameters!!.orderId)
|
||||
d(
|
||||
SceneConstant.M_BUS + TAG, "sendTrajectoryReq(): "
|
||||
+ GsonUtils.toJson(mAutoPilotLine)
|
||||
+ GsonUtils.toJson(mAutopilotControlParameters)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,23 +1,18 @@
|
||||
package com.mogo.och.weaknet.util
|
||||
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.sendTrajectoryDownloadReq
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||
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
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||
import com.mogo.och.bridge.autopilot.line.LineManager
|
||||
import com.mogo.och.common.module.biz.login.LoginStatusManager.isLogin
|
||||
import com.mogo.och.bridge.autopilot.line.LineManager.contraiInfo
|
||||
import com.mogo.och.bridge.autopilot.line.LineManager.initAutopilotControlParameters
|
||||
import com.mogo.och.bridge.autopilot.line.LineManager.lineInfos
|
||||
import com.mogo.och.bridge.autopilot.trajectory.ITrajectoryListListener
|
||||
import com.mogo.och.bridge.autopilot.trajectory.TrajectoryManager
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager.writeChainLog
|
||||
import com.mogo.och.weaknet.constant.BusConst
|
||||
import com.mogo.och.weaknet.model.LineModel.currentTask
|
||||
import com.mogo.och.weaknet.model.LineModel.startStationIndex
|
||||
import com.mogo.och.weaknet.model.OrderModel.isGoingToNextStation
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
@@ -55,21 +50,14 @@ object BusTrajectoryManager : ITrajectoryListListener {
|
||||
*/
|
||||
fun syncTrajectoryInfo() {
|
||||
if (mAutopilotControlParameters == null || mAutopilotControlParameters!!.autoPilotLine == null) {
|
||||
writeChainLog(
|
||||
"轨迹监控",
|
||||
"开始或者结束下发轨迹 轨迹id" + -1,
|
||||
true,
|
||||
OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY
|
||||
)
|
||||
OchChainLogManager.writeChainLogTrajectory("轨迹监控", "开始或者结束下发轨迹 轨迹id:-1")
|
||||
} else {
|
||||
writeChainLog(
|
||||
OchChainLogManager.writeChainLogTrajectory(
|
||||
"轨迹监控",
|
||||
"开始或者结束下发轨迹 轨迹id" + mAutopilotControlParameters!!.autoPilotLine!!.lineId,
|
||||
true,
|
||||
OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY
|
||||
"开始或者结束下发轨迹 轨迹id:${mAutopilotControlParameters!!.autoPilotLine!!.lineId}"
|
||||
)
|
||||
}
|
||||
if (isLogin() && currentTask != null && startStationIndex == 0 && !isGoingToNextStation) {
|
||||
if (isLogin() && currentTask != null && !isGoingToNextStation) {
|
||||
d(TAG, "syncTrajectoryInfo() start.")
|
||||
startTrajReqLoop()
|
||||
} else {
|
||||
@@ -92,13 +80,13 @@ object BusTrajectoryManager : ITrajectoryListListener {
|
||||
}
|
||||
|
||||
private fun setupAutoPilotLine() {
|
||||
val contraiInfo = contraiInfo
|
||||
val lineInfos = lineInfos
|
||||
if (contraiInfo == null || lineInfos == null) {
|
||||
e(TAG, "setupAutoPilotLine(): routesResult is null.")
|
||||
return
|
||||
if (LineManager.contraiInfo == null || LineManager.lineInfos == null) {
|
||||
e(
|
||||
TAG,
|
||||
"下发轨迹报错:没有轨迹或线路信息 contraiInfo:${LineManager.contraiInfo} lineInfos:${LineManager.lineInfos}"
|
||||
)
|
||||
} else {
|
||||
mAutopilotControlParameters = initAutopilotControlParameters()
|
||||
mAutopilotControlParameters = LineManager.initAutopilotControlParameters()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,18 +97,11 @@ object BusTrajectoryManager : ITrajectoryListListener {
|
||||
|
||||
private fun startTrajReqLoop() {
|
||||
if (mAutopilotControlParameters == null || mAutopilotControlParameters!!.autoPilotLine == null) {
|
||||
writeChainLog(
|
||||
"轨迹监控",
|
||||
"开始下发轨迹 轨迹id" + -1,
|
||||
true,
|
||||
OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY
|
||||
)
|
||||
OchChainLogManager.writeChainLogTrajectory("轨迹监控", "开始下发轨迹 轨迹id:-1")
|
||||
} else {
|
||||
writeChainLog(
|
||||
OchChainLogManager.writeChainLogTrajectory(
|
||||
"轨迹监控",
|
||||
"开始下发轨迹 轨迹id" + mAutopilotControlParameters!!.autoPilotLine!!.lineId,
|
||||
true,
|
||||
OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY
|
||||
"开始下发轨迹 轨迹id:${mAutopilotControlParameters?.autoPilotLine?.lineId}"
|
||||
)
|
||||
}
|
||||
if (mSendReqDisposable != null && !mSendReqDisposable!!.isDisposed) {
|
||||
@@ -143,18 +124,11 @@ object BusTrajectoryManager : ITrajectoryListListener {
|
||||
|
||||
fun stopTrajReqLoop() {
|
||||
if (mAutopilotControlParameters == null || mAutopilotControlParameters!!.autoPilotLine == null) {
|
||||
writeChainLog(
|
||||
"轨迹监控",
|
||||
"结束下发轨迹 轨迹id" + -1,
|
||||
true,
|
||||
OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY
|
||||
)
|
||||
OchChainLogManager.writeChainLogTrajectory("轨迹监控", "结束下发轨迹 轨迹id:-1")
|
||||
} else {
|
||||
writeChainLog(
|
||||
OchChainLogManager.writeChainLogTrajectory(
|
||||
"轨迹监控",
|
||||
"结束下发轨迹 轨迹id" + mAutopilotControlParameters!!.autoPilotLine!!.lineId,
|
||||
true,
|
||||
OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY
|
||||
"结束下发轨迹 轨迹id:${mAutopilotControlParameters!!.autoPilotLine!!.lineId}"
|
||||
)
|
||||
}
|
||||
if (mSendReqDisposable != null) {
|
||||
@@ -172,19 +146,21 @@ object BusTrajectoryManager : ITrajectoryListListener {
|
||||
*/
|
||||
private fun sendTrajectoryReq() {
|
||||
if (mAutopilotControlParameters == null || mAutopilotControlParameters!!.autoPilotLine == null || mAutopilotControlParameters!!.autoPilotLine!!.lineId == -1L) {
|
||||
e(TAG, "sendTrajectoryReq(): mAutoPilotLine is null!!!")
|
||||
e(TAG, "下发轨迹报错:自己参数:${mAutopilotControlParameters}")
|
||||
setupAutoPilotLine()
|
||||
if (mAutopilotControlParameters == null || mAutopilotControlParameters!!.autoPilotLine == null || mAutopilotControlParameters!!.autoPilotLine!!.lineId == -1L) {
|
||||
return
|
||||
}
|
||||
}
|
||||
writeChainLog(
|
||||
"轨迹监控",
|
||||
"sendTrajectoryReq() 下发轨迹 轨迹id" + mAutopilotControlParameters!!.autoPilotLine!!.lineId,
|
||||
true,
|
||||
OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY
|
||||
)
|
||||
sendTrajectoryDownloadReq(mAutopilotControlParameters!!.autoPilotLine!!, 0)
|
||||
mAutopilotControlParameters?.let {
|
||||
OchChainLogManager.writeChainLogTrajectory(
|
||||
"轨迹监控",
|
||||
"sendTrajectoryReq() 下发轨迹 轨迹id:${it.autoPilotLine!!.lineId}"
|
||||
)
|
||||
CallerAutoPilotControlManager.sendTrajectoryDownloadReq(it.autoPilotLine!!, 0,
|
||||
it.orderId)
|
||||
}
|
||||
|
||||
d(TAG, "sendTrajectoryReq(): " + GsonUtils.toJson(mAutopilotControlParameters))
|
||||
}
|
||||
|
||||
|
||||
@@ -11,20 +11,16 @@ import com.mogo.och.bridge.autopilot.line.LineManager
|
||||
import com.mogo.och.bridge.autopilot.trajectory.ITrajectoryListListener
|
||||
import com.mogo.och.bridge.autopilot.trajectory.TrajectoryManager
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager.writeChainLog
|
||||
import com.mogo.och.unmanned.taxi.bean.TrajectoryListRespBean
|
||||
import com.mogo.och.unmanned.taxi.constant.TaskStatusEnum
|
||||
import com.mogo.och.unmanned.taxi.constant.TaxiUnmannedConst
|
||||
import com.mogo.och.unmanned.taxi.ui.debug.DebugView.Companion.printInfoMsg
|
||||
import com.mogo.och.unmanned.taxi.ui.task.TaxiTaskModel.getCurrentOrderTrajectoryList
|
||||
import com.mogo.och.unmanned.taxi.ui.task.TaxiTaskModel.getCurrentTaskTrajectory
|
||||
import com.mogo.och.unmanned.taxi.ui.task.TaxiTaskModel.getCurrentTaskWithOrder
|
||||
import com.mogo.och.unmanned.taxi.ui.task.TaxiTaskModel
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.Disposable
|
||||
import io.reactivex.functions.Function
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import java.util.Arrays
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
/**
|
||||
@@ -33,31 +29,31 @@ import java.util.concurrent.TimeUnit
|
||||
*/
|
||||
object TaxiTrajectoryManager : ITrajectoryListListener {
|
||||
|
||||
private val TAG: String = TaxiTrajectoryManager::class.java.simpleName
|
||||
private val TAG: String = SceneConstant.M_TAXI + TaxiTrajectoryManager::class.java.simpleName
|
||||
|
||||
//载类型: 0:正常下载 1:预下载
|
||||
private const val COMMON_LOADING = 0
|
||||
private const val PRE_LOADING = 1
|
||||
|
||||
//正常加载的路线
|
||||
private var mAutoPilotLine: AutopilotControlParameters? = null
|
||||
private var mAutopilotControlParameters: AutopilotControlParameters? = null
|
||||
|
||||
//预加载的路线
|
||||
private var mPreAutoPilotLine: AutopilotControlParameters? = null
|
||||
private var mPreAutopilotControlParameters: AutopilotControlParameters? = null
|
||||
|
||||
private var mSendReqDisposable: Disposable? = null
|
||||
private var mPrevTaskLineId = ""
|
||||
|
||||
init {
|
||||
mAutoPilotLine = AutopilotControlParameters()
|
||||
mPreAutoPilotLine = AutopilotControlParameters()
|
||||
mAutopilotControlParameters = AutopilotControlParameters()
|
||||
mPreAutopilotControlParameters = AutopilotControlParameters()
|
||||
}
|
||||
|
||||
fun load(){
|
||||
TrajectoryManager.addListener(TAG,this)
|
||||
fun load() {
|
||||
TrajectoryManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
fun releast(){
|
||||
fun releast() {
|
||||
TrajectoryManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
@@ -65,33 +61,31 @@ object TaxiTrajectoryManager : ITrajectoryListListener {
|
||||
* 同步订单信息
|
||||
*/
|
||||
fun syncTrajectoryInfo() {
|
||||
writeChainLog(
|
||||
OchChainLogManager.writeChainLogTrajectory(
|
||||
"轨迹监控",
|
||||
"开始或者结束下发轨迹 轨迹id" + mAutoPilotLine?.autoPilotLine?.lineId,
|
||||
true,
|
||||
OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY
|
||||
"开始或者结束下发轨迹 轨迹id:${mAutopilotControlParameters?.autoPilotLine?.lineId}"
|
||||
)
|
||||
val taskAndOrder = getCurrentTaskWithOrder()
|
||||
val taskAndOrder = TaxiTaskModel.getCurrentTaskWithOrder()
|
||||
if (taskAndOrder == null || taskAndOrder.currentStatus >= TaskStatusEnum.StartTask.code) {
|
||||
d(SceneConstant.M_TAXI + TAG, "syncTrajectoryInfo() stop.")
|
||||
d(TAG, "syncTrajectoryInfo() stop.")
|
||||
stopTrajReqLoop()
|
||||
} else {
|
||||
if (mPrevTaskLineId == taskAndOrder.lineId.toString()) {
|
||||
d(SceneConstant.M_TAXI + TAG, "syncTrajectoryInfo() 重复订单.")
|
||||
d(TAG, "syncTrajectoryInfo() 重复订单.")
|
||||
} else {
|
||||
mPrevTaskLineId = taskAndOrder.lineId.toString()
|
||||
d(SceneConstant.M_TAXI + TAG, "syncTrajectoryInfo() start.")
|
||||
d(TAG, "syncTrajectoryInfo() start.")
|
||||
startTrajReqLoop()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDownLoadStart(lineId: Long) {
|
||||
stopTrajReqLoop();
|
||||
stopTrajReqLoop()
|
||||
}
|
||||
|
||||
override fun onDownLoadSuccess(lineId: Long) {
|
||||
stopTrajReqLoop();
|
||||
stopTrajReqLoop()
|
||||
}
|
||||
|
||||
override fun onDownLoadReady(lineId: Long) {
|
||||
@@ -99,13 +93,10 @@ object TaxiTrajectoryManager : ITrajectoryListListener {
|
||||
}
|
||||
|
||||
private fun setupAutoPilotLine() {
|
||||
val taskAndOrder = getCurrentTaskWithOrder()
|
||||
val taskAndOrder = TaxiTaskModel.getCurrentTaskWithOrder()
|
||||
|
||||
if (taskAndOrder?.endSite == null) {
|
||||
e(
|
||||
SceneConstant.M_TAXI + TAG,
|
||||
"setupAutoPilotLine(): taskAndOrder or taskAndOrder.getEndSite() is null."
|
||||
)
|
||||
e(TAG, "订单或站点为空:${taskAndOrder}")
|
||||
} else {
|
||||
/**
|
||||
* 主要加载和预加载轨迹方案
|
||||
@@ -123,20 +114,19 @@ object TaxiTrajectoryManager : ITrajectoryListListener {
|
||||
* 4、若不存在,说明当前的执行的任务是与订单无关的演练任务,通知下载加载当前任务的轨迹以及预加载订单轨迹集合的第一个
|
||||
*/
|
||||
|
||||
val curTaskContrail = getCurrentTaskTrajectory() ?: return
|
||||
TaxiTaskModel.getCurrentTaskTrajectory() ?: return
|
||||
|
||||
val curLineId = taskAndOrder.lineId
|
||||
|
||||
mAutoPilotLine = LineManager.initAutopilotControlParameters()
|
||||
mAutopilotControlParameters = LineManager.initAutopilotControlParameters()
|
||||
|
||||
val orderDetail = taskAndOrder.order
|
||||
var preloadContrail: TrajectoryListRespBean.Result? = null //预加载的轨迹
|
||||
val orderContrails: List<TrajectoryListRespBean.Result> =
|
||||
getCurrentOrderTrajectoryList()
|
||||
val orderContrails = TaxiTaskModel.getCurrentOrderTrajectoryList()
|
||||
|
||||
if (orderDetail != null && orderContrails != null && orderContrails.size != 0) {
|
||||
val lineIds: MutableList<Long> = ArrayList()
|
||||
lineIds.addAll(Arrays.asList(*orderDetail.planningLines)) // 接驾
|
||||
if (orderDetail != null && orderContrails.size != 0) {
|
||||
val lineIds = mutableListOf<Long>()
|
||||
lineIds.addAll(orderDetail.planningLines) // 接驾
|
||||
lineIds.add(orderDetail.orderLine) //送驾
|
||||
|
||||
if (lineIds.contains(curLineId)) { //当前任务在lineIds集合里
|
||||
@@ -158,53 +148,58 @@ object TaxiTrajectoryManager : ITrajectoryListListener {
|
||||
|
||||
if (preloadContrail == null) return
|
||||
|
||||
if (mPreAutoPilotLine == null) {
|
||||
mPreAutoPilotLine = AutopilotControlParameters()
|
||||
if (mPreAutopilotControlParameters == null) {
|
||||
mPreAutopilotControlParameters = AutopilotControlParameters()
|
||||
}
|
||||
if(mPreAutoPilotLine?.autoPilotLine==null){
|
||||
mPreAutoPilotLine?.autoPilotLine = AutoPilotLine()
|
||||
if (mPreAutopilotControlParameters?.autoPilotLine == null) {
|
||||
mPreAutopilotControlParameters?.autoPilotLine = AutoPilotLine()
|
||||
}
|
||||
mPreAutoPilotLine?.autoPilotLine?.lineId = preloadContrail.lineId
|
||||
mPreAutoPilotLine?.autoPilotLine?.lineName = preloadContrail.lineName
|
||||
mPreAutoPilotLine?.autoPilotLine?.trajUrl = preloadContrail.csvFileUrl
|
||||
mPreAutoPilotLine?.autoPilotLine?.trajMd5 = preloadContrail.csvFileMd5
|
||||
mPreAutoPilotLine?.autoPilotLine?.stopUrl = preloadContrail.txtFileUrl
|
||||
mPreAutoPilotLine?.autoPilotLine?.stopMd5 = preloadContrail.txtFileMd5
|
||||
mPreAutoPilotLine?.autoPilotLine?.timestamp = preloadContrail.contrailSaveTime
|
||||
mPreAutoPilotLine?.autoPilotLine?.vehicleModel = TaxiUnmannedConst.BUSINESSTYPE.toString()
|
||||
mPreAutoPilotLine?.autoPilotLine?.trajUrl_dpqp = preloadContrail.csvFileUrlDPQP
|
||||
mPreAutoPilotLine?.autoPilotLine?.trajMd5_dpqp = preloadContrail.csvFileMd5DPQP
|
||||
mPreAutoPilotLine?.autoPilotLine?.stopUrl_dpqp = preloadContrail.txtFileUrlDPQP
|
||||
mPreAutoPilotLine?.autoPilotLine?.stopMd5_dpqp = preloadContrail.txtFileMd5DPQP
|
||||
mPreAutoPilotLine?.autoPilotLine?.timestamp_dpqp = preloadContrail.contrailSaveTimeDPQP
|
||||
mPreAutopilotControlParameters?.autoPilotLine?.lineId = preloadContrail.lineId
|
||||
mPreAutopilotControlParameters?.autoPilotLine?.lineName = preloadContrail.lineName
|
||||
mPreAutopilotControlParameters?.autoPilotLine?.trajUrl = preloadContrail.csvFileUrl
|
||||
mPreAutopilotControlParameters?.autoPilotLine?.trajMd5 = preloadContrail.csvFileMd5
|
||||
mPreAutopilotControlParameters?.autoPilotLine?.stopUrl = preloadContrail.txtFileUrl
|
||||
mPreAutopilotControlParameters?.autoPilotLine?.stopMd5 = preloadContrail.txtFileMd5
|
||||
mPreAutopilotControlParameters?.autoPilotLine?.timestamp =
|
||||
preloadContrail.contrailSaveTime
|
||||
mPreAutopilotControlParameters?.autoPilotLine?.vehicleModel =
|
||||
TaxiUnmannedConst.BUSINESSTYPE.toString()
|
||||
mPreAutopilotControlParameters?.autoPilotLine?.trajUrl_dpqp =
|
||||
preloadContrail.csvFileUrlDPQP
|
||||
mPreAutopilotControlParameters?.autoPilotLine?.trajMd5_dpqp =
|
||||
preloadContrail.csvFileMd5DPQP
|
||||
mPreAutopilotControlParameters?.autoPilotLine?.stopUrl_dpqp =
|
||||
preloadContrail.txtFileUrlDPQP
|
||||
mPreAutopilotControlParameters?.autoPilotLine?.stopMd5_dpqp =
|
||||
preloadContrail.txtFileMd5DPQP
|
||||
mPreAutopilotControlParameters?.autoPilotLine?.timestamp_dpqp =
|
||||
preloadContrail.contrailSaveTimeDPQP
|
||||
|
||||
val toCommonContraiInfo = preloadContrail.toCommonContraiInfo()
|
||||
val (wayLatLons, blackLatLons) = LineManager.getWayBlackLatLons(
|
||||
toCommonContraiInfo.passPoints,
|
||||
toCommonContraiInfo.blackPoints
|
||||
)
|
||||
mPreAutoPilotLine?.wayLatLons = wayLatLons
|
||||
mPreAutoPilotLine?.blackLatLons = blackLatLons
|
||||
mPreAutopilotControlParameters?.wayLatLons = wayLatLons
|
||||
mPreAutopilotControlParameters?.blackLatLons = blackLatLons
|
||||
}
|
||||
}
|
||||
|
||||
private fun clearAutoPilotLine() {
|
||||
mAutoPilotLine = null
|
||||
mPreAutoPilotLine = null
|
||||
mAutopilotControlParameters = null
|
||||
mPreAutopilotControlParameters = null
|
||||
}
|
||||
|
||||
private fun startTrajReqLoop() {
|
||||
writeChainLog(
|
||||
OchChainLogManager.writeChainLogTrajectory(
|
||||
"轨迹监控",
|
||||
"开始下发轨迹 轨迹id" + mAutoPilotLine?.autoPilotLine?.lineId,
|
||||
true,
|
||||
OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY
|
||||
"开始下发轨迹 轨迹id:${mAutopilotControlParameters?.autoPilotLine?.lineId}"
|
||||
)
|
||||
if (mSendReqDisposable != null && !mSendReqDisposable!!.isDisposed) {
|
||||
return
|
||||
}
|
||||
printInfoMsg("[下发轨迹] startTrajectoryReqLoop")
|
||||
d(SceneConstant.M_TAXI + TAG, "startTrajReqLoop()")
|
||||
d(TAG, "startTrajReqLoop()")
|
||||
setupAutoPilotLine()
|
||||
mSendReqDisposable = Observable.interval(
|
||||
TaxiUnmannedConst.LOOP_DELAY,
|
||||
@@ -219,21 +214,19 @@ object TaxiTrajectoryManager : ITrajectoryListListener {
|
||||
stopTrajReqLoop()
|
||||
return@subscribe
|
||||
}
|
||||
d(SceneConstant.M_TAXI + TAG, "loop sendTrajectoryReq: $aLong")
|
||||
d(TAG, "loop sendTrajectoryReq: $aLong")
|
||||
sendTrajectoryReq()
|
||||
}
|
||||
}
|
||||
|
||||
private fun stopTrajReqLoop() {
|
||||
writeChainLog(
|
||||
OchChainLogManager.writeChainLogTrajectory(
|
||||
"轨迹监控",
|
||||
"结束下发轨迹 轨迹id" + mAutoPilotLine?.autoPilotLine?.lineId,
|
||||
true,
|
||||
OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY
|
||||
"结束下发轨迹 轨迹id:${mAutopilotControlParameters?.autoPilotLine?.lineId}"
|
||||
)
|
||||
printInfoMsg("[下发轨迹] stopTrajectoryReqLoop")
|
||||
if (mSendReqDisposable != null) {
|
||||
d(SceneConstant.M_TAXI + TAG, "stopTrajReqLoop()")
|
||||
d(TAG, "stopTrajReqLoop()")
|
||||
mSendReqDisposable!!.dispose()
|
||||
mSendReqDisposable = null
|
||||
clearAutoPilotLine()
|
||||
@@ -241,29 +234,35 @@ object TaxiTrajectoryManager : ITrajectoryListListener {
|
||||
}
|
||||
|
||||
private fun sendTrajectoryReq() {
|
||||
if (mAutoPilotLine != null&&mAutoPilotLine?.autoPilotLine!=null) {
|
||||
printInfoMsg("[下发轨迹] sendTrajectoryDownloadReq, lindId=" + mAutoPilotLine?.autoPilotLine?.lineId + ", lineName=" + mAutoPilotLine?.autoPilotLine?.lineName)
|
||||
writeChainLog(
|
||||
if (mAutopilotControlParameters != null && mAutopilotControlParameters?.autoPilotLine != null) {
|
||||
printInfoMsg("[下发轨迹] sendTrajectoryDownloadReq, lindId=" + mAutopilotControlParameters?.autoPilotLine?.lineId + ", lineName=" + mAutopilotControlParameters?.autoPilotLine?.lineName)
|
||||
OchChainLogManager.writeChainLogTrajectory(
|
||||
"轨迹监控",
|
||||
"sendTrajectoryReq() 下发轨迹 轨迹id" + mAutoPilotLine?.autoPilotLine?.lineId,
|
||||
true,
|
||||
OchChainLogManager.EVENT_KEY_INFE_WITH_TRAJECTORY
|
||||
"sendTrajectoryReq() 下发轨迹 轨迹id:${mAutopilotControlParameters?.autoPilotLine?.lineId}"
|
||||
)
|
||||
CallerAutoPilotControlManager.sendTrajectoryDownloadReq(
|
||||
mAutopilotControlParameters!!.autoPilotLine!!,
|
||||
COMMON_LOADING,
|
||||
mAutopilotControlParameters!!.orderId
|
||||
)
|
||||
CallerAutoPilotControlManager.sendTrajectoryDownloadReq(mAutoPilotLine!!.autoPilotLine!!, COMMON_LOADING)
|
||||
} else {
|
||||
e(SceneConstant.M_TAXI + TAG, "sendTrajectoryReq(): mAutoPilotLine is null!!!")
|
||||
e(TAG, "sendTrajectoryReq(): mAutoPilotLine is null!!!")
|
||||
}
|
||||
|
||||
if (mPreAutoPilotLine != null&&mPreAutoPilotLine?.autoPilotLine!=null) {
|
||||
printInfoMsg("[下发预加载轨迹] sendTrajectoryDownloadReq, lindId=" + mPreAutoPilotLine?.autoPilotLine?.lineId + ", lineName=" + mPreAutoPilotLine?.autoPilotLine?.lineName)
|
||||
CallerAutoPilotControlManager.sendTrajectoryDownloadReq(mPreAutoPilotLine!!.autoPilotLine!!, PRE_LOADING)
|
||||
if (mPreAutopilotControlParameters != null && mPreAutopilotControlParameters?.autoPilotLine != null) {
|
||||
printInfoMsg("[下发预加载轨迹] sendTrajectoryDownloadReq, lindId=" + mPreAutopilotControlParameters?.autoPilotLine?.lineId + ", lineName=" + mPreAutopilotControlParameters?.autoPilotLine?.lineName)
|
||||
CallerAutoPilotControlManager.sendTrajectoryDownloadReq(
|
||||
mPreAutopilotControlParameters!!.autoPilotLine!!,
|
||||
PRE_LOADING,
|
||||
mPreAutopilotControlParameters!!.orderId
|
||||
)
|
||||
} else {
|
||||
e(SceneConstant.M_TAXI + TAG, "sendTrajectoryReq(): mPreAutoPilotLine is null!!!")
|
||||
e(TAG, "sendTrajectoryReq(): mPreAutoPilotLine is null!!!")
|
||||
}
|
||||
d(
|
||||
SceneConstant.M_TAXI + TAG, "sendTrajectoryReq(): common_load = "
|
||||
+ GsonUtils.toJson(mAutoPilotLine) + ", pre_load" + GsonUtils.toJson(
|
||||
mPreAutoPilotLine
|
||||
TAG, "sendTrajectoryReq(): common_load = "
|
||||
+ GsonUtils.toJson(mAutopilotControlParameters) + ", pre_load" + GsonUtils.toJson(
|
||||
mPreAutopilotControlParameters
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@ object CallerAutoPilotControlManager {
|
||||
var result = -1L
|
||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
// Routing 需要传参 routeInfo
|
||||
result = providerApi?.sendTrajectoryDownloadReq(autopilotControlParameters.autoPilotLine!!, autopilotControlParameters.toRouteInfo(), "") ?: -1L
|
||||
result = providerApi?.sendTrajectoryDownloadReq(autopilotControlParameters.autoPilotLine!!, autopilotControlParameters.toRouteInfo(), autopilotControlParameters.orderId) ?: -1L
|
||||
CallerAutoPilotStatusListenerManager.invokeTrajectoryDownloadReq(autopilotControlParameters.autoPilotLine!!, downloadType)
|
||||
}
|
||||
return result
|
||||
@@ -234,11 +234,11 @@ object CallerAutoPilotControlManager {
|
||||
* 发送 轨迹下载请求
|
||||
* @param downloadType 下载类型: 0:正常下载 1:预下载
|
||||
*/
|
||||
fun sendTrajectoryDownloadReq(autoPilotLine: AutopilotControlParameters.AutoPilotLine, downloadType: Int): Long {
|
||||
fun sendTrajectoryDownloadReq(autoPilotLine: AutopilotControlParameters.AutoPilotLine, downloadType: Int,orderId:String): Long {
|
||||
var result = -1L
|
||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
//TODO Routing 需要传参 routeInfo,这里建议业务侧重新整合到同一个数据实体内传入
|
||||
result = providerApi?.sendTrajectoryDownloadReq(autoPilotLine, downloadType, null, "") ?: -1L
|
||||
result = providerApi?.sendTrajectoryDownloadReq(autoPilotLine, downloadType, null, orderId) ?: -1L
|
||||
CallerAutoPilotStatusListenerManager.invokeTrajectoryDownloadReq(autoPilotLine, downloadType)
|
||||
}
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user