订单结果查询接口

因Internet环境下,网络不是绝对可靠,用户系统下订单到顺丰后,不一定可以收到顺丰系统返回的数据,此接口用于在未收到返回数据时,查询订单创建接口客户订单当前的处理情况。

1.请求参数:

POST https://kf.fw199.com/gateway/sfexpress/order/search

参数名 类型 说明 示例
appid String 合作伙伴AppId uwkahf@jfs92
timestamp String 当前时间戳
request_data String json格式的业务参数 见下表1.1
client_code String 顺丰的客户编码
check_word String 顺丰的校验码
sign String 接口签名 如何计算生成见示例代码
1.1 参数request_data 的说明
# 属性名 类型(约束) 必填 默认值 描述
1 orderId String(64) 客户订单号
2 searchType String(1) 1 查询类型:1.正向单查询,传入的orderId为正向订单号,2.退货单查询,传入的orderId为退货原始订单号
3 language String(100) 语言(返回描述语)

2. 请求示例代码(Java)

   /**
     *  查询订单
     * @throws Exception
     */
    @Test
    public void searchOrder() throws Exception {

        String result =""; 
        String jsonData  = "{" +
                "\"searchType\": \"1\"," +
                "\"orderId\": \"QIAO-20200618-200\"," +
                "\"language\": \"zh-cn\"" +
                "}";

        CloseableHttpClient httpclient = HttpClients.createDefault();
        HttpPost httpPost = new HttpPost( Config.SFExpressSearchOrderUrl );

        //业务参数
        Map<String, String> data = new HashMap<String, String>();
        data.put("appid",  Config.AppId);
        data.put("request_data", jsonData);
        data.put("client_code",  Config.SFClientCode);
       data.put("check_word",  Config.SFCheckWord);
        Long timestamp = System.currentTimeMillis() / 1000;
        data.put("timestamp", timestamp.toString());

        // 参数签名
        data.put("sign", Utils.Sign(data,Config.AppSecret));
        List<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();
        for (Map.Entry<String, String> entry : data.entrySet()) {
            params.add(new BasicNameValuePair(entry.getKey(), entry.getValue()));
        }
        //发起POST请求
        try {
            httpPost.setEntity(new UrlEncodedFormEntity(params, "UTF-8"));
            HttpResponse httpResponse = httpclient.execute(httpPost);
            if (httpResponse.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
                result =  EntityUtils.toString(httpResponse.getEntity());
            } else {
                result =  ("doPost Error Response: " + httpResponse.getStatusLine().toString());
            }
        } catch (Exception e) {
            e.printStackTrace();

        }

        System.out.println(result);

    }

3. 返回结果如下:

  {
     "code": 0,
     "message": "ok",
     "data": {
         "apiErrorMsg": "",
         "apiResponseID": "00017A8938302C3FE343DA12DF34623F",
         "apiResultCode": "A1000",
         "apiResultData": "{\"success\":true,\"errorCode\":\"S0000\",\"errorMsg\":null,\"msgData\":{\"orderId\":\"QIAO-20200618-200\",\"returnExtraInfoList\":null,\"waybillNoInfoList\":[{\"waybillType\":1,\"waybillNo\":\"SF1303262056675\"}],\"origincode\":\"719\",\"destcode\":\"710\",\"filterResult\":\"2\",\"remark\":null,\"routeLabelInfo\":[{\"code\":\"1000\",\"routeLabelData\":{\"waybillNo\":\"SF1303262056675\",\"sourceTransferCode\":\"\",\"sourceCityCode\":\"719\",\"sourceDeptCode\":\"719\",\"sourceTeamCode\":\"\",\"destCityCode\":\"710\",\"destDeptCode\":\"710BF\",\"destDeptCodeMapping\":\"\",\"destTeamCode\":\"001\",\"destTeamCodeMapping\":\"\",\"destTransferCode\":\"710VA\",\"destRouteLabel\":\"710BF-001\",\"proName\":\"顺丰标快\",\"cargoTypeCode\":\"T6\",\"limitTypeCode\":\"T6\",\"expressTypeCode\":\"B1\",\"codingMapping\":\"\",\"codingMappingOut\":\"\",\"xbFlag\":\"0\",\"printFlag\":\"000000000\",\"twoDimensionCode\":\"MMM={'k1':'710VA','k2':'710BF','k3':'001','k4':'T6','k5':'SF1303262056675','k6':'','k7':'46ff3389'}\",\"proCode\":\"T6\",\"printIcon\":\"00000000\",\"abFlag\":\"\",\"destPortCode\":\"\",\"destCountry\":\"\",\"destPostCode\":\"\",\"goodsValueTotal\":\"\",\"currencySymbol\":\"\",\"cusBatch\":\"\",\"goodsNumber\":\"\",\"errMsg\":\"\",\"checkCode\":\"46ff3389\",\"proIcon\":\"\",\"fileIcon\":\"\",\"fbaIcon\":\"\",\"icsmIcon\":\"\",\"destGisDeptCode\":\"710BF\",\"newIcon\":null,\"sendAreaCode\":null,\"destinationStationCode\":null,\"sxLabelDestCode\":null,\"sxDestTransferCode\":null,\"sxCompany\":null,\"newAbFlag\":null,\"destAddrKeyWord\":null,\"rongType\":null},\"message\":\"SF1303262056675:\"}]}}"
     },
     "trace_id": "KgcSQcVUzdOpXxhtMgLz"
 }

说明: code为0表示成功,非0为失败,message会包含失败原因。

4. 返回参数msgData说明:

# 属性名 类型(约束) 必填 默认值 描述
1 orderId String(64) 客户订单号
2 destCode String(30) 目的地区域代码,可用于顺丰电子运单标签打印
3 filterResult String(30) 筛单结果:1:人工确认2:可收派3:不可以收派
4 returnExtraInfoList List 返回信息扩展属性
5 waybillNoInfoList List 顺丰运单号
6 routeLabelInfo List 路由标签数据
4.1 元素<响应> returnExtraInfoList/List
# 属性名 类型(约束) 必填 描述
1 attrName String(30) 扩展属性名
2 attrVal String(30) 扩展属性值
4.2 元素<响应> waybillNoInfoList/List
# 属性名 类型(约束) 必填 描述
1 waybillType String(30) 运单号类型1:母单 2 :子单 3 : 签回单
2 waybillNo String(30) 运单号
4.3 元素<响应> routeLabelInfo/List
# 属性名 类型(约束) 必填 描述
1 code String(30) 0000(接口参数异常)0010(其它异常)0001(xml解析异常)0002(字段校验异常)0003(票数节点超出最大值,批量请求最大票数为100票)0004(RLS获取路由标签的必要字段为空)1000 成功
2 message String(30) 系统错误信息(系统异常后就不会有路由标签业务处理)
3 routeLabelData RouteLabelRespDetailDto 路由标签数据对象
4.4 元素<响应> routeLabelInfo/List/routeLabelData/RouteLabelRespDetailDto
# 属性名 类型(约束) 必填 描述
1 waybillNo String(30) 运单号
2 sourceTransferCode String(60) 原寄地中转场
3 sourceCityCode String(60) 原寄地城市代码
4 sourceDeptCode String(60) 原寄地网点代码
5 sourceTeamCode String(60) 原寄地单元区域
6 destCityCode String(60) 目的地城市代码,eg:755
7 destDeptCode String(60) 目的地网点代码,eg:755AQ
8 destDeptCodeMapping String(60) 目的地网点代码映射码
9 destTeamCode String(60) 目的地单元区域,eg:001
10 destTeamCodeMapping String(60) 目的地单元区域映射码
11 destTransferCode String(60) 目的地中转场
12 destRouteLabel String(200) 打单时的路由标签信息如果是大网的路由标签,这里的值是目的地网点代码,如果是同城配的路由标签,这里的值是根据同城配的设置映射出来的值,不同的配置结果会不一样,不能根据-符号切分(如:上海同城配,可能是:集散点-目的地网点-接驳点,也有可能是目的地网点代码-集散点-接驳点)
131 proName String(600) 产品名称
14 twoDimensionCode String(30) 二维码根据规则生成字符串信息,* 格式为MMM={‘k1’:’(目的地中转场代码)’,* ‘k2’:’(目的地原始网点代码)’,* ‘k3’:’(目的地单元区域)’,* ‘k4’:’(附件通过三维码(express_type_code、limit_type_code、cargo_type_code)映射时效类型)’,* ‘k5’:’(运单号)’}
15 proCode String(30) 时效类型
16 printIcon String(20) 打印图标* 根据托寄物判断需要打印的图标(锂电池,蟹类,生鲜,易碎)* 返回值有4位,每一位只有0和1两种,0表示按运单默认的规则,1表示显示* 顺序如下:锂电池,蟹类,生鲜,易碎* 如:0000表示不需要打印锂电池,蟹类,生鲜 ,易碎
17 abFlag String(600) AB标
18 destPortCode String(30) 目的地口岸代码
19 destCountry String(100) 目的国别(国别代码如:JP)
20 destPostCode String(30) 目的地邮编
21 goodsValueTotal String(1000) 总价值(保留两位小数,数字类型)
22 currencySymbol String(100) 币种
23 goodsNumber String(100) 件数
24 proIcon String(100)
文档更新时间: 2023-03-14 17:05   作者:admin