feat(servicing): 添加照片排序功能并优化订单放弃逻辑

- 在 PhotoTemplateInfo 模型中添加 sort 字段,用于照片排序- 在相关 VM 和 Activity 中集成照片排序逻辑
- 优化订单放弃流程,根据任务状态控制照片显示
- 更新数据库版本号- 调整订单详情页面逻辑,提高用户体验
This commit is contained in:
songzhiling
2025-05-14 15:05:41 +08:00
parent 804db17db8
commit 502e1cd604
13 changed files with 33 additions and 8 deletions

View File

@ -73,7 +73,7 @@ publishing {
release(MavenPublication) { release(MavenPublication) {
groupId = 'io.github.szl9' groupId = 'io.github.szl9'
artifactId = 'zd_servicing' artifactId = 'zd_servicing'
version = "1.0.1.9.9.63" version = "1.0.1.9.9.68"
pom { pom {
packaging = "aar" packaging = "aar"

View File

@ -58,4 +58,3 @@ abstract class BaseActivity : PushMessageActivity() {
} }

View File

@ -17,6 +17,7 @@ data class PhotoTemplateInfo(
val photoUrl : String? = null, //封面地址 val photoUrl : String? = null, //封面地址
val photoName : String? = null, // 图片名称 val photoName : String? = null, // 图片名称
val photoType : Int? = null, // 1 照片 2 电子工单 val photoType : Int? = null, // 1 照片 2 电子工单
val sort : Int? = null, //照片在后台的位置
val createTime : String? = null, //创建时间 val createTime : String? = null, //创建时间
val numbering : String? = null, // 图片编号 val numbering : String? = null, // 图片编号
val recognizeType : Int? = null, //orc 识别类型 0 无 1 车牌号 2 车架号 val recognizeType : Int? = null, //orc 识别类型 0 无 1 车牌号 2 车架号
@ -40,7 +41,7 @@ data class PhotoTemplateInfo(
val lat : Float? = null, val lat : Float? = null,
val lng : Float? = null, val lng : Float? = null,
val address : String? = null, val address : String? = null,
val showPingAnGiveUpPhoto: Int?=null,//值==1的时候并且符合到达现场取消就展示其他不展示 val showPingAnGiveUpPhoto : Int? = null, //值==1的时候并且符合到达现场取消就展示其他不展示
) { ) {
fun convertPhotoStatusStr(status : Int) : String { fun convertPhotoStatusStr(status : Int) : String {
return when (status) { return when (status) {

View File

@ -39,6 +39,7 @@ data class OfflineUpdateTaskBean(
val imageLocalPath: String? = null, val imageLocalPath: String? = null,
val imageUploadPath: String? = null, val imageUploadPath: String? = null,
val advanceTime: Long? = null, val advanceTime: Long? = null,
val sort: Int?=null,
val needWater:Boolean?=null, val needWater:Boolean?=null,
val needPhoneBrand:Boolean?=null, val needPhoneBrand:Boolean?=null,
val photoLocalWaterMarkerPath: String? = null, val photoLocalWaterMarkerPath: String? = null,

View File

@ -11,7 +11,7 @@ import com.za.room.db.GlobalRoom
@SuppressLint("StaticFieldLeak") @SuppressLint("StaticFieldLeak")
object RoomHelper { object RoomHelper {
const val VERSION: Int = 39 const val VERSION: Int = 40
private lateinit var mContext: Context private lateinit var mContext: Context
var db: GlobalRoom? = null var db: GlobalRoom? = null

View File

@ -118,6 +118,7 @@ class ZdPushServiceReceive : BroadcastReceiver() {
confirm = { confirm = {
OrderGiveUpActivity.Companion.goOrderGiveUpActivity(activity, OrderGiveUpActivity.Companion.goOrderGiveUpActivity(activity,
giveUpType = GIVE_UP_TYPE_NORMAL, giveUpType = GIVE_UP_TYPE_NORMAL,
userOrderId = jpushBean.userOrderId,
taskId = jpushBean.taskId) taskId = jpushBean.taskId)
}).show(activity.supportFragmentManager, DIALOG_TAG_GIVE_UP) }).show(activity.supportFragmentManager, DIALOG_TAG_GIVE_UP)
} else { } else {

View File

@ -51,6 +51,7 @@ class CheckVehicleVm : IServicingVm<CheckVehicleVm.Action, CheckVehicleVm.UiStat
imageLng = photoTemplateInfo.lng, imageLng = photoTemplateInfo.lng,
imageAddress = photoTemplateInfo.address, imageAddress = photoTemplateInfo.address,
imageIndex = index, imageIndex = index,
sort = photoTemplateInfo.sort,
needWater = photoTemplateInfo.needWaterMarker, needWater = photoTemplateInfo.needWaterMarker,
needPhoneBrand = photoTemplateInfo.needShowPhoneBrand, needPhoneBrand = photoTemplateInfo.needShowPhoneBrand,
imageLocalPath = photoTemplateInfo.photoLocalPath, imageLocalPath = photoTemplateInfo.photoLocalPath,
@ -77,6 +78,7 @@ class CheckVehicleVm : IServicingVm<CheckVehicleVm.Action, CheckVehicleVm.UiStat
jsonObject["path"] = item.photoUploadPath jsonObject["path"] = item.photoUploadPath
jsonObject["time"] = item.time jsonObject["time"] = item.time
jsonObject["lat"] = item.lat jsonObject["lat"] = item.lat
jsonObject["sort"] = item.sort
jsonObject["lng"] = item.lng jsonObject["lng"] = item.lng
jsonObject["address"] = item.address jsonObject["address"] = item.address
tempPhotoList.add(jsonObject.toJSONString()) tempPhotoList.add(jsonObject.toJSONString())
@ -184,6 +186,7 @@ class CheckVehicleVm : IServicingVm<CheckVehicleVm.Action, CheckVehicleVm.UiStat
jsonObject["realTakePhotoTime"] = item.realTakePhotoTime ?: "" jsonObject["realTakePhotoTime"] = item.realTakePhotoTime ?: ""
jsonObject["photoSource"] = item.photoSource jsonObject["photoSource"] = item.photoSource
jsonObject["path"] = item.photoUploadPath jsonObject["path"] = item.photoUploadPath
jsonObject["sort"] = item.sort
jsonObject["time"] = item.time jsonObject["time"] = item.time
jsonObject["lat"] = item.lat jsonObject["lat"] = item.lat
jsonObject["lng"] = item.lng jsonObject["lng"] = item.lng

View File

@ -79,6 +79,7 @@ class DeparturePhotoVm : IServicingVm<DeparturePhotoVm.Action, DeparturePhotoVm.
jsonObject["photoSource"] = item.photoSource jsonObject["photoSource"] = item.photoSource
jsonObject["path"] = item.photoUploadPath jsonObject["path"] = item.photoUploadPath
jsonObject["time"] = item.time jsonObject["time"] = item.time
jsonObject["sort"] = item.sort
jsonObject["lat"] = item.lat jsonObject["lat"] = item.lat
jsonObject["lng"] = item.lng jsonObject["lng"] = item.lng
jsonObject["address"] = item.address jsonObject["address"] = item.address

View File

@ -186,6 +186,7 @@ class DestinationPhotoVm : IServicingVm<DestinationPhotoVm.Action, DestinationPh
jsonObject["photoSource"] = item.photoSource jsonObject["photoSource"] = item.photoSource
jsonObject["path"] = item.photoUploadPath jsonObject["path"] = item.photoUploadPath
jsonObject["time"] = item.time jsonObject["time"] = item.time
jsonObject["sort"] = item.sort
jsonObject["lat"] = item.lat jsonObject["lat"] = item.lat
jsonObject["lng"] = item.lng jsonObject["lng"] = item.lng
jsonObject["address"] = item.address jsonObject["address"] = item.address

View File

@ -82,6 +82,7 @@ class InOperationVm : IServicingVm<InOperationVm.Action, InOperationVm.UiState>(
jsonObject["photoSource"] = item.photoSource jsonObject["photoSource"] = item.photoSource
jsonObject["path"] = item.photoUploadPath jsonObject["path"] = item.photoUploadPath
jsonObject["time"] = item.time jsonObject["time"] = item.time
jsonObject["sort"] = item.sort
jsonObject["lat"] = item.lat jsonObject["lat"] = item.lat
jsonObject["lng"] = item.lng jsonObject["lng"] = item.lng
jsonObject["address"] = item.address jsonObject["address"] = item.address
@ -189,6 +190,7 @@ class InOperationVm : IServicingVm<InOperationVm.Action, InOperationVm.UiState>(
jsonObject["realTakePhotoTime"] = item.realTakePhotoTime ?: "" jsonObject["realTakePhotoTime"] = item.realTakePhotoTime ?: ""
jsonObject["photoSource"] = item.photoSource jsonObject["photoSource"] = item.photoSource
jsonObject["time"] = item.time jsonObject["time"] = item.time
jsonObject["sort"] = item.sort
jsonObject["lat"] = item.lat jsonObject["lat"] = item.lat
jsonObject["path"] = item.photoUploadPath jsonObject["path"] = item.photoUploadPath
jsonObject["lng"] = item.lng jsonObject["lng"] = item.lng

View File

@ -106,6 +106,7 @@ class OrderConfirmVm : IServicingVm<OrderConfirmVm.Action, OrderConfirmVm.UiStat
jsonObject["photoSource"] = item.photoSource jsonObject["photoSource"] = item.photoSource
jsonObject["path"] = item.photoUploadPath jsonObject["path"] = item.photoUploadPath
jsonObject["time"] = item.time jsonObject["time"] = item.time
jsonObject["sort"] = item.sort
jsonObject["lat"] = item.lat jsonObject["lat"] = item.lat
jsonObject["lng"] = item.lng jsonObject["lng"] = item.lng
jsonObject["address"] = item.address jsonObject["address"] = item.address

View File

@ -53,7 +53,8 @@ class OrderGiveUpActivity : BaseActivity() {
OrderGiveUpScreen(orderInfo = orderInfo, OrderGiveUpScreen(orderInfo = orderInfo,
taskId = intent.getIntExtra("taskId", 0), taskId = intent.getIntExtra("taskId", 0),
giveUpType = intent.getIntExtra("giveUpType", 0)) giveUpType = intent.getIntExtra("giveUpType", 0)) {
}
} }
companion object { companion object {
@ -79,7 +80,8 @@ class OrderGiveUpActivity : BaseActivity() {
fun OrderGiveUpScreen(vm : OrderGiveUpVm = viewModel(), fun OrderGiveUpScreen(vm : OrderGiveUpVm = viewModel(),
orderInfo : OrderInfo?, orderInfo : OrderInfo?,
taskId : Int, taskId : Int,
giveUpType : Int) { giveUpType : Int,
onBack : () -> Unit) {
val uiState = vm.uiState.collectAsStateWithLifecycle() val uiState = vm.uiState.collectAsStateWithLifecycle()
val context = LocalContext.current val context = LocalContext.current
@ -92,6 +94,7 @@ fun OrderGiveUpScreen(vm : OrderGiveUpVm = viewModel(),
if (uiState.value.orderGiveUpSuccess == true) { if (uiState.value.orderGiveUpSuccess == true) {
context.finish() context.finish()
onBack()
} }
if (uiState.value.isGoNextPageDialog == true) { if (uiState.value.isGoNextPageDialog == true) {

View File

@ -102,6 +102,7 @@ class OrderGiveUpVm : BaseVm<OrderGiveUpVm.Action, OrderGiveUpVm.UiState>() {
jsonObject["realTakePhotoTime"] = item.realTakePhotoTime ?: "" jsonObject["realTakePhotoTime"] = item.realTakePhotoTime ?: ""
jsonObject["photoSource"] = item.photoSource jsonObject["photoSource"] = item.photoSource
jsonObject["time"] = item.time jsonObject["time"] = item.time
jsonObject["sort"] = item.sort
jsonObject["lat"] = item.lat jsonObject["lat"] = item.lat
jsonObject["path"] = item.photoUploadPath jsonObject["path"] = item.photoUploadPath
jsonObject["lng"] = item.lng jsonObject["lng"] = item.lng
@ -154,6 +155,7 @@ class OrderGiveUpVm : BaseVm<OrderGiveUpVm.Action, OrderGiveUpVm.UiState>() {
jsonObject["realTakePhotoTime"] = item.realTakePhotoTime ?: "" jsonObject["realTakePhotoTime"] = item.realTakePhotoTime ?: ""
jsonObject["photoSource"] = item.photoSource jsonObject["photoSource"] = item.photoSource
jsonObject["time"] = item.time jsonObject["time"] = item.time
jsonObject["sort"] = item.sort
jsonObject["lat"] = item.lat jsonObject["lat"] = item.lat
jsonObject["path"] = item.photoUploadPath jsonObject["path"] = item.photoUploadPath
jsonObject["lng"] = item.lng jsonObject["lng"] = item.lng
@ -204,6 +206,7 @@ class OrderGiveUpVm : BaseVm<OrderGiveUpVm.Action, OrderGiveUpVm.UiState>() {
jsonObject["realTakePhotoTime"] = item.realTakePhotoTime ?: "" jsonObject["realTakePhotoTime"] = item.realTakePhotoTime ?: ""
jsonObject["photoSource"] = item.photoSource jsonObject["photoSource"] = item.photoSource
jsonObject["time"] = item.time jsonObject["time"] = item.time
jsonObject["sort"] = item.sort
jsonObject["lat"] = item.lat jsonObject["lat"] = item.lat
jsonObject["path"] = item.photoUploadPath jsonObject["path"] = item.photoUploadPath
jsonObject["lng"] = item.lng jsonObject["lng"] = item.lng
@ -311,6 +314,10 @@ class OrderGiveUpVm : BaseVm<OrderGiveUpVm.Action, OrderGiveUpVm.UiState>() {
return return
} }
if (GlobalData.currentOrder?.taskId == uiState.value.taskId) {
updateState(uiState.value.copy(orderInfo = GlobalData.currentOrder))
}
val eleWorkOrderBean = val eleWorkOrderBean =
RoomHelper.db?.eleWorkOrderDao()?.getEleWorkOrder(uiState.value.orderInfo?.taskId ?: 0) RoomHelper.db?.eleWorkOrderDao()?.getEleWorkOrder(uiState.value.orderInfo?.taskId ?: 0)
val photoTemplateList = RoomHelper.db?.photoTemplateDao() val photoTemplateList = RoomHelper.db?.photoTemplateDao()
@ -334,16 +341,21 @@ class OrderGiveUpVm : BaseVm<OrderGiveUpVm.Action, OrderGiveUpVm.UiState>() {
} }
//0不展示 1 判断是否到达现场 是展示 不是不展示 其他都是展示
private fun handlerData(originDta : List<PhotoTemplateInfo>?) : List<PhotoTemplateInfo> { private fun handlerData(originDta : List<PhotoTemplateInfo>?) : List<PhotoTemplateInfo> {
val list = arrayListOf<PhotoTemplateInfo>() val list = arrayListOf<PhotoTemplateInfo>()
originDta?.forEach { originDta?.forEach {
if (it.showPingAnGiveUpPhoto == 0) {
return@forEach
}
if (it.showPingAnGiveUpPhoto == 1) { if (it.showPingAnGiveUpPhoto == 1) {
if (uiState.value.orderInfo?.taskState == "VERIFY" || uiState.value.orderInfo?.taskState == "EXAMINE") { if (uiState.value.orderInfo?.taskState == "VERIFY" || uiState.value.orderInfo?.taskState == "EXAMINE") {
list.add(it) list.add(it)
return@forEach
} }
} else { return@forEach
list.add(it)
} }
list.add(it)
} }
return list return list
} }