[fix]
[实时系统 处理错误]
This commit is contained in:
yangyakun
2024-11-01 19:23:19 +08:00
parent a8329efb83
commit fb591a551a
7 changed files with 106 additions and 3 deletions

View File

@@ -220,7 +220,15 @@ object LineModel {
override fun onError(e: Throwable) {
d(TAG, "commitSwitchLineId onError${e.printStackTrace()}")
if (e is DataException) {
if(RepositoryManager.supportDb()) {
if (e is DataException) {
OchChainLogManager.writeChainLog("开始任务", "${e.message}")
ToastUtils.showShort("选择任务失败:${e.message}")
mBusLinesCallbackMap.forEach {
it.value.onChangeLineIdFail()
}
}
}else{
OchChainLogManager.writeChainLog("开始任务", "${e.message}")
ToastUtils.showShort("选择任务失败:${e.message}")
mBusLinesCallbackMap.forEach {

View File

@@ -20,6 +20,7 @@ import com.mogo.och.common.module.manager.loop.BizLoopManager
import com.mogo.och.common.module.utils.ResourcesUtils
import com.mogo.och.common.module.wigets.WindowRelativeLayout
import com.mogo.och.common.module.wigets.WrapContentLinearLayoutManager
import com.mogo.och.common.module.wigets.commonview.ErrorView
import com.mogo.och.shuttle.weaknet.R
import com.mogo.och.weaknet.model.LineModel
import com.mogo.och.weaknet.repository.RepositoryManager
@@ -29,6 +30,7 @@ import kotlinx.android.synthetic.main.shuttle_wadk_task_running.view.no_order_da
import kotlinx.android.synthetic.main.shuttle_weak_switch_line.view.aciv_refresh_task
import kotlinx.android.synthetic.main.shuttle_weak_switch_line.view.actv_last_refresh_date
import kotlinx.android.synthetic.main.shuttle_weak_switch_line.view.include_empty
import kotlinx.android.synthetic.main.shuttle_weak_switch_line.view.include_errorview
import kotlinx.android.synthetic.main.shuttle_weak_switch_line.view.switch_line_rv
import me.jessyan.autosize.utils.AutoSizeUtils
@@ -99,6 +101,12 @@ class SwitchLineView: WindowRelativeLayout, SwtichLineModel.SwtichLineViewCallba
}
animator?.start()
}
include_errorview.reloadLIstener = object :ErrorView.ReloadLIstener{
override fun reload() {
viewbizModel?.showSwitchLineInfo()
}
}
}
/**
@@ -151,6 +159,7 @@ class SwitchLineView: WindowRelativeLayout, SwtichLineModel.SwtichLineViewCallba
*/
private fun showNoData(b: Boolean) {
BizLoopManager.runInMainThread{
include_errorview.visibility = View.GONE
if (b) {
switch_line_rv.visibility = View.GONE
include_empty.visibility = View.VISIBLE
@@ -173,8 +182,12 @@ class SwitchLineView: WindowRelativeLayout, SwtichLineModel.SwtichLineViewCallba
}
override fun onBusLinesChangeFaile() {
include_errorview.visibility = View.VISIBLE
switch_line_rv.visibility = View.GONE
include_empty.visibility = View.GONE
viewbizModel?.showSwitchLineInfoResult()
}
}

View File

@@ -57,6 +57,7 @@ class SwtichLineModel : ViewModel(), IBusLinesCallback {
override fun onError(e: Throwable) {
d(LineModel.TAG, "queryBusLines onError${e.printStackTrace()}")
viewCallback?.onBusLinesChangeFaile()
}
override fun onComplete() {
@@ -93,6 +94,7 @@ class SwtichLineModel : ViewModel(), IBusLinesCallback {
fun startTaskState(success: Boolean)
fun onBusLinesChange(data: MutableList<LineDataBean>?,show:Boolean)
fun refreshDate(formatLongToString: String?)
fun onBusLinesChangeFaile()
}
override fun onRefreshSuccess(currentTimeStamp: Long) {

View File

@@ -60,4 +60,14 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<com.mogo.och.common.module.wigets.commonview.ErrorView
android:id="@+id/include_errorview"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</androidx.constraintlayout.widget.ConstraintLayout>