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 {
}
public static void main(String[] args){
String str = "BASFiClearExportC6db193cb4165a71b1582465812478";
String ss = getSHA256String(str);
System.out.println(ss);
String secretKey = "BASFiClearExportC6db193cb4165a71b1582465812478";
String token = getSHA256String(secretKey);
System.out.println(token);
}
}
......
......@@ -26,11 +26,11 @@ api:
password: toQu3arch6
address:
#IClear校验运单地址
iclear-check-url: http://139.217.114.139:8080/chmConsignmentController/checkChmAndDetaliD
iclear-check-url: http://139.217.114.139:8082/chmConsignmentController/checkChmAndDetaliD
#IClearC类提交运单地址
iclear-submit-url: http://139.217.114.139:8080/chmConsignmentController/submitConsignments
iclear-submit-url: http://139.217.114.139:8082/chmConsignmentController/submitConsignments
#IClear校验C类运单地址
iclear-check-url-c: http://139.217.114.139:8080/chmConsignmentController/checkChmAndDetaliC
iclear-check-url-c: http://139.217.114.139:8082/chmConsignmentController/checkChmAndDetaliC
#获取token地址
token-url: https://apiuat.iclrccd-fedex.com/login
#刷新token地址
......
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;
import java.util.Date;
public class ApiTest {
// public static String url = "https://40.73.78.157:8780";
public static String url = "https://40.73.78.157:8780";
//D类申报的数据落地接口
public static String sendMawb = "/customs/sendMawb";
//C类申报的数据落地接口
public static String sendMawbBasf = "/basf/sendMawbBasf";
//C类EDI数据接口
public static String selectDecListBasf = "/basf/selectDecListBasf";
//C类回执数据接口
public static String selectChmListBasf = "basf/selectChmListBasf";
//获取HSCODE接口地址
public static String hscodeRequest = "hscode/hscodeRequest";
public static String timeStamp = "1649839249891";
public static String appId = "IDE";
public static String appKey = "iClearExport";
//需要申请
public static String security = "b92131f03f19a348";
public static void main(String[] args) throws Exception{
//D类申报的数据落地接口
// ApiTest.sendMawb();
//C类申报的数据落地接口
ApiTest.sendMawbBasf();
//C类EDI数据接口
// ApiTest.selectDecListBasf();
//C类回执数据接口
// ApiTest.selectChmListBasf();
//获取HSCODE接口地址
// ApiTest.hscodeRequest();
}
/**
* D类申报的数据落地接口
*/
public static void sendMawb() throws Exception{
//billNo 提单号需要修改
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\"}]}";
System.out.println(new Date(Long.valueOf(timeStamp)));
String token = SHA256Util.getSHA256String("IDE" + "iClearExport" + ApiTest.security + ApiTest.timeStamp);
System.out.println(token);
Header[] headers = HttpHeader.custom()
.other("Content-Type", "application/json")
.other("Appid", ApiTest.appId)
.other("appKey", ApiTest.appKey)
.other("TimeStamp", ApiTest.timeStamp)
.other("token", token)
.build();
HCB hcb = HCB.custom()
.timeout(20000)
.pool(100, 10)
.sslpv(SSLs.SSLProtocolVersion.TLSv1_2)
.ssl()
.retry(3);
//String url = "https://40.73.78.157:8780/customs/sendMawb";
String url = ApiTest.url + ApiTest.sendMawb;
HttpConfig config = HttpConfig.custom()
.headers(headers)
.url(url)
.encoding("utf-8")
.client(hcb.build())
// .json(new Gson().toJson(createMawb()));
.json(masbJson);
System.out.println(HttpClientUtil.post(config));
}
/**
* C类申报的数据落地接口
*/
public static void selectDecListBasf(){
String masbJson ="{\"consignmentCode\": \"289879310277\",\"consignmentId\": 222012812411,\"consType\": \"C\",\"sender\": \"巴斯夫(中国)有限公司1\",\"shipperCustomsCode\": \"1\",\"shipperSCC\": \"913100007109210071\",\"operateUnitName\": \"巴斯夫(中国)有限公司1\",\"operateUnitCode\": \"1\",\"operateSCC\": \"913100007109210071\",\"EANNo\": \"\",\"consignmentList\": [{\"consignmentDetailId\": 83010676,\"skuCode\": \"2917341090\",\"skuName\": \"邻苯二甲酸二丁酯\",\"model\": \"品名:邻苯二甲酸二丁酯 |品牌类型:0|出口享惠情况:0|成分含量:100% 邻苯二甲酸二丁酯|用途:化学分析用试剂,实验用途|GTIN:|CAS:|其他[非必报要素,请根据实际情况填报]:|\",\"knockdownNumber\": 1,\"knockdownUnit\": \"035\",\"qtyLegalFirst\": 1,\"unitLegalFirst\": \"035\",\"qtyLegalSecond\": \"1.0000\",\"unitLegalSecond\": \"035\",\"declaredAmount\": 10,\"currency\": \"USD\",\"declaredWeight\": 1}]}";
}
/**
* C类EDI数据接口
*/
public static void sendMawbBasf(){
String masbJson ="{\"ieFlag\":\"I\",\"type\":\" 0\",\"agentCode\":\"1111980005\",\"agentName\":\"联邦快递\",\"billNo\":\"774597567332\",\"contrNo\":\"3006635555/3006636664\",\"customMaster\":\"0207\",\"cutMode\":\"1\",\"declTrnRel\":\"0\",\"distinatePort\":\"DEU000\",\"ediId\":\"1\",\"feeCurr\":\"EUR\",\"feeMark\":\"3\",\"feeRate\":110.9,\"grossWet\":4.6,\"iePort\":\"0207\",\"insurCurr\":\"EUR\",\"insurMark\":\"\",\"insurRate\":0.74,\"netWt\":32,\"ownerCode\":\"9112011660\",\"ownerName\":\"西门子电气传动有限公司\",\"packNo\":1,\"tradeCountry\":\"USA\",\"tradeMode\":\"0110\",\"tradeCode\":\"9112011660\",\"trafMode\":\"5\",\"tradeName\":\"西门子电气传动有限公司\",\"transMode\":\"1\",\"wrapType\":\"23\",\"tradeCodeScc\":\"91120116600587482L\",\"ownerCodeScc\":\"91120116600587482L\",\"tradeAreaCode\":\"DEU\",\"entyPortCode\":\"110101\",\"goodsPlace\":\"\",\"declareName\":\"Jimmy shen\",\"overseasConsigneeEname\":\"PRYSMIAN KABEL UND SYSTEME GMBH\",\"mawbDetailList\":[{\"detailId\":\"495\",\"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\"},{\"detailId\":\"496\",\"classMark\":\"\",\"codeTS\":\"8504409999\",\"declPrice\":9369,\"declTotal\":9369,\"dutyMode\":\"1\",\"exgNo\":\"\",\"exgVersion\":\"\",\"firstUnit\":\"007\",\"firstQty\":3,\"originCountry\":\"CHN\",\"secondUnit\":\"035\",\"secondQty\":1,\"tradeCurr\":\"EUR\",\"useTo\":\"03\",\"destinationCountry\":\"DEU\",\"ciqCode\":\"\",\"destCode\":\"110102\",\"districtCode\":\"11010\",\"gno\":2,\"gname\":\"其他未列名静止式变流器\",\"gmodel\":\"4|0|控制电机用|36KW|西门子/SIEMENS|6RA8081-6GV62-0BB0|||\",\"gqty\":3,\"gunit\":\"007\"}]}";
}
/**
* C类回执数据接口
*/
public static void selectChmListBasf(){
String masbJson ="{\"ieFlag\":\"I\",\"type\":\" 0\",\"agentCode\":\"1111980005\",\"agentName\":\"联邦快递\",\"billNo\":\"774597567332\",\"contrNo\":\"3006635555/3006636664\",\"customMaster\":\"0207\",\"cutMode\":\"1\",\"declTrnRel\":\"0\",\"distinatePort\":\"DEU000\",\"ediId\":\"1\",\"feeCurr\":\"EUR\",\"feeMark\":\"3\",\"feeRate\":110.9,\"grossWet\":4.6,\"iePort\":\"0207\",\"insurCurr\":\"EUR\",\"insurMark\":\"\",\"insurRate\":0.74,\"netWt\":32,\"ownerCode\":\"9112011660\",\"ownerName\":\"西门子电气传动有限公司\",\"packNo\":1,\"tradeCountry\":\"USA\",\"tradeMode\":\"0110\",\"tradeCode\":\"9112011660\",\"trafMode\":\"5\",\"tradeName\":\"西门子电气传动有限公司\",\"transMode\":\"1\",\"wrapType\":\"23\",\"tradeCodeScc\":\"91120116600587482L\",\"ownerCodeScc\":\"91120116600587482L\",\"tradeAreaCode\":\"DEU\",\"entyPortCode\":\"110101\",\"goodsPlace\":\"\",\"declareName\":\"Jimmy shen\",\"overseasConsigneeEname\":\"PRYSMIAN KABEL UND SYSTEME GMBH\",\"mawbDetailList\":[{\"detailId\":\"495\",\"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\"},{\"detailId\":\"496\",\"classMark\":\"\",\"codeTS\":\"8504409999\",\"declPrice\":9369,\"declTotal\":9369,\"dutyMode\":\"1\",\"exgNo\":\"\",\"exgVersion\":\"\",\"firstUnit\":\"007\",\"firstQty\":3,\"originCountry\":\"CHN\",\"secondUnit\":\"035\",\"secondQty\":1,\"tradeCurr\":\"EUR\",\"useTo\":\"03\",\"destinationCountry\":\"DEU\",\"ciqCode\":\"\",\"destCode\":\"110102\",\"districtCode\":\"11010\",\"gno\":2,\"gname\":\"其他未列名静止式变流器\",\"gmodel\":\"4|0|控制电机用|36KW|西门子/SIEMENS|6RA8081-6GV62-0BB0|||\",\"gqty\":3,\"gunit\":\"007\"}]}";
}
/**
* 获取HSCODE接口地址
*/
public static void hscodeRequest(){
String masbJson ="{\"ieFlag\":\"I\",\"type\":\" 0\",\"agentCode\":\"1111980005\",\"agentName\":\"联邦快递\",\"billNo\":\"774597567332\",\"contrNo\":\"3006635555/3006636664\",\"customMaster\":\"0207\",\"cutMode\":\"1\",\"declTrnRel\":\"0\",\"distinatePort\":\"DEU000\",\"ediId\":\"1\",\"feeCurr\":\"EUR\",\"feeMark\":\"3\",\"feeRate\":110.9,\"grossWet\":4.6,\"iePort\":\"0207\",\"insurCurr\":\"EUR\",\"insurMark\":\"\",\"insurRate\":0.74,\"netWt\":32,\"ownerCode\":\"9112011660\",\"ownerName\":\"西门子电气传动有限公司\",\"packNo\":1,\"tradeCountry\":\"USA\",\"tradeMode\":\"0110\",\"tradeCode\":\"9112011660\",\"trafMode\":\"5\",\"tradeName\":\"西门子电气传动有限公司\",\"transMode\":\"1\",\"wrapType\":\"23\",\"tradeCodeScc\":\"91120116600587482L\",\"ownerCodeScc\":\"91120116600587482L\",\"tradeAreaCode\":\"DEU\",\"entyPortCode\":\"110101\",\"goodsPlace\":\"\",\"declareName\":\"Jimmy shen\",\"overseasConsigneeEname\":\"PRYSMIAN KABEL UND SYSTEME GMBH\",\"mawbDetailList\":[{\"detailId\":\"495\",\"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\"},{\"detailId\":\"496\",\"classMark\":\"\",\"codeTS\":\"8504409999\",\"declPrice\":9369,\"declTotal\":9369,\"dutyMode\":\"1\",\"exgNo\":\"\",\"exgVersion\":\"\",\"firstUnit\":\"007\",\"firstQty\":3,\"originCountry\":\"CHN\",\"secondUnit\":\"035\",\"secondQty\":1,\"tradeCurr\":\"EUR\",\"useTo\":\"03\",\"destinationCountry\":\"DEU\",\"ciqCode\":\"\",\"destCode\":\"110102\",\"districtCode\":\"11010\",\"gno\":2,\"gname\":\"其他未列名静止式变流器\",\"gmodel\":\"4|0|控制电机用|36KW|西门子/SIEMENS|6RA8081-6GV62-0BB0|||\",\"gqty\":3,\"gunit\":\"007\"}]}";
}
}
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;
/**
* 获取HSCODE接口地址
* fedex
* 2022年4月14日17:55:55
*/
public class HscodeRequest {
public static String url = "https://40.73.78.157:8780";
//获取HSCODE接口地址
public static String path = "/hscode/hscodeRequest";
//时间戳
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{
hscodeRequest();
}
/**
* 获取HSCODE接口地址
*/
public static void hscodeRequest() throws Exception{
//hscode 编码可修改
String json ="{\"hscode\":\"2939110014,84773010,3004201990,84251100\"}";
String token = SHA256Util.getSHA256String(HscodeRequest.appId + HscodeRequest.appKey + HscodeRequest.security + HscodeRequest.timeStamp);
System.out.println(token);
//消息头
Header[] headers = HttpHeader.custom()
.other("Content-Type", "application/json")
.other("Appid", HscodeRequest.appId)
.other("appKey", HscodeRequest.appKey)
.other("TimeStamp", HscodeRequest.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 = HscodeRequest.url + HscodeRequest.path;
//HTTP请求
HttpConfig config = HttpConfig.custom()
.headers(headers)
.url(url)
.encoding("utf-8")
.client(hcb.build())
.json(json);
System.out.println(HttpClientUtil.post(config));
}
}
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类EDI数据接口
* fedex
* 2022年4月14日17:55:55
*/
public class SelectChmListBasf {
public static String url = "https://40.73.78.157:8780";
//C类EDI数据接口
public static String path = "/basf/selectChmListBasf";
//时间戳
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{
selectDecListBasf();
}
/**
* C类EDI数据接口
*/
public static void selectDecListBasf() throws Exception{
//consignmentCode 运单号需要修改
String json ="{\"consignmentCode\":\"289050515424\"}";
String token = SHA256Util.getSHA256String(SelectChmListBasf.appId + SelectChmListBasf.appKey + SelectChmListBasf.security + SelectChmListBasf.timeStamp);
System.out.println(token);
//消息头
Header[] headers = HttpHeader.custom()
.other("Content-Type", "application/json")
.other("Appid", SelectChmListBasf.appId)
.other("appKey", SelectChmListBasf.appKey)
.other("TimeStamp", SelectChmListBasf.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 = SelectChmListBasf.url + SelectChmListBasf.path;
//HTTP请求
HttpConfig config = HttpConfig.custom()
.headers(headers)
.url(url)
.encoding("utf-8")
.client(hcb.build())
.json(json);
System.out.println(HttpClientUtil.post(config));
}
}
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;
import java.util.Date;
/**
* C类EDI数据接口
* fedex
* 2022年4月14日17:55:55
*/
public class SelectDecListBasf {
public static String url = "https://40.73.78.157:8780";
//C类EDI数据接口
public static String path = "/basf/selectDecListBasf";
//时间戳
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{
selectDecListBasf();
}
/**
* C类EDI数据接口
*/
public static void selectDecListBasf() throws Exception{
//consignmentCode 运单号需要修改
String json ="{\"consignmentCode\":\"289050515424\"}";
String token = SHA256Util.getSHA256String(SelectDecListBasf.appId + SelectDecListBasf.appKey + SelectDecListBasf.security + SelectDecListBasf.timeStamp);
System.out.println(token);
//消息头
Header[] headers = HttpHeader.custom()
.other("Content-Type", "application/json")
.other("Appid", SelectDecListBasf.appId)
.other("appKey", SelectDecListBasf.appKey)
.other("TimeStamp", SelectDecListBasf.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 = SelectDecListBasf.url + SelectDecListBasf.path;
//HTTP请求
HttpConfig config = HttpConfig.custom()
.headers(headers)
.url(url)
.encoding("utf-8")
.client(hcb.build())
.json(json);
System.out.println(HttpClientUtil.post(config));
}
}
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;
import java.util.Date;
/**
* C类申报数据落地接口
* fedex
* 2022年4月14日17:55:55
*/
public class SendMawbBasf {
public static String url = "https://40.73.78.157:8780";
//C类申报数据落地接口
public static String path = "/basf/sendMawbBasf";
//时间戳
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\":\"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}]}";
String token = SHA256Util.getSHA256String(SendMawbBasf.appId + SendMawbBasf.appKey + SendMawbBasf.security + SendMawbBasf.timeStamp);
System.out.println(token);
//消息头
Header[] headers = HttpHeader.custom()
.other("Content-Type", "application/json")
.other("Appid", SendMawbBasf.appId)
.other("appKey", SendMawbBasf.appKey)
.other("TimeStamp", SendMawbBasf.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 = SendMawbBasf.url + SendMawbBasf.path;
//HTTP请求
HttpConfig config = HttpConfig.custom()
.headers(headers)
.url(url)
.encoding("utf-8")
.client(hcb.build())
.json(json);
System.out.println(HttpClientUtil.post(config));
}
}
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;
import java.util.Date;
/**
* D类申报的数据落地接口示例代码
* fedex
* 2022年4月14日16:34:18
*/
public class SendMawbTest {
public static String url = "https://40.73.78.157:8780";
//D类申报的数据落地接口
public static String sendMawb = "/customs/sendMawb";
//时间戳
public static String timeStamp = "1649839249891";
//APPID
public static String appId = "IDE";
//APPKEY
public static String appKey = "iClearExport";
//需要申请
public static String security = "b92131f03f19a348";
public static void main(String[] args) throws Exception{
sendMawb();
}
/**
* D类申报的数据落地接口
*/
public static void sendMawb() throws Exception{
//申报数据:billNo 提单号需要修改
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\"}]}";
String token = SHA256Util.getSHA256String(SendMawbTest.appId + SendMawbTest.appKey + SendMawbTest.security + SendMawbTest.timeStamp);
//消息头
Header[] headers = HttpHeader.custom()
.other("Content-Type", "application/json")
.other("Appid", SendMawbTest.appId)
.other("appKey", SendMawbTest.appKey)
.other("TimeStamp", SendMawbTest.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 = SendMawbTest.url + SendMawbTest.sendMawb;
//HTTP请求
HttpConfig config = HttpConfig.custom()
.headers(headers)
.url(url)
.encoding("utf-8")
.client(hcb.build())
.json(masbJson);
System.out.println(HttpClientUtil.post(config));
}
}