[2.13.0][fix]添加查询消息盒子历史数据

This commit is contained in:
chenfufeng
2022-12-01 11:52:52 +08:00
parent 3cd125dbb6
commit 79e4767cc0
10 changed files with 45 additions and 3 deletions

View File

@@ -26,6 +26,7 @@ import com.mogo.eagle.core.function.api.devatools.IMogoDevaToolsUpgradeListener;
import com.mogo.eagle.core.function.call.bindingcar.CallerBindingcarManager;
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager;
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsUpgradeListenerManager;
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager;
import com.mogo.eagle.core.function.hmi.R;
import com.mogo.eagle.core.function.msgbox.db.MsgBoxDb;
import com.mogo.eagle.core.function.overview.OverviewDb;
@@ -76,6 +77,7 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
clearMessageBoxTable();
checkMonitorDb();
upgradeProgressListener();
CallerMsgBoxManager.INSTANCE.queryAllMessages(this);
}
@Override

View File

@@ -79,7 +79,7 @@ class OverViewModel(
disposable!!.dispose()
}
// 1分钟查询一次
disposable = Observable.interval(0, 60000, TimeUnit.SECONDS)
disposable = Observable.interval(0, 60000, TimeUnit.MILLISECONDS)
.flatMap {
MoGoRetrofitFactory.getInstance(HostConst.getHost())
.create(OverViewServiceApi::class.java)

View File

@@ -138,10 +138,23 @@ object DataManager {
*/
fun queryAllMessages(context: Context) {
scope.launch {
initCache()
getCacheMessages(context)
}
}
private fun initCache() {
if (cacheNotifyList.isNotEmpty()) {
cacheNotifyList.clear()
}
if (cacheRecordList.isNotEmpty()) {
cacheRecordList.clear()
}
if (cacheSysInfoList.isNotEmpty()) {
cacheSysInfoList.clear()
}
}
private suspend fun getCacheMessages(context: Context): List<MsgBoxBean> = withContext(Dispatchers.IO) {
return@withContext MsgBoxDb.getDb(context)
.monitorDao()

View File

@@ -26,6 +26,10 @@ class MsgBoxProvider : IMsgBoxProvider {
}.start()
}
override fun queryAllMessages(context: Context) {
DataManager.queryAllMessages(context)
}
override fun saveMsg(bean: MsgBoxBean) {
DataManager.saveMsg(bean)
}

View File

@@ -7,6 +7,7 @@ import android.content.Context;
import com.mogo.aicloud.services.socket.MogoAiCloudSocketManager;
import com.mogo.eagle.core.data.msgbox.MsgBoxBean;
import com.mogo.eagle.core.data.msgbox.MsgBoxType;
import com.mogo.eagle.core.data.msgbox.NoticeFrCloudMsg;
import com.mogo.eagle.core.data.notice.NoticeNormalData;
import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData;
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager;
@@ -63,7 +64,8 @@ class NoticeSocketManager {
if (obj == null) {
return;
}
CallerMsgBoxManager.INSTANCE.saveMsgBox(new MsgBoxBean(MsgBoxType.NOTICE,obj));
NoticeFrCloudMsg noticeFromCloudMsg = new NoticeFrCloudMsg(obj, null, 0);
CallerMsgBoxManager.INSTANCE.saveMsgBox(new MsgBoxBean(MsgBoxType.NOTICE, noticeFromCloudMsg));
}
};
@@ -80,7 +82,8 @@ class NoticeSocketManager {
@Override
public void onMsgReceived(NoticeTrafficStylePushData obj) {
CallerLogger.INSTANCE.d(M_NOTICE + TAG, "301001-- 交警类型公告数据:" + GsonUtil.jsonFromObject(obj));
CallerMsgBoxManager.INSTANCE.saveMsgBox(new MsgBoxBean(MsgBoxType.NOTICE,obj));
NoticeFrCloudMsg noticeFromCloudMsg = new NoticeFrCloudMsg(null, obj, 1);
CallerMsgBoxManager.INSTANCE.saveMsgBox(new MsgBoxBean(MsgBoxType.NOTICE, noticeFromCloudMsg));
}
};
}

View File

@@ -1,5 +1,6 @@
package com.mogo.eagle.core.data.msgbox
enum class MsgBoxType {
// 按功能划分为几大类运营、通知、V2X模块、OBU模块、工控机Report、录制、交通等
OPERATION, NOTICE, V2X, OBU, REPORT, RECORD, TRAFFIC
}

View File

@@ -1,5 +1,6 @@
package com.mogo.eagle.core.data.msgbox
enum class MsgCategory {
// 按UI展示划分为三大类通知、系统信息、录制
NOTICE, SYS_INFO, RECORD_BAG
}

View File

@@ -0,0 +1,11 @@
package com.mogo.eagle.core.data.msgbox
import com.mogo.eagle.core.data.notice.NoticeNormalData
import com.mogo.eagle.core.data.notice.NoticeTrafficStylePushData
data class NoticeFrCloudMsg(
var noticeNormalData: NoticeNormalData? = null,
var trafficPushData: NoticeTrafficStylePushData? = null,
// 0:取NoticeTrafficStylePushData, 1:取NoticeNormalData
var type: Int = 0
)

View File

@@ -5,6 +5,9 @@ import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.function.api.base.IMoGoFunctionServerProvider
interface IMsgBoxProvider: IMoGoFunctionServerProvider {
fun queryAllMessages(context: Context)
fun saveMsg(bean: MsgBoxBean)
/**

View File

@@ -16,6 +16,10 @@ object CallerMsgBoxManager {
MogoServicePaths.PATH_MSG_BOX_MODULE
)
fun queryAllMessages(context: Context) {
providerApi?.queryAllMessages(context)
}
/**
* 存储数据到消息盒子
*/