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
wei.zhou
2021-06-29 16:06:53 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
6c704c4c45bcb109451382cb3b6a3f85bf482f6b
6c704c4c
1 parent
6ad4ef6f
添加字段
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
80 additions
and
194 deletions
doc/建表语句.sql
doc/数据推送接口文档v4.docx
src/main/java/com/erry/iclear/dateInterface/api/CustomsDataInterface.java
src/main/java/com/erry/iclear/dateInterface/api/request/Mawb.java
src/main/java/com/erry/iclear/dateInterface/api/request/MawbDetail.java
src/main/java/com/erry/iclear/dateInterface/entity/ChmConsignmentDetail.java
src/main/java/com/erry/iclear/dateInterface/service/ChmConsignmentDetailService.java
src/main/java/com/erry/iclear/dateInterface/service/MawbDetailService.java
src/main/java/com/erry/iclear/dateInterface/service/MawbService.java
src/test/java/com/erry/iclear/dateInterface/ApiTest.java
src/test/java/com/erry/iclear/dateInterface/HttpClientTest.java
doc/建表语句.sql
View file @
6c704c4
...
...
@@ -50,6 +50,7 @@ CREATE TABLE T_ICLEAR_API_LOG(
CREATE
TABLE
T_ICLEAR_API_MAWB
(
ID
int
identity
(
1
,
1
)
primary
key
--PK
,
MSGID
int
,
APPID
VARCHAR
(
20
)
--用户ID
,
IEFlag
varchar
(
1
)
,
TYPE
VARCHAR
(
6
)
,
AGENTCODE
VARCHAR
(
18
)
...
...
@@ -104,6 +105,7 @@ CREATE TABLE T_ICLEAR_API_MAWBDETAIL(
ID
int
identity
(
1
,
1
)
primary
key
--PK
,
MSGID
int
,
MAWBID
int
,
DETAILID
VARCHAR
(
50
)
,
CLASSMARK
VARCHAR
(
1
)
,
CODETS
VARCHAR
(
10
)
,
DECLPRICE
NUMERIC
(
19
,
5
)
...
...
@@ -130,4 +132,21 @@ CREATE TABLE T_ICLEAR_API_MAWBDETAIL(
,
DESTCODE
VARCHAR
(
8
)
,
DISTRICTCODE
VARCHAR
(
5
)
)
\ No newline at end of file
)
---ALTER TABLE T_ICLEAR_API_MAWB ADD SOURCE_TYPE VARCHAR(10);
ALTER
TABLE
T_CHM_CONSIGNMENT_DETAIL
ADD
DETAILID
VARCHAR
(
50
);
...
...
doc/数据推送接口文档v4.docx
View file @
6c704c4
No preview for this file type
src/main/java/com/erry/iclear/dateInterface/api/CustomsDataInterface.java
View file @
6c704c4
...
...
@@ -57,7 +57,8 @@ public class CustomsDataInterface {
result
.
setMsg
(
"请求信息不能为空"
);
return
result
;
}
//0、保存请求信息,保存到iClear的 SQLServer
//1、保存请求信息,保存到iClear的 SQLServer
StopWatch
sw
=
new
StopWatch
(
"receice mawb"
);
sw
.
start
(
"save log"
);
...
...
@@ -67,6 +68,7 @@ public class CustomsDataInterface {
IClearApiLog
saveIClearApiLogResult
=
iClearApiLogService
.
saveIClearApiLog
(
iClearApiLogService
.
convertToIClearApiLog
(
mawb
,
appId
,
appKey
,
new
Date
(
Long
.
valueOf
(
timeStamp
))));
mawb
.
setAppId
(
appId
);
if
(!
Objects
.
equals
(
saveIClearApiLogResult
,
null
)){
log
.
info
(
"请求保存成功,msgId:"
+
saveIClearApiLogResult
.
getMsgId
());
mawb
.
setMsgId
(
saveIClearApiLogResult
.
getMsgId
());
...
...
@@ -85,37 +87,28 @@ public class CustomsDataInterface {
sw
.
stop
();
//1、校验用户名密码
// sw.start("checkAppSecret");
// result=this.checkAppSecret(request, result);
// sw.stop();
//2、TODO 校验主单
sw
.
start
(
"checkMawb"
);
if
(
result
.
getSuccess
()){
//result.setSuccess(mawbService.checkMawb(mawb));
result
=
mawbService
.
checkMawb
(
mawb
);
if
(!
result
.
getSuccess
()){
return
result
;
}
sw
.
stop
();
//3、TODO 校验子单
sw
.
start
(
"checkMawbDetail"
);
if
(
result
.
getSuccess
()){
result
=
mawbDetailServicel
.
checkMawbDetail
(
mawb
);
if
(!
result
.
getSuccess
()){
return
result
;
}
sw
.
stop
();
//4、保存运单到iclear中
sw
.
start
(
"processChmConsignment"
);
//if(result.getSuccess()){
//TODO 等待校验逻辑完善后,由result.getSuccess() 判断
if
(
true
){
result
=
chmConsignmentService
.
processChmConsignment
(
mawb
,
timeStamp
,
appId
);
if
(!
result
.
getSuccess
()){
return
result
;
}
result
=
chmConsignmentService
.
processChmConsignment
(
mawb
,
timeStamp
,
appId
);
if
(!
result
.
getSuccess
()){
return
result
;
}
sw
.
stop
();
...
...
src/main/java/com/erry/iclear/dateInterface/api/request/Mawb.java
View file @
6c704c4
...
...
@@ -32,6 +32,11 @@ public class Mawb implements Serializable {
@Column
(
name
=
"MSGID"
)
private
Long
msgId
;
@ApiModelProperty
(
value
=
"用户ID"
,
name
=
"AppId"
,
example
=
"IDE"
)
@Column
(
name
=
"APPID"
)
private
String
AppId
;
@ApiModelProperty
(
value
=
"进出口标志"
,
name
=
"IEFlag"
,
example
=
"固定值:E"
)
@Column
(
name
=
"IEFLAG"
)
private
String
IEFlag
;
...
...
src/main/java/com/erry/iclear/dateInterface/api/request/MawbDetail.java
View file @
6c704c4
...
...
@@ -31,6 +31,9 @@ public class MawbDetail implements Serializable {
@Column
(
name
=
"MAWBID"
)
private
Long
MAWBID
;
@Column
(
name
=
"DETAILID"
)
private
String
detailId
;
@ApiModelProperty
(
value
=
"商品编号"
,
example
=
"空值"
)
@Column
(
name
=
"CLASSMARK"
)
//JsonProperty("ClassMark")
...
...
src/main/java/com/erry/iclear/dateInterface/entity/ChmConsignmentDetail.java
View file @
6c704c4
...
...
@@ -233,6 +233,10 @@ public class ChmConsignmentDetail implements Serializable {
private
String
contentDescription
;
@Column
(
name
=
"DETAILID"
)
private
String
detailId
;
//------------------------------------------------------------------------------------
/**
* 备注
...
...
src/main/java/com/erry/iclear/dateInterface/service/ChmConsignmentDetailService.java
View file @
6c704c4
...
...
@@ -110,6 +110,7 @@ public class ChmConsignmentDetailService {
result
.
setDomesticDestinationMapping
(
domesticDestinationDictionaryEntries
);
result
.
setDomesticDestination
(
destinationCountryDictionaryEntries
.
getChineseName
());
result
.
setDetailId
(
mawbDetail
.
getDetailId
());
}
catch
(
Exception
e
){
log
.
error
(
"convertToChmConsignmentDetail() error:"
+
e
.
getMessage
());
...
...
src/main/java/com/erry/iclear/dateInterface/service/MawbDetailService.java
View file @
6c704c4
...
...
@@ -2,6 +2,7 @@ package com.erry.iclear.dateInterface.service;
import
com.erry.iclear.dateInterface.api.request.Mawb
;
import
com.erry.iclear.dateInterface.api.request.MawbDetail
;
import
com.erry.iclear.dateInterface.api.response.ResultRS
;
import
com.erry.iclear.dateInterface.repository.MawbDetailRepository
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -26,4 +27,20 @@ public class MawbDetailService {
}
public
ResultRS
checkMawbDetail
(
Mawb
mawb
){
ResultRS
result
=
new
ResultRS
(
Boolean
.
FALSE
,
null
,
null
);
try
{
result
.
setSuccess
(
Boolean
.
TRUE
);
}
catch
(
Exception
e
){
log
.
error
(
"checkMawbDetail() error:"
+
e
.
getMessage
());
}
return
result
;
}
}
...
...
src/main/java/com/erry/iclear/dateInterface/service/MawbService.java
View file @
6c704c4
package
com
.
erry
.
iclear
.
dateInterface
.
service
;
import
com.erry.iclear.dateInterface.api.request.Mawb
;
import
com.erry.iclear.dateInterface.api.response.ResultRS
;
import
com.erry.iclear.dateInterface.repository.MawbRepository
;
import
com.google.gson.Gson
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -42,24 +43,22 @@ public class MawbService {
* @param mawb
* @return
*/
public
Boolean
checkMawb
(
Mawb
mawb
){
public
ResultRS
checkMawb
(
Mawb
mawb
){
ResultRS
result
=
new
ResultRS
(
Boolean
.
FALSE
,
null
,
null
);
try
{
log
.
info
(
"checkMawb start>>>>>>>>>> mawb:"
+
gson
.
toJson
(
mawb
));
boolean
checkResult
=
Boolean
.
FALSE
;
//checkResult=
log
.
info
(
"checkMawb start>>>>>>>>>> mawb:"
+
gson
.
toJson
(
mawb
)
+
" result :"
+
checkResult
);
result
.
setSuccess
(
Boolean
.
TRUE
);
log
.
info
(
"checkMawb start>>>>>>>>>> mawb:"
+
gson
.
toJson
(
mawb
)
+
" result :"
+
result
.
getSuccess
()
);
return
checkResult
;
}
catch
(
Exception
e
){
log
.
error
(
"checkMawb() error:"
+
e
.
getMessage
());
}
return
Boolean
.
FALSE
;
return
result
;
}
}
...
...
src/test/java/com/erry/iclear/dateInterface/ApiTest.java
deleted
100644 → 0
View file @
6ad4ef6
package
com
.
erry
.
iclear
.
dateInterface
;
import
com.erry.iclear.dateInterface.api.request.Mawb
;
import
com.erry.iclear.dateInterface.api.request.MawbDetail
;
import
com.erry.iclear.dateInterface.api.response.ResultRS
;
import
com.google.gson.Gson
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
ApiTest
{
public
static
void
main
(
String
[]
args
)
{
//{"IEFlag":"E","type":"EX","agentCode":"1111980005","agentName":"联邦快递(中国)有限公司","billNo":"202105210784","contrNo":"NO.565733","customMaster":"0101","cutMode":"101","declTrnRel":"0","distinatePort":"ASM000","ediId":"001","entryId":"25512456","feeCurr":"USD","feeMark":"3","feeRate":100.58,"grossWet":500,"IEPort":"0101","inputerName":"","insurCurr":"MOP","insurMark":"3","insurRate":23.44,"manualNo":"备案号","netWt":80,"otherCurr":"USD","otherRate":10,"otherMark":"","ownerCode":"Z321654987","ownerName":"上海保险","packNo":1,"preEntryId":"","tradeCountry":"US","tradeMode":"110","tradeCode":"Z321654987","trafMode":"1","tradeName":"上海铢怡国际货物运输代理有限公司","transMode":"3","wrapType":"22","tradeCodeScc":"A74125896321456987","ownerCodeScc":"A74125896321456987","tradeAreaCode":"US","markNo":"N/M","entyPortCode":"310302","goodsPlace":"","declareName":"张安","overseasConsignorCode":"Z785421","overseasConsigneeCode":"Z785421","overseasConsigneeEname":"出口时必填收件人公司名(原)","mawbDetailList":[{"classMark":"","codeTS":"69125472","declPrice":111.123,"declTotal":788,"dutyMode":"1","exgNo":"","exgVersion":"","firstUnit":"035","firstQty":11,"gunit":"007","gmodel":"商品规格、型号","gname":"餐桌","gno":"1","gqty":1.88,"originCountry":"US","secondUnit":"007","secondQty":2,"tradeCurr":"USD","useTo":"","ciqCode":"","destinationCountry":"CN","declGoodsEname":"","destCode":"","districtCode":"4408W"},{"classMark":"","codeTS":"69125472","declPrice":45.72,"declTotal":33,"dutyMode":"1","exgNo":"","exgVersion":"","firstUnit":"035","firstQty":11,"gunit":"007","gmodel":"商品规格、型号","gname":"餐桌","gno":"2","gqty":22.88,"originCountry":"US","secondUnit":"007","secondQty":3,"tradeCurr":"USD","useTo":"","ciqCode":"","destinationCountry":"CN","declGoodsEname":"","destCode":"","districtCode":"4408W"}]}
MawbDetail
d1
=
new
MawbDetail
();
d1
.
setClassMark
(
""
);
d1
.
setCodeTS
(
"69125472"
);
d1
.
setDeclPrice
(
BigDecimal
.
valueOf
(
111.123
));
d1
.
setDeclTotal
(
BigDecimal
.
valueOf
(
788
));
d1
.
setDutyMode
(
"1"
);
d1
.
setExgNo
(
""
);
d1
.
setExgVersion
(
""
);
d1
.
setFirstUnit
(
"035"
);
d1
.
setFirstQty
(
11
);
d1
.
setGunit
(
"007"
);
d1
.
setGmodel
(
"商品规格、型号"
);
d1
.
setGname
(
"餐桌"
);
d1
.
setGno
(
"1"
);
d1
.
setGqty
(
BigDecimal
.
valueOf
(
1.88
));
d1
.
setOriginCountry
(
"US"
);
d1
.
setSecondUnit
(
"007"
);
d1
.
setSecondQty
(
2
);
d1
.
setTradeCurr
(
"USD"
);
d1
.
setUseTo
(
""
);
d1
.
setWorkUsd
(
null
);
d1
.
setDestinationCountry
(
"CN"
);
d1
.
setCiqCode
(
""
);
d1
.
setDeclGoodsEname
(
""
);
d1
.
setDestCode
(
""
);
d1
.
setDistrictCode
(
"4408W"
);
MawbDetail
d2
=
new
MawbDetail
();
d2
.
setClassMark
(
""
);
d2
.
setCodeTS
(
"69125472"
);
d2
.
setDeclPrice
(
BigDecimal
.
valueOf
(
45.72
));
d2
.
setDeclTotal
(
BigDecimal
.
valueOf
(
33
));
d2
.
setDutyMode
(
"1"
);
d2
.
setExgNo
(
""
);
d2
.
setExgVersion
(
""
);
d2
.
setFirstUnit
(
"035"
);
d2
.
setFirstQty
(
11
);
d2
.
setGunit
(
"007"
);
d2
.
setGmodel
(
"商品规格、型号"
);
d2
.
setGname
(
"餐桌"
);
d2
.
setGno
(
"2"
);
d2
.
setGqty
(
BigDecimal
.
valueOf
(
22.88
));
d2
.
setOriginCountry
(
"US"
);
d2
.
setSecondUnit
(
"007"
);
d2
.
setSecondQty
(
3
);
d2
.
setTradeCurr
(
"USD"
);
d2
.
setUseTo
(
""
);
d2
.
setWorkUsd
(
null
);
d2
.
setDestinationCountry
(
"CN"
);
d2
.
setCiqCode
(
""
);
d2
.
setDeclGoodsEname
(
""
);
d2
.
setDestCode
(
""
);
d2
.
setDistrictCode
(
"4408W"
);
List
<
MawbDetail
>
mawbDetailList
=
new
ArrayList
<
MawbDetail
>();
mawbDetailList
.
add
(
d1
);
mawbDetailList
.
add
(
d2
);
Mawb
mawb
=
new
Mawb
();
mawb
.
setIEFlag
(
"E"
);
mawb
.
setType
(
"EX"
);
mawb
.
setAgentCode
(
"1111980005"
);
mawb
.
setAgentName
(
"联邦快递(中国)有限公司"
);
mawb
.
setBillNo
(
"202105210784"
);
mawb
.
setContrNo
(
"NO.565733"
);
mawb
.
setCustomMaster
(
"0101"
);
mawb
.
setCutMode
(
"101"
);
mawb
.
setDeclTrnRel
(
"0"
);
mawb
.
setDistinatePort
(
"ASM000"
);
mawb
.
setEdiId
(
"001"
);
mawb
.
setEntryId
(
"25512456"
);
mawb
.
setFeeCurr
(
"USD"
);
mawb
.
setFeeMark
(
"3"
);
mawb
.
setFeeRate
(
BigDecimal
.
valueOf
(
100.58
));
mawb
.
setGrossWet
(
500
);
mawb
.
setIEPort
(
"0101"
);
mawb
.
setInputerName
(
""
);
mawb
.
setInsurCurr
(
"MOP"
);
mawb
.
setInsurMark
(
"3"
);
mawb
.
setInsurRate
(
BigDecimal
.
valueOf
(
23.44
));
mawb
.
setManualNo
(
"备案号"
);
mawb
.
setNetWt
(
BigDecimal
.
valueOf
(
80
));
mawb
.
setOtherCurr
(
"USD"
);
mawb
.
setOtherRate
(
BigDecimal
.
valueOf
(
10
));
mawb
.
setOtherMark
(
""
);
mawb
.
setOwnerCode
(
"Z321654987"
);
mawb
.
setOwnerName
(
"上海保险"
);
mawb
.
setPackNo
(
1
);
mawb
.
setPreEntryId
(
""
);
mawb
.
setTradeCountry
(
"US"
);
mawb
.
setTradeMode
(
"110"
);
mawb
.
setTradeCode
(
"Z321654987"
);
mawb
.
setTrafMode
(
"1"
);
mawb
.
setTradeName
(
"上海铢怡国际货物运输代理有限公司"
);
mawb
.
setTransMode
(
"3"
);
mawb
.
setWrapType
(
"22"
);
mawb
.
setTradeCodeScc
(
"A74125896321456987"
);
mawb
.
setOwnerCodeScc
(
"A74125896321456987"
);
mawb
.
setTradeAreaCode
(
"US"
);
mawb
.
setMarkNo
(
"N/M"
);
mawb
.
setEntyPortCode
(
"310302"
);
mawb
.
setGoodsPlace
(
""
);
mawb
.
setDeclareName
(
"张安"
);
mawb
.
setOverseasConsignorCode
(
"Z785421"
);
mawb
.
setOverseasConsigneeCode
(
"Z785421"
);
mawb
.
setOverseasConsigneeEname
(
"出口时必填收件人公司名(原)"
);
mawb
.
setMawbDetailList
(
mawbDetailList
);
// List list=(List<MawbDetail>) mawb.getMawbDetailList();
// list.forEach(d->{
// System.out.println(d.toString());
// });
ResultRS
rs
=
new
ResultRS
(
true
,
"200"
,
"操作成功"
);
Gson
gson
=
new
Gson
();
System
.
out
.
println
(
gson
.
toJson
(
mawb
));
System
.
out
.
println
(
gson
.
toJson
(
rs
));
}
}
src/test/java/com/erry/iclear/dateInterface/HttpClientTest.java
View file @
6c704c4
...
...
@@ -23,8 +23,8 @@ public class HttpClientTest {
// 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")));
//
String timeStamp = "1623920478192";
String
timeStamp
=
"1624263798669"
;
String
timeStamp
=
"1623920478192"
;
//
String timeStamp = "1624263798669";
System
.
out
.
println
(
new
Date
(
Long
.
valueOf
(
timeStamp
)));
String
token
=
SHA256Util
.
getSHA256String
(
"IDE"
+
"iClearExport"
+
"b92131f03f19a348"
+
timeStamp
);
System
.
out
.
println
(
token
);
...
...
@@ -43,7 +43,7 @@ public class HttpClientTest {
.
pool
(
100
,
10
)
.
sslpv
(
SSLs
.
SSLProtocolVersion
.
TLSv1_2
)
.
ssl
()
.
retry
(
5
);
.
retry
(
3
);
// String url = "https://40.73.78.157:8780/customs/sendMawb";
String
url
=
"https://192.168.1.75:8780/customs/sendMawb"
;
...
...
@@ -58,8 +58,8 @@ public class HttpClientTest {
public
static
Mawb
createMawb
()
{
MawbDetail
d1
=
new
MawbDetail
();
d1
.
setDetailId
(
"202105210784-1"
);
d1
.
setClassMark
(
""
);
d1
.
setCodeTS
(
"69125472"
);
d1
.
setDeclPrice
(
BigDecimal
.
valueOf
(
111.123
));
...
...
@@ -71,9 +71,9 @@ public class HttpClientTest {
d1
.
setFirstQty
(
11
);
d1
.
setGunit
(
"007"
);
d1
.
setGmodel
(
"商品规格、型号"
);
d1
.
setGname
(
"餐桌
2
"
);
d1
.
setGname
(
"餐桌"
);
d1
.
setGno
(
"1"
);
d1
.
setGqty
(
BigDecimal
.
valueOf
(
1
5
.88
));
d1
.
setGqty
(
BigDecimal
.
valueOf
(
1.88
));
d1
.
setOriginCountry
(
"US"
);
d1
.
setSecondUnit
(
"007"
);
d1
.
setSecondQty
(
2
);
...
...
@@ -88,6 +88,7 @@ public class HttpClientTest {
MawbDetail
d2
=
new
MawbDetail
();
d2
.
setDetailId
(
"202105210784-2"
);
d2
.
setClassMark
(
""
);
d2
.
setCodeTS
(
"69125472"
);
d2
.
setDeclPrice
(
BigDecimal
.
valueOf
(
45.72
));
...
...
@@ -99,9 +100,9 @@ public class HttpClientTest {
d2
.
setFirstQty
(
11
);
d2
.
setGunit
(
"007"
);
d2
.
setGmodel
(
"商品规格、型号"
);
d2
.
setGname
(
"餐桌
3
"
);
d2
.
setGname
(
"餐桌"
);
d2
.
setGno
(
"2"
);
d2
.
setGqty
(
BigDecimal
.
valueOf
(
4
2.88
));
d2
.
setGqty
(
BigDecimal
.
valueOf
(
2
2.88
));
d2
.
setOriginCountry
(
"US"
);
d2
.
setSecondUnit
(
"007"
);
d2
.
setSecondQty
(
3
);
...
...
@@ -115,11 +116,14 @@ public class HttpClientTest {
d2
.
setDistrictCode
(
"4408W"
);
List
<
MawbDetail
>
mawbDetailList
=
new
ArrayList
<
MawbDetail
>();
mawbDetailList
.
add
(
d1
);
mawbDetailList
.
add
(
d2
);
Mawb
mawb
=
new
Mawb
();
mawb
.
setIEFlag
(
"E"
);
mawb
.
setType
(
"EX"
);
...
...
Please
register
or
login
to post a comment