[5.2.9]
[shuttle] [核销人数]
This commit is contained in:
@@ -28,6 +28,9 @@ import com.mogo.och.common.module.biz.network.OchCommonServiceCallback
|
||||
import com.mogo.och.common.module.manager.loopmanager.BizLoopManager
|
||||
import com.mogo.och.common.module.manager.loopmanager.LoopInfo
|
||||
import com.mogo.och.common.module.voice.VoiceNotice.showNotice
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.ObservableEmitter
|
||||
import io.reactivex.ObservableOnSubscribe
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
|
||||
object TicketModel : IReceivedMsgListener, IMogoOnMessageListener<WriteOffPassenger> {
|
||||
@@ -36,6 +39,10 @@ object TicketModel : IReceivedMsgListener, IMogoOnMessageListener<WriteOffPassen
|
||||
|
||||
private val SELECTWRITEOFFCOUNT = "SELECTWRITEOFFCOUNT"
|
||||
|
||||
private var emitterMain: ObservableEmitter<Int>?=null
|
||||
|
||||
private val observable = Observable.create(ObservableOnSubscribe<Int> { emitter -> emitterMain = emitter })
|
||||
|
||||
init {
|
||||
|
||||
//监听乘客屏发来的消息
|
||||
@@ -91,11 +98,14 @@ object TicketModel : IReceivedMsgListener, IMogoOnMessageListener<WriteOffPassen
|
||||
val busRoutesResult = OrderModel.getInstance().busRoutesResult?:return
|
||||
val busNextStation = OrderModel.getInstance().busNextStation?:return
|
||||
OrderServiceManager.queryBusTaskByLineId(AbsMogoApplication.getApp(),
|
||||
"${busRoutesResult.lineId}",
|
||||
"${busRoutesResult.taskId}",
|
||||
"${busNextStation.siteId}",
|
||||
object :OchCommonServiceCallback<WriteOffCountResponse>{
|
||||
override fun onSuccess(data: WriteOffCountResponse?) {
|
||||
|
||||
data?.data?.let {
|
||||
emitterMain?.onNext(it)
|
||||
d(SceneConstant.M_BUS + TAG, "${busNextStation.name}核销人数:${it}")
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String?) {
|
||||
@@ -104,6 +114,10 @@ object TicketModel : IReceivedMsgListener, IMogoOnMessageListener<WriteOffPassen
|
||||
})
|
||||
}
|
||||
|
||||
fun getWriteOffCountObservable():Observable<Int>{
|
||||
return observable
|
||||
}
|
||||
|
||||
private fun receiveWrteOffInfo(writeOffMsg: WriteOffMsg?) {
|
||||
if(writeOffMsg!=null) {
|
||||
if (writeOffMsg.isScuccess != null) {
|
||||
|
||||
@@ -206,14 +206,14 @@ object OrderServiceManager {
|
||||
@JvmStatic
|
||||
fun queryBusTaskByLineId(
|
||||
context: Context,
|
||||
lineId: String?,
|
||||
taskId: String?,
|
||||
siteId: String?,
|
||||
callback: OchCommonServiceCallback<WriteOffCountResponse>?
|
||||
) {
|
||||
mService.writeOffCount(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
lineId,
|
||||
taskId,
|
||||
siteId
|
||||
)
|
||||
.transformTry()
|
||||
|
||||
@@ -7,6 +7,7 @@ import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.findViewTreeViewModelStoreOwner
|
||||
import com.mogo.och.bus.R
|
||||
import kotlinx.android.synthetic.main.shuttle_wirte_off_view.view.tv_write_off_count
|
||||
|
||||
class WriteOffView : ConstraintLayout, WriteOffViewModel.IwriteOffViewCallback {
|
||||
|
||||
@@ -45,5 +46,9 @@ class WriteOffView : ConstraintLayout, WriteOffViewModel.IwriteOffViewCallback {
|
||||
}
|
||||
}
|
||||
|
||||
override fun setWriteOffCount(showText: String) {
|
||||
tv_write_off_count.text = showText
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,29 +1,68 @@
|
||||
package com.mogo.och.bus.ui.writeoff
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.och.bus.R
|
||||
import com.mogo.och.bus.model.TicketModel
|
||||
import com.mogo.och.common.module.utils.RxUtils
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.Observer
|
||||
import io.reactivex.disposables.Disposable
|
||||
|
||||
class WriteOffViewModel: ViewModel() {
|
||||
class WriteOffViewModel : ViewModel() {
|
||||
|
||||
private val TAG = WriteOffViewModel::class.java.simpleName
|
||||
|
||||
private var viewCallback:IwriteOffViewCallback?=null
|
||||
private var viewCallback: IwriteOffViewCallback? = null
|
||||
|
||||
init {
|
||||
|
||||
}
|
||||
|
||||
fun setWriteOffCallback(viewCallback:IwriteOffViewCallback){
|
||||
this.viewCallback = viewCallback
|
||||
}
|
||||
private var disposable: Disposable? = null
|
||||
|
||||
private val observer = object : Observer<String> {
|
||||
override fun onSubscribe(d: Disposable) {
|
||||
disposable = d
|
||||
}
|
||||
|
||||
override fun onError(e: Throwable) {
|
||||
|
||||
}
|
||||
|
||||
override fun onComplete() {
|
||||
|
||||
}
|
||||
|
||||
override fun onNext(countInfo: String) {
|
||||
viewCallback?.setWriteOffCount(countInfo)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun setWriteOffCallback(viewCallback: IwriteOffViewCallback) {
|
||||
this.viewCallback = viewCallback
|
||||
TicketModel
|
||||
.getWriteOffCountObservable()
|
||||
.flatMap { t ->
|
||||
val showText =
|
||||
AbsMogoApplication.getApp().getString(R.string.shuttle_write_off_count, t)
|
||||
CallerLogger.d(SceneConstant.M_BUS + TAG, "显示文案:${showText}")
|
||||
Observable.just(showText)
|
||||
}
|
||||
.subscribe(observer)
|
||||
}
|
||||
|
||||
override fun onCleared() {
|
||||
super.onCleared()
|
||||
this.viewCallback = null
|
||||
|
||||
RxUtils.disposeSubscribe(disposable)
|
||||
}
|
||||
|
||||
interface IwriteOffViewCallback{
|
||||
|
||||
interface IwriteOffViewCallback {
|
||||
fun setWriteOffCount(count:String)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,7 +8,7 @@
|
||||
android:id="@+id/no_line_data_view">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/no_order_data_tv"
|
||||
android:id="@+id/tv_write_off_count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/shuttle_driver_cad6ff"
|
||||
@@ -17,5 +17,5 @@
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:text="@string/shuttle_write_off_count"/>
|
||||
android:text="@string/shuttle_write_off_count_default"/>
|
||||
</merge>
|
||||
@@ -39,7 +39,8 @@
|
||||
<string name="bus_dialog_cancel">取消</string>
|
||||
|
||||
<string name="bus_no_task_tip">暂无任务</string>
|
||||
<string name="shuttle_write_off_count">本站核销成功:%1$s人</string>
|
||||
<string name="shuttle_write_off_count">本站核销成功:%1$d人</string>
|
||||
<string name="shuttle_write_off_count_default">本站核销成功:0人</string>
|
||||
|
||||
|
||||
<!-- region tts -->
|
||||
|
||||
Reference in New Issue
Block a user