SendMawbFedex.java
3.14 KB
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
63
64
65
66
67
68
package com.erry.iclear.dateInterface;
import com.arronlong.httpclientutil.HttpClientUtil;
import com.arronlong.httpclientutil.builder.HCB;
import com.arronlong.httpclientutil.common.HttpConfig;
import com.arronlong.httpclientutil.common.HttpHeader;
import com.arronlong.httpclientutil.common.SSLs;
import com.erry.iclear.dateInterface.util.SHA256Util;
import org.apache.http.Header;
/**
* C类申报数据落地接口
* fedex
* 2022年4月14日17:55:55
*/
public class SendMawbFedex {
public static String url = "https://40.73.78.157:8780";
//C类申报数据落地接口
public static String path = "/fedex/sendMawbFedex";
//时间戳
public static String timeStamp = "1649839249891";
//APPID
public static String appId = "BASF";
//APPKEY
public static String appKey = "iClearExportC";
//需要申请
public static String security = "6db193cb4165a71b";
public static void main(String[] args) throws Exception{
sendMawbBasf();
}
/**
* C类申报数据落地接口
*/
public static void sendMawbBasf() throws Exception{
//申报数据:consignmentCode 运单号需要修改
String json ="{\"consignmentCode\":\"281833508306\",\"consignmentId\":14054615,\"consType\":\"C\",\"sender\":\"鲁泰纺织股份有限公司\",\"operateUnitName\":\"鲁泰纺织股份有限公司\",\"operateUnitCode\":\"3703930116\",\"operateSCC\":\"91370302613281175K\",\"shipperCustomsCode\":\"3703930116\",\"shipperSCC\":\"91370302613281175K\",\"EANNo\":\"0000000001\",\"consignmentList\":[{\"consignmentDetailId\":15815679,\"skuCode\":\"4205001090\",\"skuName\":\"其他动物皮革制的坐具套\",\"model\":\"品名:其他动物皮革制的坐具套|品牌类型:0|出口享惠情况:0|材质[皮革或再生皮革]:皮革|GTIN:|CAS:|其他[非必报要素,请根据实际情况填报]:|\",\"knockdownNumber\":1,\"knockdownUnit\":\"035\",\"qtyLegalFirst\":1,\"unitLegalFirst\":\"035\",\"declaredAmount\":1,\"currency\":\"USD\",\"declaredWeight\":1}]}";
System.out.println(json);
String token = SHA256Util.getSHA256String(SendMawbFedex.appId + SendMawbFedex.appKey + SendMawbFedex.security + SendMawbFedex.timeStamp);
System.out.println(token);
//消息头
Header[] headers = HttpHeader.custom()
.other("Content-Type", "application/json")
.other("Appid", SendMawbFedex.appId)
.other("appKey", SendMawbFedex.appKey)
.other("TimeStamp", SendMawbFedex.timeStamp)
.other("token", token)
.build();
//客户端配置
HCB hcb = HCB.custom()
.timeout(20000)
.pool(100, 10)
.sslpv(SSLs.SSLProtocolVersion.TLSv1_2)
.ssl()
.retry(3);
//URL
String url = SendMawbFedex.url + SendMawbFedex.path;
//HTTP请求
HttpConfig config = HttpConfig.custom()
.headers(headers)
.url(url)
.encoding("utf-8")
.client(hcb.build())
.json(json);
System.out.println(HttpClientUtil.post(config));
}
}