[BadCase]BadCase记录添加持久化逻辑

This commit is contained in:
renwj
2022-01-25 16:36:17 +08:00
parent 46bdb9d200
commit a108a1f955
6 changed files with 120 additions and 37 deletions

View File

@@ -1,13 +1,18 @@
package com.mogo.eagle.core.data.autopilot
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey
import java.text.SimpleDateFormat
import java.util.*
@Entity(tableName = "record")
class AutoPilotRecordResult {
/**
* 磁盘可用空间(M)
*/
@ColumnInfo(name = "disk_free")
var diskFree: Long = 0
/**
@@ -19,6 +24,7 @@ class AutoPilotRecordResult {
/**
* 保存的文件名
*/
@ColumnInfo(name = "file_name")
var fileName: String? = ""
@@ -27,7 +33,6 @@ class AutoPilotRecordResult {
*/
var note: String? = ""
/**
* 域控制器定义的bag key
*/
@@ -54,26 +59,23 @@ class AutoPilotRecordResult {
*/
var id: Int = 0
/**
* 时间戳格式YYYY-MM-DD-hh-mm-ss
*/
var timestamp: String? = ""
@PrimaryKey
var timestamp: String = SimpleDateFormat("yyyy-MM-dd-HH-mm-ss", Locale.getDefault()).format(Date())
/**
* 此次采集数据总大小M
*/
var total: Long? = 0
/**
* 记录此条数据是否已消费
*/
@Volatile
var consumed: Boolean = false
override fun toString(): String {
return "AutoPilotRecordResult(diskFree=$diskFree, duration=$duration, fileName=$fileName, note=$note, key=$key, stat=$stat, type=$type, id=$id, timestamp=$timestamp, total=$total)"
}