2. 已有项目可参考接口
2.1 配对信息
| 来源项目 | OrderingMachine、ZhctWeightingTableYoukate |
| 接口 | POST /p/api/matecode |
| Content-Type | application/x-www-form-urlencoded |
| 请求参数 | matecode:配对码。 |
| 客户端封装 | OrderingMachine RetrofitRequest.getPairInfo(...);ZhctWeightingTableYoukate NetworkService.getPairInfo(...) |
| 返回字段 |
说明 |
matecode | 配对码。 |
code | 终端/设备编号,客户端保存为 DEVICE_CODE。 |
communicationkey | 通信密钥。 |
ali_mqtt | MQTT 配置,首期 ManageDishTeminal 可保存但不启用实时状态。 |
business_name | 商户名称。 |
restaurant_id | 餐厅 ID。 |
restaurant_name | 餐厅名称。 |
api_auth_account | 后续业务接口鉴权账号。 |
api_auth_pwd | 后续业务接口鉴权密码。 |
api_auth_key | 后续业务接口鉴权 key。 |
本项目系统设置中如保留“配置链接/配对码”,可复用该接口和保存逻辑。首期本地登录不依赖此接口。
2.2 启动初始化
| 来源项目 | OrderingMachine、ZhctWeightingTableYoukate |
| 接口 | POST /p/api/equipmentStart |
| 请求参数 | code:配对码或设备编号,参考项目命名存在差异,需后端最终确认。 |
| 用途 | 设备启动时初始化。 |
2.3 心跳
| 来源项目 | OrderingMachine、ZhctWeightingTableYoukate |
| 接口 | POST /p/api/heartbeat |
| 请求参数 | code:设备编号。 |
| 用途 | 现有项目用于设备心跳;ManageDishTeminal 首期不做实时状态,可暂不接。 |
2.4 档口列表 + 当前餐次信息
| 来源项目 | OrderingMachine |
| 接口 | POST /api/orderMachine/restaurantList |
| Content-Type | application/x-www-form-urlencoded |
| 请求参数 | equipment_code:设备编号。 |
| 客户端调用 | ChooseShopActivity.getRestaurantListData() 调用 RetrofitRequest.getRestaurantList(...) |
| 返回字段 |
说明 |
area_id、area_name | 区域信息。 |
equipment.code | 设备编号。 |
equipment.restaurant_id | 设备关联餐厅 ID。 |
list[].shop_id | 食堂/分组 ID。 |
list[].shop_name | 食堂/分组名称。 |
list[].stall_list[].restaurant_id | 档口/餐厅 ID。 |
list[].stall_list[].restaurant_name | 档口/餐厅名称。 |
list[].stall_list[].file_path | 档口图片。 |
list[].stall_list[].intro | 档口简介。 |
list[].stall_list[].meal_date | 当前可用餐次日期。 |
list[].stall_list[].meal_times | 当前餐次编号。 |
list[].stall_list[].meal_name | 当前餐次名称。 |
list[].stall_list[].is_order | 是否允许订餐:参考项目 1 允许,2 不允许。 |
list[].stall_list[].dishes_num | 有效菜品数量。 |
ManageDishTeminal 可复用该接口作为“档口列表 + 默认餐段”的首期依据:进入排菜页先拉档口列表,默认第一个档口,并使用返回的 meal_date / meal_times / meal_name 展示当前餐段。
2.5 餐段时间
| 来源项目 | ZhctWeightingTableYoukate |
| 接口 | POST /p/api/getRestaurantsInfo |
| Content-Type | application/x-www-form-urlencoded |
| 请求参数 | id:餐厅/档口 ID。 |
| 客户端封装 | NetworkService.getCurrentMealTime(restaurantId) |
| 返回字段 |
说明 |
morning_start、morning_end | 早餐开始/结束时间。 |
noon_start、noon_end | 午餐开始/结束时间。 |
night_start、night_end | 晚餐开始/结束时间。 |
如果本项目最终要求“根据当前时间判断餐段”,优先使用该接口字段;如果后端直接在档口列表返回当前餐段,也可减少一次请求。
2.6 当前餐次菜谱 / 菜品列表
| 来源项目 | OrderingMachine、ZhctWeightingTableYoukate |
| 接口 | POST /p/api/getMeal |
| Content-Type | application/x-www-form-urlencoded 或 JSON body,OrderingMachine 使用 form。 |
| OrderingMachine 请求参数 | category、keyword、code、restaurant_id、meal_date、meal_times |
| 客户端调用 | FoodListActivity.getDishListData() 调用 RetrofitRequest.getDishMenu(...) |
| 返回字段 |
说明 |
data.1 | 分类 1 菜品列表,OrderingMachine 映射为主食。 |
data.2 | 分类 2 菜品列表,OrderingMachine 映射为素菜。 |
data.3 | 分类 3 菜品列表,OrderingMachine 映射为肉类。 |
data.4 | 分类 4 菜品列表,OrderingMachine 映射为奶/坚果类。 |
data.5 | 分类 5 菜品列表,OrderingMachine 映射为水果。 |
data.6 | 分类 6 菜品列表,OrderingMachine 映射为汤饮。 |
| 菜品字段 |
说明 |
id | 菜品 ID。 |
uuid | 菜品 UUID,后续保存/添加时优先使用。 |
name | 菜品名称。 |
price | 价格。 |
unit | 单位。 |
file_path / file_url | 菜品图片。 |
weight | 重量。 |
limit_num、bookable_num | 限量和可订数量,ManageDishTeminal 首期可忽略。 |
energy_100g、carbohydrate_100g、protein_100g、fat_100g、dietary_fiber_100g | 营养字段,ManageDishTeminal 首期可忽略。 |
tag / tags | 营养标签,ManageDishTeminal 首期可忽略。 |
ManageDishTeminal 的“设置菜谱当前菜品列表”和“排菜抽屉菜谱库”可先复用该接口做读取;若后端提供按日期/餐次/档口专用菜谱接口,则以后端新接口为准。
2.7 菜品分类 + 全部菜品列表
| 来源项目 | ZhctWeightingTableYoukate |
| 接口 | POST /p/api/CaterList |
| Content-Type | application/x-www-form-urlencoded |
| 请求参数 | keyword、category、page、page_size |
| 客户端封装 | NetworkService.getDishList(searchKey, dishCategory, pageIndex, pageSize) |
| 返回字段 |
说明 |
data.category[].catergory | 分类 ID。字段拼写沿用已有项目 catergory。 |
data.category[].name | 分类名称。 |
data.category[].count | 分类菜品数量。 |
data.rows[].uuid | 菜品 UUID。 |
data.rows[].name | 菜品名称。 |
data.rows[].file_path | 菜品图片。 |
data.rows[].category | 菜品分类 ID。 |
ManageDishTeminal 首期“添加菜品到菜谱抽屉”可使用该接口做菜品库列表和分类筛选;首期搜索只做名称模糊搜索,接口支持 keyword。
2.8 添加菜品到菜谱
| 来源项目 | ZhctWeightingTableYoukate |
| 接口 | POST /p/api/addRecipe |
| Content-Type | application/x-www-form-urlencoded |
| 请求参数 | uuid:菜品 UUID;code:设备编号。 |
| 客户端封装 | NetworkService.pushDishToMenu(uuid, code) |
该接口是称重台项目里的“添加到菜谱库”,没有日期、餐次、档口参数。ManageDishTeminal 要维护“某日期 + 某餐次 + 某档口”的菜谱,是否能直接复用该接口需要后端确认。大概率需要新增接口或扩展参数。
2.9 从菜谱移除菜品
| 来源项目 | ZhctWeightingTableYoukate |
| 接口 | POST /p/api/delRecipe |
| Content-Type | application/x-www-form-urlencoded |
| 请求参数 | code:设备编号;uuid:菜品 UUID。 |
| 客户端封装 | NetworkService.deleteDishFromMenu(uuid, code) |
同添加接口一样,该接口没有日期、餐次、档口参数。ManageDishTeminal 首期如要按日期/餐次/档口移除,需要后端确认是否扩展。