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-07-23 17:29:12 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
db4404c6fc5949838ece704f5c837efaada3fd2c
db4404c6
1 parent
1a71f3a5
代码优化
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
63 additions
and
100 deletions
src/main/java/com/erry/iclear/dateInterface/api/CustomsDataInterface.java
src/main/java/com/erry/iclear/dateInterface/service/ChmConsignmentDetailService.java
src/main/resources/application-dev.yml
src/main/resources/application-prod.yml
src/main/resources/application-test.yml
src/main/resources/application.yml
src/test/java/com/erry/iclear/dateInterface/HttpClientTest.java
src/main/java/com/erry/iclear/dateInterface/api/CustomsDataInterface.java
View file @
db4404c
...
...
@@ -134,65 +134,6 @@ public class CustomsDataInterface {
return
result
;
}
/**
* 校验用户
* @param request
* @param result
private ResultRS checkAppSecret(HttpServletRequest request, ResultRS result) {
String appId=(String) request.getHeader("Appid");
String appkey=(String) request.getHeader("Appkey");
String timeStamp=(String) request.getHeader("TimeStamp");
String token= (String) request.getHeader("token");
if(StringUtils.isBlank(appId)){
result.setCode("-1");
result.setMsg("Appid 不能为空");
return result;
}
if(StringUtils.isBlank(appkey)){
result.setCode("-2");
result.setMsg("Appkey 不能为空");
return result;
}
if(StringUtils.isBlank(timeStamp)){
result.setCode("-6");
result.setMsg("TimeStamp 不能为空");
return result;
}
if(StringUtils.isBlank(token)){
result.setCode("-4");
result.setMsg("token 不能为空");
return result;
}
HashMap<String,String> secretMap = Constant.appIdSecurityCache.get(appId);
if(secretMap==null){
result.setCode("-100");
result.setMsg("系统异常,该appId没有注册");
return result;
}
String secretInSys = secretMap.get(appkey);
if (StringUtils.isBlank(secretInSys)) {
result.setCode("-101");
result.setMsg("系统异常,该appId没有权限/密码");
return result;
}
String sha256Str = SHA256Util.getSHA256String(appId+appkey+secretInSys+timeStamp);
if(!token.equals(sha256Str)){
result.setCode("-4");
result.setMsg("Token验证失败");
return result;
}
result.setSuccess(true);
return result;
}
*/
}
...
...
src/main/java/com/erry/iclear/dateInterface/service/ChmConsignmentDetailService.java
View file @
db4404c
...
...
@@ -47,22 +47,31 @@ public class ChmConsignmentDetailService {
result
.
setAmount
(
mawbDetail
.
getDeclTotal
());
//征免方式
DictionaryEntries
levyTypeDictionaryEntries
=
Constant
.
dictionaryEntriesCache
.
get
(
Constant
.
LEVY_TYPE
+
mawbDetail
.
getDutyMode
());
result
.
setLevyTypeDic
(
levyTypeDictionaryEntries
);
result
.
setLevyType
(
levyTypeDictionaryEntries
.
getChineseName
());
if
(!
Objects
.
equals
(
levyTypeDictionaryEntries
,
null
)){
result
.
setLevyTypeDic
(
levyTypeDictionaryEntries
);
result
.
setLevyType
(
levyTypeDictionaryEntries
.
getChineseName
());
}
//货号
//版本号
//第一计量单位(法定单位)
DictionaryEntries
firstUnitDictionaryEntries
=
Constant
.
dictionaryEntriesCache
.
get
(
Constant
.
TRANSACTION_UNIT
+
mawbDetail
.
getFirstUnit
());
result
.
setUnitLegalFirstId
(
firstUnitDictionaryEntries
);
result
.
setUnitLegalFirst
(
firstUnitDictionaryEntries
.
getChineseName
());
if
(!
Objects
.
equals
(
firstUnitDictionaryEntries
,
null
)){
result
.
setUnitLegalFirstId
(
firstUnitDictionaryEntries
);
result
.
setUnitLegalFirst
(
firstUnitDictionaryEntries
.
getChineseName
());
}
//第一法定数量
result
.
setQtyLegalFirst
(
BigDecimal
.
valueOf
(
mawbDetail
.
getFirstQty
().
doubleValue
()));
//成交计量单位
//2021年7月8日 成交单位有修改,原取值第一法定计量单位,先取值成交单位。xjq
DictionaryEntries
knockdownUnitEntries
=
Constant
.
dictionaryEntriesCache
.
get
(
Constant
.
TRANSACTION_UNIT
+
mawbDetail
.
getGunit
());
result
.
setKnockdownUnitDic
(
knockdownUnitEntries
);
result
.
setKnockdownUnit
(
knockdownUnitEntries
.
getChineseName
());
if
(!
Objects
.
equals
(
knockdownUnitEntries
,
null
)){
result
.
setKnockdownUnitDic
(
knockdownUnitEntries
);
result
.
setKnockdownUnit
(
knockdownUnitEntries
.
getChineseName
());
}
//商品规格、型号
result
.
setModel
(
mawbDetail
.
getGmodel
());
//商品名称
...
...
@@ -72,26 +81,39 @@ public class ChmConsignmentDetailService {
result
.
setKnockdownNumber
(
BigDecimal
.
valueOf
(
mawbDetail
.
getGqty
().
doubleValue
()));
//原产国
DictionaryEntries
habitatDictonaryEntries
=
Constant
.
dictionaryEntriesCache
.
get
(
Constant
.
COUNTRY
+
mawbDetail
.
getOriginCountry
());
result
.
setHabitatDic
(
habitatDictonaryEntries
);
result
.
setHabitat
(
habitatDictonaryEntries
.
getChineseName
());
if
(!
Objects
.
equals
(
habitatDictonaryEntries
,
null
)){
result
.
setHabitatDic
(
habitatDictonaryEntries
);
result
.
setHabitat
(
habitatDictonaryEntries
.
getChineseName
());
}
//第二计量单位
DictionaryEntries
secondUnitDictionaryEntries
=
Constant
.
dictionaryEntriesCache
.
get
(
Constant
.
TRANSACTION_UNIT
+
mawbDetail
.
getSecondUnit
());
result
.
setUnitLegalSecondId
(
secondUnitDictionaryEntries
);
result
.
setUnitLegalSecond
(
secondUnitDictionaryEntries
.
getChineseName
());
if
(!
Objects
.
equals
(
secondUnitDictionaryEntries
,
null
)){
result
.
setUnitLegalSecondId
(
secondUnitDictionaryEntries
);
result
.
setUnitLegalSecond
(
secondUnitDictionaryEntries
.
getChineseName
());
}
//第二法定数量
result
.
setQtyLegalSecond
(
BigDecimal
.
valueOf
(
mawbDetail
.
getSecondQty
().
doubleValue
()));
//成交币制
DictionaryEntries
currencyDictionaryEntries
=
Constant
.
dictionaryEntriesCache
.
get
(
Constant
.
CURRENCY_SYSTEM
+
mawbDetail
.
getTradeCurr
());
result
.
setCurrencyDic
(
currencyDictionaryEntries
);
result
.
setCurrency
(
currencyDictionaryEntries
.
getChineseName
());
if
(!
Objects
.
equals
(
currencyDictionaryEntries
,
null
)){
result
.
setCurrencyDic
(
currencyDictionaryEntries
);
result
.
setCurrency
(
currencyDictionaryEntries
.
getChineseName
());
}
//用途/生产厂家
//工缴费
//最终目的国
DictionaryEntries
destinationCountryDictionaryEntries
=
Constant
.
dictionaryEntriesCache
.
get
(
Constant
.
COUNTRY
+
mawbDetail
.
getDestinationCountry
());
result
.
setDestinationCountryDic
(
destinationCountryDictionaryEntries
);
result
.
setDestinationCountry
(
destinationCountryDictionaryEntries
.
getChineseName
());
if
(!
Objects
.
equals
(
destinationCountryDictionaryEntries
,
null
)){
result
.
setDestinationCountryDic
(
destinationCountryDictionaryEntries
);
result
.
setDestinationCountry
(
destinationCountryDictionaryEntries
.
getChineseName
());
}
//检验检疫编码
...
...
@@ -101,15 +123,18 @@ public class ChmConsignmentDetailService {
if
(
StringUtils
.
isNotBlank
(
mawbDetail
.
getDestCode
())){
OrigplacecodeMapping
origplacecodeMapping
=
Constant
.
origplacecodeMappingCache
.
get
(
mawbDetail
.
getDestCode
());
result
.
setOrigplacecodeMapping
(
origplacecodeMapping
);
result
.
setOrigplacecode
(
origplacecodeMapping
.
getOrigplaceName
());
result
.
setOrigplacecode
(
Objects
.
equals
(
origplacecodeMapping
,
null
)?
""
:
origplacecodeMapping
.
getOrigplaceName
());
}
//境内目的地/境内货源地
DomesticDestinationMapping
domesticDestinationDictionaryEntries
=
Constant
.
domesticDestinationMappingCache
.
get
(
mawbDetail
.
getDistrictCode
());
result
.
setDomesticDestinationMapping
(
domesticDestinationDictionaryEntries
);
result
.
setDomesticDestination
(
destinationCountryDictionaryEntries
.
getChineseName
());
if
(!
Objects
.
equals
(
domesticDestinationDictionaryEntries
,
null
)){
result
.
setDomesticDestinationMapping
(
domesticDestinationDictionaryEntries
);
result
.
setDomesticDestination
(
Objects
.
equals
(
destinationCountryDictionaryEntries
,
null
)?
""
:
destinationCountryDictionaryEntries
.
getChineseName
());
}
result
.
setDetailId
(
mawbDetail
.
getDetailId
());
...
...
src/main/resources/application-dev.yml
View file @
db4404c
spring
:
jpa
:
database
:
sql_server
show-sql
:
true
hibernate
:
ddl-auto
:
none
naming
:
physical-strategy
:
org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
datasource
:
url
:
jdbc:sqlserver://40.73.78.157:1433;DatabaseName=IClearDev
username
:
sa
...
...
src/main/resources/application-prod.yml
View file @
db4404c
spring
:
jpa
:
database
:
sql_server
show-sql
:
true
hibernate
:
ddl-auto
:
none
naming
:
physical-strategy
:
org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
datasource
:
url
:
jdbc:sqlserver://yilansql.database.chinacloudapi.cn:1433;DatabaseName=IClear_Prod
username
:
sqladmin
...
...
src/main/resources/application-test.yml
View file @
db4404c
spring
:
jpa
:
database
:
sql_server
show-sql
:
true
hibernate
:
ddl-auto
:
none
naming
:
physical-strategy
:
org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
datasource
:
url
:
jdbc:sqlserver://40.73.78.157:1433;DatabaseName=IClearDemo
username
:
sa
...
...
src/main/resources/application.yml
View file @
db4404c
...
...
@@ -16,4 +16,14 @@ spring:
name
:
iClearExport.DataInterface
profiles
:
active
:
@
activatedProperties@
jpa
:
database
:
sql_server
show-sql
:
true
hibernate
:
ddl-auto
:
none
naming
:
physical-strategy
:
org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
properties
:
event
:
merge
:
entity_copy_observer
:
allow
...
...
src/test/java/com/erry/iclear/dateInterface/HttpClientTest.java
View file @
db4404c
...
...
@@ -23,7 +23,14 @@ 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
masbJson
=
"{\"ieFlag\":\"E\",\"type\":\"EX\",\"agentCode\":\"1111980005\",\"agentName\":\"联邦快递(中国)有限公司\",\"billNo\":\"07127275242_00062210\",\"contrNo\":\"FY2016\",\"customMaster\":\"2233\",\"cutMode\":\"101\",\"declTrnRel\":\"0\",\"distinatePort\":\"ASM000\",\"ediId\":\"001\",\"entryId\":\"25512456\",\"feeCurr\":\"EUR\",\"feeMark\":\"3\",\"feeRate\":3.65,\"grossWet\":4,\"iePort\":\"0101\",\"insurCurr\":\"MOP\",\"insurMark\":\"3\",\"insurRate\":0.02457,\"netWt\":3.857,\"ownerCode\":\"1234567890\",\"ownerName\":\"琥博信息科技有限公司\",\"packNo\":1,\"tradeCountry\":\"US\",\"tradeMode\":\"0110\",\"tradeCode\":\"1234567890\",\"trafMode\":\"5\",\"tradeName\":\"琥博信息科技有限公司\",\"transMode\":\"3\",\"wrapType\":\"22\",\"tradeCodeScc\":\"123456789012345678\",\"ownerCodeScc\":\"123456789012345678\",\"tradeAreaCode\":\"US\",\"entyPortCode\":\"310302\",\"goodsPlace\":\"\",\"declareName\":\"申报人员姓名_50\",\"overseasConsignorCode\":\"AEO Code 50位\",\"overseasConsigneeCode\":\"境外收货人编码_50位\",\"overseasConsigneeEname\":\"境外收货人名称(外文)_400\",\"mawbDetailList\":[{\"detailId\":\"12251\",\"classMark\":\"\",\"codeTS\":\"8538900000\",\"declPrice\":128,\"declTotal\":128,\"dutyMode\":\"1\",\"exgNo\":\"\",\"exgVersion\":\"\",\"firstUnit\":\"035\",\"firstQty\":0,\"gunit\":\"007\",\"gmodel\":\"用于PLC可编程控制器|琥博|6ES7153|无其他1\",\"gname\":\"PLC可编程控制器零件/接口模块\",\"gno\":\"1\",\"gqty\":1,\"originCountry\":\"US\",\"secondQty\":222,\"tradeCurr\":\"USD\",\"useTo\":\"03\",\"ciqCode\":\"001\",\"destinationCountry\":\"CNY\",\"destCode\":\"110102\",\"districtCode\":\"4408W\"},{\"detailId\":\"12252\",\"classMark\":\"\",\"codeTS\":\"8538900000\",\"declPrice\":94.47,\"declTotal\":188.94,\"dutyMode\":\"1\",\"exgNo\":\"\",\"exgVersion\":\"\",\"firstUnit\":\"035\",\"firstQty\":0,\"gunit\":\"007\",\"gmodel\":\"用于PLC可编程控制器|琥博|6ES7331|无其他2\",\"gname\":\"PLC可编程控制器零件/输入模块\",\"gno\":\"2\",\"gqty\":2,\"originCountry\":\"US\",\"secondQty\":222,\"tradeCurr\":\"USD\",\"useTo\":\"03\",\"ciqCode\":\"\",\"destinationCountry\":\"CHN\",\"destCode\":\"\",\"districtCode\":\"4408W\"},{\"detailId\":\"12601\",\"classMark\":\"\",\"codeTS\":\"8538900001\",\"declPrice\":94.47,\"declTotal\":188.94,\"dutyMode\":\"1\",\"exgNo\":\"\",\"exgVersion\":\"\",\"firstUnit\":\"035\",\"firstQty\":0,\"gunit\":\"007\",\"gmodel\":\"用于PLC可编程控制器|琥博|6ES7331|无其他3\",\"gname\":\"PLC可编程控制器零件/输入模块\",\"gno\":\"2\",\"gqty\":2,\"originCountry\":\"US\",\"secondQty\":222,\"tradeCurr\":\"USD\",\"useTo\":\"03\",\"ciqCode\":\"\",\"destinationCountry\":\"CHN\",\"destCode\":\"\",\"districtCode\":\"4408W\"}]}"
;
String
timeStamp
=
"1623971478192"
;
//String timeStamp = "1624263798669";
System
.
out
.
println
(
new
Date
(
Long
.
valueOf
(
timeStamp
)));
String
token
=
SHA256Util
.
getSHA256String
(
"IDE"
+
"iClearExport"
+
"b92131f03f19a348"
+
timeStamp
);
...
...
@@ -52,7 +59,8 @@ public class HttpClientTest {
.
url
(
url
)
.
encoding
(
"utf-8"
)
.
client
(
hcb
.
build
())
.
json
(
new
Gson
().
toJson
(
createMawb
()));
// .json(new Gson().toJson(createMawb()));
.
json
(
masbJson
);
System
.
out
.
println
(
HttpClientUtil
.
post
(
config
));
}
...
...
Please
register
or
login
to post a comment