[6.8.4]
[fea] [添加日志]
This commit is contained in:
@@ -10,9 +10,11 @@ import java.util.List;
|
||||
* @date: 2022/2/9
|
||||
*/
|
||||
public interface IBusLinesCallback {
|
||||
|
||||
default void onChangeLineIdSuccess(){}
|
||||
|
||||
default void onRefreshSuccess(long currentTimeStamp){}
|
||||
|
||||
default void onRefreshSuccessWIthData(){}
|
||||
|
||||
default void onChangeLineIdFail(){}
|
||||
@@ -23,11 +25,10 @@ public interface IBusLinesCallback {
|
||||
|
||||
default void onLeaveStaionSuccess(){}
|
||||
|
||||
default void onLeaveStaionFail(){}
|
||||
|
||||
default void onArriveStationSuccess(){}
|
||||
|
||||
default void onCompleteTask(){}
|
||||
|
||||
default void onCompleteTaskFail(){}
|
||||
|
||||
default void onEndTaskByOther(long taskId,String plateNumber){}
|
||||
|
||||
@@ -11,7 +11,6 @@ import com.mogo.eagle.core.data.v2x.Point
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||
import com.mogo.eagle.core.function.call.datacenter.CallerDataCenterBizListener
|
||||
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.NetworkUtils
|
||||
@@ -83,7 +82,7 @@ object LineModel {
|
||||
|
||||
@JvmStatic
|
||||
fun init() {
|
||||
CallerLogger.d(TAG,"init")
|
||||
d(TAG,"init")
|
||||
mContext = AbsMogoApplication.getApp()
|
||||
EventModel.load()
|
||||
queryCarExecutableTaskList(true)
|
||||
@@ -92,7 +91,7 @@ object LineModel {
|
||||
@JvmStatic
|
||||
@Synchronized
|
||||
fun release() {
|
||||
CallerLogger.d(TAG,"release")
|
||||
d(TAG,"release")
|
||||
mContext = null
|
||||
EventModel.release()
|
||||
mBusLinesCallbackMap.clear()
|
||||
@@ -119,7 +118,7 @@ object LineModel {
|
||||
*/
|
||||
private fun queryCarExecutableTaskList(isBackground:Boolean) {
|
||||
if(isRequesting.get()){
|
||||
CallerLogger.d(TAG,"正在同步请稍等")
|
||||
d(TAG,"正在同步请稍等")
|
||||
val lastUpdateTime = SharedPrefsMgr.getInstance().getLong(EXECUTABLECHANGETIME, 0)
|
||||
mBusLinesCallbackMap.forEach { callback ->
|
||||
callback.value.onRefreshSuccess(lastUpdateTime)
|
||||
@@ -127,12 +126,12 @@ object LineModel {
|
||||
return
|
||||
}
|
||||
isRequesting.set(true)
|
||||
CallerLogger.d(TAG,"开始同步数据")
|
||||
d(TAG,"开始同步数据")
|
||||
RepositoryManager.queryCarExecutableTaskList(
|
||||
object : OchCommonServiceCallback<CarExecutableTaskResponse> {
|
||||
override fun onSuccess(data: CarExecutableTaskResponse) {
|
||||
isRequesting.set(false)
|
||||
CallerLogger.d(TAG,"同步数据成功")
|
||||
d(TAG,"同步数据成功")
|
||||
RxUtils.disposeSubscribe(queryCarInfo)
|
||||
queryCarInfo = RxUtils.createSubscribe(60_000) {
|
||||
queryCarExecutableTaskList(true)
|
||||
@@ -160,7 +159,7 @@ object LineModel {
|
||||
)
|
||||
val startTime = System.currentTimeMillis()
|
||||
CarExecutableTaskResponse.save2Db(data)
|
||||
CallerLogger.d(TAG,"更新数据耗时${System.currentTimeMillis()-startTime}___${Thread.currentThread().name}")
|
||||
d(TAG,"更新数据耗时${System.currentTimeMillis()-startTime}___${Thread.currentThread().name}")
|
||||
RxUtils.createSubscribe(800) {
|
||||
// 等待写入数据库
|
||||
mBusLinesCallbackMap.forEach { callback ->
|
||||
@@ -171,7 +170,7 @@ object LineModel {
|
||||
|
||||
override fun onError() {
|
||||
isRequesting.set(false)
|
||||
CallerLogger.d(TAG,"同步数据失败 onError")
|
||||
d(TAG,"同步数据失败 onError")
|
||||
RxUtils.disposeSubscribe(queryCarInfo)
|
||||
queryCarInfo = RxUtils.createSubscribe(60_000) {
|
||||
queryCarExecutableTaskList(true)
|
||||
@@ -187,7 +186,7 @@ object LineModel {
|
||||
|
||||
override fun onFail(code: Int, failMsg: String) {
|
||||
isRequesting.set(false)
|
||||
CallerLogger.d(TAG,"同步数据失败 onFail")
|
||||
d(TAG,"同步数据失败 onFail")
|
||||
RxUtils.disposeSubscribe(queryCarInfo)
|
||||
queryCarInfo = RxUtils.createSubscribe(60_000) {
|
||||
queryCarExecutableTaskList(true)
|
||||
@@ -204,23 +203,6 @@ object LineModel {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询可用线路
|
||||
*/
|
||||
@JvmStatic
|
||||
fun queryBusLines() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过线路id 查询线路排班表
|
||||
* @param lineId 线路ID
|
||||
*/
|
||||
@JvmStatic
|
||||
fun queryBusLineTasksById(lineId: Long) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始任务
|
||||
*/
|
||||
@@ -431,7 +413,7 @@ object LineModel {
|
||||
}
|
||||
|
||||
fun callEyeMap(index:Int){
|
||||
CallerLogger.d(TAG,"执行${index} callEyeMap${stationList?.size}")
|
||||
d(TAG,"执行${index} callEyeMap${stationList?.size}")
|
||||
if(stationList.isNullOrEmpty()){
|
||||
val ochInfo = OchInfo(1, mutableListOf())
|
||||
ochInfo.siteMarkerList = mutableListOf()
|
||||
@@ -476,7 +458,7 @@ object LineModel {
|
||||
|
||||
fun endTaskByOther(taskId: Long,plateNumber:String) {
|
||||
if(LoginStatusManager.getLoginInfo()?.plateNumber==plateNumber){
|
||||
CallerLogger.d(TAG,"当前车辆消耗任务")
|
||||
d(TAG,"当前车辆消耗任务")
|
||||
return
|
||||
}
|
||||
RepositoryManager.endTaskByOther(taskId)
|
||||
|
||||
@@ -170,12 +170,12 @@ object OrderModel {
|
||||
?.observeOn(AndroidSchedulers.mainThread())
|
||||
?.subscribe(object : Observer<Boolean> {
|
||||
override fun onSubscribe(d: Disposable) {
|
||||
d(TAG, "onSubscribe")
|
||||
d(M_BUS + TAG, "onSubscribe")
|
||||
}
|
||||
|
||||
override fun onError(e: Throwable) {
|
||||
e.printStackTrace()
|
||||
d(TAG, "onError${e.printStackTrace()}")
|
||||
d(M_BUS + TAG, "onError${e.printStackTrace()}")
|
||||
LineModel.haveNoRunningTask()
|
||||
d(M_BUS + TAG, "获取到小巴路线数据:空 ")
|
||||
LineManager.setLineInfo(null)
|
||||
@@ -185,7 +185,7 @@ object OrderModel {
|
||||
}
|
||||
|
||||
override fun onComplete() {
|
||||
d(TAG, "onComplete")
|
||||
d(M_BUS + TAG, "onComplete")
|
||||
}
|
||||
|
||||
override fun onNext(data: Boolean) {
|
||||
|
||||
@@ -113,8 +113,19 @@ abstract class MyDataBase : RoomDatabase() {
|
||||
|
||||
FileUtils.createOrExistsDir(ROOT_PATH)
|
||||
|
||||
return Room.databaseBuilder(
|
||||
AbsMogoApplication.getApp()!!.applicationContext, MyDataBase::class.java, ROOT_PATH+roomName
|
||||
val dbFile = AbsMogoApplication.getApp().getDatabasePath(roomName)
|
||||
|
||||
val oldDbFile = File(ROOT_PATH)
|
||||
oldDbFile.listFiles()?.forEach {
|
||||
FileUtils.moveFile(it,File(dbFile.parent+File.separator+it.name),null)
|
||||
}
|
||||
|
||||
FileUtils.deleteFilesInDir(ROOT_PATH)
|
||||
|
||||
return Room.databaseBuilder(
|
||||
AbsMogoApplication.getApp()!!.applicationContext,
|
||||
MyDataBase::class.java,
|
||||
dbFile.path
|
||||
)
|
||||
.addMigrations(MIGRATION_1_2)
|
||||
.addMigrations(MIGRATION_2_3)
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.common.module.manager.autopilot.line.LineManager
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||
@@ -68,18 +69,18 @@ class WeaknetRepository : ILineRepository {
|
||||
}
|
||||
|
||||
override fun loadCurrentTaskInfo(): Observable<Boolean>? {
|
||||
|
||||
return Observable.just(123)
|
||||
.flatMap {
|
||||
// 获取正在运行的任务
|
||||
val runningTaskInfo = TaskDb.queryRunningTask()
|
||||
if (runningTaskInfo.isNullOrEmpty()) {
|
||||
// 本地没有进行中的任务
|
||||
CallerLogger.d(TAG, "没有查询到正在运行的任务")
|
||||
CallerLogger.d(M_BUS + TAG, "没有查询到正在运行的任务")
|
||||
return@flatMap loadServerRuningTask()
|
||||
} else if (runningTaskInfo.size > 1) {
|
||||
// 本地有多条正在进行的任务 需要check event
|
||||
// 1 比对event表 1 清理错误数据 2 加载后台数据
|
||||
CallerLogger.d(M_BUS + TAG, "查询到多个正在执行的任务")
|
||||
return@flatMap selectRightData(runningTaskInfo)
|
||||
} else {
|
||||
// 只有一条进行中的任务
|
||||
@@ -164,6 +165,7 @@ class WeaknetRepository : ILineRepository {
|
||||
"业务数据",
|
||||
"本地没有正在运行的数据,服务器端有${busRoutesResult}"
|
||||
)
|
||||
CallerLogger.d(M_BUS + TAG,"本地没有正在运行的数据,服务器端有${busRoutesResult}")
|
||||
LineDb.saveRunningInfo(
|
||||
busRoutesResult.lineId,
|
||||
busRoutesResult.name,
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.view.LayoutInflater
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.findViewTreeViewModelStoreOwner
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||
import com.mogo.och.common.module.utils.ResourcesUtils
|
||||
@@ -50,19 +51,25 @@ class SwitchBizView: WindowRelativeLayout, SwtichBizeModel.SwtichLineViewCallbac
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
CallerLogger.d(M_BUS+TAG,"SwitchBizView:onAttachedToWindow")
|
||||
super.onAttachedToWindow()
|
||||
viewModel = findViewTreeViewModelStoreOwner()?.let {
|
||||
ViewModelProvider(it).get(SwtichBizeModel::class.java)
|
||||
ViewModelProvider(it)[SwtichBizeModel::class.java]
|
||||
}
|
||||
viewModel?.setDistanceCallback(this)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
CallerLogger.d(M_BUS+TAG,"SwitchBizView:onDetachedFromWindow")
|
||||
}
|
||||
|
||||
var startLoading = System.currentTimeMillis()
|
||||
|
||||
// 展示loading页面
|
||||
override fun showLoadingView(){
|
||||
startLoading = System.currentTimeMillis()
|
||||
CallerLogger.d(TAG,"开始展示 lading 时间:${startLoading}")
|
||||
CallerLogger.d(M_BUS+TAG,"开始展示 lading 时间:${startLoading}")
|
||||
loading_biz.visibility = VISIBLE
|
||||
swtichLine.visibility = GONE
|
||||
swtichTask.visibility = GONE
|
||||
@@ -72,7 +79,6 @@ class SwitchBizView: WindowRelativeLayout, SwtichBizeModel.SwtichLineViewCallbac
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 初始化数据
|
||||
*/
|
||||
@@ -91,7 +97,7 @@ class SwitchBizView: WindowRelativeLayout, SwtichBizeModel.SwtichLineViewCallbac
|
||||
RxUtils.disposeSubscribe(queryTimeout)
|
||||
val endLoading = System.currentTimeMillis()
|
||||
val dex = (100-(endLoading - startLoading)).takeIf { it>=0 }?:0
|
||||
CallerLogger.d(TAG,"展示任务 lading 展示了 ${dex}毫秒")
|
||||
CallerLogger.d(M_BUS+TAG,"展示任务 lading 展示了 ${dex}毫秒")
|
||||
|
||||
ThreadUtils.runOnUiThreadDelayed({
|
||||
loading_biz.visibility = GONE
|
||||
@@ -106,7 +112,7 @@ class SwitchBizView: WindowRelativeLayout, SwtichBizeModel.SwtichLineViewCallbac
|
||||
RxUtils.disposeSubscribe(queryTimeout)
|
||||
val endLoading = System.currentTimeMillis()
|
||||
val dex = (100-(endLoading - startLoading)).takeIf { it>=0 }?:0
|
||||
CallerLogger.d(TAG,"展示线路 lading 展示了 ${dex}毫秒")
|
||||
CallerLogger.d(M_BUS+TAG,"展示线路 lading 展示了 ${dex}毫秒")
|
||||
ThreadUtils.runOnUiThreadDelayed({
|
||||
loading_biz.visibility = GONE
|
||||
swtichLine.visibility = VISIBLE
|
||||
@@ -120,7 +126,7 @@ class SwitchBizView: WindowRelativeLayout, SwtichBizeModel.SwtichLineViewCallbac
|
||||
RxUtils.disposeSubscribe(queryTimeout)
|
||||
val endLoading = System.currentTimeMillis()
|
||||
val dex = (100-(endLoading - startLoading)).takeIf { it>=0 }?:0
|
||||
CallerLogger.d(TAG,"展示运行中任务 lading 展示了 ${dex}毫秒")
|
||||
CallerLogger.d(M_BUS+TAG,"展示运行中任务 lading 展示了 ${dex}毫秒")
|
||||
ThreadUtils.runOnUiThreadDelayed({
|
||||
loading_biz.visibility = GONE
|
||||
swtichLine.visibility = GONE
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
package com.mogo.och.weaknet.ui.bizswitch
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
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.ThreadUtils
|
||||
import com.mogo.och.weaknet.callback.IBusLinesCallback
|
||||
import com.mogo.och.weaknet.model.LineModel
|
||||
import com.mogo.och.weaknet.model.OrderModel
|
||||
import com.mogo.och.weaknet.repository.db.bean.LineDataBean
|
||||
import com.mogo.och.weaknet.ui.switchtask.SwitchTaskView
|
||||
import com.mogo.och.weaknet.ui.switchtask.SwitchTaskView.Companion
|
||||
|
||||
/**
|
||||
* @author XuXinChao
|
||||
@@ -24,10 +22,12 @@ class SwtichBizeModel : ViewModel(), IBusLinesCallback {
|
||||
|
||||
|
||||
override fun onCleared() {
|
||||
d(M_BUS + TAG,"SwtichBizeModel onCleared")
|
||||
LineModel.setBusLinesCallback(TAG, null)
|
||||
}
|
||||
|
||||
fun setDistanceCallback(viewCallback: SwtichLineViewCallback) {
|
||||
d(M_BUS + TAG,"SwtichBizeModel setDistanceCallback")
|
||||
this.viewCallback = viewCallback
|
||||
LineModel.setBusLinesCallback(TAG, this)
|
||||
this.viewCallback?.showLoadingView()
|
||||
@@ -43,7 +43,7 @@ class SwtichBizeModel : ViewModel(), IBusLinesCallback {
|
||||
}
|
||||
|
||||
fun loadingSwitchTask(lineInfo: LineDataBean) {
|
||||
d(LineModel.TAG, "loadingSwitchTask 查询线路的任务线路信息:${lineInfo}")
|
||||
d(M_BUS+TAG, "loadingSwitchTask 查询线路的任务线路信息:${lineInfo}")
|
||||
viewCallback?.showSwitchTaskByLineInfo(lineInfo)
|
||||
}
|
||||
|
||||
@@ -76,12 +76,12 @@ class SwtichBizeModel : ViewModel(), IBusLinesCallback {
|
||||
|
||||
override fun onNoRunningTask() {
|
||||
this.viewCallback?.loadLineData()
|
||||
CallerLogger.d(TAG,"没有任务去加载线路")
|
||||
d(M_BUS+TAG,"没有任务去加载线路")
|
||||
}
|
||||
|
||||
override fun onRunningTask() {
|
||||
this.viewCallback?.loadRunningTask()
|
||||
CallerLogger.d(TAG,"有任务去加载正在执行的任务")
|
||||
d(M_BUS+TAG,"有任务去加载正在执行的任务")
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -44,7 +44,6 @@ class SwtichLineModel : ViewModel(), IBusLinesCallback {
|
||||
}
|
||||
|
||||
fun queryBusLines(loading:Boolean) {
|
||||
LineModel.queryBusLines()
|
||||
RxUtils.disposeSubscribe(endTaskDisposable)
|
||||
RepositoryManager.queryCanUseLine()
|
||||
?.subscribeOn(Schedulers.io())
|
||||
|
||||
@@ -25,7 +25,6 @@ import com.mogo.eagle.core.utilcode.kotlin.lifeCycleOwner
|
||||
import com.mogo.eagle.core.utilcode.reminder.Reminder
|
||||
import com.mogo.eagle.core.utilcode.reminder.api.impl.PopupWindowReminder
|
||||
import com.mogo.eagle.core.utilcode.util.*
|
||||
import com.mogo.och.weaknet.ui.bizswitch.SwitchBizView
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
import kotlin.math.abs
|
||||
|
||||
|
||||
@@ -53,13 +53,6 @@ class TaskRunningModel : ViewModel(), IBusLinesCallback {
|
||||
})
|
||||
}
|
||||
|
||||
override fun onLeaveStaionFail() {
|
||||
BizLoopManager.runInMainThread{
|
||||
viewCallback?.showRunningTaskInfo()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun arriveStation() {
|
||||
OrderModel.onArriveAt(null, "页面触发到站")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user