xuhy
2026-01-27 2d2a8ce78eff4ff88dc146e26f2722d183445823
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package com.ruoyi.web.controller.yuncang.api.trade;
 
 
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.core.exception.ServiceException;
import com.ruoyi.web.controller.yuncang.utils.WdtClient;
import lombok.extern.slf4j.Slf4j;
 
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
 
@Slf4j
public class LogisticsSyncQuery {
 
    /**
     * 物流erp查询
     * @param sid     卖家账号,接口请求的公共参数sid
     * @param appkey     接口账号,接口请求的公共参数appkey
     * @param appsecret 接口秘钥,接口请求的参数appsecret ,用于计算签名
     * @param url     接口地址,接口请求的公共参数url
     * @param shop_no     店铺编号
     * @return
     */
    public static JSONObject logisticsSyncQuery(String sid, String appkey, String appsecret, String url,
                                          String shop_no) {
        WdtClient client = new WdtClient(sid, appkey, appsecret, url);
        Map<String, String> params = new HashMap<String, String>();
        params.put("shop_no", shop_no);
//        params.put("is_part_sync_able", "0");
        params.put("limit", "100");
        try {
            String response = client.execute("logistics_sync_query.php", params);
            log.info("物流erp查询结果:{}", response);
            JSONObject jsonObject = JSONObject.parseObject(response);
            if(jsonObject.getInteger("code") == 0){
                return jsonObject;
            }else{
                log.info("物流erp查询失败");
                throw new ServiceException(jsonObject.getString("message"));
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }
    public static void main(String[] args) {
        WdtClient client = new WdtClient("", "", "", "");
        Map<String, String> params = new HashMap<String, String>();
        params.put("shop_no", "mytest");
        params.put("is_part_sync_able", "0");
        params.put("limit", "100");
        try {
            String response = client.execute("logistics_sync_query.php", params);
            System.out.println(response);
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
 
}