tao.mo

示例代码编写

mt
2022年4月14日22:33:55
No preview for this file type
No preview for this file type
...@@ -48,8 +48,8 @@ public class SHA256Util { ...@@ -48,8 +48,8 @@ public class SHA256Util {
48 } 48 }
49 49
50 public static void main(String[] args){ 50 public static void main(String[] args){
51 - String str = "BASFiClearExportC6db193cb4165a71b1582465812478"; 51 + String secretKey = "BASFiClearExportC6db193cb4165a71b1582465812478";
52 - String ss = getSHA256String(str); 52 + String token = getSHA256String(secretKey);
53 - System.out.println(ss); 53 + System.out.println(token);
54 } 54 }
55 } 55 }
......
...@@ -26,11 +26,11 @@ api: ...@@ -26,11 +26,11 @@ api:
26 password: toQu3arch6 26 password: toQu3arch6
27 address: 27 address:
28 #IClear校验运单地址 28 #IClear校验运单地址
29 - iclear-check-url: http://139.217.114.139:8080/chmConsignmentController/checkChmAndDetaliD 29 + iclear-check-url: http://139.217.114.139:8082/chmConsignmentController/checkChmAndDetaliD
30 #IClearC类提交运单地址 30 #IClearC类提交运单地址
31 - iclear-submit-url: http://139.217.114.139:8080/chmConsignmentController/submitConsignments 31 + iclear-submit-url: http://139.217.114.139:8082/chmConsignmentController/submitConsignments
32 #IClear校验C类运单地址 32 #IClear校验C类运单地址
33 - iclear-check-url-c: http://139.217.114.139:8080/chmConsignmentController/checkChmAndDetaliC 33 + iclear-check-url-c: http://139.217.114.139:8082/chmConsignmentController/checkChmAndDetaliC
34 #获取token地址 34 #获取token地址
35 token-url: https://apiuat.iclrccd-fedex.com/login 35 token-url: https://apiuat.iclrccd-fedex.com/login
36 #刷新token地址 36 #刷新token地址
......
This diff is collapsed. Click to expand it.
1 +package com.erry.iclear.dateInterface;
2 +
3 +import com.arronlong.httpclientutil.HttpClientUtil;
4 +import com.arronlong.httpclientutil.builder.HCB;
5 +import com.arronlong.httpclientutil.common.HttpConfig;
6 +import com.arronlong.httpclientutil.common.HttpHeader;
7 +import com.arronlong.httpclientutil.common.SSLs;
8 +import com.erry.iclear.dateInterface.util.SHA256Util;
9 +import org.apache.http.Header;
10 +
11 +/**
12 + * 获取HSCODE接口地址
13 + * fedex
14 + * 2022年4月14日17:55:55
15 + */
16 +public class HscodeRequest {
17 + public static String url = "https://40.73.78.157:8780";
18 + //获取HSCODE接口地址
19 + public static String path = "/hscode/hscodeRequest";
20 + //时间戳
21 + public static String timeStamp = "1649839249891";
22 + //APPID
23 + public static String appId = "BASF";
24 + //APPKEY
25 + public static String appKey = "iClearExportC";
26 + //需要申请
27 + public static String security = "6db193cb4165a71b";
28 +
29 + public static void main(String[] args) throws Exception{
30 + hscodeRequest();
31 + }
32 +
33 + /**
34 + * 获取HSCODE接口地址
35 + */
36 + public static void hscodeRequest() throws Exception{
37 + //hscode 编码可修改
38 + String json ="{\"hscode\":\"2939110014,84773010,3004201990,84251100\"}";
39 +
40 + String token = SHA256Util.getSHA256String(HscodeRequest.appId + HscodeRequest.appKey + HscodeRequest.security + HscodeRequest.timeStamp);
41 + System.out.println(token);
42 + //消息头
43 + Header[] headers = HttpHeader.custom()
44 + .other("Content-Type", "application/json")
45 + .other("Appid", HscodeRequest.appId)
46 + .other("appKey", HscodeRequest.appKey)
47 + .other("TimeStamp", HscodeRequest.timeStamp)
48 + .other("token", token)
49 + .build();
50 + //客户端配置
51 + HCB hcb = HCB.custom()
52 + .timeout(20000)
53 + .pool(100, 10)
54 + .sslpv(SSLs.SSLProtocolVersion.TLSv1_2)
55 + .ssl()
56 + .retry(3);
57 + //URL
58 + String url = HscodeRequest.url + HscodeRequest.path;
59 + //HTTP请求
60 + HttpConfig config = HttpConfig.custom()
61 + .headers(headers)
62 + .url(url)
63 + .encoding("utf-8")
64 + .client(hcb.build())
65 + .json(json);
66 + System.out.println(HttpClientUtil.post(config));
67 + }
68 +}
1 +package com.erry.iclear.dateInterface;
2 +
3 +import com.arronlong.httpclientutil.HttpClientUtil;
4 +import com.arronlong.httpclientutil.builder.HCB;
5 +import com.arronlong.httpclientutil.common.HttpConfig;
6 +import com.arronlong.httpclientutil.common.HttpHeader;
7 +import com.arronlong.httpclientutil.common.SSLs;
8 +import com.erry.iclear.dateInterface.util.SHA256Util;
9 +import org.apache.http.Header;
10 +
11 +/**
12 + * C类EDI数据接口
13 + * fedex
14 + * 2022年4月14日17:55:55
15 + */
16 +public class SelectChmListBasf {
17 + public static String url = "https://40.73.78.157:8780";
18 + //C类EDI数据接口
19 + public static String path = "/basf/selectChmListBasf";
20 + //时间戳
21 + public static String timeStamp = "1649839249891";
22 + //APPID
23 + public static String appId = "BASF";
24 + //APPKEY
25 + public static String appKey = "iClearExportC";
26 + //需要申请
27 + public static String security = "6db193cb4165a71b";
28 +
29 + public static void main(String[] args) throws Exception{
30 + selectDecListBasf();
31 + }
32 +
33 + /**
34 + * C类EDI数据接口
35 + */
36 + public static void selectDecListBasf() throws Exception{
37 + //consignmentCode 运单号需要修改
38 + String json ="{\"consignmentCode\":\"289050515424\"}";
39 +
40 + String token = SHA256Util.getSHA256String(SelectChmListBasf.appId + SelectChmListBasf.appKey + SelectChmListBasf.security + SelectChmListBasf.timeStamp);
41 + System.out.println(token);
42 + //消息头
43 + Header[] headers = HttpHeader.custom()
44 + .other("Content-Type", "application/json")
45 + .other("Appid", SelectChmListBasf.appId)
46 + .other("appKey", SelectChmListBasf.appKey)
47 + .other("TimeStamp", SelectChmListBasf.timeStamp)
48 + .other("token", token)
49 + .build();
50 + //客户端配置
51 + HCB hcb = HCB.custom()
52 + .timeout(20000)
53 + .pool(100, 10)
54 + .sslpv(SSLs.SSLProtocolVersion.TLSv1_2)
55 + .ssl()
56 + .retry(3);
57 + //URL
58 + String url = SelectChmListBasf.url + SelectChmListBasf.path;
59 + //HTTP请求
60 + HttpConfig config = HttpConfig.custom()
61 + .headers(headers)
62 + .url(url)
63 + .encoding("utf-8")
64 + .client(hcb.build())
65 + .json(json);
66 + System.out.println(HttpClientUtil.post(config));
67 + }
68 +}
1 +package com.erry.iclear.dateInterface;
2 +
3 +import com.arronlong.httpclientutil.HttpClientUtil;
4 +import com.arronlong.httpclientutil.builder.HCB;
5 +import com.arronlong.httpclientutil.common.HttpConfig;
6 +import com.arronlong.httpclientutil.common.HttpHeader;
7 +import com.arronlong.httpclientutil.common.SSLs;
8 +import com.erry.iclear.dateInterface.util.SHA256Util;
9 +import org.apache.http.Header;
10 +
11 +import java.util.Date;
12 +
13 +/**
14 + * C类EDI数据接口
15 + * fedex
16 + * 2022年4月14日17:55:55
17 + */
18 +public class SelectDecListBasf {
19 + public static String url = "https://40.73.78.157:8780";
20 + //C类EDI数据接口
21 + public static String path = "/basf/selectDecListBasf";
22 + //时间戳
23 + public static String timeStamp = "1649839249891";
24 + //APPID
25 + public static String appId = "BASF";
26 + //APPKEY
27 + public static String appKey = "iClearExportC";
28 + //需要申请
29 + public static String security = "6db193cb4165a71b";
30 +
31 + public static void main(String[] args) throws Exception{
32 + selectDecListBasf();
33 + }
34 +
35 + /**
36 + * C类EDI数据接口
37 + */
38 + public static void selectDecListBasf() throws Exception{
39 + //consignmentCode 运单号需要修改
40 + String json ="{\"consignmentCode\":\"289050515424\"}";
41 +
42 + String token = SHA256Util.getSHA256String(SelectDecListBasf.appId + SelectDecListBasf.appKey + SelectDecListBasf.security + SelectDecListBasf.timeStamp);
43 + System.out.println(token);
44 + //消息头
45 + Header[] headers = HttpHeader.custom()
46 + .other("Content-Type", "application/json")
47 + .other("Appid", SelectDecListBasf.appId)
48 + .other("appKey", SelectDecListBasf.appKey)
49 + .other("TimeStamp", SelectDecListBasf.timeStamp)
50 + .other("token", token)
51 + .build();
52 + //客户端配置
53 + HCB hcb = HCB.custom()
54 + .timeout(20000)
55 + .pool(100, 10)
56 + .sslpv(SSLs.SSLProtocolVersion.TLSv1_2)
57 + .ssl()
58 + .retry(3);
59 + //URL
60 + String url = SelectDecListBasf.url + SelectDecListBasf.path;
61 + //HTTP请求
62 + HttpConfig config = HttpConfig.custom()
63 + .headers(headers)
64 + .url(url)
65 + .encoding("utf-8")
66 + .client(hcb.build())
67 + .json(json);
68 + System.out.println(HttpClientUtil.post(config));
69 + }
70 +}
1 +package com.erry.iclear.dateInterface;
2 +
3 +import com.arronlong.httpclientutil.HttpClientUtil;
4 +import com.arronlong.httpclientutil.builder.HCB;
5 +import com.arronlong.httpclientutil.common.HttpConfig;
6 +import com.arronlong.httpclientutil.common.HttpHeader;
7 +import com.arronlong.httpclientutil.common.SSLs;
8 +import com.erry.iclear.dateInterface.util.SHA256Util;
9 +import org.apache.http.Header;
10 +
11 +import java.util.Date;
12 +
13 +/**
14 + * C类申报数据落地接口
15 + * fedex
16 + * 2022年4月14日17:55:55
17 + */
18 +public class SendMawbBasf {
19 + public static String url = "https://40.73.78.157:8780";
20 + //C类申报数据落地接口
21 + public static String path = "/basf/sendMawbBasf";
22 + //时间戳
23 + public static String timeStamp = "1649839249891";
24 + //APPID
25 + public static String appId = "BASF";
26 + //APPKEY
27 + public static String appKey = "iClearExportC";
28 + //需要申请
29 + public static String security = "6db193cb4165a71b";
30 +
31 + public static void main(String[] args) throws Exception{
32 + sendMawbBasf();
33 + }
34 +
35 + /**
36 + * C类申报数据落地接口
37 + */
38 + public static void sendMawbBasf() throws Exception{
39 + //申报数据:consignmentCode 运单号需要修改
40 + String json ="{\"consignmentCode\":\"271002102051\",\"consignmentId\":164535620,\"consType\":\"C\",\"sender\":\"巴斯夫护理化学品(上海)有限公司\",\"shipperCustomsCode\":\"3119920047\",\"shipperSCC\":\"91310000607239894U\",\"operateUnitName\":\"巴斯夫护理化学品(上海)有限公司\",\"operateUnitCode\":\"3119920047\",\"operateSCC\":\"91310000607239894U\",\"consignmentList\":[{\"consignmentDetailId\":83010676,\"skuCode\":\"2917341090\",\"skuName\":\"邻苯二甲酸二丁酯\",\"model\":\"品名:邻苯二甲酸二丁酯 |品牌类型:0|出口享惠情况:0|成分含量:100% 邻苯二甲酸二丁酯|用途:化学分析用试剂,实验用途|GTIN:|CAS:|其他[非必报要素,请根据实际情况填报]:|\",\"knockdownNumber\":1,\"knockdownUnit\":\"035\",\"qtyLegalFirst\":1,\"unitLegalFirst\":\"035\",\"qtyLegalSecond\":\"1.0000\",\"unitLegalSecond\":\"\",\"declaredAmount\":10,\"currency\":\"USD\",\"declaredWeight\":1}]}";
41 +
42 + String token = SHA256Util.getSHA256String(SendMawbBasf.appId + SendMawbBasf.appKey + SendMawbBasf.security + SendMawbBasf.timeStamp);
43 + System.out.println(token);
44 + //消息头
45 + Header[] headers = HttpHeader.custom()
46 + .other("Content-Type", "application/json")
47 + .other("Appid", SendMawbBasf.appId)
48 + .other("appKey", SendMawbBasf.appKey)
49 + .other("TimeStamp", SendMawbBasf.timeStamp)
50 + .other("token", token)
51 + .build();
52 + //客户端配置
53 + HCB hcb = HCB.custom()
54 + .timeout(20000)
55 + .pool(100, 10)
56 + .sslpv(SSLs.SSLProtocolVersion.TLSv1_2)
57 + .ssl()
58 + .retry(3);
59 + //URL
60 + String url = SendMawbBasf.url + SendMawbBasf.path;
61 + //HTTP请求
62 + HttpConfig config = HttpConfig.custom()
63 + .headers(headers)
64 + .url(url)
65 + .encoding("utf-8")
66 + .client(hcb.build())
67 + .json(json);
68 + System.out.println(HttpClientUtil.post(config));
69 + }
70 +}
1 +package com.erry.iclear.dateInterface;
2 +
3 +import com.arronlong.httpclientutil.HttpClientUtil;
4 +import com.arronlong.httpclientutil.builder.HCB;
5 +import com.arronlong.httpclientutil.common.HttpConfig;
6 +import com.arronlong.httpclientutil.common.HttpHeader;
7 +import com.arronlong.httpclientutil.common.SSLs;
8 +import com.erry.iclear.dateInterface.util.SHA256Util;
9 +import org.apache.http.Header;
10 +
11 +import java.util.Date;
12 +
13 +/**
14 + * D类申报的数据落地接口示例代码
15 + * fedex
16 + * 2022年4月14日16:34:18
17 + */
18 +public class SendMawbTest {
19 + public static String url = "https://40.73.78.157:8780";
20 + //D类申报的数据落地接口
21 + public static String sendMawb = "/customs/sendMawb";
22 + //时间戳
23 + public static String timeStamp = "1649839249891";
24 + //APPID
25 + public static String appId = "IDE";
26 + //APPKEY
27 + public static String appKey = "iClearExport";
28 + //需要申请
29 + public static String security = "b92131f03f19a348";
30 +
31 + public static void main(String[] args) throws Exception{
32 + sendMawb();
33 + }
34 +
35 + /**
36 + * D类申报的数据落地接口
37 + */
38 + public static void sendMawb() throws Exception{
39 + //申报数据:billNo 提单号需要修改
40 + String masbJson ="{\"ieFlag\":\"E\",\"type\":\"EX\",\"agentCode\":\"1111980005\",\"agentName\":\"联邦快递(中国)有限公司\",\"billNo\":\"202204141\",\"contrNo\":\"3006622200\",\"customMaster\":\"0208\",\"cutMode\":\"601\",\"declTrnRel\":\"0\",\"distinatePort\":\"DEU000\",\"ediId\":\"001\",\"feeCurr\":\"EUR\",\"feeMark\":\"3\",\"feeRate\":110.9,\"grossWet\":4.6,\"iePort\":\"0101\",\"insurCurr\":\"EUR\",\"insurMark\":\"3\",\"insurRate\":0.74,\"netWt\":32,\"ownerCode\":\"3118962277\",\"ownerName\":\"测试核销单位\",\"packNo\":1,\"tradeCountry\":\"USA\",\"tradeMode\":\"110\",\"tradeCode\":\"32099616DM\",\"trafMode\":\"5\",\"tradeName\":\"测试发件人\",\"transMode\":\"1\",\"wrapType\":\"23\",\"tradeCodeScc\":\"A74125896321456987\",\"ownerCodeScc\":\"913100007421296207\",\"tradeAreaCode\":\"DEU\",\"entyPortCode\":\"310302\",\"goodsPlace\":\"\",\"declareName\":\"Jimmy shen\",\"overseasConsigneeEname\":\"PRYSMIAN KABEL UND SYSTEME GMBH\",\"mawbDetailList\":[{\"detailId\":\"204\",\"classMark\":\"\",\"codeTS\":\"8504409999\",\"declPrice\":3365,\"declTotal\":3365,\"dutyMode\":\"1\",\"exgNo\":\"\",\"exgVersion\":\"\",\"firstUnit\":\"007\",\"firstQty\":1,\"originCountry\":\"CHN\",\"secondUnit\":\"035\",\"secondQty\":1,\"tradeCurr\":\"EUR\",\"useTo\":\"03\",\"destinationCountry\":\"DEU\",\"ciqCode\":\"\",\"destCode\":\"110102\",\"districtCode\":\"44079\",\"gno\":1,\"gname\":\"变频调速装置\",\"gmodel\":\"4|0|控制电机用|240KW|西门子/SIEMENS|6RA8081-6GV62-0AA0|||\",\"gqty\":1,\"gunit\":\"007\"}]}";
41 + String token = SHA256Util.getSHA256String(SendMawbTest.appId + SendMawbTest.appKey + SendMawbTest.security + SendMawbTest.timeStamp);
42 + //消息头
43 + Header[] headers = HttpHeader.custom()
44 + .other("Content-Type", "application/json")
45 + .other("Appid", SendMawbTest.appId)
46 + .other("appKey", SendMawbTest.appKey)
47 + .other("TimeStamp", SendMawbTest.timeStamp)
48 + .other("token", token)
49 + .build();
50 + //客户端配置
51 + HCB hcb = HCB.custom()
52 + .timeout(20000)
53 + .pool(100, 10)
54 + .sslpv(SSLs.SSLProtocolVersion.TLSv1_2)
55 + .ssl()
56 + .retry(3);
57 + //URL
58 + String url = SendMawbTest.url + SendMawbTest.sendMawb;
59 + //HTTP请求
60 + HttpConfig config = HttpConfig.custom()
61 + .headers(headers)
62 + .url(url)
63 + .encoding("utf-8")
64 + .client(hcb.build())
65 + .json(masbJson);
66 + System.out.println(HttpClientUtil.post(config));
67 + }
68 +}