Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Fedex
/
iClear-api
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Jiaqi.xu
2022-09-20 14:45:26 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c6a93db5fae24a5a7c3488910fef3197f5c09f41
c6a93db5
1 parent
092771b5
Merge branch 'master' of E:\iClear-api with conflicts.
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
158 additions
and
46 deletions
src/test/java/com/erry/iclear/dateInterface/HttpClientTest.java
src/test/java/com/erry/iclear/dateInterface/IClearApiApplicationTests.java
src/test/java/com/erry/iclear/dateInterface/IClearCheckTest.java
src/test/java/com/erry/iclear/dateInterface/TokenTest.java
src/test/java/com/erry/iclear/dateInterface/HttpClientTest.java
View file @
c6a93db
...
...
@@ -7,6 +7,8 @@ import com.arronlong.httpclientutil.common.HttpHeader;
import
com.arronlong.httpclientutil.common.HttpResult
;
import
com.arronlong.httpclientutil.common.SSLs
;
import
com.arronlong.httpclientutil.exception.HttpProcessException
;
import
com.erry.iclear.dateInterface.api.request.Basfc
;
import
com.erry.iclear.dateInterface.api.request.BasfcDetail
;
import
com.erry.iclear.dateInterface.api.request.Mawb
;
import
com.erry.iclear.dateInterface.api.request.MawbDetail
;
import
com.erry.iclear.dateInterface.util.SHA256Util
;
...
...
@@ -21,26 +23,26 @@ import java.util.*;
public
class
HttpClientTest
{
public
static
void
main
(
String
[]
args
)
throws
HttpProcessException
,
FileNotFoundException
{
// System.out.println(HttpClientUtil.get(HttpConfig.custom().url("https://40.73.78.157:8780/system/healthCheck")));
// System.out.println(HttpClientUtil.post(HttpConfig.custom().url("https://40.73.78.157:8780/customs/sendMawb")));
//System.out.println(HttpClientUtil.post(HttpConfig.custom().url("https://40.73.78.157:8780/customs/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\":\"11010\",\"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\"}]}";
String
basfJson
=
"{\"consignmentCode\":\"287598603852\",\"consignmentId\":221121505595,\"consType\":\"C\",\"sender\":\"巴斯夫(中国)有限公司\",\"shipperCustomsCode\":\"3122241734\",\"shipperSCC\":\"913100007109210071\",\"operateUnitName\":\"巴斯夫(中国)有限公司\",\"operateUnitCode\":\"3122241734\",\"operateSCC\":\"913100007109210071\",\"EANNo\":\"\",\"consignmentList\":[{\"consignmentDetailId\":83013414,\"skuCode\":\"3909500000\",\"skuName\":\"热塑性聚氨酯弹性体\",\"model\":\"品名:热塑性聚氨酯弹性体|品牌类型:0|出口享惠情况:0|外观[形状;透明度;颜色等]:热塑性聚氨酯99-100%|成分含量:多元醇70-90%,异氰酸酯0-20%,其他二元醇0-10%|单体单元的种类和比例:非塑料再生料|底料来源[再生料、瓶片料、新料、副牌料]:DEVELOPMENT|品牌[中文或外文名称]:ELASTOLLAN|型号:见合同|签约日期:制造聚氨酯塑料用|用途:|GTIN:|CAS:|其他[非必报要素,请根据实际情况填报]:|\",\"knockdownNumber\":40.0000,\"knockdownUnit\":\"035\",\"qtyLegalFirst\":40.0000,\"unitLegalFirst\":\"NULL\",\"qtyLegalSecond\":40.0000,\"unitLegalSecond\":\"NULL\",\"declaredAmount\":1200.0,\"currency\":\"USD\",\"declaredWeight\":40.0000}]}"
;
//String basfJson = "{\"consignmentCode\":\"796565081410\",\"consignmentId\":221112408858,\"consType\":\"C\",\"sender\":\"巴斯夫新材料有限公司\",\"shipperCustomsCode\":\"3122240631\",\"shipperSCC\":\"91310115607299125B\",\"operateUnitName\":\"巴斯夫新材料有限公司\",\"operateUnitCode\":\"3122240631\",\"operateSCC\":\"91310115607299125B\",\"EANNo\":\"\",\"consignmentList\":[{\"consignmentDetailId\":30787356,\"skuCode\":\"3402900090\",\"skuName\":\"表面活性剂制品 683 LT\",\"model\":\"1|0|表面活性剂,用于化工技术工业的原材料|非零售包装|异丙基苯磺酸钠5-15%,低聚D-吡喃葡糖C10-16-烷基苷25-50%,水40-60%|巴斯夫Glucopon|683 LT\",\"knockdownNumber\":0.5000,\"knockdownUnit\":\"035\",\"qtyLegalFirst\":0.5000,\"unitLegalFirst\":\"035\",\"qtyLegalSecond\":null,\"unitLegalSecond\":null,\"declaredAmount\":2.5,\"currency\":\"USD\",\"declaredWeight\":0.5000}]}";
//String basfJson = "{\"consignmentCode\":\"794650129680\",\"consignmentId\":220062201115,\"consType\":\"C\",\"sender\":\"巴斯夫植物保护(江苏)有限公司\",\"shipperCustomsCode\":\"3206946236\",\"shipperSCC\":\"913206230645013066\",\"operateUnitName\":\"巴斯夫植物保护(江苏)有限公司\",\"operateUnitCode\":\"3206946236\",\"operateSCC\":\"913206230645013066\",\"EANNo\":\"\",\"consignmentList\":[{\"consignmentDetailId\":50285469,\"skuCode\":\"2926909090\",\"skuName\":\"丙腈水溶液\",\"model\":\"0|0|||\",\"knockdownNumber\":2.0000,\"knockdownUnit\":\"035\",\"qtyLegalFirst\":2.0000,\"unitLegalFirst\":\"035\",\"qtyLegalSecond\":null,\"unitLegalSecond\":null,\"declaredAmount\":23.0000,\"currency\":\"USD\",\"declaredWeight\":2.0000}]}";
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\":\"11010\",\"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\"}]}"
;
String
timeStamp
=
"1623971478192"
;
String
timeStamp
=
"1638254683000"
;
//String timeStamp = "1624263798669";
System
.
out
.
println
(
new
Date
(
Long
.
valueOf
(
timeStamp
)));
String
token
=
SHA256Util
.
getSHA256String
(
"IDE"
+
"iClearExport"
+
"b92131f03f19a348"
+
timeStamp
);
//String token = SHA256Util.getSHA256String("IDE" + "iClearExport" + "b92131f03f19a348" + timeStamp);
String
token
=
SHA256Util
.
getSHA256String
(
"BASF"
+
"iClearExportC"
+
"6db193cb4165a71b"
+
timeStamp
);
System
.
out
.
println
(
token
);
Header
[]
headers
=
HttpHeader
.
custom
()
.
other
(
"Content-Type"
,
"application/json"
)
.
other
(
"Appid"
,
"IDE"
)
.
other
(
"appKey"
,
"iClearExport"
)
//.other("Appid", "IDE")
//.other("appKey", "iClearExport")
.
other
(
"Appid"
,
"BASF"
)
.
other
(
"appKey"
,
"iClearExportC"
)
.
other
(
"TimeStamp"
,
timeStamp
)
.
other
(
"token"
,
token
)
.
build
();
...
...
@@ -53,14 +55,15 @@ public class HttpClientTest {
.
retry
(
3
);
//String url = "https://40.73.78.157:8780/customs/sendMawb";
String
url
=
"https://127.0.0.1:8780/
customs/sendMawb
"
;
String
url
=
"https://127.0.0.1:8780/
basf/sendMawbBasf
"
;
HttpConfig
config
=
HttpConfig
.
custom
()
.
headers
(
headers
)
.
url
(
url
)
.
encoding
(
"utf-8"
)
.
client
(
hcb
.
build
())
// .json(new Gson().toJson(createMawb()));
.
json
(
masbJson
);
.
json
(
basfJson
);
System
.
out
.
println
(
"111111111111111111111111111111111111111111111"
);
System
.
out
.
println
(
HttpClientUtil
.
post
(
config
));
}
...
...
@@ -185,5 +188,38 @@ public class HttpClientTest {
return
mawb
;
}
private
Basfc
createNewBasf
(){
List
<
BasfcDetail
>
basfcDetailList
=
new
ArrayList
<>();
BasfcDetail
basfcDetail
=
new
BasfcDetail
();
basfcDetail
.
setConsignmentDetailId
(
123L
);
basfcDetail
.
setSkuCode
(
"29262000"
);
basfcDetail
.
setSkuName
(
"210908001测试"
);
basfcDetail
.
setModel
(
"0|0|1|1||||||||"
);
basfcDetail
.
setUnitLegalFirst
(
"035"
);
basfcDetail
.
setQtyLegalFirst
(
BigDecimal
.
valueOf
(
1
));
basfcDetail
.
setKnockdownUnit
(
"035"
);
basfcDetail
.
setKnockdownNumber
(
BigDecimal
.
valueOf
(
1
));
basfcDetail
.
setUnitLegalSecond
(
"007"
);
basfcDetail
.
setQtyLegalSecond
(
BigDecimal
.
valueOf
(
1
));
basfcDetail
.
setDeclaredAmount
(
BigDecimal
.
valueOf
(
1
));
basfcDetail
.
setCurrency
(
"USD"
);
basfcDetail
.
setDeclaredWeight
(
BigDecimal
.
valueOf
(
1
));
basfcDetailList
.
add
(
basfcDetail
);
Basfc
basfc
=
new
Basfc
();
basfc
.
setConsignmentCode
(
"210908003"
);
basfc
.
setConsignmentId
(
1L
);
basfc
.
setConsType
(
"C"
);
basfc
.
setSender
(
"天津知行博创科技有限公司"
);
basfc
.
setShipperCustomsCode
(
"11119608L9"
);
basfc
.
setShipperSCC
(
"123456789012345678"
);
basfc
.
setOperateUnitName
(
"天津丰铭佳业科贸有限公司"
);
basfc
.
setOperateUnitCode
(
""
);
basfc
.
setOperateSCC
(
""
);
basfc
.
setEanNo
(
"1"
);
basfc
.
setConsignmentList
(
basfcDetailList
);
return
basfc
;
}
}
...
...
src/test/java/com/erry/iclear/dateInterface/IClearApiApplicationTests.java
View file @
c6a93db
package
com
.
erry
.
iclear
.
dateInterface
;
import
com.alibaba.fastjson.JSONObject
;
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.arronlong.httpclientutil.exception.HttpProcessException
;
import
com.erry.iclear.dateInterface.api.request.ConsignmentCode
;
import
com.erry.iclear.dateInterface.util.SHA256Util
;
import
com.google.gson.Gson
;
import
org.apache.http.Header
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.boot.test.context.SpringBootTest
;
...
...
@@ -7,14 +19,74 @@ import org.springframework.test.context.ActiveProfiles;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.test.context.web.WebAppConfiguration
;
import
java.util.*
;
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
@WebAppConfiguration
@ActiveProfiles
(
"dev"
)
class
IClearApiApplicationTests
{
@Test
public
void
contextLoads
()
{
public
static
void
main
(
String
[]
args
)
throws
HttpProcessException
{
Gson
gson
=
new
Gson
();
String
str
=
"{\"consignmentCode\":\""
+
"201907105,"
+
"202018092,"
+
"202108026,"
+
"192770847591,"
+
"201907099,"
+
"202017062,"
+
"770194186721,"
+
"201907109,"
+
"201907092,"
+
"201907096,"
+
"201907103,"
+
"201907093,"
+
"774439601,"
+
"774439602,"
+
"201907097,"
+
"281382086345,"
+
"202108100,"
+
"192770847477,"
+
"192770847478,"
+
"149148215190\"}"
;
// String str = "{\"consignmentCode\":\"110000011\"}";
String
timeStamp
=
"1634697153697"
;
//String timeStamp = "1624263798669";
System
.
out
.
println
(
new
Date
(
Long
.
valueOf
(
timeStamp
)));
//String token = SHA256Util.getSHA256String("IDE" + "iClearExport" + "b92131f03f19a348" + timeStamp);
String
token
=
SHA256Util
.
getSHA256String
(
"BASF"
+
"iClearExportC"
+
"6db193cb4165a71b"
+
timeStamp
);
System
.
out
.
println
(
token
);
Header
[]
headers
=
HttpHeader
.
custom
()
.
other
(
"Content-Type"
,
"application/json"
)
.
other
(
"Appid"
,
"BASF"
)
.
other
(
"appKey"
,
"iClearExportC"
)
.
other
(
"TimeStamp"
,
timeStamp
)
.
other
(
"token"
,
"2D9F60B9ACE7A559CF1C21F34D543522F3520C7FF0F4A94FEC5A9700BC8589B8"
)
.
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
=
"https://40.73.78.157:8780/basf/selectDecListBasf"
;
//String url = "https://40.73.78.157:8780/basf/selectChmListBasf";
HttpConfig
config
=
HttpConfig
.
custom
()
.
headers
(
headers
)
.
url
(
url
)
.
encoding
(
"utf-8"
)
.
client
(
hcb
.
build
())
// .json(new Gson().toJson(createMawb()));
.
json
(
str
);
System
.
out
.
println
(
HttpClientUtil
.
post
(
config
));
}
}
...
...
src/test/java/com/erry/iclear/dateInterface/IClearCheckTest.java
View file @
c6a93db
package
com
.
erry
.
iclear
.
dateInterface
;
import
com.arronlong.httpclientutil.HttpClientUtil
;
import
com.arronlong.httpclientutil.common.HttpConfig
;
import
com.arronlong.httpclientutil.common.HttpHeader
;
import
com.erry.iclear.dateInterface.util.JsonToJava
;
import
org.apache.http.Header
;
public
class
IClearCheckTest
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
//调用IClear接口进行运单数据校验
String
objJson
=
"{\"chmConsignmentDetailList\":[{\"amount\":3365,\"chmConsignment\":{\"$ref\":\"$\"},\"contentDescription\":null,\"currency\":\"欧元\",\"currencyDic\":{\"chineseName\":\"欧元\",\"code\":\"currencySystem_EUR\",\"dictCode\":\"currencySystem\",\"ext2\":\"EUR\",\"ext3\":\"GBR\",\"ext6\":\"300\",\"id\":84605},\"destinationCountry\":\"德意志联邦共和国\",\"destinationCountryDic\":{\"chineseName\":\"德意志联邦共和国\",\"code\":\"Country_DE\",\"dictCode\":\"Country\",\"ext2\":\"DE\",\"ext3\":\"DEU\",\"ext6\":\"304\",\"id\":84415},\"detailId\":\"204\",\"domesticDestination\":null,\"domesticDestinationMapping\":null,\"habitat\":\"中华人民共和国\",\"habitatDic\":{\"chineseName\":\"中华人民共和国\",\"code\":\"Country_CN\",\"dictCode\":\"Country\",\"ext2\":\"CN\",\"ext3\":\"CHN\",\"ext6\":\"142\",\"id\":84355},\"id\":null,\"knockdownNumber\":1.0,\"knockdownUnit\":\"个\",\"knockdownUnitDic\":{\"chineseName\":\"个\",\"code\":\"transactionUnit_007\",\"dictCode\":\"transactionUnit\",\"ext2\":\"007\",\"ext3\":\"GBR\",\"ext6\":\"EA\",\"id\":84139},\"levyType\":\"照章征税\",\"levyTypeDic\":{\"chineseName\":\"照章征税\",\"code\":\"levyType_1\",\"dictCode\":\"levyType\",\"ext2\":\"1\",\"ext3\":\"GBR\",\"ext6\":null,\"id\":84515},\"model\":\"4|0|控制电机用|240KW|西门子/SIEMENS|6RA8081-6GV62-0AA0|||\",\"oriRegion\":3365,\"origplacecode\":\"\",\"origplacecodeMapping\":null,\"qtyLegalFirst\":1.0,\"qtyLegalSecond\":1.0,\"skuCode\":\"8504409999\",\"skuName\":\"变频调速装置\",\"unitLegalFirst\":\"千克\",\"unitLegalFirstId\":{\"chineseName\":\"千克\",\"code\":\"transactionUnit_035\",\"dictCode\":\"transactionUnit\",\"ext2\":\"035\",\"ext3\":\"GBR\",\"ext6\":\"KGS\",\"id\":84148},\"unitLegalSecond\":\"千克\",\"unitLegalSecondId\":{\"$ref\":\"$.chmConsignmentDetailList[0].unitLegalFirstId\"}}],\"consStatus\":\"待申报海关\",\"consStatusDic\":{\"chineseName\":\"待申报海关\",\"code\":\"transferWaybillStatus_5\",\"dictCode\":\"transferWaybillStatus\",\"ext2\":\"5\",\"ext3\":\"GBR\",\"ext6\":null,\"id\":84492},\"consType\":\"D\",\"consTypeId\":{\"chineseName\":\"D\",\"code\":\"consType_D\",\"dictCode\":\"consType\",\"ext2\":\"D\",\"ext3\":\"GBR\",\"ext6\":null,\"id\":84512},\"consignmentCode\":\"774426960555\",\"consignmentHeadCode\":null,\"contractCode\":\"3006622200\",\"counts\":1,\"createTime\":1628681350830,\"creator\":\"IDE-ICLEAR-API\",\"customsNo\":null,\"dealMode\":\"CIF、CIP、DDP、DDU、DAP\",\"dealModeDic\":{\"chineseName\":\"CIF、CIP、DDP、DDU、DAP\",\"code\":\"ClinchType_CIF\",\"dictCode\":\"ClinchType\",\"ext2\":\"CIF\",\"ext3\":\"GBR\",\"ext6\":\"1\",\"id\":83977},\"declaredDocType\":null,\"declaredDocTypeDic\":null,\"declaredPort\":null,\"declaredRemark\":null,\"declaredUnitName\":\"Jimmy shen\",\"enteringNo\":null,\"fromCountry\":\"美国\",\"fromCountryDic\":{\"chineseName\":\"美国\",\"code\":\"Country_US\",\"dictCode\":\"Country\",\"ext2\":\"US\",\"ext3\":\"USA\",\"ext6\":\"502\",\"id\":84653},\"grossWeight\":4.6,\"id\":null,\"insuranceCost\":0.74,\"insuranceCostCurrency\":\"欧元\",\"insuranceCostCurrencyDic\":{\"$ref\":\"$.chmConsignmentDetailList[0].currencyDic\"},\"netWeight\":32,\"operateUnitName\":\"西门子电气传动有限公司\",\"otherCost\":null,\"otherCurrency\":null,\"otherCurrencyDic\":null,\"overseasConsignorCode\":null,\"overseasConsignorFnCname\":\"PRYSMIAN KABEL UND SYSTEME GMBH\",\"ownerCode\":\"91120116600587482L\",\"ownerCodeScc\":\"91120116600587482L\",\"ownerName\":\"西门子电气传动有限公司\",\"packageType\":\"木制或竹藤等植物性材料制盒/箱\",\"packageTypeDic\":{\"chineseName\":\"木制或竹藤等植物性材料制盒/箱\",\"code\":\"NewPackageType_23\",\"dictCode\":\"NewPackageType\",\"ext2\":\"23\",\"ext3\":\"GBR\",\"ext6\":null,\"id\":83934},\"portId\":{\"chineseName\":\"TSN\",\"code\":\"port_tsn\",\"dictCode\":\"port\",\"ext2\":null,\"ext3\":null,\"ext6\":null,\"id\":125028},\"portName\":\"TSN\",\"recordCode\":null,\"taxNature\":\"中外合资\",\"taxNatureDic\":{\"chineseName\":\"中外合资\",\"code\":\"natureExemption_601\",\"dictCode\":\"natureExemption\",\"ext2\":\"601\",\"ext3\":\"GBR\",\"ext6\":null,\"id\":84122},\"throughStopPort\":\"304\",\"throughStopPortDic\":{\"createName\":\"ADMIN\",\"createTime\":\"\",\"id\":5457,\"pcCode\":\"DEU000\",\"portEngName\":\"Germany\",\"portName\":\"德国\",\"portNo\":\"304\"},\"tradeAreaCode\":\"德意志联邦共和国\",\"tradeAreaCodeDic\":{\"$ref\":\"$.chmConsignmentDetailList[0].destinationCountryDic\"},\"tradeCoSCC\":\"91120116600587482L\",\"tradeMode\":\"一般贸易\",\"tradeModeDic\":{\"chineseName\":\"一般贸易\",\"code\":\"supervisionMode_110\",\"dictCode\":\"supervisionMode\",\"ext2\":\"0110\",\"ext3\":\"GBR\",\"ext6\":null,\"id\":84000},\"transCost\":110.9,\"transCurrency\":\"欧元\",\"transCurrencyDic\":{\"$ref\":\"$.chmConsignmentDetailList[0].currencyDic\"},\"updateTime\":null,\"vehicleWay\":{\"chineseName\":\"航空运输\",\"code\":\"VehicleWayCode_5\",\"dictCode\":\"VehicleWayCode\",\"ext2\":\"5\",\"ext3\":\"GBR\",\"ext6\":null,\"id\":83986},\"vehicleWayCode\":\"VehicleWayCode_5\"}"
;
String
url
=
"http://40.73.78.157:8081/chmConsignmentController/checkChmAndDetaliD"
;
Header
[]
headers
=
HttpHeader
.
custom
()
.
other
(
"Content-Type"
,
"application/json"
)
.
build
();
//推送海关回执数据
HttpConfig
config
=
HttpConfig
.
custom
()
.
headers
(
headers
)
.
url
(
url
)
.
encoding
(
"utf-8"
)
.
json
(
objJson
);
String
json
=
HttpClientUtil
.
post
(
config
);
System
.
out
.
println
(
json
);
}
}
//
package com.erry.iclear.dateInterface;
//
//
import com.arronlong.httpclientutil.HttpClientUtil;
//
import com.arronlong.httpclientutil.common.HttpConfig;
//
import com.arronlong.httpclientutil.common.HttpHeader;
//
import com.erry.iclear.dateInterface.util.JsonToJava;
//
import org.apache.http.Header;
//
//
public class IClearCheckTest {
//
public static void main(String[] args) throws Exception{
//
//调用IClear接口进行运单数据校验
//
String objJson = "{\"chmConsignmentDetailList\":[{\"amount\":3365,\"chmConsignment\":{\"$ref\":\"$\"},\"contentDescription\":null,\"currency\":\"欧元\",\"currencyDic\":{\"chineseName\":\"欧元\",\"code\":\"currencySystem_EUR\",\"dictCode\":\"currencySystem\",\"ext2\":\"EUR\",\"ext3\":\"GBR\",\"ext6\":\"300\",\"id\":84605},\"destinationCountry\":\"德意志联邦共和国\",\"destinationCountryDic\":{\"chineseName\":\"德意志联邦共和国\",\"code\":\"Country_DE\",\"dictCode\":\"Country\",\"ext2\":\"DE\",\"ext3\":\"DEU\",\"ext6\":\"304\",\"id\":84415},\"detailId\":\"204\",\"domesticDestination\":null,\"domesticDestinationMapping\":null,\"habitat\":\"中华人民共和国\",\"habitatDic\":{\"chineseName\":\"中华人民共和国\",\"code\":\"Country_CN\",\"dictCode\":\"Country\",\"ext2\":\"CN\",\"ext3\":\"CHN\",\"ext6\":\"142\",\"id\":84355},\"id\":null,\"knockdownNumber\":1.0,\"knockdownUnit\":\"个\",\"knockdownUnitDic\":{\"chineseName\":\"个\",\"code\":\"transactionUnit_007\",\"dictCode\":\"transactionUnit\",\"ext2\":\"007\",\"ext3\":\"GBR\",\"ext6\":\"EA\",\"id\":84139},\"levyType\":\"照章征税\",\"levyTypeDic\":{\"chineseName\":\"照章征税\",\"code\":\"levyType_1\",\"dictCode\":\"levyType\",\"ext2\":\"1\",\"ext3\":\"GBR\",\"ext6\":null,\"id\":84515},\"model\":\"4|0|控制电机用|240KW|西门子/SIEMENS|6RA8081-6GV62-0AA0|||\",\"oriRegion\":3365,\"origplacecode\":\"\",\"origplacecodeMapping\":null,\"qtyLegalFirst\":1.0,\"qtyLegalSecond\":1.0,\"skuCode\":\"8504409999\",\"skuName\":\"变频调速装置\",\"unitLegalFirst\":\"千克\",\"unitLegalFirstId\":{\"chineseName\":\"千克\",\"code\":\"transactionUnit_035\",\"dictCode\":\"transactionUnit\",\"ext2\":\"035\",\"ext3\":\"GBR\",\"ext6\":\"KGS\",\"id\":84148},\"unitLegalSecond\":\"千克\",\"unitLegalSecondId\":{\"$ref\":\"$.chmConsignmentDetailList[0].unitLegalFirstId\"}}],\"consStatus\":\"待申报海关\",\"consStatusDic\":{\"chineseName\":\"待申报海关\",\"code\":\"transferWaybillStatus_5\",\"dictCode\":\"transferWaybillStatus\",\"ext2\":\"5\",\"ext3\":\"GBR\",\"ext6\":null,\"id\":84492},\"consType\":\"D\",\"consTypeId\":{\"chineseName\":\"D\",\"code\":\"consType_D\",\"dictCode\":\"consType\",\"ext2\":\"D\",\"ext3\":\"GBR\",\"ext6\":null,\"id\":84512},\"consignmentCode\":\"774426960555\",\"consignmentHeadCode\":null,\"contractCode\":\"3006622200\",\"counts\":1,\"createTime\":1628681350830,\"creator\":\"IDE-ICLEAR-API\",\"customsNo\":null,\"dealMode\":\"CIF、CIP、DDP、DDU、DAP\",\"dealModeDic\":{\"chineseName\":\"CIF、CIP、DDP、DDU、DAP\",\"code\":\"ClinchType_CIF\",\"dictCode\":\"ClinchType\",\"ext2\":\"CIF\",\"ext3\":\"GBR\",\"ext6\":\"1\",\"id\":83977},\"declaredDocType\":null,\"declaredDocTypeDic\":null,\"declaredPort\":null,\"declaredRemark\":null,\"declaredUnitName\":\"Jimmy shen\",\"enteringNo\":null,\"fromCountry\":\"美国\",\"fromCountryDic\":{\"chineseName\":\"美国\",\"code\":\"Country_US\",\"dictCode\":\"Country\",\"ext2\":\"US\",\"ext3\":\"USA\",\"ext6\":\"502\",\"id\":84653},\"grossWeight\":4.6,\"id\":null,\"insuranceCost\":0.74,\"insuranceCostCurrency\":\"欧元\",\"insuranceCostCurrencyDic\":{\"$ref\":\"$.chmConsignmentDetailList[0].currencyDic\"},\"netWeight\":32,\"operateUnitName\":\"西门子电气传动有限公司\",\"otherCost\":null,\"otherCurrency\":null,\"otherCurrencyDic\":null,\"overseasConsignorCode\":null,\"overseasConsignorFnCname\":\"PRYSMIAN KABEL UND SYSTEME GMBH\",\"ownerCode\":\"91120116600587482L\",\"ownerCodeScc\":\"91120116600587482L\",\"ownerName\":\"西门子电气传动有限公司\",\"packageType\":\"木制或竹藤等植物性材料制盒/箱\",\"packageTypeDic\":{\"chineseName\":\"木制或竹藤等植物性材料制盒/箱\",\"code\":\"NewPackageType_23\",\"dictCode\":\"NewPackageType\",\"ext2\":\"23\",\"ext3\":\"GBR\",\"ext6\":null,\"id\":83934},\"portId\":{\"chineseName\":\"TSN\",\"code\":\"port_tsn\",\"dictCode\":\"port\",\"ext2\":null,\"ext3\":null,\"ext6\":null,\"id\":125028},\"portName\":\"TSN\",\"recordCode\":null,\"taxNature\":\"中外合资\",\"taxNatureDic\":{\"chineseName\":\"中外合资\",\"code\":\"natureExemption_601\",\"dictCode\":\"natureExemption\",\"ext2\":\"601\",\"ext3\":\"GBR\",\"ext6\":null,\"id\":84122},\"throughStopPort\":\"304\",\"throughStopPortDic\":{\"createName\":\"ADMIN\",\"createTime\":\"\",\"id\":5457,\"pcCode\":\"DEU000\",\"portEngName\":\"Germany\",\"portName\":\"德国\",\"portNo\":\"304\"},\"tradeAreaCode\":\"德意志联邦共和国\",\"tradeAreaCodeDic\":{\"$ref\":\"$.chmConsignmentDetailList[0].destinationCountryDic\"},\"tradeCoSCC\":\"91120116600587482L\",\"tradeMode\":\"一般贸易\",\"tradeModeDic\":{\"chineseName\":\"一般贸易\",\"code\":\"supervisionMode_110\",\"dictCode\":\"supervisionMode\",\"ext2\":\"0110\",\"ext3\":\"GBR\",\"ext6\":null,\"id\":84000},\"transCost\":110.9,\"transCurrency\":\"欧元\",\"transCurrencyDic\":{\"$ref\":\"$.chmConsignmentDetailList[0].currencyDic\"},\"updateTime\":null,\"vehicleWay\":{\"chineseName\":\"航空运输\",\"code\":\"VehicleWayCode_5\",\"dictCode\":\"VehicleWayCode\",\"ext2\":\"5\",\"ext3\":\"GBR\",\"ext6\":null,\"id\":83986},\"vehicleWayCode\":\"VehicleWayCode_5\"}";
//
//
String url = "http://40.73.78.157:8081/chmConsignmentController/checkChmAndDetaliD";
//
//
Header[] headers = HttpHeader.custom()
//
.other("Content-Type", "application/json")
//
.build();
//
//推送海关回执数据
//
HttpConfig config = HttpConfig.custom()
//
.headers(headers)
//
.url(url)
//
.encoding("utf-8")
//
.json(objJson);
//
String json = HttpClientUtil.post(config);
//
System.out.println(json);
//
}
//
}
...
...
src/test/java/com/erry/iclear/dateInterface/TokenTest.java
View file @
c6a93db
...
...
@@ -7,6 +7,8 @@ import com.erry.iclear.dateInterface.util.HttpUtils;
import
com.erry.iclear.dateInterface.util.JsonToJava
;
import
org.junit.Test
;
import
org.springframework.beans.factory.annotation.Value
;
import
java.text.SimpleDateFormat
;
import
java.util.HashMap
;
import
java.util.Map
;
...
...
@@ -50,7 +52,7 @@ public class TokenTest extends IClearApiApplicationTests {
System
.
out
.
println
(
rs
);
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
/*
public static void main(String[] args) throws Exception{
String url = "https://apictm.iclrccd-fedex.com/login";
Map<String,String> map = new HashMap<String,String>();
map.put("username", "iclear_export_prod");
...
...
@@ -66,7 +68,9 @@ public class TokenTest extends IClearApiApplicationTests {
map.put("token","eyJhbGciOiJSUzI1NiJ9.eyJleHBpcmVBdCI6MTY0Njg4MDc3NzY0NSwidXNlcklkIjoiaWNsZWFyX2V4cG9ydF9wcm9kIn0.fey8YVWL0wcxvCUMQR-ePyCXIh9AdoztIixtcYgGjtaUCxO3VVf9Jmut3ZVVelxigvTDzv-Iz097R2fgBSOBzStICTZGqxmRV7Av6R41HCTTQ8BL6aSPle2QszSkTt5T95cYiFYSv9CHmxSKBU_MrJk5WhCJb5XOAmWmdV94McFWTBi1oTIjVfgiczu0pzgA1berR1lfUIEDVEUxUoduVARzwUcDDljq0pf-rPhpAj-Iqbhc4fint4Th-BlO6Rg4ZWYB08-3Id9krl92TMJJ_rXMrhbna6833r8PcpdbXIFPkuopbrv9GL1Ds_vWL7Sd5BTSYtMRn2ku0GhAP6GNPg");
String rs = httpUtils.doPost(url,map);
System.out.println(rs);
}
}
*/
private
static
HttpUtils
httpUtils
=
new
HttpUtils
();
}
...
...
Please
register
or
login
to post a comment