[3.3.0]fix V2xObuEventManager.onMoGoObuSaveMessage NullPointerException

This commit is contained in:
xuxinchao
2023-06-26 11:09:32 +08:00
parent ca2113433d
commit 0b24e59d09

View File

@@ -5,7 +5,6 @@ import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
import com.mogo.eagle.core.data.msgbox.MsgBoxType
import com.mogo.eagle.core.data.msgbox.V2XMsg
import com.mogo.eagle.core.data.obu.MogoObuConst
import com.mogo.eagle.core.function.api.datacenter.obu.IMoGoObuSaveMessageListener
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.function.call.obu.CallerObuSaveMessageListenerManager
@@ -37,20 +36,19 @@ object V2xObuEventManager : IMoGoObuSaveMessageListener {
* @param content 事件内容
* @param tts 事件语音播报 //30秒内同一个事件只出现一次 TODO 临时添加,后面宏宇统一在数据中心处理
*/
override fun onMoGoObuSaveMessage(type: String, content: String, tts: String, source: DataSourceType) {
override fun onMoGoObuSaveMessage(type: String, content: String, tts: String, sourceType: DataSourceType) {
if (content.isNotEmpty()) {
if (obuDataMap.containsKey(type)) {
var oldTime = obuDataMap[type]
var timeDiff = (System.currentTimeMillis() - oldTime!!) / 1000
if (timeDiff < 30) {
return
val oldTime = obuDataMap[type]
oldTime?.let {
val timeDiff = (System.currentTimeMillis() - it) / 1000
if (timeDiff < 30) {
return
}
obuDataMap.remove(type)
}
obuDataMap.remove(type)
obuDataMap[type] = System.currentTimeMillis()
} else {
obuDataMap[type] = System.currentTimeMillis()
}
obuDataMap[type] = System.currentTimeMillis()
CallerLogger.d("${SceneConstant.M_OBU}${TAG}", "onMoGoObuSaveMessage type = $type ---content = $content ---tts = $tts ")
CallerMsgBoxManager.saveMsgBox(
MsgBoxBean(
@@ -61,7 +59,7 @@ object V2xObuEventManager : IMoGoObuSaveMessageListener {
tts
)
).apply {
sourceType = source
this.sourceType = sourceType
}
)
}