18034727885
2026-06-28 bb5cc01d905a93dba7eac44a0fb2dcad3d1f4006
修复问题
12个文件已修改
198 ■■■■■ 已修改文件
app/src/main/java/com/xw/yunwei/MyApp.kt 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/xw/yunwei/model/ClockInStatusModel.kt 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/xw/yunwei/push/MessageHandler.kt 126 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/xw/yunwei/ui/task/accident/detail/AccidentDetailVM.kt 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/xw/yunwei/ui/task/normal/NormalTaskDetailVM.kt 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/xw/yunwei/ui/work/car/detail/CarDetailActivity.kt 1 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/xw/yunwei/ui/work/car/detail/CarDetailVM.kt 4 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/xw/yunwei/ui/work/car/detail/operations/charge/ChargeCarVM.kt 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/xw/yunwei/ui/work/site/SiteNavActivity.kt 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/res/layout/activity_check_in.xml 4 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/res/layout/activity_site_nav.xml 1 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/res/layout/fragment_mine.xml 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/xw/yunwei/MyApp.kt
@@ -432,7 +432,7 @@
            activity,
            Constants.reasons,
        ) { position, input, dialog2 ->
            activity.viewModel.showDialog(content = "加载中...")
            activity.viewModel.showDialog(content = "改派中...")
            activity.viewModel.launchRequest(showLoading = false, error = { code, msg ->
                activity.viewModel.dismissDialog()
                ToastUtilCommon.showError(msg)
app/src/main/java/com/xw/yunwei/model/ClockInStatusModel.kt
@@ -2,6 +2,7 @@
import android.os.Parcelable
import com.google.gson.annotations.SerializedName
import com.xw.yunwei.extension.dateChangePattern
import kotlinx.parcelize.Parcelize
import java.util.Calendar
@@ -436,4 +437,33 @@
    fun hadLostOffWorkCheckedIn(): Boolean {
        return clockOutResult == 3
    }
    //获取上班打卡成功时间
    fun getFormateClockInTime(): String {
        return try {
            clockInTime?.let {
                val split = it.split(" ")
                val ymd = split[0].dateChangePattern("yyyy-MM-dd", "yyyy/MM/dd")
                "$ymd ${split[1]}"
            } ?: ""
        } catch (e: Exception) {
            e.printStackTrace()
            ""
        }
    }
    //获取下班打卡成功时间
    fun getFormateClockOutTime(): String {
        return try {
            clockOutTime?.let {
                val split = it.split(" ")
                val ymd = split[0].dateChangePattern("yyyy-MM-dd", "yyyy/MM/dd")
                "$ymd ${split[1]}"
            } ?: ""
        } catch (e: Exception) {
            e.printStackTrace()
            ""
        }
    }
}
app/src/main/java/com/xw/yunwei/push/MessageHandler.kt
@@ -21,6 +21,7 @@
import com.xw.yunwei.model.AgreeInfo
import com.xw.yunwei.model.SwitchTabMain
import com.xw.yunwei.model.SwitchTabTask
import com.xw.yunwei.net.TaskRepository
import com.xw.yunwei.net.UserRepository
import com.xw.yunwei.ui.MainActivity
import com.xw.yunwei.ui.task.TaskVM
@@ -34,7 +35,6 @@
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import org.greenrobot.eventbus.EventBus
@@ -50,6 +50,7 @@
object MessageHandler : KoinComponent {
    var TAG = "zmc-${this.javaClass.simpleName}"
    val userRepository: UserRepository by inject()
    val taskRepository: TaskRepository by inject()
    fun handlePushEvent(content: String?, isPush: Boolean = false) {
        try {
@@ -80,69 +81,88 @@
        val strategy = jsob.optInt("strategy")
        val type = jsob.optInt("type")
        val id = jsob.optString("id")
        GlobalScope.launch {
            val currentShowActivity = MyApp.myApp.getCurrentShowActivity()
            LogUtils.i(
                "zmc-MessageHandler", "handlePushEvent ${currentShowActivity.javaClass.name}"
            )
            handleMsg(currentShowActivity, strategy, id, isPush)
        }
        handleMsg(strategy, id, isPush)
    }
    private fun handleMsg(
        currentShowActivity: Activity,
        strategy: Int,
        id: String,
        isPush: Boolean
    ) {
        when (strategy) {
            1, 2, 3, 5 -> { // 1=新增事故,2=事故即将超时提示,3=事故超时提示,5=事故状态变更 点击都跳事故详情
                if (strategy == 5 && isPush) return
                currentShowActivity.startActivity(
                    Intent(currentShowActivity, AccidentDetailActivity::class.java).apply {
                        putExtra("taskId", id.toLong())
                    })
            }
        runOnMainThread {
            val currentShowActivity = MyApp.myApp.getCurrentShowActivity()
            LogUtils.i(
                "zmc-MessageHandler", "handlePushEvent ${currentShowActivity.javaClass.name}"
            )
            when (strategy) {
                1, 2, 3, 5 -> { // 1=新增事故,2=事故即将超时提示,3=事故超时提示,5=事故状态变更 点击都跳事故详情
                    if (strategy == 5 && isPush) return@runOnMainThread
                    checkTaskCouldInDetail(id) {
                        if (!it) {
                            ToastUtilCommon.showSuc("事故处理完成,已归档")
                            return@checkTaskCouldInDetail
                        }
                        currentShowActivity.startActivity(
                            Intent(currentShowActivity, AccidentDetailActivity::class.java).apply {
                                putExtra("taskId", id.toLong())
                            })
                    }
                }
            4 -> { // 排班信息变动
                currentShowActivity.startActivity(
                    Intent(currentShowActivity, SchedulingActivity::class.java)
                )
            }
            6, 7 -> { // 6=新增任务,7=任务过期提示  点击都跳任务详情
                if (isPush) return
                if (strategy == 6 && id == "0") { // 多条任务 跳转任务中心待处理页面
                    EventBus.getDefault().post(SwitchTabMain(1))
                    EventBus.getDefault().post(SwitchTabTask(2))
                4 -> { // 排班信息变动
                    currentShowActivity.startActivity(
                        Intent(
                            currentShowActivity,
                            MainActivity::class.java
                        )
                        Intent(currentShowActivity, SchedulingActivity::class.java)
                    )
                } else {
                    currentShowActivity.startActivity(
                        Intent(currentShowActivity, NormalTaskDetailActivity::class.java).apply {
                            putExtra("taskId", id.toLong())
                        })
                }
                6, 7 -> { // 6=新增任务,7=任务过期提示  点击都跳任务详情
                    if (isPush) return@runOnMainThread
                    if (strategy == 6 && id == "0") { // 多条任务 跳转任务中心待处理页面
                        EventBus.getDefault().post(SwitchTabMain(1))
                        EventBus.getDefault().post(SwitchTabTask(2))
                        currentShowActivity.startActivity(
                            Intent(
                                currentShowActivity,
                                MainActivity::class.java
                            )
                        )
                    } else {
                        currentShowActivity.startActivity(
                            Intent(
                                currentShowActivity,
                                NormalTaskDetailActivity::class.java
                            ).apply {
                                putExtra("taskId", id.toLong())
                            })
                    }
                }
                8, 12 -> { // 升级
                    if (strategy == 8 && isPush) return@runOnMainThread
                    showUpdateDialog(currentShowActivity)
                }
                9, 10 -> { // 变更协议内容
                    if (strategy == 9 && isPush) return@runOnMainThread
                    if (strategy == 9) {
                        currentShowActivity.startActivity(
                            Intent(currentShowActivity, ProtocolActivity::class.java)
                        )
                    } else {
                        MMKVManager.getInstance().saveBoolean(KeyPreferences.NEED_READ, true)
                        showProtocolDialog(currentShowActivity, true)
                    }
                }
            }
        }
    }
            8, 12 -> { // 升级
                if (strategy == 8 && isPush) return
                showUpdateDialog(currentShowActivity)
            }
            9, 10 -> { // 变更协议内容
                if (strategy == 9 && isPush) return
                if (strategy == 9) {
                    currentShowActivity.startActivity(
                        Intent(currentShowActivity, ProtocolActivity::class.java)
                    )
                } else {
                    MMKVManager.getInstance().saveBoolean(KeyPreferences.NEED_READ, true)
                    showProtocolDialog(currentShowActivity, true)
    //检测任务是否能够进入详情页
    private fun checkTaskCouldInDetail(taskId: String, block: (could: Boolean) -> Unit) {
        launchRequest {
            taskRepository.vehicleAccidentDetail(taskId)?.also {
                runOnMainThread {
                    block.invoke(it.status != 2)
                }
            }
        }
@@ -275,7 +295,7 @@
                    }
                }
                bind.btnRight.setOnClickListener {
                    if(checked.size!=list.size){
                    if (checked.size != list.size) {
                        ToastUtilCommon.showError("请勾选全部协议后再确认同意")
                        return@setOnClickListener
                    }
@@ -335,7 +355,7 @@
    }
    //运行在主线程
    private fun runOnMainThread(block: () -> Unit) {
    private fun runOnMainThread(block: suspend () -> Unit) {
        CoroutineScope(Dispatchers.Main + exceptionHandler).launch {
            block()
        }
app/src/main/java/com/xw/yunwei/ui/task/accident/detail/AccidentDetailVM.kt
@@ -245,13 +245,13 @@
            workRepository.unlockByType(map)
            when (type) {
                1 -> {
                    runOnMainThread { ToastUtilCommon.showSuc("车门已解锁") }
                    runOnMainThread { ToastUtilCommon.showSuc("车门解锁成功") }
                    hadCheckDoorStatus.postValue(false)
                    hadDoorOpened.postValue(true)
                }
                2 -> {
                    runOnMainThread { ToastUtilCommon.showSuc("后备箱已解锁") }
                    runOnMainThread { ToastUtilCommon.showSuc("后备箱解锁成功") }
                    hadCheckTrunkStatus.postValue(false)
                    hadTrunkOpened.postValue(true)
                }
@@ -424,7 +424,7 @@
            context,
            Constants.reasons,
        ) { position, input, dialog ->
            showDialog(content = "加载中...")
            showDialog(content = "改派中...")
            launchRequest(showLoading = false, error = { code, msg ->
                dismissDialog()
                ToastUtilCommon.showError(msg)
app/src/main/java/com/xw/yunwei/ui/task/normal/NormalTaskDetailVM.kt
@@ -424,7 +424,7 @@
            context,
            Constants.reasons,
        ) { position, input, dialog ->
            showDialog(content = "加载中...")
            showDialog(content = "改派中...")
            launchRequest(showLoading = false, error = { code, msg ->
                dismissDialog()
                ToastUtilCommon.showError(msg)
@@ -456,6 +456,7 @@
                    EventBus.getDefault().post(SwitchTabTask(4))
                }
            }
            delay(1000)
            finish()
        }
    }
app/src/main/java/com/xw/yunwei/ui/work/car/detail/CarDetailActivity.kt
@@ -29,6 +29,7 @@
        TabLayoutMediator(binding.tabs, binding.pager) { tab, positon ->
            tab.text = tabTitles[positon]
        }.attach()
        binding.pager.isUserInputEnabled = false
    }
    override fun setListener() {
app/src/main/java/com/xw/yunwei/ui/work/car/detail/CarDetailVM.kt
@@ -195,13 +195,13 @@
            workRepository.unlockByType(map)
            when (type) {
                1 -> {
                    runOnMainThread { ToastUtilCommon.showSuc("车门已解锁") }
                    runOnMainThread { ToastUtilCommon.showSuc("车门解锁成功") }
                    hadCheckDoorStatus.postValue(false)
                    hadDoorOpened.postValue(true)
                }
                2 -> {
                    runOnMainThread { ToastUtilCommon.showSuc("后备箱已解锁") }
                    runOnMainThread { ToastUtilCommon.showSuc("后备箱解锁成功") }
                    hadCheckTrunkStatus.postValue(false)
                    hadTrunkOpened.postValue(true)
                }
app/src/main/java/com/xw/yunwei/ui/work/car/detail/operations/charge/ChargeCarVM.kt
@@ -115,7 +115,7 @@
            block(false)
            return
        }
        if (leftCharge.value!!.toDouble() <= (chargeRecord.value?.xpChargingRecord?.startRemainingBattery
        if (leftCharge.value!!.toDouble() < (chargeRecord.value?.xpChargingRecord?.startRemainingBattery
                ?: 0)
        ) {
            ToastUtilCommon.showError("结束电量不得低于开始电量")
app/src/main/java/com/xw/yunwei/ui/work/site/SiteNavActivity.kt
@@ -35,6 +35,7 @@
import com.xw.yunwei.extension.drawableIdToDrawable
import com.xw.yunwei.extension.hideKeyboardAndClearFocus
import com.xw.yunwei.model.SiteModel
import com.xw.yunwei.model.sitePlaceHolder
import com.xw.yunwei.ui.work.AMapFragment
import com.xw.yunwei.utils.DialogFactory
import org.json.JSONArray
@@ -105,7 +106,7 @@
    override fun setObservable() {
        super.setObservable()
        viewModel.dataList.observe(this) {
        viewModel.dataList.observe(this) { it ->
//            if (it.isEmpty()) ToastUtilCommon.showWarn("未找到对应点位信息")
            adapter.setList(it)
            if (it.isEmpty() && !adapter.hasEmptyView()) {
@@ -117,7 +118,7 @@
                )
            }
            mapFrag.clearMarks()
            it.forEach {
            it.filter { it!= sitePlaceHolder }.forEach {
                val resId =
                    if (it.operationStatus !in arrayOf(3, 4)) com.xw.yunwei.R.mipmap.ic_map_site_g
                    else com.xw.yunwei.R.mipmap.ic_map_site_r
@@ -231,10 +232,6 @@
            skipCollapsed = false  // 允许进入折叠状态
            halfExpandedRatio = 0.58f
            // 展开时距离顶部距离(留出状态栏和搜索区域)
            expandedOffset = resources.getDimensionPixelSize(R.dimen.dp_50)
            // expandedOffset = 0 // 顶部有定位图标占位 暂不需要设置
            addBottomSheetCallback(object : BottomSheetBehavior.BottomSheetCallback() {
                override fun onStateChanged(bottomSheet: View, newState: Int) {
                    if (binding.siteRv.isVisible) {
@@ -250,9 +247,7 @@
                                if (!binding.arrow.isVisible) {
                                    showAnim(binding.arrow, true)
                                }
                                if (binding.title1.isVisible) {
                                    showAnim(binding.title1, false)
                                }
                                binding.location.visibility = View.VISIBLE
                                arrow(0f)
                            }
@@ -262,9 +257,7 @@
                                if (!binding.arrow.isVisible) {
                                    showAnim(binding.arrow, true)
                                }
                                if (binding.title1.isVisible) {
                                    showAnim(binding.title1, false)
                                }
                                binding.location.visibility = View.VISIBLE
                                arrow(180f)
                            }
app/src/main/res/layout/activity_check_in.xml
@@ -162,7 +162,7 @@
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/dp_16"
                    android:text='@{"打卡时间:" + (viewModel.clockModel.xpClockIn.clockInResult != 3 ? viewModel.clockModel.xpClockIn.clockInTime : "-")}'
                    android:text='@{"打卡时间:" + (viewModel.clockModel.xpClockIn.clockInResult != 3 ? viewModel.clockModel.xpClockIn.getFormateClockInTime() : "-")}'
                    android:textColor="@color/gray_8"
                    android:textSize="@dimen/sp_14"
                    android:textStyle="bold"
@@ -237,7 +237,7 @@
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/dp_16"
                    android:text='@{"打卡时间:"+viewModel.clockModel.xpClockIn.clockOutTime}'
                    android:text='@{"打卡时间:"+viewModel.clockModel.xpClockIn.getFormateClockOutTime()}'
                    android:textColor="@color/gray_8"
                    android:textSize="@dimen/sp_14"
                    android:textStyle="bold"
app/src/main/res/layout/activity_site_nav.xml
@@ -121,6 +121,7 @@
        <androidx.coordinatorlayout.widget.CoordinatorLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_marginTop="@dimen/dp_50"
            android:elevation="@dimen/dp_2"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/searchLayout">
app/src/main/res/layout/fragment_mine.xml
@@ -711,7 +711,7 @@
                                android:layout_height="wrap_content"
                                android:layout_marginEnd="@dimen/dp_6"
                                android:text="@{viewModel.phone}"
                                android:textColor="@color/gray_9"
                                android:textColor="@color/blue_5"
                                android:textSize="@dimen/sp_12"
                                tools:text="12345678901" />