# 订单列表查询接口
# 1.概述
通过【订单列表查询】接口,客户平台可以查询自己企业内的订单列表。
# 2.接口基本信息
| 名称 | 描述 |
|---|---|
| 请求方式 | POST |
| 调用地址 | 测试环境:https://waimai-openapi.apigw.test.meituan.com/api/sqt/open/order/queryList 正式环境:https://bep-openapi.meituan.com/api/sqt/open/order/queryList |
| 调用方 | 客户平台 |
| 响应方 | 美团企业版 |
| 响应超时时间 | 5秒 |
| 调用限频 | 每分钟访问不超过100次,每天累计访问不超过100000次 |
# 2.1.请求体
| 名称 | 类型 | 是否必填 | 示例 | 说明 |
|---|---|---|---|---|
| accessKey | String | 是 | B3GFJIEHNEM1RLV-TK | 美团企业版分配给客户的接入秘钥 |
| content | String | 是 | UgxoCGPQIzoP | 请求体内容,将请求参数JSON序列化后进行加密的结果值, 参照:签名实例 |
# content加密前数据结构
| 名称 | 类型 | 是否必填 | 示例 | 说明 |
|---|---|---|---|---|
| ts | Long | 是 | 1617085650321 | 13位时间戳。若请求发起时间与平台接受请求时间相差大于10分钟,平台将直接拒绝本次请求 |
| entId | Long | 是 | 46574 | 企业ID |
| firstBusinessType | String | 否 | 030 | 一级业务品类编码,详见:6.1.业务类型映射关系 |
| secondBusinessType | String | 否 | 030110 | 二级业务品类编码,详见:6.1.业务类型映射关系 |
| payStatus | Integer | 否 | 10 | 支付状态,10:未支付,20:已支付,31:部分退款,32:全额退款 |
| minCreateTime | Long | 否 | 1569859200000 | 最小订单创建时间,13位时间戳,需要与最大订单创建时间结合使用,可以实现下单时间的区间查询 |
| maxCreateTime | Long | 否 | 1569859200000 | 最大订单创建时间,13位时间戳,需要与最小订单创建时间结合使用,可以实现下单时间的区间查询 |
| minUpdateTime | Long | 否 | 1569859200000 | 最小订单更新时间,13位时间戳,需要与最大订单更新时间结合使用,可以实现更新时间的区间查询 |
| maxUpdateTime | Long | 否 | 1569859200000 | 最大订单更新时间,13位时间戳,需要与最小订单更新时间结合使用,可以实现更新时间的区间查询 |
| minPayTime | Long | 否 | 1569859200000 | 最小订单支付时间,13位时间戳,需要与最大订单支付时间结合使用,可以实现支付时间的区间查询 |
| maxPayTime | Long | 否 | 1569859200000 | 最大订单支付时间,13位时间戳,需要与最小订单支付时间结合使用,可以实现支付时间的区间查询 |
| pageSize | Integer | 否 | 1 | 每页条数:默认20,最多支持1000 |
| pageNum | Integer | 否 | 20 | 当前页码:默认1,pageNum*pageSize<100000 |
| applyType | Integer | 否 | 1 | 申请单类型,1:出差申请,2:用餐申请,3:用车申请(用车暂不支持外部申请单号查询),申请单查询时需要传值 |
| applyNo | String | 否 | xxxxxxxx | 美团申请单号,如需申请单查询请传applyType,applyNo与externalApplyNo两个字段只能传一个 |
| externalApplyNo | String | 否 | xxxxxxxx | 外部申请单号,如需申请单查询请传applyType,applyNo与externalApplyNo两个字段只能传一个 |
# 2.2.响应参数
| 名称 | 类型 | 是否必填 | 示例 | 说明 |
|---|---|---|---|---|
| traceId | String | 是 | 56a0af18ae30a168d4006c7c | 日志查询ID,用于排查问题 |
| status | Integer | 是 | 0 | 接口响应编码,编码枚举值和解决方案详见第四章错误码 |
| msg | String | 否 | 错误描述信息 | |
| data | String | 是 | UgxoCGPQIzoP | 响应数据,将响应参数JSON序列化后进行加密的结果值,解密秘钥使用secretKey参数 |
# data解密后数据结构
| 名称 | 类型 | 是否必填 | 示例 | 说明 |
|---|---|---|---|---|
| pageSize | Integer | 是 | 每页条数 | |
| pageNum | Integer | 是 | 当前页数 | |
| totalCount | Long | 是 | 总条数,根据查询条件查询的结果集总数 | |
| orderList | List<OrderListItem> | 是 | 订单列表结果集 |
OrderListItem字段说明
| 名称 | 类型 | 是否必填 | 示例 | 说明 |
|---|---|---|---|---|
| sqtBizOrderId | Long | 是 | 314442083816943618 | 美团企业版订单ID |
| origOrderId | String | 是 | 6045253884937765 | 业务原始订单ID |
| firstBusinessType | String | 是 | 030 | 一级业务品类编码,详见:6.1.业务类型映射关系 |
| secondBusinessType | String | 是 | 030110 | 二级业务品类编码,详见:6.1.业务类型映射关系 |
| payStatus | Integer | 是 | 32 | 支付状态,10:未支付,20:已支付,31:部分退款,32:全额退款 |
| staffId | Long | 是 | 227010 | 下单员工美团侧员工ID |
| staffName | String | 否 | 张珊珊 | 员工名称 |
| staffNum | String | 否 | 001 | 员工工号 |
| staffPhone | String | 否 | 131059684958 | 员工手机号 |
| staffEmail | String | 否 | 2828@qq.com | 员工邮箱 |
| expenseCityId | String | 是 | 110000 | 消费城市编码,国标编码 |
| expenseCityName | String | 否 | 北京市 | 消费城市名称 |
| orderAmount | String | 是 | 35.40 | 订单金额,单位元,精确到小数点后两位(不包含服务费) |
| totalPayAmount | String | 是 | 15.00 | 总支付金额,单位元,精确到小数点后两位(不包含服务费) |
| totalRefundAmount | String | 是 | 15.00 | 总退款金额,单位元,精确到小数点后两位(不包含服务费) |
| totalRealAmount | String | 是 | 0.00 | 实际支付金额,单位元,精确到小数点后两位(不包含服务费) |
| realtimeServiceFeeMode | Integer | 否 | 1 | 随单收服务费承担方式,0:企业承担(不扣预算),1:员工承担(扣员工预算),10:组合承担 |
| realtimeServiceFee | String | 否 | 0.00 | 随单收服务费,单位元,精确到小数点后两位 |
| afterServiceFee | String | 否 | 0.00 | 后结算服务费,单位元,精确到小数点后两位 |
| repayAmount | String | 是 | 0.00 | 实际偿还金额,单位元,精确到小数点后两位 |
| createTime | String | 是 | 2019-10-01 16:40:34 | 下单时间,格式:yyyy-MM-dd hh:mm:ss |
| updateTime | String | 是 | 2019-10-01 16:40:34 | 更新时间,格式:yyyy-MM-dd hh:mm:ss |
| payTime | String | 否 | 2021-03-10 16:43:29 | 首次支付时间,格式:yyyy-MM-dd hh:mm:ss |
| applyList | List<ApplyInfo> | 否 | 申请单信息 |
ApplyInfo字段说明
| 名称 | 类型 | 是否必填 | 示例 | 说明 |
|---|---|---|---|---|
| applyType | Integer | 是 | 1 | 申请单类型,1:出差申请,2:用餐申请,3:用车申请 |
| applyNo | String | 否 | 123456 | 美团企业版申请单号 |
| externalApplyNo | String | 否 | 4747 | 外部申请单号 |
# 3.示例
# 3.1.请求示例
# 3.1.1.请求示例
{
"accessKey": "B3GFJIEHNEM1RLV-TK",
"content": "UgJn07uNgW7S7fJK0R0xVbaLxoCGPQIzoP-_K4Hmp4RduGszhm2mbUs2toZhCtXKP5JGXVTZ9kGts2Wx3IJQCd90ptMoJTDB0vu7mkedEr4KZCvZn77EZLssMC5SpXilmQ-5RXHzvMIT0ASH-IXepTP_O16U37QqCkEb5L1WLy4"
}
# 3.1.2.请求参数content解析
{
"ts": 1617085650321,
"entId": 46574,
"firstBusinessType": "030",
"secondBusinessType": "030110",
"payStatus": 10,
"minCreateTime": 1569859200000,
"maxCreateTime": 1569859200000,
"minUpdateTime": 1569859200000,
"maxUpdateTime": 1569859200000,
"minPayTime": 1569859200000,
"maxPayTime": 1569859200000,
"pageNum": 1,
"pageSize": 20,
"applyType": 1,
"applyNo": "xxxxxxxx",
"outerApplyNo": "xxxxxxxx"
}
# 3.2.响应示例
# 3.2.1.响应结果
{
"traceId": "56a0af18ae30a168d4006c7c",
"status": 0,
"data": "UgJn07uNgW7S7fJK0R0xVbaLxoCGPQIzoP-_K4Hmp4RduGszhm2mbUs2toZhCtXKP5JGXVTZ9kGts2Wx3IJQCd90ptMoJTDB0vu7mkedEr4KZCvZn77EZLssMC5SpXilmQ-5RXHzvMIT0ASH-IXepTP_O16U37QqCkEb5L1WLy4"
}
# 3.2.2.响应参数data解析
{
"status": 0,
"message": null,
"data": {
"pageSize": 20,
"pageNum": 1,
"totalCount": 3,
"orderList": [
{
"sqtBizOrderId": 1635642136772743207,
"origOrderId": "1678802436769",
"firstBusinessType": "010",
"secondBusinessType": "010120",
"payStatus": 20,
"staffId": 390967,
"staffName": "XXX",
"staffNum": "03150629",
"staffPhone": null,
"staffEmail": null,
"expenseCityId": "110000",
"expenseCityName": "北京市",
"orderAmount": "1.00",
"totalPayAmount": "1.00",
"totalRefundAmount": "0.00",
"totalRealAmount": "1.00",
"realtimeServiceFeeMode": null,
"realtimeServiceFee": null,
"afterServiceFee": null,
"repayAmount": "0.00",
"createTime": "2023-03-14 22:00:48",
"updateTime": "2023-03-14 22:00:52",
"payTime": "2023-03-14 22:01:03",
"applyList": []
},
{
"sqtBizOrderId": 1633028378015567924,
"origOrderId": "447414063084876",
"firstBusinessType": "020",
"secondBusinessType": "020000",
"payStatus": 20,
"staffId": 528980,
"staffName": "XXX",
"staffNum": "03196682",
"staffPhone": null,
"staffEmail": null,
"expenseCityId": "110000",
"expenseCityName": "北京市",
"orderAmount": "75.00",
"totalPayAmount": "75.00",
"totalRefundAmount": "0.00",
"totalRealAmount": "75.00",
"realtimeServiceFeeMode": null,
"realtimeServiceFee": null,
"afterServiceFee": null,
"repayAmount": "0.00",
"createTime": "2023-03-07 16:54:40",
"updateTime": "2023-03-07 23:23:45",
"payTime": "2023-03-07 16:54:58",
"applyList": [
{
"applyType": 2,
"applyNo": "5T7DXOJQ054Y",
"outerApplyNo": ""
}
]
}
]
}
}
# 4.错误码
# 4.1.公共错误码
| 错误码 | 错误描述 | 解决方案 |
|---|---|---|
| 10010002 | 企业已停止合作,请联系客户经理进行确认 | 将接口调用的entId参数给到客户经理,由客户经理确认企业状态是否在合作中 |
| 10010003 | content不合法 | 详细阅读content参数加密说明(签名实例),确认content加密方式和content解密前传参是否正确 |
| 10010004 | ts缺失或ts时间已过期 | 确认ts是否传值并为13位时间戳,如果正确传值,则确认请求发起时间与美团接受请求的时间差是否超过10分钟 |
| 10010005 | entId不能为空 | entId参数不可为空,如果未拿到entId参数,可以咨询客户经理获取 |
| 20010001 | accessKey不合法 | 检查accessKey是否为客户经理给到的值,如果accessKey值正确,确认调用环境是否和accessKey一致,如使用测试环境的accessKey调用线上的接口 |
| 20010002 | 请求path不合法 | 检查接口调用地址是否正确,如是否有非法字符 |
| 20010003 | 鉴权失败,无接口访问权限 | 将接口调用地址给到客户经理,由客户经理检查接口权限是否开通并保存成功 |
| 20010004 | 越权访问,无法访问该企业数据,请检查entId的正确性 | 检查accessKey和entId两个参数的对应关系是否正确 |
| 30010001 | 访问频率过高 | 请确认接口访问频率,每个接口默认调用限频为每分钟不超过100次,超出调用频率会调用此错误 |
| 30010002 | 访问次数超过配额 | 请确认接口的累计访问次数,每个接口的默认累计调用量为10w次,超出限额则会报错 |
# 4.2.业务错误码
| 错误码 | 错误描述 | 解决方案 |
|---|---|---|
| 10210000 | 参数异常 | 请根据msg中内容排查传值情况,确认必填字段是否传值,如entId是否传值 |
| 10210001 | 参数不匹配 | 请根据msg中内容排查传值情况,确认字段传值是否正确,如firstBusinessType在枚举表中不存在 |
| 10210002 | 参数组合不匹配 | 请根据msg中内容排查传值情况,确认组合字段是否全部传值,如minCreateTime和maxCreateTime需要同时传值才生效 |
| 10210003 | 参数不支持 | 请求传入参数不支持,请根据接口调用返回结果确认异常具体原因,参考调用方与接口文档核对修正 |
# 5.代码实例
依赖SDK包地址:SDK下载地址
package com.meituan.sqt.demo.in.order;
import com.meituan.sqt.client.SqtClient;
import com.meituan.sqt.constant.CommonConstants;
import com.meituan.sqt.enums.ResponseStatusEnum;
import com.meituan.sqt.exception.MtSqtException;
import com.meituan.sqt.request.in.order.OrderListQueryRequest;
import com.meituan.sqt.response.in.BaseApiResponse;
import com.meituan.sqt.response.in.order.OrderListQueryResult;
import java.util.Objects;
public class OrderListQueryDemo {
private static final String invokeUrl = "https://waimai-openapi.apigw.test.meituan.com/api/sqt/open/order/queryList";
private static SqtClient sqtClient = null;
static {
// 初始化SqtClient,只需要初始化一次即可
// entId,accessKey,secretKey需要根据不同环境动态的设置获取
sqtClient = new SqtClient.Builder()
.setEntId(CommonConstants.entId)
.setAccessKey(CommonConstants.accessKey)
.setSecretKey(CommonConstants.secretKey)
.build();
}
public static void main(String[] args) throws MtSqtException {
// 1. 构建请求对象
OrderListQueryRequest orderListQueryRequest = new OrderListQueryRequest();
orderListQueryRequest.setTs(System.currentTimeMillis());
orderListQueryRequest.setEntId(sqtClient.getEntId());
// 可以单个参数查询,也可以多个参数组合查询
orderListQueryRequest.setPageSize(20);
orderListQueryRequest.setPageNum(1);
// orderListQueryRequest.setFirstBusinessType("030");
// orderListQueryRequest.setSecondBusinessType("030110");
// orderListQueryRequest.setPayStatus(10);
// orderListQueryRequest.setMinCreateTime(1569859200000L);
// orderListQueryRequest.setMaxCreateTime(1569859200000L);
// orderListQueryRequest.setMinUpdateTime(1569859200000L);
// orderListQueryRequest.setMaxUpdateTime(1569859200000L);
// orderListQueryRequest.setMinPayTime(1569859200000L);
// orderListQueryRequest.setMaxPayTime(1569859200000L);
// orderListQueryRequest.setApplyType(1);
// orderListQueryRequest.setApplyNo("xxxxxxxx");
// orderListQueryRequest.setExternalApplyNo("xxxxxxxx");
// 2. API调用
// 注意:超时时间默认以请求对象中注解ApiMeta上设置的为准,也可以自定义传递对应的超时时间
BaseApiResponse<OrderListQueryResult> response = sqtClient.invokeApi(invokeUrl, orderListQueryRequest, null, null);
// 3. 响应结果为空处理
if (response == null) {
// 处理响应结果为空情况
// ...
}
// 4. 获取结果
if(Objects.equals(ResponseStatusEnum.SUCCESS.getCode(), response.getStatus())) {
// 4.1 成功,获取订单列表查询结果
OrderListQueryResult realData = response.getRealData();
// 4.2 处理查询成功后的业务逻辑
} else {
// 处理请求失败场景
handleRespFailResult(response);
}
}
private static void handleRespFailResult(BaseApiResponse<OrderListQueryResult> response) {
// 访问频率过高
if (ResponseStatusEnum.HIGH_FREQUENCY_ACCESS.getCode().intValue() == response.getStatus()) {
// 解决方案参照:https://h5.dianping.com/app/bep-docs/open-platform-doc/guide/rate_limiting.html
}
// 访问次数超过配额
if (ResponseStatusEnum.EXCEED_ACCESS_NUMBER.getCode().intValue() == response.getStatus()) {
// 解决方案参照:https://h5.dianping.com/app/bep-docs/open-platform-doc/guide/rate_limiting.html
}
// 其它失败场景
}
}
# 6.附录
# 6.1.业务类型映射关系
| 一级业务类型编码 | 一级业务类型名称 | 二级业务类型编码 | 二级业务类型名称 |
|---|---|---|---|
| 010 | 到店 | ||
| 010110 | 团购 | ||
| 010120 | 买单 | ||
| 010130 | 扫一扫 | ||
| 010140 | 付款码 | ||
| 010150 | 特许报备 | ||
| 010160 | 预定 | ||
| 010170 | 安心付 | ||
| 020 | 外卖 | ||
| 030 | 酒店 | 030110 | 国内酒店 |
| 040 | 打车 | ||
| 050 | 火车票 | ||
| 060 | 机票 | 060110 | 国内机票 |
| 070 | 优选 | ||
| 080 | 买菜 | ||
| 090 | 配餐 | ||
| 090110 | 盒餐 | ||
| 090120 | 现场就餐 | ||
| 100 | 团好货 | ||
| 130 | 门票 | ||
| 140 | 电影票 | ||
| 150 | 跑腿 | ||
| 160 | 文印图文 | ||
| 999 | 其他 |
# 7.版本记录
| 版本号 | 版本日期 | 更新内容 |
|---|---|---|
| v1.0 | 2023-04-01 | 新增订单列表查询接口 |
| v1.1 | 2023-08-08 | 新增代码实例 |
| v1.2 | 2023-11-21 | 新增二级业务类型安心付 |