作者 朱兆平

增加FWB电子运单实体类

正在显示 25 个修改的文件 包含 1588 行增加0 行删除
package com.sunyo.wlpt.base.model.efreight.fwb;
/**
* 电子运单主运单
* @author mrz
* @date 2023-05-30
*
*/
public class FWB {
/**
* 版本号
* 默认16
*/
public String ver = "16";
/**
* 主运单格式
*/
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";
}
... ...
package com.sunyo.wlpt.base.model.efreight.fwb;
/**
* Accounting Information
* 财务信息
* O 可选节点
* 可重复6次
* DEMO:
* ACC/GEN/FREIGHT PREPAID
* CRLF
*/
public class FWB_ACC {
/**
*
* 财务信息ID标识
* [A-Z]{1,3}
* M
* DEMO:
* /GEN
*/
private String acc_info_id;
/**
*
* 财务信息内容
* [A-Z0-9-<=/\s\.]{1,34}
* M
* DEMO:
* /GEN/FREIGHT PREPAID
*/
private String acc_info;
}
... ...
package com.sunyo.wlpt.base.model.efreight.fwb;
/**
* 代理人信息
* 代理人信息有IATA代码 则名称与地址也为必填项
* conditional (must be included if the indicated condition is met);C
* (满足指定条件必须包含在内)
* (中性运单包含代理人IATA信息 则必填)
*/
public class FWB_AGT {
/**
* 代理人账号信息
* [A-Z0-9-<=/\s\.]{0,14}
*/
private String agt_account_number;
/**
* 代理人IATA代码
* \d{7}
*
*/
private String agt_IATA_number;
/**
* code issued by IATA to identify individual agent locations for CASS billing purposes
* 由国际航空运输协会发布的代码,用于标识用于CASS计费的各个代理位置,闹求不机密啥意思
* \d{0,4} 有就是4位,没有就0位
*
*/
private String agt_CASS_ADR;
/**
* participant identifier 参与者标识符
* [A-Z0-9]{0,3}
*/
private String agt_participant_id;
/**
* 代理人名称
* [A-Z0-9-<=/\s\.]{1,35}
*/
private String agt_name;
/**
* 代理人地址
* [A-Z0-9-<=/\s\.]{1,17}
*/
private String agt_ADR;
}
... ...
package com.sunyo.wlpt.base.model.efreight.fwb;
import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBException;
public interface FWB_BASE {
String getFWBNodeText() throws FWBException;
String getNodeName();
}
... ...
package com.sunyo.wlpt.base.model.efreight.fwb;
/**
* CER
* Shipper's Certification
* 托运人认证
* O 可选节点
*
* DEMO:(括号里面的是可选项)
* CER/ZHENGZHOU NAVITRANS
* CRLF
*/
public class FWB_CER {
/**
* NODE:CER
* Signature
* 签名
* [A-Z0-9-<=/\s\.]{0,20}
* O (可选节点)
* DEMO:
* CER/ZHENGZHOU NAVITRANS
*/
private String cer_signature;
}
... ...
package com.sunyo.wlpt.base.model.efreight.fwb;
/**
* 主单收货人
* mandatory (must be included);M
*/
public class FWB_CNE {
/**
* 收货人账号信息
* [A-Z0-9-<=/\s\.]{0,14}
* 禁止字符正则 [^A-Z0-9-.<=\s\/]
*/
private String cne_account_number;
/**
* 收货人名称
* [A-Z0-9-<=/\s\.]{1,35}
* 名称信息可最多重复2次
*/
private String cne_name;
/**
* 收货人地址
* [A-Z0-9-<=/\s\.]{1,35}
* 地址信息最多可重复两次
*/
private String cne_adr;
/**
* 收货人城市
* [A-Z0-9-<=/\s\.]{1,17}
*/
private String cne_loc_place;
/**
* 收货人省
* [A-Z0-9-<=/\s\.]{0,9}
*/
private String cne_loc_province;
/**
* 收货人国家
* [A-Z]{2}
*/
private String cne_country;
/**
* 收货人邮编
* [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;
}
... ...
package com.sunyo.wlpt.base.model.efreight.fwb;
/**
* COL
* Collect Charge Summary
* 到付费用汇总
* O 可选节点
* 到付节点与预付PPD节点字段相同
* DEMO:(括号里面的是可选项)
* COL/WT22213.8/VC0/TX0
* /OA0/OC14/CT22227.8
* CRLF
*/
public class FWB_COL {
/**
* NODE:WT
* ToTal Weight Charge
* 总重量费用
* [0-9\.]{0,12}
* O (可选节点)
* DEMO:
* /WT/12306.99
*/
private String col_weight_amount;
/**
* NODE:VC
* Valuation Charge
* 声明价值附加费
* [0-9\.]{0,12}
* O (可选节点)
* DEMO:
* /VC/12306.99
*/
private String col_valuation_amount;
/**
* NODE:TX
* Taxes
* 税费
* [0-9\.]{0,12}
* O (可选节点)
* DEMO:
* /TX/12306.99
*/
private String col_taxes_amount;
/**
* NODE:OA
* Other Charges Due Agent
* 交代理人的其它费用总额
* [0-9\.]{0,12}
* O (可选节点)
* DEMO:
* /OA/12306.99
*/
private String col_other_charges_due_agent;
/**
* NODE:OC
* Other Charges Due Carrier
* 交承运人的其它费用总额
* [0-9\.]{0,12}
* O (可选节点)
* DEMO:
* /OC/12306.99
*/
private String col_other_charges_due_carrier;
/**
* NODE:CT
* Charge Summary Total
* 收费汇总
* [0-9\.]{0,12}
* O (可选节点)
* DEMO:
* /CT/12306.99
*/
private String col_charge_summary_total;
}
... ...
package com.sunyo.wlpt.base.model.efreight.fwb;
/**
* COR
* Customs Origin
* 海关起始信息 (飞机驶离的航站楼信息:如T1)
* O (O 可选, M 必填, C 指定条件下可选)
*
* DEMO:(括号里面的是可选项)
* COR/T1 OR COR/X
* CRLF
*/
public class FWB_COR {
/**
* Parent NODE:COR
* Par Node Des(EN):
* Par Node Des(CN):
* This Node Des EN: Customs Origin Code
* This Node Des CN: 海关起始代码
* [0-9A-Z]{0,2}
* O (O 可选, M 必填, C 指定条件下可选)
* DEMO:
* X
*/
private String cor_code;
}
... ...
package com.sunyo.wlpt.base.model.efreight.fwb;
/**
* CVD
* Charge Declarations
* 收费声明
* M 必填节点
*
* DEMO:(括号里面的是可选项)
* CVD/CNY/(PX)/PP/NVD/NCV/XXX
* CRLF
*/
public class FWB_CVD {
/**
* 货币单位
* [A-Z]{1,3}
* M
* DEMO:
* CNY
*/
private String cvd_currency_code;
/**
* Charge Code
* 收费代码
* [A-Z]{2}
* C 可选
* DEMO:
* PP CC CZ CG PX ...太多了 看字典吧
* 大多数时候空着
*/
private String cvd_charge_code;
/**
* Prepaid/Collect Charge Declarations
* 预付/到付声明
* PP|CC
* M
* DEMO:
* PP
*/
private String cvd_charge_prepaid;
/**
* Value For Carriage Declaration
* 运费申报价值
* [0-9.]{1,12}
* M 必填
* DEMO:
* 123.31 OR NVD
*/
private String cvd_value_for_carriage;
/**
* Value For Carriage Declaration
* 海关声明价值
* [0-9.]{1,12}
* M 必填
* DEMO:
* 123.05 OR NCV
*/
private String cvd_value_for_customs;
/**
* Value For insurance Declaration
* 保险声明价值
* [0-9.]{1,11}
* M 必填
* DEMO:
* 123.05 OR XXX
*/
private String getCvd_value_for_customs;
}
... ...
package com.sunyo.wlpt.base.model.efreight.fwb;
/**
* Flight Bookings
* FLT
* 运单航程航班
*/
public class FWB_FLT {
/**
* 承运人代码 mm
* [A-Z]{2}
*/
private String cariier;
/**
* 航班号 nnn(n)(a)
* [0-9]{3}\d?[A-Z0-9]?
*/
private String flightNumber;
/**
* 航班日期 - 按日标识
* [0-9]{2}
*/
private String day;
}
... ...
package com.sunyo.wlpt.base.model.efreight.fwb;
/**
* ISU
* Carrier's Execution
* 承运人的执行信息
* M 必填节点
*
* DEMO:(括号里面的是可选项)
* ISU/29MAY23/ZHENGZHOU/ZHU YUAN ZHANG
* CRLF
*/
public class FWB_ISU {
/**
* NODE:ISU
* Day Mounth Year
* 签名日期
* [0-9]{2}[A-Z]{3}[0-9]{2}
* M (必填节点)
* DEMO:
* 29MAY23
*/
private String isu_day_mounth_year;
/**
* NODE:ISU
* Place Or Airport/City Code
* 签订地址 或 机场代码 或城市代码
* [A-Z0-9-<=/\s\.]{1,17}
* M (必填节点)
* DEMO:
* ZHENGZHOU OR CGO OR BJS
*/
private String isu_place_or_airport_code;
/**
* NODE:ISU
* Authorisation
* Signature
* 许可签名
* [A-Z0-9-<=/\s\.]{0,20}
* O (可选节点)
* DEMO:
* ZHU YUANZHANG
*/
private String isu_signature;
}
... ...
package com.sunyo.wlpt.base.model.efreight.fwb;
/**
* NFY
* Also Notify
* 另外通知
* optional (may be included) 可选(有可能包含)
* 请求最多可重复2次
* DEMO:
* /NFY/
*/
public class FWB_NFY {
/**
* 被通知人名称
* [A-Z0-9-<=/\s\.]{1,35}
* 最多重复两次,一行装不下装两行
* /NAME TEXT
* /NAME TEXT
*/
private String nfy_name;
/**
* 被通知人地址
* [A-Z0-9-<=/\s\.]{1,35}
* 最多重复两次,一行装不下装两行
* /ADR TXT
* /ADR TXT
*/
private String nfy_ADR;
/**
* 被通知人城市
* [A-Z0-9-<=/\s\.]{1,17}
* /CITY NAME
*/
private String nfy_LOC_city;
/**
*
* 被通知人省
* [A-Z0-9-<=/\s\.]{0,9}
* /PROVINCE NAME
* O 可选
*/
private String nfy_LOC_province;
/**
* 被通知人国家
* [A-Z]{2}
* /CN
* M
*/
private String nfy_country;
/**
* 邮编
* [A-Z0-9-<=/\s\.]{0,9}
* 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;
}
... ...
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 org.springframework.util.StringUtils;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* OCI
* Other Customs,Security And Regulatory Control Information
* 其他海关、安全和监管信息
* O 可选节点
* OCI 内节点可重复次数不限
* DEMO:(括号里面的是可选项)
* OCI/CN/SHP/T/USCI91440101MA9Y9E79XG
* /CN/SHP/CT/862086277592
* /NL/CNE/T/NL857752108
* /NL/CNE/CP/PLANNING AEROEXPRESSGROUP.COM
* /NL/CNE/CT/029 774 5540
* CRLF
*/
public class FWB_OCI implements FWB_BASE {
/**
* NODE:OCI
* ISO Country Code
* 国际标准国家代码二字码
*
* [A-Z]{0,2}
* C (可选节点,主节点存在的情况下)
* DEMO:
* /CN
*/
private String oci_country_code ="";
/**
* NODE:OCI
* Information Identifier
* 信息业务类型标识
*
* [A-Z]{0,3}
* C (可选节点,主节点存在的情况下)
* DEMO:
* /SHP OR /CNE
*/
private String oci_information_id="";
/**
* NODE:OCI
* Other Customs,Security And Regulatory Control Information Identifier
* 其他海关、安全和监管信息ID业务标识
*
* [A-Z]{0,2}
* C (可选节点,主节点存在的情况下)
* DEMO:
* /T OR /CP OR /CT ...
*/
private String oci_csrc_id="";
/**
* NODE:OCI
* Supplementary Customs,Security And Regulatory Control Information
* 补充海关、安全及管制资料
* 此节点有值的话 上一个节点oci_csrc_id也必须有值
* [A-Z]{0,35}
* M (可选节点,主节点存在的情况下)
* DEMO:
* /USCI91440101MA9Y9E79XG (商业注册编码) OR /PLANNING AEROEXPRESSGROUP.COM (具体联系人联系信息) ...
*/
private String oci_csrc_info="";
/**
* ---------------------------------------------------------------------------------------------------
*
*/
public String getOci_country_code() {
//校验正则
String patternStr = "^[A-Z]{2}$";
Pattern pattern = Pattern.compile(patternStr);
Matcher matcher = pattern.matcher(oci_country_code);
if (!matcher.find()){
System.out.println("[OCI-WARN]-缺少国家代码信息,或未通过规则校验");
}
return oci_country_code;
}
public void setOci_country_code(String oci_country_code) {
this.oci_country_code = oci_country_code;
}
public String getOci_information_id() {
//校验正则
String patternStr = "^[A-Z]{3}$";
Pattern pattern = Pattern.compile(patternStr);
Matcher matcher = pattern.matcher(oci_information_id);
if (!matcher.find()){
System.out.println("[OCI-WARN]-缺少业务代码信息ID,或未通过规则校验");
}
return oci_information_id;
}
public void setOci_information_id(String oci_information_id) {
this.oci_information_id = oci_information_id;
}
public String getOci_csrc_id() {
String patternStr = "^[A-Z]{1,2}$";
Pattern pattern = Pattern.compile(patternStr);
Matcher matcher = pattern.matcher(oci_csrc_id);
if (!matcher.find()){
System.out.println("[OCI-WARN]-缺少CSCR ID,或未通过规则校验");
}
return oci_csrc_id;
}
public void setOci_csrc_id(String oci_csrc_id) {
this.oci_csrc_id = oci_csrc_id;
}
/**
* 在必填项字段进行 所需相关信息数据的检查
* @return
*/
public String getOci_csrc_info() throws FWBException {
if (StringUtils.hasText(oci_csrc_info)){
if (
!StringUtils.hasLength(this.oci_csrc_id)
){
throw new FWBException(FWBExceptionType.OCI_CSRC_ERROR);
}
}
return oci_csrc_info;
}
public void setOci_csrc_info(String oci_csrc_info) {
this.oci_csrc_info = oci_csrc_info;
}
@Override
public String getFWBNodeText() throws FWBException {
String SPLIT_CODE = "/";
String CRLF = "\n";
StringBuilder sb = new StringBuilder("");
if (StringUtils.hasLength(getOci_csrc_info())){
sb.append(SPLIT_CODE)
.append(getOci_country_code())
.append(SPLIT_CODE)
.append(getOci_information_id())
.append(SPLIT_CODE)
.append(getOci_csrc_id())
.append(SPLIT_CODE)
.append(getOci_csrc_info())
.append(CRLF);
return sb.toString();
}
return "";
}
@Override
public String getNodeName() {
return "OCI";
}
}
... ...
package com.sunyo.wlpt.base.model.efreight.fwb;
/**
* OSI
* Other Service Infomation
* 其他服务信息
* O (O 可选, M 必填, C 指定条件下可选)
*
* DEMO:(括号里面的是可选项)
* OSI/SAY TOTAL 8 PACKAGES PLEASE NOTIFY CONSIGNEE UPON FLIGHT ARRIVAL
* CRLF
*/
public class FWB_OSI {
/**
* Parent NODE:OSI
* Par Node Des(EN):
* Par Node Des(CN):
* This Node Des EN: Other Service Information Text
* This Node Des CN: 其他服务信息内容
* [A-Z0-9-<=/\s\.]{0,65}
* O (O 可选, M 必填, C 指定条件下可选)
* 可重复次数:3
* DEMO:
* 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;
}
... ...
package com.sunyo.wlpt.base.model.efreight.fwb;
/**
* OTH
* Other Charges
* 其他费用
* O 可选节点
*
* DEMO:(括号里面的是可选项)
* OTH/P/NEC14
* CRLF
*/
public class FWB_OTH {
/**
* NODE:P OR C
* Other Charge Code
* 其他费用代码
* [A-Z]{2}
* M (主节点存在则子节点必须有)
* DEMO:
* NE
*/
private String oth_charge_code;
/**
* NODE:P OR C
* Entitlement Code
* 授权代码
* [A-Z]{1}
* M (主节点存在则子节点必须有)
* DEMO:
* C
*/
private String oth_entitlement_code;
/**
* NODE:P OR C
* Charge Amount
* 收费金额
* [0-9\.]{12}
* M (主节点存在则子节点必须有)
* 此节点可重复复出现3次
* DEMO:
* 22.73
*/
private String oth_amount;
}
... ...
package com.sunyo.wlpt.base.model.efreight.fwb;
/**
* PPD
* Prepaid Charge Summary
* 预付费用汇总
* O 可选节点
*
* DEMO:(括号里面的是可选项)
* PPD/WT22213.8/VC0/TX0
* /OA0/OC14/CT22227.8
* CRLF
*/
public class FWB_PPD {
/**
* NODE:WT
* ToTal Weight Charge
* 总重量费用
* [0-9\.]{0,12}
* O (可选节点)
* DEMO:
* /WT/12306.99
*/
private String ppd_weight_amount;
/**
* NODE:VC
* Valuation Charge
* 声明价值附加费
* [0-9\.]{0,12}
* O (可选节点)
* DEMO:
* /VC/12306.99
*/
private String ppd_valuation_amount;
/**
* NODE:TX
* Taxes
* 税费
* [0-9\.]{0,12}
* O (可选节点)
* DEMO:
* /TX/12306.99
*/
private String ppd_taxes_amount;
/**
* NODE:OA
* Other Charges Due Agent
* 交代理人的其它费用总额
* [0-9\.]{0,12}
* O (可选节点)
* DEMO:
* /OA/12306.99
*/
private String ppd_other_charges_due_agent;
/**
* NODE:OC
* Other Charges Due Carrier
* 交承运人的其它费用总额
* [0-9\.]{0,12}
* O (可选节点)
* DEMO:
* /OC/12306.99
*/
private String ppd_other_charges_due_carrier;
/**
* NODE:CT
* Charge Summary Total
* 收费汇总
* [0-9\.]{0,12}
* O (可选节点)
* DEMO:
* /CT/12306.99
*/
private String ppd_charge_summary_total;
}
... ...
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 org.springframework.util.StringUtils;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* REF
* Sender Reference
* 发送者参考信息
* M 必填节点
*
* DEMO:(括号里面的是可选项)
* REF/CGOFD1E/EC1A2C4CBC3D/AGT/MECCGO01/CGO
* CRLF
*/
public class FWB_REF implements FWB_BASE{
/**
* NODE:REF
* Sender Office Message Address
* 发送人办公室电报地址
* Air Port Code And Office Function Designator And Company Designator
* [A-Z]{3}[0-9A-Z]{2}[0-9A-Z]{2}
* M (必填节点)
* DEMO:
* CGOFD1E
*/
private String ref_address = "";
/**
* NODE:REF
* Sender Office File Reference
* 发件人办公室文件参考
* File Reference
* [A-Z0-9-<=/\s\.]{0,15}
* O (可选节点)
* DEMO:
* EC1A2C4CBC3D
*/
private String ref_file_reference ="";
/**
* NODE:REF
* Sender Participan Identification
* 发送方参与者身份
* Participan Identification
* [A-Z0-9]{0,3}
* O (可选节点)
* DEMO:
* EC1
*/
private String ref_participant_id = "";
/**
* NODE:REF
* Sender Participan Identification
* 发送方参与者身份
* Participan Code
* [A-Z0-9]{0,17}
* O (可选节点)
* DEMO:
* EC1A2C4CBC3D
*/
private String ref_participant_code="";
/**
* NODE:REF
* Sender Participan Identification
* 发送方参与者身份
* Airport/City Code
* [A-Z]{0,3}
* O (可选节点)
* DEMO:
* CGO OR BJS
*/
private String ref_participant_airport="";
public String getRef_address() throws FWBException {
if (!StringUtils.hasText(ref_address)){
throw new FWBException(FWBExceptionType.REF_ERROR);
}
String patternStr = "^[A-Z]{3}[0-9A-Z]{2}[0-9A-Z]{2}$";
Pattern pattern = Pattern.compile(patternStr);
Matcher matcher = pattern.matcher(ref_address);
if (!matcher.find()){
throw new FWBException(FWBExceptionType.REF_SOMA_REGEX_FAILD);
}
return ref_address;
}
public void setRef_address(String ref_address) {
this.ref_address = ref_address;
}
public String getRef_file_reference() {
String patternStr = "^[A-Z0-9-<=/\\s\\.]{0,15}$";
Pattern pattern = Pattern.compile(patternStr);
Matcher matcher = pattern.matcher(ref_file_reference);
if (!matcher.find()){
System.out.println("[REF-WARN]-缺少file_reference,或未通过规则校验");
}
return ref_file_reference;
}
public void setRef_file_reference(String ref_file_reference) {
this.ref_file_reference = ref_file_reference;
}
public String getRef_participant_id() throws FWBException {
if (StringUtils.hasText(ref_participant_id) || StringUtils.hasText(ref_participant_code) || StringUtils.hasText(ref_participant_airport)){
if (!StringUtils.hasText(ref_participant_id) || !StringUtils.hasText(ref_participant_code) || !StringUtils.hasText(ref_participant_airport)){{
throw new FWBException(FWBExceptionType.REF_SPID_REGEX_FAILD);
}}
}
String patternStr = "^[A-Z0-9]{0,3}$";
Pattern pattern = Pattern.compile(patternStr);
Matcher matcher = pattern.matcher(ref_participant_id);
if (!matcher.find()){
System.out.println("[REF-WARN]-participant_id 未通过规则校验");
}
return ref_participant_id;
}
public void setRef_participant_id(String ref_participant_id) {
this.ref_participant_id = ref_participant_id;
}
public String getRef_participant_code() {
String patternStr = "^[A-Z0-9]{0,17}$";
Pattern pattern = Pattern.compile(patternStr);
Matcher matcher = pattern.matcher(ref_participant_code);
if (!matcher.find()){
System.out.println("[REF-WARN]-participant_code 未通过规则校验");
}
return ref_participant_code;
}
public void setRef_participant_code(String ref_participant_code) {
this.ref_participant_code = ref_participant_code;
}
public String getRef_participant_airport() {
String patternStr = "^[A-Z]{0,3}$";
Pattern pattern = Pattern.compile(patternStr);
Matcher matcher = pattern.matcher(ref_participant_airport);
if (!matcher.find()){
System.out.println("[REF-WARN]- participant_airport 未通过规则校验");
}
return ref_participant_airport;
}
public void setRef_participant_airport(String ref_participant_airport) {
this.ref_participant_airport = ref_participant_airport;
}
@Override
public String getFWBNodeText() throws FWBException {
String SPLIT_CODE = "/";
String CRLF = "\n";
StringBuilder sb = new StringBuilder("");
try {
sb.append(SPLIT_CODE)
.append(getRef_address());
if (StringUtils.hasLength(getRef_file_reference())){
sb.append(SPLIT_CODE)
.append(getRef_file_reference());
}else {
sb.append(SPLIT_CODE);
}
if (StringUtils.hasLength(getRef_participant_id())
&& StringUtils.hasLength(getRef_participant_code())
&& StringUtils.hasLength(getRef_participant_airport())
){
sb.append(SPLIT_CODE)
.append(getRef_participant_id());
sb.append(SPLIT_CODE)
.append(getRef_participant_code());
sb.append(SPLIT_CODE)
.append(getRef_participant_airport());
}
sb.append(CRLF);
} catch (FWBException e) {
e.printStackTrace();
}
return sb.toString();
}
@Override
public String getNodeName() {
return "REF";
}
}
... ...
package com.sunyo.wlpt.base.model.efreight.fwb;
/**
* RTD
* Rate Description
* 费率说明
* M 必填节点
*
* DEMO:(括号里面的是可选项)
* RTD/1/P8/K60/CQ/W94
* /NG/SHIPMENT AS PER ATTD
* /2/NC/CONSOL
* /3/ND//CMT1.63-34-33/8
* /4/NV/MC0.56
* CTLF
*/
public class FWB_RTD {
/**
* NODE:P
* Number of Pieces
* 件数
* [0-9]{1,4}
* M
* DEMO:
* 1230
*/
private String rtd_number_pieces;
/**
* Rate Combination Point
* 费率组合点
* [A-Z]{0,3}
* O
* DEMO:
* ABC
*/
private String rtd_combination_point;
/**
* NODE:K/L
* K/公斤(固体) L/公升(液体)
* Gross Weight Details
* 毛重
* 重量单位
* [0-9\.]{0,7}
* O
* DEMO:
* K185.07
*/
private String rtd_gross_weight;
/**
* NODE:C
* Rate Class Details
* 费率类别详情,运费级别
* [A-Z]{0,1}
* O
* DEMO:
* CQ
*/
private String rtd_rate_class;
/**
* NODE:S
* Commodity Item Number Details
* 商品编号详细信息
* Commodity Item Number OR ULD Rate Class Type OR [Rate Class Code(Basis) Class Rate Percentage]
* [0-9]{0,7} | [0-9][A-Z]{0,2} | [A-Z][0-9]{0,3}
* O
* DEMO:
* S3476 | S9AF | SD345
*/
private String rtd_commodity_NUM;
/**
* NODE:W
* Chargeable Weight Details
* 计费重量信息
*
* [0-9\.]{0,7}
* O
* DEMO:
* W637.09
*/
private String rtd_charge_weight;
/**
* NODE:R
* Rate/Charge Details
* 率/收费细节,运费信息,如 没公斤的收费费率
* Rate or Charge Or Discount(折扣)
* [0-9\.]{0,8}
* O
* DEMO:
* R34.73
*/
private String rtd_rate_charge;
/**
* NODE:T
* Total Details
* 总计信息
* 如运费单价(Rate/Charge)x公斤/计费重量(W)的结果值
* Charge Amount or Discount Amount
* [0-9\.]{0,8}
* O
* DEMO:
* T2334.73
*/
private String rtd_rate_total;
/**
* NODE:NG
* Goods Description
* 货物信息描述
* Nature and Quantity of Goods
* 实际货物信息/货物的性质和数量
* [A-Z0-9-<=/\s\.]{0,20}
* O
* DEMO:
* DELL COMPUTER
*/
private String rtd_goods_DES;
/**
* NODE:NC
* Consolidation
* 集拼集运货物
* Nature and Quantity of Goods
* 实际货物信息/货物的性质和数量
* [A-Z0-9-<=/\s\.]{0,20}
* O
* DEMO:
* COSOLE GOODS
*/
private String rtd_goods_consol_DES;
/**
* NODE:ND
* Dimensions [C]
* 尺寸信息
* Weight Code
* 重量单位
* [A-Z]{0,1}
* O
* DEMO:
* K
*/
private String rtd_goods_DIM_weightcode;
/**
* NODE:ND
* Dimensions
* 尺寸信息
* Weight
* 重量
* [0-9\.]{0,7}
* O
* DEMO:
* 21.11
*/
private String rtd_goods_DIM_weight;
/**
* NODE:ND
* Dimensions
* 尺寸信息
* Measurement Unit Code
* 尺寸单位
* [A-Z]{0,3}
* O
* DEMO:
* CBM OR NDA(没有尺寸信息)
*/
private String rtd_measurement_code;
/**
* Parent NODE:ND
* Dimensions
* 尺寸信息
* Measurement info
* 尺寸具体信息,这个节点比较麻烦在前端交互以及长宽高的识别及处理,多个体积信息可重复节点标识
* [0-9]{0,5}x[0-9]{0,5}x[0-9]{0,5}/[0-9]{0,4} | [0-9]{0,5}-[0-9]{0,5}-[0-9]{0,5}/[0-9]{0,4}
* 长-宽-高/件数
* O
* DEMO:
* 100-100-50/4
*/
private String rtd_measurement_info;
/**
* Parent NODE:NV
* VOLUME
* 体积
* Valume Code
* 体积代码
* [A-Z]{2}
* MC 平方米
* O
* DEMO:
* MC
*/
private String rtd_volume_code;
/**
* Parent NODE:NV
* VOLUME
* 体积
* Valume Amount
* 体积
* [0-9\.]{0,9}
*
* O
* DEMO:
* 12.31
*/
private String rtd_volume;
//todo: 还有NU,NS,NH,NO等信息后面完善
}
... ...
package com.sunyo.wlpt.base.model.efreight.fwb;
/**
* Flight Bookings
* Routing
* RTG
* 运单航程目的地承运人
*/
public class FWB_RTG {
/**
* 首程目的站
* [A-Z]{3}
* 可选节点
*/
private String destinationAirport;
/**
* 首程目的站对应承运人
* [A-Z0-9]{2}
*/
private String destinationCarrier;
/**
* 下一航程起始航站
* 可选节点
* 下一航程节点最多可重复两次,结合首程一共三个航程
*/
private String onwardAirport;
/**
* 下一航程起始航站承运人
*/
private String onwardCarrier;
}
... ...
package com.sunyo.wlpt.base.model.efreight.fwb;
/**
* 主单发货人
* mandatory (must be included); M
*/
public class FWB_SHP {
/**
* 发货人账号信息
* [A-Z0-9-<=/\s\.]{0,14}
* 禁止 [^A-Z0-9-.<=\s\/]
*/
private String shp_account_number;
/**
* 发货人名称
* [A-Z0-9-<=/\s\.]{1,35}
* 名称信息可最多重复2次
*/
private String shp_name;
/**
* 发货人地址
* [A-Z0-9-<=/\s\.]{1,35}
*/
private String shp_adr;
/**
* 发货人城市
* [A-Z0-9-<=/\s\.]{1,17}
*/
private String shp_loc_place;
/**
* 发货人省
* [A-Z0-9-<=/\s\.]{0,9}
*/
private String shp_loc_province;
/**
* 发货人国家
* [A-Z]{2}
*/
private String shp_country;
/**
* 发货人邮编
* [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;
}
... ...
package com.sunyo.wlpt.base.model.efreight.fwb;
/**
* SPH
* Special Handing Details
* 特殊操作信息
* O 可选节点
* 可最多出现9次
* DEMO:(括号里面的是可选项)
* SPH/ECC/ELI
* CRLF
*/
public class FWB_SPH {
/**
* NODE:SPH
* Special Handing Requirements
* 特殊处理要求
* Special Handing Code
* [A-Z]{0,3}
* M (必填节点,主节点存在的情况下)
* DEMO:
* /ELI
*/
private String sph_code;
}
... ...
package com.sunyo.wlpt.base.model.efreight.fwb;
/**
* SSR
* special service request
* 特殊服务请求
* optional (may be included) 可选(有可能包含)
* 请求最多可重复3次
* DEMO:
* /SSR/RQUEST TXT/REQUST TXT/REQUEST TXT
*/
public class FWB_SSR {
/**
* 特殊服务请求内容
* [A-Z0-9-<=/\s\.]{0,65}
*/
private String ssr_request_content;
}
... ...
package com.sunyo.wlpt.base.model.efreight.fwb.exception;
public class FWBException extends Exception {
private static final long serialVersionUID = 6098063244016154220L;
/**
* 异常错误编码
*/
private String code;
/**
* 异常信息
*/
private String message;
public FWBException(FWBExceptionType exceptionTypeEnum, String message) {
this.code = exceptionTypeEnum.getCode();
this.message = message;
}
public FWBException(FWBExceptionType exceptionTypeEnum) {
this.code = exceptionTypeEnum.getCode();
this.message = exceptionTypeEnum.getMsg();
}
public String getCode() {
return code;
}
@Override
public String getMessage() {
return message;
}
}
... ...
package com.sunyo.wlpt.base.model.efreight.fwb.exception;
/**
* @author 子诚
* Description:枚举,定制异常类型
* 时间:2020/7/17 16:27
*/
public enum FWBExceptionType {
REF_ERROR("203", "缺少 REF Sender Reference - Sender Office Message Address"),
REF_SOMA_REGEX_FAILD("2031", "REF- Sender Office Message Address RegEx Faild"),
REF_SPID_REGEX_FAILD("206", "REF- Sender Participant Idenfitication RegEx Faild,缺少关联节点信息"),
OCI_CSRC_ERROR("297", "缺少 Other Customs,Security And Regulatory Control Information Identifier");
/**
* 响应业务状态
*/
private String code;
/**
* 响应消息
*/
private String msg;
FWBExceptionType(String code, String msg)
{
this.code = code;
this.msg = msg;
}
public String getCode()
{
return code;
}
public String getMsg()
{
return msg;
}
}
... ...
import com.sunyo.wlpt.base.model.efreight.fwb.FWB_OCI;
import com.sunyo.wlpt.base.model.efreight.fwb.FWB_REF;
import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBException;
public class FWBTest {
public static void main(String[] args) {
REF_TEST();
// OCI_TEST();
}
static void OCI_TEST(){
FWB_OCI fwb_oci = new FWB_OCI();
fwb_oci.setOci_csrc_id("T");
fwb_oci.setOci_csrc_info("USCI91440101MA9Y9E79XG");
fwb_oci.setOci_country_code("CN");
fwb_oci.setOci_information_id("SHP");
try {
String oci = fwb_oci.getFWBNodeText();
System.out.println(oci);
} catch (FWBException e) {
e.printStackTrace();
}
}
static void REF_TEST(){
FWB_REF fwb_ref = new FWB_REF();
fwb_ref.setRef_address("CGOFDIE");
fwb_ref.setRef_file_reference("EC1A2C4CBC3D1");
fwb_ref.setRef_participant_id("AGT");
fwb_ref.setRef_participant_code("MECCGO01");
fwb_ref.setRef_participant_airport("CGO");
try {
String oci = fwb_ref.getFWBNodeText();
System.out.println(oci);
} catch (FWBException e) {
e.printStackTrace();
}
}
}
... ...