feat(servicing): 添加照片排序功能并优化订单放弃逻辑
- 在 PhotoTemplateInfo 模型中添加 sort 字段,用于照片排序- 在相关 VM 和 Activity 中集成照片排序逻辑 - 优化订单放弃流程,根据任务状态控制照片显示 - 更新数据库版本号- 调整订单详情页面逻辑,提高用户体验
This commit is contained in:
@ -73,7 +73,7 @@ publishing {
|
||||
release(MavenPublication) {
|
||||
groupId = 'io.github.szl9'
|
||||
artifactId = 'zd_servicing'
|
||||
version = "1.0.1.9.9.63"
|
||||
version = "1.0.1.9.9.68"
|
||||
|
||||
pom {
|
||||
packaging = "aar"
|
||||
|
@ -58,4 +58,3 @@ abstract class BaseActivity : PushMessageActivity() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -17,6 +17,7 @@ data class PhotoTemplateInfo(
|
||||
val photoUrl : String? = null, //封面地址
|
||||
val photoName : String? = null, // 图片名称
|
||||
val photoType : Int? = null, // 1 照片 2 电子工单
|
||||
val sort : Int? = null, //照片在后台的位置
|
||||
val createTime : String? = null, //创建时间
|
||||
val numbering : String? = null, // 图片编号
|
||||
val recognizeType : Int? = null, //orc 识别类型 0 无 1 车牌号 2 车架号
|
||||
|
@ -39,6 +39,7 @@ data class OfflineUpdateTaskBean(
|
||||
val imageLocalPath: String? = null,
|
||||
val imageUploadPath: String? = null,
|
||||
val advanceTime: Long? = null,
|
||||
val sort: Int?=null,
|
||||
val needWater:Boolean?=null,
|
||||
val needPhoneBrand:Boolean?=null,
|
||||
val photoLocalWaterMarkerPath: String? = null,
|
||||
|
@ -11,7 +11,7 @@ import com.za.room.db.GlobalRoom
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
object RoomHelper {
|
||||
const val VERSION: Int = 39
|
||||
const val VERSION: Int = 40
|
||||
private lateinit var mContext: Context
|
||||
var db: GlobalRoom? = null
|
||||
|
||||
|
@ -118,6 +118,7 @@ class ZdPushServiceReceive : BroadcastReceiver() {
|
||||
confirm = {
|
||||
OrderGiveUpActivity.Companion.goOrderGiveUpActivity(activity,
|
||||
giveUpType = GIVE_UP_TYPE_NORMAL,
|
||||
userOrderId = jpushBean.userOrderId,
|
||||
taskId = jpushBean.taskId)
|
||||
}).show(activity.supportFragmentManager, DIALOG_TAG_GIVE_UP)
|
||||
} else {
|
||||
|
@ -51,6 +51,7 @@ class CheckVehicleVm : IServicingVm<CheckVehicleVm.Action, CheckVehicleVm.UiStat
|
||||
imageLng = photoTemplateInfo.lng,
|
||||
imageAddress = photoTemplateInfo.address,
|
||||
imageIndex = index,
|
||||
sort = photoTemplateInfo.sort,
|
||||
needWater = photoTemplateInfo.needWaterMarker,
|
||||
needPhoneBrand = photoTemplateInfo.needShowPhoneBrand,
|
||||
imageLocalPath = photoTemplateInfo.photoLocalPath,
|
||||
@ -77,6 +78,7 @@ class CheckVehicleVm : IServicingVm<CheckVehicleVm.Action, CheckVehicleVm.UiStat
|
||||
jsonObject["path"] = item.photoUploadPath
|
||||
jsonObject["time"] = item.time
|
||||
jsonObject["lat"] = item.lat
|
||||
jsonObject["sort"] = item.sort
|
||||
jsonObject["lng"] = item.lng
|
||||
jsonObject["address"] = item.address
|
||||
tempPhotoList.add(jsonObject.toJSONString())
|
||||
@ -184,6 +186,7 @@ class CheckVehicleVm : IServicingVm<CheckVehicleVm.Action, CheckVehicleVm.UiStat
|
||||
jsonObject["realTakePhotoTime"] = item.realTakePhotoTime ?: ""
|
||||
jsonObject["photoSource"] = item.photoSource
|
||||
jsonObject["path"] = item.photoUploadPath
|
||||
jsonObject["sort"] = item.sort
|
||||
jsonObject["time"] = item.time
|
||||
jsonObject["lat"] = item.lat
|
||||
jsonObject["lng"] = item.lng
|
||||
|
@ -79,6 +79,7 @@ class DeparturePhotoVm : IServicingVm<DeparturePhotoVm.Action, DeparturePhotoVm.
|
||||
jsonObject["photoSource"] = item.photoSource
|
||||
jsonObject["path"] = item.photoUploadPath
|
||||
jsonObject["time"] = item.time
|
||||
jsonObject["sort"] = item.sort
|
||||
jsonObject["lat"] = item.lat
|
||||
jsonObject["lng"] = item.lng
|
||||
jsonObject["address"] = item.address
|
||||
|
@ -186,6 +186,7 @@ class DestinationPhotoVm : IServicingVm<DestinationPhotoVm.Action, DestinationPh
|
||||
jsonObject["photoSource"] = item.photoSource
|
||||
jsonObject["path"] = item.photoUploadPath
|
||||
jsonObject["time"] = item.time
|
||||
jsonObject["sort"] = item.sort
|
||||
jsonObject["lat"] = item.lat
|
||||
jsonObject["lng"] = item.lng
|
||||
jsonObject["address"] = item.address
|
||||
|
@ -82,6 +82,7 @@ class InOperationVm : IServicingVm<InOperationVm.Action, InOperationVm.UiState>(
|
||||
jsonObject["photoSource"] = item.photoSource
|
||||
jsonObject["path"] = item.photoUploadPath
|
||||
jsonObject["time"] = item.time
|
||||
jsonObject["sort"] = item.sort
|
||||
jsonObject["lat"] = item.lat
|
||||
jsonObject["lng"] = item.lng
|
||||
jsonObject["address"] = item.address
|
||||
@ -189,6 +190,7 @@ class InOperationVm : IServicingVm<InOperationVm.Action, InOperationVm.UiState>(
|
||||
jsonObject["realTakePhotoTime"] = item.realTakePhotoTime ?: ""
|
||||
jsonObject["photoSource"] = item.photoSource
|
||||
jsonObject["time"] = item.time
|
||||
jsonObject["sort"] = item.sort
|
||||
jsonObject["lat"] = item.lat
|
||||
jsonObject["path"] = item.photoUploadPath
|
||||
jsonObject["lng"] = item.lng
|
||||
|
@ -106,6 +106,7 @@ class OrderConfirmVm : IServicingVm<OrderConfirmVm.Action, OrderConfirmVm.UiStat
|
||||
jsonObject["photoSource"] = item.photoSource
|
||||
jsonObject["path"] = item.photoUploadPath
|
||||
jsonObject["time"] = item.time
|
||||
jsonObject["sort"] = item.sort
|
||||
jsonObject["lat"] = item.lat
|
||||
jsonObject["lng"] = item.lng
|
||||
jsonObject["address"] = item.address
|
||||
|
@ -53,7 +53,8 @@ class OrderGiveUpActivity : BaseActivity() {
|
||||
|
||||
OrderGiveUpScreen(orderInfo = orderInfo,
|
||||
taskId = intent.getIntExtra("taskId", 0),
|
||||
giveUpType = intent.getIntExtra("giveUpType", 0))
|
||||
giveUpType = intent.getIntExtra("giveUpType", 0)) {
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
@ -79,7 +80,8 @@ class OrderGiveUpActivity : BaseActivity() {
|
||||
fun OrderGiveUpScreen(vm : OrderGiveUpVm = viewModel(),
|
||||
orderInfo : OrderInfo?,
|
||||
taskId : Int,
|
||||
giveUpType : Int) {
|
||||
giveUpType : Int,
|
||||
onBack : () -> Unit) {
|
||||
val uiState = vm.uiState.collectAsStateWithLifecycle()
|
||||
val context = LocalContext.current
|
||||
|
||||
@ -92,6 +94,7 @@ fun OrderGiveUpScreen(vm : OrderGiveUpVm = viewModel(),
|
||||
|
||||
if (uiState.value.orderGiveUpSuccess == true) {
|
||||
context.finish()
|
||||
onBack()
|
||||
}
|
||||
|
||||
if (uiState.value.isGoNextPageDialog == true) {
|
||||
|
@ -102,6 +102,7 @@ class OrderGiveUpVm : BaseVm<OrderGiveUpVm.Action, OrderGiveUpVm.UiState>() {
|
||||
jsonObject["realTakePhotoTime"] = item.realTakePhotoTime ?: ""
|
||||
jsonObject["photoSource"] = item.photoSource
|
||||
jsonObject["time"] = item.time
|
||||
jsonObject["sort"] = item.sort
|
||||
jsonObject["lat"] = item.lat
|
||||
jsonObject["path"] = item.photoUploadPath
|
||||
jsonObject["lng"] = item.lng
|
||||
@ -154,6 +155,7 @@ class OrderGiveUpVm : BaseVm<OrderGiveUpVm.Action, OrderGiveUpVm.UiState>() {
|
||||
jsonObject["realTakePhotoTime"] = item.realTakePhotoTime ?: ""
|
||||
jsonObject["photoSource"] = item.photoSource
|
||||
jsonObject["time"] = item.time
|
||||
jsonObject["sort"] = item.sort
|
||||
jsonObject["lat"] = item.lat
|
||||
jsonObject["path"] = item.photoUploadPath
|
||||
jsonObject["lng"] = item.lng
|
||||
@ -204,6 +206,7 @@ class OrderGiveUpVm : BaseVm<OrderGiveUpVm.Action, OrderGiveUpVm.UiState>() {
|
||||
jsonObject["realTakePhotoTime"] = item.realTakePhotoTime ?: ""
|
||||
jsonObject["photoSource"] = item.photoSource
|
||||
jsonObject["time"] = item.time
|
||||
jsonObject["sort"] = item.sort
|
||||
jsonObject["lat"] = item.lat
|
||||
jsonObject["path"] = item.photoUploadPath
|
||||
jsonObject["lng"] = item.lng
|
||||
@ -311,6 +314,10 @@ class OrderGiveUpVm : BaseVm<OrderGiveUpVm.Action, OrderGiveUpVm.UiState>() {
|
||||
return
|
||||
}
|
||||
|
||||
if (GlobalData.currentOrder?.taskId == uiState.value.taskId) {
|
||||
updateState(uiState.value.copy(orderInfo = GlobalData.currentOrder))
|
||||
}
|
||||
|
||||
val eleWorkOrderBean =
|
||||
RoomHelper.db?.eleWorkOrderDao()?.getEleWorkOrder(uiState.value.orderInfo?.taskId ?: 0)
|
||||
val photoTemplateList = RoomHelper.db?.photoTemplateDao()
|
||||
@ -334,17 +341,22 @@ class OrderGiveUpVm : BaseVm<OrderGiveUpVm.Action, OrderGiveUpVm.UiState>() {
|
||||
|
||||
}
|
||||
|
||||
//0不展示 1 判断是否到达现场 是展示 不是不展示 其他都是展示
|
||||
private fun handlerData(originDta : List<PhotoTemplateInfo>?) : List<PhotoTemplateInfo> {
|
||||
val list = arrayListOf<PhotoTemplateInfo>()
|
||||
originDta?.forEach {
|
||||
if (it.showPingAnGiveUpPhoto == 0) {
|
||||
return@forEach
|
||||
}
|
||||
if (it.showPingAnGiveUpPhoto == 1) {
|
||||
if (uiState.value.orderInfo?.taskState == "VERIFY" || uiState.value.orderInfo?.taskState == "EXAMINE") {
|
||||
list.add(it)
|
||||
return@forEach
|
||||
}
|
||||
return@forEach
|
||||
}
|
||||
} else {
|
||||
list.add(it)
|
||||
}
|
||||
}
|
||||
return list
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user