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 18:02:24 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
83bc1293c49668bffb6ea52fdf21c840a841a1e0
83bc1293
1 parent
17e3f20b
提交代码
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
105 additions
and
28 deletions
src/main/java/com/erry/iclear/dateInterface/api/CommonExceptionAdvice.java
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/api/CommonExceptionAdvice.java
0 → 100644
View file @
83bc129
package
com
.
erry
.
iclear
.
dateInterface
.
api
;
import
com.erry.iclear.dateInterface.api.response.ResultRS
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.MessageSource
;
import
org.springframework.context.i18n.LocaleContextHolder
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.validation.FieldError
;
import
org.springframework.web.bind.MethodArgumentNotValidException
;
import
org.springframework.web.bind.annotation.ControllerAdvice
;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.ResponseStatus
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* @author Administrator
*/
@ControllerAdvice
@ResponseBody
@Slf4j
public
class
CommonExceptionAdvice
{
@Autowired
private
MessageSource
messageSource
;
@ResponseStatus
(
HttpStatus
.
OK
)
@ExceptionHandler
({
MethodArgumentNotValidException
.
class
,
NullPointerException
.
class
})
public
ResultRS
handleMethodArgumentNotValidException
(
MethodArgumentNotValidException
e
)
{
log
.
error
(
"参数验证失败:{}"
,
e
.
getMessage
());
BindingResult
result
=
e
.
getBindingResult
();
List
<
FieldError
>
errorList
=
e
.
getBindingResult
().
getFieldErrors
();
List
<
String
>
errorMessages
=
errorList
.
stream
().
map
(
x
->{
String
itemMessage
=
messageSource
.
getMessage
(
x
.
getDefaultMessage
(),
null
,
x
.
getDefaultMessage
(),
LocaleContextHolder
.
getLocale
());
return
String
.
format
(
"%s"
,
itemMessage
);
}).
collect
(
Collectors
.
toList
());
return
new
ResultRS
(
Boolean
.
FALSE
,
"30002"
,
errorMessages
.
toString
());
}
}
src/main/java/com/erry/iclear/dateInterface/api/CustomsDataInterface.java
View file @
83bc129
...
...
@@ -13,6 +13,7 @@ import lombok.extern.slf4j.Slf4j;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.StopWatch
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
...
...
@@ -48,7 +49,7 @@ public class CustomsDataInterface {
@PostMapping
(
"/sendMawb"
)
@ResponseBody
public
ResultRS
sendMawb
(
HttpServletRequest
request
,
@RequestBody
Mawb
mawb
)
{
,
@Validated
@RequestBody
Mawb
mawb
)
{
log
.
info
(
"接收到请求数据billNo:"
+
mawb
.
getBillNo
()+
" data:"
+
gson
.
toJson
(
mawb
));
ResultRS
result
=
new
ResultRS
(
Boolean
.
FALSE
,
""
,
""
);
...
...
src/main/java/com/erry/iclear/dateInterface/api/request/Mawb.java
View file @
83bc129
...
...
@@ -5,8 +5,12 @@ import io.swagger.annotations.ApiModelProperty;
import
lombok.Data
;
import
org.hibernate.annotations.DynamicInsert
;
import
org.hibernate.annotations.DynamicUpdate
;
import
org.springframework.validation.annotation.Validated
;
import
javax.persistence.*
;
import
javax.validation.Valid
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.util.List
;
...
...
@@ -38,22 +42,27 @@ public class Mawb implements Serializable {
@ApiModelProperty
(
value
=
"进出口标志"
,
name
=
"IEFlag"
,
example
=
"固定值:E"
)
@NotBlank
(
message
=
"参数ieFlag不能为空"
)
@Column
(
name
=
"IEFLAG"
)
private
String
ieFlag
;
@ApiModelProperty
(
value
=
"报关类型"
,
name
=
"Type"
,
example
=
"固定值:EX"
)
@NotBlank
(
message
=
"参数type不能为空"
)
@Column
(
name
=
"TYPE"
)
private
String
type
;
@ApiModelProperty
(
value
=
"申报单位代码"
,
name
=
"agentCode"
,
example
=
"固定值:1111980005"
)
@NotBlank
(
message
=
"参数agentCode不能为空"
)
@Column
(
name
=
"AGENTCODE"
)
private
String
agentCode
;
@ApiModelProperty
(
value
=
"申报单位名称"
,
name
=
"agentName"
,
example
=
"固定值:联邦快递(中国)有限公司"
)
@NotBlank
(
message
=
"参数agentName不能为空"
)
@Column
(
name
=
"AGENTNAME"
)
private
String
agentName
;
@ApiModelProperty
(
value
=
"提单号"
,
name
=
"billNo"
,
example
=
"固定值:有总单号则取值‘总单号_运单号‘,没有总单号则取值‘运单号‘"
)
@NotBlank
(
message
=
"参数billNo不能为空"
)
@Column
(
name
=
"BILLNO"
)
private
String
billNo
;
...
...
@@ -62,46 +71,57 @@ public class Mawb implements Serializable {
private
String
contrNo
;
@ApiModelProperty
(
value
=
"主管海关(申报地海关)"
,
name
=
"customMaster"
,
example
=
"固定值:0101"
)
@NotBlank
(
message
=
"参数customMaster不能为空"
)
@Column
(
name
=
"CUSTOMMASTER"
)
private
String
customMaster
;
@ApiModelProperty
(
value
=
"征免性质"
,
name
=
"cutMode"
,
example
=
"101"
)
@NotBlank
(
message
=
"参数cutMode不能为空"
)
@Column
(
name
=
"CUTMODE"
)
private
String
cutMode
;
@ApiModelProperty
(
value
=
"报关/转关关系标志"
,
name
=
"declTrnRel"
,
example
=
"固定值:0"
)
@NotBlank
(
message
=
"参数declTrnRel不能为空"
)
@Column
(
name
=
"DECLTRNREL"
)
private
String
declTrnRel
;
@ApiModelProperty
(
value
=
"经停港/指运港"
,
name
=
"distinatePort"
,
example
=
"ASM000"
)
@NotBlank
(
message
=
"参数distinatePort不能为空"
)
@Column
(
name
=
"DISTINATEPORT"
)
private
String
distinatePort
;
@ApiModelProperty
(
value
=
"报关标志"
,
name
=
"EdiId"
,
example
=
"001"
)
@NotBlank
(
message
=
"参数ediId不能为空"
)
@Column
(
name
=
"EDIID"
)
private
String
ediId
;
@ApiModelProperty
(
value
=
"海关编号"
,
name
=
"EntryId"
,
example
=
"001"
)
@NotBlank
(
message
=
"参数entryId不能为空"
)
@Column
(
name
=
"ENTRYID"
)
private
String
entryId
;
@ApiModelProperty
(
value
=
"运费币制"
,
name
=
"feeCurr"
,
example
=
"固定值:3"
)
@NotBlank
(
message
=
"参数feeCurr不能为空"
)
@Column
(
name
=
"FEECURR"
)
private
String
feeCurr
;
@ApiModelProperty
(
value
=
"运费标记"
,
name
=
"feeMark"
,
example
=
"99.22"
)
@NotBlank
(
message
=
"参数feeMark不能为空"
)
@Column
(
name
=
"FEEMARK"
)
private
String
feeMark
;
@ApiModelProperty
(
value
=
"运费/率"
,
name
=
"feeRate"
,
example
=
"43.34358"
)
@NotNull
(
message
=
"参数feeRate不能为空"
)
@Column
(
name
=
"FEERATE"
)
private
BigDecimal
feeRate
;
@ApiModelProperty
(
value
=
"毛重"
,
name
=
"grossWet"
,
example
=
""
)
@NotNull
(
message
=
"参数grossWet不能为空"
)
@Column
(
name
=
"CROSSWET"
)
private
Integer
grossWet
;
@ApiModelProperty
(
value
=
"出入境关闭"
,
name
=
"IEPort"
,
example
=
"固定值:0101"
)
@NotBlank
(
message
=
"参数iePort不能为空"
)
@Column
(
name
=
"IEPORT"
)
private
String
iePort
;
...
...
@@ -110,6 +130,7 @@ public class Mawb implements Serializable {
private
String
inputerName
;
@ApiModelProperty
(
value
=
"保险费币制"
,
name
=
"insurCurr"
,
example
=
"MOP"
)
@NotBlank
(
message
=
"参数insurCurr不能为空"
)
@Column
(
name
=
"INSURCURR"
)
private
String
insurCurr
;
...
...
@@ -118,6 +139,7 @@ public class Mawb implements Serializable {
private
String
insurMark
;
@ApiModelProperty
(
value
=
"保险费/率"
,
name
=
"insurRate"
,
example
=
""
)
@NotNull
(
message
=
"参数insurRate不能为空"
)
@Column
(
name
=
"INSURRATE"
)
private
BigDecimal
insurRate
;
...
...
@@ -126,6 +148,7 @@ public class Mawb implements Serializable {
private
String
manualNo
;
@ApiModelProperty
(
value
=
"净重"
,
name
=
"netWt"
,
example
=
""
)
@NotNull
(
message
=
"参数netWt不能为空"
)
@Column
(
name
=
"NETWT"
)
private
BigDecimal
netWt
;
...
...
@@ -142,58 +165,70 @@ public class Mawb implements Serializable {
private
String
otherMark
;
@ApiModelProperty
(
value
=
"消费使用/生产销售单位代码"
,
name
=
"ownerCode"
,
example
=
"Z321654987"
)
@NotBlank
(
message
=
"参数ownerCode不能为空"
)
@Column
(
name
=
"OWNERCODE"
)
private
String
ownerCode
;
@ApiModelProperty
(
value
=
"消费使用/生产销售单位名称"
,
name
=
"ownerName"
,
example
=
"上海保险"
)
@NotBlank
(
message
=
"参数ownerName不能为空"
)
@Column
(
name
=
"OWNERNAME"
)
private
String
ownerName
;
@ApiModelProperty
(
value
=
"件数"
,
name
=
"packNo"
,
example
=
""
)
@NotNull
(
message
=
"参数packNo不能为空"
)
@Column
(
name
=
"PACKNO"
)
private
Integer
packNo
;
@ApiModelProperty
(
value
=
"预录入编号"
,
name
=
"preEntryId"
,
example
=
""
)
@Column
(
name
=
"PREENTRYID"
)
private
String
preEntryId
;
@ApiModelProperty
(
value
=
"启运国/运抵国"
,
name
=
"tradeCountry"
,
example
=
"USA"
)
@NotBlank
(
message
=
"参数tradeCountry不能为空"
)
@Column
(
name
=
"TRADECOUNTRY"
)
private
String
tradeCountry
;
@ApiModelProperty
(
value
=
"监管方式"
,
name
=
"tradeMode"
,
example
=
"0200"
)
@NotBlank
(
message
=
"参数tradeMode不能为空"
)
@Column
(
name
=
"TRADEMODE"
)
private
String
tradeMode
;
@ApiModelProperty
(
value
=
"境内收发货人编号"
,
name
=
"tradeCode"
,
example
=
"Z321654987"
)
@NotBlank
(
message
=
"参数tradeCode不能为空"
)
@Column
(
name
=
"TRADECODE"
)
private
String
tradeCode
;
@ApiModelProperty
(
value
=
"运输方式代码"
,
name
=
"trafMode"
,
example
=
"1"
)
@NotBlank
(
message
=
"参数trafMode不能为空"
)
@Column
(
name
=
"TRAFMODE"
)
private
String
trafMode
;
@ApiModelProperty
(
value
=
"境内收发货人名称"
,
name
=
"tradeName"
,
example
=
"上海铢怡国际货物运输代理有限公司"
)
@NotBlank
(
message
=
"参数tradeName不能为空"
)
@Column
(
name
=
"TRADENAME"
)
private
String
tradeName
;
@ApiModelProperty
(
value
=
"成交方式"
,
name
=
"transMode"
,
example
=
"2"
)
@NotBlank
(
message
=
"参数transMode不能为空"
)
@Column
(
name
=
"TRANSMODE"
)
private
String
transMode
;
@ApiModelProperty
(
value
=
"包装种类"
,
name
=
"wrapType"
,
example
=
"22"
)
@NotBlank
(
message
=
"参数wrapType不能为空"
)
@Column
(
name
=
"WRAPTYPE"
)
private
String
wrapType
;
@ApiModelProperty
(
value
=
"生产核销单位统一信用代码---报关形式类型"
,
name
=
"TradeCodeScc"
,
example
=
"A74125896321456987"
)
@NotBlank
(
message
=
"参数tradeCodeScc不能为空"
)
@Column
(
name
=
"TRADECODESCC"
)
private
String
tradeCodeScc
;
@ApiModelProperty
(
value
=
"消费使用/生产销售单位单位统一编码"
,
name
=
"ownerCodeScc"
,
example
=
""
)
@NotBlank
(
message
=
"参数ownerCodeScc不能为空"
)
@Column
(
name
=
"OWNERCODESCC"
)
private
String
ownerCodeScc
;
@ApiModelProperty
(
value
=
"贸易国别"
,
name
=
"tradeAreaCode"
,
example
=
""
)
@NotBlank
(
message
=
"参数tradeAreaCode不能为空"
)
@Column
(
name
=
"TRADEAREACODE"
)
private
String
tradeAreaCode
;
...
...
@@ -202,6 +237,7 @@ public class Mawb implements Serializable {
private
String
markNo
;
@ApiModelProperty
(
value
=
"入境口岸代码"
,
name
=
"entyPortCode"
,
example
=
"固定值:310302"
)
@NotBlank
(
message
=
"参数entyPortCode不能为空"
)
@Column
(
name
=
"ENTYPORTCODE"
)
private
String
entyPortCode
;
...
...
@@ -214,7 +250,6 @@ public class Mawb implements Serializable {
private
String
declareName
;
@ApiModelProperty
(
value
=
"境外发货人代码"
,
name
=
"overseasConsignorCode"
,
example
=
""
)
@Column
(
name
=
"OVERSEASCONSIGNORCODE"
)
private
String
overseasConsignorCode
;
@ApiModelProperty
(
value
=
"境外收货人编码"
,
name
=
"overseasConsigneeCode"
,
example
=
""
)
...
...
@@ -222,9 +257,11 @@ public class Mawb implements Serializable {
private
String
overseasConsigneeCode
;
@ApiModelProperty
(
value
=
"境外收货人名称(外文)"
,
name
=
"overseasConsigneeEname"
,
example
=
""
)
@NotBlank
(
message
=
"参数overseasConsigneeEname不能为空"
)
@Column
(
name
=
"OVERSEASCONSIGNEEENAME"
)
private
String
overseasConsigneeEname
;
@Valid
@ApiModelProperty
(
value
=
"运单明细"
,
name
=
"mawbDetailList"
,
example
=
""
)
@OneToMany
(
cascade
=
CascadeType
.
PERSIST
)
@JoinColumn
(
name
=
"mawbId"
)
...
...
src/main/java/com/erry/iclear/dateInterface/api/request/MawbDetail.java
View file @
83bc129
...
...
@@ -4,8 +4,11 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
org.springframework.validation.annotation.Validated
;
import
javax.persistence.*
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
...
...
@@ -32,131 +35,123 @@ public class MawbDetail implements Serializable {
private
Long
mawbId
;
@Column
(
name
=
"DETAILID"
)
@NotBlank
(
message
=
"参数detailId不能为空"
)
private
String
detailId
;
@ApiModelProperty
(
value
=
"商品编号"
,
example
=
"空值"
)
@Column
(
name
=
"CLASSMARK"
)
//JsonProperty("ClassMark")
private
String
classMark
;
@ApiModelProperty
(
value
=
"商品编号"
)
@NotBlank
(
message
=
"参数codeTS不能为空"
)
@Column
(
name
=
"CODETS"
)
//@JsonProperty("CodeTS")
private
String
codeTS
;
@ApiModelProperty
(
value
=
"申报单价"
,
example
=
"空值"
)
@NotNull
(
message
=
"参数declPrice不能为空"
)
@Column
(
name
=
"DECLPRICE"
)
//@JsonProperty("DeclPrice")
private
BigDecimal
declPrice
;
@ApiModelProperty
(
value
=
"申报总价"
)
@NotNull
(
message
=
"参数declTotal不能为空"
)
@Column
(
name
=
"DECLTOTAL"
)
//@JsonProperty("DeclTotal")
private
BigDecimal
declTotal
;
@ApiModelProperty
(
value
=
"征免方式"
)
@NotBlank
(
message
=
"参数dutyMode不能为空"
)
@Column
(
name
=
"DUTYMODE"
)
//@JsonProperty("DutyMode")
private
String
dutyMode
;
@ApiModelProperty
(
value
=
"货号"
)
@Column
(
name
=
"EXGNO"
)
//@JsonProperty("ExgNo")
private
String
exgNo
;
@ApiModelProperty
(
value
=
"货号"
)
@Column
(
name
=
"EXGVERSION"
)
//@JsonProperty("ExgVersion")
private
String
exgVersion
;
@ApiModelProperty
(
value
=
"第一计量单位(法定单位)"
)
@NotBlank
(
message
=
"参数firstUnit不能为空"
)
@Column
(
name
=
"FIRSTUNIT"
)
//@JsonProperty("FirstUnit")
private
String
firstUnit
;
@ApiModelProperty
(
value
=
"第一法定数量"
)
@NotNull
(
message
=
"参数firstQty不能为空"
)
@Column
(
name
=
"FIRSTQTY"
)
//@JsonProperty("FirstQty")
private
Integer
firstQty
;
@ApiModelProperty
(
value
=
"成交计量单位"
)
@NotBlank
(
message
=
"参数gunit不能为空"
)
@Column
(
name
=
"GUNIT"
)
//@JsonProperty("GUNIT")
private
String
gunit
;
@ApiModelProperty
(
value
=
"商品规格、型号"
)
@NotBlank
(
message
=
"参数gmodel不能为空"
)
@Column
(
name
=
"GMODE"
)
//@JsonProperty("GModel")
private
String
gmodel
;
@ApiModelProperty
(
value
=
"商品名称"
)
@NotBlank
(
message
=
"参数gname不能为空"
)
@Column
(
name
=
"GNAME"
)
//@JsonProperty("GName")
private
String
gname
;
@ApiModelProperty
(
value
=
"商品序号"
)
@NotBlank
(
message
=
"参数gno不能为空"
)
@Column
(
name
=
"GNO"
)
//@JsonProperty("GNo")
private
String
gno
;
@ApiModelProperty
(
value
=
"成交数量"
)
@NotNull
(
message
=
"参数gqty不能为空"
)
@Column
(
name
=
"GQTY"
)
//@JsonProperty("GQty")
private
BigDecimal
gqty
;
@ApiModelProperty
(
value
=
"原产国"
)
@NotBlank
(
message
=
"参数originCountry不能为空"
)
@Column
(
name
=
"ORIGINCURRENTY"
)
//@JsonProperty("OriginCountry")
private
String
originCountry
;
@ApiModelProperty
(
value
=
"第二计量单位"
)
@Column
(
name
=
"SECONDUNIT"
)
//@JsonProperty("SecondUnit")
private
String
secondUnit
;
@ApiModelProperty
(
value
=
"第二法定数量"
)
@NotNull
(
message
=
"参数secondQty不能为空"
)
@Column
(
name
=
"SECONDQTY"
)
//@JsonProperty("SecondQty")
private
Integer
secondQty
;
@ApiModelProperty
(
value
=
"成交币制"
)
@NotBlank
(
message
=
"参数tradeCurr不能为空"
)
@Column
(
name
=
"TRADECURR"
)
//@JsonProperty("TradeCurr")
private
String
tradeCurr
;
@ApiModelProperty
(
value
=
"用途/生产厂家"
)
@Column
(
name
=
"USETO"
)
//@JsonProperty("UseTo")
private
String
useTo
;
@ApiModelProperty
(
value
=
"工缴费"
)
@Column
(
name
=
"WORKUSD"
)
//@JsonProperty("WorkUsd")
private
BigDecimal
workUsd
;
@ApiModelProperty
(
value
=
"检验检疫编"
)
@Column
(
name
=
"CIQCODE"
)
//@JsonProperty("CiqCode")
private
String
ciqCode
;
@ApiModelProperty
(
value
=
"最终目的国(地区)"
)
@NotBlank
(
message
=
"参数destinationCountry不能为空"
)
@Column
(
name
=
"DESTINATIONCOUNTRY"
)
//@JsonProperty("DestinationCountry")
private
String
destinationCountry
;
@ApiModelProperty
(
value
=
"申报货物英文名称"
)
@Column
(
name
=
"DECLGOODSENAME"
)
//@JsonProperty("DeclGoodsEname")
private
String
declGoodsEname
;
@ApiModelProperty
(
value
=
"目的地代码"
)
@Column
(
name
=
"DESTCODE"
)
//@JsonProperty("DestCode")
private
String
destCode
;
@ApiModelProperty
(
value
=
"境内目的地/境内货源地"
)
@NotBlank
(
message
=
"参数districtCode不能为空"
)
@Column
(
name
=
"DISTRICTCODE"
)
//@JsonProperty("DistrictCode")
private
String
districtCode
;
...
...
Please
register
or
login
to post a comment