修复预约详情图片回显链路

This commit is contained in:
2026-07-23 12:09:31 +08:00
parent 3e7b40fe3c
commit b14a97578e
4 changed files with 18 additions and 10 deletions
@@ -286,11 +286,15 @@ class PlanningServiceImplTest {
assertThat(storedItem[0].getDepositPaid()).isTrue();
assertThat(storedItem[0].getNeedRemoval()).isTrue();
assertThat(storedItem[0].getFromMeituan()).isTrue();
assertThat(storedItem[0].getAppointmentProductImageFileIds()).isNull();
assertThat(appointment.getCustomerName()).isEqualTo("到店王女士");
assertThat(appointment.getProductTitle()).isEqualTo("净色护理");
assertThat(appointment.getDepositPaid()).isTrue();
assertThat(appointment.getNeedRemoval()).isTrue();
assertThat(appointment.getFromMeituan()).isTrue();
assertThat(appointment.getProductImageFileIds()).isEmpty();
assertThat(appointment.getProductImageUrls()).isEmpty();
org.mockito.Mockito.verify(objectStorageFileService, org.mockito.Mockito.never()).getObjectStorageFileMapByIds(any());
}
@Test
@@ -41,22 +41,14 @@ function resolveProductImageFileIds(appointment) {
if (!appointment || typeof appointment !== 'object') {
return []
}
return splitImageValues(appointment.productImageFileIds || appointment.imageFileIds)
return splitImageValues(appointment.productImageFileIds)
}
function resolveProductImageUrls(appointment) {
if (!appointment || typeof appointment !== 'object') {
return []
}
const productImageUrls = normalizeImageUrlArray(appointment.productImageUrls)
if (productImageUrls.length > 0) {
return productImageUrls
}
const imageUrls = normalizeImageUrlArray(appointment.imageUrls)
if (imageUrls.length > 0) {
return imageUrls
}
return normalizeImageUrlArray(appointment.productImageUrl || appointment.imageUrl)
return normalizeImageUrlArray(appointment.productImageUrls)
}
async function resolveSignedImageUrls(fileIds) {
+7
View File
@@ -412,3 +412,10 @@
以后避免:在轻量单测或纯 mock 场景里新增 `LambdaUpdateWrapper` 时,先确认 lambda cache 已初始化;如果只是单表显式更新,优先用列名版 `UpdateWrapper`。
验证方式:`PlanningServiceImplTest#updateAppointmentImagesShouldPersistSnapshotImageIdsAndReturnUrls` 和 `...ShouldClearSnapshotImagesWithoutProductFallback` 通过,且不会再抛 `can not find lambda cache`。
## 2026-07-23 预约详情回显不能再用旧字段兜底
问题:预约详情页当前后端 VO 只返回 `productImageFileIds/productImageUrls`,但前端还兼容 `imageFileIds/imageUrls/productImageUrl/imageUrl`。如果旧字段残留,删除最后一张图片后重新进入详情页,空图片状态可能被历史字段带回。
原因:前端用真值判断而不是按字段是否存在判断,导致“显式清空”和“老接口兼容”混在一起。
预防方式:详情回显必须按当前 VO 契约读取;只有当前字段不存在时才兼容旧字段,不能让空串或空数组再回退到历史图片。
验证方式:删除最后一张图片后重新进入详情页仍应为空图;后端定向测试覆盖新建手工预约不传图片时返回空图片且不查询对象存储。
+5
View File
@@ -25,3 +25,8 @@
## 最近一次重要操作结果
2026-07-23 生产 MySQL `mysql02` 已放行当前维护机源地址 `192.168.5.163/32` 访问 3306;本机 `Test-NetConnection 192.168.5.110 -Port 3306` 返回 `TcpTestSucceeded=True`;`git diff --check --cached` 通过;GitNexus staged `detect-changes` 返回 low risk、0 affected processes。
## 2026-07-23 预约图片链路检查
- 已完成:梳理新建预约手工作品上传、预约详情上传/删除、后端 `PlanningServiceImpl` 回显链路,并修复详情页旧字段回退隐患。
- 下一步:无,等待用户验收预约图片链路。
- 阻塞点:暂无。
- 最近结果:小程序详情页/表单 JS 语法检查通过;`PlanningServiceImplTest` 图片链路定向测试通过;GitNexus staged `detect-changes` 为 low risk、0 affected processes;本次改动已准备提交。