# 小蒙马房间数自动计算 + 多档位最低价 - **日期**: 2026-04-15 - **服务**: hl-product-service-v2 - **PR**: #595, #596 - **类型**: feat (新功能) ## 概述 1. 行程设计中的住宿房间数自动取最小值作为班期默认房间数,不再需要班期里单独传 2. 多档位产品详情返回各档位各自的最低价 ## 功能1:房间数自动计算 ### 行为变更 - **保存行程(Step2)时**,后端自动计算各天住宿(档位1)的最小 `roomCount`,写入 `defaultRoomCount` - 例:D1=8间、D2=9间、D3=8间 → `defaultRoomCount = 8` - **创建班期时**,如果 `maxRooms` 未传或传0,自动使用 `defaultRoomCount` - 批量创建班期同样适用 - 如果手动传了 `maxRooms > 0`,仍以手动值为准 ### 接口影响 无新增接口。现有接口行为变更: **PUT /admin/product/item/{id}/itinerary**(Step2 保存行程) - 保存后自动更新 `defaultRoomCount` **POST /admin/product/item/{id}/schedule**(创建班期) - `maxRooms` 为空或0时自动取 `defaultRoomCount` **POST /admin/product/item/{id}/schedule/batch-create**(批量创建班期) - 同上 ## 功能2:多档位最低价 ### GET /mp/product/{id} 新增字段 | 字段 | 类型 | 说明 | |------|------|------| | `tierPrices` | Array/null | 各档位起步价,仅多档位产品返回 | `tierPrices` 数组元素结构: | 字段 | 类型 | 说明 | |------|------|------| | `tierSeq` | Integer | 档位序号 | | `tierName` | String | 档位名称 | | `startPrice` | BigDecimal | 该档位未来可售最低成人售价 | ### 响应示例 ```json { "startPrice": 7980.0, "tierPrices": [ {"tierSeq": 1, "tierName": "精选", "startPrice": 7980.0}, {"tierSeq": 2, "tierName": "臻享", "startPrice": 9980.0} ] } ``` ### 规则 - `startPrice` 保留为全局最低价(向后兼容) - `tierPrices` 仅多档位产品返回,单档位产品为 `null` - 每个档位的 `startPrice` 独立计算(未来日期 + 售价>0 的最低值)