[fea]
[找回saas 到站播放站点视频]
This commit is contained in:
yangyakun
2024-10-31 20:03:01 +08:00
parent 7c1ca46ea7
commit 68b0e2f97a
13 changed files with 807 additions and 33 deletions

View File

@@ -2,7 +2,7 @@
"formatVersion": 1,
"database": {
"version": 2,
"identityHash": "66522c4500a3e7f83bfcabf98096c6bd",
"identityHash": "2b20934a560960930f10ae5c581cbcec",
"entities": [
{
"tableName": "contrail_data_table",
@@ -141,7 +141,7 @@
},
{
"tableName": "site_data_table",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `site_id` INTEGER, `line_id` INTEGER, `name` TEXT, `name_kr` TEXT, `seq` INTEGER, `gcj_lon` REAL, `gcj_lat` REAL, `lon` REAL, `lat` REAL, `introduction` TEXT, `is_play_tts` INTEGER, `md5` TEXT)",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `site_id` INTEGER, `line_id` INTEGER, `name` TEXT, `name_kr` TEXT, `seq` INTEGER, `gcj_lon` REAL, `gcj_lat` REAL, `lon` REAL, `lat` REAL, `introduction` TEXT, `is_play_tts` INTEGER, `md5` TEXT, `videoList` TEXT)",
"fields": [
{
"fieldPath": "id",
@@ -220,6 +220,12 @@
"columnName": "md5",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "videoListDB",
"columnName": "videoList",
"affinity": "TEXT",
"notNull": false
}
],
"primaryKey": {
@@ -339,7 +345,7 @@
},
{
"tableName": "used_task_data_table",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `task_id` INTEGER, `line_id` INTEGER, `site_id` INTEGER, `line_name` TEXT, `name` TEXT, `name_kr` TEXT, `seq` INTEGER, `gcj_lon` REAL, `gcj_lat` REAL, `lon` REAL, `lat` REAL, `driving_status` INTEGER, `leaving` INTEGER, `arrived_time` INTEGER, `leave_time` INTEGER, `introduction` TEXT, `is_play_tts` INTEGER, `event_save_time` INTEGER NOT NULL)",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `task_id` INTEGER, `line_id` INTEGER, `site_id` INTEGER, `line_name` TEXT, `name` TEXT, `name_kr` TEXT, `seq` INTEGER, `gcj_lon` REAL, `gcj_lat` REAL, `lon` REAL, `lat` REAL, `driving_status` INTEGER, `leaving` INTEGER, `arrived_time` INTEGER, `leave_time` INTEGER, `introduction` TEXT, `is_play_tts` INTEGER, `event_save_time` INTEGER NOT NULL, `videoList` TEXT)",
"fields": [
{
"fieldPath": "id",
@@ -454,6 +460,12 @@
"columnName": "event_save_time",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "videoList",
"columnName": "videoList",
"affinity": "TEXT",
"notNull": false
}
],
"primaryKey": {
@@ -571,7 +583,7 @@
"views": [],
"setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '66522c4500a3e7f83bfcabf98096c6bd')"
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '2b20934a560960930f10ae5c581cbcec')"
]
}
}

View File

@@ -0,0 +1,589 @@
{
"formatVersion": 1,
"database": {
"version": 3,
"identityHash": "2b20934a560960930f10ae5c581cbcec",
"entities": [
{
"tableName": "contrail_data_table",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `line_id` INTEGER, `csv_file_url` TEXT, `csv_file_md5` TEXT, `txt_file_url` TEXT, `txt_file_md5` TEXT, `contrail_save_time` INTEGER, `md5` TEXT)",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "lineId",
"columnName": "line_id",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "csvFileUrl",
"columnName": "csv_file_url",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "csvFileMd5",
"columnName": "csv_file_md5",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "txtFileUrl",
"columnName": "txt_file_url",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "txtFileMd5",
"columnName": "txt_file_md5",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "contrailSaveTime",
"columnName": "contrail_save_time",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "md5",
"columnName": "md5",
"affinity": "TEXT",
"notNull": false
}
],
"primaryKey": {
"columnNames": [
"id"
],
"autoGenerate": true
},
"indices": [
{
"name": "index_contrail_data_table_line_id",
"unique": false,
"columnNames": [
"line_id"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `index_contrail_data_table_line_id` ON `${TABLE_NAME}` (`line_id`)"
},
{
"name": "index_contrail_data_table_md5",
"unique": false,
"columnNames": [
"md5"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `index_contrail_data_table_md5` ON `${TABLE_NAME}` (`md5`)"
}
],
"foreignKeys": []
},
{
"tableName": "line_data_table",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `line_id` INTEGER, `line_name` TEXT, `end_station_name` TEXT, `line_get_time` INTEGER NOT NULL)",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "lineId",
"columnName": "line_id",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "lineName",
"columnName": "line_name",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "endStationName",
"columnName": "end_station_name",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "linegetTime",
"columnName": "line_get_time",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"columnNames": [
"id"
],
"autoGenerate": true
},
"indices": [
{
"name": "index_line_data_table_line_id",
"unique": false,
"columnNames": [
"line_id"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `index_line_data_table_line_id` ON `${TABLE_NAME}` (`line_id`)"
}
],
"foreignKeys": []
},
{
"tableName": "site_data_table",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `site_id` INTEGER, `line_id` INTEGER, `name` TEXT, `name_kr` TEXT, `seq` INTEGER, `gcj_lon` REAL, `gcj_lat` REAL, `lon` REAL, `lat` REAL, `introduction` TEXT, `is_play_tts` INTEGER, `md5` TEXT, `videoList` TEXT)",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "siteId",
"columnName": "site_id",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "lineId",
"columnName": "line_id",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "nameKr",
"columnName": "name_kr",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "seq",
"columnName": "seq",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "gcjLon",
"columnName": "gcj_lon",
"affinity": "REAL",
"notNull": false
},
{
"fieldPath": "gcjLat",
"columnName": "gcj_lat",
"affinity": "REAL",
"notNull": false
},
{
"fieldPath": "lon",
"columnName": "lon",
"affinity": "REAL",
"notNull": false
},
{
"fieldPath": "lat",
"columnName": "lat",
"affinity": "REAL",
"notNull": false
},
{
"fieldPath": "introduction",
"columnName": "introduction",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "isPlayTts",
"columnName": "is_play_tts",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "md5",
"columnName": "md5",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "videoListDB",
"columnName": "videoList",
"affinity": "TEXT",
"notNull": false
}
],
"primaryKey": {
"columnNames": [
"id"
],
"autoGenerate": true
},
"indices": [
{
"name": "index_site_data_table_site_id",
"unique": false,
"columnNames": [
"site_id"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `index_site_data_table_site_id` ON `${TABLE_NAME}` (`site_id`)"
},
{
"name": "index_site_data_table_line_id",
"unique": false,
"columnNames": [
"line_id"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `index_site_data_table_line_id` ON `${TABLE_NAME}` (`line_id`)"
}
],
"foreignKeys": []
},
{
"tableName": "task_data_table",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `task_id` INTEGER, `line_id` INTEGER, `task_data` INTEGER, `task_start_time` INTEGER, `start_time` INTEGER, `end_time` INTEGER, `task_get_time` INTEGER NOT NULL, `status` INTEGER)",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "taskId",
"columnName": "task_id",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "lineId",
"columnName": "line_id",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "taskDate",
"columnName": "task_data",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "taskStartTime",
"columnName": "task_start_time",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "startTime",
"columnName": "start_time",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "endtime",
"columnName": "end_time",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "taskgetTime",
"columnName": "task_get_time",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "status",
"columnName": "status",
"affinity": "INTEGER",
"notNull": false
}
],
"primaryKey": {
"columnNames": [
"id"
],
"autoGenerate": true
},
"indices": [
{
"name": "index_task_data_table_task_id",
"unique": false,
"columnNames": [
"task_id"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `index_task_data_table_task_id` ON `${TABLE_NAME}` (`task_id`)"
},
{
"name": "index_task_data_table_line_id",
"unique": false,
"columnNames": [
"line_id"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `index_task_data_table_line_id` ON `${TABLE_NAME}` (`line_id`)"
}
],
"foreignKeys": []
},
{
"tableName": "used_task_data_table",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `task_id` INTEGER, `line_id` INTEGER, `site_id` INTEGER, `line_name` TEXT, `name` TEXT, `name_kr` TEXT, `seq` INTEGER, `gcj_lon` REAL, `gcj_lat` REAL, `lon` REAL, `lat` REAL, `driving_status` INTEGER, `leaving` INTEGER, `arrived_time` INTEGER, `leave_time` INTEGER, `introduction` TEXT, `is_play_tts` INTEGER, `event_save_time` INTEGER NOT NULL, `videoList` TEXT)",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "taskId",
"columnName": "task_id",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "lineId",
"columnName": "line_id",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "siteId",
"columnName": "site_id",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "lineName",
"columnName": "line_name",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "nameKr",
"columnName": "name_kr",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "seq",
"columnName": "seq",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "gcjLon",
"columnName": "gcj_lon",
"affinity": "REAL",
"notNull": false
},
{
"fieldPath": "gcjLat",
"columnName": "gcj_lat",
"affinity": "REAL",
"notNull": false
},
{
"fieldPath": "lon",
"columnName": "lon",
"affinity": "REAL",
"notNull": false
},
{
"fieldPath": "lat",
"columnName": "lat",
"affinity": "REAL",
"notNull": false
},
{
"fieldPath": "drivingStatus",
"columnName": "driving_status",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "leaving",
"columnName": "leaving",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "arrivedTime",
"columnName": "arrived_time",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "leaveTime",
"columnName": "leave_time",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "introduction",
"columnName": "introduction",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "isPlayTts",
"columnName": "is_play_tts",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "eventSaveTime",
"columnName": "event_save_time",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "videoList",
"columnName": "videoList",
"affinity": "TEXT",
"notNull": false
}
],
"primaryKey": {
"columnNames": [
"id"
],
"autoGenerate": true
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "event_data_table",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `event_type` TEXT, `lineId` INTEGER, `lineName` TEXT, `task_id` INTEGER, `task_start_time` INTEGER, `business_time` INTEGER, `write_version` INTEGER, `site_id` INTEGER, `seq` INTEGER, `driver_id` INTEGER, `event_save_time` INTEGER NOT NULL, `update_status` INTEGER NOT NULL)",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "eventType",
"columnName": "event_type",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "lineId",
"columnName": "lineId",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "lineName",
"columnName": "lineName",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "taskId",
"columnName": "task_id",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "taskStartTime",
"columnName": "task_start_time",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "businessTime",
"columnName": "business_time",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "writeVersion",
"columnName": "write_version",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "siteId",
"columnName": "site_id",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "seq",
"columnName": "seq",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "driverId",
"columnName": "driver_id",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "eventSaveTime",
"columnName": "event_save_time",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "updateStatus",
"columnName": "update_status",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"columnNames": [
"id"
],
"autoGenerate": true
},
"indices": [
{
"name": "index_event_data_table_event_save_time",
"unique": false,
"columnNames": [
"event_save_time"
],
"orders": [],
"createSql": "CREATE INDEX IF NOT EXISTS `index_event_data_table_event_save_time` ON `${TABLE_NAME}` (`event_save_time`)"
}
],
"foreignKeys": []
}
],
"views": [],
"setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '2b20934a560960930f10ae5c581cbcec')"
]
}
}

View File

@@ -1,10 +1,13 @@
package com.mogo.och.weaknet.bean.response
import com.google.gson.reflect.TypeToken
import com.mogo.eagle.core.data.BaseData
import com.mogo.eagle.core.utilcode.util.GsonUtils
import com.mogo.och.common.module.manager.autopilot.line.LineManager
import com.mogo.och.data.bean.BusRoutesResult
import com.mogo.och.data.bean.BusStationBean
import com.mogo.och.data.bean.LineInfo
import com.mogo.och.data.bean.SiteIntroduce
import com.mogo.och.weaknet.model.LineModel
import com.mogo.och.weaknet.repository.db.bean.TaskSiteDataBean
import com.mogo.och.weaknet.repository.db.repository.TaskSiteDb
@@ -50,6 +53,13 @@ class BusRoutesResponse : BaseData() {
temp?.isPlayTts = Boolean.TRUE == taskAndsite.isPlayTts
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()
}
result.add(temp!!)
// 正在进行中的任务
if (temp!!.drivingStatus == TaskSiteDataBean.drivingStatusCurrent) {
@@ -84,6 +94,7 @@ class BusRoutesResponse : BaseData() {
temp.leaving = it.isLeaving
temp.introduction = it.introduction
temp.isPlayTts = it.isPlayTts
temp.videoList = GsonUtils.toJson(it.videoList)
runnintTaskAndSites.add(temp)
}
TaskSiteDb.addOrUpdate(*runnintTaskAndSites.toTypedArray())

View File

@@ -1,6 +1,8 @@
package com.mogo.och.weaknet.bean.response
import com.mogo.eagle.core.data.BaseData
import com.mogo.eagle.core.utilcode.util.GsonUtils
import com.mogo.och.data.bean.SiteIntroduce
import com.mogo.och.weaknet.repository.db.bean.ContrailDataBean
import com.mogo.och.weaknet.repository.db.bean.LineDataBean
import com.mogo.och.weaknet.repository.db.bean.SiteDataBean
@@ -67,6 +69,13 @@ data class CarExecutableTaskResponse(val data: List<Result>?) : BaseData(){
dataInfo.siteList?.let {siteListInfo->
siteListInfo.forEach {
it.lineId = lineId
val videoInfoList = mutableListOf<SiteIntroduce>()
it.videoList?.forEach { videoInfoIt->
videoInfoList.add(videoInfoIt)
}
if(videoInfoList.isNotEmpty()) {
it.videoListDB = GsonUtils.toJson(videoInfoList)
}
}
siteList.addAll(siteListInfo)
}

View File

@@ -30,7 +30,7 @@ import java.io.File
//entities指定该数据库有哪些表多张表就逗号分隔
//version指定数据库版本号升级时需要用到
//数据库继承自RoomDatabase
@Database(entities = [ContrailDataBean::class, LineDataBean::class, SiteDataBean::class, TaskDataBean::class, TaskSiteDataBean::class, EventDataBean::class], version = 2)
@Database(entities = [ContrailDataBean::class, LineDataBean::class, SiteDataBean::class, TaskDataBean::class, TaskSiteDataBean::class, EventDataBean::class], version = 3)
abstract class MyDataBase : RoomDatabase() {
override fun getOpenHelper(): SupportSQLiteOpenHelper {
@@ -86,6 +86,7 @@ abstract class MyDataBase : RoomDatabase() {
AbsMogoApplication.getApp()!!.applicationContext, MyDataBase::class.java, ROOT_PATH+roomName
)
.addMigrations(Migration1_2(1,2))
.addMigrations(Migration2_3(2,3))
.build()
}
val ROOT_PATH = Environment.getExternalStorageDirectory().absolutePath + File.separator + "Mogo" + File.separator + "APP_cache" + File.separator //程序外部存储跟目录
@@ -104,4 +105,10 @@ abstract class MyDataBase : RoomDatabase() {
database.execSQL("ALTER TABLE ${EventDataBean.evnetDataTable} ADD COLUMN driver_id INTEGER");
}
}
class Migration2_3(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");
}
}
}

View File

@@ -2,7 +2,9 @@ package com.mogo.och.weaknet.repository.db.bean
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.Ignore
import androidx.room.PrimaryKey
import com.mogo.och.data.bean.SiteIntroduce
@Entity(tableName = SiteDataBean.siteDataTable)
data class SiteDataBean(
@@ -77,14 +79,24 @@ data class SiteDataBean(
* 除id 外其他值做的md5
*/
@ColumnInfo(name = "md5", typeAffinity = ColumnInfo.TEXT)
var md5: String? = null
var md5: String? = null,
/**
* 站点视频
*/
@ColumnInfo(name = "videoList", typeAffinity = ColumnInfo.TEXT)
var videoListDB: String? = null,
@Ignore
var videoList:MutableList<SiteIntroduce>?=null
) {
companion object {
const val siteDataTable = "site_data_table"
const val mediaTypeVideo = 1
}
override fun toString(): String {
return "SiteDataBean(siteId=$siteId, lineId=$lineId, name=$name, nameKr=$nameKr, seq=$seq, gcjLon=$gcjLon, gcjLat=$gcjLat, lon=$lon, lat=$lat, introduction=$introduction, isPlayTts=$isPlayTts)"
return "SiteDataBean(siteId=$siteId, lineId=$lineId, name=$name, nameKr=$nameKr, seq=$seq, gcjLon=$gcjLon, gcjLat=$gcjLat, lon=$lon, lat=$lat, introduction=$introduction, isPlayTts=$isPlayTts, videoList=$videoListDB)"
}

View File

@@ -118,6 +118,11 @@ data class TaskSiteDataBean(
@ColumnInfo(name = "event_save_time", typeAffinity = ColumnInfo.INTEGER)
var eventSaveTime: Long = System.currentTimeMillis(),
/**
* 站点视频
*/
@ColumnInfo(name = "videoList", typeAffinity = ColumnInfo.TEXT)
var videoList: String? = null,
) {
companion object {
@@ -148,6 +153,7 @@ data class TaskSiteDataBean(
temp?.leaving = false
temp?.introduction = it.introduction
temp?.isPlayTts = it.isPlayTts
temp?.videoList = it.videoListDB
result.add(temp!!)
}
return result

View File

@@ -0,0 +1,17 @@
package com.mogo.och.shuttle.weaknet.passenger.bean.response
import com.mogo.eagle.core.data.BaseData
/**
* 网约车小巴路线接口请求响应结果 返回的是对应司机屏的线路信息
*
* @author tongchenfei
*/
data class ResponseSiteIntroduce(val data: MutableList<SiteIntroduceInfo>?) : BaseData(){
data class SiteIntroduceInfo(val siteId:Long,val introduceList:MutableList<IntroduceInfo>)
data class IntroduceInfo(val type:Int,val url :String,val seq:Int)
}

View File

@@ -0,0 +1,67 @@
package com.mogo.och.shuttle.weaknet.passenger.model
import com.mogo.commons.AbsMogoApplication
import com.mogo.commons.env.ProjectUtils
import com.mogo.och.common.module.biz.lansocket.IOchLanPassengerStatusListener
import com.mogo.och.common.module.manager.download.DownloadManager
import com.mogo.och.common.module.manager.socket.lan.LanSocketManager
import com.mogo.och.common.module.manager.socket.lan.bean.BusinessType
import com.mogo.och.common.module.manager.socket.lan.bean.TaskDetailsMsg
import com.mogo.och.common.module.network.OchCommonServiceCallback
import com.mogo.och.shuttle.weaknet.passenger.bean.response.ResponseSiteIntroduce
import com.mogo.och.shuttle.weaknet.passenger.network.PassengerServiceManager
open class CommonModel {
val connectDriverListener = object : IOchLanPassengerStatusListener {
override fun onDriverConnectChangeListener(isConnect: Boolean) {
super.onDriverConnectChangeListener(isConnect)
if(isConnect){
queryDriverByLocalDriver()
}
}
override fun onDriverSnChagneListner(sn: String?) {
super.onDriverSnChagneListner(sn)
sn?.let {
querySiteIntroduce()
}
}
}
fun queryDriverByLocalDriver() {
//本地去请求司机端
val msg = TaskDetailsMsg("task", BusinessType.shuttle)
LanSocketManager.sendMsgToServer(msg)
}
private fun querySiteIntroduce(){
AbsMogoApplication.getApp()?.let {
if (ProjectUtils.isSaas()) {
PassengerServiceManager.querySiteIntroduceBySn(it,object :
OchCommonServiceCallback<ResponseSiteIntroduce> {
override fun onSuccess(response: ResponseSiteIntroduce?) {
response?.let {response->
downloadSiteIntroduce(response)
}
}
override fun onFail(code: Int, msg: String?) {
}
})
}
}
}
private fun downloadSiteIntroduce(response: ResponseSiteIntroduce) {
response.data?.forEach {siteIntroduceInfo ->
siteIntroduceInfo.introduceList.forEach {introduceInfo ->
DownloadManager.downloadVideoFile(introduceInfo.url,null)
}
}
}
}

View File

@@ -13,6 +13,8 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.util.GsonUtils
import com.mogo.eagle.core.utilcode.util.StringUtils
import com.mogo.och.common.module.biz.lansocket.LoginLanPassengerSocket
import com.mogo.och.common.module.biz.media.MediaManager
import com.mogo.och.common.module.manager.autopilot.autopilot.IOchAutopilotStatusListener
import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutoPilotStatusListenerManager
import com.mogo.och.common.module.manager.autopilot.location.OchLocationManager
@@ -25,6 +27,7 @@ import com.mogo.och.common.module.manager.socket.lan.bean.DPMsgType
import com.mogo.och.common.module.manager.socket.lan.bean.TaskDetailsMsg
import com.mogo.och.common.module.utils.PinYinUtil
import com.mogo.och.common.module.voice.VoiceNotice.showNotice
import com.mogo.och.common.module.wigets.media.MediaItem
import com.mogo.och.data.bean.BusRoutesResult
import com.mogo.och.data.bean.BusStationBean
import com.mogo.och.data.bean.BusTransferData
@@ -38,7 +41,7 @@ import kotlin.math.abs
* @date: 2023/1/31
*/
@SuppressLint("StaticFieldLeak")
object LineModel{
object LineModel:CommonModel(){
private var mContext: Context? = null
@@ -58,11 +61,7 @@ object LineModel{
queryDriverByLocalDriver()
}
private fun queryDriverByLocalDriver() {
//本地去请求司机端
val msg = TaskDetailsMsg("task", BusinessType.shuttle)
LanSocketManager.sendMsgToServer(msg)
}
private fun initListener() {
//自动驾驶状态监听
@@ -77,6 +76,8 @@ object LineModel{
// 监听站点信息
LanSocketManager.registerSocketMessageListener(DPMsgType.TYPE_TASK_DETAILS.type,typeTaskDetails)
LoginLanPassengerSocket.addListener(TAG, connectDriverListener)
}
fun releaseListener() {
@@ -93,6 +94,8 @@ object LineModel{
LanSocketManager.unRegisterSocketMessageListener(DPMsgType.TYPE_COMMON.type,LanSocketManager.commonListener)
LanSocketManager.unRegisterSocketMessageListener(DPMsgType.TYPE_TASK_DETAILS.type,typeTaskDetails)
LoginLanPassengerSocket.removeListener(TAG)
}
fun setDrivingInfoCallback(drivingInfoCallback : DrivingInfoCallback?){
@@ -238,6 +241,7 @@ object LineModel{
if (i == stations.size - 1) {
cleanStation("updatePassengerRouteInfo最后一个站点")
}
startStationVideo(station)
isGoingToNextStation = false
mDrivingInfoCallback?.updateStationsInfo(stations as MutableList<BusStationBean>, i, true)
clearAutopilotControlParameters()
@@ -264,6 +268,20 @@ object LineModel{
TrajectoryAndDistanceManager.setStationPoint(startStation, endStation, lineId.toLong())
}
private fun startStationVideo(startStationInfo: BusStationBean){
val introductionList = mutableListOf<MediaItem>()
startStationInfo.videoList.forEach {
if(it.type==1) {
introductionList.add(
MediaItem(
MediaItem.PrioritySite, it.url,
MediaItem.MEDIA_TYPE_VIDEO,"","")
)
}
}
MediaManager.postSiteIntroduceInfo(introductionList)
}
private fun cleanStation(type: String) {
d(SceneConstant.M_BUS_P + TAG, "清理站点:$type")
TrajectoryAndDistanceManager.setStationPoint(null, null, -1L)

View File

@@ -18,6 +18,7 @@ import com.mogo.och.shuttle.weaknet.passenger.bean.request.PassengerWriteOffRequ
import com.mogo.och.shuttle.weaknet.passenger.bean.response.PassengerOperationStatusResponse
import com.mogo.och.shuttle.weaknet.passenger.bean.response.PassengerRoutesResponse
import com.mogo.och.shuttle.weaknet.passenger.bean.response.PassengerWriteOffResponse
import com.mogo.och.shuttle.weaknet.passenger.bean.response.ResponseSiteIntroduce
/**
* Created on 2022/3/31
@@ -65,4 +66,21 @@ object PassengerServiceManager {
.subscribe(OchCommonSubscribeImpl(context, callback, "writeOff"))
}
}
/**
* 查询绑定行驶的小巴车路线
* @param context
* @param callback
*/
@JvmStatic
fun querySiteIntroduceBySn(
context: Context, callback: OchCommonServiceCallback<ResponseSiteIntroduce>?
) {
mShuttleBusPassengerServiceApi.querySiteIntroduceBySn(
MoGoAiCloudClientConfig.getInstance().serviceAppId,
SharedPrefsMgr.getInstance().token,
LoginLanPassengerSocket.driverSn
).transformTry()
.subscribe(OchCommonSubscribeImpl(context, callback, "querySiteIntroduceBySn"))
}
}

View File

@@ -1,10 +1,8 @@
package com.mogo.och.shuttle.weaknet.passenger.network;
import com.mogo.och.shuttle.weaknet.passenger.bean.request.PassengerQueryLineRequest;
import com.mogo.och.shuttle.weaknet.passenger.bean.request.PassengerWriteOffRequest;
import com.mogo.och.shuttle.weaknet.passenger.bean.response.PassengerOperationStatusResponse;
import com.mogo.och.shuttle.weaknet.passenger.bean.response.PassengerRoutesResponse;
import com.mogo.och.shuttle.weaknet.passenger.bean.response.PassengerWriteOffResponse;
import com.mogo.och.shuttle.weaknet.passenger.bean.response.ResponseSiteIntroduce;
import io.reactivex.Observable;
import retrofit2.http.Body;
@@ -35,4 +33,12 @@ public interface ServiceApi {
@POST("/och-vehicle/api/car/v2/device/writeOff")
Observable<PassengerWriteOffResponse> saaswriteOffTicket(@Header ("appId") String appId, @Header("ticket") String ticket, @Body PassengerWriteOffRequest request);
/**
* 查询车辆对应站点的所有视频介绍视频
* @return 接口返回数据
*/
@Headers( {"Content-Type:application/json;charset=UTF-8"} )
@GET( "/och-bus-cabin/api/business/v1/querySiteIntroduceBySn" )
Observable<ResponseSiteIntroduce> querySiteIntroduceBySn(@Header("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn);
}

View File

@@ -17,6 +17,7 @@ import com.mogo.eagle.core.utilcode.util.GsonUtils
import com.mogo.eagle.core.utilcode.util.StringUtils
import com.mogo.och.common.module.biz.lansocket.IOchLanPassengerStatusListener
import com.mogo.och.common.module.biz.lansocket.LoginLanPassengerSocket
import com.mogo.och.common.module.biz.media.MediaManager
import com.mogo.och.common.module.manager.autopilot.autopilot.IOchAutopilotStatusListener
import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutoPilotStatusListenerManager
import com.mogo.och.common.module.manager.autopilot.location.OchLocationManager
@@ -33,6 +34,7 @@ import com.mogo.och.common.module.manager.socket.lan.bean.TaskDetailsMsg
import com.mogo.och.common.module.utils.DateTimeUtil
import com.mogo.och.common.module.utils.PinYinUtil
import com.mogo.och.common.module.voice.VoiceNotice.showNotice
import com.mogo.och.common.module.wigets.media.MediaItem
import com.mogo.och.data.bean.BusRoutesResult
import com.mogo.och.data.bean.BusStationBean
import com.mogo.och.data.bean.BusTransferData
@@ -48,7 +50,7 @@ import java.util.concurrent.ConcurrentHashMap
* Created on 2022/3/31
*/
@SuppressLint("StaticFieldLeak")
object BusPassengerModel {
object BusPassengerModel :CommonModel(){
private val TAG: String = BusPassengerModel::class.java.simpleName
private var mContext: Context? = null
private var mADASStatusCallback: IBusPassengerADASStatusCallback? = null //Model->Presenter自动驾驶状态相关
@@ -72,12 +74,6 @@ object BusPassengerModel {
queryDriverByLocalDriver()
}
private fun queryDriverByLocalDriver() {
//本地去请求司机端
val msg = TaskDetailsMsg("task", BusinessType.shuttle)
LanSocketManager.sendMsgToServer(msg)
}
fun setDriverStatusCallback(callback: IBusPassegerDriverStatusCallback?) {
this.mDriverStatusCallback = callback
}
@@ -149,7 +145,7 @@ object BusPassengerModel {
if (i == stations.size - 1) {
cleanStation("updatePassengerRouteInfo最后一个站点")
}
startStationVideo(station)
isGoingToNextStation = false
Logger.d(SceneConstant.M_BUS_P + TAG, "order = station= arrive")
mRouteLineInfoCallback!!.updateStationsInfo(stations, i, true)
@@ -198,15 +194,6 @@ object BusPassengerModel {
LoginLanPassengerSocket.removeListener(TAG)
}
private val connectDriverListener = object : IOchLanPassengerStatusListener{
override fun onDriverConnectChangeListener(isConnect: Boolean) {
super.onDriverConnectChangeListener(isConnect)
if(isConnect){
queryDriverByLocalDriver()
}
}
}
private val commonListener = object : ILanMessageListener<AppConnectMsg> {
override fun targetLan(): Class<AppConnectMsg> = AppConnectMsg::class.java
@@ -323,6 +310,21 @@ object BusPassengerModel {
TrajectoryAndDistanceManager.setStationPoint(startStation, endStation, lineId.toLong())
}
private fun startStationVideo(startStationInfo: BusStationBean){
val introductionList = mutableListOf<MediaItem>()
startStationInfo.videoList.forEach {
if(it.type==1) {
introductionList.add(
MediaItem(
MediaItem.PrioritySite, it.url,
MediaItem.MEDIA_TYPE_VIDEO,"","")
)
}
}
MediaManager.postSiteIntroduceInfo(introductionList)
}
private fun cleanStation(type: String) {
d(SceneConstant.M_BUS_P + TAG, "清理站点:$type")
TrajectoryAndDistanceManager.setStationPoint(null, null, -1L)