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
tao.mo
2023-02-28 14:30:09 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
73050ac52c64af57c3971bbbd9d17e4d22bfe1a6
73050ac5
1 parent
7050c19c
C类校验接口,指定appid运单号可以为空不进行校验
mt 2023年2月28日14:30:00
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
58 additions
and
35 deletions
sql/C类运单号校验/C类运单号校验.sql
src/main/java/com/erry/iclear/dateInterface/api/FedexDataInterface.java
src/main/java/com/erry/iclear/dateInterface/common/Constant.java
src/main/java/com/erry/iclear/dateInterface/entity/AppInfo.java
src/main/java/com/erry/iclear/dateInterface/entity/ChmConsignment.java
src/main/java/com/erry/iclear/dateInterface/service/AppInfoService.java
src/main/java/com/erry/iclear/dateInterface/service/ChmConsignmentService.java
src/main/java/com/erry/iclear/dateInterface/service/FedexService.java
src/test/java/com/erry/iclear/dateInterface/ChmConsignmentServiceTest.java
sql/C类运单号校验/C类运单号校验.sql
0 → 100644
View file @
73050ac
ALTER
TABLE
T_ICLEAR_API_APPINFO
ADD
C_CODE_CHECK
VARCHAR
(
1
)
EXEC
sys
.
sp_addextendedproperty
@
name
=
N
'MS_Description'
,
@
value
=
N
'C类校验是否校验运单号'
,
@
level0type
=
N
'SCHEMA'
,
@
level0name
=
N
'dbo'
,
@
level1type
=
N
'TABLE'
,
@
level1name
=
N
'T_ICLEAR_API_APPINFO'
,
@
level2type
=
N
'COLUMN'
,
@
level2name
=
N
'C_CODE_CHECK'
GO
\ No newline at end of file
src/main/java/com/erry/iclear/dateInterface/api/FedexDataInterface.java
View file @
73050ac
...
...
@@ -9,10 +9,8 @@ import com.erry.iclear.dateInterface.api.request.*;
import
com.erry.iclear.dateInterface.api.response.FedexResultChmRS
;
import
com.erry.iclear.dateInterface.api.response.FedexResultRS
;
import
com.erry.iclear.dateInterface.api.response.ResultRS
;
import
com.erry.iclear.dateInterface.entity.ChmConsignment
;
import
com.erry.iclear.dateInterface.entity.DeclaredInfo
;
import
com.erry.iclear.dateInterface.entity.IClearApiLog
;
import
com.erry.iclear.dateInterface.entity.TIClearApiCheckLog
;
import
com.erry.iclear.dateInterface.common.Constant
;
import
com.erry.iclear.dateInterface.entity.*
;
import
com.erry.iclear.dateInterface.repository.ChmConsignmentRepository
;
import
com.erry.iclear.dateInterface.repository.IClearApiCheckLogRepository
;
import
com.erry.iclear.dateInterface.service.*
;
...
...
@@ -77,6 +75,8 @@ public class FedexDataInterface {
String
token
=(
String
)
request
.
getHeader
(
"Token"
);
String
addr
=
request
.
getRemoteAddr
();
//获取APPINFO信息
AppInfo
appInfo
=
Constant
.
appInfoCache
.
get
(
appId
+
appKey
);
TIClearApiCheckLog
tIclearApiCheckLog
=
new
TIClearApiCheckLog
();
tIclearApiCheckLog
.
setRequestAppid
(
appId
);
...
...
@@ -96,7 +96,7 @@ public class FedexDataInterface {
log
.
info
(
"checkBASFMawbFedex:"
+
fedexc
.
toString
());
log
.
info
(
"appId:{},appKey:{},timeStamp:{},token:{}"
,
appId
,
appKey
,
timeStamp
,
token
);
ResultRS
result
=
fedexService
.
checkBasfInterfaceData
(
fedexc
);
ResultRS
result
=
fedexService
.
checkBasfInterfaceData
(
fedexc
,
appInfo
);
StopWatch
sw
=
new
StopWatch
(
"checkBASFMawbFedex"
);
sw
.
start
(
"generate FedexMawb"
);
...
...
@@ -106,7 +106,7 @@ public class FedexDataInterface {
sw
.
start
(
"checkFedexMawb"
);
String
msg
=
result
.
getMsg
();
String
iclearCheckMsg
=
fedexService
.
checkFedexMawb
(
saveMawbFedexResult
).
getMsg
();
String
iclearCheckMsg
=
fedexService
.
checkFedexMawb
(
saveMawbFedexResult
,
appInfo
).
getMsg
();
if
(
StringUtil
.
isEmpty
(
msg
)
&&
StringUtil
.
isEmpty
(
iclearCheckMsg
)){
result
.
setSuccess
(
Boolean
.
TRUE
);
}
else
{
...
...
@@ -144,7 +144,6 @@ public class FedexDataInterface {
return
result
;
}
//1、保存请求信息,保存到iClear的 SQLServer
StopWatch
sw
=
new
StopWatch
(
"receice mawbFedex"
);
sw
.
start
(
"save log"
);
...
...
@@ -175,7 +174,7 @@ public class FedexDataInterface {
//2、TODO 校验主单
sw
.
start
(
"checkFedexMawb"
);
result
=
fedexService
.
checkFedexMawb
(
saveMawbFedexResult
);
result
=
fedexService
.
checkFedexMawb
(
saveMawbFedexResult
,
null
);
if
(!
result
.
getSuccess
()){
return
result
;
}
...
...
src/main/java/com/erry/iclear/dateInterface/common/Constant.java
View file @
73050ac
package
com
.
erry
.
iclear
.
dateInterface
.
common
;
import
com.erry.iclear.dateInterface.entity.ChmCarryPort
;
import
com.erry.iclear.dateInterface.entity.DictionaryEntries
;
import
com.erry.iclear.dateInterface.entity.DomesticDestinationMapping
;
import
com.erry.iclear.dateInterface.entity.OrigplacecodeMapping
;
import
com.erry.iclear.dateInterface.entity.*
;
import
org.springframework.stereotype.Component
;
import
java.util.HashMap
;
...
...
@@ -21,6 +18,11 @@ public class Constant {
public
static
Map
<
String
,
HashMap
<
String
,
String
>>
appIdSecurityCache
=
new
HashMap
<>();
/**
* APP INFO信息
*/
public
static
Map
<
String
,
AppInfo
>
appInfoCache
=
new
HashMap
<>();
/**
* 字典表 code:entity
*/
public
static
Map
<
String
,
DictionaryEntries
>
dictionaryEntriesCache
=
new
HashMap
<>();
...
...
src/main/java/com/erry/iclear/dateInterface/entity/AppInfo.java
View file @
73050ac
...
...
@@ -34,5 +34,9 @@ public class AppInfo implements Serializable {
@Column
(
name
=
"IS_ENABLE"
)
private
String
isEnable
;
/**
* C类校验是否校验运单号,非空则不校验
*/
@Column
(
name
=
"C_CODE_CHECK"
)
private
String
codeCheck
;
}
...
...
src/main/java/com/erry/iclear/dateInterface/entity/ChmConsignment.java
View file @
73050ac
...
...
@@ -416,6 +416,11 @@ public class ChmConsignment implements Serializable {
@OneToMany
(
mappedBy
=
"chmConsignment"
,
cascade
=
CascadeType
.
ALL
)
private
List
<
ChmConsignmentDetail
>
chmConsignmentDetailList
;
/**
* C类校验是否校验运单号,非空则不校验
*/
@Transient
private
String
codeCheck
;
@Override
public
String
toString
()
{
...
...
src/main/java/com/erry/iclear/dateInterface/service/AppInfoService.java
View file @
73050ac
...
...
@@ -43,6 +43,7 @@ public class AppInfoService {
HashMap
<
String
,
String
>
appkeyMap
=
new
HashMap
<
String
,
String
>();
appkeyMap
.
put
(
appInfo
.
getAppKey
(),
appInfo
.
getSecurity
());
Constant
.
appIdSecurityCache
.
put
(
appInfo
.
getAppId
(),
appkeyMap
);
Constant
.
appInfoCache
.
put
(
appInfo
.
getAppId
()+
appInfo
.
getAppKey
(),
appInfo
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
"initAppInfo() error"
+
e
.
getMessage
());
...
...
src/main/java/com/erry/iclear/dateInterface/service/ChmConsignmentService.java
View file @
73050ac
...
...
@@ -241,7 +241,7 @@ public class ChmConsignmentService {
return
result
;
}
public
ChmConsignment
convertToChmConsignmentFedex
(
FedexMawb
mawb
,
Date
pushTime
,
String
creator
){
public
ChmConsignment
convertToChmConsignmentFedex
(
FedexMawb
mawb
,
Date
pushTime
,
String
creator
,
AppInfo
appInfo
){
ChmConsignment
result
=
new
ChmConsignment
();
try
{
//运单号
...
...
@@ -258,6 +258,11 @@ public class ChmConsignmentService {
result.setTradeModeDic(tradeModeDictionaryEntries);
result.setTradeMode(tradeModeDictionaryEntries.getChineseName());
}*/
if
(
appInfo
!=
null
){
//C类校验是否校验运单号,非空则不校验
result
.
setCodeCheck
(
appInfo
.
getCodeCheck
());
}
//境内收发货人社会信用证代码
result
.
setTradeCoSCC
(
mawb
.
getTradeCodeScc
());
//境内发货人(经营单位编码)
...
...
@@ -577,7 +582,7 @@ public class ChmConsignmentService {
ResultRS
result
=
new
ResultRS
(
Boolean
.
FALSE
,
null
,
null
);
try
{
Date
pushTime
=
DateUtils
.
timeStampToDate
(
Long
.
valueOf
(
timeStamp
));
ChmConsignment
chmConsignment
=
this
.
convertToChmConsignmentFedex
(
fedexMawb
,
pushTime
,
creator
);
ChmConsignment
chmConsignment
=
this
.
convertToChmConsignmentFedex
(
fedexMawb
,
pushTime
,
creator
,
null
);
if
(
Objects
.
equals
(
chmConsignment
,
null
)){
result
.
setCode
(
"30001"
);
result
.
setMsg
(
"数据格式不正确"
);
...
...
src/main/java/com/erry/iclear/dateInterface/service/FedexService.java
View file @
73050ac
...
...
@@ -7,6 +7,7 @@ import com.arronlong.httpclientutil.common.HttpHeader;
import
com.erry.iclear.dateInterface.api.request.*
;
import
com.erry.iclear.dateInterface.api.response.IClearCheckResponseResult
;
import
com.erry.iclear.dateInterface.api.response.ResultRS
;
import
com.erry.iclear.dateInterface.entity.AppInfo
;
import
com.erry.iclear.dateInterface.entity.ChmConsignment
;
import
com.erry.iclear.dateInterface.entity.ChmConsignmentDetail
;
import
com.erry.iclear.dateInterface.repository.FedexMawbRepository
;
...
...
@@ -126,13 +127,13 @@ public class FedexService {
* @param fedexMawb
* @return
*/
public
ResultRS
checkFedexMawb
(
FedexMawb
fedexMawb
){
public
ResultRS
checkFedexMawb
(
FedexMawb
fedexMawb
,
AppInfo
appInfo
){
ResultRS
result
=
new
ResultRS
(
Boolean
.
FALSE
,
null
,
null
);
try
{
log
.
info
(
"checkMawb start>>>>>>>>>> mawb:"
+
gson
.
toJson
(
fedexMawb
));
//1、将请求转换为运单
ChmConsignment
chmConsignment
=
consignmentService
.
convertToChmConsignmentFedex
(
fedexMawb
,
null
,
"IDE-ICLEAR-API"
);
ChmConsignment
chmConsignment
=
consignmentService
.
convertToChmConsignmentFedex
(
fedexMawb
,
null
,
"IDE-ICLEAR-API"
,
appInfo
);
if
(
Objects
.
equals
(
chmConsignment
,
null
)){
result
.
setCode
(
"30001"
);
result
.
setMsg
(
"数据格式不正确"
);
...
...
@@ -180,7 +181,7 @@ public class FedexService {
* @param fedexc
* @return
*/
public
ResultRS
checkBasfInterfaceData
(
Fedexc
fedexc
){
public
ResultRS
checkBasfInterfaceData
(
Fedexc
fedexc
,
AppInfo
appInfo
){
ResultRS
result
=
new
ResultRS
(
Boolean
.
FALSE
,
""
,
""
);
...
...
@@ -191,7 +192,8 @@ public class FedexService {
List
<
String
>
msgList
=
new
ArrayList
<>();
// 参数consignmentCode不能为空
String
consignmentCode
=
fedexc
.
getConsignmentCode
();
if
(
StringUtils
.
isEmpty
(
consignmentCode
)){
//C类校验是否校验运单号,非空则不校验
if
(
appInfo
.
getCodeCheck
()
==
null
&&
StringUtils
.
isEmpty
(
consignmentCode
)){
msgList
.
add
(
"参数consignmentCode不能为空"
);
}
// 参数consignmentId不能为空
...
...
src/test/java/com/erry/iclear/dateInterface/ChmConsignmentServiceTest.java
View file @
73050ac
...
...
@@ -40,22 +40,22 @@ public class ChmConsignmentServiceTest extends IClearApiApplicationTests {
@Test
public
void
testProcessChmConsignment1
(){
try
{
ResultRS
result
=
new
ResultRS
(
Boolean
.
FALSE
,
""
,
""
);
Fedexc
fedexc
=
this
.
createNewFedex
();
FedexMawb
mawb
=
fedexService
.
saveMawbFedex
(
fedexc
);
//Basfc fedexc = this.createNewBasf();
String
timeStamp
=
String
.
valueOf
(
new
Date
().
getTime
());
ResultRS
resultRS
=
chmConsignmentService
.
processChmConsignmentFedex
(
mawb
,
timeStamp
,
"BASF"
);
/*result=fedexService.checkBasfMawb(mawb);
if(!result.getSuccess()){
System.out.println(result.getMsg());
}*/
System
.
out
.
println
(
resultRS
.
toString
());
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
System
.
out
.
println
(
"1"
);
//
try{
//
ResultRS result = new ResultRS(Boolean.FALSE,"","");
//
Fedexc fedexc = this.createNewFedex();
//
FedexMawb mawb = fedexService.saveMawbFedex(fedexc);
//
//Basfc fedexc = this.createNewBasf();
//
String timeStamp = String.valueOf(new Date().getTime());
//
ResultRS resultRS = chmConsignmentService.processChmConsignmentFedex(mawb, timeStamp, "BASF");
//
/*result=fedexService.checkBasfMawb(mawb);
//
if(!result.getSuccess()){
//
System.out.println(result.getMsg());
//
}*/
//
System.out.println(resultRS.toString());
//
}catch (Exception e){
//
e.printStackTrace();
//
}
//
System.out.println("1");
}
private
Fedexc
createNewFedex
(){
...
...
Please
register
or
login
to post a comment