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();
|
}
|
}
|
|
}
|