Merge branch 'refs/heads/dev_robobus-d_241028_6.7.3' into dev_robobus-d_241028_6.8.0_yyk
# Conflicts: # OCH/shuttle/driver_weaknet/schemas/com.mogo.och.weaknet.repository.db.MyDataBase/4.json
This commit is contained in:
@@ -17,7 +17,7 @@ data class ShuttleEventRequest(val requestId: String, val sn: String, val busine
|
||||
var tempEvent: Event?=null
|
||||
waitUpdateEvent.forEach {
|
||||
tempEvent = Event(it.eventType,
|
||||
EventData(it.taskId,it.businessTime,it.writeVersion,it.siteId,it.seq,it.driverId)
|
||||
EventData(it.taskId,it.businessTime,it.writeVersion,it.siteId,it.seq,it.driverId,it.msgId)
|
||||
)
|
||||
eventList4Request.add(tempEvent!!)
|
||||
}
|
||||
@@ -35,5 +35,6 @@ data class EventData(
|
||||
var writeVersion: Long?,
|
||||
var siteId: Long?,
|
||||
var seq: Int?,
|
||||
var driverId:Long?
|
||||
var driverId:Long?,
|
||||
var msgId:String?
|
||||
)
|
||||
@@ -54,11 +54,16 @@ class BusRoutesResponse : BaseData() {
|
||||
temp?.seq = (taskAndsite.seq ?: 0)
|
||||
temp?.siteId = if (taskAndsite.siteId == null) 0 else taskAndsite.siteId!!.toInt()
|
||||
if(!taskAndsite.videoList.isNullOrEmpty()){
|
||||
val list = GsonUtils.fromJson<List<SiteIntroduce>>(
|
||||
taskAndsite.videoList,
|
||||
object : TypeToken<List<SiteIntroduce?>?>() {}.type
|
||||
)
|
||||
temp?.videoList = list.toMutableList()
|
||||
try {
|
||||
val list = GsonUtils.fromJson<List<SiteIntroduce>>(
|
||||
taskAndsite.videoList,
|
||||
object : TypeToken<List<SiteIntroduce?>?>() {}.type
|
||||
)
|
||||
temp?.videoList = list.toMutableList()
|
||||
}catch (e:Exception){
|
||||
temp?.videoList = null
|
||||
}
|
||||
|
||||
}
|
||||
result.add(temp!!)
|
||||
// 正在进行中的任务
|
||||
|
||||
@@ -55,6 +55,10 @@ object EventModel : EventDb.EventCallback {
|
||||
|
||||
|
||||
private fun updateEvent(){
|
||||
if(isUpdating.get()){
|
||||
OchChainLogManager.writeChainLogDb("上报event","正在上传 等待下一次轮训 ${Thread.currentThread().name}")
|
||||
return
|
||||
}
|
||||
isUpdating.set(true)
|
||||
createDefault.onNext(isUpdating.get())
|
||||
ThreadUtils.getSinglePool().submit {
|
||||
@@ -72,6 +76,7 @@ object EventModel : EventDb.EventCallback {
|
||||
override fun onSuccess(data: BaseData?) {
|
||||
waitUpdateEvent.forEach {
|
||||
it.updateStatus = EventDataBean.updated
|
||||
it.upDateTime = System.currentTimeMillis()
|
||||
}
|
||||
OchChainLogManager.writeChainLogDb("上报event成功","$transformDb2Net ${Thread.currentThread().name}")
|
||||
EventDb.saveUpdateSuccess(waitUpdateEvent)
|
||||
|
||||
@@ -457,6 +457,10 @@ object OrderModel {
|
||||
ToastUtils.showShort(ResourcesUtils.getString(R.string.shuttle_logout_error))
|
||||
return@execute
|
||||
}
|
||||
if(RepositoryManager.haveRunningTask()){
|
||||
ToastUtils.showShort(ResourcesUtils.getString(R.string.shuttle_logout_error_running))
|
||||
return@execute
|
||||
}
|
||||
MapMakerManager.removeAllMapMarkerByOwner(TAG)
|
||||
BusTrajectoryManager.getInstance().stopTrajReqLoop();
|
||||
LoginStatusManager.loginOut()
|
||||
|
||||
@@ -132,6 +132,7 @@ object ThirdDeviceData {
|
||||
busRoutesResult.name = lineInfo.lineName
|
||||
busRoutesResult.taskId = LineModel.currentTask!!.taskId!!.toInt()
|
||||
busRoutesResult.taskTime = LineModel.currentTask!!.taskStartTime!!
|
||||
busRoutesResult.writeVersion = System.currentTimeMillis()
|
||||
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))
|
||||
|
||||
@@ -130,6 +130,10 @@ object RepositoryManager {
|
||||
writeOffRepository?.queryWriteoffCount(context,taskId,siteId,callback)
|
||||
}
|
||||
|
||||
fun haveRunningTask():Boolean{
|
||||
return repository?.haveRunningTask()?:false
|
||||
}
|
||||
|
||||
|
||||
fun haveDataWaitSyn(): Boolean {
|
||||
if(ProjectUtils.isSaas()&&AppIdentityModeUtils.isShuttle(FunctionBuildConfig.appIdentityMode)) {
|
||||
|
||||
@@ -31,7 +31,7 @@ import java.io.File
|
||||
//entities指定该数据库有哪些表,多张表就逗号分隔
|
||||
//version指定数据库版本号,升级时需要用到
|
||||
//数据库继承自RoomDatabase
|
||||
@Database(entities = [ContrailDataBean::class, LineDataBean::class, SiteDataBean::class, TaskDataBean::class, TaskSiteDataBean::class, EventDataBean::class], version = 3)
|
||||
@Database(entities = [ContrailDataBean::class, LineDataBean::class, SiteDataBean::class, TaskDataBean::class, TaskSiteDataBean::class, EventDataBean::class], version = 4)
|
||||
abstract class MyDataBase : RoomDatabase() {
|
||||
|
||||
override fun getOpenHelper(): SupportSQLiteOpenHelper {
|
||||
@@ -90,6 +90,9 @@ abstract class MyDataBase : RoomDatabase() {
|
||||
)
|
||||
.addMigrations(Migration1_2(1,2))
|
||||
.addMigrations(Migration2_3(2,3))
|
||||
.addMigrations(Migration3_4(3,4))
|
||||
.addMigrations(Migration2_4(2,4))
|
||||
.fallbackToDestructiveMigration()
|
||||
.build()
|
||||
}
|
||||
val ROOT_PATH = Environment.getExternalStorageDirectory().absolutePath + File.separator + "Mogo" + File.separator + "APP_cache" + File.separator //程序外部存储跟目录
|
||||
@@ -114,4 +117,20 @@ abstract class MyDataBase : RoomDatabase() {
|
||||
database.execSQL("ALTER TABLE ${TaskSiteDataBean.usedTaskDataTable} ADD COLUMN videoList TEXT");
|
||||
}
|
||||
}
|
||||
|
||||
class Migration3_4(val startVersion:Int,val endVersion:Int): Migration(startVersion,endVersion) {
|
||||
override fun migrate(database: SupportSQLiteDatabase) {
|
||||
database.execSQL("ALTER TABLE ${EventDataBean.evnetDataTable} ADD COLUMN msg_id TEXT")
|
||||
database.execSQL("ALTER TABLE ${EventDataBean.evnetDataTable} ADD COLUMN update_time INTEGER")
|
||||
}
|
||||
}
|
||||
|
||||
class Migration2_4(val startVersion:Int,val endVersion:Int): Migration(startVersion,endVersion) {
|
||||
override fun migrate(database: SupportSQLiteDatabase) {
|
||||
database.execSQL("ALTER TABLE ${SiteDataBean.siteDataTable} ADD COLUMN videoList TEXT");
|
||||
database.execSQL("ALTER TABLE ${TaskSiteDataBean.usedTaskDataTable} ADD COLUMN videoList TEXT");
|
||||
database.execSQL("ALTER TABLE ${EventDataBean.evnetDataTable} ADD COLUMN msg_id TEXT")
|
||||
database.execSQL("ALTER TABLE ${EventDataBean.evnetDataTable} ADD COLUMN update_time INTEGER")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,7 +80,13 @@ data class EventDataBean(
|
||||
val eventSaveTime: Long = System.currentTimeMillis(),
|
||||
|
||||
@ColumnInfo(name = "update_status", typeAffinity = ColumnInfo.INTEGER)
|
||||
var updateStatus:Int = 0
|
||||
var updateStatus:Int = 0,
|
||||
|
||||
@ColumnInfo(name = "msg_id", typeAffinity = ColumnInfo.TEXT)
|
||||
var msgId:String? = "",
|
||||
|
||||
@ColumnInfo(name = "update_time", typeAffinity = ColumnInfo.INTEGER)
|
||||
var upDateTime:Long? = 0L,
|
||||
|
||||
) {
|
||||
companion object {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.och.weaknet.repository.db.repository
|
||||
|
||||
import com.mogo.och.common.module.biz.login.LoginStatusManager
|
||||
import com.mogo.och.common.module.manager.cache.OchSPManager
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||
@@ -40,6 +41,7 @@ object EventDb: IDbRepository {
|
||||
event.driverId = LoginStatusManager.getLoginInfo()?.driverId?:-1
|
||||
event.siteId = 0L
|
||||
event.seq = 0
|
||||
event.msgId = "${OchSPManager.getSn()}_${DateTimeUtil.getCurrentTimeStamp()}"
|
||||
BizLoopManager.runInIoThread {
|
||||
eventDataDao?.insert(event)
|
||||
eventCallback?.notifySyn()
|
||||
@@ -65,6 +67,7 @@ object EventDb: IDbRepository {
|
||||
event.siteId = siteId
|
||||
event.driverId = LoginStatusManager.getLoginInfo()?.driverId?:-1
|
||||
event.seq = seq
|
||||
event.msgId = "${OchSPManager.getSn()}_${DateTimeUtil.getCurrentTimeStamp()}"
|
||||
BizLoopManager.runInIoThread {
|
||||
eventDataDao?.insert(event)
|
||||
eventCallback?.notifySyn()
|
||||
@@ -90,6 +93,7 @@ object EventDb: IDbRepository {
|
||||
event.driverId = LoginStatusManager.getLoginInfo()?.driverId?:-1L
|
||||
event.siteId = siteId
|
||||
event.seq = seq
|
||||
event.msgId = "${OchSPManager.getSn()}_${DateTimeUtil.getCurrentTimeStamp()}"
|
||||
BizLoopManager.runInIoThread {
|
||||
eventDataDao?.insert(event)
|
||||
eventCallback?.notifySyn()
|
||||
@@ -108,6 +112,7 @@ object EventDb: IDbRepository {
|
||||
event.driverId = LoginStatusManager.getLoginInfo()?.driverId?:-1L
|
||||
event.siteId = 0L
|
||||
event.seq = 0
|
||||
event.msgId = "${OchSPManager.getSn()}_${DateTimeUtil.getCurrentTimeStamp()}"
|
||||
BizLoopManager.runInIoThread {
|
||||
eventDataDao?.insert(event)
|
||||
eventCallback?.notifySyn()
|
||||
|
||||
@@ -56,8 +56,15 @@ object TaskDb : IDbRepository {
|
||||
taskDataDao.insert(*needAddDatas.toTypedArray())
|
||||
}
|
||||
if (needMinusDatas.isNotEmpty()) {
|
||||
val needSaveTask = mutableListOf<TaskDataBean>()
|
||||
// 删除任务
|
||||
taskDataDao.delete(*needMinusDatas.toTypedArray())
|
||||
needMinusDatas.forEach {
|
||||
if(it.status==TaskDataBean.useing||it.status==TaskDataBean.used){
|
||||
needSaveTask.add(it)
|
||||
}
|
||||
}
|
||||
val failneedMinusDatas = needMinusDatas-needSaveTask
|
||||
taskDataDao.delete(*failneedMinusDatas.toTypedArray())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,10 @@ interface ILineRepository {
|
||||
|
||||
fun reportCabinEvent(context: Context?, data: ShuttleEventRequest?, callback: OchCommonServiceCallback<BaseData?>?)
|
||||
|
||||
fun haveRunningTask(): Boolean{
|
||||
return false
|
||||
}
|
||||
|
||||
fun release()
|
||||
|
||||
}
|
||||
@@ -327,6 +327,14 @@ class WeaknetRepository : ILineRepository {
|
||||
weakNetInterface?.reportCabinEvent(context,data,callback)
|
||||
}
|
||||
|
||||
override fun haveRunningTask(): Boolean {
|
||||
if(LineModel.currentTask==null){
|
||||
return false
|
||||
}else{
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
override fun release() {
|
||||
weakNetInterface = null
|
||||
CallerLogger.d(TAG,"重置 weakNetInterface")
|
||||
|
||||
@@ -7,10 +7,13 @@ import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.findViewTreeViewModelStoreOwner
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
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
|
||||
import com.mogo.och.common.module.utils.RxUtils
|
||||
import com.mogo.och.common.module.wigets.WindowRelativeLayout
|
||||
import com.mogo.och.shuttle.weaknet.R
|
||||
import com.mogo.och.weaknet.repository.db.bean.LineDataBean
|
||||
import io.reactivex.disposables.Disposable
|
||||
import kotlinx.android.synthetic.main.shuttle_weak_switch_biz.view.loading_biz
|
||||
import kotlinx.android.synthetic.main.shuttle_weak_switch_biz.view.swtichLine
|
||||
import kotlinx.android.synthetic.main.shuttle_weak_switch_biz.view.swtichTask
|
||||
@@ -34,6 +37,8 @@ class SwitchBizView: WindowRelativeLayout, SwtichBizeModel.SwtichLineViewCallbac
|
||||
|
||||
private var viewModel: SwtichBizeModel?=null
|
||||
|
||||
private var queryTimeout: Disposable? = null
|
||||
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.shuttle_weak_switch_biz, this, true)
|
||||
@@ -57,9 +62,14 @@ class SwitchBizView: WindowRelativeLayout, SwtichBizeModel.SwtichLineViewCallbac
|
||||
// 展示loading页面
|
||||
override fun showLoadingView(){
|
||||
startLoading = System.currentTimeMillis()
|
||||
CallerLogger.d(TAG,"开始展示 lading 时间:${startLoading}")
|
||||
loading_biz.visibility = VISIBLE
|
||||
swtichLine.visibility = GONE
|
||||
swtichTask.visibility = GONE
|
||||
queryTimeout = RxUtils.createSubscribe(10_1000) {
|
||||
OchChainLogManager.writeChainLog("Loading超时","loading 展示了10s")
|
||||
viewModel?.queryRuningTask()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -78,8 +88,8 @@ class SwitchBizView: WindowRelativeLayout, SwtichBizeModel.SwtichLineViewCallbac
|
||||
|
||||
// 展示选择任务页面
|
||||
override fun showSwitchTaskInfo() {
|
||||
RxUtils.disposeSubscribe(queryTimeout)
|
||||
val endLoading = System.currentTimeMillis()
|
||||
|
||||
val dex = (100-(endLoading - startLoading)).takeIf { it>=0 }?:0
|
||||
CallerLogger.d(TAG,"展示任务 lading 展示了 ${dex}毫秒")
|
||||
|
||||
@@ -93,6 +103,7 @@ class SwitchBizView: WindowRelativeLayout, SwtichBizeModel.SwtichLineViewCallbac
|
||||
|
||||
// 展示选择线路页面
|
||||
override fun showSwtichLineView() {
|
||||
RxUtils.disposeSubscribe(queryTimeout)
|
||||
val endLoading = System.currentTimeMillis()
|
||||
val dex = (100-(endLoading - startLoading)).takeIf { it>=0 }?:0
|
||||
CallerLogger.d(TAG,"展示线路 lading 展示了 ${dex}毫秒")
|
||||
@@ -106,6 +117,7 @@ class SwitchBizView: WindowRelativeLayout, SwtichBizeModel.SwtichLineViewCallbac
|
||||
}
|
||||
// 展示正在进行的任务
|
||||
override fun loadRunningTask() {
|
||||
RxUtils.disposeSubscribe(queryTimeout)
|
||||
val endLoading = System.currentTimeMillis()
|
||||
val dex = (100-(endLoading - startLoading)).takeIf { it>=0 }?:0
|
||||
CallerLogger.d(TAG,"展示运行中任务 lading 展示了 ${dex}毫秒")
|
||||
|
||||
@@ -36,6 +36,12 @@ class SwtichBizeModel : ViewModel(), IBusLinesCallback {
|
||||
}
|
||||
}
|
||||
|
||||
fun queryRuningTask(){
|
||||
ThreadUtils.getIoPool().execute {
|
||||
OrderModel.queryBusRoutes()
|
||||
}
|
||||
}
|
||||
|
||||
fun loadingSwitchTask(lineInfo: LineDataBean) {
|
||||
d(LineModel.TAG, "loadingSwitchTask 查询线路的任务线路信息:${lineInfo}")
|
||||
viewCallback?.showSwitchTaskByLineInfo(lineInfo)
|
||||
|
||||
@@ -6,11 +6,10 @@ import androidx.appcompat.widget.AppCompatTextView
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.findViewTreeViewModelStoreOwner
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.env.ProjectUtils
|
||||
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.och.shuttle.weaknet.R
|
||||
import com.mogo.och.weaknet.repository.RepositoryManager
|
||||
import com.mogo.och.weaknet.ui.taskrunning.TaskRunningAdapter
|
||||
|
||||
class WriteOffView : AppCompatTextView, WriteOffViewModel.IwriteOffViewCallback {
|
||||
|
||||
@@ -41,11 +40,9 @@ class WriteOffView : AppCompatTextView, WriteOffViewModel.IwriteOffViewCallback
|
||||
|
||||
private fun startListenerWriteOff(){
|
||||
viewModel?.setWriteOffCallback(this)
|
||||
visibility = VISIBLE
|
||||
}
|
||||
private fun stopListenerWriteOff(){
|
||||
viewModel?.setWriteOffCallback(null)
|
||||
visibility = GONE
|
||||
if(RepositoryManager.supportWriteOff()) {
|
||||
val showText =
|
||||
AbsMogoApplication.getApp().getString(R.string.shuttle_write_off_count, 0)
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
<string name="bus_dialog_cancel">取消</string>
|
||||
|
||||
<string name="shuttle_logout_error">请在网络良好的区域完成任务信息同步后退出</string>
|
||||
<string name="shuttle_logout_error_running">请结束任务后再退出登录</string>
|
||||
|
||||
<string name="bus_no_task_tip">暂无任务</string>
|
||||
<string name="shuttle_write_off_count">核销%1$d人</string>
|
||||
|
||||
Reference in New Issue
Block a user