切换导航条
此项目
正在载入...
登录
WLPT_CLOUD
/
Base_Model
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
朱兆平
2 years ago
提交
cc42845dd78e6408791e9a65024b1df3ff7ca223
1 个父辈
2118037a
master
电子运单-电报生成优化一对多部分
显示空白字符变更
内嵌
并排对比
正在显示
20 个修改的文件
包含
791 行增加
和
422 行删除
src/main/java/com/sunyo/wlpt/base/model/efreight/fwb/FWB.java
src/main/java/com/sunyo/wlpt/base/model/efreight/fwb/FWB_ACC.java
src/main/java/com/sunyo/wlpt/base/model/efreight/fwb/FWB_Bill.java
src/main/java/com/sunyo/wlpt/base/model/efreight/fwb/FWB_CER.java
src/main/java/com/sunyo/wlpt/base/model/efreight/fwb/FWB_CNE.java
src/main/java/com/sunyo/wlpt/base/model/efreight/fwb/FWB_CVD.java
src/main/java/com/sunyo/wlpt/base/model/efreight/fwb/FWB_FLT.java
src/main/java/com/sunyo/wlpt/base/model/efreight/fwb/FWB_ISU.java
src/main/java/com/sunyo/wlpt/base/model/efreight/fwb/FWB_NFY.java
src/main/java/com/sunyo/wlpt/base/model/efreight/fwb/FWB_OCI.java
src/main/java/com/sunyo/wlpt/base/model/efreight/fwb/FWB_OSI.java
src/main/java/com/sunyo/wlpt/base/model/efreight/fwb/FWB_REF.java
src/main/java/com/sunyo/wlpt/base/model/efreight/fwb/FWB_RTD.java
src/main/java/com/sunyo/wlpt/base/model/efreight/fwb/FWB_RTG.java
src/main/java/com/sunyo/wlpt/base/model/efreight/fwb/FWB_SHP.java
src/main/java/com/sunyo/wlpt/base/model/efreight/fwb/FWB_SSR.java
src/main/java/com/sunyo/wlpt/base/model/efreight/fwb/SHP_CNE_CONTACT.java
src/main/java/com/sunyo/wlpt/base/model/efreight/fwb/exception/FWBExceptionType.java
src/test/java/FWB_804_31118511.java
src/test/java/FWB_TEST.java
src/main/java/com/sunyo/wlpt/base/model/efreight/fwb/FWB.java
查看文件 @
cc42845
package
com
.
sunyo
.
wlpt
.
base
.
model
.
efreight
.
fwb
;
import
com.sunyo.wlpt.base.model.efreight.BASE
;
import
com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBException
;
import
com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBExceptionType
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
java.util.List
;
/**
* 电子运单主运单
* @author mrz
* @date 2023-05-30
*
*/
public
class
FWB
extends
BASE
implements
FWB_BASE
{
/**
* 版本号
* 默认16
*/
public
String
ver
=
"16"
;
/**
* 主运单格式
* [0-9]{3}-[0-9]{8}
*/
private
String
waybillNum
=
""
;
/**
* 运单起始站
*/
private
String
origin
=
""
;
/**
* 运单目的站
*/
private
String
destination
=
""
;
/**
* 运单总件数
* number of pieces
*/
private
String
quantity_picecs
=
""
;
/**
* 运单毛重,运单的实际称重
*/
private
String
quantity_weight
=
""
;
/**
* 计重单位,
* K 代表KG 公斤
* L 代表公升
*/
private
String
quantity_weight_code
=
""
;
/**
* 体积
*/
private
String
quantity_volume
=
""
;
/**
* 体积单位
* MC 代表 立方米 Cubic Metres
* CC 代表 立方厘米 Cubic Centimeters
* CF 代表 立方英尺 Cubic Feet
* CI 代表 立方英寸 Cubic Inches
*/
private
String
quantity_volume_code
=
""
;
/**
* 密度
* 可选节点
*/
private
String
quantity_density
=
""
;
/**
* 密度
* 可选节点
*/
private
String
quantity_density_code
=
"DG"
;
public
class
FWB
{
public
FWB_Bill
bill
;
public
FWB_FLT
flt
;
public
FWB_RTG
rtg
;
public
FWB_SHP
shp
;
public
FWB_CNE
cne
;
public
FWB_AGT
agt
;
public
FWB_SSR
ssr
;
public
FWB_NFY
nfy
;
public
List
<
FWB_ACC
>
acc
;
public
FWB_CVD
cvd
;
public
FWB_RTD
rtd
;
public
FWB_OTH
oth
;
public
FWB_PPD
ppd
;
public
FWB_CER
cer
;
public
FWB_ISU
isu
;
public
List
<
FWB_OSI
>
osi
;
public
FWB_REF
ref
;
public
List
<
FWB_OCI
>
oci
;
public
String
getWaybillNum
()
throws
FWBException
{
public
String
getFWBText
(){
StringBuilder
text
=
new
StringBuilder
();
try
{
text
.
append
(
bill
.
getNodeName
()).
append
(
bill
.
getFWBNodeText
())
;
text
.
append
(
flt
.
getNodeName
()).
append
(
flt
.
getFWBNodeText
());
text
.
append
(
rtg
.
getNodeName
()).
append
(
rtg
.
getFWBNodeText
());
text
.
append
(
shp
.
getNodeName
()).
append
(
shp
.
getFWBNodeText
());
text
.
append
(
cne
.
getNodeName
()).
append
(
cne
.
getFWBNodeText
());
text
.
append
(
agt
.
getFWBNodeText
());
text
.
append
(
ssr
.
getFWBNodeText
());
text
.
append
(
nfy
.
getFWBNodeText
());
String
patternStr
=
"^[0-9]{3}-[0-9]{8}$"
;
Pattern
pattern
=
Pattern
.
compile
(
patternStr
);
Matcher
matcher
=
pattern
.
matcher
(
waybillNum
);
if
(!
matcher
.
find
()){
throw
new
FWBException
(
FWBExceptionType
.
FWB_WAYBILL_ERR
);
if
(
acc
!=
null
&&
!
acc
.
isEmpty
()){
for
(
int
i
=
0
;
i
<
acc
.
size
();
i
++)
{
if
(
i
==
0
){
text
.
append
(
acc
.
get
(
i
).
getNodeName
());
}
String
serialNumber
=
waybillNum
.
split
(
"-"
)[
1
];
Integer
serialNumber7
=
Integer
.
valueOf
(
serialNumber
.
substring
(
0
,
7
))
;
Integer
serialNumberEnd
=
Integer
.
valueOf
(
serialNumber
.
substring
(
7
));
//模七校验
if
((
serialNumber7
%
7
)
!=
serialNumberEnd
){
throw
new
FWBException
(
FWBExceptionType
.
FWB_WAYBILL_REGX_ERR
);
}
return
waybillNum
;
}
public
void
setWaybillNum
(
String
waybillNum
)
{
this
.
waybillNum
=
waybillNum
;
}
public
String
getOrigin
()
throws
FWBException
{
String
patternStr
=
"^[A-Z]{3}$"
;
Pattern
pattern
=
Pattern
.
compile
(
patternStr
);
Matcher
matcher
=
pattern
.
matcher
(
origin
);
if
(!
matcher
.
find
()){
throw
new
FWBException
(
FWBExceptionType
.
FWB_WAYBILL_ORGN_ERR
);
}
return
origin
;
}
public
void
setOrigin
(
String
origin
)
{
this
.
origin
=
origin
;
}
public
String
getDestination
()
throws
FWBException
{
String
patternStr
=
"^[A-Z]{3}$"
;
Pattern
pattern
=
Pattern
.
compile
(
patternStr
);
Matcher
matcher
=
pattern
.
matcher
(
origin
);
if
(!
matcher
.
find
()){
throw
new
FWBException
(
FWBExceptionType
.
FWB_WAYBILL_DES_ERR
);
}
return
destination
;
}
public
void
setDestination
(
String
destination
)
{
this
.
destination
=
destination
;
}
public
String
getQuantity_picecs
()
throws
FWBException
{
String
patternStr
=
"^[0-9]{1,4}$"
;
Pattern
pattern
=
Pattern
.
compile
(
patternStr
);
Matcher
matcher
=
pattern
.
matcher
(
quantity_picecs
);
if
(!
matcher
.
find
()){
throw
new
FWBException
(
FWBExceptionType
.
FWB_WAYBILL_PCE_ERR
);
}
return
quantity_picecs
;
}
public
void
setQuantity_picecs
(
String
quantity_picecs
)
{
this
.
quantity_picecs
=
quantity_picecs
;
}
public
String
getQuantity_weight
()
throws
FWBException
{
String
patternStr
=
"^[1-9][0-9\\.]{1,6}$"
;
Pattern
pattern
=
Pattern
.
compile
(
patternStr
);
Matcher
matcher
=
pattern
.
matcher
(
quantity_weight
);
if
(!
matcher
.
find
()){
throw
new
FWBException
(
FWBExceptionType
.
FWB_WAYBILL_WGT_ERR
);
}
return
quantity_weight
;
}
public
void
setQuantity_weight
(
String
quantity_weight
)
{
this
.
quantity_weight
=
quantity_weight
;
}
public
String
getQuantity_weight_code
()
throws
FWBException
{
String
patternStr
=
"^[KL]$"
;
Pattern
pattern
=
Pattern
.
compile
(
patternStr
);
Matcher
matcher
=
pattern
.
matcher
(
quantity_weight_code
);
if
(!
matcher
.
find
()){
throw
new
FWBException
(
FWBExceptionType
.
FWB_WAYBILL_WGT_CODE_ERR
);
text
.
append
(
acc
.
get
(
i
).
getFWBNodeText
());
}
return
quantity_weight_code
;
}
public
void
setQuantity_weight_code
(
String
quantity_weight_code
)
{
this
.
quantity_weight_code
=
quantity_weight_code
;
}
public
String
getQuantity_volume
()
throws
FWBException
{
if
(
hasText
(
quantity_volume
)){
String
patternStr
=
"^[0-9][0-9\\.]{0,8}$"
;
Pattern
pattern
=
Pattern
.
compile
(
patternStr
);
Matcher
matcher
=
pattern
.
matcher
(
quantity_volume
);
if
(!
matcher
.
find
()){
throw
new
FWBException
(
FWBExceptionType
.
FWB_WAYBILL_VOL_ERR
);
}
}
text
.
append
(
cvd
.
getFWBNodeText
());
text
.
append
(
rtd
.
getFWBNodeText
());
text
.
append
(
oth
.
getFWBNodeText
());
text
.
append
(
ppd
.
getFWBNodeText
());
text
.
append
(
cer
.
getFWBNodeText
());
text
.
append
(
isu
.
getFWBNodeText
());
return
quantity_volume
;
if
(
osi
!=
null
&&
!
osi
.
isEmpty
()){
for
(
int
i
=
0
;
i
<
osi
.
size
();
i
++)
{
if
(
i
==
0
){
text
.
append
(
osi
.
get
(
i
).
getNodeName
());
}
public
void
setQuantity_volume
(
String
quantity_volume
)
{
this
.
quantity_volume
=
quantity_volume
;
text
.
append
(
osi
.
get
(
i
).
getFWBNodeText
());
}
public
String
getQuantity_volume_code
()
throws
FWBException
{
String
patternStr
=
"^MC|CC|CI|CF$"
;
Pattern
pattern
=
Pattern
.
compile
(
patternStr
);
Matcher
matcher
=
pattern
.
matcher
(
quantity_volume_code
);
if
(!
matcher
.
find
()){
throw
new
FWBException
(
FWBExceptionType
.
FWB_WAYBILL_VOL_CODE_ERR
);
}
return
quantity_volume_code
;
}
public
void
setQuantity_volume_code
(
String
quantity_volume_code
)
{
this
.
quantity_volume_code
=
quantity_volume_code
;
}
text
.
append
(
ref
.
getFWBNodeText
());
public
String
getQuantity_density
()
throws
FWBException
{
String
patternStr
=
"^[1-9]?[0-9]?$"
;
Pattern
pattern
=
Pattern
.
compile
(
patternStr
);
Matcher
matcher
=
pattern
.
matcher
(
quantity_density
);
if
(!
matcher
.
find
()){
throw
new
FWBException
(
FWBExceptionType
.
FWB_WAYBILL_DG_ERR
);
}
return
quantity_density
;
if
(
oci
!=
null
&&
!
oci
.
isEmpty
()){
for
(
int
i
=
0
;
i
<
oci
.
size
();
i
++)
{
if
(
i
==
0
){
text
.
append
(
oci
.
get
(
i
).
getNodeName
());
}
public
void
setQuantity_density
(
String
quantity_density
)
{
this
.
quantity_density
=
quantity_density
;
text
.
append
(
oci
.
get
(
i
).
getFWBNodeText
());
}
public
String
getQuantity_density_code
()
{
return
quantity_density_code
;
}
public
void
setQuantity_density_code
(
String
quantity_density_code
)
{
this
.
quantity_density_code
=
quantity_density_code
;
return
text
.
toString
();
}
catch
(
FWBException
e
)
{
e
.
printStackTrace
();
}
@Override
public
String
getFWBNodeText
()
throws
FWBException
{
String
SPLIT_CODE
=
"/"
;
String
CRLF
=
"\n"
;
StringBuilder
sb
=
new
StringBuilder
(
""
);
sb
.
append
(
getWaybillNum
()).
append
(
getOrigin
()).
append
(
getDestination
())
.
append
(
SPLIT_CODE
).
append
(
"T"
).
append
(
getQuantity_picecs
())
.
append
(
getQuantity_weight_code
()).
append
(
getQuantity_weight
());
if
(
hasText
(
getQuantity_volume
())){
sb
.
append
(
getQuantity_volume_code
()).
append
(
getQuantity_volume
());
}
if
(
hasText
(
getQuantity_density
())){
sb
.
append
(
getQuantity_density_code
()).
append
(
getQuantity_density
());
}
sb
.
append
(
CRLF
);
return
sb
.
toString
();
}
@Override
public
String
getNodeName
()
{
return
"FWB/"
+
ver
+
"\n"
;
return
""
;
}
}
...
...
src/main/java/com/sunyo/wlpt/base/model/efreight/fwb/FWB_ACC.java
查看文件 @
cc42845
...
...
@@ -36,6 +36,14 @@ public class FWB_ACC extends BASE implements FWB_BASE {
*/
private
String
acc_info
;
public
FWB_ACC
()
{
}
public
FWB_ACC
(
String
acc_info_id
,
String
acc_info
)
{
this
.
acc_info_id
=
acc_info_id
;
this
.
acc_info
=
acc_info
;
}
public
String
getAcc_info_id
()
throws
FWBException
{
String
patternStr
=
"^[A-Z]{3}$"
;
Pattern
pattern
=
Pattern
.
compile
(
patternStr
);
...
...
@@ -72,7 +80,7 @@ public class FWB_ACC extends BASE implements FWB_BASE {
StringBuilder
sb
=
new
StringBuilder
(
""
);
if
(
hasText
(
acc_info
)
||
hasText
(
acc_info_id
)){
sb
.
append
(
getNodeName
()).
append
(
SPLIT_CODE
);
sb
.
append
(
SPLIT_CODE
);
sb
.
append
(
getAcc_info_id
()).
append
(
SPLIT_CODE
).
append
(
getAcc_info
());
sb
.
append
(
CRLF
);
}
...
...
src/main/java/com/sunyo/wlpt/base/model/efreight/fwb/FWB_Bill.java
0 → 100644
查看文件 @
cc42845
package
com
.
sunyo
.
wlpt
.
base
.
model
.
efreight
.
fwb
;
import
com.sunyo.wlpt.base.model.efreight.BASE
;
import
com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBException
;
import
com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBExceptionType
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
/**
* 电子运单主运单
* @author mrz
* @date 2023-05-30
*
*/
public
class
FWB_Bill
extends
BASE
implements
FWB_BASE
{
/**
* 版本号
* 默认16
*/
public
String
ver
=
"16"
;
/**
* 主运单格式
* [0-9]{3}-[0-9]{8}
*/
private
String
waybillNum
=
""
;
/**
* 运单起始站
*/
private
String
origin
=
""
;
/**
* 运单目的站
*/
private
String
destination
=
""
;
/**
* 运单总件数
* number of pieces
*/
private
String
quantity_picecs
=
""
;
/**
* 运单毛重,运单的实际称重
*/
private
String
quantity_weight
=
""
;
/**
* 计重单位,
* K 代表KG 公斤
* L 代表公升
*/
private
String
quantity_weight_code
=
""
;
/**
* 体积
*/
private
String
quantity_volume
=
""
;
/**
* 体积单位
* MC 代表 立方米 Cubic Metres
* CC 代表 立方厘米 Cubic Centimeters
* CF 代表 立方英尺 Cubic Feet
* CI 代表 立方英寸 Cubic Inches
*/
private
String
quantity_volume_code
=
""
;
/**
* 密度
* 可选节点
*/
private
String
quantity_density
=
""
;
/**
* 密度
* 可选节点
*/
private
String
quantity_density_code
=
"DG"
;
public
String
getWaybillNum
()
throws
FWBException
{
String
patternStr
=
"^[0-9]{3}-[0-9]{8}$"
;
Pattern
pattern
=
Pattern
.
compile
(
patternStr
);
Matcher
matcher
=
pattern
.
matcher
(
waybillNum
);
if
(!
matcher
.
find
()){
throw
new
FWBException
(
FWBExceptionType
.
FWB_WAYBILL_ERR
);
}
String
serialNumber
=
waybillNum
.
split
(
"-"
)[
1
];
Integer
serialNumber7
=
Integer
.
valueOf
(
serialNumber
.
substring
(
0
,
7
))
;
Integer
serialNumberEnd
=
Integer
.
valueOf
(
serialNumber
.
substring
(
7
));
//模七校验
if
((
serialNumber7
%
7
)
!=
serialNumberEnd
){
throw
new
FWBException
(
FWBExceptionType
.
FWB_WAYBILL_REGX_ERR
);
}
return
waybillNum
;
}
public
void
setWaybillNum
(
String
waybillNum
)
{
this
.
waybillNum
=
waybillNum
;
}
public
String
getOrigin
()
throws
FWBException
{
String
patternStr
=
"^[A-Z]{3}$"
;
Pattern
pattern
=
Pattern
.
compile
(
patternStr
);
Matcher
matcher
=
pattern
.
matcher
(
origin
);
if
(!
matcher
.
find
()){
throw
new
FWBException
(
FWBExceptionType
.
FWB_WAYBILL_ORGN_ERR
);
}
return
origin
;
}
public
void
setOrigin
(
String
origin
)
{
this
.
origin
=
origin
;
}
public
String
getDestination
()
throws
FWBException
{
String
patternStr
=
"^[A-Z]{3}$"
;
Pattern
pattern
=
Pattern
.
compile
(
patternStr
);
Matcher
matcher
=
pattern
.
matcher
(
origin
);
if
(!
matcher
.
find
()){
throw
new
FWBException
(
FWBExceptionType
.
FWB_WAYBILL_DES_ERR
);
}
return
destination
;
}
public
void
setDestination
(
String
destination
)
{
this
.
destination
=
destination
;
}
public
String
getQuantity_picecs
()
throws
FWBException
{
String
patternStr
=
"^[0-9]{1,4}$"
;
Pattern
pattern
=
Pattern
.
compile
(
patternStr
);
Matcher
matcher
=
pattern
.
matcher
(
quantity_picecs
);
if
(!
matcher
.
find
()){
throw
new
FWBException
(
FWBExceptionType
.
FWB_WAYBILL_PCE_ERR
);
}
return
quantity_picecs
;
}
public
void
setQuantity_picecs
(
String
quantity_picecs
)
{
this
.
quantity_picecs
=
quantity_picecs
;
}
public
String
getQuantity_weight
()
throws
FWBException
{
String
patternStr
=
"^[1-9][0-9\\.]{1,6}$"
;
Pattern
pattern
=
Pattern
.
compile
(
patternStr
);
Matcher
matcher
=
pattern
.
matcher
(
quantity_weight
);
if
(!
matcher
.
find
()){
throw
new
FWBException
(
FWBExceptionType
.
FWB_WAYBILL_WGT_ERR
);
}
return
quantity_weight
;
}
public
void
setQuantity_weight
(
String
quantity_weight
)
{
this
.
quantity_weight
=
quantity_weight
;
}
public
String
getQuantity_weight_code
()
throws
FWBException
{
String
patternStr
=
"^[KL]$"
;
Pattern
pattern
=
Pattern
.
compile
(
patternStr
);
Matcher
matcher
=
pattern
.
matcher
(
quantity_weight_code
);
if
(!
matcher
.
find
()){
throw
new
FWBException
(
FWBExceptionType
.
FWB_WAYBILL_WGT_CODE_ERR
);
}
return
quantity_weight_code
;
}
public
void
setQuantity_weight_code
(
String
quantity_weight_code
)
{
this
.
quantity_weight_code
=
quantity_weight_code
;
}
public
String
getQuantity_volume
()
throws
FWBException
{
if
(
hasText
(
quantity_volume
)){
String
patternStr
=
"^[0-9][0-9\\.]{0,8}$"
;
Pattern
pattern
=
Pattern
.
compile
(
patternStr
);
Matcher
matcher
=
pattern
.
matcher
(
quantity_volume
);
if
(!
matcher
.
find
()){
throw
new
FWBException
(
FWBExceptionType
.
FWB_WAYBILL_VOL_ERR
);
}
}
return
quantity_volume
;
}
public
void
setQuantity_volume
(
String
quantity_volume
)
{
this
.
quantity_volume
=
quantity_volume
;
}
public
String
getQuantity_volume_code
()
throws
FWBException
{
String
patternStr
=
"^MC|CC|CI|CF$"
;
Pattern
pattern
=
Pattern
.
compile
(
patternStr
);
Matcher
matcher
=
pattern
.
matcher
(
quantity_volume_code
);
if
(!
matcher
.
find
()){
throw
new
FWBException
(
FWBExceptionType
.
FWB_WAYBILL_VOL_CODE_ERR
);
}
return
quantity_volume_code
;
}
public
void
setQuantity_volume_code
(
String
quantity_volume_code
)
{
this
.
quantity_volume_code
=
quantity_volume_code
;
}
public
String
getQuantity_density
()
throws
FWBException
{
String
patternStr
=
"^[1-9]?[0-9]?$"
;
Pattern
pattern
=
Pattern
.
compile
(
patternStr
);
Matcher
matcher
=
pattern
.
matcher
(
quantity_density
);
if
(!
matcher
.
find
()){
throw
new
FWBException
(
FWBExceptionType
.
FWB_WAYBILL_DG_ERR
);
}
return
quantity_density
;
}
public
void
setQuantity_density
(
String
quantity_density
)
{
this
.
quantity_density
=
quantity_density
;
}
public
String
getQuantity_density_code
()
{
return
quantity_density_code
;
}
public
void
setQuantity_density_code
(
String
quantity_density_code
)
{
this
.
quantity_density_code
=
quantity_density_code
;
}
public
FWB_Bill
()
{
}
public
FWB_Bill
(
String
ver
,
String
waybillNum
,
String
origin
,
String
destination
,
String
quantity_picecs
,
String
quantity_weight
,
String
quantity_weight_code
,
String
quantity_volume
,
String
quantity_volume_code
,
String
quantity_density
,
String
quantity_density_code
)
{
this
.
ver
=
ver
;
this
.
waybillNum
=
waybillNum
;
this
.
origin
=
origin
;
this
.
destination
=
destination
;
this
.
quantity_picecs
=
quantity_picecs
;
this
.
quantity_weight
=
quantity_weight
;
this
.
quantity_weight_code
=
quantity_weight_code
;
this
.
quantity_volume
=
quantity_volume
;
this
.
quantity_volume_code
=
quantity_volume_code
;
this
.
quantity_density
=
quantity_density
;
this
.
quantity_density_code
=
quantity_density_code
;
}
@Override
public
String
getFWBNodeText
()
throws
FWBException
{
String
SPLIT_CODE
=
"/"
;
String
CRLF
=
"\n"
;
StringBuilder
sb
=
new
StringBuilder
(
""
);
sb
.
append
(
getWaybillNum
()).
append
(
getOrigin
()).
append
(
getDestination
())
.
append
(
SPLIT_CODE
).
append
(
"T"
).
append
(
getQuantity_picecs
())
.
append
(
getQuantity_weight_code
()).
append
(
getQuantity_weight
());
if
(
hasText
(
getQuantity_volume
())){
sb
.
append
(
getQuantity_volume_code
()).
append
(
getQuantity_volume
());
}
if
(
hasText
(
getQuantity_density
())){
sb
.
append
(
getQuantity_density_code
()).
append
(
getQuantity_density
());
}
sb
.
append
(
CRLF
);
return
sb
.
toString
();
}
@Override
public
String
getNodeName
()
{
return
"FWB/"
+
ver
+
"\n"
;
}
}
...
...
src/main/java/com/sunyo/wlpt/base/model/efreight/fwb/FWB_CER.java
查看文件 @
cc42845
...
...
@@ -30,6 +30,13 @@ public class FWB_CER extends BASE implements FWB_BASE{
*/
private
String
cer_signature
;
public
FWB_CER
()
{
}
public
FWB_CER
(
String
cer_signature
)
{
this
.
cer_signature
=
cer_signature
;
}
public
String
getCer_signature
()
throws
FWBException
{
String
patternStr
=
"^[A-Z0-9-<=/\\s\\.]{0,20}$"
;
...
...
src/main/java/com/sunyo/wlpt/base/model/efreight/fwb/FWB_CNE.java
查看文件 @
cc42845
...
...
@@ -4,6 +4,7 @@ import com.sunyo.wlpt.base.model.efreight.BASE;
import
com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBException
;
import
com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBExceptionType
;
import
java.util.List
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
...
...
@@ -51,18 +52,8 @@ public class FWB_CNE extends BASE implements FWB_BASE {
* [A-Z0-9-<=/\s\.]{0,9}
*/
private
String
cne_postcode
=
""
;
/**
* 收货人联系方式类别
* FX|TE|TL
* 传真|电话|电传(电报)
* 可重复未标识重复次数
*/
private
String
cne_contact_id
;
/**
* 收货人联系方式具体信息(号码)
* [A-Z0-9]{1,25}
*/
private
String
cne_contact_number
;
private
List
<
SHP_CNE_CONTACT
>
contacts
;
public
String
getCne_account_number
()
throws
FWBException
{
...
...
@@ -97,7 +88,7 @@ public class FWB_CNE extends BASE implements FWB_BASE {
public
String
getCne_adr
()
throws
FWBException
{
String
patternStr
=
"^[A-Z0-9-<=/\\s\\.]{
0
,35}$"
;
String
patternStr
=
"^[A-Z0-9-<=/\\s\\.]{
1
,35}$"
;
Pattern
pattern
=
Pattern
.
compile
(
patternStr
);
Matcher
matcher
=
pattern
.
matcher
(
cne_adr
);
if
(!
matcher
.
find
()){
...
...
@@ -170,33 +161,25 @@ public class FWB_CNE extends BASE implements FWB_BASE {
this
.
cne_postcode
=
cne_postcode
;
}
public
String
getCne_contact_id
()
throws
FWBException
{
String
patternStr
=
"^FX|TE|TL$"
;
Pattern
pattern
=
Pattern
.
compile
(
patternStr
);
Matcher
matcher
=
pattern
.
matcher
(
cne_contact_id
);
if
(!
matcher
.
find
()){
throw
new
FWBException
(
FWBExceptionType
.
FWB_CNE_CID_ERR
);
}
return
cne_contact_id
;
public
List
<
SHP_CNE_CONTACT
>
getContacts
()
{
return
contacts
;
}
public
void
setCne_contact_id
(
String
cne_contact_id
)
{
this
.
cne_contact_id
=
cne_contact_id
;
public
void
setContacts
(
List
<
SHP_CNE_CONTACT
>
contacts
)
{
this
.
contacts
=
contacts
;
}
public
String
getCne_contact_number
()
throws
FWBException
{
String
patternStr
=
"^[A-Z0-9]{1,25}$"
;
Pattern
pattern
=
Pattern
.
compile
(
patternStr
);
Matcher
matcher
=
pattern
.
matcher
(
cne_contact_number
);
if
(!
matcher
.
find
()){
throw
new
FWBException
(
FWBExceptionType
.
FWB_CNE_CN_ERR
);
}
return
cne_contact_number
;
public
FWB_CNE
()
{
}
public
void
setCne_contact_number
(
String
cne_contact_number
)
{
this
.
cne_contact_number
=
cne_contact_number
;
public
FWB_CNE
(
String
cne_name
,
String
cne_adr
,
String
cne_loc_place
,
String
cne_loc_province
,
String
cne_country
,
String
cne_postcode
,
List
<
SHP_CNE_CONTACT
>
contacts
)
{
this
.
cne_name
=
cne_name
;
this
.
cne_adr
=
cne_adr
;
this
.
cne_loc_place
=
cne_loc_place
;
this
.
cne_loc_province
=
cne_loc_province
;
this
.
cne_country
=
cne_country
;
this
.
cne_postcode
=
cne_postcode
;
this
.
contacts
=
contacts
;
}
@Override
...
...
@@ -219,14 +202,16 @@ public class FWB_CNE extends BASE implements FWB_BASE {
if
(
hasText
(
getCne_postcode
()))
{
sb
.
append
(
SPLIT_CODE
).
append
(
getCne_postcode
());
}
else
{
if
(
hasText
(
getCne_contact_number
()
)){
if
(
contacts
!=
null
&&
!
contacts
.
isEmpty
(
)){
sb
.
append
(
SPLIT_CODE
);
}
}
//联系方式可重复不限次数,todo:处理这种联系方式 有多个信息的
if
(
hasText
(
getCne_contact_number
())){
sb
.
append
(
SPLIT_CODE
).
append
(
getCne_contact_id
()).
append
(
SPLIT_CODE
).
append
(
getCne_contact_number
());
if
(
contacts
!=
null
&&
!
contacts
.
isEmpty
()){
for
(
SHP_CNE_CONTACT
item
:
contacts
)
{
sb
.
append
(
SPLIT_CODE
).
append
(
item
.
getContact_id
()).
append
(
SPLIT_CODE
).
append
(
item
.
getContact_number
());
}
}
//todo:此节点循环的报文内容获取方式
...
...
src/main/java/com/sunyo/wlpt/base/model/efreight/fwb/FWB_CVD.java
查看文件 @
cc42845
...
...
@@ -163,6 +163,19 @@ public class FWB_CVD extends BASE implements FWB_BASE{
this
.
cvd_amount_of_insurance
=
cvd_amount_of_insurance
;
}
public
FWB_CVD
()
{
}
public
FWB_CVD
(
String
cvd_currency_code
,
String
cvd_charge_code
,
String
cvd_charge_prepaid
,
String
cvd_value_for_carriage
,
String
cvd_value_for_customs
,
String
cvd_amount_of_insurance
)
{
this
.
cvd_currency_code
=
cvd_currency_code
;
this
.
cvd_charge_code
=
cvd_charge_code
;
this
.
cvd_charge_prepaid
=
cvd_charge_prepaid
;
this
.
cvd_value_for_carriage
=
cvd_value_for_carriage
;
this
.
cvd_value_for_customs
=
cvd_value_for_customs
;
this
.
cvd_amount_of_insurance
=
cvd_amount_of_insurance
;
}
@Override
public
String
getFWBNodeText
()
throws
FWBException
{
String
SPLIT_CODE
=
"/"
;
...
...
src/main/java/com/sunyo/wlpt/base/model/efreight/fwb/FWB_FLT.java
查看文件 @
cc42845
...
...
@@ -75,6 +75,16 @@ public class FWB_FLT extends BASE implements FWB_BASE {
this
.
day
=
day
;
}
public
FWB_FLT
(){
}
public
FWB_FLT
(
String
cariier
,
String
flightNumber
,
String
day
)
{
this
.
cariier
=
cariier
;
this
.
flightNumber
=
flightNumber
;
this
.
day
=
day
;
}
@Override
public
String
getFWBNodeText
()
throws
FWBException
{
String
SPLIT_CODE
=
"/"
;
...
...
@@ -87,7 +97,7 @@ public class FWB_FLT extends BASE implements FWB_BASE {
//todo:此节点循环的报文内容获取方式
//
sb.append(CRLF);
sb
.
append
(
CRLF
);
return
sb
.
toString
();
}
...
...
src/main/java/com/sunyo/wlpt/base/model/efreight/fwb/FWB_ISU.java
查看文件 @
cc42845
...
...
@@ -53,6 +53,17 @@ public class FWB_ISU extends BASE implements FWB_BASE{
*/
private
String
isu_signature
;
public
FWB_ISU
()
{
}
public
FWB_ISU
(
String
isu_day_mounth_year
,
String
isu_place_or_airport_code
,
String
isu_signature
)
{
this
.
isu_day_mounth_year
=
isu_day_mounth_year
;
this
.
isu_place_or_airport_code
=
isu_place_or_airport_code
;
this
.
isu_signature
=
isu_signature
;
}
public
String
getIsu_day_mounth_year
()
throws
FWBException
{
String
patternStr
=
"^[0-9]{2}[A-Z]{3}[0-9]{2}$"
;
Pattern
pattern
=
Pattern
.
compile
(
patternStr
);
...
...
src/main/java/com/sunyo/wlpt/base/model/efreight/fwb/FWB_NFY.java
查看文件 @
cc42845
...
...
@@ -4,6 +4,7 @@ import com.sunyo.wlpt.base.model.efreight.BASE;
import
com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBException
;
import
com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBExceptionType
;
import
java.util.List
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
...
...
@@ -62,19 +63,8 @@ public class FWB_NFY extends BASE implements FWB_BASE {
* O 可选
*/
private
String
nfy_postcode
;
/**
* Contact Detail 可重复多次
* 联系方式代码
* TE|FX|TL
* M
*/
private
String
nfy_contact_id
;
/**
* 联系方式号码
* [A-Z0-9]{1,25}
* M
*/
private
String
nfy_contact_NUM
;
private
List
<
SHP_CNE_CONTACT
>
contacts
;
public
String
getNfy_name
()
throws
FWBException
{
String
patternStr
=
"^[A-Z0-9-<=/\\s\\.]{0,35}$"
;
...
...
@@ -160,32 +150,12 @@ public class FWB_NFY extends BASE implements FWB_BASE {
this
.
nfy_postcode
=
nfy_postcode
;
}
public
String
getNfy_contact_id
()
throws
FWBException
{
String
patternStr
=
"^FX|TE|TL$"
;
Pattern
pattern
=
Pattern
.
compile
(
patternStr
);
Matcher
matcher
=
pattern
.
matcher
(
nfy_contact_id
);
if
(!
matcher
.
find
()){
throw
new
FWBException
(
FWBExceptionType
.
FWB_NFY_CID_ERR
);
}
return
nfy_contact_id
;
}
public
void
setNfy_contact_id
(
String
nfy_contact_id
)
{
this
.
nfy_contact_id
=
nfy_contact_id
;
public
List
<
SHP_CNE_CONTACT
>
getContacts
()
{
return
contacts
;
}
public
String
getNfy_contact_NUM
()
throws
FWBException
{
String
patternStr
=
"^[A-Z0-9]{1,25}$"
;
Pattern
pattern
=
Pattern
.
compile
(
patternStr
);
Matcher
matcher
=
pattern
.
matcher
(
nfy_contact_NUM
);
if
(!
matcher
.
find
()){
throw
new
FWBException
(
FWBExceptionType
.
FWB_NFY_CN_ERR
);
}
return
nfy_contact_NUM
;
}
public
void
setNfy_contact_NUM
(
String
nfy_contact_NUM
)
{
this
.
nfy_contact_NUM
=
nfy_contact_NUM
;
public
void
setContacts
(
List
<
SHP_CNE_CONTACT
>
contacts
)
{
this
.
contacts
=
contacts
;
}
@Override
...
...
@@ -209,13 +179,15 @@ public class FWB_NFY extends BASE implements FWB_BASE {
if
(
hasText
(
nfy_postcode
)){
sb
.
append
(
SPLIT_CODE
).
append
(
getNfy_postcode
());
}
else
{
if
(
hasText
(
nfy_contact_NUM
)){
if
(
contacts
!=
null
&&
!
contacts
.
isEmpty
(
)){
sb
.
append
(
SPLIT_CODE
);
}
}
if
(
hasText
(
nfy_contact_NUM
)){
sb
.
append
(
SPLIT_CODE
).
append
(
getNfy_contact_id
()).
append
(
SPLIT_CODE
).
append
(
getNfy_contact_NUM
());
if
(
contacts
!=
null
&&
!
contacts
.
isEmpty
()){
for
(
SHP_CNE_CONTACT
item
:
contacts
)
{
sb
.
append
(
SPLIT_CODE
).
append
(
item
.
getContact_id
()).
append
(
SPLIT_CODE
).
append
(
item
.
getContact_number
());
}
}
sb
.
append
(
CRLF
);
...
...
src/main/java/com/sunyo/wlpt/base/model/efreight/fwb/FWB_OCI.java
查看文件 @
cc42845
...
...
@@ -73,6 +73,16 @@ public class FWB_OCI implements FWB_BASE {
private
String
oci_csrc_info
=
""
;
public
FWB_OCI
()
{
}
public
FWB_OCI
(
String
oci_country_code
,
String
oci_information_id
,
String
oci_csrc_id
,
String
oci_csrc_info
)
{
this
.
oci_country_code
=
oci_country_code
;
this
.
oci_information_id
=
oci_information_id
;
this
.
oci_csrc_id
=
oci_csrc_id
;
this
.
oci_csrc_info
=
oci_csrc_info
;
}
/**
* ---------------------------------------------------------------------------------------------------
*
...
...
@@ -127,11 +137,16 @@ public class FWB_OCI implements FWB_BASE {
*/
public
String
getOci_csrc_info
()
throws
FWBException
{
if
(
StringUtils
.
hasText
(
oci_csrc_info
)){
if
(
!
StringUtils
.
hasLength
(
this
.
oci_csrc_id
)
){
if
(!
StringUtils
.
hasLength
(
this
.
oci_csrc_id
)){
throw
new
FWBException
(
FWBExceptionType
.
OCI_CSRC_ERROR
);
}
String
patternStr
=
"^[A-Z0-9<=/\\s\\.\\-]{1,35}$"
;
Pattern
pattern
=
Pattern
.
compile
(
patternStr
);
Matcher
matcher
=
pattern
.
matcher
(
oci_csrc_info
);
if
(!
matcher
.
find
()){
throw
new
FWBException
(
FWBExceptionType
.
OCI_CSRCI_ERROR
,
oci_csrc_info
);
}
}
return
oci_csrc_info
;
...
...
@@ -148,7 +163,6 @@ public class FWB_OCI implements FWB_BASE {
String
CRLF
=
"\n"
;
StringBuilder
sb
=
new
StringBuilder
(
""
);
if
(
StringUtils
.
hasLength
(
getOci_csrc_info
())){
sb
.
append
(
getNodeName
());
sb
.
append
(
SPLIT_CODE
)
.
append
(
getOci_country_code
())
.
append
(
SPLIT_CODE
)
...
...
src/main/java/com/sunyo/wlpt/base/model/efreight/fwb/FWB_OSI.java
查看文件 @
cc42845
...
...
@@ -5,6 +5,7 @@ import com.sunyo.wlpt.base.model.efreight.BASE;
import
com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBException
;
import
com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBExceptionType
;
import
java.util.List
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
...
...
@@ -33,19 +34,24 @@ public class FWB_OSI extends BASE implements FWB_BASE{
* OSI/ZV EA FILED SPX PER ATTACHED LIST CH RA 00195-01 31-05-23 13 27
* /ZV EA FILED SPX PER ATTACHED LIST CH RA 00195-01 31-05-23 16 46
*/
private
String
osi_text
;
private
List
<
String
>
osi_text
;
public
String
getOsi_text
()
throws
FWBException
{
public
List
<
String
>
getOsi_text
()
throws
FWBException
{
if
(
osi_text
!=
null
&&
!
osi_text
.
isEmpty
()){
String
patternStr
=
"^[A-Z0-9-<=/\\s\\.]{1,65}$"
;
Pattern
pattern
=
Pattern
.
compile
(
patternStr
);
Matcher
matcher
=
pattern
.
matcher
(
osi_text
);
for
(
String
item
:
osi_text
)
{
Matcher
matcher
=
pattern
.
matcher
(
item
);
if
(!
matcher
.
find
()){
throw
new
FWBException
(
FWBExceptionType
.
OSI_TEXT_ERROR
);
throw
new
FWBException
(
FWBExceptionType
.
OSI_TEXT_ERROR
,
item
);
}
}
}
return
osi_text
;
}
public
void
setOsi_text
(
String
osi_text
)
{
public
void
setOsi_text
(
List
<
String
>
osi_text
)
{
this
.
osi_text
=
osi_text
;
}
...
...
@@ -56,12 +62,11 @@ public class FWB_OSI extends BASE implements FWB_BASE{
String
CRLF
=
"\n"
;
StringBuilder
sb
=
new
StringBuilder
(
""
);
if
(
hasText
(
osi_text
)){
sb
.
append
(
getNodeName
())
.
append
(
SPLIT_CODE
).
append
(
getOsi_text
());
if
(
osi_text
!=
null
&&
!
osi_text
.
isEmpty
()){
for
(
String
item
:
osi_text
)
{
sb
.
append
(
SPLIT_CODE
).
append
(
item
).
append
(
CRLF
);
}
sb
.
append
(
CRLF
);
}
...
...
src/main/java/com/sunyo/wlpt/base/model/efreight/fwb/FWB_REF.java
查看文件 @
cc42845
...
...
@@ -79,6 +79,14 @@ public class FWB_REF implements FWB_BASE{
*/
private
String
ref_participant_airport
=
""
;
public
FWB_REF
()
{
}
public
FWB_REF
(
String
ref_address
)
{
this
.
ref_address
=
ref_address
;
}
public
String
getRef_address
()
throws
FWBException
{
if
(!
StringUtils
.
hasText
(
ref_address
)){
throw
new
FWBException
(
FWBExceptionType
.
REF_ERROR
);
...
...
@@ -177,9 +185,11 @@ public class FWB_REF implements FWB_BASE{
if
(
StringUtils
.
hasText
(
getRef_file_reference
())){
sb
.
append
(
SPLIT_CODE
)
.
append
(
getRef_file_reference
());
}
else
{
sb
.
append
(
SPLIT_CODE
);
}
//todo:这里有BUG
// else {
// sb.append(SPLIT_CODE);
// }
if
(
StringUtils
.
hasText
(
getRef_participant_id
())
&&
StringUtils
.
hasText
(
getRef_participant_code
())
...
...
src/main/java/com/sunyo/wlpt/base/model/efreight/fwb/FWB_RTD.java
查看文件 @
cc42845
...
...
@@ -277,6 +277,25 @@ public class FWB_RTD extends BASE implements FWB_BASE{
this
.
rtd_volume
=
rtd_volume
;
}
public
FWB_RTD
()
{
}
public
FWB_RTD
(
String
rtd_number_pieces
,
String
rtd_combination_point
,
String
rtd_gross_weight
,
String
rtd_rate_class
,
String
rtd_commodity_NUM
,
String
rtd_charge_weight
,
String
rtd_rate_charge
,
String
rtd_total
,
String
rtd_goods_DES
,
String
rtd_goods_consol_DES
,
List
<
FWB_RTD_Dimension
>
dimensions
,
String
rtd_volume_code
,
String
rtd_volume
)
{
this
.
rtd_number_pieces
=
rtd_number_pieces
;
this
.
rtd_combination_point
=
rtd_combination_point
;
this
.
rtd_gross_weight
=
rtd_gross_weight
;
this
.
rtd_rate_class
=
rtd_rate_class
;
this
.
rtd_commodity_NUM
=
rtd_commodity_NUM
;
this
.
rtd_charge_weight
=
rtd_charge_weight
;
this
.
rtd_rate_charge
=
rtd_rate_charge
;
this
.
rtd_total
=
rtd_total
;
this
.
rtd_goods_DES
=
rtd_goods_DES
;
this
.
rtd_goods_consol_DES
=
rtd_goods_consol_DES
;
this
.
dimensions
=
dimensions
;
this
.
rtd_volume_code
=
rtd_volume_code
;
this
.
rtd_volume
=
rtd_volume
;
}
//todo: 还有NU,NS,NH,NO等信息后面完善
@Override
...
...
src/main/java/com/sunyo/wlpt/base/model/efreight/fwb/FWB_RTG.java
查看文件 @
cc42845
...
...
@@ -94,7 +94,14 @@ public class FWB_RTG extends BASE implements FWB_BASE {
public
void
setOnwardCarrier
(
String
onwardCarrier
)
{
this
.
onwardCarrier
=
onwardCarrier
;
}
public
FWB_RTG
(){
}
public
FWB_RTG
(
String
destinationAirport
,
String
destinationCarrier
)
{
this
.
destinationAirport
=
destinationAirport
;
this
.
destinationCarrier
=
destinationCarrier
;
}
@Override
public
String
getFWBNodeText
()
throws
FWBException
{
...
...
@@ -115,7 +122,7 @@ public class FWB_RTG extends BASE implements FWB_BASE {
//todo:此节点循环的报文内容获取方式
//
sb.append(CRLF);
sb
.
append
(
CRLF
);
return
sb
.
toString
();
}
...
...
src/main/java/com/sunyo/wlpt/base/model/efreight/fwb/FWB_SHP.java
查看文件 @
cc42845
...
...
@@ -4,6 +4,7 @@ import com.sunyo.wlpt.base.model.efreight.BASE;
import
com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBException
;
import
com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBExceptionType
;
import
java.util.List
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
...
...
@@ -50,18 +51,9 @@ public class FWB_SHP extends BASE implements FWB_BASE {
* [A-Z0-9-<=/\s\.]{0,9}
*/
private
String
shp_postcode
;
/**
* 发货人联系方式类别
* FX|TE|TL
* 传真|电话|电传(电报)
* 可重复未标识重复次数
*/
private
String
shp_contact_id
;
/**
* 发货人联系方式具体信息(号码)
* [A-Z0-9]{1,25}
*/
private
String
shp_contact_number
;
private
List
<
SHP_CNE_CONTACT
>
contacts
;
...
...
@@ -166,32 +158,37 @@ public class FWB_SHP extends BASE implements FWB_BASE {
this
.
shp_postcode
=
shp_postcode
;
}
public
String
getShp_contact_id
()
throws
FWBException
{
String
patternStr
=
"^FX|TE|TL$"
;
Pattern
pattern
=
Pattern
.
compile
(
patternStr
);
Matcher
matcher
=
pattern
.
matcher
(
shp_contact_id
);
if
(!
matcher
.
find
()){
throw
new
FWBException
(
FWBExceptionType
.
FWB_SHP_CID_ERR
);
}
return
shp_contact_id
;
}
public
void
setShp_contact_id
(
String
shp_contact_id
)
{
this
.
shp_contact_id
=
shp_contact_id
;
public
List
<
SHP_CNE_CONTACT
>
getContacts
()
{
return
contacts
;
}
public
String
getShp_contact_number
()
throws
FWBException
{
String
patternStr
=
"^[A-Z0-9]{1,25}$"
;
Pattern
pattern
=
Pattern
.
compile
(
patternStr
);
Matcher
matcher
=
pattern
.
matcher
(
shp_contact_number
);
if
(!
matcher
.
find
()){
throw
new
FWBException
(
FWBExceptionType
.
FWB_SHP_CN_ERR
);
public
void
setContacts
(
List
<
SHP_CNE_CONTACT
>
contacts
)
{
this
.
contacts
=
contacts
;
}
return
shp_contact_number
;
public
FWB_SHP
()
{
}
public
void
setShp_contact_number
(
String
shp_contact_number
)
{
this
.
shp_contact_number
=
shp_contact_number
;
/**
*
* @param shp_name 名称
* @param shp_adr 地址
* @param shp_loc_place 城市
* @param shp_loc_province 省
* @param shp_country 国家
* @param shp_postcode 邮编
* @param contacts 联系信息
*/
public
FWB_SHP
(
String
shp_name
,
String
shp_adr
,
String
shp_loc_place
,
String
shp_loc_province
,
String
shp_country
,
String
shp_postcode
,
List
<
SHP_CNE_CONTACT
>
contacts
)
{
this
.
shp_name
=
shp_name
;
this
.
shp_adr
=
shp_adr
;
this
.
shp_loc_place
=
shp_loc_place
;
this
.
shp_loc_province
=
shp_loc_province
;
this
.
shp_country
=
shp_country
;
this
.
shp_postcode
=
shp_postcode
;
this
.
contacts
=
contacts
;
}
@Override
...
...
@@ -214,16 +211,17 @@ public class FWB_SHP extends BASE implements FWB_BASE {
if
(
hasText
(
shp_postcode
))
{
sb
.
append
(
SPLIT_CODE
).
append
(
getShp_postcode
());
}
else
{
if
(
hasText
(
shp_contact_number
)){
if
(
contacts
!=
null
&&
!
contacts
.
isEmpty
(
)){
sb
.
append
(
SPLIT_CODE
);
}
}
//联系方式可重复不限次数,todo:处理这种联系方式 有多个信息的
if
(
hasText
(
shp_contact_number
)){
sb
.
append
(
SPLIT_CODE
).
append
(
getShp_contact_id
()).
append
(
SPLIT_CODE
).
append
(
getShp_contact_number
());
//联系方式可重复不限次数
if
(
contacts
!=
null
&&
!
contacts
.
isEmpty
()){
for
(
SHP_CNE_CONTACT
item
:
contacts
)
{
sb
.
append
(
SPLIT_CODE
).
append
(
item
.
getContact_id
()).
append
(
SPLIT_CODE
).
append
(
item
.
getContact_number
());
}
}
//todo:此节点循环的报文内容获取方式
sb
.
append
(
CRLF
);
...
...
src/main/java/com/sunyo/wlpt/base/model/efreight/fwb/FWB_SSR.java
查看文件 @
cc42845
...
...
@@ -4,6 +4,7 @@ import com.sunyo.wlpt.base.model.efreight.BASE;
import
com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBException
;
import
com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBExceptionType
;
import
java.util.List
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
...
...
@@ -21,21 +22,26 @@ public class FWB_SSR extends BASE implements FWB_BASE {
* 特殊服务请求内容
* [A-Z0-9-<=/\s\.]{0,65}
*/
private
String
ssr_request_content
;
private
List
<
String
>
ssr_request_content
;
public
String
getSsr_request_content
()
throws
FWBException
{
public
List
<
String
>
getSsr_request_content
()
throws
FWBException
{
if
(
ssr_request_content
!=
null
&&
!
ssr_request_content
.
isEmpty
()){
String
patternStr
=
"^[A-Z0-9-<=/\\s\\.]{0,65}$"
;
Pattern
pattern
=
Pattern
.
compile
(
patternStr
);
Matcher
matcher
=
pattern
.
matcher
(
ssr_request_content
);
for
(
String
item
:
ssr_request_content
)
{
Matcher
matcher
=
pattern
.
matcher
(
item
);
if
(!
matcher
.
find
()){
throw
new
FWBException
(
FWBExceptionType
.
FWB_SSR_CONT_ERR
);
throw
new
FWBException
(
FWBExceptionType
.
FWB_SSR_CONT_ERR
,
item
);
}
}
}
return
ssr_request_content
;
}
public
void
setSsr_request_content
(
String
ssr_request_content
)
{
public
void
setSsr_request_content
(
List
<
String
>
ssr_request_content
)
{
this
.
ssr_request_content
=
ssr_request_content
;
}
...
...
@@ -45,11 +51,13 @@ public class FWB_SSR extends BASE implements FWB_BASE {
String
CRLF
=
"\n"
;
StringBuilder
sb
=
new
StringBuilder
(
""
);
if
(
hasText
(
ssr_request_content
)){
if
(
ssr_request_content
!=
null
&&
!
ssr_request_content
.
isEmpty
(
)){
sb
.
append
(
getNodeName
());
sb
.
append
(
SPLIT_CODE
).
append
(
getSsr_request_content
());
for
(
String
item
:
ssr_request_content
)
{
sb
.
append
(
SPLIT_CODE
).
append
(
item
);
sb
.
append
(
CRLF
);
}
}
return
sb
.
toString
();
}
...
...
src/main/java/com/sunyo/wlpt/base/model/efreight/fwb/SHP_CNE_CONTACT.java
0 → 100644
查看文件 @
cc42845
package
com
.
sunyo
.
wlpt
.
base
.
model
.
efreight
.
fwb
;
import
com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBException
;
import
com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBExceptionType
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
/**
* 收发货人共用联系方式实体
*/
public
class
SHP_CNE_CONTACT
{
/**
* 发货人联系方式类别
* FX|TE|TL
* 传真|电话|电传(电报)
* 可重复未标识重复次数
*/
private
String
contact_id
;
/**
* 发货人联系方式具体信息(号码)
* [A-Z0-9]{1,25}
*/
private
String
contact_number
;
public
String
getContact_id
()
throws
FWBException
{
String
patternStr
=
"^FX|TE|TL$"
;
Pattern
pattern
=
Pattern
.
compile
(
patternStr
);
Matcher
matcher
=
pattern
.
matcher
(
contact_id
);
if
(!
matcher
.
find
()){
throw
new
FWBException
(
FWBExceptionType
.
FWB_SHP_CID_ERR
,
contact_id
);
}
return
contact_id
;
}
public
void
setContact_id
(
String
contact_id
)
{
this
.
contact_id
=
contact_id
;
}
public
String
getContact_number
()
throws
FWBException
{
String
patternStr
=
"^[A-Z0-9]{1,25}$"
;
Pattern
pattern
=
Pattern
.
compile
(
patternStr
);
Matcher
matcher
=
pattern
.
matcher
(
contact_number
);
if
(!
matcher
.
find
()){
throw
new
FWBException
(
FWBExceptionType
.
FWB_SHP_CN_ERR
);
}
return
contact_number
;
}
public
void
setContact_number
(
String
contact_number
)
{
this
.
contact_number
=
contact_number
;
}
public
SHP_CNE_CONTACT
()
{
}
public
SHP_CNE_CONTACT
(
String
contact_id
,
String
contact_number
)
{
this
.
contact_id
=
contact_id
;
this
.
contact_number
=
contact_number
;
}
}
...
...
src/main/java/com/sunyo/wlpt/base/model/efreight/fwb/exception/FWBExceptionType.java
查看文件 @
cc42845
...
...
@@ -39,8 +39,8 @@ public enum FWBExceptionType {
FWB_SHP_PVC_ERR
(
"565"
,
"发货人省份信息格式有误"
),
FWB_SHP_CNT_ERR
(
"572"
,
"发货人国家信息格式有误"
),
FWB_SHP_PC_ERR
(
"573"
,
"发货人邮编信息格式有误"
),
FWB_SHP_CID_ERR
(
"582"
,
"发货人联系方式代码格式有误"
),
FWB_SHP_CN_ERR
(
"584"
,
"发货人联系方式信息格式有误"
),
FWB_SHP_CID_ERR
(
"582"
,
"收发货人联系方式代码格式有误"
),
FWB_SHP_CN_ERR
(
"584"
,
"收发货人联系方式信息格式有误"
),
FWB_CNE_ACC_ERR
(
"622"
,
"收货人账号信息格式有误"
),
FWB_CNE_NAME_ERR
(
"643"
,
"收货人名称信息格式有误"
),
...
...
@@ -49,8 +49,6 @@ public enum FWBExceptionType {
FWB_CNE_PVC_ERR
(
"665"
,
"收货人省份信息格式有误"
),
FWB_CNE_CNT_ERR
(
"672"
,
"收货人国家信息格式有误"
),
FWB_CNE_PC_ERR
(
"673"
,
"收货人邮编信息格式有误"
),
FWB_CNE_CID_ERR
(
"682"
,
"收货人联系方式代码格式有误"
),
FWB_CNE_CN_ERR
(
"684"
,
"收货人联系方式信息格式有误"
),
FWB_AGT_ACC_ERR
(
"722"
,
"代理人账号信息格式有误"
),
...
...
@@ -107,7 +105,8 @@ public enum FWBExceptionType {
SPH_CODE_FAILD
(
"2522"
,
"SPH-代码格式信息有误"
),
OCI_CSRC_ERROR
(
"2970"
,
"缺少 Other Customs,Security And Regulatory Control Information Identifier"
);
OCI_CSRC_ERROR
(
"2970"
,
"缺少 Other Customs,Security And Regulatory Control Information Identifier"
),
OCI_CSRCI_ERROR
(
"2990"
,
"缺少 Other Customs,Security And Regulatory Control Information"
);
/**
* 参照字典FWB节点位置
...
...
src/test/java/FWB_804_31118511.java
查看文件 @
cc42845
...
...
@@ -37,15 +37,15 @@ public class FWB_804_31118511 {
}
static
String
FWB_WAYBILL_TEST
(){
FWB
fwb
=
new
FWB
();
fwb
.
setWaybillNum
(
"804-31118485"
);
FWB_Bill
fwb
=
new
FWB_Bill
();
fwb
.
setWaybillNum
(
"804-31118146"
);
fwb
.
setOrigin
(
"CGO"
);
fwb
.
setDestination
(
"ICN"
);
fwb
.
setQuantity_picecs
(
"
2
"
);
fwb
.
setQuantity_picecs
(
"
170
"
);
fwb
.
setQuantity_weight_code
(
"K"
);
fwb
.
setQuantity_weight
(
"10"
);
fwb
.
setQuantity_weight
(
"1
65
0"
);
fwb
.
setQuantity_volume_code
(
"MC"
);
fwb
.
setQuantity_volume
(
"
0.10
"
);
fwb
.
setQuantity_volume
(
"
5.97
"
);
// fwb.setQuantity_density("22");
try
{
...
...
@@ -63,7 +63,7 @@ public class FWB_804_31118511 {
FWB_FLT
flt
=
new
FWB_FLT
();
flt
.
setCariier
(
"CF"
);
flt
.
setFlightNumber
(
"221"
);
flt
.
setDay
(
"1
3
"
);
flt
.
setDay
(
"1
5
"
);
try
{
String
nodeText
=
flt
.
getNodeName
()
+
flt
.
getFWBNodeText
()
+
"\n"
;
...
...
@@ -93,15 +93,13 @@ public class FWB_804_31118511 {
static
String
FWB_SHP_TEST
(){
FWB_SHP
var
=
new
FWB_SHP
();
var
.
setShp_name
(
"
MCL ELECTRONIC MATERIALS
CO LTD"
);
var
.
setShp_name
(
"
TIANSHUI HUATIAN TECHNOLOGY
CO LTD"
);
// var.setShp_account_number("ABC");
var
.
setShp_adr
(
"NO99 BINHEBEI ROAD GAOXIN DISTRICT"
);
var
.
setShp_loc_place
(
"LUOYANG"
);
var
.
setShp_loc_province
(
"HENAN"
);
var
.
setShp_adr
(
"NO14 SHUANGQIAO ROAD QINZHOU TOWN"
);
var
.
setShp_loc_place
(
"TIANSHUI"
);
var
.
setShp_loc_province
(
"GANSU"
);
var
.
setShp_country
(
"CN"
);
var
.
setShp_postcode
(
"471000"
);
var
.
setShp_contact_id
(
"TE"
);
var
.
setShp_contact_number
(
"86037963390432"
);
var
.
setShp_postcode
(
"741000"
);
try
{
...
...
@@ -115,15 +113,14 @@ public class FWB_804_31118511 {
static
String
FWB_CNE_TEST
(){
FWB_CNE
var
=
new
FWB_CNE
();
var
.
setCne_name
(
"
EASY TRADING CO LTD
"
);
var
.
setCne_name
(
"
HUATIAN KOREA CORPORATION
"
);
// var.setShp_account_number("ABC");
var
.
setCne_adr
(
"201 111 BALLYONG RO DEOKJIN GU"
);
var
.
setCne_loc_place
(
"JEONJU SI"
);
var
.
setCne_adr
(
"RM 401 4TH FL 55 SEONGSUIL RO"
);
var
.
setCne_loc_place
(
"SEOUL"
);
// var.setCne_loc_province("HENAN");
var
.
setCne_country
(
"KR"
);
var
.
setCne_postcode
(
"54853"
);
var
.
setCne_contact_id
(
"TE"
);
var
.
setCne_contact_number
(
"82637143737"
);
var
.
setCne_postcode
(
"121842"
);
try
{
...
...
@@ -220,25 +217,27 @@ public class FWB_804_31118511 {
static
String
FWB_RTD_TEST
(){
//todo:做个计费单价x计费重量 与 total 总价的对比验证
FWB_RTD
var
=
new
FWB_RTD
();
var
.
setRtd_number_pieces
(
"2"
);
var
.
setRtd_gross_weight
(
"10"
);
var
.
setRtd_number_pieces
(
"170"
);
var
.
setRtd_gross_weight
(
"1650"
);
var
.
setRtd_rate_class
(
"Q"
);
// var.setRtd_commodity_NUM("12398");
var
.
setRtd_charge_weight
(
"
45
"
);
var
.
setRtd_charge_weight
(
"
1650
"
);
var
.
setRtd_rate_charge
(
"14.32"
);
var
.
setRtd_total
(
"644.40"
);
var
.
setRtd_goods_DES
(
"POLISHED SILICON WAFER"
);
var
.
setRtd_total
(
"23628.00"
);
var
.
setRtd_goods_DES
(
"INTEGRATED CIRCUIT"
);
// var.setRtd_goods_consol_DES("CONSOL");
// var.setRtd_goods_DIM_weightcode("W");
// var.setRtd_goods_DIM_weight("302.33");
List
<
FWB_RTD_Dimension
>
measurement_list
=
new
ArrayList
();
measurement_list
.
add
(
new
FWB_RTD_Dimension
(
"136.73"
,
"47-42-26/4"
));
measurement_list
.
add
(
new
FWB_RTD_Dimension
(
"22.08"
,
"27-33-44/1"
));
measurement_list
.
add
(
new
FWB_RTD_Dimension
(
""
,
"34-40-29/36"
));
measurement_list
.
add
(
new
FWB_RTD_Dimension
(
""
,
"36-36-22/66"
));
measurement_list
.
add
(
new
FWB_RTD_Dimension
(
""
,
"36-43-37/19"
));
measurement_list
.
add
(
new
FWB_RTD_Dimension
(
""
,
"58-28-20/48"
));
measurement_list
.
add
(
new
FWB_RTD_Dimension
(
""
,
"56-27-15/1"
));
var
.
setDimensions
(
measurement_list
);
var
.
setRtd_volume_code
(
"MC"
);
var
.
setRtd_volume
(
"
0.10
"
);
var
.
setRtd_volume
(
"
5.97
"
);
try
{
String
nodeText
=
var
.
getFWBNodeText
()
;
return
nodeText
;
...
...
@@ -264,12 +263,12 @@ public class FWB_804_31118511 {
static
String
FWB_PPD_TEST
(){
//todo:做个计费单价x计费重量 与 total 总价的对比验证
FWB_PPD
var
=
new
FWB_PPD
();
var
.
setPpd_weight_amount
(
"1"
);
var
.
setPpd_valuation_amount
(
"2"
);
var
.
setPpd_taxes_amount
(
"3"
);
var
.
setPpd_other_charges_due_agent
(
"4"
);
var
.
setPpd_other_charges_due_carrier
(
"5"
);
var
.
setPpd_charge_summary_total
(
"6"
);
var
.
setPpd_weight_amount
(
"23628.00"
);
// var.setPpd_valuation_amount("2");
// var.setPpd_taxes_amount("3");
// var.setPpd_other_charges_due_agent("4");
// var.setPpd_other_charges_due_carrier("5");
var
.
setPpd_charge_summary_total
(
"23628.00"
);
try
{
String
nodeText
=
var
.
getFWBNodeText
()
;
...
...
@@ -282,7 +281,7 @@ public class FWB_804_31118511 {
static
String
FWB_CER_TEST
(){
FWB_CER
var
=
new
FWB_CER
();
var
.
setCer_signature
(
"
ZHENGZHOU NAVITRAN
S"
);
var
.
setCer_signature
(
"
KERRY EAS LOGISTIC
S"
);
try
{
...
...
@@ -296,7 +295,7 @@ public class FWB_804_31118511 {
static
String
FWB_ISU_TEST
(){
FWB_ISU
var
=
new
FWB_ISU
();
var
.
setIsu_day_mounth_year
(
"1
2
JUL23"
);
var
.
setIsu_day_mounth_year
(
"1
4
JUL23"
);
var
.
setIsu_place_or_airport_code
(
"ZHENGZHOU"
);
// var.setIsu_signature("JUNWEI WANG");
...
...
@@ -333,24 +332,24 @@ public class FWB_804_31118511 {
FWB_OCI
var
=
new
FWB_OCI
();
var
.
setOci_csrc_id
(
"T"
);
var
.
setOci_csrc_info
(
"USCI91
410300623912049A
"
);
var
.
setOci_csrc_info
(
"USCI91
620500756558610D
"
);
var
.
setOci_country_code
(
"CN"
);
var
.
setOci_information_id
(
"SHP"
);
FWB_OCI
var_CP
=
new
FWB_OCI
();
var_CP
.
setOci_csrc_id
(
"CP"
);
var_CP
.
setOci_csrc_info
(
"LI"
);
var_CP
.
setOci_country_code
(
"CN"
);
var_CP
.
setOci_information_id
(
"SHP"
);
// FWB_OCI var_CP = new FWB_OCI();
// var_CP.setOci_csrc_id("CP");
// var_CP.setOci_csrc_info("BRUCE LI");
// var_CP.setOci_country_code("CN");
// var_CP.setOci_information_id("SHP");
FWB_OCI
var_CT
=
new
FWB_OCI
();
var_CT
.
setOci_csrc_id
(
"CT"
);
var_CT
.
setOci_csrc_info
(
"12384511"
);
var_CT
.
setOci_country_code
(
"CN"
);
var_CT
.
setOci_information_id
(
"SHP"
);
var_CT
.
setOci_csrc_id
(
"T"
);
var_CT
.
setOci_csrc_info
(
"CRN546 88 00805"
);
var_CT
.
setOci_country_code
(
"KR"
);
var_CT
.
setOci_information_id
(
"CNE"
);
ociList
.
add
(
var
);
ociList
.
add
(
var_CP
);
//
ociList.add(var_CP);
ociList
.
add
(
var_CT
);
try
{
...
...
src/test/java/FWB_TEST.java
0 → 100644
查看文件 @
cc42845
import
com.sunyo.wlpt.base.model.efreight.fwb.*
;
import
com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBException
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
FWB_TEST
{
public
static
void
main
(
String
[]
args
)
{
FWB
fwb
=
new
FWB
();
fwb
.
bill
=
new
FWB_Bill
(
"16"
,
"804-31118636"
,
"CGO"
,
"ICN"
,
"22"
,
"1540.0"
,
"K"
,
"8.37"
,
"MC"
,
""
,
""
);
fwb
.
flt
=
new
FWB_FLT
(
"CF"
,
"221"
,
"18"
);
fwb
.
rtg
=
new
FWB_RTG
(
"ICN"
,
"CF"
);
//发货人
List
<
SHP_CNE_CONTACT
>
shp_contacts
=
new
ArrayList
<
SHP_CNE_CONTACT
>();
SHP_CNE_CONTACT
shp_cne_te
=
new
SHP_CNE_CONTACT
(
"TE"
,
"008637155528940"
);
SHP_CNE_CONTACT
shp_cne_fx
=
new
SHP_CNE_CONTACT
(
"FX"
,
"86037761367800"
);
shp_contacts
.
add
(
shp_cne_te
);
// shp_contacts.add(shp_cne_fx);
fwb
.
shp
=
new
FWB_SHP
(
"KERRY EAS LOGISTICS LIMITED"
,
"KERRY LOGISTICS PARK 500M EAST"
,
"ZHENGZHOU"
,
"HENAN"
,
"CN"
,
"450000"
,
shp_contacts
);
//收货人
List
<
SHP_CNE_CONTACT
>
cne_contacts
=
new
ArrayList
<
SHP_CNE_CONTACT
>();
SHP_CNE_CONTACT
cne_cne_te
=
new
SHP_CNE_CONTACT
(
"TE"
,
"82312703625"
);
SHP_CNE_CONTACT
cne_cne_fx
=
new
SHP_CNE_CONTACT
(
"FX"
,
"82312703671"
);
cne_contacts
.
add
(
cne_cne_te
);
cne_contacts
.
add
(
cne_cne_fx
);
fwb
.
cne
=
new
FWB_CNE
(
"SAMSUNG ELECTRONICS LOGITECH"
,
"416 MAETAN-DONG YOUNGTONG-GU"
,
"SUWON"
,
""
,
"KR"
,
""
,
cne_contacts
);
fwb
.
agt
=
new
FWB_AGT
();
fwb
.
ssr
=
new
FWB_SSR
();
fwb
.
nfy
=
new
FWB_NFY
();
//ACC
FWB_ACC
fwb_acc
=
new
FWB_ACC
(
"GEN"
,
"FREIGHT PREPAID"
);
List
<
FWB_ACC
>
accList
=
new
ArrayList
<
FWB_ACC
>();
accList
.
add
(
fwb_acc
);
fwb
.
acc
=
accList
;
fwb
.
cvd
=
new
FWB_CVD
(
"CNY"
,
""
,
"PP"
,
"NVD"
,
"NCV"
,
"XXX"
);
//货物计费信息
List
<
FWB_RTD_Dimension
>
dimensions
=
new
ArrayList
<
FWB_RTD_Dimension
>();
FWB_RTD_Dimension
dimension_1
=
new
FWB_RTD_Dimension
(
"33-33-33/13"
);
FWB_RTD_Dimension
dimension_2
=
new
FWB_RTD_Dimension
(
"51-37-22/2"
);
FWB_RTD_Dimension
dimension_3
=
new
FWB_RTD_Dimension
(
"110-110-83/1"
);
FWB_RTD_Dimension
dimension_4
=
new
FWB_RTD_Dimension
(
"110-110-106/2"
);
FWB_RTD_Dimension
dimension_5
=
new
FWB_RTD_Dimension
(
"110-110-113/2"
);
FWB_RTD_Dimension
dimension_6
=
new
FWB_RTD_Dimension
(
"80-120-79/2"
);
dimensions
.
add
(
dimension_1
);
dimensions
.
add
(
dimension_2
);
dimensions
.
add
(
dimension_3
);
dimensions
.
add
(
dimension_4
);
dimensions
.
add
(
dimension_5
);
dimensions
.
add
(
dimension_6
);
fwb
.
rtd
=
new
FWB_RTD
(
"22"
,
""
,
"1540.0"
,
"Q"
,
""
,
"1540.0"
,
"14.32"
,
"22052.80"
,
""
,
"CONSOL"
,
dimensions
,
"MC"
,
"8.37"
);
fwb
.
oth
=
new
FWB_OTH
();
fwb
.
ppd
=
new
FWB_PPD
();
fwb
.
cer
=
new
FWB_CER
(
"KERRY EAS LOGISTICS"
);
fwb
.
isu
=
new
FWB_ISU
(
"17JUL23"
,
"ZHENGZHOU"
,
""
);
fwb
.
osi
=
new
ArrayList
<
FWB_OSI
>();
fwb
.
ref
=
new
FWB_REF
(
"CGOFD1E"
);
List
<
FWB_OCI
>
fwbOciList
=
new
ArrayList
<
FWB_OCI
>();
FWB_OCI
oci_shp_T
=
new
FWB_OCI
(
"CN"
,
"SHP"
,
"T"
,
"USCI91410100712647021U"
);
fwbOciList
.
add
(
oci_shp_T
);
fwb
.
oci
=
fwbOciList
;
String
fwbText
=
fwb
.
getFWBText
();
System
.
out
.
println
(
fwbText
);
}
}
...
...
请
注册
或
登录
后发表评论