fix: 修复图片上传字段、航班查询接口及图片鉴权加载问题
- 国际进港舱单列表页航班查询接口改为 /flt/searchFlightList,支持多航班校验 - 修复国内进港移库编辑/交接页图片上传缺少 pic、picNumber 字段 - 国际进港舱单详情页对接交接图片展示 - 图片缩略图和大图预览加载带 Authorization header 解决 403 - CLAUDE.md 新增图片上传与展示规范 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -13,6 +13,7 @@ import com.lukouguoji.module_base.base.CommonAdapter
|
||||
import com.lukouguoji.module_base.ktx.addOnItemClickListener
|
||||
import com.lukouguoji.module_base.router.ARouterConstants
|
||||
|
||||
@Deprecated("旧的实现")
|
||||
@Route(path = ARouterConstants.ACTIVITY_URL_GJJ_MANIFEST)
|
||||
class GjjManifestListActivity :
|
||||
BaseBindingActivity<ActivityGjjManifestBinding, GjjManifestListViewModel>() {
|
||||
|
||||
@@ -3,14 +3,20 @@ package com.lukouguoji.gjj.activity
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.lukouguoji.gjj.R
|
||||
import com.lukouguoji.gjj.databinding.ActivityIntImpManifestDetailsBinding
|
||||
import com.lukouguoji.gjj.holder.GjjManifestPicViewHolder
|
||||
import com.lukouguoji.gjj.viewModel.IntImpManifestDetailsViewModel
|
||||
import com.lukouguoji.module_base.base.BaseBindingActivity
|
||||
import com.lukouguoji.module_base.base.CommonAdapter
|
||||
import com.lukouguoji.module_base.bean.FileBean
|
||||
import com.lukouguoji.module_base.bean.GjjManifest
|
||||
import com.lukouguoji.module_base.common.Constant
|
||||
import com.lukouguoji.module_base.router.ARouterConstants
|
||||
import com.lukouguoji.module_base.util.MediaUtil
|
||||
import com.lukouguoji.module_base.ktx.noNull
|
||||
|
||||
/**
|
||||
* 国际进港舱单详情
|
||||
@@ -26,6 +32,29 @@ class IntImpManifestDetailsActivity :
|
||||
setBackArrow("进港舱单详情")
|
||||
binding.viewModel = viewModel
|
||||
viewModel.initOnCreated(intent)
|
||||
|
||||
// 交接图片
|
||||
val picAdapter = CommonAdapter(
|
||||
this,
|
||||
R.layout.item_gjj_manifest_pic,
|
||||
GjjManifestPicViewHolder::class.java
|
||||
)
|
||||
binding.rvPic.layoutManager = LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false)
|
||||
binding.rvPic.adapter = picAdapter
|
||||
|
||||
viewModel.dataBean.observe(this) { bean ->
|
||||
val picList = bean.pic.noNull().split(",").filter { it.isNotEmpty() }
|
||||
val originalPicList = bean.originalPic.noNull().split(",").filter { it.isNotEmpty() }
|
||||
val list = picList.mapIndexed { index, picUrl ->
|
||||
val originalFile = originalPicList.getOrElse(index) { picUrl }
|
||||
FileBean(
|
||||
path = MediaUtil.fillUrl(picUrl),
|
||||
url = picUrl,
|
||||
originalPic = MediaUtil.fillUrl(originalFile)
|
||||
)
|
||||
}
|
||||
picAdapter.refresh(list)
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
package com.lukouguoji.gjj.holder
|
||||
|
||||
import android.view.View
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.load.model.GlideUrl
|
||||
import com.bumptech.glide.load.model.LazyHeaders
|
||||
import com.lukouguoji.gjj.databinding.ItemGjjManifestPicBinding
|
||||
import com.lukouguoji.module_base.base.BaseViewHolder
|
||||
import com.lukouguoji.module_base.bean.FileBean
|
||||
import com.lukouguoji.module_base.common.Constant
|
||||
import com.lukouguoji.module_base.db.perference.SharedPreferenceUtil
|
||||
import com.lukouguoji.module_base.ktx.commonAdapter
|
||||
import com.lukouguoji.module_base.ui.page.preview.PreviewActivity
|
||||
|
||||
@@ -14,6 +19,17 @@ class GjjManifestPicViewHolder(view: View) :
|
||||
val bean = getItemBean(item)!!
|
||||
binding.bean = bean
|
||||
|
||||
// 带 Authorization header 加载图片
|
||||
if (bean.path.isNotEmpty()) {
|
||||
val glideUrl = GlideUrl(
|
||||
bean.path,
|
||||
LazyHeaders.Builder()
|
||||
.addHeader("Authorization", SharedPreferenceUtil.getString(Constant.Share.token))
|
||||
.build()
|
||||
)
|
||||
Glide.with(itemView.context).load(glideUrl).into(binding.ivThumbnail)
|
||||
}
|
||||
|
||||
binding.ivThumbnail.setOnClickListener {
|
||||
val items = getRecyclerView()?.commonAdapter()?.items
|
||||
?.filterIsInstance<FileBean>() ?: listOf(bean)
|
||||
|
||||
@@ -64,30 +64,40 @@ class IntImpManifestViewModel : BasePageViewModel() {
|
||||
lastQueriedFlight = key
|
||||
|
||||
launchCollect({
|
||||
NetApply.api.getGjFlightBean(
|
||||
NetApply.api.searchFlightList(
|
||||
mapOf(
|
||||
"fdate" to fdate,
|
||||
"fno" to fno,
|
||||
"ieFlag" to "I",
|
||||
"status" to "1",
|
||||
).toRequestBody()
|
||||
)
|
||||
}) {
|
||||
onSuccess = {
|
||||
if (it.verifySuccess() && it.data != null) {
|
||||
val flight = it.data!!
|
||||
fid = flight.fid.noNull()
|
||||
fdep = flight.fdep.noNull()
|
||||
fdest.value = flight.fdest.noNull()
|
||||
if (it.verifySuccess() && !it.data.isNullOrEmpty()) {
|
||||
val dataList = it.data!!
|
||||
if (dataList.size > 1) {
|
||||
showToast("存在多个航班记录,请核实")
|
||||
fid = ""
|
||||
fdep = ""
|
||||
fdest.value = ""
|
||||
sendAddressList.value = emptyList()
|
||||
sendAddress.value = ""
|
||||
} else {
|
||||
val flight = dataList[0]
|
||||
fid = flight.fid.noNull()
|
||||
fdep = flight.fdep.noNull()
|
||||
fdest.value = flight.fdest.noNull()
|
||||
|
||||
// 构建始发站下拉列表:fdep + jtz(经停港)
|
||||
val list = mutableListOf(
|
||||
KeyValue(flight.fdep.noNull(), flight.fdep.noNull()),
|
||||
)
|
||||
if (!flight.jtz.isNullOrEmpty()) {
|
||||
list.add(KeyValue(flight.jtz.noNull(), flight.jtz.noNull()))
|
||||
// 构建始发站下拉列表:fdep + jtz(经停港)
|
||||
val list = mutableListOf(
|
||||
KeyValue(flight.fdep.noNull(), flight.fdep.noNull()),
|
||||
)
|
||||
if (!flight.jtz.isNullOrEmpty()) {
|
||||
list.add(KeyValue(flight.jtz.noNull(), flight.jtz.noNull()))
|
||||
}
|
||||
sendAddressList.value = list
|
||||
sendAddress.value = flight.fdep.noNull()
|
||||
}
|
||||
sendAddressList.value = list
|
||||
sendAddress.value = flight.fdep.noNull()
|
||||
} else {
|
||||
fid = ""
|
||||
fdep = ""
|
||||
|
||||
@@ -263,25 +263,14 @@
|
||||
android:textColor="@color/text_gray"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_images"
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_pic"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="14dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="80dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<!-- 交接图片区域预留,后续对接图片数据 -->
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="暂无图片"
|
||||
android:textColor="@color/text_gray"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</LinearLayout>
|
||||
android:orientation="horizontal" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_thumbnail"
|
||||
loadImage="@{bean.path}"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
|
||||
Reference in New Issue
Block a user