| | |
| | | |
| | | //任务统计信息 |
| | | data class TaskStatisticInfo( |
| | | var totalTableCount: Int?,//全部数量 |
| | | var completedCount: Int?,//已完成数量 |
| | | var totalCount: Int?,//全部数量 |
| | | var waitArriveCount: Int?,//待到达数量 |
| | | var waitHandleCount: Int?,//待处理数量 |
| | | var totalCount: Int?,//底部全部事故数量 |
| | | var accidentCount: Int?,//底部事故数量 |
| | | var routineCount: Int?,//底部常规数量 |
| | | ) |
| | |
| | | } |
| | | |
| | | /*任务中心状态统计*/ |
| | | suspend fun statistic(taskCategory: String?): TaskStatisticInfo? { |
| | | suspend fun statistic( |
| | | distributeType: String?, |
| | | startTime: String?, |
| | | endTime: String?, |
| | | taskCategory: String?, |
| | | taskUrgencyLevel: String?, |
| | | plateNumber: String? |
| | | ): TaskStatisticInfo? { |
| | | val map = mapOf( |
| | | "taskCategory" to taskCategory |
| | | "distributeType" to distributeType, |
| | | "startTime" to if (startTime.isNullOrEmpty()) null else plateNumber, |
| | | "endTime" to if (endTime.isNullOrEmpty()) null else plateNumber, |
| | | "taskUrgencyLevel" to taskUrgencyLevel, |
| | | "taskCategory" to taskCategory, |
| | | "plateNumber" to if (plateNumber.isNullOrEmpty()) null else plateNumber, |
| | | ) |
| | | return api.statistic(getBody(map)).interceptAwait() |
| | | } |
| | |
| | | ToastUtilCommon.show("请输入车牌号") |
| | | } else { |
| | | EventBus.getDefault().post(filterData) |
| | | viewModel.statistic() |
| | | // requireActivity().supportFragmentManager.setFragmentResult( |
| | | // REQUEST_KEY_FILTER, |
| | | // bundleOf(KEY_FILTER_DATA to filterData) |
| | |
| | | } |
| | | } |
| | | viewModel.taskStatistic.observe(viewLifecycleOwner) { |
| | | val totalCountShow = it.totalCount.showCount(99) |
| | | val totalCountShow = it.totalTableCount.showCount(99) |
| | | val waitArriveCountShow = it.waitArriveCount.showCount(99) |
| | | val waitHandleCountShow = it.waitHandleCount.showCount(99) |
| | | val completedCountShow = it.completedCount.showCount(99) |
| | |
| | | "已处理${if (completedCountShow.isEmpty()) "" else " $completedCountShow"}" |
| | | tabTitles[4] = "改派中" |
| | | adapter.notifyDataSetChanged() |
| | | binding.tvAllCount.visibility = |
| | | if ((it.totalCount ?: 0) > 0) View.VISIBLE else View.GONE |
| | | binding.tvAllCount.text = it.totalCount.showCount(99) |
| | | binding.tvAccidentCount.visibility = |
| | | if ((it.accidentCount ?: 0) > 0) View.VISIBLE else View.GONE |
| | | binding.tvAccidentCount.text = it.accidentCount.showCount(99) |
| | | binding.tvNormalCount.visibility = |
| | | if ((it.routineCount ?: 0) > 0) View.VISIBLE else View.GONE |
| | | binding.tvNormalCount.text = it.routineCount.showCount(99) |
| | | } |
| | | viewModel.needRefreshList.observe(viewLifecycleOwner) { |
| | | if (it == true) { |
| | | EventBus.getDefault().post(filterData) |
| | | viewModel.statistic() |
| | | } |
| | | } |
| | | } |
| | |
| | | return@setOnClickListener |
| | | } |
| | | EventBus.getDefault().post(filterData) |
| | | viewModel.statistic() |
| | | // requireActivity().supportFragmentManager.setFragmentResult( |
| | | // REQUEST_KEY_FILTER, |
| | | // bundleOf(KEY_FILTER_DATA to filterData) |
| | |
| | | launchRequest(error = { code, msg -> |
| | | LogUtils.e(TAG, "launchRequest: code = $code msg = $msg") |
| | | }) { |
| | | taskRepository.statistic(getTaskCategory()?.toString())?.also { |
| | | taskRepository.statistic( |
| | | getDistributeType()?.toString(), |
| | | startTime, |
| | | endTime, |
| | | getTaskCategory()?.toString(), |
| | | getUrgencyLevel()?.toString(), |
| | | plateNumber.value |
| | | )?.also { |
| | | taskStatistic.postValue(it) |
| | | } |
| | | } |