# 外卖API接入文档

# 1.1 接入流程

第三方渠道通过API接入美团企业版外卖服务时

接口交互流程如下:

  1. 根据用户经纬度获取商家列表
  2. 用户选择某个餐厅时,根据商家poiId获取商家菜品信息
  3. 根据用户选择的菜品信息构建购物车(目前只支持一次性构建),调用订单预览确认是否满足下单要求,
    美团企业版会根据菜品和商家规则计算相应费用(打包费、配送费、菜品费等)
  4. 根据购物车下单,第三方渠道生成渠道订单号,然后调用美团企业版提交订单接口下单,返回美团订单号供第三方记录
  5. 如果订单支付类型是在线支付,调用pay支付接口,美团企业版扣除企业账户的金额,支付结果可通过订单查询接口获取。
  6. 订单在商家未确认前可以取消
  7. 商家确认订单、订单开始配送等均会通过订单状态变更接口进行推送。

# 1.2 请求说明

美团企业版外卖API接口为基于HTTP协议、RESTful风格的标准API接口,请求的编码方式为UTF-8编码,
请求地址为:
测试环境:https://sqt-api.test.meituan.com
生产环境:https://api-sqt.meituan.com

每个请求都需要指定公共请求参数和业务请求参数。
公共请求参数为每个向平台发起的请求都需包含的参数,业务请求参数与特定接口相关。

# 请求体

名称 类型 说明
token String 美团企业版分配给调用方token
version String 接口版本,目前1.0
content String 请求体内容,序列化后通过AES进行加密

# 公共请求参数

名称 类型 说明
sign String 用于验证请求合法性的秘钥
method String 请求方法名,和具体业务请求相关
ts Long 10位时间戳。若请求发起时间与平台服务端接受请求的时间相差过大,平台将直接拒绝本次请求。

# 业务请求参数

和具体接口有关,请参考业务接口描述。

# 1.3 响应说明

名称 类型 说明
status Integer 0: 调用成功 1:失败
msg String 失败时的错误描述
data 请求成功时的响应体,和具体业务有关,后文简称业务响应

# 1.4 签名方法

接入测试时,需要向美团企业版管理员或者项目经理申请获取token、sign、aesKey,
其中token和sign填充到请求和公共请求参数中,
通过aesKey对业务请求化结果进行AES加密,作为content。

假设分配得到的参数如下:

名称 取值
token CESHI-POS
sign sgW1bxc7oatFhOJXAeHnNg==
aesKey xxxx

# 1.4.1 查询商家列表页签名示例

1、查询请求

{
  "sign": "sgW1bxc7oatFhOJXAeHnNg==",
  "method":"waimai.poi.list",
  "ts":1512963578,
  "longitude":116488645,
  "latitude":40007069
}

2、待加密的明文plainText

{"sign":"sgW1bxc7oatFhOJXAeHnNg==","ts":1512963655,"method":"waimai.poi.list","longitude":116488645,"latitude":40007069}

3、业务请求明文通过AES进行加密,得到content

content=aesEncrypt(plainText, aesKey)

4、构造请求参数 设置Content-Typeapplication/x-www-form-urlencoded, 将token、version、content按照key-value的方式 填充到Body体中。

curl -v "https://sqt-api.test.meituan.com/waimai/v1/poi/list" -H "Accept: application/json"  -H "Content-Type: application/x-www-form-urlencoded" -d "token=CESHI-POS&version=1.6&content=UgJn07uNgW7S7fJK0R0xVbaLxoCGPQIzoP-_K4Hmp4RduGszhm2mbUs2toZhCtXKP5JGXVTZ9kGts2Wx3IJQCd90ptMoJTDB0vu7mkedEr4KZCvZn77EZLssMC5SpXilmQ-5RXHzvMIT0ASH-IXepTP_O16U37QqCkEb5L1WLy4"

# 1.5 测试说明

第三方渠道接入美团企业版时,需要联系我们获取测试账号和线上账号信息,测试账号只能用于测试环境,在测试环境测试验证没有问题后, 可以在线上进行功能验证,线上有专用测试餐厅,请联系我们获取。禁止在线上环境,随意挑选餐厅测试,否者产生的费用将由第三方承担。

# 2.0 获取金刚位列表集合

# 接口说明

名称 描述
功能 根据经纬度获取金刚位列表集合
HTTP方法 POST
请求方 第三方渠道
响应方 美团企业版平台
uri /waimai/v1/poi/getPrimaryCardList
method waimai.poi.primary

# 业务请求参数

名称 类型 是否必填 示例 说明
longitude Integer 116488645(即116.488645) 用户当前经度(高德经度*1000000
latitude Integer 40007069(即40.007069) 用户当前纬度(高德经度*1000000)

# 业务响应

{
    "status": 0,
    "msg": "成功",
    "data": [
        {
            "code": "2", #(long) 分类编码
            "name": "美食", # 名称
            "url": "http://p1.meituan.net/jungle/8b5e1702d4145ccf058ba5fb31008c5310912.png", #(String) 图片未选中状态url
            "gray_url": "http://p0.meituan.net/jungle/6539a4c1d2bb51b572e399016ee0e8cb11261.png" #(String) 图片选中状态url
        },
        {
            "code": "1",
            "name": "生鲜果蔬",
            "url": "http://p1.meituan.net/jungle/12a9834827909fa55f54bce96e67470711250.png",
            "gray_url": "http://p1.meituan.net/jungle/12a9834827909fa55f54bce96e67470711250.png"
        }
         
    ]
}

# 2.1 获取筛选栏数据集合

# 接口说明

名称 描述
功能 根据经纬度获取筛选栏数据
HTTP方法 POST
请求方 第三方渠道
响应方 美团企业版平台
uri /waimai/v1/poi/getFilterConditions
method waimai.poi.filterConditions

# 业务请求参数

名称 类型 是否必填 示例 说明
longitude Integer 116488645(即116.488645) 用户当前经度(高德经度*1000000
latitude Integer 40007069(即40.007069) 用户当前纬度(高德经度*1000000)
first_category_type Integer 910 一级品类code
second_category_type Integer 101119 二级品类codee

# 业务响应


{
    "code": 0,
    "msg": "调用成功",
    "data": {
        "category_filter_list": [ #(Object[]) 品类列表
            {
                "code": 910, #(long) 一级品类code
                "name": "美食", #(String) 名称
                "quantity": 32, #(int) 数量
                "sub_category_list": [ #(Object[]) 一级品类下子品类列表
                    {
                        "code": 100561,  #(long) 一级品类code
                        "name": "火锅",  #(String) 名称
                        "quantity": 7,  #(int) 数量
                        "icon_url": "https://p0.meituan.net/jungle/f2b895006df1cd866d96c2fd5e902cd215622.png" #(long) icon地址
                    },
                    {...}
                ]
            },
            {...}
        ],
        "sort_type_list": [  #(Object[]) 排序列表
            {
                "code": 1,  #(long) 排序条件编码
                "name": "销量最高",   #(String) 排序条件名称
                "short_name": "销量", #(String) 排序名称短文案
                "icon_url": "https://p1.meituan.net/xianfu/51635adbb08819d5586c3e1feb0946c62052.png",  #(String) 未选择状态下图标地址
                "icon_url_click": "https://p0.meituan.net/xianfu/31c8e28240571276801a6d99c55a88f82048.png", #(String) 选中条件下图标地址
                "position": 0 #(int) 展示位置,0-导航tab,1-下拉列表
            },
            {...}
        ],
        "activity_filter_list": [  #(Object[]) 活动筛选条件列表
            {
                "group_title": "商家特色",  #(String) 筛选条件分组名称
                "support_multi_choice": 1, #(int) 该筛选条件分组是否支持多选,0:单选,1:多选
                "display_style": 0, #(int) 展示样式 0:默认的网格样式  1:列表样式  2: 滑块样式
                "items": [   #(Object[]) 分组下的活动筛选项列表
                    {
                        "code": "-3",   #(String) 筛选条件编码
                        "name": "免配送费",  #(String)  筛选条件名称
                        "icon": "",  #(String)  筛选条件图标URL
                        "remarks": ""  #(String)  筛选条件说明
                    },
                    {...}
                ]
            },
            {...}
        ]
    }
}


# 2.2 商家列表

# 接口说明

名称 描述
功能 根据用户地理位置,获取附近的商家信息列表
HTTP方法 POST
请求方 第三方渠道
响应方 美团企业版平台
uri /waimai/v1/poi/list
method waimai.poi.list

# 业务请求参数

名称 类型 是否必填 示例 说明
longitude Integer 116488645(即116.488645) 用户当前经度(高德经度*1000000
latitude Integer 40007069(即40.007069) 用户当前纬度(高德经度*1000000)
keyword String 黄焖鸡 关键字
sort_type Integer 0 排序方式 (默认为0)
0 综合排序
2 速度最快
3 评分最高
4 起送价最低
5 距离最近
6 配送费最低
7 人均低到高
8 人均高到低
page_index Integer 1 页号 默认第1页
page_size Integer 20 每页数量,固定20返回,可忽略此字体
migFilter List<String> ["-5"] 筛选参数
-3 免配送费
-4 0元起送
-5 支持开发票
-7美团专送
-8 新商家
-9 品牌商家
510 货到付款
511 跨天预订
navigateType Integer 910 金刚code(无金刚接口请忽略)
categoryType Integer 910 一级品类(获取筛选栏数据接口中category_filter_list中的code)
secondCategoryType Integer 100561 二级品类(获取筛选栏数据接口中sub_category_list中的code,此值非空时一级品类categoryType须传)
idCardHash String xxx 可传入您系统的userid
bankCardHash String xxx 可传入您系统的userid
deviceHash String xxx 可传入您系统的userid
thirdUserIdHash String xxx 可传入您系统的userid

# 业务响应

名称 类型 是否非空 说明
poi_total_num Integer 符合搜索的商家总数
have_next_page Integer 是否有下一页
current_page_index Integer 当前页号
page_size Integer 每页数量
openPoiBaseInfoList List<PoiBase> 商家信息

PoiBase结构

名称 类型 是否非空 说明
wm_poi_id Long 商家ID
encryptPoiId String 加密后的商家ID字符串(做购物车时可用做商家菜品唯一key,因为wm_poi_id数值类型值会动态变化)
status Integer 营业状态 1:可配送 2:忙碌中 3:休息中
status_desc String 营业状态描述
name String 商家名称
pic_url String 商家图片url
address String 商家地址
shipping_fee Double 配送费
min_price Double 起送价
wm_poi_score Double 商家评分
avg_delivery_time Integer 平均配送时间 (单位:分钟)
distance String 我和商家的距离
longitude Integer 商家位置经度
latitude Integer 商家位置纬度
delivery_type Integer 配送类型,1:美团专送,0:非美团专送
invoice_support Integer 是否支持开发票,1:支持 0:不支持
invoice_min_price Integer 开发票最低金额要求
address String 餐厅地址
poi_type_icon String 商家图片角标
average_price_tip String 人均价格展示文案
product_list List<PoiProductDTO> 菜品列表,搜索时有
discounts List<PoiDiscountDTO> 门店活动信息

PoiProductDTO结构

名称 类型 是否非空 说明
id Long 商品ID
name Integer 商品名称
min_price String 最低价
unit String 单位(如“份”)
tag String 所属类别,如有多个,则用,分隔
description String 菜品描述
picture String 菜品图片
status String 状态 0:正常销售中 1:已售完 2:已抢光 3:非可售时间
sku_label String 库存量名称

PoiDiscountDTO结构

名称 类型 是否非空 说明
info String 活动描述文案(实际支付18元返1元商家代金券)
icon_url String 活动图标url
reduceFree String 优惠金额
name String 活动名称

# 响应示例

参数:

 {
    "ts": 1537240257,
    "method": "waimai.poi.list",
    "sign": "zetMoLCXpFjUAwNGyAb44g==",
    "page_index": 1,
    "page_size": 20,
    "latitude": "40010747",
    "longitude": "116488629",
    "idCardHash": "1111",
    "bankCardHash": "2222",
    "deviceHash": "3333",
    "thirdUserIdHash": "4444",
    "keyword": "王彩"
}

结果:

{
  "status": 0,
  "msg": "成功",
  "data": {
    "poi_total_num": 2,
    "have_next_page": 0,
    "current_page_index": 1,
    "page_size": 20,
    "openPoiBaseInfoList": [
      {
        "wm_poi_id": "601637",
        "status": 1,
        "status_desc": "可配送",
        "name": "王彩_活动_专用门店(勿动)",
        "pic_url": "https://p1.meituan.net/xianfu/f0aac8c1b910a38dac894f83f5ae9eed31493.jpg",
        "shipping_fee": 5,
        "min_price": 20,
        "wm_poi_score": 5,
        "avg_delivery_time": 70,
        "distance": "11.4km",
        "delivery_type": 0,
        "invoice_support": 1,
        "longitude": 116582574,
        "latitude": 40083284,
        "invoice_min_price": 10,
        "address": "北京首都国际机场",
        "product_list": [],
        "average_price_tip": "",
        "poi_type_icon": "https://p0.meituan.net/aichequan/f88262384aa71e387b8bf05b264f77ea2939.png",
        "discounts": [
          {
            "info": "满10减5;满20减10;满30减15;满40减20;满50减25",
            "icon_url": "https://p0.meituan.net/xianfu/f8bc8dffdbc805878aa3801a33f563cd1001.png",
            "reduceFree": "0.0",
            "name": ""
          },
          {
            "info": "本店新用户立减2.22元",
            "icon_url": "https://p1.meituan.net/xianfu/1cc4324d7d2f59f2cccb6920b57cd0902048.png",
            "reduceFree": "0.0",
            "name": ""
          },
          {
            "info": "有机会领取商家代金券",
            "icon_url": "https://p0.meituan.net/xianfu/c2c0f31d0ebf0f60af115d058169c492992.png",
            "reduceFree": "0.0",
            "name": ""
          },
          {
            "info": "实际支付20元返3元商家代金券",
            "icon_url": "https://p0.meituan.net/xianfu/652eea4034250563fe11b02e3219ba8d981.png",
            "reduceFree": "0.0",
            "name": ""
          },
          {
            "info": "满15元赠送满赠100个混混",
            "icon_url": "https://p1.meituan.net/xianfu/5ffe01c550a139db693d152cefd1b247869.png",
            "reduceFree": "0.0",
            "name": ""
          },
          {
            "info": "购买指定商品有赠品",
            "icon_url": "https://p1.meituan.net/xianfu/04d485a1b8e040bff21c02c19a9731d92048.png",
            "reduceFree": "0.0",
            "name": ""
          },
          {
            "info": "下单多减5.55元,限07:00-11:00;下单多减5.55元,限14:00-19:45",
            "icon_url": "https://p0.meituan.net/xianfu/538a2adfab46a37ec42853aece765704603.png",
            "reduceFree": "0.0",
            "name": ""
          }
        ]
      },
      {
        "wm_poi_id": "107263",
        "status": 1,
        "status_desc": "可配送",
        "name": "王彩_超市_活动专用门店(勿动)",
        "pic_url": "https://p1.meituan.net/xianfu/3b5d03cf88f71befc4484236046e6d7e6144.jpg",
        "shipping_fee": 11.1,
        "min_price": 15,
        "wm_poi_score": 4.1,
        "avg_delivery_time": 40,
        "distance": "424m",
        "delivery_type": 1,
        "invoice_support": 1,
        "longitude": 116485905,
        "latitude": 40007561,
        "invoice_min_price": 0,
        "address": "望京东路4号科创大厦",
        "product_list": [
          {
            "id": 10418360,
            "name": "到你家 哦婆婆 公司金融 丁宁",
            "min_price": null,
            "unit": null,
            "tag": null,
            "description": null,
            "picture": "https://p1.meituan.net/wmproduct/934c034f58c5b4b089b7c2684e5a3ff3187488.jpg",
            "status": null,
            "sku_label": null,
            "price": 36
          }
        ],
        "average_price_tip": "",
        "poi_type_icon": "https://p0.meituan.net/aichequan/f88262384aa71e387b8bf05b264f77ea2939.png",
        "discounts": [
          {
            "info": "本店新用户立减1元, 新用户立减8元,首次使用美团支付最高再减3元",
            "icon_url": "https://p1.meituan.net/xianfu/1cc4324d7d2f59f2cccb6920b57cd0902048.png",
            "reduceFree": "0.0",
            "name": ""
          },
          {
            "info": "满5元赠送可口可乐",
            "icon_url": "https://p1.meituan.net/xianfu/5ffe01c550a139db693d152cefd1b247869.png",
            "reduceFree": "0.0",
            "name": ""
          },
          {
            "info": "购买指定商品有赠品",
            "icon_url": "https://p1.meituan.net/xianfu/04d485a1b8e040bff21c02c19a9731d92048.png",
            "reduceFree": "0.0",
            "name": ""
          }
        ]
      }
    ],
    "total_pages": null
  }
}

# 2.3 菜品列表

###接口说明

名称 描述
功能 获取商家菜品列表
HTTP方法 POST
请求方 第三方渠道
响应方 美团企业版平台
uri /waimai/v1/poi/food
method waimai.poi.food

# 业务请求参数

名称 类型 是否必填 示例 说明
wm_poi_id Long 606737 商家ID
longitude Integer 116491116 用户当前经度
latitude Integer 40002102 用户当前纬度
idCardHash String xxx 可传入您系统的userid
bankCardHash String xxx 可传入您系统的userid
deviceHash String xxx 可传入您系统的userid
thirdUserIdHash String xxx 可传入您系统的userid

# 业务响应

名称 类型 是否非空 说明
food_spu_tags List<FoodSpuTag> 菜品类别
poi_info PoiInfo 商家信息

FoodSpuTag结构

名称 类型 是否非空 说明
tag Long 类别ID
type Integer 1:普通类型 2:折扣菜 3:热销
tagType Integer 必选类型: 0:普通分类(如有必选分类, 下单需选择必选分类中菜品);1:必选分类;2:可单独结算分类
name String 类别名
icon String 类别图标
description String 描述
sequence int 排序序号
spus List<Spu> 菜品

Spu结构

名称 类型 是否非空 说明
id Long 商品ID(SPU_ID)
name String 规格名称
min_prise Double 最低价
unit String 单位:份
tag Integer 所属类别,如有多个,则用‘,’分隔
description String 菜品描述
picture String 菜品图片
status Integer 状态 0:正常销售中 1:已售完 2:已抢光 3:非可售时间
sku_label String 规格
skus List<Sku> 库存
attrs List<AttrsDTO> 属性

Sku结构

名称 类型 是否非空 说明
id Long 库存量ID
spec String 规格名称,例如:大份
description String 描述
picture String 图片URL
price Double 价格
origin_price Double 原价
box_num Integer 餐盒个数
box_price Double 餐盒价格
min_order_count Integer 最低起送数量(0表示不限制起送数量,数量=0如美团App上点加号时就是+1,而数量=2就是商品+2了)
status Integer 状态 0:正常销售中 1:已售完 3:非可售时间
stock Integer 库存数 -1:无限库存,0 无库存,>0 有库存

AttrsDTO

名称 类型 是否非空 说明
name String 属性名,例如:奶茶温度
values List<AttrValuesDTO> 可选属性

AttrValuesDTO

名称 类型 是否非空 说明
id Long 属性名,例如:奶茶温度
value String 可选属性

PoiInfo结构

名称 类型 是否非空 说明
id Long 商家ID
encryptPoiId String 加密后的商家ID字符串(做购物车时可用做商家菜品唯一不变的key,因为wm_poi_id数值类型值会动态变化)
name String 商家名称
status Integer 营业状态 1:可配送 2:忙碌中 3:休息中
shipping_time String 营业时间
shipping_fee Double 配送费
avg_delivery_time Integer 平均配送时间
min_price Double 最小起送价
bulletin String 商家提示
support_pay Integer 是否支持在线支付 1:支持 0:不支持
invoice_support Integer 是否支持开发票 1:支持 0:不支持
invoice_min_price Integer 开发票最低购买金额
wm_poi_score Double 商家评分
pic_url String 商家图片
delivery_type Integer 配送类型 1:美团配送 0:非美团配送
discounts List<PoiDiscountDTO> 优惠活动信息

PoiDiscountDTO结构

名称 类型 是否非空 说明
info String 活动描述文案(实际支付18元返1元商家代金券)
icon_url String 活动图标url
reduceFree String 优惠金额
name String 活动名称

# 响应示例

{
    "ts": 1530615298,
    "method": "waimai.poi.food",
    "sign": "zetMoLCXpFjUAwNGyAb44g==",
    "latitude": 40010747,
    "longitude": 116488629,
    "idCardHash": "1111",
    "bankCardHash": "2222",
    "deviceHash": "3333",
    "thirdUserIdHash": "4444",
    "wm_poi_id": 601637
}
{
    "status": 0,
    "msg": "成功",
    "data": {
        "food_spu_tags": [
            {
                "tag": "100",
                 "type": 3,
                 "tagType": 0,
                "name": "热销",
                "icon": "https://p1.meituan.net/aichequan/87f966955f693102d67daf2ec44b58411361.png",
                "description": "",
                "spus": [
                    {
                        "id": "1573584674",
                        "name": "素颜樱葡",
                        "min_price": 22,
                        "unit": "份",
                        "tag": "105183835",
                        "description": "无可比喻的颜值,选用葡萄酵素,由多种水果发酵而成的复合型酵素,风味类似与果醋。",
                        "picture": "https://p0.meituan.net/wmproduct/b5c884094924f312cd252c767e1b6d19271006.jpg",
                        "status": 0,
                        "sku_label": "规格",
                        "skus": [
                            {
                                "id": "1793361032",
                                "spec": "",
                                "description": "无可比喻的颜值,选用葡萄酵素,由多种水果发酵而成的复合型酵素,风味类似与果醋。",
                                "picture": "https://p0.meituan.net/wmproduct/b5c884094924f312cd252c767e1b6d19271006.jpg",
                                "price": 22,
                                "origin_price": 22,
                                "box_num": 1,
                                "box_price": 1,
                                "min_order_count": 1,
                                "status": 0,
                                "stock": -1
                            }
                        ],
                        "attrs": [
                            {
                                "name": "温度",
                                "values": [
                                    {
                                        "id": "942801794",
                                        "value": "常规冰"
                                    },
                                    {
                                        "id": "942801795",
                                        "value": "少冰"
                                    },
                                    {
                                        "id": "942801796",
                                        "value": "多冰"
                                    }
                                ]
                            },
                            {
                                "name": "甜度",
                                "values": [
                                    {
                                        "id": "942801797",
                                        "value": "常规糖"
                                    },
                                    {
                                        "id": "942801798",
                                        "value": "半糖"
                                    },
                                    {
                                        "id": "942801799",
                                        "value": "多糖"
                                    }
                                ]
                            }
                        ]
                    },
                    {
                        "id": "1576600540",
                        "name": "鲜奶小莓(草莓脏脏茶)",
                        "min_price": 22,
                        "unit": "份",
                        "tag": "105058679",
                        "description": "草莓的酸甜舞步,在鲜奶里被重新演绎。健康的鲜奶与新鲜的草莓搭配在一起,在选用茉莉绿茶做基底,喝一口唇齿萦绕着茉莉的清香,果肉与鲜奶直入心底,回味无穷。",
                        "picture": "https://p0.meituan.net/wmproduct/f299d02c4f5a1534b399025f608c7e1d99690.jpg",
                        "status": 0,
                        "sku_label": "规格",
                        "skus": [
                            {
                                "id": "1796337755",
                                "spec": "",
                                "description": "草莓的酸甜舞步,在鲜奶里被重新演绎。健康的鲜奶与新鲜的草莓搭配在一起,在选用茉莉绿茶做基底,喝一口唇齿萦绕着茉莉的清香,果肉与鲜奶直入心底,回味无穷。",
                                "picture": "https://p0.meituan.net/wmproduct/f299d02c4f5a1534b399025f608c7e1d99690.jpg",
                                "price": 22,
                                "origin_price": 22,
                                "box_num": 1,
                                "box_price": 1,
                                "min_order_count": 1,
                                "status": 0,
                                "stock": 9987
                            }
                        ],
                        "attrs": [
                            {
                                "name": "温度",
                                "values": [
                                    {
                                        "id": "942778212",
                                        "value": "常规冰"
                                    },
                                    {
                                        "id": "942778213",
                                        "value": "少冰"
                                    },
                                    {
                                        "id": "942778214",
                                        "value": "多冰"
                                    }
                                ]
                            },
                            {
                                "name": "甜度",
                                "values": [
                                    {
                                        "id": "942778215",
                                        "value": "常规糖"
                                    },
                                    {
                                        "id": "942795703",
                                        "value": "半糖"
                                    },
                                    {
                                        "id": "942795704",
                                        "value": "多糖"
                                    }
                                ]
                            }
                        ]
                    },
                    {
                        "id": "1573336924",
                        "name": "百香果之梦",
                        "min_price": 20,
                        "unit": "份",
                        "tag": "105183835",
                        "description": "现泡纯茶与精心挑选的新鲜百香果的邂逅,尝果之甜,品茶之香,冰块给予果茶清凉可人,愉悦心扉,送你一整夏的透心凉。",
                        "picture": "https://p0.meituan.net/wmproduct/cef8f06ff9acf68c866fe1dd17554877302550.jpg",
                        "status": 0,
                        "sku_label": "规格",
                        "skus": [
                            {
                                "id": "1793251866",
                                "spec": "",
                                "description": "现泡纯茶与精心挑选的新鲜百香果的邂逅,尝果之甜,品茶之香,冰块给予果茶清凉可人,愉悦心扉,送你一整夏的透心凉。",
                                "picture": "https://p0.meituan.net/wmproduct/cef8f06ff9acf68c866fe1dd17554877302550.jpg",
                                "price": 20,
                                "origin_price": 20,
                                "box_num": 1,
                                "box_price": 1,
                                "min_order_count": 1,
                                "status": 0,
                                "stock": 9985
                            }
                        ],
                        "attrs": [
                            {
                                "name": "温度",
                                "values": [
                                    {
                                        "id": "942803548",
                                        "value": "常规冰"
                                    },
                                    {
                                        "id": "942803549",
                                        "value": "少冰"
                                    },
                                    {
                                        "id": "942803550",
                                        "value": "多冰"
                                    }
                                ]
                            },
                            {
                                "name": "甜度",
                                "values": [
                                    {
                                        "id": "942803551",
                                        "value": "常规糖"
                                    },
                                    {
                                        "id": "942803552",
                                        "value": "半糖"
                                    },
                                    {
                                        "id": "942803553",
                                        "value": "多糖"
                                    }
                                ]
                            }
                        ]
                    },
                    {
                        "id": "1570886390",
                        "name": "芒果嘟嘟",
                        "min_price": 26,
                        "unit": "份",
                        "tag": "105057804",
                        "description": "新鲜的芒果,配上特制的益生菌奶盖,口感丝滑细腻,回味丰富,易于吸收,满足一天所需的维C。",
                        "picture": "https://p1.meituan.net/wmproduct/ada559afee46552bde62aafda16d4a8090824.jpg",
                        "status": 0,
                        "sku_label": "规格",
                        "skus": [
                            {
                                "id": "1790337281",
                                "spec": "",
                                "description": "新鲜的芒果,配上特制的益生菌奶盖,口感丝滑细腻,回味丰富,易于吸收,满足一天所需的维C。",
                                "picture": "https://p1.meituan.net/wmproduct/ada559afee46552bde62aafda16d4a8090824.jpg",
                                "price": 26,
                                "origin_price": 26,
                                "box_num": 1,
                                "box_price": 1,
                                "min_order_count": 1,
                                "status": 0,
                                "stock": -1
                            }
                        ],
                        "attrs": [
                            {
                                "name": "温度",
                                "values": [
                                    {
                                        "id": "942725246",
                                        "value": "常规冰"
                                    },
                                    {
                                        "id": "942725247",
                                        "value": "少冰"
                                    },
                                    {
                                        "id": "942725248",
                                        "value": "多冰"
                                    }
                                ]
                            },
                            {
                                "name": "甜度",
                                "values": [
                                    {
                                        "id": "942786589",
                                        "value": "常规糖"
                                    },
                                    {
                                        "id": "942786590",
                                        "value": "半糖"
                                    },
                                    {
                                        "id": "942786591",
                                        "value": "多糖"
                                    }
                                ]
                            }
                        ]
                    },
                    {
                        "id": "1571204294",
                        "name": "草莓嘟嘟",
                        "min_price": 28,
                        "unit": "份",
                        "tag": "105057804",
                        "description": "新鲜的草莓,配上特制的益生菌奶盖,口感丝滑细腻,回味丰富,易于吸收,满足一天所需的维C。",
                        "picture": "https://p0.meituan.net/wmproduct/3deea1a33f967dbb2c589ea4d3147d82267811.jpg",
                        "status": 0,
                        "sku_label": "规格",
                        "skus": [
                            {
                                "id": "1790491911",
                                "spec": "",
                                "description": "新鲜的草莓,配上特制的益生菌奶盖,口感丝滑细腻,回味丰富,易于吸收,满足一天所需的维C。",
                                "picture": "https://p0.meituan.net/wmproduct/3deea1a33f967dbb2c589ea4d3147d82267811.jpg",
                                "price": 28,
                                "origin_price": 28,
                                "box_num": 1,
                                "box_price": 1,
                                "min_order_count": 1,
                                "status": 0,
                                "stock": -1
                            }
                        ],
                        "attrs": [
                            {
                                "name": "温度",
                                "values": [
                                    {
                                        "id": "942757780",
                                        "value": "常规冰"
                                    },
                                    {
                                        "id": "942757781",
                                        "value": "少冰"
                                    },
                                    {
                                        "id": "942757782",
                                        "value": "多冰"
                                    }
                                ]
                            },
                            {
                                "name": "甜度",
                                "values": [
                                    {
                                        "id": "942783894",
                                        "value": "常规糖"
                                    },
                                    {
                                        "id": "942783895",
                                        "value": "半糖"
                                    },
                                    {
                                        "id": "942783896",
                                        "value": "全糖"
                                    }
                                ]
                            }
                        ]
                    }
                ]
            }
        ],
        "poi_info": {
            "id": "510161533434868",
            "name": "寻花吻茶(建外SOHO店)",
            "status": 1,
            "shipping_time": "10:30-20:00",
            "shipping_fee": 3,
            "avg_delivery_time": 30,
            "min_price": 20,
            "bulletin": "",
            "app_delivery_tip": "",
            "support_pay": 1,
            "invoice_support": 0,
            "invoice_min_price": 0,
            "wm_poi_score": 5,
            "pic_url": "https://p0.meituan.net/waimaipoi/e1721cadb4cdaddd444bedb01e1d965b227853.jpg",
            "delivery_type": 0,
            "discounts": [],
            "encryptPoiId": "ZnpQdWRwNzBwTWtHSWZXNzNVejN2QQ",
            "wm_poi_id": "510161533434868"
        }
    }
}



# 2.3.1 spu多规格属性弹框

特别说明1:原来点「+」号的弹出的属性逻辑不变,保持现在的不动
特别说明2:原来点「选规格」时用的是spu中的attrs属性,现需要升级在点“选规格”时,调用此接口,用响应结果中spu_attrs当弹出层的属性规格
特别说明3:添加购物车时,计算价格需要调用2.4 订单预览其计算出来的价格为展示价格

###接口说明

名称 描述
功能 查询商家菜品多规格属性,点「选规格」时调用此接口,属性弹出层
HTTP方法 POST
请求方 第三方渠道
响应方 美团企业版平台
uri /waimai/v1/poi/food/multiAttr
method waimai.poi.foodSkuAttr

# 业务请求参数

名称 类型 是否必填 示例 说明
wm_poi_id Long 481050284967610 商家ID
spu_id Long 5149971880 对应2.3菜品列表接口中的Spu结构中的id

# 业务响应

名称 类型 是否非空 说明
foodSpuMutilAttrDTO FoodSpuMutilAttrDTO 新菜品属性

FoodSpuMutilAttrDTO结构

名称 类型 是否非空 说明
spu_attrs List<AttrsDTO> 库存量ID
sku_attrs_map map skuid与attr属性id的映射关系: 只有存在可售卖属性(mode=2)时才有映射关系
key是skuId,value是spu_attrs中values中的id
注:根据选择可售卖属性时通过此map来计算判断出具体的skuId,
有了此skuId即为订单预览接口中的wm_food_sku_id,
所选择的属性的id即为订单预览接口food_spu_attr_ids的值
更多参见6. 【可售卖属性匹配skuId】中的说明

AttrsDTO

名称 类型 是否非空 说明
name String 属性名,例如:奶茶温度
values List<AttrValuesDTO> 可选属性
mode int 1:非售卖属性,2:售卖属性

AttrValuesDTO

名称 类型 是否非空 说明
id Long 属性名,例如:奶茶温度
value String 可选属性
status int 状态: 1可售卖 2不可售卖(如果不可用(库存校验/售罄/不可售状态/不在可售时间/属性下架等),则置灰展示,不可选)
price double 价格(0即无价格)
mutex_attr_ids List<Long> 和本属性值互斥属性id列表
如选中的属性与其他属性存在互斥关系时,未选中的互斥属性置灰,不可选;
sequence int 排序序号
selected int 是否选中 1是 0否
即使此字段值=1为选中状态,还需要从上到下遍历mutex_attr_ids是否存在互斥关系,如果存在则也不可选

# 响应示例

    {
      "ts": 1626232638,
      "method": "waimai.poi.foodSkuAttr",
      "sign": "AgQOxUd5UYQO3II0ex0o1111==",
      "wm_poi_id": 481050284967610,
      "spu_id": 5149971880
    }
{
    "status": 0,
    "msg": "成功",
    "data": {
 
       "spu_attrs": [
         {
           "name": "规格",
           "values": [
             {
               "id": 8889050052,
               "value": "常规",
               "status": 1,
               "price": 29.0,
               "mutex_attr_ids": [],
               "sequence": 1,
               "selected": 1
             }
           ],
           "mode": 2
         },
         {
           "name": "0糖0卡糖",
           "values": [
             {
               "id": 8889050026,
               "value": "常规",
               "status": 1,
               "price": 0.0,
               "mutex_attr_ids": [],
               "sequence": 1,
               "selected": 1
             },
             {
               "id": 8889050028,
               "value": "原创0糖0卡糖",
               "status": 1,
               "price": 1.0,
               "mutex_attr_ids": [],
               "sequence": 2,
               "selected": 0
             }
           ],
           "mode": 2
         },
         {
           "name": "是否配勺",
           "values": [
             {
               "id": 8889050025,
               "value": "常规",
               "status": 1,
               "price": 0.0,
               "mutex_attr_ids": [],
               "sequence": 1,
               "selected": 1
             },
             {
               "id": 8889050031,
               "value": "需配勺(品尝果肉用)",
               "status": 1,
               "price": 0.1,
               "mutex_attr_ids": [],
               "sequence": 5,
               "selected": 0
             }
           ],
           "mode": 2
         },
         {
           "name": "加料",
           "values": [
             {
               "id": 8889050024,
               "value": "常规",
               "status": 1,
               "price": 0.0,
               "mutex_attr_ids": [],
               "sequence": 1,
               "selected": 1
             },
             {
               "id": 8889050029,
               "value": "爆双倍果肉",
               "status": 1,
               "price": 5.0,
               "mutex_attr_ids": [],
               "sequence": 23,
               "selected": 0
             },
             {
               "id": 8889050030,
               "value": "益生菌",
               "status": 1,
               "price": 3.0,
               "mutex_attr_ids": [],
               "sequence": 24,
               "selected": 0
             }
           ],
           "mode": 2
         },
         {
           "name": "菠萝片分装",
           "values": [
             {
               "id": 8889050035,
               "value": "不分装",
               "status": 1,
               "price": 0.0,
               "mutex_attr_ids": [],
               "sequence": 28,
               "selected": 1
             },
             {
               "id": 8889050027,
               "value": "分装",
               "status": 1,
               "price": 1.0,
               "mutex_attr_ids": [
                 8889050041
               ],
               "sequence": 29,
               "selected": 0
             }
           ],
           "mode": 2
         },
         {
           "name": "绿色喜茶",
           "values": [
             {
               "id": 8889050032,
               "value": "PLA可降解吸管(推荐)",
               "status": 1,
               "price": 0.0,
               "mutex_attr_ids": [],
               "sequence": 3,
               "selected": 1
             },
             {
               "id": 8889050034,
               "value": "不使用吸管",
               "status": 1,
               "price": 0.0,
               "mutex_attr_ids": [],
               "sequence": 4,
               "selected": 0
             }
           ],
           "mode": 1
         },
         {
           "name": "状态",
           "values": [
             {
               "id": 8889050038,
               "value": "冰沙(推荐)",
               "status": 1,
               "price": 0.0,
               "mutex_attr_ids": [
                 8889050039
               ],
               "sequence": 6,
               "selected": 1
             },
             {
               "id": 8889050051,
               "value": "非冰沙",
               "status": 1,
               "price": 0.0,
               "mutex_attr_ids": [],
               "sequence": 7,
               "selected": 0
             }
           ],
           "mode": 1
         },
         {
           "name": "冰量",
           "values": [
             {
               "id": 8889050049,
               "value": "正常(推荐)",
               "status": 1,
               "price": 0.0,
               "mutex_attr_ids": [],
               "sequence": 8,
               "selected": 1
             },
             {
               "id": 8889050042,
               "value": "少冰",
               "status": 1,
               "price": 0.0,
               "mutex_attr_ids": [],
               "sequence": 9,
               "selected": 0
             },
             {
               "id": 8889050043,
               "value": "少少冰",
               "status": 1,
               "price": 0.0,
               "mutex_attr_ids": [],
               "sequence": 10,
               "selected": 0
             },
             {
               "id": 8889050039,
               "value": "去冰",
               "status": 1,
               "price": 0.0,
               "mutex_attr_ids": [
                 8889050038
               ],
               "sequence": 11,
               "selected": 0
             }
           ],
           "mode": 1
         },
         {
           "name": "甜度",
           "values": [
             {
               "id": 8889050048,
               "value": "标准甜(推荐)",
               "status": 1,
               "price": 0.0,
               "mutex_attr_ids": [],
               "sequence": 12,
               "selected": 1
             },
             {
               "id": 8889050045,
               "value": "少甜",
               "status": 1,
               "price": 0.0,
               "mutex_attr_ids": [],
               "sequence": 13,
               "selected": 0
             },
             {
               "id": 8889050044,
               "value": "少少甜",
               "status": 1,
               "price": 0.0,
               "mutex_attr_ids": [],
               "sequence": 14,
               "selected": 0
             }
           ],
           "mode": 1
         },
         {
           "name": "做法",
           "values": [
             {
               "id": 8889050033,
               "value": "一半果茸一半果丁",
               "status": 1,
               "price": 0.0,
               "mutex_attr_ids": [],
               "sequence": 18,
               "selected": 1
             },
             {
               "id": 8889050037,
               "value": "全果茸",
               "status": 1,
               "price": 0.0,
               "mutex_attr_ids": [],
               "sequence": 19,
               "selected": 0
             },
             {
               "id": 8889050036,
               "value": "全果丁",
               "status": 1,
               "price": 0.0,
               "mutex_attr_ids": [],
               "sequence": 20,
               "selected": 0
             }
           ],
           "mode": 1
         },
         {
           "name": "口味",
           "values": [
             {
               "id": 8889050046,
               "value": "标准(含海盐)",
               "status": 1,
               "price": 0.0,
               "mutex_attr_ids": [],
               "sequence": 21,
               "selected": 1
             },
             {
               "id": 8889050040,
               "value": "去海盐",
               "status": 1,
               "price": 0.0,
               "mutex_attr_ids": [],
               "sequence": 22,
               "selected": 0
             }
           ],
           "mode": 1
         },
         {
           "name": "特调糖烤菠萝片",
           "values": [
             {
               "id": 8889050047,
               "value": "标准(特调糖烤菠萝片)",
               "status": 1,
               "price": 0.0,
               "mutex_attr_ids": [],
               "sequence": 25,
               "selected": 1
             },
             {
               "id": 8889050050,
               "value": "菠萝片(去烤糖)",
               "status": 1,
               "price": 0.0,
               "mutex_attr_ids": [],
               "sequence": 26,
               "selected": 0
             },
             {
               "id": 8889050041,
               "value": "去菠萝片",
               "status": 1,
               "price": 0.0,
               "mutex_attr_ids": [
                 8889050027
               ],
               "sequence": 27,
               "selected": 0
             }
           ],
           "mode": 1
         }
       ],
       "sku_attrs_map": {
         "6060127978": [
           8889050024,
           8889050052,
           8889050025,
           8889050027,
           8889050026
         ],
         "6060127979": [
           8889050024,
           8889050052,
           8889050025,
           8889050027,
           8889050028
         ],
         "6060127980": [
           8889050024,
           8889050052,
           8889050025,
           8889050035,
           8889050026
         ],
         "6060127981": [
           8889050024,
           8889050052,
           8889050025,
           8889050035,
           8889050028
         ],
         "6060127982": [
           8889050024,
           8889050052,
           8889050031,
           8889050027,
           8889050026
         ],
         "6060127983": [
           8889050024,
           8889050052,
           8889050031,
           8889050027,
           8889050028
         ],
         "6060127984": [
           8889050024,
           8889050052,
           8889050031,
           8889050035,
           8889050026
         ],
         "6060127985": [
           8889050024,
           8889050052,
           8889050031,
           8889050035,
           8889050028
         ],
         "6060127986": [
           8889050029,
           8889050052,
           8889050025,
           8889050027,
           8889050026
         ],
         "6060127987": [
           8889050029,
           8889050052,
           8889050025,
           8889050027,
           8889050028
         ],
         "6060127988": [
           8889050029,
           8889050052,
           8889050025,
           8889050035,
           8889050026
         ],
         "6060127989": [
           8889050029,
           8889050052,
           8889050025,
           8889050035,
           8889050028
         ],
         "6060127990": [
           8889050029,
           8889050052,
           8889050031,
           8889050027,
           8889050026
         ],
         "6060127991": [
           8889050029,
           8889050052,
           8889050031,
           8889050027,
           8889050028
         ],
         "6060127992": [
           8889050029,
           8889050052,
           8889050031,
           8889050035,
           8889050026
         ],
         "6060127993": [
           8889050029,
           8889050052,
           8889050031,
           8889050035,
           8889050028
         ],
         "6060127994": [
           8889050030,
           8889050052,
           8889050025,
           8889050027,
           8889050026
         ],
         "6060127995": [
           8889050030,
           8889050052,
           8889050025,
           8889050027,
           8889050028
         ],
         "6060127996": [
           8889050030,
           8889050052,
           8889050025,
           8889050035,
           8889050026
         ],
         "6060127997": [
           8889050030,
           8889050052,
           8889050025,
           8889050035,
           8889050028
         ],
         "6060127998": [
           8889050030,
           8889050052,
           8889050031,
           8889050027,
           8889050026
         ],
         "6060127999": [
           8889050030,
           8889050052,
           8889050031,
           8889050027,
           8889050028
         ],
         "6060128000": [
           8889050030,
           8889050052,
           8889050031,
           8889050035,
           8889050026
         ],
         "6060128001": [
           8889050030,
           8889050052,
           8889050031,
           8889050035,
           8889050028
         ]
       }
     }
   }

# 2.4 订单预览

###接口说明

名称 描述
功能 预览订单中相关产品
HTTP方法 POST
请求方 第三方渠道
响应方 美团企业版平台
uri /waimai/v1/order/preview
method waimai.order.preview

# 业务请求参数

名称 类型 是否必填 示例 说明
user_phone String 13812345678 用户登录手机号
wm_ordering_list WmOrderingList - 订单信息
wm_ordering_user WmOrderingUser - 收餐人详细信息
idCardHash String xxx 可传入您系统的userid
bankCardHash String xxx 可传入您系统的userid
deviceHash String xxx 可传入您系统的userid
thirdUserIdHash String xxx 可传入您系统的userid

WmOrderingList结构

名称 类型 是否必填 示例 说明
wm_poi_id Long 606737 商家ID
delivery_time Integer 0 用户选择的送达时间 0为立即送出
pay_type Integer 2 支付类型 1-餐到付款 2-在线付款
food_list List<FoodListItem> - 所点菜品信息

FoodListItem结构

名称 类型 是否必填 示例 说明
wm_food_sku_id Long 1347047 菜品SKU-ID
count Integer 2 菜品数量
food_spu_attr_ids List<Long> 1,2,3 (注:详见下面5.关于菜品规格属性说明)菜品规格属性:菜品列表food接口响应结果中的food_spu_tags.spus.atts.values.id

WmOrderingUser结构

名称 类型 是否必填 示例 说明
user_phone String 13812345678 收餐人手机
user_name String 张三 收餐人
user_address String 北京市朝阳区XXX 收餐地址
house_number String 308号 门牌号
user_caution String 少放辣 用户备注
user_invoice String - 发票抬头
invoice_taxpayer_id String - 纳税人识别号
user_latitude Integer - 用户当前纬度
user_longitude Integer - 用户当前精度
addr_longitude Integer - 收餐地址精度
addr_latitude Integer - 收餐地址纬度

# 业务响应

名称 类型 是否非空 说明
code Integer 订单预览状态码 0成功,其它code对应描述见下msg
msg String 错误提示:
**订单预览状态码 code !=0 **见此字段提示信息
1 失败
2 商家不可买
3 菜品不可买
4 不在配送时间内
5 菜品未达起送金额
15 未达到最小菜品起送份数
20 缺少必选菜品
21 菜品信息为空
26 商家不支持此配送类型
29:菜品信息属性发生变化
其他 系统维护,稍后重试
wm_ordering_preview_order_vo WmOrderingPreviewOrder 订单信息
wm_ordering_preview_detail_vo_list List<WmOrderingPreviewDetail> 订单菜品
wm_ordering_unavaliable_food_vo_list List<UnavaliableFood> 不可购买的菜品列表
min_count_foodlist List<MinCountFood> 不满足最低购买数量的菜品列表
discountWarnTip String 2
token String 订单Token,调用提交订单接口时,需要作为参数传递过来
reduceTotalFree String 此单总共优惠金额
discounts List<PoiDiscountDTO> 优惠活动信息

WmOrderingPreviewOrder结构

名称 类型 是否非空 说明
recipient_address String 收餐人地址
recipient_name String 收餐人姓名
recipient_phone String 收餐人手机
recipient_phone_encrypt String 收餐人加密手机号
shipping_fee Double 配送费
estimate_arrival_time Long 预计到达时间
caution String 备注
invoice_title String 发票抬头
invoice_taxpayer_id String 纳税人识别号
wm_order_pay_type Integer 支付类型
wm_poi_id Long 对应商家ID
poi_name String 商家名称
wm_poi_min_fee Integer 商家最少起送价
total Double 总价
original_price Double 原价
box_total_price Double 餐盒费
user_phone String 下单用户手机号
user_phone_encrypt String 下单用户加密手机号
is_pre_order Integer 是否是预订单

WmOrderingPreviewDetail结构

名称 类型 是否非空 说明
wm_food_sku_id Long 菜品库存量ID
food_price Double 菜品价格
unit String 单位 例如:大份
count Integer 数量
box_num Integer 餐盒数量
box_price Double 餐盒费
food_name String 菜品名称
origin_food_price Double 菜品原价
wm_ordering_preview_food_spu_attr_list List<PreviewFoodSpuAttr> 菜品属性
spec String 规格 例如:大份
wm_food_spu_id Long 菜品ID

PreviewFoodSpuAttr结构

名称 类型 是否非空 说明
id Long 菜品属性ID
wm_food_spu_id Long 菜品ID
no Integer 序号
name String 名称 例如:温度
value String 值 例如:温热
valid Integer 有效性 (1有效)

UnavaliableFood结构

名称 类型 是否非空 说明
wm_food_sku_id Long 菜品库存量ID
wm_food_name String 菜品名称
stock Long 剩余库存量
wm_food_spu_id Long 菜品ID

MinCountFood结构

名称 类型 是否非空 说明
wm_food_sku_id Long 菜品库存量ID
wm_food_name String 菜品名称
wm_food_spu_id Long 菜品ID
cur_count Integer 当前数量
min_count Integer 最小数量

PoiDiscountDTO结构

名称 类型 是否非空 说明
info String 活动描述文案(实际支付18元返1元商家代金券)
icon_url String 活动图标url
reduceFree String 优惠金额
name String 活动名称

# 响应示例

请求参数:
{
  "sign": "xxxxxxxx",
  "ts": 1561008172,
  "method": "waimai.order.preview",
  "deviceHash": "18010181062",
  "thirdUserIdHash": "5b7c0ce223445f57b36d8ae7",
  "user_phone": "18010181062",
  "wm_ordering_list": {
    "wm_poi_id": "510161533434868",
    "delivery_time": 0,
    "pay_type": 2,
    "food_list": [
      {
        "count": 1,
        "wm_food_sku_id": 1790491911,
        "food_spu_attr_ids": [# 菜品food接口响应结果里的food_spu_tags.spus.attrs.values.id
          942757780,
          942757781,
          942757782
        ]
      }
    ]
  },
  "wm_ordering_user": {
    "user_address": "",
    "user_longitude": 0,
    "user_latitude": 0,
    "addr_longitude": 116451105,
    "addr_latitude": 39915147
  }
}

结果:

{
    "status": 0,
    "msg": "成功",
    "data": {
        "code": 0,
        "wm_ordering_preview_order_vo": {
            "recipient_address": "",
            "recipient_name": null,
            "recipient_phone": "11111111111",
            "recipient_phone_encrypt": "aFUnV3cq66Avn7kmYrLZnA",
            "shipping_fee": 3,
            "estimate_arrival_time": "1561010755",
            "caution": null,
            "invoice_title": null,
            "invoice_taxpayer_id": null,
            "wm_order_pay_type": 2,
            "wm_poi_id": "510161533434868",
            "poi_name": "寻花吻茶(建外SOHO店)",
            "wm_poi_min_fee": null,
            "total": 32,
            "original_price": 32,
            "box_total_price": 1,
            "user_phone": "11111111111",
            "user_phone_encrypt": "aFUnV3cq66Avn7kmYrLZnA",
            "is_pre_order": 0
        },
        "wm_ordering_preview_detail_vo_list": [
            {
                "wm_food_sku_id": "1790491911",
                "food_price": 28,
                "unit": "500ml",
                "count": 1,
                "box_num": 1,
                "box_price": 1,
                "food_name": "草莓嘟嘟",
                "origin_food_price": 28,
                "spec": "",
                "wm_food_spu_id": "1571204294",
                "picture": "https://p0.meituan.net/wmproduct/3deea1a33f967dbb2c589ea4d3147d82267811.jpg",
                "wm_ordering_preview_food_spu_attr_list": [
                    {
                        "id": "942757780",
                        "wm_food_spu_id": "1571204294",
                        "no": 1,
                        "name": "温度",
                        "value": "常规冰",
                        "valid": 1
                    },
                    {
                        "id": "942757781",
                        "wm_food_spu_id": "1571204294",
                        "no": 1,
                        "name": "温度",
                        "value": "少冰",
                        "valid": 1
                    },
                    {
                        "id": "942757782",
                        "wm_food_spu_id": "1571204294",
                        "no": 1,
                        "name": "温度",
                        "value": "多冰",
                        "valid": 1
                    }
                ]
            }
        ],
        "wm_ordering_unavaliable_food_vo_list": null,
        "min_count_foodlist": null,
        "msg": "",
        "discounts": [],
        "discountWarnTip": null,
        "token": "51CB7E46FDDC4228B140F714E2EAE542",
        "reduceTotalFree": "0.0"
    }
}
}

# 2.4.1 预计送达时间列表

###接口说明

名称 描述
功能 根据商家信息获取预计送达时间列表项
HTTP方法 POST
请求方 第三方渠道
响应方 美团企业版平台
uri /waimai/v1/order/arriveTime
method waimai.poi.order.arrivetime

# 业务请求参数

名称 类型 是否必填 示例 说明
longitude Integer 116488645(即116.488645) 用户当前经度(高德经度*1000000
latitude Integer 40007069(即40.007069) 用户当前纬度(高德经度*1000000)
wm_poi_id Long 606737 商家ID

# 响应结果

{
    "status": 0,
    "msg": "成功",
    "data": [
        {
            "date": "今天(周一)",#(String) 预计送达时间日期
            "status": 0,  #(int) 0:正常 1:关闭
            "info": "", #(String) 描述
            "timelist": [
                {
                    "date_type_tip": "立即送达", # (String)类型: 包含立即送达和指定时间两种
                    "view_time": "立即送出", # (String)预计送达时间
                    "unixtime": 0, # (Int)预计送达时间对应的时间戳
                    "view_shipping_fee": "5.0元配送费"  # (String)配送费
                },
                {
                    "date_type_tip": "指定时间",
                    "view_time": "15:10",
                    "unixtime": 1564384200,
                    "view_shipping_fee": "5.0元配送费"
                }
            ]
        },
        {
            "date": "明天(周二)",
            "status": 0,
            "info": "",
            "timelist": [
                {
                    "date_type_tip": "立即送达",
                    "view_time": "立即送出",
                    "unixtime": 0,
                    "view_shipping_fee": "5.0元配送费"
                },
                {
                    "date_type_tip": "指定时间",
                    "view_time": "15:10",
                    "unixtime": 1564384200,
                    "view_shipping_fee": "5.0元配送费"
                }
            ]
        }
    ]
}

# 2.5 提交订单

###接口说明

名称 描述
功能 预览订单中相关产品
HTTP方法 POST
请求方 第三方渠道
响应方 美团企业版平台
uri /waimai/v1/order/submit
method waimai.order.submit

# 业务请求参数

名称 类型 是否必填 示例 说明
user_phone String 13812345678 用户登录手机号
channel_order_id String 3456789 第三方订单号
verify_code String 3214 短信或语音验证码(只在上一次提交订单返回code=13001并自动发送验证码,再次提交时使用
return_url String xx 订单支付后返回的url
wm_ordering_list WmOrderingList - 订单信息
wm_ordering_user WmOrderingUser - 收餐人详细信息
channel_source String - 来源
token String - 订单预览接口响应结果中的token值
idCardHash String xxx 可传入您系统的userid
bankCardHash String xxx 可传入您系统的userid
deviceHash String xxx 可传入您系统的userid
thirdUserIdHash String xxx 可传入您系统的userid
risk_param String - 开通优惠活动需要的风控信息,如不开通优惠活动,则不需要传入

WmOrderingList结构

名称 类型 是否必填 示例 说明
wm_poi_id Long 606737 商家ID
delivery_time Integer 0 用户选择的送达时间 0为立即送出
pay_type Integer 2 支付类型 1:餐到付款 2:在线支付
food_list List<FoodListItem> - 所点菜品信息

FoodListItem结构

名称 类型 是否必填 示例 说明
wm_food_sku_id Long 1347047 库存量ID
count Integer 2 菜品数量
food_spu_attr_ids List<Long> 当有需要选属性规格时必传 1,2 菜品规格属性:用户自己的弹层里勾选的菜品列表food接口响应结果中的food_spu_tags.spus.atts.values.id

WmOrderingUser结构

名称 类型 是否必填 示例 说明
user_phone String 13812345678 收餐人手机
user_name String 张三 收餐人
user_address String 北京市朝阳区XXX 收餐地址
house_number String 308号 门牌号
user_caution String 少放辣 用户备注
user_invoice String - 发票信息
invoice_taxpayer_id String - 纳税人识别号
user_latitude Integer - 用户当前纬度(需扩大1000000倍)31296663即31.296663
user_longitude Integer - 用户当前精度(需扩大1000000倍)
addr_longitude Integer - 收餐地址精度(需扩大1000000倍)
addr_latitude Integer - 收餐地址纬度(需扩大1000000倍)

# 业务响应

名称 类型 是否非空 说明
code Integer 注意: code =0说明成功
状态码:0:成功
1:失败
2:重复下单
3:商家不可买
4:菜品不可买
5:预计送达时间错误
6:菜品未达起送数金额
8:订单被风控拦截
9:超出配送范围
10:计算活动优惠时异常
11:超出价格上限
15:未达到菜品最小起送份数
17:配送费已经变化
20:缺少必选菜品
30:无效的token
31:菜品为空
36:商家不支持当前支付方式
50:菜品信息属性发生变化
62:处方药暂不支持购买
13001:需要提供短信验证码
13002:验证码错误
13003:发送验证码失败,请重试
其他:系统升级,稍后重试

(注意:13001代表被美团(美团以短信或者语音通知验证码)风控,请自主研发弹窗输入验证码)
msg String 注意: 如果 code =0说明成功,其它code值皆为失败,提示内容见此msg描述
order_id String 生成的订单号
wm_orderint_unavaliable_food_vo_list List<UnavailableFood> 不可购买菜品列表
min_price Double 最少配送价格
min_count_foodlist List<MinCountFood> 不满足最低购买数量的菜品列表
payUrl String 支付地址
payParams PayParams 支付相关参数

UnavailableFood结构

名称 类型 是否非空 说明
wm_food_sku_id Long 菜品库存量ID
wm_food_name String 菜品名称
wm_food_spu_id Long 菜品ID
cur_count Integer 当前数量
min_count Integer 最小数量

MinCountFood结构

名称 类型 是否非空 说明
wm_food_sku_id Long 菜品库存量ID
wm_food_name String 菜品名称
wm_food_spu_id Long 菜品ID
cur_count Integer 当前数量
min_count Integer 最小数量

PayParams结构

名称 类型 是否非空 说明
token String 记号
pay_token String 支付标记
tradeno String 交易编号
needLogin String 需要登录
nb_platform String 支付平台
nb_version String 支付版本
cashierUrl String 支付地址

使用openApi接口支付见 支付接口
一般如果超过15分钟未支付, 则该笔订单会被自动取消, 需要重新下单.

# 响应示例

参数示例

{
  "ts": 1537254896,
  "sign": "zetMoLCXpFjUAwNGyAb44g==",
  "method": "waimai.order.submit",
  "user_phone": "13811111111",
  "pay_source": 3,
  "return_url": "",
  "wm_ordering_list": {
    "wm_poi_id": 601637,
    "delivery_time": 0,
    "pay_type": 2,
    "food_list": [
      {
        "wm_food_sku_id": 131042414,
        "count": 10
      }
    ]
  },
  "wm_ordering_user": {
    "user_phone": "13811111111",
    "user_name": "胡波-外卖openApi-订单测试",
    "user_address": "望京国际研发园FG座",
    "addr_longitude": 116488645,
    "addr_latitude": 40007069
  },
  "token": "B33D2ECDA4A541DEACC1410EB882C207",
  "idCardHash": "1111",
  "bankCardHash": "2222",
  "deviceHash": "3333",
  "thirdUserIdHash": "4444"
}

示例:

{
  "status": 0,
  "msg": "成功",
  "data": {
    "code": 0,
    "order_id": "6016371053020376",
    "wm_ordering_unavaliable_food_vo_list": null,
    "min_price": 0,
    "min_count_foodlist": null
  }
}
 

# 2.6 支付

###接口说明

名称 描述
功能 根据订单ID支付
HTTP方法 POST
请求方 第三方渠道
响应方 美团企业版平台
uri /waimai/v1/cashier/payment
method waimai.cashier.pay

# 业务请求参数

名称 类型 是否必填 示例 说明
order_id Long 6045282297615018 订单号 (即提交订单接口返回的order_id值)
channel_source String - 来源

# 业务响应

名称 类型 是否非空 说明
code Integer 状态码 0:支付成功 其它:支付失败
desc String 描述

# 业务响应示例

{
    "status": 0,
    "msg": "成功",
    "data": {
      "desc": "支付成功",
      "code": 0
      }
}

# 2.7 取消订单

###接口说明

名称 描述
功能 根据订单ID取消订单
HTTP方法 POST
请求方 第三方渠道
响应方 美团企业版平台
uri /waimai/v1/order/cancel
method waimai.order.cancel

# 业务请求参数

名称 类型 是否必填 示例 说明
order_id Long 6045282297615018 订单号
user_phone String 13012345678 用户手机号
channel_source String - 来源

# 业务响应

名称 类型 是否非空 说明
code Integer 取消码 0:取消成功 其它取消失败
desc String 描述

# 结果示例

{
  "status": 0,
  "msg": "成功",
  "data": {
    "code": 0,
    "desc": "成功"
  }
}

{
  "status": 0,
  "msg": "成功",
  "data": {
    "code": 12003, # 12003:订单已取消,无需重复操作 12004:取消订单系统异常  12005:由于业务规则限制,订单不允许取消 12006:订单所属用户id不匹配  12007:当前订单不符合取消的条件(处于申请退款中、全城送等)  12008:订单已经取消或者完成/商家已接单,用户不能取消订单/商家接单超1分钟或者骑手已取餐  12009:骑手已接单 或 该配送方式不支持退款 12010:货到付款订单不能取消
    "desc": "订单已取消,无需重复操作" 
  }
}

# 2.8 查询订单

###接口说明

名称 描述
功能 根据订单ID和用户手机号查询订单详情
HTTP方法 POST
请求方 第三方渠道
响应方 美团企业版平台
uri /waimai/v1/order/query
method waimai.order.query

# 业务请求参数

名称 类型 是否必填 示例 说明
order_id Long 6045282297615018 订单号
user_phone String 1851111111 手机号

# 业务响应

名称 类型 是否非空 说明
order_id Long 订单ID
order_time Long 下单时间
wm_order_pay_type Integer 付款方式
1 货到付款
2 在线支付
pay_status Integer 订单支付状态
1 待支付
2 付款中
3 付款成功
4 付款失败
5 申请退款
6 确认退款
7 拒绝退款
8 退款成功
9 退款失败
total Double 订单总金额
original_price Double 订单原价
shipping_fee Double 配送费
box_total_price Double 餐盒费
status Integer 订单状态
1 提交订单
2 向餐厅推单
4 已接单
8 已完成
9 取消
remark String 订单备注
is_pre_order Integer 是否是预订单
has_been_invoiced Integer 是否需要发票
invoice_title String 发票抬头
invoice_taxpayer_id String 纳税人识别号
ctime Long 订单创建时间
utime Long 订单最近更新时间
longitude Integer 提单精度
latitude Integer 提单纬度
address_longitude Integer 配送地址精度
address_latitude Integer 配送地址纬度
city_id Integer 城市编码
user_phone String 用户手机号
user_phone_encrypt String 用户手加密机号
estimate_arrival_time Long 预计到达时间
poi_name String 商家名称
wm_poi_id Long 商家ID
recipient_phone String 收货人手机号
recipient_phone_encrypt String 收货人加密手机号
recipient_address String 收货人地址
recipient_name String 收货人姓名
courier_name String 配送员姓名 (注: 商家自配送的,这类情况存在不给我们回传骑手信息的情况)
courier_phone String 配送员电话 (注: 商家自配送的,这类情况存在不给我们回传骑手信息的情况)
courier_phone_encrypt String 配送员加密电话
logistics_code String 配送方式code: 1000=商家自送; 1001或1002或1004=美团专送 其他code=第三方配送
logistics_desc String 配送方式中文描述
logistics_status Integer 配送状态
0 默认值
1 已推送给配送方
10 已抢单

15 骑手到店
20 已取餐
40 已送达
100 已取消
food_list List<Food> 菜品明细
discounts List<PoiDiscountDTO> 优惠活动信息
refundList List<WmOrderCenterRefundDTO> 退款信息
province String 江苏省
city String 苏州市

Food结构

名称 类型 是否非空 说明
food_id Long 菜品库存量ID
spu_id Long 菜品ID
name String 菜品名称
price Integer 菜品金额
original_price Integer 原始金额
count Integer 数量
spec String 规格
box_num Integer 餐盒数量
box_price Double 餐盒价格
attrValues List<String> 对应属性描述 ["常温","xxx"]

PoiDiscountDTO结构

名称 类型 是否非空 说明
info String 活动描述文案(实际支付18元返1元商家代金券)
icon_url String 活动图标url
reduceFree String 优惠金额
name String 活动名称

WmOrderCenterRefundDTO结构

名称 类型 是否非空 说明
refund_id Long 退款ID
part_refund int 部分退款标识 0全额退款 1部分退款
refund_status int 退款申请处理结果码:0待处理, 1拒绝退款 2退款成功 7取消申请
refund_status_desc String 退款状态描述
money String 退款金额
apply_reason String 申请退款原因
apply_type int 申请类型: 0、订单取消自动确认退款; 1、用户申请退款; 2、客服帮用户申请退款; 3、重复提交而自动申请; 4、支付成功消息在订单取消之后到达而自动申请; 5、支付成功消息在订单被置为无效之后到达而自动申请; 6、用户被商家拒绝后申诉
apply_type_desc String 申请类型描述
res_type int 申请退款的结果: 0:等待处理中; 1:商家驳回退款请求; 2、商家同意退款; 3、客服驳回退款请求; 4、客服帮商家同意退款; 5、超过24小时自动同意; 6、系统自动确认; 7:用户取消退款申请; 8:用户取消退款申诉
res_type_desc String 申请退款的结果描述
res_reason String 结果产生的原因:如自动取消自动确认等
ctime Long 创建时间
utime Long 更新时间
refund_type int 退款方式,0:余额退,1:原路退
refund_type_desc String 退款方式描述
part_refund_desc String 部分退款标识描述
process_deadline Long 退款进程的截止时间

全额退款/部分退款: refund_status=2   --> 退 money 的钱   --〉 成功  对接方记录refundId打标已操作过了   --〉 第2次退,踢了上次记录的refundId,退新来的那条

# 响应

 {
     "code": 0,
     "msg": null,
     "errorInfo": null,
     "data": {
         "order_id": "1059629343929",
         "order_time": "1620723763",
         "wm_order_pay_type": 2,
         "pay_status": 3,
         "total": 19.38,
         "original_price": 28.5,
         "shipping_fee": 9,
         "box_total_price": 1.5,
         "night_shipping_fee": 0,
         "status": 4,
         "remark": "",
         "is_pre_order": 0,
         "has_been_invoiced": 0,
         "invoice_title": "",
         "invoice_taxpayer_id": null,
         "ctime": "1620723763",
         "utime": "1620726514",
         "longitude": 120201880,
         "latitude": 30202136,
         "address_longitude": 120218903,
         "address_latitude": 30208313,
         "city_id": 330100,
         "user_id": "200000000",
         "user_phone": "11111111111",
         "user_phone_encrypt": "IoWk1soSLXxPvwovt4AwNQ",
         "estimate_arrival_time": "1620726780",
         "poi_name": "必胜客宅急送(江虹路店)",
         "wm_poi_id": "105962999999",
         "recipient_phone": "11111111111",
         "recipient_phone_encrypt": "IoWk1soSLXxPvwovt4AwNQ",
         "recipient_address": "江陵路吉利大厦",
         "recipient_name": "冯生",
         "courier_name": null,
         "courier_phone": "11111111111",
         "courier_phone_encrypt": "_xVMH0Zqoy0ERmQg_o8E3Q",
         "logistics_code": 1000,
         "logistics_desc": "商家自配",
         "logistics_status": 40,
         "food_list": [
             {
                 "food_id": "3924923401",
                 "spu_id": "3499518813",
                 "name": "超值香草凤尾虾(3只)",
                 "price": 12.88,
                 "origin_price": 18,
                 "count": 1,
                 "spec": "份",
                 "box_num": 3,
                 "box_price": 0.5,
                 "attrIds": null,
                 "attrValues": [],
                 "uniqMD5Key": "9b83a93ba5b351fdb0a32f181dda1078"
             }
         ],
         "discounts": null,
         "reduceTotalFree": "0.0",
         "refundList": null,
         "province": null,
         "city": null,
         "foodTotalCount": 1
     }
 }

# 2.9 商家详情

###接口说明

名称 描述
功能 根据商家poiId获取商家详情
HTTP方法 POST
请求方 第三方渠道
响应方 美团企业版平台
uri /waimai/v1/poi/detail
method waimai.poi.detail

# 业务请求参数

名称 类型 是否必填 示例 说明
wm_poi_id Long 606737 商家ID
longitude Integer 116491116 用户当前精度
latitude Integer 40002102 用户当前纬度
idCardHash String xxx 可传入您系统的userid
bankCardHash String xxx 可传入您系统的userid
deviceHash String xxx 可传入您系统的userid
thirdUserIdHash String xxx 可传入您系统的userid

注意:如果查询商家详情时,不传用户经纬度,则获取结果中用户与商家距离字段distance会展示为“9999+km”。

# 业务响应

名称 类型 是否非空 说明
wm_poi_id Long 商家ID
status Integer 商家营业状态 1:可配送 2:忙碌中 3:休息中
status_desc String 营业状态描述
name String 商家名称
pic_url String 商家图片
shipping_fee Double 配送费
min_price Integer 起送价
wm_poi_score Double 商家评分
avg_delivery_time Integer 平均配送时间
distance String 与商家的距离
latitude Integer 商家位置纬度
longitude Integer 商家位置精度
delivery_type Integer 配送方式 1:美团配送 0:非美团配送
invoice_support Integer 是否支持开发票 0:不支持 1:支持
address String 商家地址
call_center String 商家电话,可能有多个
call_center_encrypt String 商家电话密文
shipping_time String 商家营业时间
poiUserCommentVOList List<PoiUserComment> 商家评论列表
discounts List<PoiDiscountDTO> 优惠活动信息

PoiUserComment结构

名称 类型 是否非空 说明
user_name String 用户名
comment_score Integer 评分
ship_time Integer 配送时间
comment String 评论信息
comment_time Long 评论时间

PoiDiscountDTO结构

名称 类型 是否非空 说明
info Long 活动描述文案(实际支付18元返1元商家代金券)
icon_url String 活动图标url
reduceFree String 优惠金额
name String 活动名称

# 业务响应示例

{
    "ts": 1530615298,
    "method": "waimai.poi.detail",
    "sign": "zetMoLCXpFjUAwNGyAb44g==",
    "idCardHash": "1111",
    "bankCardHash": "2222",
    "deviceHash": "3333",
    "thirdUserIdHash": "4444",
    "wm_poi_id": 601637
}
{
  "status": 0,
  "msg": "成功",
  "data": {
    "wm_poi_id": "601637",
    "status": 1,
    "status_desc": "",
    "name": "王彩_活动_专用门店(勿动)",
    "pic_url": "https://p1.meituan.net/xianfu/f0aac8c1b910a38dac894f83f5ae9eed31493.jpg",
    "shipping_fee": 6,
    "min_price": 3,
    "wm_poi_score": 5,
    "avg_delivery_time": 44,
    "distance": "9999+km",
    "delivery_type": 0,
    "invoice_support": 1,
    "longitude": 116582574,
    "latitude": 40083284,
    "address": "北京首都国际机场",
    "call_center": "123456",
    "call_center_encrypt": "sdaffdsfsdfewwqaawwwwww",
    "shipping_time": "09:00-23:55",
    "poiUserCommentVOList": [
      {
        "user_name": "摩羯913",
        "comment_score": 5,
        "ship_time": 68,
        "comment": "包装精美,商家服务好,分量也足",
        "comment_time": "1533081600"
      },
      {
        "user_name": "匿名用户",
        "comment_score": 5,
        "ship_time": 4,
        "comment": "功夫反反复复凤飞飞",
        "comment_time": "1526515200"
      },
      {
        "user_name": "范680",
        "comment_score": 5,
        "ship_time": 6,
        "comment": "哈哈哈姐姐就开门比较困难",
        "comment_time": "1526515200"
      }
    ],
    "cityName": "北京市",
    "discounts": [
      {
        "info": "满10减5;满20减10;满30减15;满40减20;满50减25",
        "icon_url": "https://p0.meituan.net/xianfu/f8bc8dffdbc805878aa3801a33f563cd1001.png",
        "reduceFree": "0.0",
        "name": ""
      },
      {
        "info": "本店新用户立减2.22元",
        "icon_url": "https://p1.meituan.net/xianfu/1cc4324d7d2f59f2cccb6920b57cd0902048.png",
        "reduceFree": "0.0",
        "name": ""
      },
      {
        "info": "有机会领取商家代金券",
        "icon_url": "https://p0.meituan.net/xianfu/c2c0f31d0ebf0f60af115d058169c492992.png",
        "reduceFree": "0.0",
        "name": ""
      },
      {
        "info": "实际支付20元返3元商家代金券",
        "icon_url": "https://p0.meituan.net/xianfu/652eea4034250563fe11b02e3219ba8d981.png",
        "reduceFree": "0.0",
        "name": ""
      },
      {
        "info": "满15元赠送满赠100个混混",
        "icon_url": "https://p1.meituan.net/xianfu/5ffe01c550a139db693d152cefd1b247869.png",
        "reduceFree": "0.0",
        "name": ""
      },
      {
        "info": "购买指定商品有赠品",
        "icon_url": "https://p1.meituan.net/xianfu/04d485a1b8e040bff21c02c19a9731d92048.png",
        "reduceFree": "0.0",
        "name": ""
      },
      {
        "info": "下单多减5.55元,限07:00-11:00;下单多减5.55元,限14:00-19:45",
        "icon_url": "https://p0.meituan.net/xianfu/538a2adfab46a37ec42853aece765704603.png",
        "reduceFree": "0.0",
        "name": ""
      }
    ]
  }
}

# 3. 【推送接口】

# 3.1 订单状态推送

美团企业版平台将订单状态发生变更通知第三方接入渠道,以便渠道及时获取最新订单状态。

# 接口说明

名称 描述
功能 给第三方推送订单状态发生变更消息
HTTP方法 POST
请求方 美团企业版平台
响应方 对接方
url 对接方提供url
method waimai.order.status.notice
备注 即美团企业版调用对接方restful接口,我们美团企业版调用对接方的接口,
传入token=x&content=xx的请求参数,
其中token即我们分配对接方的token, content是AES加密后的参数串

# 业务请求参数

名称 类型 说明
token String 美团企业版分配给调用方token
content String 请求体内容,json序列化后通过AES进行加密

# content串中的关键业务请求参数

名称 类型 是否必填 示例 说明
order_id Long 6045282297615018 美团企业版外卖订单号
status Integer 4 订单状态
1 用户提交订单
2 订单推送给商家
4 已接单
8 订单完成
9 订单取消
desc String 已接单 订单状态描述

# 业务响应

名称 类型 是否必填 示例 说明
code Integer 0 变更接收情况
0 成功
1 失败
message String 成功 描述

# 业务请求示例

{http|https}://对接方域名/接口名?token=JLCAR-TK&content=UlftDb5YOWPyXmSt1BSyxddyeREpR8UWkCrOte-_gZP787Nk4gM2JX2unSm9Y9upcYPtQEBs_Ea3zt9zjbO-iQiETQCoY9DS_TWLoOlJegO54oRYNsWiovoLdlXEqH7zDVckylU3XfpAe93SRO-tKkBogiEciPGFFqBsqcJEn2M

解密出content关键字段示例:
{
  "sign": "xxxxxQ1j/h/cZLeLvfA==",
  "ts": 1619418387,
  "order_id": 61064620450552454,
  "status": 8,
  "desc": "已完成"
}

# 3.2 订单配送状态推送

美团企业版平台将订单配送状态发生变更通知第三方接入渠道,以便渠道及时获取最新订单配送状态。

# 接口说明

名称 描述
功能 给第三方推送订单配送状态发生变更消息
HTTP方法 POST
请求方 美团企业版平台
响应方 对接方
url 对接方提供url
method waimai.order.logistics_status.notice
备注 即美团企业版调用对接方restful接口,我们美团企业版调用对接方的接口,
传入token=x&content=xx的请求参数,
其中token即我们分配对接方的token, content是AES加密后的参数串

# 业务请求参数

名称 类型 说明
token String 美团企业版分配给调用方token
content String 请求体内容,序列化后通过AES进行加密

# content串中的关键业务请求参数

名称 类型 是否必填 示例 说明
orderId Long 6045282297615018 美团企业版外卖订单号
sqtOrderId Long 3045282297615018 美团企业版订单ID
serialNum String 2ZZNQ3DTBU 美团企业版支付序列号
orderLogisticsStatus Integer 40 配送状态
0 默认值
1 已推送给配送方
10 已抢单
15 骑手已到店
20 已取餐
40 已送达
100 已取消
desc String 已推送给配送方 描述信息

# 业务响应

名称 类型 是否必填 示例 说明
code Integer 0 变更接收情况
0 成功
1 失败
message String 成功 描述

# 业务请求示例

{http|https}://对接方域名/接口名?token=JLCAR-TK&content=UlftDb5YOWPyXmSt1BSyxddyeREpR8UWkCrOte-_gZP787Nk4gM2JX2unSm9Y9upcYPtQEBs_Ea3zt9zjbO-iQiETQCoY9DS_TWLoOlJegO54oRYNsWiovoLdlXEqH7zDVckylU3XfpAe93SRO-tKkBogiEciPGFFqBsqcJEn2M

解密出content关键字段示例:
{
  "sign": "AQ1j/h/cZLeLvfA==",
  "ts": 1619418514,
  "orderId": 102763573582675331,
  "sqtOrderId": 687408479999867,
  "serialNum": "3XS0LEMRK6BM",
  "orderLogisticsStatus": 10,
  "desc": "已抢单"
}

# 3.3 订单支付状态推送

美团企业版平台将订单支付状态发生变更通知第三方接入渠道,以便渠道及时获取最新订单支付、退款、部分退款等状态。
(ps: 用户如需要更多订单详情,可用美团企业版外卖订单号orderId查询订单详情接口,如果需要退款记录,可知会开通权限)

# 接口说明

名称 描述
功能 给第三方推送订单支付状态发生变更消息
HTTP方法 POST
请求方 美团企业版平台
响应方 对接方
url 第三方提供回调url
method waimai.order.paystatus.notice
备注 即美团企业版调用对接方restful接口,我们美团企业版调用对接方的接口,
传入token=x&content=xx的请求参数,
其中token即我们分配对接方的token, content是AES加密后的参数串

# 业务请求参数

名称 类型 说明
token String 美团企业版分配给调用方token
content String 请求体内容,序列化后通过AES进行加密

# content串中的关键业务请求参数

名称 类型 是否必填 示例 说明
orderId Long 6045282297615018 美团企业版外卖订单号
serialNum String QIUY09JY 交易支付序列号
payStatus Integer 31 订单支付状态:
20 已支付
30 退款中
31 部分退款
32 全部退款
payStatusDesc String 部分退款 订单支付状态描述

# 业务响应

名称 类型 是否必填 示例 说明
code Integer 0 状态码
0 成功
1 失败
message String 成功 描述

# 业务请求示例

{http|https}://对接方域名/接口名?token=JLCAR-TK&content=UlftDb5YOWPyXmSt1BSyxddyeREpR8UWkCrOte-_gZP787Nk4gM2JX2unSm9Y9upcYPtQEBs_Ea3zt9zjbO-iQiETQCoY9DS_TWLoOlJegO54oRYNsWiovoLdlXEqH7zDVckylU3XfpAe93SRO-tKkBogiEciPGFFqBsqcJEn2M

解密出content关键字段示例:
{
  "sign": "xxxxxxx==",
  "ts": 1619409626,
  "orderId": 112009910703481615,
  "serialNum": "3XSC0ZJSJMDE",
  "payStatus": 20,
  "payStatusDesc": "已支付",
  "pushTime": 1619409626622
}

# 4. 【线上测试数据】

线上可以以下数据对测试门店进行测试(预览,提交订单,支付,取消订单) 定位到:新疆的于田县人民政府,搜索关键字“测试”的商家

# 4.1 商家列表

{
  "ts": 1550662171,
  "method": "waimai.poi.list",
  "sign": "分配给您的sign",
  "page_index": 1,
  "page_size": 20,
  "latitude": "29324903",
  "longitude": "95330355",
  "keyword": "测试"
}

# 4.2.餐厅

      
{  "ts":1550662700,  
"method": "waimai.poi.food",
  "sign":"分配给您的sign",
  "latitude": "29324903",
  "longitude": "95330355",
  "wm_poi_id": 480719525793418
}

# 4.2.1 属性规格弹层


{
  "ts": 1626232638,
  "method": "waimai.poi.foodSkuAttr",
  "sign": "AgQOxUd5UYQO3II0ex0oEA==",
  "wm_poi_id": 481050284967610,
  "spu_id": 5149971880
}

# 4.3.预览

{
  "sign": "分配给您的sign",
  "ts": 1550661510,
  "method": "waimai.order.preview",
  "wm_ordering_list": {
    "wm_poi_id": "480719525793418",
    "delivery_time": 0,
    "pay_type": 2,
    "food_list": [
      {
        "count": 1,
        "wm_food_sku_id": 357014812
      }
    ]
  },
  "wm_ordering_user": {
    "user_phone": "手机号",
    "user_name": "张三",
    "user_address": "墨脱县人民政府",
    "house_number": "100号",
    "user_caution": "多点辣",
    "addr_longitude": 95333207,
    "addr_latitude": 29325286
  }
}

# 4.4.提交订单


{
   "sign": "分配给您的sign",
   "ts": 1550665138,
   "method": "waimai.order.submit",
   "token": "B54961F1640F44729201B38EAB08BE32", # 取预览接口响应结果中的token值
   "user_phone": "手机号",
   "channel_order_id": "201902202018448109712776",
   "wm_ordering_list": {
    "wm_poi_id": "480719525793418",
    "delivery_time": 0,
    "pay_type": 2,
    "food_list": [{
     "count": 1,
     "wm_food_sku_id": 357014812
    }]
   },
   "wm_ordering_user": {
    "user_phone": "手机号",
    "user_name": "张三",
    "user_address": "西藏自治区林芝市墨脱大峡谷宾馆",
    "house_number": "8101",
    "user_caution": "多点辣",
    "addr_longitude": 95330355,
    "addr_latitude": 29324903
   }
  }

# 4.5.支付


{
  "ts": 1558583357,
  "sign": "分配给您的sign",
  "method": "waimai.cashier.pay",
  "order_id": 取第提交订单接口响应结果的orderid
}

# 4.6.取消订单


{
  "ts": 1558583414,
  "sign": "分配给您的sign",
  "method": "waimai.order.cancel",
  "order_id": "取提交订单接口响应结果的order_id",
  "user_phone": "取预览接口中的手机号(user_phone)"
}

# 5. 【关于菜品规格属性】

美团外卖菜品中有「规格」选项,需要调用2.3.1 spu多规格属性弹框接口,响应结果spu_attrs字段(规格属性), 如果菜品需要选择规格,则用户做弹层展示,用户选择好属性后,将id拼接到订单预览接口的food_spu_attr_ids属性中当入参, 提交订单接口也需要food_spu_attr_ids属性中当入参,如果有规格, 最多规格见美团企业版提供的文档

# 6. 【可售卖属性匹配skuId】

示例数据

 {
   "status": 0,
   "msg": "成功",
   "data": {
     "spu_attrs": [
       {
         "name": "规格",
         "values": [
           {
             "id": "8913219293",
             "value": "常规",
             "status": 1,
             "price": 29,
             "mutex_attr_ids": [],
             "sequence": 1,
             "selected": 1
           }
         ],
         "mode": 2
       },
       {
         "name": "0糖0卡糖",
         "values": [
           {
             "id": "8913219269",
             "value": "常规",
             "status": 1,
             "price": 0,
             "mutex_attr_ids": [],
             "sequence": 1,
             "selected": 1
           },
           {
             "id": "8913219271",
             "value": "原创0糖0卡糖",
             "status": 1,
             "price": 1,
             "mutex_attr_ids": [],
             "sequence": 2,
             "selected": 0
           }
         ],
         "mode": 2
       },
       {
         "name": "加料",
         "values": [
           {
             "id": "8913219268",
             "value": "常规",
             "status": 1,
             "price": 0,
             "mutex_attr_ids": [],
             "sequence": 1,
             "selected": 1
           },
           {
             "id": "8913219272",
             "value": "爆双倍果肉",
             "status": 1,
             "price": 5,
             "mutex_attr_ids": [],
             "sequence": 23,
             "selected": 0
           },
           {
             "id": "8913219273",
             "value": "益生菌",
             "status": 1,
             "price": 3,
             "mutex_attr_ids": [],
             "sequence": 24,
             "selected": 0
           }
         ],
         "mode": 2
       },
       {
         "name": "菠萝片分装",
         "values": [
           {
             "id": "8913219277",
             "value": "不分装",
             "status": 1,
             "price": 0,
             "mutex_attr_ids": [],
             "sequence": 28,
             "selected": 1
           },
           {
             "id": "8913219270",
             "value": "分装",
             "status": 1,
             "price": 1,
             "mutex_attr_ids": [
               "8913219283"
             ],
             "sequence": 29,
             "selected": 0
           }
         ],
         "mode": 2
       },
       {
         "name": "绿色喜茶",
         "values": [
           {
             "id": "8913219274",
             "value": "PLA可降解吸管(推荐)",
             "status": 1,
             "price": 0,
             "mutex_attr_ids": [],
             "sequence": 3,
             "selected": 1
           },
           {
             "id": "8913219276",
             "value": "不使用吸管",
             "status": 1,
             "price": 0,
             "mutex_attr_ids": [],
             "sequence": 4,
             "selected": 0
           }
         ],
         "mode": 1
       },
       {
         "name": "状态",
         "values": [
           {
             "id": "8913219280",
             "value": "冰沙(推荐)",
             "status": 1,
             "price": 0,
             "mutex_attr_ids": [
               "8913219281"
             ],
             "sequence": 6,
             "selected": 1
           },
           {
             "id": "8913219292",
             "value": "非冰沙",
             "status": 1,
             "price": 0,
             "mutex_attr_ids": [],
             "sequence": 7,
             "selected": 0
           }
         ],
         "mode": 1
       },
       {
         "name": "冰量",
         "values": [
           {
             "id": "8913219290",
             "value": "正常(推荐)",
             "status": 1,
             "price": 0,
             "mutex_attr_ids": [],
             "sequence": 8,
             "selected": 1
           },
           {
             "id": "8913219284",
             "value": "少冰",
             "status": 1,
             "price": 0,
             "mutex_attr_ids": [],
             "sequence": 9,
             "selected": 0
           },
           {
             "id": "8913219285",
             "value": "少少冰",
             "status": 1,
             "price": 0,
             "mutex_attr_ids": [],
             "sequence": 10,
             "selected": 0
           },
           {
             "id": "8913219281",
             "value": "去冰",
             "status": 1,
             "price": 0,
             "mutex_attr_ids": [
               "8913219280"
             ],
             "sequence": 11,
             "selected": 0
           }
         ],
         "mode": 1
       },
       {
         "name": "甜度",
         "values": [
           {
             "id": "8913219289",
             "value": "标准甜(推荐)",
             "status": 1,
             "price": 0,
             "mutex_attr_ids": [],
             "sequence": 12,
             "selected": 1
           },
           {
             "id": "8913219286",
             "value": "少甜",
             "status": 1,
             "price": 0,
             "mutex_attr_ids": [],
             "sequence": 13,
             "selected": 0
           }
         ],
         "mode": 1
       },
       {
         "name": "做法",
         "values": [
           {
             "id": "8913219275",
             "value": "一半果茸一半果丁",
             "status": 1,
             "price": 0,
             "mutex_attr_ids": [],
             "sequence": 18,
             "selected": 1
           },
           {
             "id": "8913219279",
             "value": "全果茸",
             "status": 1,
             "price": 0,
             "mutex_attr_ids": [],
             "sequence": 19,
             "selected": 0
           },
           {
             "id": "8913219278",
             "value": "全果丁",
             "status": 1,
             "price": 0,
             "mutex_attr_ids": [],
             "sequence": 20,
             "selected": 0
           }
         ],
         "mode": 1
       },
       {
         "name": "口味",
         "values": [
           {
             "id": "8913219287",
             "value": "标准(含海盐)",
             "status": 1,
             "price": 0,
             "mutex_attr_ids": [],
             "sequence": 21,
             "selected": 1
           },
           {
             "id": "8913219282",
             "value": "去海盐",
             "status": 1,
             "price": 0,
             "mutex_attr_ids": [],
             "sequence": 22,
             "selected": 0
           }
         ],
         "mode": 1
       },
       {
         "name": "特调糖烤菠萝片",
         "values": [
           {
             "id": "8913219288",
             "value": "标准(特调糖烤菠萝片)",
             "status": 1,
             "price": 0,
             "mutex_attr_ids": [],
             "sequence": 25,
             "selected": 1
           },
           {
             "id": "8913219291",
             "value": "菠萝片(去烤糖)",
             "status": 1,
             "price": 0,
             "mutex_attr_ids": [],
             "sequence": 26,
             "selected": 0
           },
           {
             "id": "8913219283",
             "value": "去菠萝片",
             "status": 1,
             "price": 0,
             "mutex_attr_ids": [
               "8913219270"
             ],
             "sequence": 27,
             "selected": 0
           }
         ],
         "mode": 1
       }
     ],
     "sku_attrs_map": {
       "6092497267": [ /* 6092497267是skuId,数组中的是属性attrId */
         "8913219268",
         "8913219293",
         "8913219270",
         "8913219269"
       ],
       "6092497268": [
         "8913219268",
         "8913219293",
         "8913219270",
         "8913219271"
       ],
       "6092497269": [
         "8913219268",
         "8913219293",
         "8913219277",
         "8913219269"
       ],
       "6092497270": [
         "8913219268",
         "8913219293",
         "8913219277",
         "8913219271"
       ],
       "6092497271": [
         "8913219272",
         "8913219293",
         "8913219270",
         "8913219269"
       ],
       "6092497272": [
         "8913219272",
         "8913219293",
         "8913219270",
         "8913219271"
       ],
       "6092497273": [
         "8913219272",
         "8913219293",
         "8913219277",
         "8913219269"
       ],
       "6092497274": [
         "8913219272",
         "8913219293",
         "8913219277",
         "8913219271"
       ],
       "6092497275": [
         "8913219273",
         "8913219293",
         "8913219270",
         "8913219269"
       ],
       "6092497276": [
         "8913219273",
         "8913219293",
         "8913219270",
         "8913219271"
       ],
       "6092497277": [
         "8913219273",
         "8913219293",
         "8913219277",
         "8913219269"
       ],
       "6092497278": [
         "8913219273",
         "8913219293",
         "8913219277",
         "8913219271"
       ]
     }
   }
 }

注: 只有属性spu_attrs中有mode=2可售卖属性时sku_attrs_map才有映射数据

假设用户选择了4个可售卖属性分别如下,其它的非售卖属性mode=1的不会出现在sku_attrs_map中,
如果只有非售卖属性mode=1的多种属性按之前逻辑不变取skuId

       {
          "id": 8913219293,
          "value": "常规"
        },
        {
          "id": 8913219271,
          "value": "原创0糖0卡糖"
        },
        {
          "id": 8913219268,
          "value": "常规"
        },
        {
          "id": 8913219277,
          "value": "不分装"
        }

因此,用8913219293,8913219271,8913219268,8913219277 这四个属性id去sku_attrs_map中查找唯一匹配的skuId,
此skuId就是用来预览提单的skuId值

注: 用户在选择规格属性,添加购物车时,前端根据sku_attrs_map数据匹配出skuId,mode=1的非售卖属性不用取

java代码示例

public class FoodAttrSkuMapUtils {

    public static void main(String[] args) {
        String  = "{\"spu_attrs\":[{\"name\":\"规格\",\"values\":[{\"id\":\"8913219293\",\"value\":\"常规\",\"status\":1,\"price\":29,\"mutex_attr_ids\":[],\"sequence\":1,\"selected\":1}],\"mode\":2},{\"name\":\"0糖0卡糖\",\"values\":[{\"id\":\"8913219269\",\"value\":\"常规\",\"status\":1,\"price\":0,\"mutex_attr_ids\":[],\"sequence\":1,\"selected\":1},{\"id\":\"8913219271\",\"value\":\"原创0糖0卡糖\",\"status\":1,\"price\":1,\"mutex_attr_ids\":[],\"sequence\":2,\"selected\":0}],\"mode\":2},{\"name\":\"加料\",\"values\":[{\"id\":\"8913219268\",\"value\":\"常规\",\"status\":1,\"price\":0,\"mutex_attr_ids\":[],\"sequence\":1,\"selected\":1},{\"id\":\"8913219272\",\"value\":\"爆双倍果肉\",\"status\":1,\"price\":5,\"mutex_attr_ids\":[],\"sequence\":23,\"selected\":0},{\"id\":\"8913219273\",\"value\":\"益生菌\",\"status\":1,\"price\":3,\"mutex_attr_ids\":[],\"sequence\":24,\"selected\":0}],\"mode\":2},{\"name\":\"菠萝片分装\",\"values\":[{\"id\":\"8913219277\",\"value\":\"不分装\",\"status\":1,\"price\":0,\"mutex_attr_ids\":[],\"sequence\":28,\"selected\":1},{\"id\":\"8913219270\",\"value\":\"分装\",\"status\":1,\"price\":1,\"mutex_attr_ids\":[\"8913219283\"],\"sequence\":29,\"selected\":0}],\"mode\":2},{\"name\":\"绿色喜茶\",\"values\":[{\"id\":\"8913219274\",\"value\":\"PLA可降解吸管(推荐)\",\"status\":1,\"price\":0,\"mutex_attr_ids\":[],\"sequence\":3,\"selected\":1},{\"id\":\"8913219276\",\"value\":\"不使用吸管\",\"status\":1,\"price\":0,\"mutex_attr_ids\":[],\"sequence\":4,\"selected\":0}],\"mode\":1},{\"name\":\"状态\",\"values\":[{\"id\":\"8913219280\",\"value\":\"冰沙(推荐)\",\"status\":1,\"price\":0,\"mutex_attr_ids\":[\"8913219281\"],\"sequence\":6,\"selected\":1},{\"id\":\"8913219292\",\"value\":\"非冰沙\",\"status\":1,\"price\":0,\"mutex_attr_ids\":[],\"sequence\":7,\"selected\":0}],\"mode\":1},{\"name\":\"冰量\",\"values\":[{\"id\":\"8913219290\",\"value\":\"正常(推荐)\",\"status\":1,\"price\":0,\"mutex_attr_ids\":[],\"sequence\":8,\"selected\":1},{\"id\":\"8913219284\",\"value\":\"少冰\",\"status\":1,\"price\":0,\"mutex_attr_ids\":[],\"sequence\":9,\"selected\":0},{\"id\":\"8913219285\",\"value\":\"少少冰\",\"status\":1,\"price\":0,\"mutex_attr_ids\":[],\"sequence\":10,\"selected\":0},{\"id\":\"8913219281\",\"value\":\"去冰\",\"status\":1,\"price\":0,\"mutex_attr_ids\":[\"8913219280\"],\"sequence\":11,\"selected\":0}],\"mode\":1},{\"name\":\"甜度\",\"values\":[{\"id\":\"8913219289\",\"value\":\"标准甜(推荐)\",\"status\":1,\"price\":0,\"mutex_attr_ids\":[],\"sequence\":12,\"selected\":1},{\"id\":\"8913219286\",\"value\":\"少甜\",\"status\":1,\"price\":0,\"mutex_attr_ids\":[],\"sequence\":13,\"selected\":0}],\"mode\":1},{\"name\":\"做法\",\"values\":[{\"id\":\"8913219275\",\"value\":\"一半果茸一半果丁\",\"status\":1,\"price\":0,\"mutex_attr_ids\":[],\"sequence\":18,\"selected\":1},{\"id\":\"8913219279\",\"value\":\"全果茸\",\"status\":1,\"price\":0,\"mutex_attr_ids\":[],\"sequence\":19,\"selected\":0},{\"id\":\"8913219278\",\"value\":\"全果丁\",\"status\":1,\"price\":0,\"mutex_attr_ids\":[],\"sequence\":20,\"selected\":0}],\"mode\":1},{\"name\":\"口味\",\"values\":[{\"id\":\"8913219287\",\"value\":\"标准(含海盐)\",\"status\":1,\"price\":0,\"mutex_attr_ids\":[],\"sequence\":21,\"selected\":1},{\"id\":\"8913219282\",\"value\":\"去海盐\",\"status\":1,\"price\":0,\"mutex_attr_ids\":[],\"sequence\":22,\"selected\":0}],\"mode\":1},{\"name\":\"特调糖烤菠萝片\",\"values\":[{\"id\":\"8913219288\",\"value\":\"标准(特调糖烤菠萝片)\",\"status\":1,\"price\":0,\"mutex_attr_ids\":[],\"sequence\":25,\"selected\":1},{\"id\":\"8913219291\",\"value\":\"菠萝片(去烤糖)\",\"status\":1,\"price\":0,\"mutex_attr_ids\":[],\"sequence\":26,\"selected\":0},{\"id\":\"8913219283\",\"value\":\"去菠萝片\",\"status\":1,\"price\":0,\"mutex_attr_ids\":[\"8913219270\"],\"sequence\":27,\"selected\":0}],\"mode\":1}],\"sku_attrs_map\":{\"6092497267\":[\"8913219268\",\"8913219293\",\"8913219270\",\"8913219269\"],\"6092497268\":[\"8913219268\",\"8913219293\",\"8913219270\",\"8913219271\"],\"6092497269\":[\"8913219268\",\"8913219293\",\"8913219277\",\"8913219269\"],\"6092497270\":[\"8913219268\",\"8913219293\",\"8913219277\",\"8913219271\"],\"6092497271\":[\"8913219272\",\"8913219293\",\"8913219270\",\"8913219269\"],\"6092497272\":[\"8913219272\",\"8913219293\",\"8913219270\",\"8913219271\"],\"6092497273\":[\"8913219272\",\"8913219293\",\"8913219277\",\"8913219269\"],\"6092497274\":[\"8913219272\",\"8913219293\",\"8913219277\",\"8913219271\"],\"6092497275\":[\"8913219273\",\"8913219293\",\"8913219270\",\"8913219269\"],\"6092497276\":[\"8913219273\",\"8913219293\",\"8913219270\",\"8913219271\"],\"6092497277\":[\"8913219273\",\"8913219293\",\"8913219277\",\"8913219269\"],\"6092497278\":[\"8913219273\",\"8913219293\",\"8913219277\",\"8913219271\"]}}";
        List<Long> chooseList = Lists.newArrayList(8913219293L, 8913219271L, 8913219268L, 8913219277L);

        matchSaleSkuId(, chooseList);
    }

     /**
         * 可售卖属性时找skuId,通过传入的所有可售卖的属性id,在sku_attrs_map中找出唯一一个skuid
         * <pre>
         *     1.将sku_attrs_map反转出属性id为key,skuId为value的映射
         *     2.取出选中的属性的数据
         *     3.取交集的找出唯一的skuId
         * </pre>
         * @param 
         * @param selectedAttId
         * @return
         */
     public static Long matchSaleSkuId(String json , List<Long> selectedAttId) {
         long resultSkuId = 0L;
 
         FoodSpuMutilAttrDTO foodSpuMutilAttrDTO = JsonUtil.2Object(json, FoodSpuMutilAttrDTO.class);
         System.out.println(Util.object2(foodSpuMutilAttrDTO));
 
         Map<Long, List<Long>> sku_attrs_map = foodSpuMutilAttrDTO.getSku_attrs_map();
         if (sku_attrs_map == null) {
             return resultSkuId;
         }
 
         // 反转属性id为key,skuId为value的映射
         Map<Long, Set<Long>> attr_sku_map = new HashMap<>();
         sku_attrs_map.forEach((skuId, attrs) -> {
 
             for (Long attrId : attrs) {
                 Set<Long> skuIdList = attr_sku_map.get(attrId);
                 skuIdList = CollectionUtils.isEmpty(skuIdList) ? new TreeSet<>() : skuIdList;
                 skuIdList.add(skuId);
 
                 attr_sku_map.put(attrId, skuIdList);
             }
 
         });
         System.out.println("attr_sku_map= " + Util.object2(attr_sku_map));
 
 
         List<Set<Long>> groupList = new ArrayList<>();
         for (Long attId : selectedAttId) {
             Set<Long> skuIdList = attr_sku_map.get(attId);
             groupList.add(skuIdList);
         }
 
         // 取交集
         Set<Long> firstSet = groupList.get(0);
         for (int i = 1; i < groupList.size(); i++) {
             firstSet.retainAll(groupList.get(i));
         }
 
         resultSkuId = new ArrayList<>(firstSet).get(0);
         System.out.println("所选的可售卖的属性匹配的kuId=" + resultSkuId);
 
         return resultSkuId;
     }
}

上次更新: 4/22/2024, 4:15:08 PM