[6.6.0]
[shuttle] [乘客屏适配]
This commit is contained in:
@@ -126,6 +126,11 @@ object TaskRepository {
|
||||
return taskDataDao?.queryRunningTaskByStatus()
|
||||
}
|
||||
|
||||
fun queryTaskById(taskId: Long): TaskDataBean? {
|
||||
return taskDataDao?.queryTaskByTaskIdOne(taskId)
|
||||
}
|
||||
|
||||
|
||||
fun endTask(taskId: Long) {
|
||||
DbThreadUtils.runInIoThread{
|
||||
taskDataDao?.endTask(taskId)
|
||||
|
||||
@@ -11,15 +11,22 @@ import com.mogo.eagle.core.network.utils.digest.DigestUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||
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.biz.login.LoginStatusManager
|
||||
import com.mogo.och.common.module.manager.autopilot.line.LineManager
|
||||
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.socket.lan.LanSocketManager
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.BusinessType
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.TaskDetailsMsg
|
||||
import com.mogo.och.common.module.network.OchCommonServiceCallback
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||
import com.mogo.och.common.module.utils.ResourcesUtils
|
||||
import com.mogo.och.data.bean.BusRoutesResult
|
||||
import com.mogo.och.data.bean.BusStationBean
|
||||
import com.mogo.och.data.bean.BusTransferData
|
||||
import com.mogo.och.shuttle.weaknet.R
|
||||
import com.mogo.och.weaknet.bean.BusQueryLineTaskResponse
|
||||
import com.mogo.och.weaknet.bean.BusQueryLinesResponse
|
||||
@@ -66,6 +73,9 @@ object BusLineModel {
|
||||
// 当前任务的站点列表
|
||||
var stationList:MutableList<BusStationBean>? = mutableListOf<BusStationBean>()
|
||||
|
||||
@JvmStatic
|
||||
val busRoutesResult: BusRoutesResult = BusRoutesResult()
|
||||
|
||||
|
||||
private val isRequesting = AtomicBoolean(false)
|
||||
private val loopQueryInfo = object :Runnable{
|
||||
@@ -333,19 +343,34 @@ object BusLineModel {
|
||||
override fun onSuccess(response: BusRoutesResponse?) {
|
||||
response?.data?.let {
|
||||
if (!it.sites.isNullOrEmpty()&&it.sites.size>1) {
|
||||
OchChainLogManager.writeChainLogDb("业务数据","本地没有正在运行的数据,服务器端有")
|
||||
LineRepository.saveRunningInfo(it.lineId,it.name,it.sites.last().name)
|
||||
TaskRepository.saveRunningInfo(it.lineId,it.taskId,it.taskTime)
|
||||
ContraiRepository.saveRunningInfo(
|
||||
it.lineId,
|
||||
it.csvFileMd5,
|
||||
it.csvFileUrl,
|
||||
it.txtFileUrl,
|
||||
it.txtFileMd5,
|
||||
it.contrailSaveTime
|
||||
)
|
||||
BusRoutesResponse.bean2Db(it.sites,it.lineId.toLong(),it.name,it.taskId.toLong())
|
||||
OrderModel.queryBusRoutes()
|
||||
val queryTaskById = TaskRepository.queryTaskById(it.taskId.toLong())
|
||||
if(queryTaskById==null||queryTaskById.status!=TaskDataBean.used) {
|
||||
OchChainLogManager.writeChainLogDb(
|
||||
"业务数据",
|
||||
"本地没有正在运行的数据,服务器端有"
|
||||
)
|
||||
LineRepository.saveRunningInfo(
|
||||
it.lineId,
|
||||
it.name,
|
||||
it.sites.last().name
|
||||
)
|
||||
TaskRepository.saveRunningInfo(it.lineId, it.taskId, it.taskTime)
|
||||
ContraiRepository.saveRunningInfo(
|
||||
it.lineId,
|
||||
it.csvFileMd5,
|
||||
it.csvFileUrl,
|
||||
it.txtFileUrl,
|
||||
it.txtFileMd5,
|
||||
it.contrailSaveTime
|
||||
)
|
||||
BusRoutesResponse.bean2Db(
|
||||
it.sites,
|
||||
it.lineId.toLong(),
|
||||
it.name,
|
||||
it.taskId.toLong()
|
||||
)
|
||||
OrderModel.queryBusRoutes()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -470,7 +495,6 @@ object BusLineModel {
|
||||
LineManager.lineInfos?.lineName?.let {lineName->
|
||||
EventRepository.saveEventTaskEnd(task.taskId!!,task.lineId!!,task.taskStartTime,lineName)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -507,5 +531,24 @@ object BusLineModel {
|
||||
}
|
||||
}
|
||||
|
||||
fun sendTaskDetailsToClients() {
|
||||
if (LineManager.lineInfos==null||currentTask==null||stationList.isNullOrEmpty()) {
|
||||
val data = BusTransferData(if (LoginStatusManager.isLogin()) 1 else 0, null)
|
||||
val msg = TaskDetailsMsg(GsonUtils.toJson(data), BusinessType.shuttle)
|
||||
d(M_BUS + TAG, "sendTaskDetailsToClients = " + GsonUtils.toJson(msg))
|
||||
LanSocketManager.sendMsgToClient(msg)
|
||||
}else{
|
||||
busRoutesResult.setSite(stationList)
|
||||
busRoutesResult.lineId = LineManager.lineInfos!!.lineId.toInt()
|
||||
busRoutesResult.name = LineManager.lineInfos!!.lineName
|
||||
busRoutesResult.taskId = currentTask!!.taskId!!.toInt()
|
||||
busRoutesResult.taskTime = currentTask!!.taskStartTime!!
|
||||
val data = BusTransferData(if (LoginStatusManager.isLogin()) 1 else 0, busRoutesResult)
|
||||
val msg = TaskDetailsMsg(GsonUtils.toJson(data), BusinessType.shuttle)
|
||||
d(M_BUS + TAG, "sendTaskDetailsToClients = " + GsonUtils.toJson(msg))
|
||||
LanSocketManager.sendMsgToClient(msg)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -71,9 +71,6 @@ object OrderModel {
|
||||
private val TAG: String = OrderModel::class.java.simpleName
|
||||
|
||||
private var mContext: Context? = null
|
||||
@JvmStatic
|
||||
var busRoutesResult: BusRoutesResult? = null
|
||||
private set
|
||||
|
||||
private var mADASStatusCallback: IBusADASStatusCallback? = null
|
||||
/**
|
||||
@@ -145,7 +142,7 @@ object OrderModel {
|
||||
// 乘客屏请求线路信息
|
||||
private val taskDetailsMsgListener = object : ILanMessageListener<TaskDetailsMsg> {
|
||||
override fun targetLan(): Class<TaskDetailsMsg> = TaskDetailsMsg::class.java
|
||||
override fun onLanMsgReceived(taskDetailsMsg: TaskDetailsMsg?) = sendTaskDetailsToClients()
|
||||
override fun onLanMsgReceived(taskDetailsMsg: TaskDetailsMsg?) = BusLineModel.sendTaskDetailsToClients()
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@@ -290,16 +287,18 @@ object OrderModel {
|
||||
*/
|
||||
@JvmStatic
|
||||
fun abortTask() {
|
||||
d(M_BUS + TAG, "结束当前路线abortTask")
|
||||
OCHThreadPoolManager.getsInstance().execute {
|
||||
d(M_BUS + TAG, "结束当前路线abortTask")
|
||||
|
||||
endOrAbortTaskSuccess()
|
||||
clearBusStationDatas()
|
||||
queryBusRoutes()
|
||||
removeTipRunnables()
|
||||
ShuttleVoiceManager.endOrderBus()
|
||||
// 取消自驾
|
||||
CallerAutoPilotControlManager.cancelAutoPilot()
|
||||
setTrajectoryStation(true)
|
||||
endOrAbortTaskSuccess()
|
||||
clearBusStationDatas()
|
||||
queryBusRoutes()
|
||||
removeTipRunnables()
|
||||
ShuttleVoiceManager.endOrderBus()
|
||||
// 取消自驾
|
||||
CallerAutoPilotControlManager.cancelAutoPilot()
|
||||
setTrajectoryStation(true)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -320,7 +319,7 @@ object OrderModel {
|
||||
}
|
||||
BusLineModel.endTask()
|
||||
|
||||
sendTaskDetailsToClients()
|
||||
BusLineModel.sendTaskDetailsToClients()
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -477,15 +476,6 @@ object OrderModel {
|
||||
updateBusStatus()
|
||||
}
|
||||
|
||||
|
||||
private fun sendTaskDetailsToClients() {
|
||||
val data = BusTransferData(if (LoginStatusManager.isLogin()) 1 else 0, busRoutesResult)
|
||||
val msg = TaskDetailsMsg(GsonUtils.toJson(data), BusinessType.shuttle)
|
||||
d(M_BUS + TAG, "sendTaskDetailsToClients = " + GsonUtils.toJson(msg))
|
||||
LanSocketManager.sendMsgToClient(msg)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 离站上报
|
||||
*/
|
||||
@@ -533,7 +523,7 @@ object OrderModel {
|
||||
fun autoDriveToNextStation() {
|
||||
if (BusLineModel.isLastStation()==true) {
|
||||
// 当前站是最后一站,结束当前行程
|
||||
endTask()
|
||||
abortTask()
|
||||
return
|
||||
}
|
||||
leaveStation()
|
||||
@@ -573,7 +563,7 @@ object OrderModel {
|
||||
}
|
||||
}
|
||||
|
||||
sendTaskDetailsToClients()
|
||||
BusLineModel.sendTaskDetailsToClients()
|
||||
|
||||
//更新bus路线面板
|
||||
updateBusTaskStatus()
|
||||
@@ -660,22 +650,6 @@ object OrderModel {
|
||||
val isRestartAutopilot: Boolean
|
||||
get() = firstStartAutopilot > 1
|
||||
|
||||
/**
|
||||
* task正常结束
|
||||
*/
|
||||
private fun endTask() {
|
||||
d(M_BUS + TAG, "结束当前路线abortTask")
|
||||
|
||||
endOrAbortTaskSuccess()
|
||||
clearBusStationDatas()
|
||||
queryBusRoutes()
|
||||
removeTipRunnables()
|
||||
ShuttleVoiceManager.endOrderBus()
|
||||
// 取消自驾
|
||||
CallerAutoPilotControlManager.cancelAutoPilot()
|
||||
setTrajectoryStation(true)
|
||||
}
|
||||
|
||||
/**
|
||||
* 到站
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user