Merge branch 'dev_robotaxi-d_250417_8.0.0_routing' into dev_robotaxi-d_250709_8.2.0_advideo
# Conflicts: # OCH/charter/passenger/src/main/java/com/mogo/och/charter/passenger/model/MusicModel.kt # OCH/common/common/src/main/java/com/mogo/och/common/module/constant/OchCommonConst.kt
@@ -2,7 +2,6 @@ package com.mogo.och.charter.passenger.model
|
||||
|
||||
import com.mogo.commons.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.utilcode.util.TAG
|
||||
import com.mogo.och.bridge.autopilot.autopilot.IOchAutopilotStatusListener
|
||||
import com.mogo.och.bridge.autopilot.autopilot.OchAutoPilotStatusListenerManager
|
||||
import com.mogo.och.common.module.biz.media.MediaManager
|
||||
@@ -10,6 +9,9 @@ import com.mogo.och.common.module.utils.RxUtils
|
||||
import io.reactivex.disposables.Disposable
|
||||
|
||||
object MusicModel : IOchAutopilotStatusListener, IOrderStatusChangeListener {
|
||||
|
||||
private const val TAG = "MusicModel"
|
||||
|
||||
init {
|
||||
CharterPassengerModel.setStatusChangeListener(TAG,this)
|
||||
//自动驾驶状态监听
|
||||
|
||||
@@ -40,6 +40,15 @@ android {
|
||||
kotlinOptions {
|
||||
jvmTarget = '1.8'
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
res.srcDirs = [
|
||||
'src/main/res',
|
||||
'src/main/res/routing',
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -53,6 +62,7 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.material
|
||||
implementation rootProject.ext.dependencies.rxandroid
|
||||
implementation rootProject.ext.dependencies.amapnavi3dmap
|
||||
implementation project(':OCH:common:common')
|
||||
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.mogo.och.biz.routing
|
||||
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OCHCOMMON
|
||||
import com.mogo.och.biz.routing.ui.RoutingSwitchView
|
||||
import com.mogo.och.common.module.biz.routing.RoutingCallback
|
||||
import com.mogo.och.common.module.biz.routing.RoutingService
|
||||
import com.mogo.och.common.module.constant.OchCommonConst
|
||||
|
||||
|
||||
@Route(path = OchCommonConst.BIZ_ROUTING)
|
||||
class RoutingProvider : RoutingService {
|
||||
|
||||
private var context: Context? = null
|
||||
|
||||
private val TAG = M_OCHCOMMON + "RoutingProvider"
|
||||
|
||||
private var switchView:RoutingSwitchView?=null
|
||||
|
||||
private var callback:RoutingCallback?=null
|
||||
|
||||
|
||||
override fun getRoutingView(): View? {
|
||||
if(AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
context?.let {
|
||||
if(switchView==null){
|
||||
switchView = RoutingSwitchView(it)
|
||||
}
|
||||
return switchView
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
override fun setRoutingCallback(callback: RoutingCallback?) {
|
||||
this.callback = callback
|
||||
}
|
||||
|
||||
|
||||
override fun init(context: Context?) {
|
||||
this.context = context
|
||||
}
|
||||
|
||||
fun invokeCallbackShowMap(isShow: Boolean) {
|
||||
this.callback?.showMap(isShow)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.mogo.och.biz.routing
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.och.common.module.constant.OchCommonConst
|
||||
|
||||
|
||||
object RoutingServiceManager {
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private var routingService: RoutingProvider? =
|
||||
ARouter.getInstance().build(OchCommonConst.BIZ_ROUTING).navigation() as RoutingProvider
|
||||
|
||||
|
||||
fun invokeCallback(isShow: Boolean) {
|
||||
this.routingService?.invokeCallbackShowMap(isShow)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
package com.mogo.och.unmanned.taxi.bean
|
||||
package com.mogo.och.biz.routing.bean
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.och.data.bean.BusStationBean
|
||||
import com.mogo.och.data.bean.ContraiInfo
|
||||
import com.mogo.och.data.bean.LineInfo
|
||||
|
||||
/**
|
||||
* 灰度路线信息
|
||||
@@ -16,7 +17,8 @@ data class GrayLineBean(
|
||||
var lineFailCount: Int?, //线路累计反馈不可用次数
|
||||
var isChoosed: Boolean = false, //当前是否选中
|
||||
var startSite: RoutingSite?,
|
||||
var endSite: RoutingSite?
|
||||
var endSite: RoutingSite?,
|
||||
var distance:Float,
|
||||
)
|
||||
|
||||
/**
|
||||
@@ -29,7 +31,6 @@ data class RoutingSite(
|
||||
var gcjLon: Double,// 高德坐标
|
||||
var wgs84Lon: Double,//高精坐标
|
||||
var wgs84Lat: Double,//高精坐标
|
||||
var pointType: Int // 1:途径点 2:禁行点 3:站点
|
||||
) {
|
||||
fun toBusStationBean(): BusStationBean {
|
||||
val temp = BusStationBean()
|
||||
@@ -39,7 +40,6 @@ data class RoutingSite(
|
||||
temp.lon = wgs84Lon
|
||||
temp.gcjLat = gcjLat
|
||||
temp.gcjLon = gcjLon
|
||||
temp.pointType = pointType
|
||||
temp.isLeaving = true
|
||||
return temp
|
||||
}
|
||||
@@ -49,36 +49,65 @@ data class RoutingSite(
|
||||
* 轨迹信息
|
||||
*/
|
||||
data class ContrailBean(
|
||||
var businessType:Int=0,
|
||||
var contrailId: Long = -1L,
|
||||
var contrailSaveTime: Long = -1L,
|
||||
var csvFileMd5: String = "",
|
||||
var csvFileUrl: String = "",
|
||||
var lineId: Long = -1L,
|
||||
var lineName: String = "",
|
||||
var contrailId: Long = -1L,
|
||||
var csvFileUrl: String = "",
|
||||
var csvFileMd5: String = "",
|
||||
var txtFileUrl: String = "",
|
||||
var segmentPointList:MutableList<PointInfoGroup> = mutableListOf(),
|
||||
var txtFileMd5: String = "",
|
||||
var contrailSaveTime: Long = -1L,
|
||||
var csvFileUrlDPQP: String = "",
|
||||
var csvFileMd5DPQP: String = "",
|
||||
var txtFileUrlDPQP: String = "",
|
||||
var txtFileMd5DPQP: String = "",
|
||||
var contrailSaveTimeDPQP: Long = -1L,
|
||||
var version: Long = -1L,
|
||||
var passPoints: MutableList<RoutingSite>?, // 用于算路的经停点
|
||||
var blackPoints: MutableList<RoutingSite>?, // 用于算路的黑名單點
|
||||
var txtFileUrl: String = "",
|
||||
) {
|
||||
fun toContraiInfo(): ContraiInfo {
|
||||
val tempPassPoints = mutableListOf<BusStationBean>()
|
||||
passPoints?.forEach {
|
||||
tempPassPoints.add(it.toBusStationBean())
|
||||
}
|
||||
val tempblackPoints = mutableListOf<BusStationBean>()
|
||||
blackPoints?.forEach {
|
||||
tempPassPoints.add(it.toBusStationBean())
|
||||
segmentPointList.forEach {
|
||||
for (pointInfo in it.blackList) {
|
||||
tempblackPoints.add(pointInfo.toBusStationBean())
|
||||
}
|
||||
for (pointInfo in it.pointList) {
|
||||
tempPassPoints.add(pointInfo.toBusStationBean())
|
||||
}
|
||||
}
|
||||
return ContraiInfo(lineId,csvFileUrl,csvFileMd5,txtFileUrl,txtFileMd5,contrailSaveTime,tempPassPoints,tempblackPoints)
|
||||
return ContraiInfo(lineId,csvFileUrl,csvFileMd5,txtFileUrl,txtFileMd5,contrailSaveTime,tempPassPoints,tempblackPoints, 2)
|
||||
}
|
||||
|
||||
fun getPassAndBlackPoint(index: Int): Pair<MutableList<BusStationBean>, MutableList<BusStationBean>> {
|
||||
val tempPassPoints = mutableListOf<BusStationBean>()
|
||||
val tempblackPoints = mutableListOf<BusStationBean>()
|
||||
segmentPointList.forEach {
|
||||
if(it.segment==index){
|
||||
for (pointInfo in it.blackList) {
|
||||
tempblackPoints.add(pointInfo.toBusStationBean())
|
||||
}
|
||||
for (pointInfo in it.pointList) {
|
||||
tempPassPoints.add(pointInfo.toBusStationBean())
|
||||
}
|
||||
return Pair(tempPassPoints,tempblackPoints)
|
||||
}
|
||||
}
|
||||
return Pair(tempPassPoints,tempblackPoints)
|
||||
}
|
||||
}
|
||||
|
||||
data class PointInfoGroup(var blackList:MutableList<PointInfo>,//用于算路的黑名單點
|
||||
var pointList:MutableList<PointInfo>,//用于算路的经停点
|
||||
var segment:Int)
|
||||
|
||||
data class PointInfo(var latitude:Double,var longitude:Double,var pointType:Int,var segment:Int) {
|
||||
fun toBusStationBean(): BusStationBean {
|
||||
val temp = BusStationBean()
|
||||
temp.lat = latitude
|
||||
temp.lon = longitude
|
||||
temp.pointType = pointType
|
||||
temp.isLeaving = true
|
||||
return temp
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询灰度线路列表
|
||||
*/
|
||||
@@ -87,7 +116,7 @@ data class QueryGrayContrailListRsp(var data: MutableList<GrayLineBean>?) : Base
|
||||
/**
|
||||
* 通过id查询轨迹详情
|
||||
*/
|
||||
data class StartGrayContrailTaskReq(var sn: String, var contrailId: Long)
|
||||
data class StartGrayContrailTaskReq(var sn: String, var contrailId: Long, var driverId: Long)
|
||||
|
||||
/**
|
||||
* 开始一个路线的灰度任务,对服务端的路线标记
|
||||
@@ -99,11 +128,6 @@ data class StartGrayContrailTaskRsp(var data: Long?) : BaseData()
|
||||
*/
|
||||
data class QueryRoutingContrailByIdRsp(var data: ContrailBean?) : BaseData()
|
||||
|
||||
/**
|
||||
* 上报路线打点
|
||||
*/
|
||||
data class SubmitGrayLineIssueLocationReq(var grayId: Long, var gcjLon: Double, var gcjLat: Double)
|
||||
|
||||
/**
|
||||
* 结束一个路线的灰度任务
|
||||
*/
|
||||
@@ -113,14 +137,14 @@ data class EndGrayContrailTaskReq(
|
||||
var occurrenceTime: Long
|
||||
) //feedback 1:成功 2:失败
|
||||
|
||||
|
||||
/**
|
||||
* 灰度任务&查询轨迹详情
|
||||
*/
|
||||
data class StartGrayAndQueryContrailRsp(
|
||||
var taskId: Long?,
|
||||
var contrail: ContrailBean?,
|
||||
var grayLineBean: GrayLineBean
|
||||
var grayLineBean: GrayLineBean,
|
||||
var stationList: MutableList<BusStationBean>
|
||||
) : BaseData()
|
||||
|
||||
data class PointError(var code: String, var name: String, var isCheck: Boolean = false)
|
||||
@@ -140,13 +164,35 @@ data class SaveGrayContrailErrorReasons(
|
||||
var wgs84Lon: Double,
|
||||
var wgs84Lat: Double,
|
||||
var occurrenceTime: Long,
|
||||
var plateNumber: String,
|
||||
var driverId: Long,
|
||||
var noteCodes: MutableList<String>,
|
||||
) //feedback 1:成功 2:失败
|
||||
|
||||
/**
|
||||
* 小巴、接驳、班车 获取站点的参数
|
||||
*/
|
||||
data class QuerySitesReasons(
|
||||
var lineId: Long, // 线路id
|
||||
var businessType: Int,// 业务模式
|
||||
)
|
||||
|
||||
|
||||
enum class EndGrayTaskFeedbackType(var type: Int) {
|
||||
USABLE_YES(1),
|
||||
USABLE_NO(2)
|
||||
}
|
||||
|
||||
data class BindLineListResponse(val data: List<Result>?) : BaseData() {
|
||||
|
||||
data class Result(
|
||||
var line: LineInfo?,
|
||||
var siteList: List<BusStationBean>?,//站点名称
|
||||
)
|
||||
}
|
||||
|
||||
data class SitesInfo(val data: List<RoutingSite>?) : BaseData()
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
package com.mogo.och.unmanned.taxi.network
|
||||
package com.mogo.och.biz.routing.net
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.commons.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.och.unmanned.taxi.bean.EndGrayContrailTaskReq
|
||||
import com.mogo.och.unmanned.taxi.bean.QueryGrayContrailListRsp
|
||||
import com.mogo.och.unmanned.taxi.bean.QueryPointErrorReasonsRsp
|
||||
import com.mogo.och.unmanned.taxi.bean.QueryRoutingContrailByIdRsp
|
||||
import com.mogo.och.unmanned.taxi.bean.SaveGrayContrailErrorReasons
|
||||
import com.mogo.och.unmanned.taxi.bean.StartGrayContrailTaskReq
|
||||
import com.mogo.och.unmanned.taxi.bean.StartGrayContrailTaskRsp
|
||||
import com.mogo.och.unmanned.taxi.bean.SubmitGrayLineIssueLocationReq
|
||||
import com.mogo.och.biz.routing.bean.BindLineListResponse
|
||||
import com.mogo.och.biz.routing.bean.QueryGrayContrailListRsp
|
||||
import com.mogo.och.biz.routing.bean.QueryPointErrorReasonsRsp
|
||||
import com.mogo.och.biz.routing.bean.QueryRoutingContrailByIdRsp
|
||||
import com.mogo.och.biz.routing.bean.QuerySitesReasons
|
||||
import com.mogo.och.biz.routing.bean.SaveGrayContrailErrorReasons
|
||||
import com.mogo.och.biz.routing.bean.SitesInfo
|
||||
import com.mogo.och.biz.routing.bean.StartGrayContrailTaskReq
|
||||
import com.mogo.och.biz.routing.bean.StartGrayContrailTaskRsp
|
||||
import io.reactivex.Observable
|
||||
import retrofit2.http.Body
|
||||
import retrofit2.http.GET
|
||||
@@ -19,13 +20,13 @@ import retrofit2.http.Headers
|
||||
import retrofit2.http.POST
|
||||
import retrofit2.http.Query
|
||||
|
||||
interface TaxiRoutingServiceApi {
|
||||
interface RoutingServiceApi {
|
||||
|
||||
/**
|
||||
* 查询灰度线路列表
|
||||
*/
|
||||
@Headers("Content-type:application/json;charset=UTF-8")
|
||||
@GET("/och-taxi-cabin/api/business/v1/queryGrayContrailList")
|
||||
@GET("/och-contrail/contrail/queryGrayContrailList")
|
||||
fun queryRoutingGrayLineList(
|
||||
@Header("appId") appId: String = MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
@Header("ticket") ticket: String = SharedPrefsMgr.getInstance().token,
|
||||
@@ -36,7 +37,7 @@ interface TaxiRoutingServiceApi {
|
||||
* 开始一个路线的灰度任务
|
||||
*/
|
||||
@Headers("Content-type:application/json;charset=UTF-8")
|
||||
@POST("/och-taxi-cabin/api/business/v1/startGray")
|
||||
@POST("/och-contrail/grayFeedback/saveFeedback")
|
||||
fun startGrayTask(
|
||||
@Header("appId") appId: String = MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
@Header("ticket") ticket: String = SharedPrefsMgr.getInstance().token,
|
||||
@@ -44,36 +45,26 @@ interface TaxiRoutingServiceApi {
|
||||
): Observable<StartGrayContrailTaskRsp>
|
||||
|
||||
/**
|
||||
* 根据id查询灰度轨迹详情
|
||||
* 根据轨迹id查询轨迹信息
|
||||
*/
|
||||
@Headers("Content-type:application/json;charset=UTF-8")
|
||||
@GET("/och-taxi-cabin/api/business/v1/gray/contrail")
|
||||
@GET("/och-contrail/contrail/queryCabinContrailById")
|
||||
fun queryRoutingContrailById(
|
||||
@Header("appId") appId: String = MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
@Header("ticket") ticket: String = SharedPrefsMgr.getInstance().token,
|
||||
@Query("id") contrailId: Long
|
||||
@Query("contrailId") contrailId: Long
|
||||
): Observable<QueryRoutingContrailByIdRsp>
|
||||
|
||||
/**
|
||||
* 上报路线打点
|
||||
*/
|
||||
@Headers("Content-type:application/json;charset=UTF-8")
|
||||
@POST("/och-taxi-cabin/api/business/v1/saveDotDetail")
|
||||
fun submitGrayLineIssueLocation(
|
||||
@Header("appId") appId: String = MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
@Header("ticket") ticket: String = SharedPrefsMgr.getInstance().token,
|
||||
@Body data: SubmitGrayLineIssueLocationReq
|
||||
): Observable<BaseData>
|
||||
|
||||
/**
|
||||
* 结束一个路线的灰度任务
|
||||
*/
|
||||
@Headers("Content-type:application/json;charset=UTF-8")
|
||||
@POST("/och-taxi-cabin/api/business/v1/endGray")
|
||||
@GET("/och-contrail/grayFeedback/update")
|
||||
fun endGrayTask(
|
||||
@Header("appId") appId: String = MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
@Header("ticket") ticket: String = SharedPrefsMgr.getInstance().token,
|
||||
@Body data: EndGrayContrailTaskReq
|
||||
@Query("id") id:Long,
|
||||
@Query("feedback") feedback:Int,
|
||||
): Observable<BaseData>
|
||||
|
||||
/**
|
||||
@@ -90,10 +81,22 @@ interface TaxiRoutingServiceApi {
|
||||
* 结束一个路线的灰度任务
|
||||
*/
|
||||
@Headers("Content-type:application/json;charset=UTF-8")
|
||||
@POST("/och-taxi-cabin/api/business/v1/saveDotDetail")
|
||||
@POST("/och-contrail/dotDetail/save")
|
||||
fun saveDotDetail(
|
||||
@Header("appId") appId: String = MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
@Header("ticket") ticket: String = SharedPrefsMgr.getInstance().token,
|
||||
@Body data: SaveGrayContrailErrorReasons
|
||||
): Observable<BaseData>
|
||||
|
||||
|
||||
|
||||
@Headers("Content-type:application/json;charset=UTF-8")
|
||||
@POST("/och-vehicle/api/line/querySiteListByLine")
|
||||
fun querySiteListByLine(
|
||||
@Header("appId") appId: String = MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
@Header("ticket") ticket: String = SharedPrefsMgr.getInstance().token,
|
||||
@Body data: QuerySitesReasons
|
||||
): Observable<SitesInfo>
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
package com.mogo.och.biz.routing.net
|
||||
|
||||
import android.content.Context
|
||||
import com.mogo.commons.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.network.MoGoRetrofitFactory
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.och.biz.routing.bean.EndGrayContrailTaskReq
|
||||
import com.mogo.och.biz.routing.bean.GrayLineBean
|
||||
import com.mogo.och.biz.routing.bean.QueryGrayContrailListRsp
|
||||
import com.mogo.och.biz.routing.bean.QueryPointErrorReasonsRsp
|
||||
import com.mogo.och.biz.routing.bean.QuerySitesReasons
|
||||
import com.mogo.och.biz.routing.bean.SaveGrayContrailErrorReasons
|
||||
import com.mogo.och.biz.routing.bean.StartGrayAndQueryContrailRsp
|
||||
import com.mogo.och.biz.routing.bean.StartGrayContrailTaskReq
|
||||
import com.mogo.och.common.module.biz.login.LoginStatusManager
|
||||
import com.mogo.och.common.module.constant.OchCommonConst
|
||||
import com.mogo.och.common.module.network.OchCommonServiceCallback
|
||||
import com.mogo.och.common.module.network.OchCommonSubscribeImpl
|
||||
import com.mogo.och.common.module.network.interceptor.transformTry
|
||||
import com.mogo.och.data.bean.BusStationBean
|
||||
import com.mogo.och.weaknet.repository.db.exception.NetDataException
|
||||
import io.reactivex.Observable
|
||||
|
||||
object RoutingServiceManager {
|
||||
|
||||
private var mRoutingServiceApi: RoutingServiceApi =
|
||||
MoGoRetrofitFactory.getInstance(OchCommonConst.getBaseUrl()).create(
|
||||
RoutingServiceApi::class.java
|
||||
)
|
||||
|
||||
/**
|
||||
* 查询灰度路线列表
|
||||
*/
|
||||
fun queryRoutingGrayLineList(
|
||||
context: Context,
|
||||
callback: OchCommonServiceCallback<QueryGrayContrailListRsp>
|
||||
) {
|
||||
mRoutingServiceApi.queryRoutingGrayLineList(
|
||||
sn = SharedPrefsMgr.getInstance().sn
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryRoutingGrayLineList"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 结束一个灰度任务
|
||||
*/
|
||||
fun endGrayTask(
|
||||
context: Context,
|
||||
data: EndGrayContrailTaskReq,
|
||||
callback: OchCommonServiceCallback<BaseData>
|
||||
) {
|
||||
mRoutingServiceApi.endGrayTask(id = data.grayId, feedback = data.feedback).transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "endGrayTask"))
|
||||
}
|
||||
|
||||
fun getErrorPointReasons(
|
||||
context: Context,
|
||||
callback: OchCommonServiceCallback<QueryPointErrorReasonsRsp>
|
||||
) {
|
||||
mRoutingServiceApi.getDotErrorList().transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "dot/list"))
|
||||
}
|
||||
fun saveDotDetail(
|
||||
context: Context,
|
||||
data: SaveGrayContrailErrorReasons,
|
||||
callback: OchCommonServiceCallback<BaseData>
|
||||
) {
|
||||
mRoutingServiceApi.saveDotDetail(data = data).transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "dot/list"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 标记灰度任务被启动验证
|
||||
*/
|
||||
fun startGrayTaskAndQueryRoutingContrail(
|
||||
context: Context,
|
||||
sn: String,
|
||||
contrailId: Long,
|
||||
grayLineBean: GrayLineBean,
|
||||
callback: OchCommonServiceCallback<StartGrayAndQueryContrailRsp>
|
||||
) {
|
||||
val data = StartGrayContrailTaskReq(sn, contrailId ,LoginStatusManager.getOchLoginInfo()?.driverId?:0L)
|
||||
|
||||
val requestContral = mRoutingServiceApi.queryRoutingContrailById(contrailId = contrailId)
|
||||
val startRouting = mRoutingServiceApi.startGrayTask(data = data)
|
||||
|
||||
|
||||
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)
|
||||
||AppIdentityModeUtils.isShuttle(FunctionBuildConfig.appIdentityMode)
|
||||
||AppIdentityModeUtils.isScheduled(FunctionBuildConfig.appIdentityMode)
|
||||
) {
|
||||
val request = QuerySitesReasons(grayLineBean.lineId?:0,
|
||||
LoginStatusManager.getOchBizInfo()?.businessType?:11)
|
||||
val querySites = mRoutingServiceApi.querySiteListByLine(data = request)
|
||||
|
||||
Observable.zip(requestContral,startRouting,querySites) { t1, t2, t3 ->
|
||||
if ((t1.code != 0 && t1.code != 200) || t1.data == null) {
|
||||
throw NetDataException(t1.code, "${t1.msg}_queryCabinContrailById")
|
||||
}
|
||||
if (t2.code != 0 && t2.code != 200 || t2.data == null) {
|
||||
throw NetDataException(t2.code, "${t2.msg}_saveFeedback")
|
||||
}
|
||||
if (t3.code != 0 && t3.code != 200 || t3.data.isNullOrEmpty()) {
|
||||
throw NetDataException(t3.code, "${t3.msg}_saveFeedback")
|
||||
}
|
||||
val stationList = mutableListOf<BusStationBean>()
|
||||
t3.data.let { lineList->
|
||||
lineList.forEach {
|
||||
stationList.add(it.toBusStationBean())
|
||||
}
|
||||
}
|
||||
val result = StartGrayAndQueryContrailRsp(
|
||||
taskId = t2.data!!,
|
||||
contrail = t1.data,
|
||||
grayLineBean = grayLineBean,
|
||||
stationList = stationList
|
||||
)
|
||||
result.code = t1.code
|
||||
result.msg = t1.msg
|
||||
result
|
||||
}.transformTry()
|
||||
.subscribe(
|
||||
OchCommonSubscribeImpl(
|
||||
context,
|
||||
callback,
|
||||
"startGrayTaskAndQueryRoutingContrail"
|
||||
)
|
||||
)
|
||||
}else if(AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)){
|
||||
Observable.zip(requestContral,startRouting) { t1, t2 ->
|
||||
if ((t1.code != 0 && t1.code != 200)||t1.data==null) {
|
||||
throw NetDataException(t1.code,"${t1.msg}_queryCabinContrailById")
|
||||
}
|
||||
if (t2.code != 0 && t2.code != 200||t2.data==null) {
|
||||
throw NetDataException(t2.code,"${t2.msg}_saveFeedback")
|
||||
}
|
||||
val stationList = mutableListOf<BusStationBean>()
|
||||
grayLineBean.startSite?.toBusStationBean()?.let {
|
||||
stationList.add(it)
|
||||
}
|
||||
grayLineBean.endSite?.toBusStationBean()?.let {
|
||||
stationList.add(it)
|
||||
}
|
||||
val result = StartGrayAndQueryContrailRsp(
|
||||
taskId = t2.data!!,
|
||||
contrail = t1.data,
|
||||
grayLineBean = grayLineBean,
|
||||
stationList = stationList
|
||||
)
|
||||
result.code = t1.code
|
||||
result.msg = t1.msg
|
||||
result
|
||||
}.transformTry()
|
||||
.subscribe(
|
||||
OchCommonSubscribeImpl(
|
||||
context,
|
||||
callback,
|
||||
"startGrayTaskAndQueryRoutingContrail"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.mogo.och.unmanned.taxi.ui.routing
|
||||
package com.mogo.och.biz.routing.ui
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.mogo.och.biz.routing.bean.StartGrayAndQueryContrailRsp
|
||||
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
||||
import com.mogo.och.unmanned.taxi.bean.StartGrayAndQueryContrailRsp
|
||||
|
||||
/**
|
||||
* @author XuXinChao
|
||||
@@ -1,21 +1,25 @@
|
||||
package com.mogo.och.unmanned.taxi.ui.routing
|
||||
package com.mogo.och.biz.routing.ui
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.findViewTreeViewModelStoreOwner
|
||||
import com.mogo.commons.module.status.MogoStatusManager
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.och.biz.R
|
||||
import com.mogo.och.biz.routing.bean.StartGrayAndQueryContrailRsp
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||
import com.mogo.och.common.module.utils.ResourcesUtils
|
||||
import com.mogo.och.unmanned.taxi.R
|
||||
import com.mogo.och.unmanned.taxi.TaxiUnmannedDriverProvider
|
||||
import com.mogo.och.unmanned.taxi.bean.StartGrayAndQueryContrailRsp
|
||||
import kotlinx.android.synthetic.main.unmanned_routing_switch.view.routingRunningView
|
||||
import kotlinx.android.synthetic.main.unmanned_routing_switch.view.routingSelectView
|
||||
import kotlinx.android.synthetic.main.unmanned_routing_switch.view.switch_routing_loading
|
||||
import com.mogo.och.common.module.utils.RxUtils
|
||||
import kotlinx.android.synthetic.main.biz_taxi_switch.view.routingOtherRunningView
|
||||
import kotlinx.android.synthetic.main.biz_taxi_switch.view.routingSelectView
|
||||
import kotlinx.android.synthetic.main.biz_taxi_switch.view.routingTaxiRunningView
|
||||
import kotlinx.android.synthetic.main.biz_taxi_switch.view.switch_routing_loading
|
||||
|
||||
class RoutingSwitchView: ConstraintLayout, RoutingSwitchModel.SwtichLineViewCallback {
|
||||
|
||||
@@ -35,17 +39,17 @@ class RoutingSwitchView: ConstraintLayout, RoutingSwitchModel.SwtichLineViewCall
|
||||
|
||||
private var viewModel: RoutingSwitchModel?=null
|
||||
|
||||
private var fragment: LifecycleOwner?=null
|
||||
private var data: StartGrayAndQueryContrailRsp?=null
|
||||
|
||||
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.unmanned_routing_switch, this, true)
|
||||
LayoutInflater.from(context).inflate(R.layout.biz_taxi_switch, this, true)
|
||||
initView()
|
||||
initEventBus()
|
||||
}
|
||||
|
||||
private fun initView(){
|
||||
fragment = TaxiUnmannedDriverProvider.getFragmentInfo()
|
||||
switch_routing_loading.setEmptyText(ResourcesUtils.getString(R.string.common_biz_loading))
|
||||
}
|
||||
|
||||
@@ -57,7 +61,15 @@ class RoutingSwitchView: ConstraintLayout, RoutingSwitchModel.SwtichLineViewCall
|
||||
super.onVisibilityAggregated(isVisible)
|
||||
if(isVisible){
|
||||
showLoadingView()
|
||||
showRoutingSelectView()
|
||||
if (MogoStatusManager.getInstance().isTaxiUnmanedDriverLineRoutingPerformTask) {
|
||||
if(data!=null){
|
||||
showRoutingRunning(data!!)
|
||||
}else{
|
||||
showRoutingSelectView()
|
||||
}
|
||||
}else {
|
||||
showRoutingSelectView()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,39 +79,63 @@ class RoutingSwitchView: ConstraintLayout, RoutingSwitchModel.SwtichLineViewCall
|
||||
override fun showLoadingView(){
|
||||
startLoading = System.currentTimeMillis()
|
||||
routingSelectView.visibility = GONE
|
||||
routingRunningView.visibility = GONE
|
||||
routingTaxiRunningView.visibility = GONE
|
||||
routingOtherRunningView.visibility = GONE
|
||||
switch_routing_loading.visibility = VISIBLE
|
||||
}
|
||||
|
||||
override fun showRoutingSelectView() {
|
||||
this.data = null
|
||||
val endLoading = System.currentTimeMillis()
|
||||
val dex = (100-(endLoading - startLoading)).takeIf { it>=0 }?:0
|
||||
CallerLogger.d(TAG,"展示选择线路 lading 展示了 ${dex}毫秒")
|
||||
ThreadUtils.runOnUiThreadDelayed({
|
||||
routingSelectView.visibility = VISIBLE
|
||||
routingRunningView.visibility = GONE
|
||||
routingTaxiRunningView.visibility = GONE
|
||||
routingOtherRunningView.visibility = GONE
|
||||
switch_routing_loading.visibility = GONE
|
||||
},dex, ThreadUtils.MODE.QUEUE)
|
||||
}
|
||||
|
||||
override fun showRoutingRunning(data: StartGrayAndQueryContrailRsp) {
|
||||
this.data = data
|
||||
val endLoading = System.currentTimeMillis()
|
||||
val dex = (100-(endLoading - startLoading)).takeIf { it>=0 }?:0
|
||||
CallerLogger.d(TAG,"展示线路 lading 展示了 ${dex}毫秒")
|
||||
ThreadUtils.runOnUiThreadDelayed({
|
||||
OchChainLogManager.writeChainLogRouting("展示线路:","延时${dex}ms")
|
||||
RxUtils.createSubscribe(dex) {
|
||||
OchChainLogManager.writeChainLogRouting("展示线路:","信息:$data")
|
||||
routingSelectView.visibility = GONE
|
||||
routingRunningView.visibility = VISIBLE
|
||||
switch_routing_loading.visibility = GONE
|
||||
routingRunningView.setData(data)
|
||||
},dex, ThreadUtils.MODE.QUEUE)
|
||||
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)
|
||||
|| AppIdentityModeUtils.isShuttle(FunctionBuildConfig.appIdentityMode)
|
||||
|| AppIdentityModeUtils.isScheduled(FunctionBuildConfig.appIdentityMode)
|
||||
) {
|
||||
routingTaxiRunningView.visibility = GONE
|
||||
routingOtherRunningView.visibility = VISIBLE
|
||||
routingOtherRunningView.setData(data)
|
||||
}else if(AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)){
|
||||
routingTaxiRunningView.visibility = VISIBLE
|
||||
routingOtherRunningView.visibility = GONE
|
||||
routingTaxiRunningView.setData(data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
CallerLogger.d(TAG,"onAttachedToWindow")
|
||||
super.onAttachedToWindow()
|
||||
viewModel = findViewTreeViewModelStoreOwner()?.let {
|
||||
ViewModelProvider(it).get(RoutingSwitchModel::class.java)
|
||||
}
|
||||
viewModel?.setDistanceCallback(this)
|
||||
data = null
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
CallerLogger.d(TAG,"onDetachedFromWindow")
|
||||
data = null
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,16 +1,15 @@
|
||||
package com.mogo.och.unmanned.taxi.ui.routing.errorpoint
|
||||
package com.mogo.och.biz.routing.ui.errorpoint
|
||||
|
||||
import android.content.Context
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.CheckBox
|
||||
import androidx.appcompat.widget.AppCompatImageView
|
||||
import androidx.appcompat.widget.AppCompatTextView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.mogo.eagle.core.utilcode.kotlin.onClick
|
||||
import com.mogo.och.unmanned.taxi.R
|
||||
import com.mogo.och.unmanned.taxi.bean.PointError
|
||||
import com.mogo.och.biz.R
|
||||
import com.mogo.och.biz.routing.bean.PointError
|
||||
import me.jessyan.autosize.AutoSizeCompat
|
||||
|
||||
/**
|
||||
@@ -40,7 +39,7 @@ class ErrorPointItemAdapter(
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): TextVH {
|
||||
val view: View
|
||||
val inflater = LayoutInflater.from(context)
|
||||
view = inflater.inflate(R.layout.taxt_report_error_point_item, parent, false)
|
||||
view = inflater.inflate(R.layout.biz_taxi_report_error_point_item, parent, false)
|
||||
return TextVH(view)
|
||||
}
|
||||
|
||||
@@ -48,9 +47,9 @@ class ErrorPointItemAdapter(
|
||||
val errorInfo = dataList[holder.bindingAdapterPosition]
|
||||
AutoSizeCompat.autoConvertDensityOfGlobal(holder.itemView.resources)
|
||||
if (errorInfo.isCheck) {
|
||||
holder.cbErrorInfo.setImageResource(R.drawable.taxi_routing_check)
|
||||
holder.cbErrorInfo.setImageResource(R.drawable.biz_taxi_routing_check)
|
||||
}else{
|
||||
holder.cbErrorInfo.setImageResource(R.drawable.taxi_routing_uncheck)
|
||||
holder.cbErrorInfo.setImageResource(R.drawable.biz_taxi_uncheck)
|
||||
}
|
||||
holder.cbErrorResong.text = errorInfo.name
|
||||
holder.itemView.onClick {
|
||||
@@ -1,29 +1,25 @@
|
||||
package com.mogo.och.unmanned.taxi.ui.routing.errorpoint
|
||||
package com.mogo.och.biz.routing.ui.errorpoint
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import com.google.android.flexbox.AlignItems
|
||||
import com.google.android.flexbox.FlexDirection
|
||||
import com.google.android.flexbox.FlexWrap
|
||||
import com.google.android.flexbox.FlexboxLayoutManager
|
||||
import com.mogo.eagle.core.utilcode.kotlin.onClick
|
||||
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.TimeUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.biz.R
|
||||
import com.mogo.och.biz.routing.bean.PointError
|
||||
import com.mogo.och.common.module.wigets.WindowRelativeLayout
|
||||
import com.mogo.och.common.module.wigets.dialog.CommonDialogView
|
||||
import com.mogo.och.common.module.wigets.dialog.CommonFeedbackDialog
|
||||
import com.mogo.och.unmanned.taxi.R
|
||||
import com.mogo.och.unmanned.taxi.bean.PointError
|
||||
import kotlinx.android.synthetic.main.taxt_report_error_point_panel.view.lvs_loding
|
||||
import kotlinx.android.synthetic.main.taxt_report_error_point_panel.view.rvErrorPointReason
|
||||
import kotlinx.android.synthetic.main.taxt_report_error_point_panel.view.tv_report_error_point_reason
|
||||
import kotlinx.android.synthetic.main.taxt_report_error_point_panel.view.tv_report_error_point_reason_cancel
|
||||
import kotlinx.android.synthetic.main.taxt_report_error_point_panel.view.tv_work_order_time
|
||||
import kotlinx.android.synthetic.main.biz_taxi_report_error_point_panel.view.rvErrorPointReason
|
||||
import kotlinx.android.synthetic.main.biz_taxi_report_error_point_panel.view.lvs_loding
|
||||
import kotlinx.android.synthetic.main.biz_taxi_report_error_point_panel.view.tv_report_error_point_reason
|
||||
import kotlinx.android.synthetic.main.biz_taxi_report_error_point_panel.view.tv_report_error_point_reason_cancel
|
||||
import kotlinx.android.synthetic.main.biz_taxi_report_error_point_panel.view.tv_work_order_time
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -78,7 +74,7 @@ class ReportErrorPointView : WindowRelativeLayout,
|
||||
|
||||
private fun initView() {
|
||||
d(SceneConstant.M_TAXI_P + TAG, "initView")
|
||||
LayoutInflater.from(context).inflate(R.layout.taxt_report_error_point_panel, this, true)
|
||||
LayoutInflater.from(context).inflate(R.layout.biz_taxi_report_error_point_panel, this, true)
|
||||
|
||||
rvErrorPointReason?.layoutManager = GridLayoutManager(context, 2)
|
||||
rvErrorPointReason?.setHasFixedSize(true)
|
||||
@@ -1,16 +1,17 @@
|
||||
package com.mogo.och.unmanned.taxi.ui.routing.errorpoint
|
||||
package com.mogo.och.biz.routing.ui.errorpoint
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.biz.routing.bean.PointError
|
||||
import com.mogo.och.biz.routing.bean.QueryPointErrorReasonsRsp
|
||||
import com.mogo.och.biz.routing.bean.SaveGrayContrailErrorReasons
|
||||
import com.mogo.och.biz.routing.net.RoutingServiceManager
|
||||
import com.mogo.och.bridge.autopilot.location.OchLocationManager
|
||||
import com.mogo.och.common.module.biz.login.LoginStatusManager
|
||||
import com.mogo.och.common.module.network.OchCommonServiceCallback
|
||||
import com.mogo.och.unmanned.taxi.bean.PointError
|
||||
import com.mogo.och.unmanned.taxi.bean.QueryPointErrorReasonsRsp
|
||||
import com.mogo.och.unmanned.taxi.bean.SaveGrayContrailErrorReasons
|
||||
import com.mogo.och.unmanned.taxi.network.TaxiRoutingServiceManager
|
||||
|
||||
class ReportErrorPointViewModel : ViewModel() {
|
||||
|
||||
@@ -30,7 +31,7 @@ class ReportErrorPointViewModel : ViewModel() {
|
||||
}
|
||||
|
||||
fun getPointErrorReasons(){
|
||||
TaxiRoutingServiceManager.getErrorPointReasons(
|
||||
RoutingServiceManager.getErrorPointReasons(
|
||||
AbsMogoApplication.getApp(),
|
||||
object : OchCommonServiceCallback<QueryPointErrorReasonsRsp> {
|
||||
override fun onSuccess(data: QueryPointErrorReasonsRsp?) {
|
||||
@@ -70,6 +71,7 @@ class ReportErrorPointViewModel : ViewModel() {
|
||||
checkDataList.forEach {pointError->
|
||||
errorReasonCodes.add(pointError.code)
|
||||
}
|
||||
|
||||
val saveGrayContrailErrorReasons = SaveGrayContrailErrorReasons(
|
||||
it,
|
||||
gcj02.longitude,
|
||||
@@ -77,9 +79,11 @@ class ReportErrorPointViewModel : ViewModel() {
|
||||
wgs84.longitude,
|
||||
wgs84.latitude,
|
||||
occurrenceTime,
|
||||
LoginStatusManager.getOchCarInfo()?.plateNumber?:"",
|
||||
LoginStatusManager.getOchLoginInfo()?.driverId?:0L,
|
||||
errorReasonCodes
|
||||
)
|
||||
TaxiRoutingServiceManager.saveDotDetail(
|
||||
RoutingServiceManager.saveDotDetail(
|
||||
AbsMogoApplication.getApp(),
|
||||
saveGrayContrailErrorReasons,
|
||||
object : OchCommonServiceCallback<BaseData> {
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.och.unmanned.taxi.ui.routing.routingselect
|
||||
package com.mogo.och.biz.routing.ui.routingselect
|
||||
|
||||
import android.content.Context
|
||||
import android.view.LayoutInflater
|
||||
@@ -8,8 +8,8 @@ import androidx.appcompat.widget.AppCompatTextView
|
||||
import androidx.recyclerview.widget.DiffUtil
|
||||
import androidx.recyclerview.widget.DiffUtil.Callback
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.mogo.och.unmanned.taxi.R
|
||||
import com.mogo.och.unmanned.taxi.bean.GrayLineBean
|
||||
import com.mogo.och.biz.R
|
||||
import com.mogo.och.biz.routing.bean.GrayLineBean
|
||||
import me.jessyan.autosize.AutoSizeCompat
|
||||
|
||||
/**
|
||||
@@ -42,7 +42,7 @@ class RoutingItemAdapter(
|
||||
viewType: Int
|
||||
): RoutingItemViewHolder {
|
||||
val view = LayoutInflater.from(mContext).inflate(
|
||||
R.layout.unmanned_routing_select_item, parent, false
|
||||
R.layout.biz_taxi_select_item, parent, false
|
||||
)
|
||||
return RoutingItemViewHolder(view)
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.och.unmanned.taxi.ui.routing.routingselect
|
||||
package com.mogo.och.biz.routing.ui.routingselect
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
@@ -6,20 +6,19 @@ import com.mogo.commons.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||
import com.mogo.eagle.core.function.call.och.CallerEagleBaseFunctionCall4OchManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OCHCOMMON
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.biz.routing.bean.GrayLineBean
|
||||
import com.mogo.och.biz.routing.bean.QueryGrayContrailListRsp
|
||||
import com.mogo.och.biz.routing.bean.StartGrayAndQueryContrailRsp
|
||||
import com.mogo.och.biz.routing.net.RoutingServiceManager
|
||||
import com.mogo.och.bridge.autopilot.line.LineManager
|
||||
import com.mogo.och.common.module.network.OchCommonServiceCallback
|
||||
import com.mogo.och.data.bean.BusStationBean
|
||||
import com.mogo.och.data.bean.LineInfo
|
||||
import com.mogo.och.unmanned.taxi.bean.GrayLineBean
|
||||
import com.mogo.och.unmanned.taxi.bean.QueryGrayContrailListRsp
|
||||
import com.mogo.och.unmanned.taxi.bean.StartGrayAndQueryContrailRsp
|
||||
import com.mogo.och.unmanned.taxi.network.TaxiRoutingServiceManager
|
||||
import com.mogo.och.unmanned.taxi.ui.debug.DebugView
|
||||
import com.mogo.och.unmanned.taxi.ui.routing.TaxiRoutingModel
|
||||
import com.mogo.och.unmanned.taxi.ui.routing.routingrunning.RoutingRunningModel
|
||||
import com.mogo.och.common.module.biz.birdge.BridgeManager
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||
|
||||
/**
|
||||
* @author XuXinChao
|
||||
@@ -28,7 +27,7 @@ import com.mogo.och.unmanned.taxi.ui.routing.routingrunning.RoutingRunningModel
|
||||
*/
|
||||
class RoutingSelectModel : ViewModel() {
|
||||
|
||||
private val TAG = RoutingRunningModel::class.java.simpleName
|
||||
private val TAG = M_OCHCOMMON +"RoutingSelectModel"
|
||||
|
||||
private var viewCallback: SwtichRoutingViewCallback? = null
|
||||
|
||||
@@ -43,9 +42,9 @@ class RoutingSelectModel : ViewModel() {
|
||||
* 查询灰度路线
|
||||
*/
|
||||
fun queryRoutingGrayLineList() {
|
||||
DebugView.printInfoMsg("[查询灰度路线] 准备发送请求,sn=${SharedPrefsMgr.getInstance().sn}")
|
||||
OchChainLogManager.writeChainLogRouting("[查询灰度路线]","[查询灰度路线] 准备发送请求,sn=${SharedPrefsMgr.getInstance().sn}")
|
||||
|
||||
TaxiRoutingServiceManager.queryRoutingGrayLineList(
|
||||
RoutingServiceManager.queryRoutingGrayLineList(
|
||||
content,
|
||||
object : OchCommonServiceCallback<QueryGrayContrailListRsp> {
|
||||
override fun onSuccess(data: QueryGrayContrailListRsp) {
|
||||
@@ -53,11 +52,17 @@ class RoutingSelectModel : ViewModel() {
|
||||
TAG,
|
||||
"queryRoutingGrayLineList onSuccess: data=${GsonUtils.toJson(data)}"
|
||||
)
|
||||
DebugView.printInfoMsg("[查询灰度路线] 请求success,dataSize=${data?.data?.size}")
|
||||
OchChainLogManager.writeChainLogRouting("[查询灰度路线]","[查询灰度路线] 请求success,dataSize=${data?.data?.size}")
|
||||
val result = mutableListOf<GrayLineBean>()
|
||||
data.data?.also {
|
||||
result.addAll(it)
|
||||
}
|
||||
result.forEach {
|
||||
it.startSite?.let { startSite->
|
||||
it.distance = BridgeManager.distance2Point( startSite.gcjLon, startSite.gcjLat,)
|
||||
}
|
||||
}
|
||||
result.sortBy { it.distance }
|
||||
viewCallback?.onQueryRoutingGrayLineListSuccess(result)
|
||||
}
|
||||
|
||||
@@ -66,7 +71,7 @@ class RoutingSelectModel : ViewModel() {
|
||||
TAG,
|
||||
"queryRoutingGrayLineList onFail: code=$code, msg=$msg"
|
||||
)
|
||||
DebugView.printErrorMsg("[查询灰度路线] 请求fail, code=$code, msg=$msg, sn=${SharedPrefsMgr.getInstance().sn}")
|
||||
OchChainLogManager.writeChainLogRouting("[查询灰度路线]","[查询灰度路线] 请求fail, code=$code, msg=$msg, sn=${SharedPrefsMgr.getInstance().sn}")
|
||||
ToastUtils.showShort("查询灰度线路列表异常, 请稍后重试, code=$code")
|
||||
viewCallback?.onQueryRoutingGrayLineListFailed(msg ?: "查询灰度线路列表异常, 请稍后重试")
|
||||
}
|
||||
@@ -83,7 +88,7 @@ class RoutingSelectModel : ViewModel() {
|
||||
TAG,
|
||||
"queryRoutingGrayLineList onError, msg=$hintStr, sn=${SharedPrefsMgr.getInstance().sn}"
|
||||
)
|
||||
DebugView.printErrorMsg("[查询灰度路线] 请求error, msg=$hintStr")
|
||||
OchChainLogManager.writeChainLogRouting("[查询灰度路线]","[查询灰度路线] 请求error, msg=$hintStr")
|
||||
viewCallback?.onQueryRoutingGrayLineListFailed(hintStr)
|
||||
}
|
||||
})
|
||||
@@ -93,8 +98,8 @@ class RoutingSelectModel : ViewModel() {
|
||||
* 开始灰度任务&查询轨迹详情
|
||||
*/
|
||||
fun startGrayTaskAndQueryRoutingContrail(contrailId: Long, grayLineBean: GrayLineBean) {
|
||||
DebugView.printInfoMsg("[开始灰度任务&查询轨迹详情] 准备发送请求,contrailId=${contrailId}, lineId=${grayLineBean.lineId}")
|
||||
TaxiRoutingServiceManager.startGrayTaskAndQueryRoutingContrail(
|
||||
OchChainLogManager.writeChainLogRouting("[开始灰度任务&查询轨迹详情]","[开始灰度任务&查询轨迹详情] 准备发送请求,contrailId=${contrailId}, lineId=${grayLineBean.lineId}")
|
||||
RoutingServiceManager.startGrayTaskAndQueryRoutingContrail(
|
||||
content,
|
||||
sn = SharedPrefsMgr.getInstance().sn,
|
||||
contrailId = contrailId,
|
||||
@@ -109,7 +114,7 @@ class RoutingSelectModel : ViewModel() {
|
||||
)
|
||||
}"
|
||||
)
|
||||
DebugView.printInfoMsg("[开始灰度任务&查询轨迹详情] 请求success,taskId=${data.taskId}, contrailId=${contrailId}, lineId=${grayLineBean.lineId}")
|
||||
OchChainLogManager.writeChainLogRouting("[开始灰度任务&查询轨迹详情]","[开始灰度任务&查询轨迹详情] 请求success,taskId=${data.taskId}, contrailId=${contrailId}, lineId=${grayLineBean.lineId}")
|
||||
|
||||
initAutopilot(data)
|
||||
}
|
||||
@@ -119,7 +124,7 @@ class RoutingSelectModel : ViewModel() {
|
||||
TAG,
|
||||
"startGrayTaskAndQueryRoutingContrail onFail: code=$code, msg=$msg"
|
||||
)
|
||||
DebugView.printErrorMsg("[开始灰度任务&查询轨迹详情] 请求fail, code=$code, msg=$msg, contrailId=${contrailId}, lineId=${grayLineBean.lineId}")
|
||||
OchChainLogManager.writeChainLogRouting("[开始灰度任务&查询轨迹详情]","[开始灰度任务&查询轨迹详情] 请求fail, code=$code, msg=$msg, contrailId=${contrailId}, lineId=${grayLineBean.lineId}")
|
||||
viewCallback?.onStartGrayTaskAndQueryContrailFailed( msg ?: "startGrayTaskAndQueryRoutingContrail onFail")
|
||||
}
|
||||
|
||||
@@ -135,7 +140,7 @@ class RoutingSelectModel : ViewModel() {
|
||||
TAG,
|
||||
"startGrayTaskAndQueryRoutingContrail onError, msg=$hintStr, contrailId=${contrailId}, lineId=${grayLineBean.lineId}"
|
||||
)
|
||||
DebugView.printErrorMsg("[开始灰度任务&查询轨迹详情] 请求error, msg=$hintStr")
|
||||
OchChainLogManager.writeChainLogRouting("[开始灰度任务&查询轨迹详情]","[开始灰度任务&查询轨迹详情] 请求error, msg=$hintStr")
|
||||
viewCallback?.onStartGrayTaskAndQueryContrailFailed(hintStr)
|
||||
}
|
||||
}
|
||||
@@ -143,41 +148,40 @@ class RoutingSelectModel : ViewModel() {
|
||||
}
|
||||
|
||||
private fun initAutopilot(data: StartGrayAndQueryContrailRsp) {
|
||||
DebugView.printInfoMsg("[开始任务] 准备开始任务")
|
||||
OchChainLogManager.writeChainLogRouting("[开始任务]","[开始任务] 准备开始任务")
|
||||
val grayLineBean = data.grayLineBean
|
||||
val contrailBean = data.contrail
|
||||
val grayId = data.taskId
|
||||
if (grayLineBean == null || contrailBean == null) {
|
||||
val stationList = data.stationList
|
||||
if (grayLineBean == null || contrailBean == null || stationList.size < 2) {
|
||||
ToastUtils.showShort("灰度线路或轨迹信息异常,请稍后再试")
|
||||
DebugView.printErrorMsg("[开始任务] 灰度线路或轨迹信息异常,请稍后再试")
|
||||
OchChainLogManager.writeChainLogRouting("[开始任务]","[开始任务] 灰度线路或轨迹信息异常,请稍后再试")
|
||||
return
|
||||
}
|
||||
DebugView.printInfoMsg("[启自驾] 准备启动自驾")
|
||||
OchChainLogManager.writeChainLogRouting("[启自驾]","[启自驾] 准备启动自驾")
|
||||
|
||||
val startStation = grayLineBean.startSite?.toBusStationBean()
|
||||
val endStation = grayLineBean.endSite?.toBusStationBean()
|
||||
val temp = mutableListOf<BusStationBean>()
|
||||
if(startStation!=null){
|
||||
temp.add(startStation)
|
||||
}
|
||||
if(endStation!=null){
|
||||
temp.add(endStation)
|
||||
stationList.forEachIndexed { index, busStationBean ->
|
||||
if(index>0){
|
||||
val (tempPassPoints, tempblackPoints) = contrailBean.getPassAndBlackPoint(index)
|
||||
busStationBean.passPoints = tempPassPoints
|
||||
busStationBean.blackPoints = tempblackPoints
|
||||
}
|
||||
}
|
||||
|
||||
LineManager.setLineInfo(
|
||||
LineInfo(
|
||||
grayLineBean.lineId?:0L,
|
||||
LineInfo(grayLineBean.lineId?:0L,
|
||||
grayLineBean.lineName?:"",
|
||||
orderId = "${data.taskId}",
|
||||
siteInfos = temp
|
||||
)
|
||||
siteInfos = stationList)
|
||||
)
|
||||
LineManager.setContraiInfo(contrailBean.toContraiInfo())
|
||||
LineManager.setStartAndEndStation(startStation,endStation)
|
||||
CallerEagleBaseFunctionCall4OchManager.updateOrderStatus(true)
|
||||
|
||||
viewCallback?.onStartGrayTaskAndQueryContrailSuccess(data)
|
||||
// Routing 从这里解析出经停信息,轨迹信息,并调用下载轨迹接口
|
||||
LineManager.initAutopilotControlParameters()?.let {
|
||||
LineManager.initAutopilotControlParametersFromContrai()?.let {
|
||||
CallerLogger.d(TAG,"下发下载轨迹信息:${it}")
|
||||
OchChainLogManager.writeChainLogRouting("[启自驾]","下发下载轨迹信息:${it}")
|
||||
CallerAutoPilotControlManager.sendTrajectoryDownloadReq(it)
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.och.unmanned.taxi.ui.routing.routingselect
|
||||
package com.mogo.och.biz.routing.ui.routingselect
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
@@ -7,18 +7,20 @@ import android.view.View
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.findViewTreeViewModelStoreOwner
|
||||
import com.mogo.eagle.core.utilcode.kotlin.onClick
|
||||
import com.mogo.eagle.core.utilcode.mogo.view.SpacesItemDecoration
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.biz.R
|
||||
import com.mogo.och.biz.routing.bean.GrayLineBean
|
||||
import com.mogo.och.biz.routing.bean.StartGrayAndQueryContrailRsp
|
||||
import com.mogo.och.common.module.wigets.WrapContentLinearLayoutManager
|
||||
import com.mogo.och.unmanned.taxi.R
|
||||
import com.mogo.och.unmanned.taxi.bean.GrayLineBean
|
||||
import com.mogo.och.unmanned.taxi.bean.StartGrayAndQueryContrailRsp
|
||||
import com.mogo.och.unmanned.taxi.ui.debug.DebugView
|
||||
import com.mogo.och.unmanned.taxi.ui.routing.RoutingSwitchModel
|
||||
import com.mogo.och.unmanned.taxi.ui.routing.routingselect.RoutingSelectModel.SwtichRoutingViewCallback
|
||||
import kotlinx.android.synthetic.main.unmanned_routing_select.view.include_empty
|
||||
import kotlinx.android.synthetic.main.unmanned_routing_select.view.include_error
|
||||
import kotlinx.android.synthetic.main.unmanned_routing_select.view.switch_routing_rv
|
||||
import com.mogo.och.biz.routing.ui.RoutingSwitchModel
|
||||
import com.mogo.och.biz.routing.ui.routingselect.RoutingSelectModel.SwtichRoutingViewCallback
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||
import kotlinx.android.synthetic.main.biz_taxi_select.view.actv_refresh
|
||||
import kotlinx.android.synthetic.main.biz_taxi_select.view.include_empty
|
||||
import kotlinx.android.synthetic.main.biz_taxi_select.view.include_error
|
||||
import kotlinx.android.synthetic.main.biz_taxi_select.view.switch_routing_rv
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
|
||||
class RoutingSelectView: ConstraintLayout, SwtichRoutingViewCallback {
|
||||
@@ -48,7 +50,7 @@ class RoutingSelectView: ConstraintLayout, SwtichRoutingViewCallback {
|
||||
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.unmanned_routing_select, this, true)
|
||||
LayoutInflater.from(context).inflate(R.layout.biz_taxi_select, this, true)
|
||||
initView()
|
||||
}
|
||||
|
||||
@@ -61,16 +63,21 @@ class RoutingSelectView: ConstraintLayout, SwtichRoutingViewCallback {
|
||||
switch_routing_rv.addItemDecoration(SpacesItemDecoration(AutoSizeUtils.dp2px(context,20f)))
|
||||
switch_routing_rv.adapter = mChooseLineListAdapter
|
||||
//设置item 点击事件
|
||||
mChooseLineListAdapter.setOnLineItemClickListener(object : RoutingItemAdapter.LineItemClickListener {
|
||||
mChooseLineListAdapter.setOnLineItemClickListener(object :
|
||||
RoutingItemAdapter.LineItemClickListener {
|
||||
override fun onItemClick(data: GrayLineBean) {
|
||||
if(data.contrailId==null||data.contrailId!!<=0L){
|
||||
ToastUtils.showShort("请设置轨迹信息")
|
||||
}
|
||||
DebugView.printInfoMsg("[选择灰度任务] 当前选择 mCurrentChosenPosition=$mCurrentChosenPosition, ")
|
||||
OchChainLogManager.writeChainLogRouting("[选择灰度任务]","[选择灰度任务] 当前选择 ${data} ")
|
||||
swtichViewModel?.showLoading()
|
||||
viewModel?.startGrayTaskAndQueryRoutingContrail(data.contrailId!!,data)
|
||||
}
|
||||
})
|
||||
|
||||
actv_refresh.onClick {
|
||||
viewModel?.queryRoutingGrayLineList()
|
||||
}
|
||||
}
|
||||
|
||||
private fun showEmptyView() {
|
||||
@@ -98,6 +105,7 @@ class RoutingSelectView: ConstraintLayout, SwtichRoutingViewCallback {
|
||||
mRoutingLineList.clear()
|
||||
mRoutingLineList.addAll(data)
|
||||
mChooseLineListAdapter.notifyDataSetChanged()
|
||||
ToastUtils.showShort("刷新成功")
|
||||
} else {
|
||||
showEmptyView()
|
||||
}
|
||||
@@ -0,0 +1,263 @@
|
||||
package com.mogo.och.biz.routing.ui.runing.other
|
||||
|
||||
import android.animation.ArgbEvaluator
|
||||
import android.content.Context
|
||||
import android.graphics.drawable.GradientDrawable
|
||||
import android.util.TypedValue
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.appcompat.widget.AppCompatImageView
|
||||
import androidx.appcompat.widget.AppCompatTextView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OCHCOMMON
|
||||
import com.mogo.och.biz.R
|
||||
import com.mogo.och.common.module.utils.ResourcesUtils
|
||||
import com.mogo.och.data.bean.BusStationBean
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
|
||||
/**
|
||||
* 路线列表adapter
|
||||
*/
|
||||
class TaskRunningAdapter(
|
||||
private val mContext: Context,
|
||||
val mData: MutableList<BusStationBean>
|
||||
) : RecyclerView.Adapter<TaskRunningAdapter.TaskRunningViewHolder>() {
|
||||
|
||||
companion object {
|
||||
const val TAG = "${M_OCHCOMMON}TaskRunningAdapter"
|
||||
}
|
||||
|
||||
private val argbEvaluator: ArgbEvaluator = ArgbEvaluator()
|
||||
private val startColor = ResourcesUtils.getColor(R.color.common_1970FF)
|
||||
private val endColor = ResourcesUtils.getColor(R.color.common_19FF7F)
|
||||
private val heightItem = 100f
|
||||
private val halfHeight = 16.5f
|
||||
private var totalHeight = 0f
|
||||
|
||||
|
||||
|
||||
override fun onCreateViewHolder(
|
||||
parent: ViewGroup,
|
||||
viewType: Int
|
||||
): TaskRunningViewHolder {
|
||||
val view = LayoutInflater.from(mContext).inflate(
|
||||
R.layout.biz_other_running_item, parent, false
|
||||
)
|
||||
return TaskRunningViewHolder(view)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: TaskRunningViewHolder, position: Int) {
|
||||
val currentPosition = holder.bindingAdapterPosition
|
||||
val line = mData[currentPosition]
|
||||
holder.actvStationName.text = line.name
|
||||
val startStationIndex = TaskRunningModel.currentIndex
|
||||
if (startStationIndex >= 0) {
|
||||
CallerLogger.d(TAG, "位置:$currentPosition ${TaskRunningModel.currentIndex} 当前站${mData[startStationIndex]} ")
|
||||
}
|
||||
|
||||
if (currentPosition < startStationIndex) {
|
||||
holder.actvStationName.setTextSize(
|
||||
TypedValue.COMPLEX_UNIT_PX,
|
||||
AutoSizeUtils.dp2px(mContext, 40f).toFloat()
|
||||
)
|
||||
holder.actvStationName.setTextColor(ResourcesUtils.getColor(R.color.common_4DFFFFFF))
|
||||
holder.acivStationHead.setImageResource(R.drawable.bus_switch_line_adapter_point_pass)
|
||||
} else if (currentPosition == startStationIndex) {
|
||||
holder.actvStationName.setTextSize(
|
||||
TypedValue.COMPLEX_UNIT_PX,
|
||||
AutoSizeUtils.dp2px(mContext, 45f).toFloat()
|
||||
)
|
||||
holder.actvStationName.setTextColor(ResourcesUtils.getColor(R.color.common_2EACFF))
|
||||
holder.acivStationHead.setImageResource(R.drawable.bus_runnint_task_middle)
|
||||
} else {
|
||||
holder.actvStationName.setTextColor(ResourcesUtils.getColor(R.color.white))
|
||||
holder.actvStationName.setTextSize(
|
||||
TypedValue.COMPLEX_UNIT_PX,
|
||||
AutoSizeUtils.dp2px(mContext, 40f).toFloat()
|
||||
)
|
||||
holder.itemView.background = null
|
||||
holder.acivStationHead.setImageResource(R.drawable.bus_runnint_task_middle)
|
||||
}
|
||||
|
||||
when (currentPosition) {
|
||||
0 -> {
|
||||
holder.acivStationHeadBig.visibility = View.VISIBLE
|
||||
holder.acivStationHead.visibility = View.INVISIBLE
|
||||
holder.acivStationHeadBig.setImageResource(R.drawable.bus_runnint_task_start)
|
||||
holder.middleStationBg.visibility = View.GONE
|
||||
holder.startStationBg.visibility = View.VISIBLE
|
||||
holder.endStationBg.visibility = View.GONE
|
||||
if (startStationIndex == 0) {
|
||||
if (line.isLeaving) {
|
||||
// 下端 灰色
|
||||
holder.startStationBg.setBackgroundResource(R.color.common_4DFFFFFF)
|
||||
holder.itemView.background = null
|
||||
} else {
|
||||
// 下端 彩色
|
||||
holder.itemView.setBackgroundResource(R.drawable.bus_task_current_station_bg)
|
||||
|
||||
val orientation = GradientDrawable.Orientation.TOP_BOTTOM
|
||||
val temp01 = GradientDrawable(
|
||||
orientation, intArrayOf(
|
||||
startColor,
|
||||
endColor
|
||||
)
|
||||
)
|
||||
holder.startStationBg.background = temp01
|
||||
}
|
||||
} else {
|
||||
// 下端 灰色
|
||||
holder.startStationBg.setBackgroundResource(R.color.common_4DFFFFFF)
|
||||
holder.itemView.background = null
|
||||
}
|
||||
}
|
||||
|
||||
mData.size - 1 -> {
|
||||
holder.acivStationHeadBig.visibility = View.VISIBLE
|
||||
holder.acivStationHead.visibility = View.INVISIBLE
|
||||
holder.acivStationHeadBig.setImageResource(R.drawable.bus_runnint_task_end)
|
||||
holder.middleStationBg.visibility = View.GONE
|
||||
holder.startStationBg.visibility = View.GONE
|
||||
holder.endStationBg.visibility = View.VISIBLE
|
||||
if (startStationIndex == itemCount - 2) {
|
||||
if (line.isLeaving) {
|
||||
holder.endStationBg.setBackgroundResource(R.color.common_4DFFFFFF)
|
||||
holder.itemView.setBackgroundResource(R.drawable.bus_task_current_station_bg)
|
||||
} else {
|
||||
holder.itemView.setBackgroundResource(R.drawable.bus_task_current_station_bg)
|
||||
holder.endStationBg.setBackgroundResource(R.color.common_4DFFFFFF)
|
||||
}
|
||||
} else {
|
||||
// 上端 彩色
|
||||
holder.itemView.background = null
|
||||
val startColorTemp = argbEvaluator.evaluate(
|
||||
((totalHeight - halfHeight) / totalHeight).toFloat(),
|
||||
startColor,
|
||||
endColor
|
||||
) as Int
|
||||
val endColorTemp = argbEvaluator.evaluate(1f, startColor, endColor) as Int
|
||||
val orientation = GradientDrawable.Orientation.TOP_BOTTOM
|
||||
val temp01 = GradientDrawable(
|
||||
orientation, intArrayOf(
|
||||
startColorTemp,
|
||||
endColorTemp
|
||||
)
|
||||
)
|
||||
holder.endStationBg.background = temp01
|
||||
}
|
||||
}
|
||||
|
||||
else -> {
|
||||
holder.acivStationHeadBig.visibility = View.GONE
|
||||
holder.acivStationHead.visibility = View.VISIBLE
|
||||
holder.middleStationBg.visibility = View.VISIBLE
|
||||
holder.startStationBg.visibility = View.GONE
|
||||
holder.endStationBg.visibility = View.GONE
|
||||
if (currentPosition == startStationIndex) {
|
||||
if (line.isLeaving) {
|
||||
// 灰色
|
||||
holder.middleStationBg.setBackgroundResource(R.color.common_4DFFFFFF)
|
||||
holder.itemView.background = null
|
||||
} else {
|
||||
// 彩色
|
||||
holder.itemView.setBackgroundResource(R.drawable.bus_task_current_station_bg)
|
||||
val startColorTemp = argbEvaluator.evaluate(0f, startColor, endColor) as Int
|
||||
val endColorTemp =
|
||||
argbEvaluator.evaluate(100f / totalHeight, startColor, endColor) as Int
|
||||
val orientation = GradientDrawable.Orientation.TOP_BOTTOM
|
||||
val temp01 = GradientDrawable(
|
||||
orientation, intArrayOf(
|
||||
startColorTemp,
|
||||
endColorTemp
|
||||
)
|
||||
)
|
||||
holder.middleStationBg.background = temp01
|
||||
}
|
||||
} else if (currentPosition < startStationIndex) {
|
||||
// 灰色
|
||||
holder.middleStationBg.setBackgroundResource(R.color.common_4DFFFFFF)
|
||||
holder.itemView.background = null
|
||||
} else {
|
||||
var dex = 0f
|
||||
if (startStationIndex == 0) {
|
||||
val firstItemData = mData[0]
|
||||
if (!firstItemData.isLeaving) {
|
||||
dex = halfHeight
|
||||
}
|
||||
} else {
|
||||
val checkIndex = mData.get(startStationIndex)
|
||||
if (!checkIndex.isLeaving) {
|
||||
dex = heightItem
|
||||
}
|
||||
}
|
||||
// 彩色
|
||||
holder.itemView.background = null
|
||||
val index = (currentPosition - startStationIndex - 1) * 100
|
||||
val startFraction = (dex + index) / totalHeight
|
||||
val endFraction = (dex + index + 100) / totalHeight
|
||||
// CallerLogger.d(
|
||||
// TAG,
|
||||
// "位置:$currentPosition 当前站${startStationIndex} 开始百分比:${startFraction} 结束百分比:${endFraction}"
|
||||
// )
|
||||
val startColorTemp =
|
||||
argbEvaluator.evaluate(startFraction, startColor, endColor) as Int
|
||||
val endColorTemp =
|
||||
argbEvaluator.evaluate(endFraction, startColor, endColor) as Int
|
||||
val orientation = GradientDrawable.Orientation.TOP_BOTTOM
|
||||
val temp01 = GradientDrawable(
|
||||
orientation, intArrayOf(
|
||||
startColorTemp,
|
||||
endColorTemp
|
||||
)
|
||||
)
|
||||
holder.middleStationBg.background = temp01
|
||||
}
|
||||
}
|
||||
}
|
||||
if (currentPosition == startStationIndex + 1) {
|
||||
val preLine = mData[currentPosition - 1]
|
||||
if (preLine.isLeaving) {
|
||||
holder.itemView.setBackgroundResource(R.drawable.bus_task_current_station_bg)
|
||||
} else {
|
||||
holder.itemView.background = null
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return mData.size
|
||||
}
|
||||
|
||||
fun setDataList(dataList: List<BusStationBean>) {
|
||||
this.mData.clear()
|
||||
this.mData.addAll(dataList)
|
||||
totalHeight = 33 + (dataList.size - 2) * heightItem
|
||||
notifyItemRangeChanged(0, dataList.size, true)
|
||||
}
|
||||
|
||||
fun notifyChange(){
|
||||
if (TaskRunningModel.currentIndex == 0) {
|
||||
totalHeight = 33 + (mData.size - 2) * heightItem
|
||||
} else {
|
||||
totalHeight =
|
||||
(halfHeight + (mData.size - 1 - TaskRunningModel.currentIndex) * heightItem).toFloat()
|
||||
}
|
||||
notifyItemRangeChanged(0, mData.size, true)
|
||||
}
|
||||
class TaskRunningViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||
val actvStationName: AppCompatTextView = itemView.findViewById(R.id.actv_station_name)//站点名称
|
||||
val acivStationHead: AppCompatImageView =
|
||||
itemView.findViewById(R.id.aciv_station_head)//普通站点标识 不是起始和终点坐标
|
||||
val acivStationHeadBig: AppCompatImageView =
|
||||
itemView.findViewById(R.id.aciv_station_head_big)//起始和终点坐标标识
|
||||
val middleStationBg: View = itemView.findViewById(R.id.bg_pass_bg) //贯通背景调
|
||||
val endStationBg: View = itemView.findViewById(R.id.bg_pass_head_bg) //终点的背景
|
||||
val startStationBg: View = itemView.findViewById(R.id.bg_pass_bottom_bg) //起点坐标的背景
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,303 @@
|
||||
package com.mogo.och.biz.routing.ui.runing.other
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.module.status.MogoStatusManager
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.och.CallerEagleBaseFunctionCall4OchManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OCHCOMMON
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils
|
||||
import com.mogo.och.biz.routing.bean.ContrailBean
|
||||
import com.mogo.och.biz.routing.bean.EndGrayContrailTaskReq
|
||||
import com.mogo.och.biz.routing.bean.EndGrayTaskFeedbackType
|
||||
import com.mogo.och.biz.routing.bean.GrayLineBean
|
||||
import com.mogo.och.biz.routing.bean.StartGrayAndQueryContrailRsp
|
||||
import com.mogo.och.biz.routing.net.RoutingServiceManager
|
||||
import com.mogo.och.bridge.autopilot.autopilot.IOchAutopilotStatusListener
|
||||
import com.mogo.och.bridge.autopilot.autopilot.OchAutoPilotStatusListenerManager
|
||||
import com.mogo.och.bridge.autopilot.autopilot.bean.ArrivedStation
|
||||
import com.mogo.och.bridge.autopilot.line.ILineCallback
|
||||
import com.mogo.och.bridge.autopilot.line.LineManager
|
||||
import com.mogo.och.common.module.constant.OchCommonConst
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
||||
import com.mogo.och.common.module.network.OchCommonServiceCallback
|
||||
import com.mogo.och.data.bean.BusStationBean
|
||||
|
||||
/**
|
||||
* @author XuXinChao
|
||||
* @description BadCase录包管理页面
|
||||
* @since: 2022/12/15
|
||||
*/
|
||||
class TaskRunningModel : ViewModel() {
|
||||
|
||||
private val TAG = M_OCHCOMMON + TaskRunningModel::class.java.simpleName
|
||||
|
||||
private var viewCallback: SwtichLineViewCallback? = null
|
||||
|
||||
private val content = AbsMogoApplication.getApp()
|
||||
|
||||
private var _data: StartGrayAndQueryContrailRsp? = null
|
||||
val data: StartGrayAndQueryContrailRsp?
|
||||
get() = _data
|
||||
|
||||
private var currentGrayLineBean: GrayLineBean? = null
|
||||
private var currentContrailBean: ContrailBean? = null
|
||||
private var stationList: MutableList<BusStationBean>? = null
|
||||
private var currentGrayId: Long? = null
|
||||
|
||||
/**
|
||||
* 是否可以进行进站操作
|
||||
*/
|
||||
var arrivedStation:Boolean = false
|
||||
|
||||
companion object {
|
||||
var currentIndex = -1
|
||||
}
|
||||
|
||||
|
||||
override fun onCleared() {
|
||||
}
|
||||
|
||||
fun setDistanceCallback(viewCallback: SwtichLineViewCallback) {
|
||||
this.viewCallback = viewCallback
|
||||
}
|
||||
|
||||
fun setNewData(data: StartGrayAndQueryContrailRsp) {
|
||||
this._data = data
|
||||
this.currentGrayLineBean = data.grayLineBean
|
||||
this.currentContrailBean = data.contrail
|
||||
this.currentGrayId = data.taskId
|
||||
this.stationList = data.stationList
|
||||
this.stationList?.forEach {
|
||||
it.isLeaving = false
|
||||
}
|
||||
currentIndex = 0
|
||||
this.stationList?.let {
|
||||
val startStationNext = it[currentIndex]
|
||||
val endStation = it[currentIndex + 1]
|
||||
CallerLogger.d(TAG,"setNewData index:${currentIndex} ${startStationNext.name} -- ${endStation.name}")
|
||||
LineManager.setStartAndEndStation(startStationNext, endStation)
|
||||
}
|
||||
MogoStatusManager.getInstance().setTaxiUnmanedDriverLineRoutingPerformTask(TAG, true)
|
||||
//添加到站监听
|
||||
OchAutoPilotStatusListenerManager.addListener(TAG, mMogoAutopilotStatusListener)
|
||||
LineManager.addListener(TAG, lineCallback)
|
||||
}
|
||||
|
||||
//MAP到站监听
|
||||
private val mMogoAutopilotStatusListener: IOchAutopilotStatusListener =
|
||||
object : IOchAutopilotStatusListener {
|
||||
|
||||
override fun onAutopilotArriveAtStation(arrivalNotification: ArrivedStation?) {
|
||||
if(!arrivedStation){
|
||||
OchChainLogManager.writeChainLogRouting("已到站","等待重试",false)
|
||||
return
|
||||
}
|
||||
CallerLogger.i(
|
||||
TAG,
|
||||
"onAutopilotArriveAtStation = ${arrivalNotification.toString()}"
|
||||
)
|
||||
OchChainLogManager.writeChainLogRouting(
|
||||
"MAP到站通知",
|
||||
"[MAP到站通知] 上报到站,location=${arrivalNotification?.endLocation}"
|
||||
)
|
||||
arriveStation()
|
||||
}
|
||||
}
|
||||
|
||||
private val lineCallback: ILineCallback = object : ILineCallback {
|
||||
override fun arrivedStationSuccessBySearch() {
|
||||
OchChainLogManager.writeChainLogRouting(
|
||||
"[自车定位围栏]",
|
||||
"\"[自车定位围栏] 并查询底盘触发到站, endSiteId=${currentGrayLineBean?.endSite?.siteId}, endSiteName=${currentGrayLineBean?.endSite?.siteName}, lineId=${currentGrayLineBean?.lineId},围栏范围:${OchCommonConst.ARRIVE_AT_START_STATION_DISTANCE}米 没有过站、速度基本为零且在15m内\""
|
||||
)
|
||||
if(!arrivedStation){
|
||||
OchChainLogManager.writeChainLogRouting("已到站","等待重试",false)
|
||||
return
|
||||
}
|
||||
arriveStation()
|
||||
}
|
||||
}
|
||||
|
||||
fun leaveStation() {
|
||||
stationList?.let {
|
||||
if (it.isNotEmpty()) {
|
||||
if (currentIndex + 1 >= it.size) {
|
||||
this.viewCallback?.showCompleteTask()
|
||||
return
|
||||
}
|
||||
val startStation = it[currentIndex]
|
||||
val endStation = it[currentIndex + 1]
|
||||
startStation.isLeaving = true
|
||||
arrivedStation = true
|
||||
startStation.drivingStatus = 2
|
||||
CallerLogger.d(TAG,"leaveStation index:${currentIndex} ${startStation.name}---${endStation.name}")
|
||||
this.viewCallback?.notifyItemChange(currentIndex)
|
||||
this.viewCallback?.showArriverStationAndCompleteTask()
|
||||
if (CallerAutoPilotStatusListenerManager.getState() == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
|
||||
) {
|
||||
LineManager.startAutopilot()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
fun arriveStation() {
|
||||
stationList?.let {
|
||||
val startStation = it[currentIndex]
|
||||
|
||||
if (currentIndex + 2 >= it.size) {
|
||||
startStation.isLeaving = true
|
||||
this.viewCallback?.showCompleteTask()
|
||||
}else {
|
||||
startStation.isLeaving = false
|
||||
arrivedStation = false
|
||||
startStation.drivingStatus = 1
|
||||
currentIndex += 1
|
||||
val startStationNext = it[currentIndex]
|
||||
val endStation = it[currentIndex + 1]
|
||||
CallerLogger.d(TAG, "setNewData index:${currentIndex} ${startStationNext.name}----${endStation.name}")
|
||||
LineManager.setStartAndEndStation(startStationNext, endStation)
|
||||
}
|
||||
LineManager.getStations { start, end ->
|
||||
BizLoopManager.runInMainThread{
|
||||
this.viewCallback?.onArrivedStation(start.isLeaving)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
interface SwtichLineViewCallback {
|
||||
// 到站
|
||||
fun onArrivedStation(leaving: Boolean)
|
||||
|
||||
// 结束服务成功
|
||||
fun onSubmitEndTaskSuccess()
|
||||
|
||||
// 结束服务失败
|
||||
fun onSubmitEndTaskFailed(s: String)
|
||||
|
||||
// 站点到站和结束任务
|
||||
fun showCompleteTask()
|
||||
|
||||
//
|
||||
fun showArriverStationAndCompleteTask()
|
||||
|
||||
fun notifyItemChange(currentIndex: Int)
|
||||
fun clearData()
|
||||
}
|
||||
|
||||
/**
|
||||
* 结束灰度任务
|
||||
*/
|
||||
fun endGrayTask(grayId: Long, type: EndGrayTaskFeedbackType, occurrenceTime: Long) {
|
||||
OchChainLogManager.writeChainLogRouting(
|
||||
"[结束灰度任务]",
|
||||
"[结束灰度任务] 准备发送请求,grayId=$grayId, type=${type.type}, typeName=${type.name}"
|
||||
)
|
||||
val submit = EndGrayContrailTaskReq(grayId, type.type, occurrenceTime)
|
||||
RoutingServiceManager.endGrayTask(
|
||||
content,
|
||||
submit,
|
||||
object : OchCommonServiceCallback<BaseData> {
|
||||
override fun onSuccess(data: BaseData?) {
|
||||
CallerLogger.d(
|
||||
TAG,
|
||||
"endGrayTask onSuccess: data=${
|
||||
GsonUtils.toJson(
|
||||
data
|
||||
)
|
||||
}"
|
||||
)
|
||||
OchChainLogManager.writeChainLogRouting(
|
||||
"[结束灰度任务]",
|
||||
"[结束灰度任务] 请求success,grayId=$grayId, type=${type.type}, typeName=${type.name}"
|
||||
)
|
||||
clearData()
|
||||
viewCallback?.onSubmitEndTaskSuccess()
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String?) {
|
||||
CallerLogger.d(
|
||||
TAG,
|
||||
"endGrayTask onFail: code=$code, msg=$msg"
|
||||
)
|
||||
OchChainLogManager.writeChainLogRouting(
|
||||
"[结束灰度任务]",
|
||||
"[结束灰度任务] 请求fail, code=$code, msg=$msg, grayId=$grayId, type=${type.type}, typeName=${type.name}"
|
||||
)
|
||||
viewCallback?.onSubmitEndTaskFailed(msg ?: "endGrayTask onFail")
|
||||
}
|
||||
|
||||
override fun onError() {
|
||||
super.onError()
|
||||
var hintStr = ""
|
||||
if (!NetworkUtils.isConnected(content)) {
|
||||
hintStr = "网络出现异常,请稍后重试"
|
||||
} else {
|
||||
hintStr = "上报结束任务异常, 请稍后重试"
|
||||
}
|
||||
CallerLogger.d(
|
||||
TAG,
|
||||
"endGrayTask onError, msg=$hintStr"
|
||||
)
|
||||
OchChainLogManager.writeChainLogRouting(
|
||||
"[结束灰度任务]",
|
||||
"[结束灰度任务] 请求error, msg=$hintStr, grayId=$grayId, type=${type.type}, typeName=${type.name}"
|
||||
)
|
||||
viewCallback?.onSubmitEndTaskFailed(hintStr)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun clearData() {
|
||||
_data = null
|
||||
this.currentGrayLineBean = null
|
||||
this.currentContrailBean = null
|
||||
this.currentGrayId = null
|
||||
LineManager.setLineInfo(null)
|
||||
LineManager.setContraiInfo(null)
|
||||
LineManager.setStartAndEndStation(null, null)
|
||||
|
||||
BizLoopManager.runInMainThread{
|
||||
this.viewCallback?.clearData()
|
||||
}
|
||||
|
||||
CallerEagleBaseFunctionCall4OchManager.updateOrderStatus(false)
|
||||
|
||||
// 设置灰度路线任务执行状态,切换模式时判断使用
|
||||
MogoStatusManager.getInstance().setTaxiUnmanedDriverLineRoutingPerformTask(TAG, false)
|
||||
|
||||
// 移除到站监听
|
||||
OchAutoPilotStatusListenerManager.removeListener(TAG)
|
||||
LineManager.removeListener(TAG)
|
||||
cancelAutopilot()
|
||||
}
|
||||
|
||||
/**
|
||||
* 结束自动驾驶
|
||||
* */
|
||||
private fun cancelAutopilot() {
|
||||
try {
|
||||
CallerAutoPilotControlManager.cancelAutoPilot()
|
||||
OchChainLogManager.writeChainLogRouting("[取消自驾]", "[取消自驾] 调用成功")
|
||||
CallerLogger.d(TAG, "结束自动驾驶")
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,255 @@
|
||||
package com.mogo.och.biz.routing.ui.runing.other
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.findViewTreeViewModelStoreOwner
|
||||
import com.mogo.eagle.core.utilcode.kotlin.onClick
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OCHCOMMON
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.biz.R
|
||||
import com.mogo.och.biz.routing.RoutingServiceManager
|
||||
import com.mogo.och.biz.routing.bean.EndGrayTaskFeedbackType
|
||||
import com.mogo.och.biz.routing.bean.StartGrayAndQueryContrailRsp
|
||||
import com.mogo.och.biz.routing.ui.RoutingSwitchModel
|
||||
import com.mogo.och.biz.routing.ui.errorpoint.ReportErrorPointView
|
||||
import com.mogo.och.bridge.autopilot.line.LineManager
|
||||
import com.mogo.och.common.module.map.AmapNaviToDestinationModel
|
||||
import com.mogo.och.common.module.wigets.dialog.CommonDialogStatus
|
||||
import com.mogo.och.common.module.wigets.CommonSlideView
|
||||
import com.mogo.och.common.module.wigets.WrapContentLinearLayoutManager
|
||||
import kotlinx.android.synthetic.main.biz_other_running.view.aciv_task_leave_station_slide_bg
|
||||
import kotlinx.android.synthetic.main.biz_other_running.view.actv_arriver_station
|
||||
import kotlinx.android.synthetic.main.biz_other_running.view.actv_complete_task
|
||||
import kotlinx.android.synthetic.main.biz_other_running.view.actv_running_task_last_station
|
||||
import kotlinx.android.synthetic.main.biz_other_running.view.actv_submit_task
|
||||
import kotlinx.android.synthetic.main.biz_other_running.view.bus_task_running_line_name
|
||||
import kotlinx.android.synthetic.main.biz_other_running.view.loading_arrive_station
|
||||
import kotlinx.android.synthetic.main.biz_other_running.view.rl_running_task_station_list
|
||||
|
||||
|
||||
class TaskRunningView : ConstraintLayout, TaskRunningModel.SwtichLineViewCallback {
|
||||
|
||||
|
||||
constructor(context: Context) : super(context)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int) : super(
|
||||
context,
|
||||
attributeSet,
|
||||
defStyleAttr
|
||||
)
|
||||
|
||||
constructor(
|
||||
context: Context,
|
||||
attributeSet: AttributeSet,
|
||||
defStyleAttr: Int,
|
||||
defStyleRes: Int
|
||||
) : super(context, attributeSet, defStyleAttr, defStyleRes)
|
||||
|
||||
|
||||
companion object {
|
||||
const val TAG = M_OCHCOMMON + "TaskRunningView"
|
||||
}
|
||||
|
||||
private var viewModel: TaskRunningModel? = null
|
||||
|
||||
private var swtichViewModel: RoutingSwitchModel?=null
|
||||
|
||||
|
||||
private lateinit var mAdapter: TaskRunningAdapter
|
||||
|
||||
private lateinit var linearLayoutManager: WrapContentLinearLayoutManager
|
||||
|
||||
private var closeRouting: CommonDialogStatus?=null
|
||||
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.biz_other_running, this, true)
|
||||
initView()
|
||||
}
|
||||
|
||||
private fun initView() {
|
||||
linearLayoutManager = WrapContentLinearLayoutManager(context)
|
||||
rl_running_task_station_list.setLayoutManager(linearLayoutManager)
|
||||
mAdapter = TaskRunningAdapter(context, mutableListOf())
|
||||
rl_running_task_station_list.setAdapter(mAdapter)
|
||||
// 滑动出发
|
||||
aciv_task_leave_station_slide_bg.setSlideListener(object : CommonSlideView.SlideListener {
|
||||
override fun slideEnd() {
|
||||
if (TaskRunningModel.currentIndex == mAdapter.mData.size-2) {
|
||||
LineManager.getStations { start, end ->
|
||||
if (viewModel?.arrivedStation == true && start.isLeaving) {
|
||||
aciv_task_leave_station_slide_bg.setTextValue("单程结束")
|
||||
aciv_task_leave_station_slide_bg.reset()
|
||||
viewModel?.data?.taskId?.let {
|
||||
showFeedbackDialog(it)
|
||||
}
|
||||
}else{
|
||||
aciv_task_leave_station_slide_bg.setTextValue("滑动出发")
|
||||
viewModel?.leaveStation()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
aciv_task_leave_station_slide_bg.setTextValue("滑动出发")
|
||||
viewModel?.leaveStation()
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
// 到站
|
||||
actv_arriver_station.onClick {
|
||||
loading_arrive_station.visibility = VISIBLE
|
||||
viewModel?.arriveStation()
|
||||
}
|
||||
|
||||
// 结束任务
|
||||
actv_complete_task.onClick {
|
||||
viewModel?.data?.taskId?.let {
|
||||
showFeedbackDialog(it)
|
||||
}
|
||||
}
|
||||
|
||||
actv_submit_task.onClick {
|
||||
CallerLogger.d(TAG,"启动自驾参数:${LineManager.initAutopilotControlParameters()}")
|
||||
viewModel?.data?.taskId?.let {
|
||||
ReportErrorPointView.showDialog(context,it)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
viewModel = findViewTreeViewModelStoreOwner()?.let {
|
||||
ViewModelProvider(it).get(TaskRunningModel::class.java)
|
||||
}
|
||||
|
||||
swtichViewModel = findViewTreeViewModelStoreOwner()?.let {
|
||||
ViewModelProvider(it).get(RoutingSwitchModel::class.java)
|
||||
}
|
||||
|
||||
viewModel?.setDistanceCallback(this)
|
||||
}
|
||||
|
||||
private fun showFeedbackDialog(grayId: Long) {
|
||||
val occurrenceTime = System.currentTimeMillis()
|
||||
if(closeRouting==null) {
|
||||
closeRouting = CommonDialogStatus
|
||||
.Builder()
|
||||
.title("路线验证结束")
|
||||
.tips("请点击按钮反馈验证结果")
|
||||
.showClose(true)
|
||||
.cancelTextColor(R.color.biz_routing_FF4E41)
|
||||
.cancelStr("线路不可用")
|
||||
.confirmStr("线路可用")
|
||||
.status(CommonDialogStatus.Status.success)
|
||||
.build(context)
|
||||
}else{
|
||||
if(closeRouting?.isShowing==true){
|
||||
return
|
||||
}
|
||||
}
|
||||
closeRouting?.setClickListener(object : CommonDialogStatus.ClickListener {
|
||||
override fun confirm() {
|
||||
swtichViewModel?.showLoading()
|
||||
viewModel?.endGrayTask(grayId, EndGrayTaskFeedbackType.USABLE_YES, occurrenceTime)
|
||||
}
|
||||
|
||||
override fun cancel() {
|
||||
swtichViewModel?.showLoading()
|
||||
viewModel?.endGrayTask(
|
||||
grayId,
|
||||
EndGrayTaskFeedbackType.USABLE_NO,
|
||||
occurrenceTime
|
||||
)
|
||||
}
|
||||
})
|
||||
closeRouting?.show()
|
||||
}
|
||||
|
||||
fun showLeaveStationView() {
|
||||
aciv_task_leave_station_slide_bg.visibility = VISIBLE
|
||||
actv_arriver_station.visibility = GONE
|
||||
actv_complete_task.visibility = GONE
|
||||
}
|
||||
|
||||
override fun showArriverStationAndCompleteTask() {
|
||||
aciv_task_leave_station_slide_bg.visibility = INVISIBLE
|
||||
actv_arriver_station.visibility = VISIBLE
|
||||
actv_complete_task.visibility = VISIBLE
|
||||
}
|
||||
|
||||
fun setData(data: StartGrayAndQueryContrailRsp) {
|
||||
viewModel?.setNewData(data)
|
||||
bus_task_running_line_name.setText(data.grayLineBean.lineName)
|
||||
actv_running_task_last_station.text = "往${data.stationList.last().name ?: ""}"
|
||||
mAdapter.setDataList(data.stationList)
|
||||
aciv_task_leave_station_slide_bg.setTextValue("滑动出发")
|
||||
showLeaveStationView()
|
||||
}
|
||||
|
||||
/**
|
||||
* 到达目的地
|
||||
*/
|
||||
override fun onArrivedStation(leaving: Boolean) {
|
||||
//
|
||||
showLeaveStationView()
|
||||
loading_arrive_station.visibility = GONE
|
||||
notifyItemChange(0)
|
||||
if (TaskRunningModel.currentIndex == mAdapter.mData.size-2) {
|
||||
LineManager.getStations { start, end ->
|
||||
if(start.isLeaving){
|
||||
aciv_task_leave_station_slide_bg.setTextValue("单程结束")
|
||||
}else{
|
||||
aciv_task_leave_station_slide_bg.setTextValue("滑动出发")
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
aciv_task_leave_station_slide_bg.setTextValue("滑动出发")
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务完成
|
||||
*/
|
||||
override fun onSubmitEndTaskSuccess() {
|
||||
ToastUtils.showLong("结束任务成功")
|
||||
RoutingServiceManager.invokeCallback(false)
|
||||
// 移除高德导航计算距离
|
||||
AmapNaviToDestinationModel.getInstance(context).destroyAmaNavi()
|
||||
swtichViewModel?.showRoutingSelectView()
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务完成失败
|
||||
*/
|
||||
override fun onSubmitEndTaskFailed(errorStr: String) {
|
||||
ToastUtils.showShort(errorStr)
|
||||
viewModel?.data?.let {
|
||||
swtichViewModel?.showRoutingRunning(it)
|
||||
}
|
||||
}
|
||||
|
||||
override fun showCompleteTask() {
|
||||
aciv_task_leave_station_slide_bg.setTextValue("单程结束")
|
||||
}
|
||||
|
||||
override fun notifyItemChange(currentIndex: Int) {
|
||||
mAdapter.notifyChange()
|
||||
}
|
||||
|
||||
override fun clearData() {
|
||||
bus_task_running_line_name.setText("--")
|
||||
actv_running_task_last_station.text = "往--"
|
||||
mAdapter.setDataList(mutableListOf())
|
||||
aciv_task_leave_station_slide_bg.setTextValue("滑动出发")
|
||||
showLeaveStationView()
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.och.unmanned.taxi.ui.routing.routingrunning
|
||||
package com.mogo.och.biz.routing.ui.runing.taxi
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
@@ -9,6 +9,12 @@ import com.mogo.eagle.core.function.call.och.CallerEagleBaseFunctionCall4OchMana
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils
|
||||
import com.mogo.och.biz.routing.bean.ContrailBean
|
||||
import com.mogo.och.biz.routing.bean.EndGrayContrailTaskReq
|
||||
import com.mogo.och.biz.routing.bean.EndGrayTaskFeedbackType
|
||||
import com.mogo.och.biz.routing.bean.GrayLineBean
|
||||
import com.mogo.och.biz.routing.bean.StartGrayAndQueryContrailRsp
|
||||
import com.mogo.och.biz.routing.net.RoutingServiceManager
|
||||
import com.mogo.och.bridge.autopilot.autopilot.IOchAutopilotStatusListener
|
||||
import com.mogo.och.bridge.autopilot.autopilot.OchAutoPilotStatusListenerManager
|
||||
import com.mogo.och.bridge.autopilot.autopilot.bean.ArrivedStation
|
||||
@@ -17,24 +23,17 @@ import com.mogo.och.bridge.autopilot.line.LineManager
|
||||
import com.mogo.och.bridge.distance.IDistanceListener
|
||||
import com.mogo.och.bridge.distance.TrajectoryAndDistanceManager
|
||||
import com.mogo.och.common.module.constant.OchCommonConst
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||
import com.mogo.och.common.module.network.OchCommonServiceCallback
|
||||
import com.mogo.och.unmanned.taxi.bean.ContrailBean
|
||||
import com.mogo.och.unmanned.taxi.bean.EndGrayContrailTaskReq
|
||||
import com.mogo.och.unmanned.taxi.bean.EndGrayTaskFeedbackType
|
||||
import com.mogo.och.unmanned.taxi.bean.GrayLineBean
|
||||
import com.mogo.och.unmanned.taxi.bean.StartGrayAndQueryContrailRsp
|
||||
import com.mogo.och.unmanned.taxi.constant.TaxiUnmannedConst
|
||||
import com.mogo.och.unmanned.taxi.network.TaxiRoutingServiceManager
|
||||
import com.mogo.och.unmanned.taxi.ui.debug.DebugView
|
||||
|
||||
/**
|
||||
* @author XuXinChao
|
||||
* @description BadCase录包管理页面
|
||||
* @since: 2022/12/15
|
||||
*/
|
||||
class RoutingRunningModel : ViewModel(), IDistanceListener {
|
||||
class TaxiRunningModel : ViewModel(), IDistanceListener {
|
||||
|
||||
private val TAG = RoutingRunningModel::class.java.simpleName
|
||||
private val TAG = TaxiRunningModel::class.java.simpleName
|
||||
|
||||
private var viewCallback: RoutingRuningCallback? = null
|
||||
|
||||
@@ -58,16 +57,14 @@ class RoutingRunningModel : ViewModel(), IDistanceListener {
|
||||
TAG,
|
||||
"onAutopilotArriveAtStation = ${arrivalNotification.toString()}"
|
||||
)
|
||||
DebugView.printInfoMsg("[MAP到站通知] 上报到站,location=${arrivalNotification?.endLocation}")
|
||||
OchChainLogManager.writeChainLogRouting("MAP到站通知","[MAP到站通知] 上报到站,location=${arrivalNotification?.endLocation}")
|
||||
viewCallback?.onArrivedStation(currentGrayId)
|
||||
}
|
||||
}
|
||||
|
||||
private val lineCallback: ILineCallback = object : ILineCallback {
|
||||
override fun arrivedStationSuccessBySearch() {
|
||||
DebugView.printInfoMsg(
|
||||
"[自车定位围栏] 并查询底盘触发到站, endSiteId=${currentGrayLineBean?.endSite?.siteId}, endSiteName=${currentGrayLineBean?.endSite?.siteName}, lineId=${currentGrayLineBean?.lineId},围栏范围:${TaxiUnmannedConst.ARRIVE_AT_START_STATION_DISTANCE}米 没有过站、速度基本为零且在15m内"
|
||||
)
|
||||
OchChainLogManager.writeChainLogRouting("[自车定位围栏]","\"[自车定位围栏] 并查询底盘触发到站, endSiteId=${currentGrayLineBean?.endSite?.siteId}, endSiteName=${currentGrayLineBean?.endSite?.siteName}, lineId=${currentGrayLineBean?.lineId},围栏范围:${OchCommonConst.ARRIVE_AT_START_STATION_DISTANCE}米 没有过站、速度基本为零且在15m内\"")
|
||||
viewCallback?.onArrivedStation(currentGrayId)
|
||||
}
|
||||
}
|
||||
@@ -101,6 +98,9 @@ class RoutingRunningModel : ViewModel(), IDistanceListener {
|
||||
this.currentGrayLineBean = data.grayLineBean
|
||||
this.currentContrailBean = data.contrail
|
||||
this.currentGrayId = data.taskId
|
||||
if(data.stationList.size>=2) {
|
||||
LineManager.setStartAndEndStation(data.stationList[0], data.stationList[1])
|
||||
}
|
||||
MogoStatusManager.getInstance().setTaxiUnmanedDriverLineRoutingPerformTask(TAG, true)
|
||||
//添加到站监听
|
||||
OchAutoPilotStatusListenerManager.addListener(TAG, mMogoAutopilotStatusListener)
|
||||
@@ -111,9 +111,9 @@ class RoutingRunningModel : ViewModel(), IDistanceListener {
|
||||
* 结束灰度任务
|
||||
*/
|
||||
fun endGrayTask(grayId: Long, type: EndGrayTaskFeedbackType, occurrenceTime: Long) {
|
||||
DebugView.printInfoMsg("[结束灰度任务] 准备发送请求,grayId=$grayId, type=${type.type}, typeName=${type.name}")
|
||||
OchChainLogManager.writeChainLogRouting("[结束灰度任务]","[结束灰度任务] 准备发送请求,grayId=$grayId, type=${type.type}, typeName=${type.name}")
|
||||
val submit = EndGrayContrailTaskReq(grayId, type.type, occurrenceTime)
|
||||
TaxiRoutingServiceManager.endGrayTask(
|
||||
RoutingServiceManager.endGrayTask(
|
||||
content,
|
||||
submit,
|
||||
object : OchCommonServiceCallback<BaseData> {
|
||||
@@ -126,7 +126,7 @@ class RoutingRunningModel : ViewModel(), IDistanceListener {
|
||||
)
|
||||
}"
|
||||
)
|
||||
DebugView.printInfoMsg("[结束灰度任务] 请求success,grayId=$grayId, type=${type.type}, typeName=${type.name}")
|
||||
OchChainLogManager.writeChainLogRouting("[结束灰度任务]","[结束灰度任务] 请求success,grayId=$grayId, type=${type.type}, typeName=${type.name}")
|
||||
clearData()
|
||||
viewCallback?.onSubmitEndTaskSuccess()
|
||||
}
|
||||
@@ -136,7 +136,7 @@ class RoutingRunningModel : ViewModel(), IDistanceListener {
|
||||
TAG,
|
||||
"endGrayTask onFail: code=$code, msg=$msg"
|
||||
)
|
||||
DebugView.printErrorMsg("[结束灰度任务] 请求fail, code=$code, msg=$msg, grayId=$grayId, type=${type.type}, typeName=${type.name}")
|
||||
OchChainLogManager.writeChainLogRouting("[结束灰度任务]","[结束灰度任务] 请求fail, code=$code, msg=$msg, grayId=$grayId, type=${type.type}, typeName=${type.name}")
|
||||
viewCallback?.onSubmitEndTaskFailed(msg ?: "endGrayTask onFail")
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ class RoutingRunningModel : ViewModel(), IDistanceListener {
|
||||
TAG,
|
||||
"endGrayTask onError, msg=$hintStr"
|
||||
)
|
||||
DebugView.printErrorMsg("[结束灰度任务] 请求error, msg=$hintStr, grayId=$grayId, type=${type.type}, typeName=${type.name}")
|
||||
OchChainLogManager.writeChainLogRouting("[结束灰度任务]","[结束灰度任务] 请求error, msg=$hintStr, grayId=$grayId, type=${type.type}, typeName=${type.name}")
|
||||
viewCallback?.onSubmitEndTaskFailed(hintStr)
|
||||
}
|
||||
})
|
||||
@@ -184,7 +184,7 @@ class RoutingRunningModel : ViewModel(), IDistanceListener {
|
||||
private fun cancelAutopilot() {
|
||||
try {
|
||||
CallerAutoPilotControlManager.cancelAutoPilot()
|
||||
DebugView.printInfoMsg("[取消自驾] 调用成功")
|
||||
OchChainLogManager.writeChainLogRouting("[取消自驾]","[取消自驾] 调用成功")
|
||||
CallerLogger.d(TAG, "结束自动驾驶")
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.och.unmanned.taxi.ui.routing.routingrunning
|
||||
package com.mogo.och.biz.routing.ui.runing.taxi
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
@@ -10,34 +10,35 @@ import androidx.lifecycle.findViewTreeViewModelStoreOwner
|
||||
import com.amap.api.navi.model.NaviLatLng
|
||||
import com.mogo.eagle.core.utilcode.kotlin.onClick
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.util.ActivityUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.och.biz.R
|
||||
import com.mogo.och.biz.routing.RoutingServiceManager
|
||||
import com.mogo.och.biz.routing.bean.EndGrayTaskFeedbackType
|
||||
import com.mogo.och.biz.routing.bean.StartGrayAndQueryContrailRsp
|
||||
import com.mogo.och.bridge.autopilot.location.OchLocationManager
|
||||
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
||||
import com.mogo.och.common.module.map.AmapNaviToDestinationModel
|
||||
import com.mogo.och.common.module.map.ICommonNaviChangedCallback
|
||||
import com.mogo.och.unmanned.taxi.R
|
||||
import com.mogo.och.unmanned.taxi.bean.EndGrayTaskFeedbackType
|
||||
import com.mogo.och.unmanned.taxi.bean.StartGrayAndQueryContrailRsp
|
||||
import com.mogo.och.unmanned.taxi.constant.TaxiUnmannedConst
|
||||
import com.mogo.och.unmanned.taxi.ui.routing.RoutingSwitchModel
|
||||
import com.mogo.och.unmanned.taxi.ui.routing.TaxiRoutingModel
|
||||
import com.mogo.och.biz.routing.ui.RoutingSwitchModel
|
||||
import com.mogo.och.common.module.map.MapMakerManager
|
||||
import com.mogo.och.common.module.wigets.dialog.CommonDialogStatus
|
||||
import com.mogo.och.unmanned.taxi.ui.routing.errorpoint.ReportErrorPointView
|
||||
import com.mogo.och.unmanned.taxi.utils.TaskUtils
|
||||
import kotlinx.android.synthetic.main.unmanned_routing_running.view.actv_current_itinerary_end_name
|
||||
import kotlinx.android.synthetic.main.unmanned_routing_running.view.actv_current_itinerary_start_name
|
||||
import kotlinx.android.synthetic.main.unmanned_routing_running.view.actv_distance_end
|
||||
import kotlinx.android.synthetic.main.unmanned_routing_running.view.actv_end_routing
|
||||
import kotlinx.android.synthetic.main.unmanned_routing_running.view.actv_routing_name
|
||||
import kotlinx.android.synthetic.main.unmanned_routing_running.view.actv_submit_task
|
||||
import kotlinx.android.synthetic.main.unmanned_routing_running.view.goutp_show_routing_info
|
||||
import kotlinx.android.synthetic.main.unmanned_routing_running.view.include_empty
|
||||
import kotlinx.android.synthetic.main.unmanned_routing_running.view.naviToStart
|
||||
import com.mogo.och.biz.routing.ui.errorpoint.ReportErrorPointView
|
||||
import com.mogo.och.biz.routing.ui.utils.TimeDistanceUtils
|
||||
import com.mogo.och.common.module.constant.OchCommonConst
|
||||
import kotlinx.android.synthetic.main.biz_taxi_running.view.actv_end_routing
|
||||
import kotlinx.android.synthetic.main.biz_taxi_running.view.actv_current_itinerary_end_name
|
||||
import kotlinx.android.synthetic.main.biz_taxi_running.view.actv_current_itinerary_start_name
|
||||
import kotlinx.android.synthetic.main.biz_taxi_running.view.actv_distance_end
|
||||
import kotlinx.android.synthetic.main.biz_taxi_running.view.actv_routing_name
|
||||
import kotlinx.android.synthetic.main.biz_taxi_running.view.actv_submit_task
|
||||
import kotlinx.android.synthetic.main.biz_taxi_running.view.goutp_show_routing_info
|
||||
import kotlinx.android.synthetic.main.biz_taxi_running.view.include_empty
|
||||
import kotlinx.android.synthetic.main.biz_taxi_running.view.naviToStart
|
||||
|
||||
class RoutingRunningView: ConstraintLayout, RoutingRunningModel.RoutingRuningCallback,
|
||||
class TaxiRunningView: ConstraintLayout, TaxiRunningModel.RoutingRuningCallback,
|
||||
ICommonNaviChangedCallback {
|
||||
|
||||
|
||||
@@ -54,14 +55,14 @@ class RoutingRunningView: ConstraintLayout, RoutingRunningModel.RoutingRuningCal
|
||||
const val TAG = "RoutingRunningView"
|
||||
}
|
||||
|
||||
private var viewModel: RoutingRunningModel?=null
|
||||
private var viewModel: TaxiRunningModel?=null
|
||||
private var swtichViewModel: RoutingSwitchModel?=null
|
||||
|
||||
private var closeRouting: CommonDialogStatus?=null
|
||||
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.unmanned_routing_running, this, true)
|
||||
LayoutInflater.from(context).inflate(R.layout.biz_taxi_running, this, true)
|
||||
initView()
|
||||
initListener()
|
||||
}
|
||||
@@ -85,17 +86,18 @@ class RoutingRunningView: ConstraintLayout, RoutingRunningModel.RoutingRuningCal
|
||||
|
||||
private fun showFeedbackDialog(grayId: Long) {
|
||||
val occurrenceTime = System.currentTimeMillis()
|
||||
val topActivity = ActivityUtils.getTopActivity()
|
||||
if(closeRouting==null) {
|
||||
closeRouting = CommonDialogStatus
|
||||
.Builder()
|
||||
.title("路线验证结束")
|
||||
.tips("请点击按钮反馈验证结果")
|
||||
.showClose(true)
|
||||
.cancelTextColor(R.color.taxi_color_FF4E41)
|
||||
.cancelTextColor(R.color.biz_routing_FF4E41)
|
||||
.cancelStr("线路不可用")
|
||||
.confirmStr("线路可用")
|
||||
.status(CommonDialogStatus.Status.success)
|
||||
.build(context)
|
||||
.build(topActivity)
|
||||
}else{
|
||||
if(closeRouting?.isShowing==true){
|
||||
return
|
||||
@@ -120,7 +122,9 @@ class RoutingRunningView: ConstraintLayout, RoutingRunningModel.RoutingRuningCal
|
||||
)
|
||||
}
|
||||
})
|
||||
closeRouting?.show()
|
||||
if(!topActivity.isFinishing() && !topActivity.isDestroyed()) {
|
||||
closeRouting?.show()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -132,7 +136,7 @@ class RoutingRunningView: ConstraintLayout, RoutingRunningModel.RoutingRuningCal
|
||||
}
|
||||
|
||||
private fun removeAllMapMarker() {
|
||||
MapMakerManager.removeAllMapMarkerByOwner(TaxiUnmannedConst.TYPE_MARKER_ROUTING_VERIFY)
|
||||
MapMakerManager.removeAllMapMarkerByOwner(OchCommonConst.TYPE_MARKER_ROUTING_VERIFY)
|
||||
}
|
||||
|
||||
private fun initStartNaviToStationParam(
|
||||
@@ -162,16 +166,8 @@ class RoutingRunningView: ConstraintLayout, RoutingRunningModel.RoutingRuningCal
|
||||
*/
|
||||
private fun updateCurrentTaskTripInfo(meters: Long, timeInSecond: Long) {
|
||||
UiThreadHandler.post {
|
||||
CallerLogger.d(
|
||||
TAG,
|
||||
"updateCurrentTaskTripInfo, taskUtil, ${
|
||||
TaskUtils.getCurrentTaskTripHtml(
|
||||
meters,
|
||||
timeInSecond
|
||||
)
|
||||
}"
|
||||
)
|
||||
actv_distance_end.text = "${TaskUtils.getCurrentTaskDistance(meters)} ${TaskUtils.getCurrentTaskTime(timeInSecond)}"
|
||||
CallerLogger.d(TAG, "updateCurrentTaskTripInfo, taskUtil, ${TimeDistanceUtils.getCurrentTaskTripHtml(meters, timeInSecond)}")
|
||||
actv_distance_end.text = "${TimeDistanceUtils.getCurrentTaskDistance(meters)} ${TimeDistanceUtils.getCurrentTaskTime(timeInSecond)}"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,7 +184,7 @@ class RoutingRunningView: ConstraintLayout, RoutingRunningModel.RoutingRuningCal
|
||||
resourceId: Int
|
||||
) {
|
||||
if (isAdd) {
|
||||
MapMakerManager.addMapMaker(TaxiUnmannedConst.TYPE_MARKER_ROUTING_VERIFY, uuid, lat, lon, resourceId)
|
||||
MapMakerManager.addMapMaker(OchCommonConst.TYPE_MARKER_ROUTING_VERIFY, uuid, lat, lon, resourceId)
|
||||
} else {
|
||||
MapMakerManager.removeMapMaker(uuid, lat, lon)
|
||||
}
|
||||
@@ -198,7 +194,7 @@ class RoutingRunningView: ConstraintLayout, RoutingRunningModel.RoutingRuningCal
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
viewModel = findViewTreeViewModelStoreOwner()?.let {
|
||||
ViewModelProvider(it).get(RoutingRunningModel::class.java)
|
||||
ViewModelProvider(it).get(TaxiRunningModel::class.java)
|
||||
}
|
||||
swtichViewModel = findViewTreeViewModelStoreOwner()?.let {
|
||||
ViewModelProvider(it).get(RoutingSwitchModel::class.java)
|
||||
@@ -223,7 +219,7 @@ class RoutingRunningView: ConstraintLayout, RoutingRunningModel.RoutingRuningCal
|
||||
override fun reInitNaviAmap(isPlay: Boolean, isRestart: Boolean) {
|
||||
CallerLogger.d(TAG, "isPlay = $isPlay, isRestart=$isRestart")
|
||||
if (!isRestart) {
|
||||
TaxiRoutingModel.startNaviToEndStationByAMap(false)
|
||||
RoutingServiceManager.invokeCallback(false)
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -244,11 +240,11 @@ class RoutingRunningView: ConstraintLayout, RoutingRunningModel.RoutingRuningCal
|
||||
it.gcjLon
|
||||
)
|
||||
naviToStart.setOnClickListener {
|
||||
TaxiRoutingModel.startNaviToEndStationByAMap(true)
|
||||
RoutingServiceManager.invokeCallback(true)
|
||||
}
|
||||
setOrRemoveMapMaker(
|
||||
true,
|
||||
TaxiUnmannedConst.TAXI_ROUTING_VERIFY_START_SITE,
|
||||
OchCommonConst.TAXI_ROUTING_VERIFY_START_SITE,
|
||||
it.wgs84Lat,
|
||||
it.wgs84Lon,
|
||||
R.raw.star_marker
|
||||
@@ -258,7 +254,7 @@ class RoutingRunningView: ConstraintLayout, RoutingRunningModel.RoutingRuningCal
|
||||
data.grayLineBean.endSite?.also {
|
||||
setOrRemoveMapMaker(
|
||||
true,
|
||||
TaxiUnmannedConst.TAXI_ROUTING_VERIFY_END_SITE,
|
||||
OchCommonConst.TAXI_ROUTING_VERIFY_END_SITE,
|
||||
it.wgs84Lat,
|
||||
it.wgs84Lon,
|
||||
R.raw.end_marker
|
||||
@@ -271,7 +267,7 @@ class RoutingRunningView: ConstraintLayout, RoutingRunningModel.RoutingRuningCal
|
||||
|
||||
override fun onSubmitEndTaskSuccess() {
|
||||
ToastUtils.showLong("结束任务成功")
|
||||
TaxiRoutingModel.startNaviToEndStationByAMap(false)
|
||||
RoutingServiceManager.invokeCallback(false)
|
||||
// 移除高德导航计算距离
|
||||
AmapNaviToDestinationModel.getInstance(context).destroyAmaNavi()
|
||||
swtichViewModel?.showRoutingSelectView()
|
||||
@@ -0,0 +1,112 @@
|
||||
package com.mogo.och.biz.routing.ui.utils
|
||||
|
||||
import android.text.Spanned
|
||||
import androidx.core.text.HtmlCompat
|
||||
import com.mogo.eagle.core.utilcode.util.DateTimeUtils
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||
import com.mogo.och.common.module.utils.NumberFormatUtil
|
||||
import java.util.Calendar
|
||||
import kotlin.math.ceil
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
object TimeDistanceUtils {
|
||||
|
||||
fun getCurrentTaskDistance(meters: Long):String{
|
||||
var dis = "0"
|
||||
var disUnit = "公里"
|
||||
if (meters > 0) {
|
||||
if (meters / 1000 < 1) {
|
||||
disUnit = "米"
|
||||
dis = meters.toFloat().roundToInt().toString()
|
||||
} else {
|
||||
disUnit = "公里"
|
||||
dis = NumberFormatUtil.formatLong(meters.toDouble() / 1000)
|
||||
}
|
||||
}
|
||||
return "${dis}${disUnit}"
|
||||
}
|
||||
|
||||
fun getCurrentTaskTime(timeInSecond: Long):String{
|
||||
val min = ceil(timeInSecond.toDouble() / 60f).toInt()
|
||||
return "${min}分钟"
|
||||
}
|
||||
|
||||
/**
|
||||
* 剩余里程和剩余时间 html
|
||||
*/
|
||||
fun getCurrentTaskTripHtml(meters: Long, timeInSecond: Long): Spanned {
|
||||
var dis = "0"
|
||||
var disUnit = "公里"
|
||||
if (meters > 0) {
|
||||
if (meters / 1000 < 1) {
|
||||
disUnit = "米"
|
||||
dis = meters.toFloat().roundToInt().toString()
|
||||
} else {
|
||||
disUnit = "公里"
|
||||
dis = NumberFormatUtil.formatLong(meters.toDouble() / 1000)
|
||||
}
|
||||
}
|
||||
val min = ceil(timeInSecond.toDouble() / 60f).toInt()
|
||||
val strHtml =
|
||||
("<font color=\"#CAD6FF\">里程 </font>"
|
||||
+ "<b><font color=\"#FFFFFF\">"
|
||||
+ dis + "</font></b>"
|
||||
+ "<font color=\"#CAD6FF\"> "
|
||||
+ disUnit + "</font>"
|
||||
+ "<font color=\"#CAD6FF\">,剩余 </font>"
|
||||
+ "<b><font color=\"#FFFFFF\">"
|
||||
+ min + "</font></b>"
|
||||
+ "<font color=\"#CAD6FF\"> 分钟</font>")
|
||||
return HtmlCompat.fromHtml(strHtml, HtmlCompat.FROM_HTML_MODE_LEGACY)
|
||||
}
|
||||
|
||||
fun getCurrentTaskWaitTimeHtml(): Spanned {
|
||||
val currentCale = DateTimeUtils.getCurrentDateTime()
|
||||
val currentDay =
|
||||
DateTimeUtil.formatCalendarToString(currentCale, DateTimeUtil.yyyy_MM_dd)
|
||||
currentCale.add(Calendar.MINUTE, 10)
|
||||
val strHtml13: String = if (currentDay == DateTimeUtil.formatCalendarToString(
|
||||
currentCale,
|
||||
DateTimeUtil.yyyy_MM_dd
|
||||
)
|
||||
) {
|
||||
("<font color=\"#CAD6FF\">免费等待至 </font>"
|
||||
+ "<b><font color=\"#FFFFFF\"><big>" + DateTimeUtil.formatCalendarToString(
|
||||
currentCale,
|
||||
DateTimeUtil.HH_mm
|
||||
) + "</big></b></font>")
|
||||
} else {
|
||||
("<font color=\"#CAD6FF\">免费等待至</font>"
|
||||
+ "<font color=\"#FFFFFF\"><big>" + DateTimeUtil.formatCalendarToString(
|
||||
currentCale,
|
||||
DateTimeUtil.MM_dd_HH_mm
|
||||
) + "</big></font>")
|
||||
}
|
||||
return HtmlCompat.fromHtml(strHtml13, HtmlCompat.FROM_HTML_MODE_LEGACY)
|
||||
}
|
||||
|
||||
fun getCurrentTaskTotalAndDurationHtml(mileage: Float, duration: Int): Spanned {
|
||||
val strHtml =
|
||||
("<font color=\"#CAD6FF\">全程 </font>" + "<font color=\"#FFFFFF\"> $mileage </font>" + "<font color=\"#CAD6FF\"> 公里 </font>"
|
||||
+ "<font color=\"#CAD6FF\">,总用时 </font>" + "<font color=\"#FFFFFF\"> $duration </font>" + "<font color=\"#CAD6FF\"> 分钟</font>")
|
||||
return HtmlCompat.fromHtml(strHtml, HtmlCompat.FROM_HTML_MODE_LEGACY)
|
||||
}
|
||||
|
||||
fun getCurrentTaskPhoneNumAndPassengerCountHtml(phoneNum: String, passengerSize: Int): Spanned {
|
||||
return HtmlCompat.fromHtml(
|
||||
"<font color=\"#FFFFFF\"> " + phoneNum + "</font>" +
|
||||
"<font color=\"#6473B2\"> | </font>" +
|
||||
"<font color=\"#FFFFFF\">" + passengerSize + "人" + "</font>",
|
||||
HtmlCompat.FROM_HTML_MODE_LEGACY
|
||||
)
|
||||
}
|
||||
|
||||
fun getNextTaskPhoneNumAndPassengerCountHtml(phoneNum: String, passengerSize: Int): Spanned {
|
||||
return HtmlCompat.fromHtml(
|
||||
"<font color=\"#FFFFFF\"> " + phoneNum + "</font>" +
|
||||
"<font color=\"#6473B2\"> | </font>" +
|
||||
"<font color=\"#FFFFFF\">" + passengerSize + "人" + "</font>",
|
||||
HtmlCompat.FROM_HTML_MODE_LEGACY
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="@color/biz_routing_FF4E41" android:state_pressed="true"/>
|
||||
<item android:color="@color/biz_routing_FF4E41" android:state_pressed="false"/>
|
||||
<item android:color="@color/biz_routing_FF4E41"/>
|
||||
</selector>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="@color/biz_routing_2eacff" android:state_pressed="true"/>
|
||||
<item android:color="@color/biz_routing_2eacff" android:state_pressed="false"/>
|
||||
<item android:color="@color/biz_routing_2eacff"/>
|
||||
</selector>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 610 B |
|
After Width: | Height: | Size: 261 B |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 610 B |
|
After Width: | Height: | Size: 261 B |
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@color/biz_routing_4D000000"/>
|
||||
<corners android:radius="@dimen/dp_30"/>
|
||||
</shape>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@color/biz_routing_80000000"/>
|
||||
<corners android:radius="@dimen/dp_30"/>
|
||||
</shape>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true" android:drawable="@drawable/biz_button_selected"/>
|
||||
<item android:state_pressed="false" android:drawable="@drawable/biz_button_normal"/>
|
||||
<item android:state_checked="true" android:drawable="@drawable/biz_button_selected"/>
|
||||
<item android:state_checked="false" android:drawable="@drawable/biz_button_normal"/>
|
||||
<item android:drawable="@drawable/biz_button_normal"/>
|
||||
</selector>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid
|
||||
android:color="@color/biz_routing_4D000000" />
|
||||
<corners android:radius="@dimen/dp_30"/>
|
||||
</shape>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<gradient
|
||||
android:endColor="#660043FF"
|
||||
android:startColor="#0028345E" />
|
||||
</shape>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<gradient
|
||||
android:endColor="#CC0043FF"
|
||||
android:startColor="#0028345E" />
|
||||
</shape>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true" android:drawable="@drawable/bus_switch_task_selected"/>
|
||||
<item android:state_pressed="false" android:drawable="@drawable/bus_switch_task_normal"/>
|
||||
<item android:state_checked="true" android:drawable="@drawable/bus_switch_task_selected"/>
|
||||
<item android:state_checked="false" android:drawable="@drawable/bus_switch_task_normal"/>
|
||||
<item android:drawable="@drawable/bus_switch_task_normal"/>
|
||||
</selector>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true" android:drawable="@drawable/bus_switch_task_selected"/>
|
||||
<item android:state_pressed="false" android:drawable="@drawable/bus_switch_task_normal"/>
|
||||
<item android:state_checked="true" android:drawable="@drawable/bus_switch_task_selected"/>
|
||||
<item android:state_checked="false" android:drawable="@drawable/bus_switch_task_normal"/>
|
||||
<item android:drawable="@drawable/bus_switch_task_normal"/>
|
||||
</selector>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@color/common_color_4D000000"/>
|
||||
<corners android:radius="@dimen/dp_30"/>
|
||||
</shape>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<gradient
|
||||
android:endColor="#CC0043FF"
|
||||
android:startColor="#0028345E" />
|
||||
<corners android:radius="@dimen/dp_30" />
|
||||
</shape>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true" android:drawable="@drawable/bus_switch_line_selected"/>
|
||||
<item android:state_pressed="false" android:drawable="@drawable/bus_switch_line_normal"/>
|
||||
<item android:drawable="@drawable/bus_switch_line_normal"/>
|
||||
</selector>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@color/common_color_4D000000"/>
|
||||
<corners android:radius="@dimen/dp_30"/>
|
||||
</shape>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@color/common_80000000"/>
|
||||
<corners android:radius="@dimen/dp_30"/>
|
||||
</shape>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="@dimen/dp_30"/>
|
||||
<solid android:color="@color/common_color_4D000000"/>
|
||||
</shape>
|
||||
121
OCH/common/biz/src/main/res/routing/layout/biz_other_running.xml
Normal file
@@ -0,0 +1,121 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="@dimen/dp_880"
|
||||
android:layout_height="match_parent"
|
||||
tools:layout_height="@dimen/dp_966"
|
||||
tools:background="@drawable/bus_switch_line_normal"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/bus_task_running_line_name"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/dp_45"
|
||||
android:layout_marginStart="@dimen/dp_54"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="end"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/actv_running_task_time"
|
||||
android:layout_marginEnd="@dimen/dp_140"
|
||||
android:layout_marginTop="@dimen/dp_37"
|
||||
android:textColor="@color/white"
|
||||
tools:text="线路名称"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/actv_running_task_last_station"
|
||||
android:textColor="@color/common_B3FFFFFF"
|
||||
android:textSize="@dimen/dp_36"
|
||||
app:layout_constraintStart_toStartOf="@+id/bus_task_running_line_name"
|
||||
app:layout_constraintTop_toBottomOf="@+id/bus_task_running_line_name"
|
||||
android:layout_marginTop="@dimen/dp_11"
|
||||
tools:text="往新街口方向"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/actv_running_task_time"
|
||||
android:gravity="center"
|
||||
android:layout_marginEnd="@dimen/dp_54"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_100">
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/actv_submit_task"
|
||||
android:layout_width="@dimen/dp_200"
|
||||
android:layout_height="@dimen/dp_80"
|
||||
app:pressed_enabled="false"
|
||||
android:gravity="center"
|
||||
android:text="问题打点"
|
||||
android:background="@drawable/biz_button_selector"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/dp_40" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rl_running_task_station_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_0"
|
||||
android:layout_marginStart="@dimen/dp_54"
|
||||
android:layout_marginEnd="@dimen/dp_52"
|
||||
app:layout_constraintTop_toBottomOf="@+id/actv_running_task_last_station"
|
||||
app:layout_constraintBottom_toTopOf="@+id/aciv_task_leave_station_slide_bg"
|
||||
android:layout_marginTop="@dimen/dp_22"
|
||||
android:layout_marginBottom="@dimen/dp_46"/>
|
||||
|
||||
<com.mogo.och.common.module.wigets.CommonSlideView
|
||||
android:id="@+id/aciv_task_leave_station_slide_bg"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:assetsfolder="images"
|
||||
app:slide_title="@string/common_leave_station"
|
||||
android:layout_marginBottom="@dimen/dp_46"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/actv_arriver_station"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:gravity="center"
|
||||
android:textSize="@dimen/dp_40"
|
||||
android:textColor="@color/white"
|
||||
android:background="@drawable/bus_running_task_arrive_station_selector"
|
||||
android:layout_marginBottom="@dimen/dp_46"
|
||||
android:layout_marginStart="@dimen/dp_54"
|
||||
android:text="@string/common_arrive_station"
|
||||
android:layout_width="@dimen/dp_474"
|
||||
android:layout_height="@dimen/dp_120"/>
|
||||
|
||||
<com.mogo.och.common.module.wigets.loading.LoadingViewSmall
|
||||
android:id="@+id/loading_arrive_station"
|
||||
android:src="@drawable/common_biz_loading_samll"
|
||||
app:layout_constraintTop_toTopOf="@+id/actv_arriver_station"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/actv_arriver_station"
|
||||
app:layout_constraintEnd_toEndOf="@+id/actv_arriver_station"
|
||||
android:layout_marginEnd="@dimen/dp_30"
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/actv_complete_task"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:gravity="center"
|
||||
android:textSize="@dimen/dp_40"
|
||||
android:textColor="@color/white"
|
||||
android:background="@drawable/bus_running_task_complete_selector"
|
||||
android:layout_marginBottom="@dimen/dp_46"
|
||||
android:layout_marginEnd="@dimen/dp_54"
|
||||
android:text="@string/common_complete"
|
||||
android:layout_width="@dimen/dp_245"
|
||||
android:layout_height="@dimen/dp_120"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,79 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_100"
|
||||
tools:background="@drawable/bus_switch_line_selector">
|
||||
|
||||
|
||||
<View
|
||||
android:id="@+id/bg_pass_bg"
|
||||
app:layout_constraintStart_toStartOf="@+id/aciv_station_head"
|
||||
app:layout_constraintEnd_toEndOf="@+id/aciv_station_head"
|
||||
android:background="@color/common_4DFFFFFF"
|
||||
android:layout_width="@dimen/dp_7"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<View
|
||||
android:id="@+id/bg_pass_head_bg"
|
||||
android:layout_marginBottom="@dimen/dp_11"
|
||||
app:layout_constraintStart_toStartOf="@+id/aciv_station_head_big"
|
||||
app:layout_constraintEnd_toEndOf="@+id/aciv_station_head_big"
|
||||
tools:background="@color/light_prompt_red"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@+id/aciv_station_head_big"
|
||||
android:layout_width="@dimen/dp_7"
|
||||
android:layout_height="0dp"/>
|
||||
|
||||
<View
|
||||
android:id="@+id/bg_pass_bottom_bg"
|
||||
app:layout_constraintStart_toStartOf="@+id/aciv_station_head_big"
|
||||
app:layout_constraintEnd_toEndOf="@+id/aciv_station_head_big"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/aciv_station_head_big"
|
||||
android:layout_marginTop="@dimen/dp_11"
|
||||
tools:background="@color/light_prompt_red"
|
||||
android:layout_width="@dimen/dp_7"
|
||||
android:layout_height="0dp"/>
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/aciv_station_head"
|
||||
android:src="@drawable/bus_switch_line_adapter_point"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginStart="@dimen/dp_33"
|
||||
android:layout_width="@dimen/dp_30"
|
||||
android:layout_height="@dimen/dp_30"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/aciv_station_head_big"
|
||||
android:src="@drawable/bus_runnint_task_start"
|
||||
app:layout_constraintTop_toTopOf="@+id/aciv_station_head"
|
||||
app:layout_constraintStart_toStartOf="@+id/aciv_station_head"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/aciv_station_head"
|
||||
app:layout_constraintEnd_toEndOf="@+id/aciv_station_head"
|
||||
android:layout_width="@dimen/dp_45"
|
||||
android:layout_height="@dimen/dp_45"/>
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/actv_station_name"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/aciv_station_head"
|
||||
android:layout_marginStart="@dimen/dp_36"
|
||||
android:layout_marginEnd="@dimen/dp_36"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:text="天安门天安门天安门…"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/white"
|
||||
android:ellipsize="end"
|
||||
android:textSize="@dimen/dp_45"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -4,7 +4,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_12"
|
||||
android:background="@drawable/routing_choose_line_shape_select_line_item_bg_normal"
|
||||
android:background="@drawable/biz_shape_select_line_item_bg_normal"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="@dimen/dp_78"
|
||||
android:paddingEnd="@dimen/dp_78">
|
||||
@@ -51,7 +51,7 @@
|
||||
android:layout_toRightOf="@+id/todayVerifyNumTextView"
|
||||
android:gravity="right|center_vertical"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/taxi_color_ccb9c3e9"
|
||||
android:textColor="@color/biz_routing_ccb9c3e9"
|
||||
android:textSize="@dimen/dp_30"
|
||||
tools:text="路线累计反馈0可用,1不可用" />
|
||||
</RelativeLayout>
|
||||
@@ -13,7 +13,7 @@
|
||||
android:id="@+id/no_routing_data_iv"
|
||||
android:layout_width="@dimen/dp_386"
|
||||
android:layout_height="@dimen/dp_350"
|
||||
android:src="@drawable/no_order_data"
|
||||
android:src="@drawable/biz_taxi_no_order_data"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
@@ -10,7 +10,7 @@
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:src="@drawable/taxi_routing_uncheck"
|
||||
android:src="@drawable/biz_taxi_uncheck"
|
||||
android:layout_width="@dimen/dp_53"
|
||||
android:layout_height="@dimen/dp_53"/>
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
@@ -54,7 +54,7 @@
|
||||
android:background="@drawable/common_button_cancle"
|
||||
android:gravity="center"
|
||||
android:text="打点"
|
||||
android:textColor="@color/taxi_color_2eacff"
|
||||
android:textColor="@color/biz_routing_2eacff"
|
||||
android:textSize="@dimen/sp_40"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginBottom="@dimen/dp_65"
|
||||
@@ -5,7 +5,7 @@
|
||||
android:layout_width="@dimen/dp_880"
|
||||
android:layout_height="match_parent"
|
||||
tools:layout_height="@dimen/dp_966"
|
||||
tools:background="@drawable/shape_itinerary_bg_default"
|
||||
tools:background="@drawable/biz_shape_itinerary_bg_default"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
@@ -41,7 +41,7 @@
|
||||
android:layout_marginStart="@dimen/dp_54"
|
||||
android:layout_marginEnd="@dimen/dp_52"
|
||||
android:layout_width="match_parent"
|
||||
android:background="@drawable/shape_itinerary_bg_default"
|
||||
android:background="@drawable/biz_shape_itinerary_bg_default"
|
||||
android:layout_height="@dimen/dp_272"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
@@ -52,7 +52,7 @@
|
||||
android:layout_marginTop="@dimen/dp_34"
|
||||
android:layout_width="@dimen/dp_45"
|
||||
android:layout_height="@dimen/dp_45"
|
||||
android:src="@drawable/taxi_task_current_start_station_point" />
|
||||
android:src="@drawable/biz_taxi_current_start_station_point" />
|
||||
|
||||
<View
|
||||
android:id="@+id/v_line_current_start_end"
|
||||
@@ -60,7 +60,7 @@
|
||||
app:layout_constraintStart_toStartOf="@+id/aciv_current_itinerary_start_point"
|
||||
app:layout_constraintEnd_toEndOf="@+id/aciv_current_itinerary_start_point"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:background="@color/taxi_color_4D000000"
|
||||
android:background="@color/biz_routing_4D000000"
|
||||
android:layout_width="@dimen/dp_6"
|
||||
android:layout_height="@dimen/dp_92"/>
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:layout_width="@dimen/dp_45"
|
||||
android:layout_height="@dimen/dp_45"
|
||||
android:src="@drawable/taxi_task_current_end_station_point" />
|
||||
android:src="@drawable/biz_taxi_current_end_station_point" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/actv_current_itinerary_start_name"
|
||||
@@ -91,7 +91,7 @@
|
||||
app:layout_constraintTop_toTopOf="@+id/actv_current_itinerary_start_name"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/actv_current_itinerary_start_name"
|
||||
app:layout_constraintEnd_toEndOf="@+id/v_bg_itinerary_info"
|
||||
android:src="@drawable/taxi_task_nav"
|
||||
android:src="@drawable/biz_taxi_nav"
|
||||
android:layout_marginEnd="@dimen/dp_36"
|
||||
android:layout_width="@dimen/dp_46"
|
||||
android:layout_height="@dimen/dp_46"/>
|
||||
@@ -101,7 +101,7 @@
|
||||
android:id="@+id/actv_distance_end"
|
||||
android:text="5.2公里"
|
||||
android:textSize="@dimen/dp_32"
|
||||
android:textColor="@color/taxi_color_CCCCCC"
|
||||
android:textColor="@color/biz_routing_CCCCCC"
|
||||
app:layout_constraintTop_toBottomOf="@+id/actv_current_itinerary_start_name"
|
||||
app:layout_constraintStart_toStartOf="@+id/actv_current_itinerary_start_name"
|
||||
app:layout_constraintBottom_toTopOf="@+id/actv_current_itinerary_end_name"
|
||||
@@ -131,8 +131,8 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:layout_marginStart="@dimen/dp_54"
|
||||
android:layout_marginBottom="@dimen/dp_55"
|
||||
android:background="@drawable/taxi_button_selector"
|
||||
android:textColor="@color/taxi_submit_text_color_selector"
|
||||
android:background="@drawable/biz_button_selector"
|
||||
android:textColor="@color/biz_taxi_submit_text_color_selector"
|
||||
android:textSize="@dimen/dp_40" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
@@ -146,8 +146,8 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginEnd="@dimen/dp_54"
|
||||
android:layout_marginBottom="@dimen/dp_55"
|
||||
android:background="@drawable/taxi_button_selector"
|
||||
android:textColor="@color/taxi_button_red_text_color"
|
||||
android:background="@drawable/biz_button_selector"
|
||||
android:textColor="@color/biz_taxi_button_red_text_color"
|
||||
android:textSize="@dimen/dp_40" />
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
@@ -5,7 +5,7 @@
|
||||
android:layout_width="@dimen/dp_880"
|
||||
android:layout_height="match_parent"
|
||||
tools:layout_height="@dimen/dp_966"
|
||||
tools:background="@drawable/shape_itinerary_bg_default"
|
||||
tools:background="@drawable/biz_shape_itinerary_bg_default"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
@@ -20,6 +20,28 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/actv_running_task_time"
|
||||
android:gravity="center"
|
||||
android:layout_marginEnd="@dimen/dp_54"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_100">
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/actv_refresh"
|
||||
android:layout_width="@dimen/dp_200"
|
||||
android:layout_height="@dimen/dp_80"
|
||||
app:pressed_enabled="false"
|
||||
android:gravity="center"
|
||||
android:text="刷新列表"
|
||||
android:background="@drawable/biz_button_selector"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/dp_40" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/switch_routing_rv"
|
||||
android:layout_width="match_parent"
|
||||
@@ -4,7 +4,7 @@
|
||||
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout"
|
||||
android:layout_width="@dimen/dp_774"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/shape_itinerary_bg_default"
|
||||
android:background="@drawable/biz_shape_itinerary_bg_default"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
@@ -28,7 +28,7 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginEnd="@dimen/dp_40"
|
||||
android:layout_marginTop="@dimen/dp_31"
|
||||
android:textColor="@color/taxi_color_CCFFFFFF"
|
||||
android:textColor="@color/biz_routing_CCFFFFFF"
|
||||
android:textSize="@dimen/dp_32"
|
||||
tools:text="今日验证:2次"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -63,7 +63,7 @@
|
||||
app:layout_constraintTop_toTopOf="@+id/actv_history_verify_num_title"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/actv_history_verify_num_title"
|
||||
app:layout_constraintStart_toEndOf="@+id/actv_history_verify_num_title"
|
||||
android:textColor="@color/taxi_color_26C14F"
|
||||
android:textColor="@color/biz_routing_26C14F"
|
||||
android:layout_marginStart="@dimen/dp_17"
|
||||
android:textSize="@dimen/dp_30"
|
||||
tools:text="5可用"
|
||||
@@ -75,7 +75,7 @@
|
||||
app:layout_constraintTop_toTopOf="@+id/actv_history_verify_num_title"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/actv_history_verify_num_title"
|
||||
app:layout_constraintStart_toEndOf="@+id/actv_history_verify_num_enable_num"
|
||||
android:textColor="@color/taxi_color_FF852E"
|
||||
android:textColor="@color/biz_routing_FF852E"
|
||||
android:layout_marginStart="@dimen/dp_28"
|
||||
android:textSize="@dimen/dp_30"
|
||||
tools:text="2不可用"
|
||||
@@ -87,7 +87,7 @@
|
||||
android:id="@+id/actv_routing_start"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:textColor="@color/taxi_color_2eacff"
|
||||
android:textColor="@color/biz_routing_2eacff"
|
||||
android:layout_marginEnd="@dimen/dp_40"
|
||||
android:layout_marginBottom="@dimen/dp_32"
|
||||
android:textSize="@dimen/dp_30"
|
||||
@@ -7,7 +7,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
|
||||
|
||||
<com.mogo.och.unmanned.taxi.ui.routing.routingselect.RoutingSelectView
|
||||
<com.mogo.och.biz.routing.ui.routingselect.RoutingSelectView
|
||||
android:id="@+id/routingSelectView"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
@@ -15,8 +15,16 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<com.mogo.och.unmanned.taxi.ui.routing.routingrunning.RoutingRunningView
|
||||
android:id="@+id/routingRunningView"
|
||||
<com.mogo.och.biz.routing.ui.runing.taxi.TaxiRunningView
|
||||
android:id="@+id/routingTaxiRunningView"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<com.mogo.och.biz.routing.ui.runing.other.TaskRunningView
|
||||
android:id="@+id/routingOtherRunningView"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
BIN
OCH/common/biz/src/main/res/routing/raw/end_marker.nt3d
Normal file
BIN
OCH/common/biz/src/main/res/routing/raw/star_marker.nt3d
Normal file
13
OCH/common/biz/src/main/res/routing/values/colors.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<color name="biz_routing_FF4E41">#FF4E41</color>
|
||||
<color name="biz_routing_2eacff">#2EACFF</color>
|
||||
<color name="biz_routing_ccb9c3e9">#CCB9C3E9</color>
|
||||
<color name="biz_routing_4D000000">#4D000000</color>
|
||||
<color name="biz_routing_80000000">#80000000</color>
|
||||
<color name="biz_routing_CCCCCC">#CCCCCC</color>
|
||||
<color name="biz_routing_CCFFFFFF">#CCFFFFFF</color>
|
||||
<color name="biz_routing_26C14F">#26C14F</color>
|
||||
<color name="biz_routing_FF852E">#FF852E</color>
|
||||
</resources>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="biz_bus_dialog_tips">您确认要结束任务吗?</string>
|
||||
</resources>
|
||||
@@ -16,6 +16,7 @@ import com.mogo.eagle.core.function.call.datacenter.CallerDataCenterBizListener
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapGlobalTrajectoryDrawManager
|
||||
import com.mogo.eagle.core.function.call.och.CallerEagleBaseFunctionCall4OchManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.e
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OCHCOMMON
|
||||
@@ -42,7 +43,7 @@ import kotlin.properties.Delegates
|
||||
* 订单中
|
||||
*/
|
||||
object LineManager : CallerBase<ILineCallback>() {
|
||||
const val TAG = M_OCHCOMMON+"LineManager"
|
||||
const val TAG = M_OCHCOMMON + "LineManager"
|
||||
|
||||
const val firstStationFirstStartAutopilotFlag = 0
|
||||
const val middleStationFirstStartAutopilotFlag = 1
|
||||
@@ -54,7 +55,7 @@ object LineManager : CallerBase<ILineCallback>() {
|
||||
@JvmStatic
|
||||
private var _lineInfos: LineInfo? = null
|
||||
|
||||
val lineInfos:LineInfo?
|
||||
val lineInfos: LineInfo?
|
||||
@JvmStatic
|
||||
get() = _lineInfos
|
||||
|
||||
@@ -63,7 +64,7 @@ object LineManager : CallerBase<ILineCallback>() {
|
||||
*/
|
||||
@JvmStatic
|
||||
private var _contraiInfo: ContraiInfo? = null
|
||||
val contraiInfo:ContraiInfo?
|
||||
val contraiInfo: ContraiInfo?
|
||||
@JvmStatic
|
||||
get() = _contraiInfo
|
||||
|
||||
@@ -96,9 +97,9 @@ object LineManager : CallerBase<ILineCallback>() {
|
||||
* 2 中间站点触发
|
||||
* 3 新的站点第一次启动自驾成功后
|
||||
*/
|
||||
var autopilotFlag : Int by Delegates.observable(firstStationFirstStartAutopilotFlag) { _, oldValue, newValue ->
|
||||
if(oldValue!=newValue){
|
||||
d(TAG,"autopilotFlag old=$oldValue new=$newValue")
|
||||
var autopilotFlag: Int by Delegates.observable(firstStationFirstStartAutopilotFlag) { _, oldValue, newValue ->
|
||||
if (oldValue != newValue) {
|
||||
d(TAG, "autopilotFlag old=$oldValue new=$newValue")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,23 +114,24 @@ object LineManager : CallerBase<ILineCallback>() {
|
||||
CallerEagleBaseFunctionCall4OchManager.setOchAutopilotOrderId(newValue)
|
||||
isFirstStartAutopilot = true
|
||||
M_LISTENERS.forEach {
|
||||
it.value.onAutopilotIdChange(oldValue,newValue)
|
||||
it.value.onAutopilotIdChange(oldValue, newValue)
|
||||
}
|
||||
if(!AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)&&
|
||||
!AppIdentityModeUtils.isShuttle(FunctionBuildConfig.appIdentityMode)&&
|
||||
if (!AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode) &&
|
||||
!AppIdentityModeUtils.isShuttle(FunctionBuildConfig.appIdentityMode) &&
|
||||
!AppIdentityModeUtils.isScheduled(FunctionBuildConfig.appIdentityMode)
|
||||
){
|
||||
) {
|
||||
val (start, end) = getStations()
|
||||
if(start!=null&&end!=null){
|
||||
val ochInfo = OchInfo(0, mutableListOf(start.toMogoLocation(), end.toMogoLocation()))
|
||||
if (start != null && end != null) {
|
||||
val ochInfo =
|
||||
OchInfo(0, mutableListOf(start.toMogoLocation(), end.toMogoLocation()))
|
||||
CallerDataCenterBizListener.invokeOchInfo(ochInfo)
|
||||
OchChainLogManager.writeChainLogMap("向地图传参数", "参数信息:${ochInfo}")
|
||||
d(TAG,"向地图传参数_参数信息:${ochInfo}")
|
||||
}else{
|
||||
d(TAG, "向地图传参数_参数信息:${ochInfo}")
|
||||
} else {
|
||||
val ochInfo = OchInfo(0, mutableListOf())
|
||||
CallerDataCenterBizListener.invokeOchInfo(ochInfo)
|
||||
OchChainLogManager.writeChainLogMap("向地图传参数", "参数信息:${ochInfo}")
|
||||
d(TAG,"向地图传参数_参数信息:${ochInfo}")
|
||||
d(TAG, "向地图传参数_参数信息:${ochInfo}")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -165,9 +167,13 @@ object LineManager : CallerBase<ILineCallback>() {
|
||||
* 在终点10m 范围内向地盘查询是否到站
|
||||
* [com.mogo.och.bridge.autopilot.autopilot.OchAutoPilotStatusListenerManager.onAutoPilotStation]
|
||||
*/
|
||||
val token = CallerAutoPilotControlManager.sendSsmFuncQueryAutoPilotStation(teleOrderId)
|
||||
OchChainLogManager.writeChainLogAutopilot("到站逻辑","距离站点:$distance 请求token:$token")
|
||||
d(TAG,"到站逻辑_距离站点:$distance 请求token:$token")
|
||||
val token =
|
||||
CallerAutoPilotControlManager.sendSsmFuncQueryAutoPilotStation(teleOrderId)
|
||||
OchChainLogManager.writeChainLogAutopilot(
|
||||
"到站逻辑",
|
||||
"距离站点:$distance 请求token:$token"
|
||||
)
|
||||
d(TAG, "到站逻辑_距离站点:$distance 请求token:$token")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -186,7 +192,7 @@ object LineManager : CallerBase<ILineCallback>() {
|
||||
}
|
||||
}
|
||||
|
||||
fun searchAutopilotState(){
|
||||
fun searchAutopilotState() {
|
||||
CallerAutoPilotControlManager.sendSsmFuncQueryAutoPilotInfo()
|
||||
}
|
||||
|
||||
@@ -194,10 +200,10 @@ object LineManager : CallerBase<ILineCallback>() {
|
||||
* [searchAutopilotState] 方法请求的返回值
|
||||
*/
|
||||
fun invokeSetIsFirstAutopilot(orderId: String?, firstAutopilotFlag: Boolean, count: Int) {
|
||||
if (this.teleOrderId==orderId){
|
||||
if(count>=1){
|
||||
if (this.teleOrderId == orderId) {
|
||||
if (count >= 1) {
|
||||
teleIsFirstStartAutopilot = false
|
||||
}else{
|
||||
} else {
|
||||
teleIsFirstStartAutopilot = true
|
||||
}
|
||||
}
|
||||
@@ -209,20 +215,23 @@ object LineManager : CallerBase<ILineCallback>() {
|
||||
fun setStartAndEndStation(startStation: BusStationBean?, endStation: BusStationBean?) {
|
||||
this.startStation = startStation
|
||||
this.endStation = endStation
|
||||
if(startStation==null||endStation==null){
|
||||
if (startStation == null || endStation == null) {
|
||||
clearAutopilotControlParameters()
|
||||
}else {
|
||||
} else {
|
||||
setAutopilotControlParameters()
|
||||
}
|
||||
OchChainLogManager.writeChainLogAutopilot("自驾参数", "站点信息:${startStation}---${endStation}")
|
||||
d(TAG,"自驾参数 设置站点_站点信息:${startStation}---${endStation}")
|
||||
OchChainLogManager.writeChainLogAutopilot(
|
||||
"自驾参数",
|
||||
"站点信息:${startStation}---${endStation}"
|
||||
)
|
||||
d(TAG, "自驾参数 设置站点_站点信息:${startStation}---${endStation}")
|
||||
}
|
||||
|
||||
fun setContraiInfo(contraiInfo: ContraiInfo?){
|
||||
fun setContraiInfo(contraiInfo: ContraiInfo?) {
|
||||
this._contraiInfo = contraiInfo
|
||||
setAutopilotControlParameters()
|
||||
OchChainLogManager.writeChainLogAutopilot("自驾参数", "轨迹信息:${contraiInfo}")
|
||||
d(TAG,"自驾参数 设置轨迹_轨迹信息:${contraiInfo}")
|
||||
d(TAG, "自驾参数 设置轨迹_轨迹信息:${contraiInfo}")
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@@ -242,12 +251,12 @@ object LineManager : CallerBase<ILineCallback>() {
|
||||
sb.append(it.value)
|
||||
}
|
||||
OchChainLogManager.writeChainLogAutopilot("设置线路", "$sb")
|
||||
d(TAG,"自驾参数 设置线路_线路信息:${_lineInfos}_${sb}")
|
||||
d(TAG, "自驾参数 设置线路_线路信息:${_lineInfos}_${sb}")
|
||||
CallerEagleBaseFunctionCall4OchManager.updateOrderLine(sb.toString())
|
||||
}
|
||||
}
|
||||
OchChainLogManager.writeChainLogAutopilot("设置线路", "线路信息:$_lineInfos")
|
||||
d(TAG,"自驾参数 设置线路_线路信息:${_lineInfos}")
|
||||
d(TAG, "自驾参数 设置线路_线路信息:${_lineInfos}")
|
||||
}
|
||||
|
||||
fun getStations(): Pair<BusStationBean?, BusStationBean?> {
|
||||
@@ -294,8 +303,8 @@ object LineManager : CallerBase<ILineCallback>() {
|
||||
}
|
||||
}
|
||||
|
||||
fun getLineInfo(function: (lineInfo: LineInfo) -> Unit){
|
||||
_lineInfos?.let { line->
|
||||
fun getLineInfo(function: (lineInfo: LineInfo) -> Unit) {
|
||||
_lineInfos?.let { line ->
|
||||
function.invoke(line)
|
||||
return
|
||||
}
|
||||
@@ -311,7 +320,7 @@ object LineManager : CallerBase<ILineCallback>() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun setAutopilotControlParameters(){
|
||||
private fun setAutopilotControlParameters() {
|
||||
getStationsWithLine { start, end, lineInfo ->
|
||||
val parameters = initAutopilotControlParameters()
|
||||
if (null == parameters) {
|
||||
@@ -321,7 +330,7 @@ object LineManager : CallerBase<ILineCallback>() {
|
||||
d(TAG, "AutopilotControlParameters is update.")
|
||||
if (lineInfo.isFirstStation(start)) {
|
||||
autopilotFlag = firstStationFirstStartAutopilotFlag
|
||||
}else{
|
||||
} else {
|
||||
autopilotFlag = middleStationFirstStartAutopilotFlag
|
||||
}
|
||||
CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(parameters)
|
||||
@@ -332,14 +341,18 @@ object LineManager : CallerBase<ILineCallback>() {
|
||||
val endStationLocation = MogoLocation()
|
||||
endStationLocation.latitude = end.gcjLat
|
||||
endStationLocation.longitude = end.gcjLon
|
||||
TrajectoryAndDistanceManager.setStationPoint(startStationLocation, endStationLocation, lineInfo.lineId)
|
||||
OchLocationManager.addGCJ02Listener(TAG,1, mMapLocationListener)
|
||||
TrajectoryAndDistanceManager.setStationPoint(
|
||||
startStationLocation,
|
||||
endStationLocation,
|
||||
lineInfo.lineId
|
||||
)
|
||||
OchLocationManager.addGCJ02Listener(TAG, 1, mMapLocationListener)
|
||||
// 恢复启动自驾信息
|
||||
searchAutopilotState()
|
||||
}
|
||||
}
|
||||
|
||||
private fun clearAutopilotControlParameters(){
|
||||
private fun clearAutopilotControlParameters() {
|
||||
CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(null)
|
||||
TrajectoryAndDistanceManager.setStationPoint(null, null, null)
|
||||
autopilotId = ""
|
||||
@@ -380,20 +393,21 @@ object LineManager : CallerBase<ILineCallback>() {
|
||||
fun initAutopilotControlParameters(): AutopilotControlParameters? {
|
||||
var parameters: AutopilotControlParameters? = null
|
||||
getStationsWithLine { start, end, lineInfo ->
|
||||
this.autopilotId = "${lineInfo.lineId}_${start.siteId}_${end.siteId}_${lineInfo.orderId}"
|
||||
this.autopilotId =
|
||||
"${lineInfo.lineId}_${start.siteId}_${end.siteId}_${lineInfo.orderId}"
|
||||
this.teleOrderId = lineInfo.genAutopilotId()
|
||||
}
|
||||
getStationsWithLineAndContrai { start, end, lineInfo, contrai ->
|
||||
parameters = AutopilotControlParameters()
|
||||
parameters?.routeID = lineInfo.lineId.toInt()
|
||||
parameters?.routeName = lineInfo.lineName
|
||||
parameters?.startName = start.name
|
||||
parameters?.endName = end.name
|
||||
parameters?.startLatLon = AutoPilotLonLat(start.lat, start.lon)
|
||||
parameters?.endLatLon = AutoPilotLonLat(end.lat, end.lon)
|
||||
if(AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)){
|
||||
parameters?.startName = start.name ?: ""
|
||||
parameters?.endName = end.name ?: ""
|
||||
parameters?.startLatLon = AutoPilotLonLat(start.lat, start.lon,true)
|
||||
parameters?.endLatLon = AutoPilotLonLat(end.lat, end.lon,true)
|
||||
if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)) {
|
||||
parameters?.vehicleType = 9
|
||||
}else{
|
||||
} else {
|
||||
parameters?.vehicleType = 10
|
||||
}
|
||||
parameters?.orderId = this.teleOrderId
|
||||
@@ -418,95 +432,105 @@ object LineManager : CallerBase<ILineCallback>() {
|
||||
)
|
||||
}
|
||||
|
||||
val (wayLatLons, blackLatLons) = contrai.getWayBlackLatLons()
|
||||
|
||||
parameters?.wayLatLons = wayLatLons
|
||||
parameters?.blackLatLons = blackLatLons
|
||||
|
||||
if (endStation?.passPoints?.isNotEmpty() == true ||
|
||||
endStation?.blackPoints?.isNotEmpty() == true
|
||||
) {
|
||||
val (wayLatLons, blackLatLons) = endStation!!.getWayBlackLatLons()
|
||||
parameters?.wayLatLons = wayLatLons
|
||||
parameters?.blackLatLons = blackLatLons
|
||||
CallerLogger.d(TAG, "从站点获取经停点和禁行点")
|
||||
} else {
|
||||
val (wayLatLons, blackLatLons) = contrai.getWayBlackLatLons()
|
||||
parameters?.wayLatLons = wayLatLons
|
||||
parameters?.blackLatLons = blackLatLons
|
||||
CallerLogger.d(TAG, "从轨迹获取经停点和禁行点")
|
||||
}
|
||||
}
|
||||
CallerLogger.d(TAG, "${parameters?.wayLatLons}\n${parameters?.blackLatLons}")
|
||||
if (parameters == null) {
|
||||
ToastUtils.showShort("未设置起始或终点站点")
|
||||
}
|
||||
return parameters
|
||||
}
|
||||
|
||||
fun getWayBlackLatLons(
|
||||
passPoints: MutableList<BusStationBean>?,
|
||||
blackPoints: MutableList<BusStationBean>?
|
||||
): Pair<MutableList<AutoPilotLonLat>, MutableList<AutoPilotLonLat>> {
|
||||
fun initAutopilotControlParametersFromContrai(): AutopilotControlParameters? {
|
||||
var parameters: AutopilotControlParameters? = null
|
||||
|
||||
this.autopilotId = "${lineInfos?.lineId}_${startStation?.siteId}_${endStation?.siteId}_${lineInfos?.orderId}"
|
||||
this.teleOrderId = lineInfos?.genAutopilotId() ?: ""
|
||||
|
||||
|
||||
parameters = AutopilotControlParameters()
|
||||
parameters.routeID = lineInfos?.lineId?.toInt()?:0
|
||||
parameters.routeName = lineInfos?.lineName?:""
|
||||
lineInfos?.siteInfos?.let {
|
||||
if(it.size>=0){
|
||||
parameters.startLatLon = AutoPilotLonLat(it.first().lat, it.first().lon,true)
|
||||
parameters.endLatLon = AutoPilotLonLat(it.last().lat, it.last().lon,true)
|
||||
parameters.startName = it.first().name ?: ""
|
||||
parameters.endName = it.last().name ?: ""
|
||||
}
|
||||
}
|
||||
if (AppIdentityModeUtils.isTaxi(FunctionBuildConfig.appIdentityMode)) {
|
||||
parameters.vehicleType = 9
|
||||
} else {
|
||||
parameters.vehicleType = 10
|
||||
}
|
||||
parameters.orderId = this.teleOrderId
|
||||
parameters.firstStationFlag = autopilotFlag
|
||||
parameters.firstAutopilotFlag = teleIsFirstStartAutopilot
|
||||
|
||||
if (parameters.autoPilotLine == null) {
|
||||
parameters.autoPilotLine = AutoPilotLine(
|
||||
lineInfos?.lineId?:0L,
|
||||
lineInfos?.lineName?:"",
|
||||
contraiInfo?.csvFileUrl?:"",
|
||||
contraiInfo?.csvFileMd5?:"",
|
||||
contraiInfo?.txtFileUrl?:"",
|
||||
contraiInfo?.txtFileMd5?:"",
|
||||
contraiInfo?.contrailSaveTime?:System.currentTimeMillis(),
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
0L
|
||||
)
|
||||
}
|
||||
|
||||
val wayLatLons = mutableListOf<AutoPilotLonLat>()
|
||||
// 途经点
|
||||
if (!passPoints.isNullOrEmpty()) {
|
||||
for (mogoLatLng in passPoints) {
|
||||
wayLatLons.add(
|
||||
AutoPilotLonLat(
|
||||
mogoLatLng.lat,
|
||||
mogoLatLng.lon,
|
||||
when (mogoLatLng.pointType) {
|
||||
1 -> {//途径点
|
||||
false
|
||||
}
|
||||
|
||||
2 -> {//禁行点
|
||||
false
|
||||
}
|
||||
|
||||
3 -> {//站点
|
||||
true
|
||||
}
|
||||
|
||||
else -> {
|
||||
false
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
val blackLatLons = mutableListOf<AutoPilotLonLat>()
|
||||
// 黑名单点
|
||||
if (!blackPoints.isNullOrEmpty()) {
|
||||
for (mogoLatLng in blackPoints) {
|
||||
blackLatLons.add(
|
||||
AutoPilotLonLat(
|
||||
mogoLatLng.lat,
|
||||
mogoLatLng.lat,
|
||||
when (mogoLatLng.pointType) {
|
||||
1 -> {//途径点
|
||||
false
|
||||
}
|
||||
|
||||
2 -> {//禁行点
|
||||
false
|
||||
}
|
||||
|
||||
3 -> {//站点
|
||||
true
|
||||
}
|
||||
|
||||
else -> {
|
||||
false
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
lineInfos?.siteInfos?.forEachIndexed { index, site ->
|
||||
if(index>0){
|
||||
val (wayLatLonsSite, blackLatLonsSite) = site.getWayBlackLatLons()
|
||||
wayLatLons.addAll(wayLatLonsSite)
|
||||
blackLatLons.addAll(blackLatLonsSite)
|
||||
if(index!=lineInfos!!.siteInfos.size-1) {
|
||||
wayLatLons.add(AutoPilotLonLat(site.lat, site.lon, true))
|
||||
}
|
||||
}
|
||||
}
|
||||
return Pair(wayLatLons,blackLatLons)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
parameters.wayLatLons = wayLatLons
|
||||
parameters.blackLatLons = blackLatLons
|
||||
|
||||
CallerLogger.d(TAG, "从轨迹获取经停点和禁行点")
|
||||
|
||||
return parameters
|
||||
}
|
||||
|
||||
|
||||
// 启动自动驾驶
|
||||
fun startAutopilot() {
|
||||
|
||||
if(startStation ==null|| endStation ==null){
|
||||
if (startStation == null || endStation == null) {
|
||||
ToastUtils.showShort("未设置起始或终点站点")
|
||||
return
|
||||
}
|
||||
|
||||
startStation?.let {
|
||||
if(!it.isLeaving){
|
||||
if (!it.isLeaving) {
|
||||
ToastUtils.showShort("请滑动出发后再启动自驾")
|
||||
return
|
||||
}
|
||||
@@ -522,10 +546,10 @@ object LineManager : CallerBase<ILineCallback>() {
|
||||
OchAutopilotAnalytics.triggerClickStartAutopilotTime(System.currentTimeMillis())
|
||||
|
||||
//1、判断轨迹url是否可用
|
||||
if(_contraiInfo ==null){
|
||||
if (_contraiInfo == null) {
|
||||
ToastUtils.showLong("无发布轨迹, 请发布后重试")
|
||||
return
|
||||
}else{
|
||||
} else {
|
||||
if (FunctionBuildConfig.isPassStartAutopilotCommand
|
||||
&& TextUtils.isEmpty(_contraiInfo!!.csvFileUrl)
|
||||
&& TextUtils.isEmpty(_contraiInfo!!.csvFileMd5)
|
||||
@@ -558,7 +582,7 @@ object LineManager : CallerBase<ILineCallback>() {
|
||||
return
|
||||
}
|
||||
|
||||
triggerStartServiceEvent(false,0,"")
|
||||
triggerStartServiceEvent(false, 0, "")
|
||||
|
||||
val parameters = initAutopilotControlParameters()
|
||||
if (null == parameters) {
|
||||
@@ -566,10 +590,11 @@ object LineManager : CallerBase<ILineCallback>() {
|
||||
return
|
||||
}
|
||||
|
||||
val sessionId = startAutoPilot(parameters)
|
||||
val sessionId = startAutoPilot(parameters)
|
||||
OchAutopilotAnalytics.triggerUpdateStartAutoPilotSessionId(sessionId)
|
||||
|
||||
d(TAG,
|
||||
d(
|
||||
TAG,
|
||||
"行程日志-开启自动驾驶====" + GsonUtil.jsonFromObject(parameters)
|
||||
+ " startLatLon=" + parameters.startName + ",endLatLon=" + parameters.endName +
|
||||
"isRestart = " + isFirstStartAutopilot
|
||||
@@ -583,7 +608,7 @@ object LineManager : CallerBase<ILineCallback>() {
|
||||
private fun triggerUnableStartAPReasonEvent() {
|
||||
getStationsWithLine { start, end, line ->
|
||||
OchAutopilotAnalytics.triggerUnableStartAPReasonEvent(
|
||||
start.name, end.name,line.lineId.toString() , "",
|
||||
start.name ?: "", end.name ?: "", line.lineId.toString(), "",
|
||||
OCHAdasAbilityManager.getInstance().autopilotUnAbilityReason
|
||||
)
|
||||
}
|
||||
@@ -594,32 +619,32 @@ object LineManager : CallerBase<ILineCallback>() {
|
||||
* 1: 通过can消息发送自驾状态确定启动自驾成功
|
||||
* 2:通过FSM 反馈确定启动自驾成功
|
||||
*/
|
||||
fun triggerStartServiceEvent(send: Boolean,source:Int,type:String) {
|
||||
fun triggerStartServiceEvent(send: Boolean, source: Int, type: String) {
|
||||
getStationsWithLine { start, end, lineInfo ->
|
||||
OchAutopilotAnalytics.triggerStartAutopilotEvent(
|
||||
isFirstStartAutopilot,
|
||||
send,
|
||||
start.name,
|
||||
end.name,
|
||||
start.name ?: "",
|
||||
end.name ?: "",
|
||||
lineInfo.lineId.toInt(),
|
||||
"",
|
||||
System.currentTimeMillis(),
|
||||
type,
|
||||
source
|
||||
)
|
||||
if(send){// 启动自驾成功回调
|
||||
if (send) {// 启动自驾成功回调
|
||||
teleIsFirstStartAutopilot = false
|
||||
isFirstStartAutopilot = false
|
||||
autopilotFlag = norFirstStartAutopilotFlag
|
||||
M_LISTENERS.forEach {
|
||||
it.value.startAutopilotSuccess(source,autopilotId)
|
||||
it.value.startAutopilotSuccess(source, autopilotId)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun invokeStartAutopilotTimeOut(){
|
||||
fun invokeStartAutopilotTimeOut() {
|
||||
M_LISTENERS.forEach {
|
||||
it.value.startAutopilotTimeOut()
|
||||
}
|
||||
@@ -627,9 +652,13 @@ object LineManager : CallerBase<ILineCallback>() {
|
||||
|
||||
@JvmStatic
|
||||
fun invokeStartAutopilotFailure(startFailedCode: String, startFailedMessage: String) {
|
||||
OchAutopilotAnalytics.triggerStartAutopilotFailureEventByAdas(startFailedCode,startFailedMessage,System.currentTimeMillis())
|
||||
OchAutopilotAnalytics.triggerStartAutopilotFailureEventByAdas(
|
||||
startFailedCode,
|
||||
startFailedMessage,
|
||||
System.currentTimeMillis()
|
||||
)
|
||||
M_LISTENERS.forEach {
|
||||
it.value.startAutopilotFailure(startFailedCode,startFailedMessage)
|
||||
it.value.startAutopilotFailure(startFailedCode, startFailedMessage)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -640,16 +669,19 @@ object LineManager : CallerBase<ILineCallback>() {
|
||||
}
|
||||
|
||||
fun compareFSMAndOchOrderId(autopilotIdFromFsm: String?) {
|
||||
if(autopilotIdFromFsm == teleOrderId){
|
||||
if (autopilotIdFromFsm == teleOrderId) {
|
||||
// 地盘有和上层一样 不用操作
|
||||
}else{
|
||||
if(autopilotIdFromFsm.isNullOrEmpty()){
|
||||
} else {
|
||||
if (autopilotIdFromFsm.isNullOrEmpty()) {
|
||||
// 地盘没有 不做操作
|
||||
}else{
|
||||
} else {
|
||||
// 地盘有但是和och出不一样
|
||||
// todo 需要och 重新出发轨迹下载操作
|
||||
ToastUtils.showShort("${autopilotIdFromFsm}_${teleOrderId}_自动驾驶id不同请排查")
|
||||
OchChainLogManager.writeChainLogAutopilot("自驾Id","${autopilotIdFromFsm}_${teleOrderId}_自动驾驶id不同请排查")
|
||||
OchChainLogManager.writeChainLogAutopilot(
|
||||
"自驾Id",
|
||||
"${autopilotIdFromFsm}_${teleOrderId}_自动驾驶id不同请排查"
|
||||
)
|
||||
// val initAutopilotControlParameters = initAutopilotControlParameters()
|
||||
// if (initAutopilotControlParameters!==null&&initAutopilotControlParameters.autoPilotLine!=null
|
||||
// && contraiInfo!=null
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.mogo.och.bridge.trajectory.TrajectoryCache
|
||||
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
||||
import com.mogo.och.common.module.manager.loop.LoopInfo
|
||||
import com.mogo.och.bridge.utils.CoordinateCalculateRouteUtil
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
@@ -127,6 +128,7 @@ object TrajectoryAndDistanceManager : IMoGoPlanningRottingListener {
|
||||
d(M_OCHCOMMON + TAG, "onAutopilotRotting: 收到轨迹")
|
||||
globalPathResp?.wayPointsList?.let {
|
||||
if (it.size > 0) {
|
||||
OchChainLogManager.writeChainLogTrajectory("轨迹监控","收到轨迹信息轨迹个数${it.size}第一个点${it[0]}最后一个点:${it.last()} 轨迹id:${globalPathResp.lineId}")
|
||||
d(
|
||||
M_OCHCOMMON + TAG,
|
||||
"收到轨迹:轨迹个数${it.size}第一个点${it[0]}最后一个点:${it.last()} 轨迹id:${globalPathResp.lineId}"
|
||||
@@ -192,6 +194,7 @@ object TrajectoryAndDistanceManager : IMoGoPlanningRottingListener {
|
||||
M_OCHCOMMON + TAG,
|
||||
"线路id:${lineId}设置站点:开始站点${startStationInfo}、结束站点:${endStationInfo}"
|
||||
)
|
||||
OchChainLogManager.writeChainLogTrajectory("轨迹监控","设置站点:线路id:${lineId}设置站点:开始站点${startStationInfo}、结束站点:${endStationInfo}")
|
||||
if (startStationInfo == null || endStationInfo == null || lineId == -1L) {
|
||||
this.endStationInfo.index = null
|
||||
this.endStationInfo.distance = null
|
||||
|
||||
@@ -61,7 +61,7 @@ dependencies {
|
||||
testImplementation project(path: ':OCH:common:common')
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||
implementation rootProject.ext.dependencies.amapnavi3dmap
|
||||
api rootProject.ext.dependencies.amapnavi3dmap
|
||||
implementation rootProject.ext.dependencies.rxandroid
|
||||
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.mogo.och.common.module.biz.routing;
|
||||
|
||||
public interface RoutingCallback {
|
||||
void showMap(boolean show);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.mogo.och.common.module.biz.routing
|
||||
|
||||
import android.view.View
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OCHCOMMON
|
||||
import com.mogo.och.common.module.biz.time.TimeService
|
||||
import com.mogo.och.common.module.constant.OchCommonConst
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
||||
|
||||
object RoutingManager {
|
||||
|
||||
private const val TAG = M_OCHCOMMON+"RoutingManager"
|
||||
|
||||
private var routingService: RoutingService? =
|
||||
ARouter.getInstance().build(OchCommonConst.BIZ_ROUTING).navigation() as RoutingService
|
||||
|
||||
|
||||
fun load(){
|
||||
OchChainLogManager.writeChainLogInit("初始化信息","初始化算路验证系统")
|
||||
d(TAG,"初始化信息_初始化算路验证系统")
|
||||
}
|
||||
|
||||
fun getRoutingView():View?{
|
||||
return routingService?.getRoutingView()
|
||||
}
|
||||
|
||||
fun setRoutingCallback(callback: RoutingCallback?){
|
||||
routingService?.setRoutingCallback(callback)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.mogo.och.common.module.biz.routing
|
||||
|
||||
import android.view.View
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.alibaba.android.arouter.facade.template.IProvider
|
||||
|
||||
interface RoutingService : IProvider {
|
||||
|
||||
fun getRoutingView(): View?
|
||||
|
||||
fun setRoutingCallback(callback: RoutingCallback?)
|
||||
|
||||
}
|
||||
@@ -39,6 +39,7 @@ class OchCommonConst {
|
||||
const val BIZ_TIME = "/ochbiz/common/time"
|
||||
const val BIZ_Media = "/ochbiz/common/media"
|
||||
|
||||
const val BIZ_ROUTING = "/ochbiz/common/routing"
|
||||
const val BIZ_OFFLINE = "/offlinedriver/offlinedata"
|
||||
const val BIZ_Bridge = "/birdge/bridge"
|
||||
|
||||
@@ -75,6 +76,19 @@ class OchCommonConst {
|
||||
const val ARRIVE_AT_END_STATION_DISTANCE = 10
|
||||
|
||||
|
||||
// taxi 到达起始点围栏
|
||||
const val ARRIVE_AT_START_STATION_DISTANCE = 15 //围栏由20m改为50m 再次改为15m
|
||||
|
||||
//算路终点UUID
|
||||
const val TAXI_ROUTING_VERIFY_END_SITE = "taxi_routing_verify_end_site"
|
||||
|
||||
//算路起点UUID
|
||||
const val TAXI_ROUTING_VERIFY_START_SITE = "taxi_routing_verify_start_site"
|
||||
|
||||
const val TYPE_MARKER_ROUTING_VERIFY = "TYPE_MARKER_TAXI_ROUTING_VERIFY"
|
||||
|
||||
|
||||
|
||||
//b1 b2 平均速度 bus的平均里程:25km/h
|
||||
const val BUS_AVERAGE_SPEED = 25
|
||||
|
||||
|
||||
@@ -64,6 +64,13 @@ object OchChainLogManager {
|
||||
|
||||
const val EVENT_KEY_INFO_ERROR = "analytics_event_och_error"
|
||||
|
||||
// 算路验证模式
|
||||
const val EVENT_KEY_INFO_ROUTING = "analytics_event_och_routing"
|
||||
|
||||
fun writeChainLogRouting(title: String, info: String , upload: Boolean = true) {
|
||||
writeChainLog(title, info, upload, EVENT_KEY_INFO_ROUTING)
|
||||
}
|
||||
|
||||
const val EVENT_KEY_INFO_VLM = "analytics_event_och_vlm"
|
||||
|
||||
const val EVENT_KEY_INFO_BRIDGE = "analytics_event_och_bridge"
|
||||
|
||||
@@ -41,6 +41,10 @@
|
||||
|
||||
<string name="common_dialog_goback">返回</string>
|
||||
|
||||
<string name="common_leave_station">滑动出发</string>
|
||||
<string name="common_arrive_station">到站</string>
|
||||
<string name="common_complete">结束</string>
|
||||
|
||||
<string name="common_start_task_after_upload_success">请等待升级完成后再选择任务</string>
|
||||
|
||||
|
||||
|
||||
@@ -1,214 +0,0 @@
|
||||
package com.mogo.och.data.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 单个网约车小巴车站信息
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class BusStationBean {
|
||||
private int siteId;
|
||||
@SerializedName(value = "name",alternate = {"siteName"})
|
||||
private String name;
|
||||
private String nameKr;
|
||||
private int seq;
|
||||
private double gcjLon; //高德
|
||||
private double gcjLat; //高德
|
||||
@SerializedName(value = "lon",alternate = {"wgs84Lon"})
|
||||
private double lon; //高精坐标
|
||||
@SerializedName(value = "lat",alternate = {"wgs84Lat"})
|
||||
private double lat; //高精坐标
|
||||
private int drivingStatus;//行驶信息,0初始值;1已经过;2当前站;3未到站
|
||||
private boolean leaving;// 为出发false 出发true
|
||||
private String introduction;// 站点简介
|
||||
private boolean isPlayTts;
|
||||
private int pointType; // 1:途径点 2:禁行点 3:站点
|
||||
private List<SiteIntroduce> videoList;
|
||||
|
||||
public String getNameKr() {
|
||||
return nameKr;
|
||||
}
|
||||
|
||||
public void setNameKr(String nameKr) {
|
||||
this.nameKr = nameKr;
|
||||
}
|
||||
|
||||
public int getSiteId() {
|
||||
return siteId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public int getSeq() {
|
||||
return seq;
|
||||
}
|
||||
|
||||
public double getGcjLon() {
|
||||
return gcjLon;
|
||||
}
|
||||
|
||||
public double getGcjLat() {
|
||||
return gcjLat;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public int getDrivingStatus() {
|
||||
return drivingStatus;
|
||||
}
|
||||
|
||||
public boolean isLeaving() {
|
||||
return leaving;
|
||||
}
|
||||
|
||||
public void setSiteId(int siteId) {
|
||||
this.siteId = siteId;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setSeq(int seq) {
|
||||
this.seq = seq;
|
||||
}
|
||||
|
||||
public void setGcjLon(double gcjLon) {
|
||||
this.gcjLon = gcjLon;
|
||||
}
|
||||
|
||||
public void setGcjLat(double gcjLat) {
|
||||
this.gcjLat = gcjLat;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public void setDrivingStatus(int drivingStatus) {
|
||||
this.drivingStatus = drivingStatus;
|
||||
}
|
||||
|
||||
public void setLeaving(boolean leaving) {
|
||||
this.leaving = leaving;
|
||||
}
|
||||
|
||||
public String getIntroduction() {
|
||||
return introduction;
|
||||
}
|
||||
|
||||
public void setIntroduction(String introduction) {
|
||||
this.introduction = introduction;
|
||||
}
|
||||
|
||||
public boolean isPlayTts() {
|
||||
return isPlayTts;
|
||||
}
|
||||
|
||||
public void setPlayTts(boolean playTts) {
|
||||
isPlayTts = playTts;
|
||||
}
|
||||
|
||||
public List<SiteIntroduce> getVideoList() {
|
||||
return videoList;
|
||||
}
|
||||
|
||||
public void setVideoList(List<SiteIntroduce> videoList) {
|
||||
this.videoList = videoList;
|
||||
}
|
||||
|
||||
public int getPointType() {
|
||||
return pointType;
|
||||
}
|
||||
|
||||
public void setPointType(int pointType) {
|
||||
this.pointType = pointType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
BusStationBean that = (BusStationBean) o;
|
||||
return siteId == that.siteId
|
||||
&& seq == that.seq
|
||||
&& Double.compare(gcjLon, that.gcjLon) == 0
|
||||
&& Double.compare(gcjLat, that.gcjLat) == 0
|
||||
&& Double.compare(lon, that.lon) == 0
|
||||
&& Double.compare(lat, that.lat) == 0
|
||||
&& drivingStatus == that.drivingStatus
|
||||
&& leaving == that.leaving && isPlayTts == that.isPlayTts
|
||||
&& pointType == that.pointType
|
||||
&& Objects.equals(name, that.name)
|
||||
&& Objects.equals(nameKr, that.nameKr)
|
||||
&& Objects.equals(introduction, that.introduction)
|
||||
&& Objects.equals(videoList, that.videoList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = siteId;
|
||||
result = 31 * result + Objects.hashCode(name);
|
||||
result = 31 * result + Objects.hashCode(nameKr);
|
||||
result = 31 * result + seq;
|
||||
result = 31 * result + Double.hashCode(gcjLon);
|
||||
result = 31 * result + Double.hashCode(gcjLat);
|
||||
result = 31 * result + Double.hashCode(lon);
|
||||
result = 31 * result + Double.hashCode(lat);
|
||||
result = 31 * result + drivingStatus;
|
||||
result = 31 * result + Boolean.hashCode(leaving);
|
||||
result = 31 * result + Objects.hashCode(introduction);
|
||||
result = 31 * result + Boolean.hashCode(isPlayTts);
|
||||
result = 31 * result + pointType;
|
||||
result = 31 * result + Objects.hashCode(videoList);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "BusStationBean{" +
|
||||
"siteId=" + siteId +
|
||||
", name='" + name + '\'' +
|
||||
", nameKr='" + nameKr + '\'' +
|
||||
", seq=" + seq +
|
||||
", gcjLon=" + gcjLon +
|
||||
", gcjLat=" + gcjLat +
|
||||
", lon=" + lon +
|
||||
", lat=" + lat +
|
||||
", drivingStatus=" + drivingStatus +
|
||||
", leaving=" + leaving +
|
||||
", introduction='" + introduction + '\'' +
|
||||
", isPlayTts=" + isPlayTts +
|
||||
", pointType=" + pointType +
|
||||
", videoList=" + videoList +
|
||||
'}';
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public MogoLocation toMogoLocation() {
|
||||
MogoLocation result = new MogoLocation();
|
||||
result.setLatitude(gcjLat);
|
||||
result.setLongitude(gcjLon);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
package com.mogo.och.data.bean
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters.AutoPilotLonLat
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import java.util.Objects
|
||||
|
||||
/**
|
||||
* 单个网约车小巴车站信息
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
open class BusStationBean {
|
||||
var siteId: Int = 0
|
||||
|
||||
@JvmField
|
||||
@SerializedName(value = "name", alternate = ["siteName"])
|
||||
var name: String? = null
|
||||
var nameKr: String? = null
|
||||
var seq: Int = 0
|
||||
@JvmField
|
||||
var gcjLon: Double = 0.0 //高德
|
||||
@JvmField
|
||||
var gcjLat: Double = 0.0 //高德
|
||||
|
||||
@SerializedName(value = "lon", alternate = ["wgs84Lon"])
|
||||
var lon: Double = 0.0 //高精坐标
|
||||
|
||||
@SerializedName(value = "lat", alternate = ["wgs84Lat"])
|
||||
var lat: Double = 0.0 //高精坐标
|
||||
@JvmField
|
||||
var drivingStatus: Int = 0 //行驶信息,0初始值;1已经过;2当前站;3未到站
|
||||
var isLeaving: Boolean = false // 为出发false 出发true
|
||||
var introduction: String? = null // 站点简介
|
||||
var isPlayTts: Boolean = false
|
||||
var pointType: Int = 0 // 1:途径点 2:禁行点 3:站点
|
||||
var videoList: List<SiteIntroduce>? = null
|
||||
|
||||
var passPoints: List<BusStationBean>? = null // 用于算路的经停点
|
||||
var blackPoints: List<BusStationBean>? = null // 用于算路的黑名單點
|
||||
|
||||
|
||||
override fun equals(o: Any?): Boolean {
|
||||
if (this === o) return true
|
||||
if (o == null || javaClass != o.javaClass) return false
|
||||
|
||||
val that = o as BusStationBean
|
||||
return siteId == that.siteId && seq == that.seq && java.lang.Double.compare(
|
||||
gcjLon,
|
||||
that.gcjLon
|
||||
) == 0 && java.lang.Double.compare(
|
||||
gcjLat,
|
||||
that.gcjLat
|
||||
) == 0 && java.lang.Double.compare(lon, that.lon) == 0 && java.lang.Double.compare(
|
||||
lat,
|
||||
that.lat
|
||||
) == 0 && drivingStatus == that.drivingStatus && isLeaving == that.isLeaving && isPlayTts == that.isPlayTts && pointType == that.pointType && name == that.name
|
||||
&& nameKr == that.nameKr
|
||||
&& introduction == that.introduction
|
||||
&& videoList == that.videoList
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = siteId
|
||||
result = 31 * result + Objects.hashCode(name)
|
||||
result = 31 * result + Objects.hashCode(nameKr)
|
||||
result = 31 * result + seq
|
||||
result = 31 * result + java.lang.Double.hashCode(gcjLon)
|
||||
result = 31 * result + java.lang.Double.hashCode(gcjLat)
|
||||
result = 31 * result + java.lang.Double.hashCode(lon)
|
||||
result = 31 * result + java.lang.Double.hashCode(lat)
|
||||
result = 31 * result + drivingStatus
|
||||
result = 31 * result + java.lang.Boolean.hashCode(isLeaving)
|
||||
result = 31 * result + Objects.hashCode(introduction)
|
||||
result = 31 * result + java.lang.Boolean.hashCode(isPlayTts)
|
||||
result = 31 * result + pointType
|
||||
result = 31 * result + Objects.hashCode(videoList)
|
||||
return result
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "BusStationBean{" +
|
||||
"siteId=" + siteId +
|
||||
", name='" + name + '\'' +
|
||||
", nameKr='" + nameKr + '\'' +
|
||||
", seq=" + seq +
|
||||
", gcjLon=" + gcjLon +
|
||||
", gcjLat=" + gcjLat +
|
||||
", lon=" + lon +
|
||||
", lat=" + lat +
|
||||
", drivingStatus=" + drivingStatus +
|
||||
", leaving=" + isLeaving +
|
||||
", introduction='" + introduction + '\'' +
|
||||
", isPlayTts=" + isPlayTts +
|
||||
", pointType=" + pointType +
|
||||
", videoList=" + videoList +
|
||||
'}'
|
||||
}
|
||||
|
||||
fun toMogoLocation(): MogoLocation {
|
||||
val result = MogoLocation()
|
||||
result.latitude = gcjLat
|
||||
result.longitude = gcjLon
|
||||
return result
|
||||
}
|
||||
|
||||
fun getWayBlackLatLons(
|
||||
): Pair<MutableList<AutoPilotLonLat>, MutableList<AutoPilotLonLat>> {
|
||||
val wayLatLons = mutableListOf<AutoPilotLonLat>()
|
||||
// 途经点
|
||||
if (!passPoints.isNullOrEmpty()) {
|
||||
for (mogoLatLng in passPoints!!) {
|
||||
wayLatLons.add(
|
||||
AutoPilotLonLat(
|
||||
mogoLatLng.lat,
|
||||
mogoLatLng.lon,
|
||||
when (mogoLatLng.pointType) {
|
||||
1 -> {//途径点
|
||||
false
|
||||
}
|
||||
|
||||
2 -> {//禁行点
|
||||
false
|
||||
}
|
||||
|
||||
3 -> {//站点
|
||||
true
|
||||
}
|
||||
|
||||
else -> {
|
||||
false
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
val blackLatLons = mutableListOf<AutoPilotLonLat>()
|
||||
// 黑名单点
|
||||
if (!blackPoints.isNullOrEmpty()) {
|
||||
for (mogoLatLng in blackPoints!!) {
|
||||
blackLatLons.add(
|
||||
AutoPilotLonLat(
|
||||
mogoLatLng.lat,
|
||||
mogoLatLng.lon,
|
||||
when (mogoLatLng.pointType) {
|
||||
1 -> {//途径点
|
||||
false
|
||||
}
|
||||
|
||||
2 -> {//禁行点
|
||||
false
|
||||
}
|
||||
|
||||
3 -> {//站点
|
||||
true
|
||||
}
|
||||
|
||||
else -> {
|
||||
false
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
return Pair(wayLatLons,blackLatLons)
|
||||
}
|
||||
}
|
||||
@@ -75,7 +75,7 @@ data class ContraiInfo(
|
||||
blackLatLons.add(
|
||||
AutoPilotLonLat(
|
||||
mogoLatLng.lat,
|
||||
mogoLatLng.lat,
|
||||
mogoLatLng.lon,
|
||||
when (mogoLatLng.pointType) {
|
||||
1 -> {//途径点
|
||||
false
|
||||
|
||||
@@ -14,15 +14,15 @@ project.dependencies {
|
||||
implementation project.project(':OCH:shuttle:passenger_weaknet')
|
||||
implementation project.project(':OCH:taxi:unmanned-passenger')
|
||||
implementation project.project(':OCH:charter:passenger')
|
||||
}else if(isBaiLing()){
|
||||
implementation project.project(':OCH:offline:driver')
|
||||
implementation project.project(':OCH:shuttle:driver_weaknet')
|
||||
implementation project.project(':OCH:shuttle:passenger_weaknet')
|
||||
implementation project.project(':OCH:charter:driver')
|
||||
implementation project.project(':OCH:charter:passenger')
|
||||
implementation project.project(':OCH:sweeper:driver')
|
||||
implementation project.project(':OCH:taxi:unmanned-driver')
|
||||
implementation project.project(':OCH:taxi:unmanned-passenger')
|
||||
// }else if(isBaiLing()){
|
||||
// implementation project.project(':OCH:offline:driver')
|
||||
// implementation project.project(':OCH:shuttle:driver_weaknet')
|
||||
// implementation project.project(':OCH:shuttle:passenger_weaknet')
|
||||
// implementation project.project(':OCH:charter:driver')
|
||||
// implementation project.project(':OCH:charter:passenger')
|
||||
// implementation project.project(':OCH:sweeper:driver')
|
||||
// implementation project.project(':OCH:taxi:unmanned-driver')
|
||||
// implementation project.project(':OCH:taxi:unmanned-passenger')
|
||||
}else {
|
||||
implementation project.project(':OCH:offline:driver')
|
||||
implementation project.project(':OCH:shuttle:driver_weaknet')
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.mogo.och.common.module.biz.lansocket.LoginLanDriverSocket
|
||||
import com.mogo.och.common.module.biz.login.EnumLoginStatus
|
||||
import com.mogo.och.common.module.biz.login.LoginStatusManager
|
||||
import com.mogo.och.common.module.biz.offline.OfflineManager
|
||||
import com.mogo.och.common.module.biz.routing.RoutingManager
|
||||
import com.mogo.och.common.module.manager.socket.lan.LanSocketManager
|
||||
import com.mogo.och.facade.constant.FacadeConst
|
||||
|
||||
@@ -43,6 +44,7 @@ class FacadeDriverProvider : FacadeProvider() {
|
||||
CheckVinManager.load()
|
||||
OfflineManager.load()
|
||||
OTAManager.load()
|
||||
RoutingManager.load()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -82,8 +82,8 @@ object ThirdDeviceData {
|
||||
LedScreenManager.sendTripInfo2Led(
|
||||
LedScreenManager.LEAVE_STATION,
|
||||
lineInfo.lineName,
|
||||
start.name,
|
||||
end.name,
|
||||
start.name?:"",
|
||||
end.name?:"",
|
||||
LineModel.isLastStation() == true
|
||||
)
|
||||
}
|
||||
@@ -100,8 +100,8 @@ object ThirdDeviceData {
|
||||
LedScreenManager.sendTripInfo2Led(
|
||||
LedScreenManager.ARRIVE_STATION,
|
||||
lineInfo.lineName,
|
||||
start.name,
|
||||
end.name,
|
||||
start.name?:"",
|
||||
end.name?:"",
|
||||
LineModel.isLastStation(end)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.mogo.och.offline.repository.db.repository
|
||||
import androidx.room.Transaction
|
||||
import com.mogo.eagle.core.network.utils.digest.DigestUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.util.TAG
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
||||
import com.mogo.och.offline.repository.db.bean.SiteDataBean
|
||||
@@ -13,6 +12,8 @@ import com.mogo.och.offline.repository.db.dao.SiteDataDao
|
||||
|
||||
object SiteDb: IDbRepository {
|
||||
|
||||
private val TAG = "SiteDb"
|
||||
|
||||
private var siteDataDao: SiteDataDao? = null
|
||||
get() {
|
||||
if(field==null){
|
||||
|
||||
@@ -0,0 +1,861 @@
|
||||
{
|
||||
"formatVersion": 1,
|
||||
"database": {
|
||||
"version": 7,
|
||||
"identityHash": "74e6f2a37be355d3c235b4a0b837cf5d",
|
||||
"entities": [
|
||||
{
|
||||
"tableName": "contrail_data_table",
|
||||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `line_id` INTEGER, `contrail_id` INTEGER, `csv_file_url` TEXT, `csv_file_md5` TEXT, `txt_file_url` TEXT, `txt_file_md5` TEXT, `contrail_save_time` INTEGER, `md5` TEXT, `source` INTEGER)",
|
||||
"fields": [
|
||||
{
|
||||
"fieldPath": "id",
|
||||
"columnName": "id",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "lineId",
|
||||
"columnName": "line_id",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "contrailId",
|
||||
"columnName": "contrail_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
|
||||
},
|
||||
{
|
||||
"fieldPath": "source",
|
||||
"columnName": "source",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": false
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"autoGenerate": true,
|
||||
"columnNames": [
|
||||
"id"
|
||||
]
|
||||
},
|
||||
"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": {
|
||||
"autoGenerate": true,
|
||||
"columnNames": [
|
||||
"id"
|
||||
]
|
||||
},
|
||||
"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": {
|
||||
"autoGenerate": true,
|
||||
"columnNames": [
|
||||
"id"
|
||||
]
|
||||
},
|
||||
"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, `shifts_id` INTEGER, `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": "shiftsId",
|
||||
"columnName": "shifts_id",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"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": {
|
||||
"autoGenerate": true,
|
||||
"columnNames": [
|
||||
"id"
|
||||
]
|
||||
},
|
||||
"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, `shifts_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": "shiftsId",
|
||||
"columnName": "shifts_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": {
|
||||
"autoGenerate": true,
|
||||
"columnNames": [
|
||||
"id"
|
||||
]
|
||||
},
|
||||
"indices": [],
|
||||
"foreignKeys": []
|
||||
},
|
||||
{
|
||||
"tableName": "event_data_table",
|
||||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `event_type` TEXT, `shifts_id` INTEGER, `lineId` INTEGER, `task_date` 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, `msg_id` TEXT, `update_time` INTEGER)",
|
||||
"fields": [
|
||||
{
|
||||
"fieldPath": "id",
|
||||
"columnName": "id",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "eventType",
|
||||
"columnName": "event_type",
|
||||
"affinity": "TEXT",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "shiftsId",
|
||||
"columnName": "shifts_id",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "lineId",
|
||||
"columnName": "lineId",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "taskDate",
|
||||
"columnName": "task_date",
|
||||
"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
|
||||
},
|
||||
{
|
||||
"fieldPath": "msgId",
|
||||
"columnName": "msg_id",
|
||||
"affinity": "TEXT",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "upDateTime",
|
||||
"columnName": "update_time",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": false
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"autoGenerate": true,
|
||||
"columnNames": [
|
||||
"id"
|
||||
]
|
||||
},
|
||||
"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": []
|
||||
},
|
||||
{
|
||||
"tableName": "writeoff_data_table",
|
||||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `msg_id` TEXT, `expiry_time` INTEGER, `booking_time` INTEGER, `type` INTEGER, `shifts_id` INTEGER, `task_id` INTEGER, `task_date` INTEGER, `line_id` INTEGER, `site_id` INTEGER, `driver_id` INTEGER, `available_times` INTEGER, `order_no` TEXT, `uid` TEXT, `seq` TEXT, `business_time` INTEGER, `tick_size` INTEGER, `tick_name` TEXT, `event_save_time` INTEGER NOT NULL, `update_status` INTEGER NOT NULL, `update_time` INTEGER)",
|
||||
"fields": [
|
||||
{
|
||||
"fieldPath": "id",
|
||||
"columnName": "id",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "msgId",
|
||||
"columnName": "msg_id",
|
||||
"affinity": "TEXT",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "expiryTime",
|
||||
"columnName": "expiry_time",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "bookingTime",
|
||||
"columnName": "booking_time",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "type",
|
||||
"columnName": "type",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "shiftsId",
|
||||
"columnName": "shifts_id",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "taskId",
|
||||
"columnName": "task_id",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "taskDate",
|
||||
"columnName": "task_date",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "lineId",
|
||||
"columnName": "line_id",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "siteId",
|
||||
"columnName": "site_id",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "driverId",
|
||||
"columnName": "driver_id",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "availableTimes",
|
||||
"columnName": "available_times",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "orderNo",
|
||||
"columnName": "order_no",
|
||||
"affinity": "TEXT",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "uid",
|
||||
"columnName": "uid",
|
||||
"affinity": "TEXT",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "phone",
|
||||
"columnName": "seq",
|
||||
"affinity": "TEXT",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "businessTime",
|
||||
"columnName": "business_time",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "ticketSize",
|
||||
"columnName": "tick_size",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "ticketName",
|
||||
"columnName": "tick_name",
|
||||
"affinity": "TEXT",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "eventSaveTime",
|
||||
"columnName": "event_save_time",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "updateStatus",
|
||||
"columnName": "update_status",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "upDateTime",
|
||||
"columnName": "update_time",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": false
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"autoGenerate": true,
|
||||
"columnNames": [
|
||||
"id"
|
||||
]
|
||||
},
|
||||
"indices": [
|
||||
{
|
||||
"name": "index_writeoff_data_table_event_save_time",
|
||||
"unique": false,
|
||||
"columnNames": [
|
||||
"event_save_time"
|
||||
],
|
||||
"orders": [],
|
||||
"createSql": "CREATE INDEX IF NOT EXISTS `index_writeoff_data_table_event_save_time` ON `${TABLE_NAME}` (`event_save_time`)"
|
||||
}
|
||||
],
|
||||
"foreignKeys": []
|
||||
},
|
||||
{
|
||||
"tableName": "point_data_table",
|
||||
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `line_id` INTEGER, `contrail_id` INTEGER, `site_id` INTEGER, `md5` TEXT, `seq` INTEGER, `point_type` INTEGER, `longitude` REAL, `latitude` REAL, `sub_seq` INTEGER)",
|
||||
"fields": [
|
||||
{
|
||||
"fieldPath": "id",
|
||||
"columnName": "id",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": true
|
||||
},
|
||||
{
|
||||
"fieldPath": "lineId",
|
||||
"columnName": "line_id",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "contrailId",
|
||||
"columnName": "contrail_id",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "siteId",
|
||||
"columnName": "site_id",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "md5",
|
||||
"columnName": "md5",
|
||||
"affinity": "TEXT",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "seq",
|
||||
"columnName": "seq",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "pointType",
|
||||
"columnName": "point_type",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "longitude",
|
||||
"columnName": "longitude",
|
||||
"affinity": "REAL",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "latitude",
|
||||
"columnName": "latitude",
|
||||
"affinity": "REAL",
|
||||
"notNull": false
|
||||
},
|
||||
{
|
||||
"fieldPath": "subSeq",
|
||||
"columnName": "sub_seq",
|
||||
"affinity": "INTEGER",
|
||||
"notNull": false
|
||||
}
|
||||
],
|
||||
"primaryKey": {
|
||||
"autoGenerate": true,
|
||||
"columnNames": [
|
||||
"id"
|
||||
]
|
||||
},
|
||||
"indices": [],
|
||||
"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, '74e6f2a37be355d3c235b4a0b837cf5d')"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ import com.mogo.och.weaknet.model.LineModel
|
||||
import com.mogo.och.weaknet.repository.RepositoryManager
|
||||
import com.mogo.och.weaknet.repository.db.repository.WriteOffDb
|
||||
import com.mogo.och.weaknet.ui.bizswitch.SwitchBizView
|
||||
import com.mogo.och.weaknet.ui.modeswitch.TopSwitchBizView
|
||||
import com.mogo.och.weaknet.ui.qr.QrOpenView
|
||||
import com.mogo.och.weaknet.util.BusAnalyticsManager
|
||||
import com.mogo.och.weaknet.util.BusTrajectoryManager
|
||||
@@ -73,7 +74,7 @@ class ShuttleDriverProvider : CommonServiceImpl() {
|
||||
override fun createOchBusinessView(context: Context?): View? {
|
||||
d(TAG, "createOchBusinessView")
|
||||
return context?.let {
|
||||
SwitchBizView(it)
|
||||
TopSwitchBizView(it)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.mogo.och.weaknet.bean.request
|
||||
|
||||
/**
|
||||
* 通过lineid 获取轨迹id
|
||||
*/
|
||||
data class QueryPointRequest(val businessType: Int,val lineIds:MutableList<Long>){
|
||||
companion object{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,9 @@ 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.PointDataBean
|
||||
import com.mogo.och.weaknet.repository.db.bean.TaskSiteDataBean
|
||||
import com.mogo.och.weaknet.repository.db.repository.PointDb
|
||||
import com.mogo.och.weaknet.repository.db.repository.TaskSiteDb
|
||||
import java.lang.Boolean
|
||||
import kotlin.String
|
||||
@@ -30,7 +32,7 @@ class BusRoutesResponse : BaseData() {
|
||||
|
||||
companion object {
|
||||
|
||||
fun db2Beans(runnintTaskAndSites: List<TaskSiteDataBean>?): Pair<MutableList<BusStationBean>,Int> {
|
||||
fun db2Beans(runnintTaskAndSites: List<TaskSiteDataBean>?, lineId: Long?): Pair<MutableList<BusStationBean>,Int> {
|
||||
val result = mutableListOf<BusStationBean>()
|
||||
var temp: BusStationBean? = null
|
||||
var currentStationIndex = -1
|
||||
@@ -39,6 +41,7 @@ class BusRoutesResponse : BaseData() {
|
||||
LineManager.setLineInfo(lineInfo)
|
||||
return Pair(result,currentStationIndex)
|
||||
}
|
||||
val points = PointDb.queryPointByLineId(lineId)
|
||||
runnintTaskAndSites.forEachIndexed { index, taskAndsite ->
|
||||
temp = BusStationBean()
|
||||
temp?.drivingStatus = (taskAndsite.drivingStatus ?: 0)
|
||||
@@ -53,6 +56,27 @@ 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()
|
||||
points?.let {
|
||||
val sitePoint = it.filter {
|
||||
it.siteId?.toInt() == temp?.siteId
|
||||
}
|
||||
val tempPassPoints = mutableListOf<BusStationBean>()
|
||||
val tempblackPoints = mutableListOf<BusStationBean>()
|
||||
sitePoint.forEach { point->
|
||||
when (point.pointType) {
|
||||
PointDataBean.pointTypePass -> {
|
||||
tempPassPoints.add(point.toStation())
|
||||
}
|
||||
PointDataBean.pointTypeBlack -> {
|
||||
tempblackPoints.add(point.toStation())
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
temp?.passPoints = tempPassPoints
|
||||
temp?.blackPoints = tempblackPoints
|
||||
}
|
||||
|
||||
if(!taskAndsite.videoList.isNullOrEmpty()){
|
||||
try {
|
||||
val list = GsonUtils.fromJson<List<SiteIntroduce>>(
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.mogo.och.weaknet.bean.response
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
|
||||
|
||||
class PointsResponse : BaseData() {
|
||||
var data: MutableList<PointResponse>?=null
|
||||
}
|
||||
|
||||
data class Point(
|
||||
val latitude: Double,
|
||||
val longitude: Double,
|
||||
val pointType: Int,
|
||||
val segment: Int
|
||||
)
|
||||
|
||||
data class Black(
|
||||
val latitude: Double,
|
||||
val longitude: Double,
|
||||
val pointType: Int,
|
||||
val segment: Int
|
||||
)
|
||||
|
||||
data class PointResponse(
|
||||
val businessType: Int,
|
||||
val contrailId: Long,
|
||||
val contrailSaveTime: Long,
|
||||
val csvFileMd5: String,
|
||||
val csvFileUrl: String,
|
||||
val lineId: Long,
|
||||
val lineName: String,
|
||||
val segmentPointList: List<SegmentPoint>,
|
||||
val source: Int,
|
||||
val txtFileMd5: String,
|
||||
val txtFileUrl: String
|
||||
)
|
||||
|
||||
data class SegmentPoint(
|
||||
val blackList: List<Black>,
|
||||
val pointList: List<Point>,
|
||||
val segment: Int?
|
||||
)
|
||||
@@ -58,24 +58,13 @@ object LineModel {
|
||||
|
||||
const val TAG = "${M_BUS}BusLineModel"
|
||||
|
||||
private val context = AbsMogoApplication.getApp()
|
||||
|
||||
// 判断接口是否变化
|
||||
private const val EXECUTABLECHANGEMD5 = "EXECUTABLECHANGEMD5"
|
||||
|
||||
// 展示上一次刷新时间
|
||||
const val EXECUTABLECHANGETIME = "executablechangetime"
|
||||
|
||||
var currentTask: TaskDataBean?=null
|
||||
|
||||
// 当前任务的站点列表
|
||||
var stationList:MutableList<BusStationBean>? = mutableListOf()
|
||||
|
||||
private var startTaskDisposable: Disposable?=null
|
||||
|
||||
private val isRequesting = AtomicBoolean(false)
|
||||
private var startTaskDisposable:Disposable?=null
|
||||
|
||||
private var queryCarInfo: Disposable? = null
|
||||
|
||||
// 当前站点
|
||||
@JvmStatic
|
||||
@@ -86,7 +75,7 @@ object LineModel {
|
||||
d(TAG,"init")
|
||||
mContext = AbsMogoApplication.getApp()
|
||||
EventModel.load()
|
||||
queryCarExecutableTaskList(true)
|
||||
SynchDataModel.queryCarExecutableTaskList(true)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@@ -94,10 +83,11 @@ object LineModel {
|
||||
fun release() {
|
||||
d(TAG,"release")
|
||||
mContext = null
|
||||
isRequesting.set(false)
|
||||
|
||||
SynchDataModel.release()
|
||||
EventModel.release()
|
||||
mBusLinesCallbackMap.clear()
|
||||
RxUtils.disposeSubscribe(queryCarInfo)
|
||||
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@@ -110,99 +100,12 @@ object LineModel {
|
||||
mBusLinesCallbackMap[tag] = callback
|
||||
}
|
||||
|
||||
fun refreshTask() {
|
||||
RxUtils.disposeSubscribe(queryCarInfo)
|
||||
queryCarExecutableTaskList(false)
|
||||
fun getBusLinesCallbackMap(): MutableMap<String, IBusLinesCallback> {
|
||||
return mBusLinesCallbackMap
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步基础信息
|
||||
*/
|
||||
private fun queryCarExecutableTaskList(isBackground:Boolean) {
|
||||
if(isRequesting.get()){
|
||||
d(TAG,"正在同步请稍等")
|
||||
val lastUpdateTime = SharedPrefsMgr.getInstance().getLong(EXECUTABLECHANGETIME, 0)
|
||||
mBusLinesCallbackMap.forEach { callback ->
|
||||
callback.value.onRefreshSuccess(lastUpdateTime)
|
||||
}
|
||||
return
|
||||
}
|
||||
isRequesting.set(true)
|
||||
d(TAG,"开始同步数据")
|
||||
RepositoryManager.queryCarExecutableTaskList(
|
||||
object : OchCommonServiceCallback<CarExecutableTaskResponse> {
|
||||
override fun onSuccess(data: CarExecutableTaskResponse) {
|
||||
isRequesting.set(false)
|
||||
d(TAG,"同步数据成功")
|
||||
RxUtils.disposeSubscribe(queryCarInfo)
|
||||
queryCarInfo = RxUtils.createSubscribe(60_000) {
|
||||
queryCarExecutableTaskList(true)
|
||||
}
|
||||
// 第一次过滤 请求返回值的md5
|
||||
val currentRequest = DigestUtils.md5Hex(data.data.toString())
|
||||
val lastChangeMd5 = SharedPrefsMgr.getInstance().getString(EXECUTABLECHANGEMD5)
|
||||
val lastUpdateTime = SharedPrefsMgr.getInstance().getLong(EXECUTABLECHANGETIME, 0)
|
||||
val currentTimeStamp = DateTimeUtil.getCurrentTimeStamp()
|
||||
|
||||
SharedPrefsMgr.getInstance().putLong(EXECUTABLECHANGETIME, currentTimeStamp)
|
||||
val sameDay = DateTimeUtil.isSameDay(currentTimeStamp, lastUpdateTime)
|
||||
mBusLinesCallbackMap.forEach { callback ->
|
||||
callback.value.onRefreshSuccess(currentTimeStamp)
|
||||
}
|
||||
if (isBackground) {
|
||||
if (currentRequest == lastChangeMd5 && sameDay) {
|
||||
return
|
||||
}
|
||||
}
|
||||
SharedPrefsMgr.getInstance().putString(EXECUTABLECHANGEMD5, currentRequest)
|
||||
OchChainLogManager.writeChainLog(
|
||||
"数据发生变化",
|
||||
"接口信息发生变化 $lastChangeMd5 new md5${currentRequest}"
|
||||
)
|
||||
val startTime = System.currentTimeMillis()
|
||||
CarExecutableTaskResponse.save2Db(data)
|
||||
d(TAG,"更新数据耗时${System.currentTimeMillis()-startTime}")
|
||||
RxUtils.createSubscribe(800) {
|
||||
// 等待写入数据库
|
||||
mBusLinesCallbackMap.forEach { callback ->
|
||||
callback.value.onRefreshSuccessWIthData()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onError() {
|
||||
isRequesting.set(false)
|
||||
d(TAG,"同步数据失败 onError")
|
||||
RxUtils.disposeSubscribe(queryCarInfo)
|
||||
queryCarInfo = RxUtils.createSubscribe(60_000) {
|
||||
queryCarExecutableTaskList(true)
|
||||
}
|
||||
if (!isBackground) {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
ToastUtils.showShort(ResourcesUtils.getString(R.string.network_error_tip))
|
||||
} else {
|
||||
ToastUtils.showShort(ResourcesUtils.getString(R.string.request_error_tip))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, failMsg: String) {
|
||||
isRequesting.set(false)
|
||||
d(TAG,"同步数据失败 onFail")
|
||||
RxUtils.disposeSubscribe(queryCarInfo)
|
||||
queryCarInfo = RxUtils.createSubscribe(60_000) {
|
||||
queryCarExecutableTaskList(true)
|
||||
}
|
||||
if (!isBackground) {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
ToastUtils.showShort("网络异常,请稍后重试")
|
||||
} else {
|
||||
ToastUtils.showShort(failMsg)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
fun refreshTask() {
|
||||
SynchDataModel.queryCarExecutableTaskList(false)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,10 +3,12 @@ package com.mogo.och.weaknet.model
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.module.status.MogoStatusManager
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.setting.CallerSopSettingManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.e
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||
@@ -206,9 +208,11 @@ object OrderModel {
|
||||
|
||||
override fun onNext(data: Boolean) {
|
||||
if(data){
|
||||
MogoStatusManager.getInstance().setShuttleDriverPerformTask(TAG, true)
|
||||
LineModel.haveRunningTask()
|
||||
updateBusStatus()
|
||||
}else{
|
||||
MogoStatusManager.getInstance().setShuttleDriverPerformTask(TAG, false)
|
||||
LineModel.haveNoRunningTask()
|
||||
d(TAG, "queryBusRoutes 获取到小巴路线数据:空 ")
|
||||
LineManager.setLineInfo(null)
|
||||
@@ -534,6 +538,9 @@ object OrderModel {
|
||||
}catch (e:Exception){
|
||||
OchChainLogManager.writeChainLog("错误","${e.message}")
|
||||
}
|
||||
MogoStatusManager.getInstance().setShuttleDriverPerformTask(TAG, false)
|
||||
MogoStatusManager.getInstance().setTaxiUnmanedDriverLineRoutingVerifyMode(TAG, false)
|
||||
CallerSopSettingManager.invokeRoutingListener(false)
|
||||
MapMakerManager.removeAllMapMarkerByOwner(TAG)
|
||||
BusTrajectoryManager.stopTrajReqLoop()
|
||||
LoginStatusManager.loginOut()
|
||||
|
||||
@@ -0,0 +1,194 @@
|
||||
package com.mogo.och.weaknet.model
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.network.utils.digest.DigestUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||
import com.mogo.och.common.module.network.OchCommonServiceCallback
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||
import com.mogo.och.common.module.utils.ResourcesUtils
|
||||
import com.mogo.och.common.module.utils.RxUtils
|
||||
import com.mogo.och.shuttle.weaknet.R
|
||||
import com.mogo.och.weaknet.bean.response.CarExecutableTaskResponse
|
||||
import com.mogo.och.weaknet.bean.response.PointResponse
|
||||
import com.mogo.och.weaknet.repository.RepositoryManager
|
||||
import com.mogo.och.weaknet.repository.db.repository.PointDb
|
||||
import io.reactivex.Observer
|
||||
import io.reactivex.disposables.Disposable
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
|
||||
object SynchDataModel {
|
||||
|
||||
private const val TAG = "SynchDataModel"
|
||||
|
||||
private val isRequesting = AtomicBoolean(false)
|
||||
|
||||
// 展示上一次刷新时间
|
||||
const val EXECUTABLECHANGETIME = "executablechangetime"
|
||||
|
||||
private var queryCarInfo: Disposable? = null
|
||||
|
||||
// 判断接口是否变化
|
||||
private const val EXECUTABLECHANGEMD5 = "EXECUTABLECHANGEMD5"
|
||||
|
||||
/**
|
||||
* 同步基础信息
|
||||
*/
|
||||
fun queryCarExecutableTaskList(isBackground:Boolean) {
|
||||
RxUtils.disposeSubscribe(queryCarInfo)
|
||||
if(isRequesting.get()){
|
||||
d(TAG,"正在同步请稍等")
|
||||
val lastUpdateTime = SharedPrefsMgr.getInstance().getLong(EXECUTABLECHANGETIME, 0)
|
||||
LineModel.getBusLinesCallbackMap().forEach { callback ->
|
||||
callback.value.onRefreshSuccess(lastUpdateTime)
|
||||
}
|
||||
return
|
||||
}
|
||||
isRequesting.set(true)
|
||||
d(TAG,"开始同步数据")
|
||||
RepositoryManager.queryCarExecutableTaskList(
|
||||
object : OchCommonServiceCallback<CarExecutableTaskResponse> {
|
||||
override fun onSuccess(data: CarExecutableTaskResponse) {
|
||||
isRequesting.set(false)
|
||||
d(TAG,"同步数据成功")
|
||||
RxUtils.disposeSubscribe(queryCarInfo)
|
||||
queryCarInfo = RxUtils.createSubscribe(60_000) {
|
||||
queryCarExecutableTaskList(true)
|
||||
}
|
||||
// 第一次过滤 请求返回值的md5
|
||||
val currentRequest = DigestUtils.md5Hex(data.data.toString())
|
||||
val lastChangeMd5 = SharedPrefsMgr.getInstance().getString(EXECUTABLECHANGEMD5)
|
||||
val lastUpdateTime = SharedPrefsMgr.getInstance().getLong(EXECUTABLECHANGETIME, 0)
|
||||
val currentTimeStamp = DateTimeUtil.getCurrentTimeStamp()
|
||||
|
||||
SharedPrefsMgr.getInstance().putLong(EXECUTABLECHANGETIME, currentTimeStamp)
|
||||
val sameDay = DateTimeUtil.isSameDay(currentTimeStamp, lastUpdateTime)
|
||||
LineModel.getBusLinesCallbackMap().forEach { callback ->
|
||||
callback.value.onRefreshSuccess(currentTimeStamp)
|
||||
}
|
||||
if (isBackground) {
|
||||
if (currentRequest == lastChangeMd5 && sameDay) {
|
||||
return
|
||||
}
|
||||
}
|
||||
SharedPrefsMgr.getInstance().putString(EXECUTABLECHANGEMD5, currentRequest)
|
||||
OchChainLogManager.writeChainLog(
|
||||
"数据发生变化",
|
||||
"接口信息发生变化 $lastChangeMd5 new md5${currentRequest}"
|
||||
)
|
||||
val startTime = System.currentTimeMillis()
|
||||
CarExecutableTaskResponse.save2Db(data)
|
||||
d(TAG,"更新数据耗时${System.currentTimeMillis()-startTime}")
|
||||
RxUtils.createSubscribe(800) {
|
||||
// 等待写入数据库
|
||||
LineModel.getBusLinesCallbackMap().forEach { callback ->
|
||||
callback.value.onRefreshSuccessWIthData()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onError() {
|
||||
isRequesting.set(false)
|
||||
d(TAG,"同步数据失败 onError")
|
||||
RxUtils.disposeSubscribe(queryCarInfo)
|
||||
queryCarInfo = RxUtils.createSubscribe(60_000) {
|
||||
queryCarExecutableTaskList(true)
|
||||
}
|
||||
if (!isBackground) {
|
||||
if (!NetworkUtils.isConnected(AbsMogoApplication.getApp())) {
|
||||
ToastUtils.showShort(ResourcesUtils.getString(R.string.network_error_tip))
|
||||
} else {
|
||||
ToastUtils.showShort(ResourcesUtils.getString(R.string.request_error_tip))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, failMsg: String) {
|
||||
isRequesting.set(false)
|
||||
d(TAG,"同步数据失败 onFail")
|
||||
RxUtils.disposeSubscribe(queryCarInfo)
|
||||
queryCarInfo = RxUtils.createSubscribe(60_000) {
|
||||
queryCarExecutableTaskList(true)
|
||||
}
|
||||
if (!isBackground) {
|
||||
if (!NetworkUtils.isConnected(AbsMogoApplication.getApp())) {
|
||||
ToastUtils.showShort("网络异常,请稍后重试")
|
||||
} else {
|
||||
ToastUtils.showShort(failMsg)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private val waitSysData = mutableSetOf<Long>()
|
||||
private val isRequestingContrainInfo = AtomicBoolean(false)
|
||||
|
||||
|
||||
fun synContraiInfo(needUpdatePoint: MutableList<Long>) {
|
||||
|
||||
waitSysData.addAll(needUpdatePoint)
|
||||
if(isRequestingContrainInfo.get()){
|
||||
// 正在请求
|
||||
OchChainLogManager.writeChainLogNet(false,"同步轨迹","正在同步轨迹请稍等 ")
|
||||
return
|
||||
}
|
||||
isRequestingContrainInfo.set(true)
|
||||
|
||||
val lines = mutableListOf<Long>()
|
||||
waitSysData.forEach {
|
||||
lines.add(it)
|
||||
}
|
||||
OchChainLogManager.writeChainLogNet(false,"同步轨迹","轨迹变更需同步禁行点和途径点 线路:${lines}")
|
||||
RepositoryManager.queryPointFromNet(lines)
|
||||
?.subscribeOn(Schedulers.io())
|
||||
?.observeOn(Schedulers.io())
|
||||
?.subscribe(object : Observer<List<PointResponse>> {
|
||||
override fun onSubscribe(d: Disposable) {
|
||||
d(TAG, "queryPointsByLinesId onSubscribe")
|
||||
}
|
||||
|
||||
override fun onError(e: Throwable) {
|
||||
d(TAG, "同步轨迹 onError${e.printStackTrace()} 同步轨迹失败 5s种后重试 线路:${lines}")
|
||||
OchChainLogManager.writeChainLogNet(false,"同步轨迹","同步轨迹失败 5s种后重试 线路:${lines}")
|
||||
RxUtils.createSubscribe(5_000){
|
||||
synContraiInfo(needUpdatePoint)
|
||||
}
|
||||
isRequestingContrainInfo.set(false)
|
||||
}
|
||||
|
||||
override fun onComplete() {
|
||||
d(TAG, "endTask onComplete")
|
||||
}
|
||||
|
||||
override fun onNext(data: List<PointResponse>) {
|
||||
try {
|
||||
PointDb.addOrUpdate(data)
|
||||
for (datum in data) {
|
||||
waitSysData.remove(datum.lineId)
|
||||
}
|
||||
isRequestingContrainInfo.set(false)
|
||||
if(waitSysData.isNotEmpty()){
|
||||
synContraiInfo(needUpdatePoint)
|
||||
}
|
||||
OchChainLogManager.writeChainLogNet(false,"同步轨迹","网络请求重构 轨迹信息${data}")
|
||||
d(TAG, "同步轨迹网络成功")
|
||||
}catch (e:Exception){
|
||||
OchChainLogManager.writeChainLogDb("同步轨迹","同步轨迹时报错 轨迹信息${data} 错误信息${e.message}")
|
||||
synContraiInfo(needUpdatePoint)
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun release() {
|
||||
isRequesting.set(false)
|
||||
RxUtils.disposeSubscribe(queryCarInfo)
|
||||
}
|
||||
}
|
||||
@@ -126,8 +126,8 @@ object ThirdDeviceData {
|
||||
LedScreenManager.sendTripInfo2Led(
|
||||
LedScreenManager.LEAVE_STATION,
|
||||
lineInfo.lineName,
|
||||
start.name,
|
||||
end.name,
|
||||
start.name?:"",
|
||||
end.name?:"",
|
||||
LineModel.isLastStation() == true
|
||||
)
|
||||
}
|
||||
@@ -146,8 +146,8 @@ object ThirdDeviceData {
|
||||
LedScreenManager.sendTripInfo2Led(
|
||||
LedScreenManager.ARRIVE_STATION,
|
||||
lineInfo.lineName,
|
||||
start.name,
|
||||
end.name,
|
||||
start.name?:"",
|
||||
end.name?:"",
|
||||
LineModel.isLastStation(end)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.mogo.och.weaknet.bean.WaitUploadLine
|
||||
import com.mogo.och.weaknet.bean.WriteOffPassenger
|
||||
import com.mogo.och.weaknet.bean.request.ShuttleEventRequest
|
||||
import com.mogo.och.weaknet.bean.response.CarExecutableTaskResponse
|
||||
import com.mogo.och.weaknet.bean.response.PointResponse
|
||||
import com.mogo.och.weaknet.repository.db.MyDataBase
|
||||
import com.mogo.och.weaknet.repository.db.bean.LineDataBean
|
||||
import com.mogo.och.weaknet.repository.db.bean.TaskDataBean
|
||||
@@ -183,6 +184,13 @@ object RepositoryManager {
|
||||
}
|
||||
}
|
||||
|
||||
fun queryPointFromNet(lines: MutableList<Long>): Observable<MutableList<PointResponse>>? {
|
||||
if (lineRepository is WeaknetRepository) {
|
||||
return lineRepository?.queryPointsByLineIds(lines)
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
fun reportCabinEvent(
|
||||
context: Context?,
|
||||
data: ShuttleEventRequest?,
|
||||
|
||||
@@ -6,16 +6,17 @@ import androidx.room.Room
|
||||
import androidx.room.RoomDatabase
|
||||
import androidx.room.migration.Migration
|
||||
import androidx.sqlite.db.SupportSQLiteDatabase
|
||||
import androidx.sqlite.db.SupportSQLiteOpenHelper
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.env.Project
|
||||
import com.mogo.commons.env.ProjectUtils
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.util.FileUtils
|
||||
import com.mogo.och.weaknet.repository.db.bean.ContrailDataBean
|
||||
import com.mogo.och.weaknet.repository.db.bean.EventDataBean
|
||||
import com.mogo.och.weaknet.repository.db.bean.LineDataBean
|
||||
import com.mogo.och.weaknet.repository.db.bean.PointDataBean
|
||||
import com.mogo.och.weaknet.repository.db.bean.SiteDataBean
|
||||
import com.mogo.och.weaknet.repository.db.bean.TaskDataBean
|
||||
import com.mogo.och.weaknet.repository.db.bean.TaskSiteDataBean
|
||||
@@ -23,17 +24,22 @@ import com.mogo.och.weaknet.repository.db.bean.WriteOffDataBean
|
||||
import com.mogo.och.weaknet.repository.db.dao.EventDataDao
|
||||
import com.mogo.och.weaknet.repository.db.dao.ContrailDataDao
|
||||
import com.mogo.och.weaknet.repository.db.dao.LineDataDao
|
||||
import com.mogo.och.weaknet.repository.db.dao.PointDataDao
|
||||
import com.mogo.och.weaknet.repository.db.dao.SiteDataDao
|
||||
import com.mogo.och.weaknet.repository.db.dao.TaskDataDao
|
||||
import com.mogo.och.weaknet.repository.db.dao.TaskSiteDataDao
|
||||
import com.mogo.och.weaknet.repository.db.dao.WriteOffDataDao
|
||||
import java.io.File
|
||||
import java.util.concurrent.Executors
|
||||
|
||||
//注解Database告诉系统这是Room数据库对象
|
||||
//entities指定该数据库有哪些表,多张表就逗号分隔
|
||||
//version指定数据库版本号,升级时需要用到
|
||||
//数据库继承自RoomDatabase
|
||||
@Database(entities = [ContrailDataBean::class, LineDataBean::class, SiteDataBean::class, TaskDataBean::class, TaskSiteDataBean::class, EventDataBean::class, WriteOffDataBean::class], version = 6)
|
||||
@Database(entities = [ContrailDataBean::class, LineDataBean::class,
|
||||
SiteDataBean::class, TaskDataBean::class, TaskSiteDataBean::class,
|
||||
EventDataBean::class, WriteOffDataBean::class,PointDataBean::class
|
||||
], version = 7)
|
||||
abstract class MyDataBase : RoomDatabase() {
|
||||
|
||||
private val dbRepositorys = mutableListOf<IDbRepository>()
|
||||
@@ -53,12 +59,18 @@ abstract class MyDataBase : RoomDatabase() {
|
||||
abstract val contrailDataDao: ContrailDataDao?
|
||||
abstract val eventDataDao: EventDataDao?
|
||||
abstract val lineDataDao: LineDataDao?
|
||||
abstract val pointDataDao: PointDataDao?
|
||||
abstract val siteDataDao: SiteDataDao?
|
||||
abstract val taskDataDao: TaskDataDao?
|
||||
abstract val taskSiteDataDao: TaskSiteDataDao?
|
||||
abstract val writeOffDataDao: WriteOffDataDao?
|
||||
|
||||
companion object {
|
||||
|
||||
|
||||
private val TAG = "MyDataBase"
|
||||
|
||||
|
||||
private val MIGRATION_1_2 = object : Migration(1, 2) {
|
||||
override fun migrate(database: SupportSQLiteDatabase) {
|
||||
database.execSQL("ALTER TABLE ${EventDataBean.tableName} ADD COLUMN driver_id INTEGER");
|
||||
@@ -95,6 +107,15 @@ abstract class MyDataBase : RoomDatabase() {
|
||||
}
|
||||
}
|
||||
|
||||
private val MIGRATION_6_7 = object : Migration(6, 7) {
|
||||
override fun migrate(database: SupportSQLiteDatabase) {
|
||||
database.execSQL("CREATE TABLE IF NOT EXISTS `${PointDataBean.tableName}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `line_id` INTEGER, `contrail_id` INTEGER, `site_id` INTEGER, `md5` TEXT, `seq` INTEGER, `point_type` INTEGER, `longitude` REAL, `latitude` REAL, `sub_seq` INTEGER)")
|
||||
database.execSQL("ALTER TABLE ${PointDataBean.tableName} ADD COLUMN contrail_id INTEGER")
|
||||
database.execSQL("ALTER TABLE ${PointDataBean.tableName} ADD COLUMN source INTEGER")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
fun getDBName():MyDataBase{
|
||||
val roomName = when (ProjectUtils.getProjectType()) {
|
||||
@@ -142,7 +163,9 @@ abstract class MyDataBase : RoomDatabase() {
|
||||
.addMigrations(MIGRATION_3_4)
|
||||
.addMigrations(MIGRATION_4_5)
|
||||
.addMigrations(MIGRATION_5_6)
|
||||
.addMigrations(MIGRATION_6_7)
|
||||
.fallbackToDestructiveMigration()
|
||||
.setQueryCallback({ sqlQuery, bindArgs -> CallerLogger.d(TAG,"sql:$sqlQuery--->参数:$bindArgs") }, Executors.newSingleThreadExecutor())
|
||||
.build()
|
||||
}
|
||||
val ROOT_PATH = Environment.getExternalStorageDirectory().absolutePath + File.separator + "Mogo" + File.separator + "APP_cache" + File.separator //程序外部存储跟目录
|
||||
|
||||
@@ -18,6 +18,12 @@ data class ContrailDataBean(
|
||||
@ColumnInfo(name = "line_id", typeAffinity = ColumnInfo.INTEGER, index = true)
|
||||
var lineId: Long? = null,
|
||||
|
||||
/**
|
||||
* 轨迹id
|
||||
*/
|
||||
@ColumnInfo(name = "contrail_id", typeAffinity = ColumnInfo.INTEGER)
|
||||
var contrailId: Long? = null,
|
||||
|
||||
/**
|
||||
* csv格式的轨迹文件
|
||||
*/
|
||||
@@ -54,9 +60,17 @@ data class ContrailDataBean(
|
||||
@ColumnInfo(name = "md5", typeAffinity = ColumnInfo.TEXT, index = true)
|
||||
var md5: String? = null,
|
||||
|
||||
/**
|
||||
* 轨迹id
|
||||
*/
|
||||
@ColumnInfo(name = "source", typeAffinity = ColumnInfo.INTEGER)
|
||||
var source: Int? = null,
|
||||
|
||||
|
||||
) {
|
||||
companion object {
|
||||
const val tableName: String = "contrail_data_table"
|
||||
const val SOURCETYPEROUTING = 2
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.mogo.och.weaknet.repository.db.bean
|
||||
|
||||
import androidx.room.ColumnInfo
|
||||
import androidx.room.Entity
|
||||
import androidx.room.PrimaryKey
|
||||
import com.mogo.och.data.bean.BusStationBean
|
||||
|
||||
@Entity(tableName = PointDataBean.tableName)
|
||||
data class PointDataBean(
|
||||
|
||||
@PrimaryKey(autoGenerate = true) var id: Int = 0,
|
||||
|
||||
/**
|
||||
* 点所属线路Id
|
||||
*/
|
||||
@ColumnInfo(name = "line_id", typeAffinity = ColumnInfo.INTEGER)
|
||||
var lineId: Long? = null,
|
||||
|
||||
/**
|
||||
* 轨迹id
|
||||
*/
|
||||
@ColumnInfo(name = "contrail_id", typeAffinity = ColumnInfo.INTEGER)
|
||||
var contrailId: Long? = null,
|
||||
|
||||
/**
|
||||
* A--B--C--D
|
||||
* A--B 的途径点 siteId = B.id
|
||||
* B--C 的途径点 siteId = C.id
|
||||
* C--D 的途径点 siteId = D.id
|
||||
*/
|
||||
@ColumnInfo(name = "site_id", typeAffinity = ColumnInfo.INTEGER)
|
||||
var siteId: Long? = null,
|
||||
|
||||
/**
|
||||
* ContrailDataBean 表格中的md5值
|
||||
*/
|
||||
@ColumnInfo(name = "md5", typeAffinity = ColumnInfo.TEXT)
|
||||
var md5: String? = null,
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 排队组
|
||||
*/
|
||||
@ColumnInfo(name = "seq", typeAffinity = ColumnInfo.INTEGER)
|
||||
var seq: Int? = null,
|
||||
|
||||
/**
|
||||
* 点的类型
|
||||
*/
|
||||
@ColumnInfo(name = "point_type", typeAffinity = ColumnInfo.INTEGER)
|
||||
var pointType: Int? = null,
|
||||
|
||||
/**
|
||||
* 高精坐标
|
||||
*/
|
||||
@ColumnInfo(name = "longitude", typeAffinity = ColumnInfo.REAL)
|
||||
var longitude: Double? = null,
|
||||
|
||||
/**
|
||||
* 高精坐标
|
||||
*/
|
||||
@ColumnInfo(name = "latitude", typeAffinity = ColumnInfo.REAL)
|
||||
var latitude: Double? = null,
|
||||
|
||||
/**
|
||||
* 组内排序
|
||||
*/
|
||||
@ColumnInfo(name = "sub_seq", typeAffinity = ColumnInfo.INTEGER)
|
||||
var subSeq: Int? = null,
|
||||
|
||||
) {
|
||||
fun toStation(): BusStationBean {
|
||||
val temp = BusStationBean()
|
||||
temp.lat = latitude?:0.0
|
||||
temp.lon = longitude?:0.0
|
||||
temp.pointType = pointType?:pointTypePass
|
||||
temp.isLeaving = true
|
||||
return temp
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val tableName = "point_data_table"
|
||||
const val pointTypePass = 1
|
||||
const val pointTypeBlack = 2
|
||||
}
|
||||
}
|
||||
@@ -38,7 +38,8 @@ interface ContrailDataDao {
|
||||
queryContrailByLineId.first()
|
||||
}
|
||||
}
|
||||
|
||||
@Query("UPDATE ${ContrailDataBean.tableName} SET contrail_id = :contrailId ,source = :source WHERE line_id = :lineId")
|
||||
fun updateIdAndSource(contrailId: Long, source: Int, lineId: Long)
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.mogo.och.weaknet.repository.db.dao
|
||||
|
||||
import androidx.room.Dao
|
||||
import androidx.room.Delete
|
||||
import androidx.room.Insert
|
||||
import androidx.room.OnConflictStrategy
|
||||
import androidx.room.Query
|
||||
import androidx.room.Transaction
|
||||
import com.mogo.och.weaknet.repository.db.bean.PointDataBean
|
||||
|
||||
@Dao
|
||||
interface PointDataDao {
|
||||
//插入数据
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
fun insert(vararg lineDataBean: PointDataBean)
|
||||
|
||||
//插入数据
|
||||
@Transaction
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
fun insertTra(vararg lineDataBean: PointDataBean)
|
||||
|
||||
|
||||
//删除数据
|
||||
@Delete
|
||||
fun delete(vararg lineDataBean: PointDataBean)
|
||||
|
||||
|
||||
// 线路删除时同步删除所属轨迹信息
|
||||
@Transaction
|
||||
@Query("DELETE FROM ${PointDataBean.tableName} WHERE line_id in (:lineId)")
|
||||
fun deleteByLineIdTra(lineId: List<Long>)
|
||||
|
||||
@Transaction
|
||||
@Query("DELETE FROM ${PointDataBean.tableName} WHERE line_id in (:lineId)")
|
||||
fun deleteByLineId(lineId: List<Long>)
|
||||
|
||||
@Query("SELECT * FROM ${PointDataBean.tableName} WHERE line_id = :lineId")
|
||||
fun queryPointByLineId(lineId: Long) : List<PointDataBean>?
|
||||
}
|
||||
@@ -2,6 +2,8 @@ package com.mogo.och.weaknet.repository.db.repository
|
||||
|
||||
import com.mogo.eagle.core.network.utils.digest.DigestUtils
|
||||
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
||||
import com.mogo.och.weaknet.model.SynchDataModel
|
||||
import com.mogo.och.weaknet.repository.RepositoryManager
|
||||
import com.mogo.och.weaknet.repository.db.IDbRepository
|
||||
import com.mogo.och.weaknet.repository.db.MyDataBase
|
||||
import com.mogo.och.weaknet.repository.db.bean.ContrailDataBean
|
||||
@@ -26,6 +28,7 @@ object ContraiDb : IDbRepository {
|
||||
val runnable = Runnable {
|
||||
// 校验数据个数
|
||||
contrailDao?.let { contrailDao->
|
||||
val needUpdatePoint = mutableListOf<Long>()
|
||||
contrailDatalist.forEach {
|
||||
val md5Source = it.toString()
|
||||
val md5Hex = DigestUtils.md5Hex(md5Source)
|
||||
@@ -33,6 +36,7 @@ object ContraiDb : IDbRepository {
|
||||
if(queryContrailByMd5.isNullOrEmpty()){// 没有值或者值有变化
|
||||
val needUpdate = contrailDao.queryContrailByLineIdOne(it.lineId!!)
|
||||
it.md5 = md5Hex
|
||||
needUpdatePoint.add(it.lineId!!)
|
||||
if(needUpdate!=null){// 更新
|
||||
it.id = needUpdate.id
|
||||
contrailDao.update(it.csvFileUrl?:"",it.csvFileMd5?:"",it.txtFileUrl?:"",it.txtFileMd5?:"",System.currentTimeMillis(),md5Hex,needUpdate.id)
|
||||
@@ -41,6 +45,9 @@ object ContraiDb : IDbRepository {
|
||||
}
|
||||
}
|
||||
}
|
||||
if(needUpdatePoint.isNotEmpty()){
|
||||
SynchDataModel.synContraiInfo(needUpdatePoint)
|
||||
}
|
||||
}
|
||||
}
|
||||
BizLoopManager.runInIoThread(runnable)
|
||||
@@ -75,4 +82,10 @@ object ContraiDb : IDbRepository {
|
||||
addOrUpdate(mutableListOf(runningLine))
|
||||
}
|
||||
|
||||
fun upDateIdAndsource(contrailId: Long?, source: Int?, lineId: Long?) {
|
||||
if(contrailId!=null&&source!=null&&lineId!=null){
|
||||
contrailDao?.updateIdAndSource(contrailId,source,lineId)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
package com.mogo.och.weaknet.repository.db.repository
|
||||
|
||||
import com.mogo.och.weaknet.bean.response.PointResponse
|
||||
import com.mogo.och.weaknet.repository.db.IDbRepository
|
||||
import com.mogo.och.weaknet.repository.db.MyDataBase
|
||||
import com.mogo.och.weaknet.repository.db.bean.ContrailDataBean
|
||||
import com.mogo.och.weaknet.repository.db.bean.PointDataBean
|
||||
import com.mogo.och.weaknet.repository.db.dao.PointDataDao
|
||||
|
||||
object PointDb: IDbRepository {
|
||||
|
||||
private var pointDao: PointDataDao?=null
|
||||
get() {
|
||||
if(field==null){
|
||||
field = MyDataBase.instance?.pointDataDao
|
||||
register()
|
||||
}
|
||||
return field
|
||||
}
|
||||
|
||||
|
||||
override fun release() {
|
||||
pointDao = null
|
||||
}
|
||||
|
||||
fun queryPointByLineId(lineId: Long?): List<PointDataBean>? {
|
||||
lineId?.let {
|
||||
return pointDao?.queryPointByLineId(lineId)
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
fun addOrUpdate(serverDataList:List<PointResponse>) {
|
||||
val contaiBeans = mutableListOf<PointDataBean>()
|
||||
val needDelete = mutableListOf<Long>()
|
||||
val needUpdateLineInfos = mutableListOf<ContrailDataBean>()
|
||||
|
||||
serverDataList.forEach { contrailInfo ->
|
||||
val lineId = contrailInfo.lineId
|
||||
val siteList = SiteDb.querySiteByLineId(lineId)
|
||||
val contraiBean = ContraiDb.queryAutopilotInfoByLineid(lineId)
|
||||
|
||||
contraiBean?.let {
|
||||
contraiBean.source = contrailInfo.source
|
||||
contraiBean.contrailId = contrailInfo.contrailId
|
||||
needUpdateLineInfos.add(contraiBean)
|
||||
}
|
||||
|
||||
val segmentPointList = contrailInfo.segmentPointList
|
||||
needDelete.add(lineId)
|
||||
segmentPointList.forEachIndexed { index, segmentPoint ->
|
||||
val siteIndex = segmentPoint.segment
|
||||
siteList?.let { siteListTemp->
|
||||
siteIndex?.let {siteIndexTemp->
|
||||
// 途径点和禁行点所有站点
|
||||
val siteDataBean = siteListTemp[siteIndexTemp]
|
||||
segmentPoint.pointList?.forEachIndexed { index, point ->
|
||||
val pointTemp = PointDataBean()
|
||||
pointTemp.lineId = lineId
|
||||
pointTemp.contrailId = contrailInfo.contrailId
|
||||
pointTemp.siteId = siteDataBean.siteId
|
||||
pointTemp.md5 = contraiBean?.md5?:""
|
||||
pointTemp.seq = siteIndex
|
||||
pointTemp.pointType = PointDataBean.pointTypePass
|
||||
pointTemp.longitude = point.longitude
|
||||
pointTemp.latitude = point.latitude
|
||||
pointTemp.subSeq = index
|
||||
contaiBeans.add(pointTemp)
|
||||
}
|
||||
segmentPoint.blackList?.forEachIndexed { index, black ->
|
||||
val pointTemp = PointDataBean()
|
||||
pointTemp.lineId = lineId
|
||||
pointTemp.contrailId = contrailInfo.contrailId
|
||||
pointTemp.siteId = siteDataBean.siteId
|
||||
pointTemp.md5 = contraiBean?.md5?:""
|
||||
pointTemp.seq = siteIndex
|
||||
pointTemp.pointType = PointDataBean.pointTypeBlack
|
||||
pointTemp.longitude = black.longitude
|
||||
pointTemp.latitude = black.latitude
|
||||
pointTemp.subSeq = index
|
||||
contaiBeans.add(pointTemp)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(needUpdateLineInfos.size<100){
|
||||
needUpdateLineInfos.forEach {
|
||||
ContraiDb.upDateIdAndsource(it.contrailId,it.source,it.lineId)
|
||||
}
|
||||
}else{
|
||||
MyDataBase.instance?.runInTransaction{
|
||||
needUpdateLineInfos.forEach {
|
||||
ContraiDb.upDateIdAndsource(it.contrailId,it.source,it.lineId)
|
||||
}
|
||||
}
|
||||
}
|
||||
if(needDelete.size<100) {
|
||||
pointDao?.deleteByLineId(needDelete)
|
||||
}else{
|
||||
pointDao?.deleteByLineIdTra(needDelete)
|
||||
}
|
||||
if(contaiBeans.size<100) {
|
||||
pointDao?.insert(*contaiBeans.toTypedArray())
|
||||
}else{
|
||||
pointDao?.insertTra(*contaiBeans.toTypedArray())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -3,7 +3,6 @@ package com.mogo.och.weaknet.repository.db.repository
|
||||
import androidx.room.Transaction
|
||||
import com.mogo.eagle.core.network.utils.digest.DigestUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.util.TAG
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
||||
import com.mogo.och.weaknet.repository.db.IDbRepository
|
||||
@@ -13,6 +12,8 @@ import com.mogo.och.weaknet.repository.db.dao.SiteDataDao
|
||||
|
||||
object SiteDb: IDbRepository {
|
||||
|
||||
private const val TAG = "SiteDb"
|
||||
|
||||
private var siteDataDao: SiteDataDao? = null
|
||||
get() {
|
||||
if(field==null){
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.och.common.module.network.OchCommonServiceCallback
|
||||
import com.mogo.och.weaknet.bean.request.ShuttleEventRequest
|
||||
import com.mogo.och.weaknet.bean.response.CarExecutableTaskResponse
|
||||
import com.mogo.och.weaknet.bean.response.PointResponse
|
||||
import com.mogo.och.weaknet.repository.db.bean.LineDataBean
|
||||
import com.mogo.och.weaknet.repository.db.bean.TaskDataBean
|
||||
import io.reactivex.Observable
|
||||
@@ -44,4 +45,6 @@ interface ILineRepository {
|
||||
fun release()
|
||||
fun endTaskByOther(taskId: Long) {}
|
||||
|
||||
fun queryPointsByLineIds(lines: MutableList<Long>): Observable<MutableList<PointResponse>>?
|
||||
|
||||
}
|
||||
@@ -16,6 +16,7 @@ import com.mogo.och.data.bean.ContraiInfo
|
||||
import com.mogo.och.data.bean.LineInfo
|
||||
import com.mogo.och.weaknet.bean.request.ShuttleEventRequest
|
||||
import com.mogo.och.weaknet.bean.response.CarExecutableTaskResponse
|
||||
import com.mogo.och.weaknet.bean.response.PointResponse
|
||||
import com.mogo.och.weaknet.model.LineModel
|
||||
import com.mogo.och.weaknet.repository.db.bean.LineDataBean
|
||||
import com.mogo.och.weaknet.repository.db.bean.TaskDataBean
|
||||
@@ -184,6 +185,10 @@ class NormalRepository: ILineRepository {
|
||||
|
||||
}
|
||||
|
||||
override fun queryPointsByLineIds(lines: MutableList<Long>): Observable<MutableList<PointResponse>>? {
|
||||
return Observable.just(ArrayList<PointResponse>())
|
||||
}
|
||||
|
||||
override fun reportCabinEvent(
|
||||
context: Context?,
|
||||
data: ShuttleEventRequest?,
|
||||
|
||||
@@ -16,12 +16,15 @@ import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||
import com.mogo.och.common.module.network.OchCommonServiceCallback
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||
import com.mogo.och.data.bean.ContraiInfo
|
||||
import com.mogo.och.weaknet.bean.request.QueryPointRequest
|
||||
import com.mogo.och.weaknet.bean.request.ShuttleEventRequest
|
||||
import com.mogo.och.weaknet.bean.response.BusRoutesResponse
|
||||
import com.mogo.och.weaknet.bean.response.CarExecutableTaskResponse
|
||||
import com.mogo.och.weaknet.bean.response.PointResponse
|
||||
import com.mogo.och.weaknet.constant.BusConst
|
||||
import com.mogo.och.weaknet.model.LineModel
|
||||
import com.mogo.och.weaknet.model.LineModel.currentTask
|
||||
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.TaskDataBean
|
||||
import com.mogo.och.weaknet.repository.db.bean.TaskSiteDataBean
|
||||
@@ -102,7 +105,7 @@ class WeaknetRepository : ILineRepository {
|
||||
TaskSiteDb.deleteErrorData(it)
|
||||
return@flatMap loadServerRuningTask(1)
|
||||
}
|
||||
val db2Beans = BusRoutesResponse.db2Beans(runnintTaskAndSites)
|
||||
val db2Beans = BusRoutesResponse.db2Beans(runnintTaskAndSites,currentTask!!.lineId)
|
||||
LineModel.stationList = db2Beans.first
|
||||
LineModel.startStationIndex = db2Beans.second
|
||||
LineModel.stationList?.let { stationlist->
|
||||
@@ -123,7 +126,7 @@ class WeaknetRepository : ILineRepository {
|
||||
OchChainLogManager.writeChainLogAutopilot("轨迹错误",this.toString())
|
||||
CallerLogger.d(TAG,"轨迹错误,$this")
|
||||
}
|
||||
LineManager.setContraiInfo(ContraiInfo(lineId!!,csvFileUrl!!,csvFileMd5!!,txtFileUrl!!,txtFileMd5!!,contrailSaveTime!!))
|
||||
LineManager.setContraiInfo(ContraiInfo(lineId!!,csvFileUrl!!,csvFileMd5!!,txtFileUrl!!,txtFileMd5!!,contrailSaveTime!!, source = source?: ContrailDataBean.SOURCETYPEROUTING))
|
||||
}
|
||||
}
|
||||
return@flatMap Observable.just(true)
|
||||
@@ -479,6 +482,11 @@ class WeaknetRepository : ILineRepository {
|
||||
weakNetInterface?.queryCarExecutableTaskList(context,ochCommonServiceCallback)
|
||||
}
|
||||
|
||||
override fun queryPointsByLineIds(lines: MutableList<Long>): Observable<MutableList<PointResponse>>? {
|
||||
val request = QueryPointRequest(LoginStatusManager.getOchBizInfo()?.businessType?:0,lines)
|
||||
return weakNetInterface?.queryPointsByLinesId(context,request)
|
||||
}
|
||||
|
||||
override fun reportCabinEvent(
|
||||
context: Context?,
|
||||
data: ShuttleEventRequest?,
|
||||
|
||||