From 68b0e2f97a90554fd8ff037cd89e412711e7b525 Mon Sep 17 00:00:00 2001 From: yangyakun Date: Thu, 31 Oct 2024 20:03:01 +0800 Subject: [PATCH] =?UTF-8?q?[6.7.2]=20[fea]=20[=E6=89=BE=E5=9B=9Esaas=20?= =?UTF-8?q?=E5=88=B0=E7=AB=99=E6=92=AD=E6=94=BE=E7=AB=99=E7=82=B9=E8=A7=86?= =?UTF-8?q?=E9=A2=91]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../2.json | 20 +- .../3.json | 589 ++++++++++++++++++ .../bean/response/BusRoutesResponse.kt | 11 + .../response/CarExecutableTaskResponse.kt | 9 + .../och/weaknet/repository/db/MyDataBase.kt | 9 +- .../repository/db/bean/SiteDataBean.kt | 16 +- .../repository/db/bean/TaskSiteDataBean.kt | 6 + .../bean/response/ResponseSiteIntroduce.kt | 17 + .../weaknet/passenger/model/CommonModel.kt | 67 ++ .../weaknet/passenger/model/LineModel.kt | 30 +- .../network/PassengerServiceManager.kt | 18 + .../weaknet/passenger/network/ServiceApi.java | 12 +- .../passenger/model/BusPassengerModel.kt | 36 +- 13 files changed, 807 insertions(+), 33 deletions(-) create mode 100644 OCH/shuttle/driver_weaknet/schemas/com.mogo.och.weaknet.repository.db.MyDataBase/3.json create mode 100644 OCH/shuttle/passenger_weaknet/src/main/java/com/mogo/och/shuttle/weaknet/passenger/bean/response/ResponseSiteIntroduce.kt create mode 100644 OCH/shuttle/passenger_weaknet/src/main/java/com/mogo/och/shuttle/weaknet/passenger/model/CommonModel.kt diff --git a/OCH/shuttle/driver_weaknet/schemas/com.mogo.och.weaknet.repository.db.MyDataBase/2.json b/OCH/shuttle/driver_weaknet/schemas/com.mogo.och.weaknet.repository.db.MyDataBase/2.json index 11a83b0e97..6970eca09c 100644 --- a/OCH/shuttle/driver_weaknet/schemas/com.mogo.och.weaknet.repository.db.MyDataBase/2.json +++ b/OCH/shuttle/driver_weaknet/schemas/com.mogo.och.weaknet.repository.db.MyDataBase/2.json @@ -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')" ] } } \ No newline at end of file diff --git a/OCH/shuttle/driver_weaknet/schemas/com.mogo.och.weaknet.repository.db.MyDataBase/3.json b/OCH/shuttle/driver_weaknet/schemas/com.mogo.och.weaknet.repository.db.MyDataBase/3.json new file mode 100644 index 0000000000..f1d18c8322 --- /dev/null +++ b/OCH/shuttle/driver_weaknet/schemas/com.mogo.och.weaknet.repository.db.MyDataBase/3.json @@ -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')" + ] + } +} \ No newline at end of file diff --git a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/bean/response/BusRoutesResponse.kt b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/bean/response/BusRoutesResponse.kt index 3408f90744..59ac0563bc 100644 --- a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/bean/response/BusRoutesResponse.kt +++ b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/bean/response/BusRoutesResponse.kt @@ -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>( + taskAndsite.videoList, + object : TypeToken?>() {}.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()) diff --git a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/bean/response/CarExecutableTaskResponse.kt b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/bean/response/CarExecutableTaskResponse.kt index 5dc574c402..190deefc95 100644 --- a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/bean/response/CarExecutableTaskResponse.kt +++ b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/bean/response/CarExecutableTaskResponse.kt @@ -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?) : BaseData(){ dataInfo.siteList?.let {siteListInfo-> siteListInfo.forEach { it.lineId = lineId + val videoInfoList = mutableListOf() + it.videoList?.forEach { videoInfoIt-> + videoInfoList.add(videoInfoIt) + } + if(videoInfoList.isNotEmpty()) { + it.videoListDB = GsonUtils.toJson(videoInfoList) + } } siteList.addAll(siteListInfo) } diff --git a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/repository/db/MyDataBase.kt b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/repository/db/MyDataBase.kt index 5f6cfc9cca..590ba5a8ab 100644 --- a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/repository/db/MyDataBase.kt +++ b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/repository/db/MyDataBase.kt @@ -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"); + } + } } diff --git a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/repository/db/bean/SiteDataBean.kt b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/repository/db/bean/SiteDataBean.kt index 2cb9f5cff1..5675520c9c 100644 --- a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/repository/db/bean/SiteDataBean.kt +++ b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/repository/db/bean/SiteDataBean.kt @@ -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?=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)" } diff --git a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/repository/db/bean/TaskSiteDataBean.kt b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/repository/db/bean/TaskSiteDataBean.kt index 0b8c408a47..9ff4dede6f 100644 --- a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/repository/db/bean/TaskSiteDataBean.kt +++ b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/repository/db/bean/TaskSiteDataBean.kt @@ -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 diff --git a/OCH/shuttle/passenger_weaknet/src/main/java/com/mogo/och/shuttle/weaknet/passenger/bean/response/ResponseSiteIntroduce.kt b/OCH/shuttle/passenger_weaknet/src/main/java/com/mogo/och/shuttle/weaknet/passenger/bean/response/ResponseSiteIntroduce.kt new file mode 100644 index 0000000000..5fd4e36676 --- /dev/null +++ b/OCH/shuttle/passenger_weaknet/src/main/java/com/mogo/och/shuttle/weaknet/passenger/bean/response/ResponseSiteIntroduce.kt @@ -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?) : BaseData(){ + + data class SiteIntroduceInfo(val siteId:Long,val introduceList:MutableList) + + data class IntroduceInfo(val type:Int,val url :String,val seq:Int) + +} diff --git a/OCH/shuttle/passenger_weaknet/src/main/java/com/mogo/och/shuttle/weaknet/passenger/model/CommonModel.kt b/OCH/shuttle/passenger_weaknet/src/main/java/com/mogo/och/shuttle/weaknet/passenger/model/CommonModel.kt new file mode 100644 index 0000000000..19b590dc2c --- /dev/null +++ b/OCH/shuttle/passenger_weaknet/src/main/java/com/mogo/och/shuttle/weaknet/passenger/model/CommonModel.kt @@ -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 { + 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) + } + } + } + + +} \ No newline at end of file diff --git a/OCH/shuttle/passenger_weaknet/src/main/java/com/mogo/och/shuttle/weaknet/passenger/model/LineModel.kt b/OCH/shuttle/passenger_weaknet/src/main/java/com/mogo/och/shuttle/weaknet/passenger/model/LineModel.kt index 3db1519d2f..a91e69c5bb 100644 --- a/OCH/shuttle/passenger_weaknet/src/main/java/com/mogo/och/shuttle/weaknet/passenger/model/LineModel.kt +++ b/OCH/shuttle/passenger_weaknet/src/main/java/com/mogo/och/shuttle/weaknet/passenger/model/LineModel.kt @@ -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, i, true) clearAutopilotControlParameters() @@ -264,6 +268,20 @@ object LineModel{ TrajectoryAndDistanceManager.setStationPoint(startStation, endStation, lineId.toLong()) } + private fun startStationVideo(startStationInfo: BusStationBean){ + val introductionList = mutableListOf() + 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) diff --git a/OCH/shuttle/passenger_weaknet/src/main/java/com/mogo/och/shuttle/weaknet/passenger/network/PassengerServiceManager.kt b/OCH/shuttle/passenger_weaknet/src/main/java/com/mogo/och/shuttle/weaknet/passenger/network/PassengerServiceManager.kt index 8a27b65b91..c6bd01848c 100644 --- a/OCH/shuttle/passenger_weaknet/src/main/java/com/mogo/och/shuttle/weaknet/passenger/network/PassengerServiceManager.kt +++ b/OCH/shuttle/passenger_weaknet/src/main/java/com/mogo/och/shuttle/weaknet/passenger/network/PassengerServiceManager.kt @@ -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? + ) { + mShuttleBusPassengerServiceApi.querySiteIntroduceBySn( + MoGoAiCloudClientConfig.getInstance().serviceAppId, + SharedPrefsMgr.getInstance().token, + LoginLanPassengerSocket.driverSn + ).transformTry() + .subscribe(OchCommonSubscribeImpl(context, callback, "querySiteIntroduceBySn")) + } } \ No newline at end of file diff --git a/OCH/shuttle/passenger_weaknet/src/main/java/com/mogo/och/shuttle/weaknet/passenger/network/ServiceApi.java b/OCH/shuttle/passenger_weaknet/src/main/java/com/mogo/och/shuttle/weaknet/passenger/network/ServiceApi.java index 1fd9931968..75d010abc4 100644 --- a/OCH/shuttle/passenger_weaknet/src/main/java/com/mogo/och/shuttle/weaknet/passenger/network/ServiceApi.java +++ b/OCH/shuttle/passenger_weaknet/src/main/java/com/mogo/och/shuttle/weaknet/passenger/network/ServiceApi.java @@ -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 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 querySiteIntroduceBySn(@Header("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn); + } diff --git a/OCH/shuttle/passenger_weaknet/src/main/java/jinlv/com/mogo/och/shuttle/weaknet/passenger/model/BusPassengerModel.kt b/OCH/shuttle/passenger_weaknet/src/main/java/jinlv/com/mogo/och/shuttle/weaknet/passenger/model/BusPassengerModel.kt index 018cfda723..8f8a1d9aee 100644 --- a/OCH/shuttle/passenger_weaknet/src/main/java/jinlv/com/mogo/och/shuttle/weaknet/passenger/model/BusPassengerModel.kt +++ b/OCH/shuttle/passenger_weaknet/src/main/java/jinlv/com/mogo/och/shuttle/weaknet/passenger/model/BusPassengerModel.kt @@ -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 { override fun targetLan(): Class = AppConnectMsg::class.java @@ -323,6 +310,21 @@ object BusPassengerModel { TrajectoryAndDistanceManager.setStationPoint(startStation, endStation, lineId.toLong()) } + + private fun startStationVideo(startStationInfo: BusStationBean){ + val introductionList = mutableListOf() + 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)