正在显示
9 个修改的文件
包含
1093 行增加
和
53 行删除
| 1 | package com.sunyo.wlpt.base.model.efreight.fwb; | 1 | package com.sunyo.wlpt.base.model.efreight.fwb; |
| 2 | 2 | ||
| 3 | +import com.sunyo.wlpt.base.model.efreight.BASE; | ||
| 4 | +import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBException; | ||
| 5 | +import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBExceptionType; | ||
| 6 | + | ||
| 7 | +import java.util.regex.Matcher; | ||
| 8 | +import java.util.regex.Pattern; | ||
| 9 | + | ||
| 3 | /** | 10 | /** |
| 4 | * Accounting Information | 11 | * Accounting Information |
| 5 | * 财务信息 | 12 | * 财务信息 |
| @@ -9,7 +16,7 @@ package com.sunyo.wlpt.base.model.efreight.fwb; | @@ -9,7 +16,7 @@ package com.sunyo.wlpt.base.model.efreight.fwb; | ||
| 9 | * ACC/GEN/FREIGHT PREPAID | 16 | * ACC/GEN/FREIGHT PREPAID |
| 10 | * CRLF | 17 | * CRLF |
| 11 | */ | 18 | */ |
| 12 | -public class FWB_ACC { | 19 | +public class FWB_ACC extends BASE implements FWB_BASE { |
| 13 | /** | 20 | /** |
| 14 | * | 21 | * |
| 15 | * 财务信息ID标识 | 22 | * 财务信息ID标识 |
| @@ -28,4 +35,53 @@ public class FWB_ACC { | @@ -28,4 +35,53 @@ public class FWB_ACC { | ||
| 28 | * /GEN/FREIGHT PREPAID | 35 | * /GEN/FREIGHT PREPAID |
| 29 | */ | 36 | */ |
| 30 | private String acc_info; | 37 | private String acc_info; |
| 38 | + | ||
| 39 | + public String getAcc_info_id() throws FWBException { | ||
| 40 | + String patternStr = "^[A-Z]{3}$"; | ||
| 41 | + Pattern pattern = Pattern.compile(patternStr); | ||
| 42 | + Matcher matcher = pattern.matcher(acc_info_id); | ||
| 43 | + if (!matcher.find()){ | ||
| 44 | + throw new FWBException(FWBExceptionType.FWB_ACC_ID_ERR); | ||
| 45 | + } | ||
| 46 | + return acc_info_id; | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + public void setAcc_info_id(String acc_info_id) { | ||
| 50 | + this.acc_info_id = acc_info_id; | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + public String getAcc_info() throws FWBException { | ||
| 54 | + String patternStr = "^[A-Z0-9-<=/\\s\\.]{1,34}$"; | ||
| 55 | + Pattern pattern = Pattern.compile(patternStr); | ||
| 56 | + Matcher matcher = pattern.matcher(acc_info); | ||
| 57 | + if (!matcher.find()){ | ||
| 58 | + throw new FWBException(FWBExceptionType.FWB_ACC_INFO_ERR); | ||
| 59 | + } | ||
| 60 | + return acc_info; | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + public void setAcc_info(String acc_info) { | ||
| 64 | + this.acc_info = acc_info; | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + | ||
| 68 | + @Override | ||
| 69 | + public String getFWBNodeText() throws FWBException { | ||
| 70 | + String SPLIT_CODE = "/"; | ||
| 71 | + String CRLF = "\n"; | ||
| 72 | + StringBuilder sb = new StringBuilder(""); | ||
| 73 | + | ||
| 74 | + if (hasText(acc_info) || hasText(acc_info_id)){ | ||
| 75 | + sb.append(getNodeName()).append(SPLIT_CODE); | ||
| 76 | + sb.append(getAcc_info_id()).append(SPLIT_CODE).append(getAcc_info()); | ||
| 77 | + sb.append(CRLF); | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + return sb.toString(); | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + @Override | ||
| 84 | + public String getNodeName() { | ||
| 85 | + return "ACC"; | ||
| 86 | + } | ||
| 31 | } | 87 | } |
| 1 | package com.sunyo.wlpt.base.model.efreight.fwb; | 1 | package com.sunyo.wlpt.base.model.efreight.fwb; |
| 2 | 2 | ||
| 3 | +import com.sunyo.wlpt.base.model.efreight.BASE; | ||
| 4 | +import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBException; | ||
| 5 | +import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBExceptionType; | ||
| 6 | + | ||
| 7 | +import java.util.regex.Matcher; | ||
| 8 | +import java.util.regex.Pattern; | ||
| 9 | + | ||
| 3 | /** | 10 | /** |
| 4 | * 代理人信息 | 11 | * 代理人信息 |
| 5 | * 代理人信息有IATA代码 则名称与地址也为必填项 | 12 | * 代理人信息有IATA代码 则名称与地址也为必填项 |
| @@ -7,7 +14,7 @@ package com.sunyo.wlpt.base.model.efreight.fwb; | @@ -7,7 +14,7 @@ package com.sunyo.wlpt.base.model.efreight.fwb; | ||
| 7 | * (满足指定条件必须包含在内) | 14 | * (满足指定条件必须包含在内) |
| 8 | * (中性运单包含代理人IATA信息 则必填) | 15 | * (中性运单包含代理人IATA信息 则必填) |
| 9 | */ | 16 | */ |
| 10 | -public class FWB_AGT { | 17 | +public class FWB_AGT extends BASE implements FWB_BASE { |
| 11 | 18 | ||
| 12 | /** | 19 | /** |
| 13 | * 代理人账号信息 | 20 | * 代理人账号信息 |
| @@ -44,4 +51,128 @@ public class FWB_AGT { | @@ -44,4 +51,128 @@ public class FWB_AGT { | ||
| 44 | * [A-Z0-9-<=/\s\.]{1,17} | 51 | * [A-Z0-9-<=/\s\.]{1,17} |
| 45 | */ | 52 | */ |
| 46 | private String agt_ADR; | 53 | private String agt_ADR; |
| 54 | + | ||
| 55 | + public String getAgt_account_number() throws FWBException { | ||
| 56 | + String patternStr = "^[A-Z0-9-<=/\\s\\.]{0,14}$"; | ||
| 57 | + Pattern pattern = Pattern.compile(patternStr); | ||
| 58 | + Matcher matcher = pattern.matcher(agt_account_number); | ||
| 59 | + if (!matcher.find()){ | ||
| 60 | + throw new FWBException(FWBExceptionType.FWB_AGT_ACC_ERR); | ||
| 61 | + } | ||
| 62 | + return agt_account_number; | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + public void setAgt_account_number(String agt_account_number) { | ||
| 66 | + this.agt_account_number = agt_account_number; | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + public String getAgt_IATA_number() throws FWBException { | ||
| 70 | + String patternStr = "^\\d{7}$"; | ||
| 71 | + Pattern pattern = Pattern.compile(patternStr); | ||
| 72 | + Matcher matcher = pattern.matcher(agt_IATA_number); | ||
| 73 | + if (!matcher.find()){ | ||
| 74 | + throw new FWBException(FWBExceptionType.FWB_AGT_IATA_ERR); | ||
| 75 | + } | ||
| 76 | + return agt_IATA_number; | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + public void setAgt_IATA_number(String agt_IATA_number) { | ||
| 80 | + this.agt_IATA_number = agt_IATA_number; | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + public String getAgt_CASS_ADR() throws FWBException { | ||
| 84 | + String patternStr = "^\\d{0,4}$"; | ||
| 85 | + Pattern pattern = Pattern.compile(patternStr); | ||
| 86 | + Matcher matcher = pattern.matcher(agt_CASS_ADR); | ||
| 87 | + if (!matcher.find()){ | ||
| 88 | + throw new FWBException(FWBExceptionType.FWB_AGT_CASS_ERR); | ||
| 89 | + } | ||
| 90 | + return agt_CASS_ADR; | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + public void setAgt_CASS_ADR(String agt_CASS_ADR) { | ||
| 94 | + this.agt_CASS_ADR = agt_CASS_ADR; | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + public String getAgt_participant_id() throws FWBException { | ||
| 98 | + String patternStr = "^[A-Z0-9]{0,3}$"; | ||
| 99 | + Pattern pattern = Pattern.compile(patternStr); | ||
| 100 | + Matcher matcher = pattern.matcher(agt_participant_id); | ||
| 101 | + if (!matcher.find()){ | ||
| 102 | + throw new FWBException(FWBExceptionType.FWB_AGT_PID_ERR); | ||
| 103 | + } | ||
| 104 | + return agt_participant_id; | ||
| 105 | + } | ||
| 106 | + | ||
| 107 | + public void setAgt_participant_id(String agt_participant_id) { | ||
| 108 | + this.agt_participant_id = agt_participant_id; | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + public String getAgt_name() throws FWBException { | ||
| 112 | + String patternStr = "^[A-Z0-9-<=/\\s\\.]{0,35}$"; | ||
| 113 | + Pattern pattern = Pattern.compile(patternStr); | ||
| 114 | + Matcher matcher = pattern.matcher(agt_name); | ||
| 115 | + if (!matcher.find()){ | ||
| 116 | + throw new FWBException(FWBExceptionType.FWB_AGT_NAME_ERR); | ||
| 117 | + } | ||
| 118 | + return agt_name; | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + public void setAgt_name(String agt_name) { | ||
| 122 | + this.agt_name = agt_name; | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + public String getAgt_ADR() throws FWBException { | ||
| 126 | + | ||
| 127 | + String patternStr = "^[A-Z0-9-<=/\\s\\.]{0,17}$"; | ||
| 128 | + Pattern pattern = Pattern.compile(patternStr); | ||
| 129 | + Matcher matcher = pattern.matcher(agt_ADR); | ||
| 130 | + if (!matcher.find()){ | ||
| 131 | + throw new FWBException(FWBExceptionType.FWB_AGT_ADR_ERR); | ||
| 132 | + } | ||
| 133 | + return agt_ADR; | ||
| 134 | + } | ||
| 135 | + | ||
| 136 | + public void setAgt_ADR(String agt_ADR) { | ||
| 137 | + this.agt_ADR = agt_ADR; | ||
| 138 | + } | ||
| 139 | + | ||
| 140 | + @Override | ||
| 141 | + public String getFWBNodeText() throws FWBException { | ||
| 142 | + String SPLIT_CODE = "/"; | ||
| 143 | + String CRLF = "\n"; | ||
| 144 | + StringBuilder sb = new StringBuilder(""); | ||
| 145 | + //代理人信息中有IATA代码时才生成 | ||
| 146 | + if (hasText(agt_IATA_number)){ | ||
| 147 | + sb.append(getNodeName()); | ||
| 148 | + sb.append(SPLIT_CODE); | ||
| 149 | + if (hasText(agt_account_number)){ | ||
| 150 | + sb.append(getAgt_account_number()); | ||
| 151 | + } | ||
| 152 | + sb.append(SPLIT_CODE).append(getAgt_IATA_number()); | ||
| 153 | + | ||
| 154 | + if (hasText(agt_CASS_ADR)){ | ||
| 155 | + sb.append(SPLIT_CODE).append(getAgt_CASS_ADR()); | ||
| 156 | + } | ||
| 157 | + | ||
| 158 | + if (hasText(agt_participant_id)){ | ||
| 159 | + sb.append(SPLIT_CODE).append(getAgt_participant_id()); | ||
| 160 | + } | ||
| 161 | + sb.append(CRLF); | ||
| 162 | + sb.append(SPLIT_CODE).append(getAgt_name()).append(CRLF) | ||
| 163 | + .append(SPLIT_CODE).append(getAgt_ADR()); | ||
| 164 | + | ||
| 165 | + | ||
| 166 | + | ||
| 167 | + sb.append(CRLF); | ||
| 168 | + } | ||
| 169 | + | ||
| 170 | + | ||
| 171 | + return sb.toString(); | ||
| 172 | + } | ||
| 173 | + | ||
| 174 | + @Override | ||
| 175 | + public String getNodeName() { | ||
| 176 | + return "AGT"; | ||
| 177 | + } | ||
| 47 | } | 178 | } |
| 1 | package com.sunyo.wlpt.base.model.efreight.fwb; | 1 | package com.sunyo.wlpt.base.model.efreight.fwb; |
| 2 | 2 | ||
| 3 | +import com.sunyo.wlpt.base.model.efreight.BASE; | ||
| 4 | +import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBException; | ||
| 5 | +import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBExceptionType; | ||
| 6 | + | ||
| 7 | +import java.util.regex.Matcher; | ||
| 8 | +import java.util.regex.Pattern; | ||
| 9 | + | ||
| 3 | /** | 10 | /** |
| 4 | * 主单收货人 | 11 | * 主单收货人 |
| 5 | * mandatory (must be included);M | 12 | * mandatory (must be included);M |
| 6 | */ | 13 | */ |
| 7 | -public class FWB_CNE { | 14 | +public class FWB_CNE extends BASE implements FWB_BASE { |
| 8 | 15 | ||
| 9 | /** | 16 | /** |
| 10 | * 收货人账号信息 | 17 | * 收货人账号信息 |
| @@ -57,6 +64,182 @@ public class FWB_CNE { | @@ -57,6 +64,182 @@ public class FWB_CNE { | ||
| 57 | */ | 64 | */ |
| 58 | private String cne_contact_number; | 65 | private String cne_contact_number; |
| 59 | 66 | ||
| 67 | + public String getCne_account_number() throws FWBException { | ||
| 68 | + | ||
| 69 | + String patternStr = "^[A-Z0-9-<=/\\s\\.]{0,14}$"; | ||
| 70 | + Pattern pattern = Pattern.compile(patternStr); | ||
| 71 | + Matcher matcher = pattern.matcher(cne_account_number); | ||
| 72 | + if (!matcher.find()){ | ||
| 73 | + throw new FWBException(FWBExceptionType.FWB_CNE_ACC_ERR); | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + return cne_account_number; | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + public void setCne_account_number(String cne_account_number) { | ||
| 80 | + this.cne_account_number = cne_account_number; | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + public String getCne_name() throws FWBException { | ||
| 84 | + | ||
| 85 | + String patternStr = "^[A-Z0-9-<=/\\s\\.]{0,35}$"; | ||
| 86 | + Pattern pattern = Pattern.compile(patternStr); | ||
| 87 | + Matcher matcher = pattern.matcher(cne_name); | ||
| 88 | + if (!matcher.find()){ | ||
| 89 | + throw new FWBException(FWBExceptionType.FWB_CNE_NAME_ERR); | ||
| 90 | + } | ||
| 91 | + return cne_name; | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + public void setCne_name(String cne_name) { | ||
| 95 | + this.cne_name = cne_name; | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + public String getCne_adr() throws FWBException { | ||
| 99 | + | ||
| 100 | + String patternStr = "^[A-Z0-9-<=/\\s\\.]{0,35}$"; | ||
| 101 | + Pattern pattern = Pattern.compile(patternStr); | ||
| 102 | + Matcher matcher = pattern.matcher(cne_adr); | ||
| 103 | + if (!matcher.find()){ | ||
| 104 | + throw new FWBException(FWBExceptionType.FWB_CNE_ADR_ERR); | ||
| 105 | + } | ||
| 106 | + return cne_adr; | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + public void setCne_adr(String cne_adr) { | ||
| 110 | + this.cne_adr = cne_adr; | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + public String getCne_loc_place() throws FWBException { | ||
| 114 | + | ||
| 115 | + String patternStr = "^[A-Z0-9-<=/\\s\\.]{0,17}$"; | ||
| 116 | + Pattern pattern = Pattern.compile(patternStr); | ||
| 117 | + Matcher matcher = pattern.matcher(cne_loc_place); | ||
| 118 | + if (!matcher.find()){ | ||
| 119 | + throw new FWBException(FWBExceptionType.FWB_CNE_PLC_ERR); | ||
| 120 | + } | ||
| 121 | + return cne_loc_place; | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + public void setCne_loc_place(String cne_loc_place) { | ||
| 125 | + this.cne_loc_place = cne_loc_place; | ||
| 126 | + } | ||
| 127 | + | ||
| 128 | + public String getCne_loc_province() throws FWBException { | ||
| 129 | + | ||
| 130 | + String patternStr = "^[A-Z0-9-<=/\\s\\.]{0,9}$"; | ||
| 131 | + Pattern pattern = Pattern.compile(patternStr); | ||
| 132 | + Matcher matcher = pattern.matcher(cne_loc_province); | ||
| 133 | + if (!matcher.find()){ | ||
| 134 | + throw new FWBException(FWBExceptionType.FWB_CNE_PVC_ERR); | ||
| 135 | + } | ||
| 136 | + return cne_loc_province; | ||
| 137 | + } | ||
| 138 | + | ||
| 139 | + public void setCne_loc_province(String cne_loc_province) { | ||
| 140 | + this.cne_loc_province = cne_loc_province; | ||
| 141 | + } | ||
| 142 | + | ||
| 143 | + public String getCne_country() throws FWBException { | ||
| 144 | + | ||
| 145 | + String patternStr = "^[A-Z]{2}$"; | ||
| 146 | + Pattern pattern = Pattern.compile(patternStr); | ||
| 147 | + Matcher matcher = pattern.matcher(cne_country); | ||
| 148 | + if (!matcher.find()){ | ||
| 149 | + throw new FWBException(FWBExceptionType.FWB_CNE_CNT_ERR); | ||
| 150 | + } | ||
| 151 | + return cne_country; | ||
| 152 | + } | ||
| 153 | + | ||
| 154 | + public void setCne_country(String cne_country) { | ||
| 155 | + this.cne_country = cne_country; | ||
| 156 | + } | ||
| 157 | + | ||
| 158 | + public String getCne_postcode() throws FWBException { | ||
| 159 | + | ||
| 160 | + String patternStr = "^[A-Z0-9-<=/\\s\\.]{0,9}$"; | ||
| 161 | + Pattern pattern = Pattern.compile(patternStr); | ||
| 162 | + Matcher matcher = pattern.matcher(cne_postcode); | ||
| 163 | + if (!matcher.find()){ | ||
| 164 | + throw new FWBException(FWBExceptionType.FWB_CNE_PC_ERR); | ||
| 165 | + } | ||
| 166 | + return cne_postcode; | ||
| 167 | + } | ||
| 168 | + | ||
| 169 | + public void setCne_postcode(String cne_postcode) { | ||
| 170 | + this.cne_postcode = cne_postcode; | ||
| 171 | + } | ||
| 172 | + | ||
| 173 | + public String getCne_contact_id() throws FWBException { | ||
| 174 | + | ||
| 175 | + String patternStr = "^FX|TE|TL$"; | ||
| 176 | + Pattern pattern = Pattern.compile(patternStr); | ||
| 177 | + Matcher matcher = pattern.matcher(cne_contact_id); | ||
| 178 | + if (!matcher.find()){ | ||
| 179 | + throw new FWBException(FWBExceptionType.FWB_CNE_CID_ERR); | ||
| 180 | + } | ||
| 181 | + return cne_contact_id; | ||
| 182 | + } | ||
| 183 | + | ||
| 184 | + public void setCne_contact_id(String cne_contact_id) { | ||
| 185 | + this.cne_contact_id = cne_contact_id; | ||
| 186 | + } | ||
| 187 | + | ||
| 188 | + public String getCne_contact_number() throws FWBException { | ||
| 189 | + String patternStr = "^[A-Z0-9]{1,25}$"; | ||
| 190 | + Pattern pattern = Pattern.compile(patternStr); | ||
| 191 | + Matcher matcher = pattern.matcher(cne_contact_number); | ||
| 192 | + if (!matcher.find()){ | ||
| 193 | + throw new FWBException(FWBExceptionType.FWB_CNE_CN_ERR); | ||
| 194 | + } | ||
| 195 | + return cne_contact_number; | ||
| 196 | + } | ||
| 197 | + | ||
| 198 | + public void setCne_contact_number(String cne_contact_number) { | ||
| 199 | + this.cne_contact_number = cne_contact_number; | ||
| 200 | + } | ||
| 201 | + | ||
| 202 | + @Override | ||
| 203 | + public String getFWBNodeText() throws FWBException { | ||
| 204 | + String SPLIT_CODE = "/"; | ||
| 205 | + String CRLF = "\n"; | ||
| 206 | + StringBuilder sb = new StringBuilder(""); | ||
| 207 | + if (hasText(cne_account_number)){ | ||
| 208 | + sb.append(SPLIT_CODE).append(getCne_account_number()); | ||
| 209 | + } | ||
| 210 | + sb.append(CRLF); | ||
| 211 | + sb.append(SPLIT_CODE).append(getCne_name()).append(CRLF); | ||
| 212 | + sb.append(SPLIT_CODE).append(getCne_adr()).append(CRLF); | ||
| 213 | + sb.append(SPLIT_CODE).append(getCne_loc_place()); | ||
| 214 | + if (hasText(getCne_loc_province())){ | ||
| 215 | + sb.append(SPLIT_CODE).append(getCne_loc_province()); | ||
| 216 | + } | ||
| 217 | + sb.append(CRLF); | ||
| 218 | + sb.append(SPLIT_CODE).append(getCne_country()); | ||
| 219 | + if (hasText(getCne_postcode())) { | ||
| 220 | + sb.append(SPLIT_CODE).append(getCne_postcode()); | ||
| 221 | + }else { | ||
| 222 | + if (hasText(getCne_contact_number())){ | ||
| 223 | + sb.append(SPLIT_CODE); | ||
| 224 | + } | ||
| 225 | + } | ||
| 226 | + | ||
| 227 | + //联系方式可重复不限次数,todo:处理这种联系方式 有多个信息的 | ||
| 228 | + if (hasText(getCne_contact_number())){ | ||
| 229 | + sb.append(SPLIT_CODE).append(getCne_contact_id()).append(SPLIT_CODE).append(getCne_contact_number()); | ||
| 230 | + } | ||
| 231 | + //todo:此节点循环的报文内容获取方式 | ||
| 232 | + | ||
| 233 | + sb.append(CRLF); | ||
| 234 | + | ||
| 235 | + return sb.toString(); | ||
| 236 | + } | ||
| 237 | + | ||
| 238 | + @Override | ||
| 239 | + public String getNodeName() { | ||
| 240 | + return "CNE"; | ||
| 241 | + } | ||
| 242 | + | ||
| 60 | 243 | ||
| 61 | } | 244 | } |
| 62 | 245 |
| 1 | package com.sunyo.wlpt.base.model.efreight.fwb; | 1 | package com.sunyo.wlpt.base.model.efreight.fwb; |
| 2 | + | ||
| 3 | +import com.sun.org.apache.bcel.internal.generic.IF_ACMPEQ; | ||
| 4 | +import com.sunyo.wlpt.base.model.efreight.BASE; | ||
| 5 | +import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBException; | ||
| 6 | +import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBExceptionType; | ||
| 7 | + | ||
| 8 | +import java.util.regex.Matcher; | ||
| 9 | +import java.util.regex.Pattern; | ||
| 10 | + | ||
| 2 | /** | 11 | /** |
| 3 | * CVD | 12 | * CVD |
| 4 | * Charge Declarations | 13 | * Charge Declarations |
| @@ -9,11 +18,11 @@ package com.sunyo.wlpt.base.model.efreight.fwb; | @@ -9,11 +18,11 @@ package com.sunyo.wlpt.base.model.efreight.fwb; | ||
| 9 | * CVD/CNY/(PX)/PP/NVD/NCV/XXX | 18 | * CVD/CNY/(PX)/PP/NVD/NCV/XXX |
| 10 | * CRLF | 19 | * CRLF |
| 11 | */ | 20 | */ |
| 12 | -public class FWB_CVD { | 21 | +public class FWB_CVD extends BASE implements FWB_BASE{ |
| 13 | 22 | ||
| 14 | /** | 23 | /** |
| 15 | * 货币单位 | 24 | * 货币单位 |
| 16 | - * [A-Z]{1,3} | 25 | + * [A-Z]{3} |
| 17 | * M | 26 | * M |
| 18 | * DEMO: | 27 | * DEMO: |
| 19 | * CNY | 28 | * CNY |
| @@ -64,10 +73,120 @@ public class FWB_CVD { | @@ -64,10 +73,120 @@ public class FWB_CVD { | ||
| 64 | /** | 73 | /** |
| 65 | * Value For insurance Declaration | 74 | * Value For insurance Declaration |
| 66 | * 保险声明价值 | 75 | * 保险声明价值 |
| 67 | - * [0-9.]{1,11} | 76 | + * [0-9.]{1,11}|XXX |
| 68 | * M 必填 | 77 | * M 必填 |
| 69 | * DEMO: | 78 | * DEMO: |
| 70 | * 123.05 OR XXX | 79 | * 123.05 OR XXX |
| 71 | */ | 80 | */ |
| 72 | - private String getCvd_value_for_customs; | 81 | + private String cvd_amount_of_insurance; |
| 82 | + | ||
| 83 | + public String getCvd_currency_code() throws FWBException { | ||
| 84 | + String patternStr = "^[A-Z]{3}$"; | ||
| 85 | + Pattern pattern = Pattern.compile(patternStr); | ||
| 86 | + Matcher matcher = pattern.matcher(cvd_currency_code); | ||
| 87 | + if (!matcher.find()){ | ||
| 88 | + throw new FWBException(FWBExceptionType.FWB_CVD_CUR_ERR); | ||
| 89 | + } | ||
| 90 | + return cvd_currency_code; | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + public void setCvd_currency_code(String cvd_currency_code) { | ||
| 94 | + this.cvd_currency_code = cvd_currency_code; | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + public String getCvd_charge_code() throws FWBException { | ||
| 98 | + String patternStr = "^[A-Z]{2}$"; | ||
| 99 | + Pattern pattern = Pattern.compile(patternStr); | ||
| 100 | + Matcher matcher = pattern.matcher(cvd_charge_code); | ||
| 101 | + if (!matcher.find()){ | ||
| 102 | + throw new FWBException(FWBExceptionType.FWB_CVD_CC_ERR); | ||
| 103 | + } | ||
| 104 | + return cvd_charge_code; | ||
| 105 | + } | ||
| 106 | + | ||
| 107 | + public void setCvd_charge_code(String cvd_charge_code) { | ||
| 108 | + this.cvd_charge_code = cvd_charge_code; | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + public String getCvd_charge_prepaid() throws FWBException { | ||
| 112 | + String patternStr = "^PP|CC$"; | ||
| 113 | + Pattern pattern = Pattern.compile(patternStr); | ||
| 114 | + Matcher matcher = pattern.matcher(cvd_charge_prepaid); | ||
| 115 | + if (!matcher.find()){ | ||
| 116 | + throw new FWBException(FWBExceptionType.FWB_CVD_PCCD_ERR); | ||
| 117 | + } | ||
| 118 | + return cvd_charge_prepaid; | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + public void setCvd_charge_prepaid(String cvd_charge_prepaid) { | ||
| 122 | + this.cvd_charge_prepaid = cvd_charge_prepaid; | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + public String getCvd_value_for_carriage() throws FWBException { | ||
| 126 | + String patternStr = "^[0-9\\.]{1,12}|NVD$"; | ||
| 127 | + Pattern pattern = Pattern.compile(patternStr); | ||
| 128 | + Matcher matcher = pattern.matcher(cvd_value_for_carriage); | ||
| 129 | + if (!matcher.find()){ | ||
| 130 | + throw new FWBException(FWBExceptionType.FWB_CVD_VCD_ERR); | ||
| 131 | + } | ||
| 132 | + return cvd_value_for_carriage; | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + public void setCvd_value_for_carriage(String cvd_value_for_carriage) { | ||
| 136 | + this.cvd_value_for_carriage = cvd_value_for_carriage; | ||
| 137 | + } | ||
| 138 | + | ||
| 139 | + public String getCvd_value_for_customs() throws FWBException { | ||
| 140 | + String patternStr = "^[0-9\\.]{1,12}|NCV$"; | ||
| 141 | + Pattern pattern = Pattern.compile(patternStr); | ||
| 142 | + Matcher matcher = pattern.matcher(cvd_value_for_customs); | ||
| 143 | + if (!matcher.find()){ | ||
| 144 | + throw new FWBException(FWBExceptionType.FWB_CVD_DVC_ERR); | ||
| 145 | + } | ||
| 146 | + return cvd_value_for_customs; | ||
| 147 | + } | ||
| 148 | + | ||
| 149 | + public void setCvd_value_for_customs(String cvd_value_for_customs) { | ||
| 150 | + this.cvd_value_for_customs = cvd_value_for_customs; | ||
| 151 | + } | ||
| 152 | + | ||
| 153 | + public String getCvd_amount_of_insurance() throws FWBException { | ||
| 154 | + String patternStr = "^[0-9\\.]{1,11}|XXX$"; | ||
| 155 | + Pattern pattern = Pattern.compile(patternStr); | ||
| 156 | + Matcher matcher = pattern.matcher(cvd_amount_of_insurance); | ||
| 157 | + if (!matcher.find()){ | ||
| 158 | + throw new FWBException(FWBExceptionType.FWB_CVD_VID_ERR); | ||
| 159 | + } | ||
| 160 | + return cvd_amount_of_insurance; | ||
| 161 | + } | ||
| 162 | + | ||
| 163 | + public void setCvd_amount_of_insurance(String cvd_amount_of_insurance) { | ||
| 164 | + this.cvd_amount_of_insurance = cvd_amount_of_insurance; | ||
| 165 | + } | ||
| 166 | + | ||
| 167 | + @Override | ||
| 168 | + public String getFWBNodeText() throws FWBException { | ||
| 169 | + String SPLIT_CODE = "/"; | ||
| 170 | + String CRLF = "\n"; | ||
| 171 | + StringBuilder sb = new StringBuilder(""); | ||
| 172 | + sb.append(getNodeName()).append(SPLIT_CODE).append(getCvd_currency_code()).append(SPLIT_CODE); | ||
| 173 | + if (hasText(cvd_charge_code)){ | ||
| 174 | + sb.append(getCvd_charge_code()); | ||
| 175 | + } | ||
| 176 | + sb.append(SPLIT_CODE).append(getCvd_charge_prepaid()); | ||
| 177 | + | ||
| 178 | + sb.append(SPLIT_CODE).append(getCvd_value_for_carriage()).append(SPLIT_CODE).append(getCvd_value_for_customs()); | ||
| 179 | + sb.append(SPLIT_CODE).append(getCvd_amount_of_insurance()); | ||
| 180 | + sb.append(CRLF); | ||
| 181 | + | ||
| 182 | + | ||
| 183 | + | ||
| 184 | + | ||
| 185 | + return sb.toString(); | ||
| 186 | + } | ||
| 187 | + | ||
| 188 | + @Override | ||
| 189 | + public String getNodeName() { | ||
| 190 | + return "CVD"; | ||
| 191 | + } | ||
| 73 | } | 192 | } |
| 1 | package com.sunyo.wlpt.base.model.efreight.fwb; | 1 | package com.sunyo.wlpt.base.model.efreight.fwb; |
| 2 | 2 | ||
| 3 | +import com.sunyo.wlpt.base.model.efreight.BASE; | ||
| 4 | +import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBException; | ||
| 5 | +import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBExceptionType; | ||
| 6 | + | ||
| 7 | +import java.util.regex.Matcher; | ||
| 8 | +import java.util.regex.Pattern; | ||
| 9 | + | ||
| 3 | /** | 10 | /** |
| 4 | * NFY | 11 | * NFY |
| 5 | * Also Notify | 12 | * Also Notify |
| @@ -9,7 +16,7 @@ package com.sunyo.wlpt.base.model.efreight.fwb; | @@ -9,7 +16,7 @@ package com.sunyo.wlpt.base.model.efreight.fwb; | ||
| 9 | * DEMO: | 16 | * DEMO: |
| 10 | * /NFY/ | 17 | * /NFY/ |
| 11 | */ | 18 | */ |
| 12 | -public class FWB_NFY { | 19 | +public class FWB_NFY extends BASE implements FWB_BASE { |
| 13 | /** | 20 | /** |
| 14 | * 被通知人名称 | 21 | * 被通知人名称 |
| 15 | * [A-Z0-9-<=/\s\.]{1,35} | 22 | * [A-Z0-9-<=/\s\.]{1,35} |
| @@ -68,4 +75,158 @@ public class FWB_NFY { | @@ -68,4 +75,158 @@ public class FWB_NFY { | ||
| 68 | * M | 75 | * M |
| 69 | */ | 76 | */ |
| 70 | private String nfy_contact_NUM; | 77 | private String nfy_contact_NUM; |
| 78 | + | ||
| 79 | + public String getNfy_name() throws FWBException { | ||
| 80 | + String patternStr = "^[A-Z0-9-<=/\\s\\.]{0,35}$"; | ||
| 81 | + Pattern pattern = Pattern.compile(patternStr); | ||
| 82 | + Matcher matcher = pattern.matcher(nfy_name); | ||
| 83 | + if (!matcher.find()){ | ||
| 84 | + throw new FWBException(FWBExceptionType.FWB_NFY_NAME_ERR); | ||
| 85 | + } | ||
| 86 | + return nfy_name; | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + public void setNfy_name(String nfy_name) { | ||
| 90 | + this.nfy_name = nfy_name; | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + public String getNfy_ADR() throws FWBException { | ||
| 94 | + String patternStr = "^[A-Z0-9-<=/\\s\\.]{0,35}$"; | ||
| 95 | + Pattern pattern = Pattern.compile(patternStr); | ||
| 96 | + Matcher matcher = pattern.matcher(nfy_ADR); | ||
| 97 | + if (!matcher.find()){ | ||
| 98 | + throw new FWBException(FWBExceptionType.FWB_NFY_ADR_ERR); | ||
| 99 | + } | ||
| 100 | + return nfy_ADR; | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + public void setNfy_ADR(String nfy_ADR) { | ||
| 104 | + this.nfy_ADR = nfy_ADR; | ||
| 105 | + } | ||
| 106 | + | ||
| 107 | + public String getNfy_LOC_city() throws FWBException { | ||
| 108 | + String patternStr = "^[A-Z0-9-<=/\\s\\.]{0,17}$"; | ||
| 109 | + Pattern pattern = Pattern.compile(patternStr); | ||
| 110 | + Matcher matcher = pattern.matcher(nfy_LOC_city); | ||
| 111 | + if (!matcher.find()){ | ||
| 112 | + throw new FWBException(FWBExceptionType.FWB_NFY_PLC_ERR); | ||
| 113 | + } | ||
| 114 | + return nfy_LOC_city; | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + public void setNfy_LOC_city(String nfy_LOC_city) { | ||
| 118 | + this.nfy_LOC_city = nfy_LOC_city; | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + public String getNfy_LOC_province() throws FWBException { | ||
| 122 | + String patternStr = "^[A-Z0-9-<=/\\s\\.]{0,9}$"; | ||
| 123 | + Pattern pattern = Pattern.compile(patternStr); | ||
| 124 | + Matcher matcher = pattern.matcher(nfy_LOC_province); | ||
| 125 | + if (!matcher.find()){ | ||
| 126 | + throw new FWBException(FWBExceptionType.FWB_NFY_PVC_ERR); | ||
| 127 | + } | ||
| 128 | + return nfy_LOC_province; | ||
| 129 | + } | ||
| 130 | + | ||
| 131 | + public void setNfy_LOC_province(String nfy_LOC_province) { | ||
| 132 | + this.nfy_LOC_province = nfy_LOC_province; | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + public String getNfy_country() throws FWBException { | ||
| 136 | + String patternStr = "^[A-Z]{2}$"; | ||
| 137 | + Pattern pattern = Pattern.compile(patternStr); | ||
| 138 | + Matcher matcher = pattern.matcher(nfy_country); | ||
| 139 | + if (!matcher.find()){ | ||
| 140 | + throw new FWBException(FWBExceptionType.FWB_NFY_CNT_ERR); | ||
| 141 | + } | ||
| 142 | + return nfy_country; | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | + public void setNfy_country(String nfy_country) { | ||
| 146 | + this.nfy_country = nfy_country; | ||
| 147 | + } | ||
| 148 | + | ||
| 149 | + public String getNfy_postcode() throws FWBException { | ||
| 150 | + String patternStr = "^[A-Z0-9-<=/\\s\\.]{0,9}$"; | ||
| 151 | + Pattern pattern = Pattern.compile(patternStr); | ||
| 152 | + Matcher matcher = pattern.matcher(nfy_postcode); | ||
| 153 | + if (!matcher.find()){ | ||
| 154 | + throw new FWBException(FWBExceptionType.FWB_NFY_PC_ERR); | ||
| 155 | + } | ||
| 156 | + return nfy_postcode; | ||
| 157 | + } | ||
| 158 | + | ||
| 159 | + public void setNfy_postcode(String nfy_postcode) { | ||
| 160 | + this.nfy_postcode = nfy_postcode; | ||
| 161 | + } | ||
| 162 | + | ||
| 163 | + public String getNfy_contact_id() throws FWBException { | ||
| 164 | + String patternStr = "^FX|TE|TL$"; | ||
| 165 | + Pattern pattern = Pattern.compile(patternStr); | ||
| 166 | + Matcher matcher = pattern.matcher(nfy_contact_id); | ||
| 167 | + if (!matcher.find()){ | ||
| 168 | + throw new FWBException(FWBExceptionType.FWB_NFY_CID_ERR); | ||
| 169 | + } | ||
| 170 | + return nfy_contact_id; | ||
| 171 | + } | ||
| 172 | + | ||
| 173 | + public void setNfy_contact_id(String nfy_contact_id) { | ||
| 174 | + this.nfy_contact_id = nfy_contact_id; | ||
| 175 | + } | ||
| 176 | + | ||
| 177 | + public String getNfy_contact_NUM() throws FWBException { | ||
| 178 | + String patternStr = "^[A-Z0-9]{1,25}$"; | ||
| 179 | + Pattern pattern = Pattern.compile(patternStr); | ||
| 180 | + Matcher matcher = pattern.matcher(nfy_contact_NUM); | ||
| 181 | + if (!matcher.find()){ | ||
| 182 | + throw new FWBException(FWBExceptionType.FWB_NFY_CN_ERR); | ||
| 183 | + } | ||
| 184 | + return nfy_contact_NUM; | ||
| 185 | + } | ||
| 186 | + | ||
| 187 | + public void setNfy_contact_NUM(String nfy_contact_NUM) { | ||
| 188 | + this.nfy_contact_NUM = nfy_contact_NUM; | ||
| 189 | + } | ||
| 190 | + | ||
| 191 | + @Override | ||
| 192 | + public String getFWBNodeText() throws FWBException { | ||
| 193 | + String SPLIT_CODE = "/"; | ||
| 194 | + String CRLF = "\n"; | ||
| 195 | + StringBuilder sb = new StringBuilder(""); | ||
| 196 | + | ||
| 197 | + if (hasText(nfy_name) || hasText(nfy_ADR) || hasText(nfy_LOC_city) || hasText(nfy_country)){ | ||
| 198 | + sb.append(getNodeName()); | ||
| 199 | + sb.append(SPLIT_CODE).append(getNfy_name()).append(CRLF); | ||
| 200 | + sb.append(SPLIT_CODE).append(getNfy_ADR()).append(CRLF); | ||
| 201 | + | ||
| 202 | + sb.append(SPLIT_CODE).append(getNfy_LOC_city()); | ||
| 203 | + if (hasText(nfy_LOC_province)){ | ||
| 204 | + sb.append(SPLIT_CODE).append(getNfy_LOC_province()); | ||
| 205 | + } | ||
| 206 | + sb.append(CRLF); | ||
| 207 | + | ||
| 208 | + sb.append(SPLIT_CODE).append(getNfy_country()); | ||
| 209 | + if (hasText(nfy_postcode)){ | ||
| 210 | + sb.append(SPLIT_CODE).append(getNfy_postcode()); | ||
| 211 | + }else { | ||
| 212 | + if (hasText(nfy_contact_NUM)){ | ||
| 213 | + sb.append(SPLIT_CODE); | ||
| 214 | + } | ||
| 215 | + } | ||
| 216 | + | ||
| 217 | + if (hasText(nfy_contact_NUM)){ | ||
| 218 | + sb.append(SPLIT_CODE).append(getNfy_contact_id()).append(SPLIT_CODE).append(getNfy_contact_NUM()); | ||
| 219 | + } | ||
| 220 | + sb.append(CRLF); | ||
| 221 | + | ||
| 222 | + | ||
| 223 | + } | ||
| 224 | + | ||
| 225 | + return sb.toString(); | ||
| 226 | + } | ||
| 227 | + | ||
| 228 | + @Override | ||
| 229 | + public String getNodeName() { | ||
| 230 | + return "NFY"; | ||
| 231 | + } | ||
| 71 | } | 232 | } |
| 1 | package com.sunyo.wlpt.base.model.efreight.fwb; | 1 | package com.sunyo.wlpt.base.model.efreight.fwb; |
| 2 | 2 | ||
| 3 | +import com.sunyo.wlpt.base.model.efreight.BASE; | ||
| 4 | +import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBException; | ||
| 5 | +import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBExceptionType; | ||
| 6 | + | ||
| 7 | +import java.util.regex.Matcher; | ||
| 8 | +import java.util.regex.Pattern; | ||
| 9 | + | ||
| 3 | /** | 10 | /** |
| 4 | * 主单发货人 | 11 | * 主单发货人 |
| 5 | * mandatory (must be included); M | 12 | * mandatory (must be included); M |
| 6 | */ | 13 | */ |
| 7 | -public class FWB_SHP { | 14 | +public class FWB_SHP extends BASE implements FWB_BASE { |
| 8 | 15 | ||
| 9 | /** | 16 | /** |
| 10 | * 发货人账号信息 | 17 | * 发货人账号信息 |
| @@ -57,5 +64,175 @@ public class FWB_SHP { | @@ -57,5 +64,175 @@ public class FWB_SHP { | ||
| 57 | private String shp_contact_number; | 64 | private String shp_contact_number; |
| 58 | 65 | ||
| 59 | 66 | ||
| 67 | + | ||
| 68 | + public String getShp_account_number() throws FWBException { | ||
| 69 | + String patternStr = "^[A-Z0-9-<=/\\s\\.]{0,14}$"; | ||
| 70 | + Pattern pattern = Pattern.compile(patternStr); | ||
| 71 | + Matcher matcher = pattern.matcher(shp_account_number); | ||
| 72 | + if (!matcher.find()){ | ||
| 73 | + throw new FWBException(FWBExceptionType.FWB_SHP_ACC_ERR); | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + return shp_account_number; | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + public void setShp_account_number(String shp_account_number) { | ||
| 80 | + | ||
| 81 | + this.shp_account_number = shp_account_number; | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + public String getShp_name() throws FWBException { | ||
| 85 | + | ||
| 86 | + String patternStr = "^[A-Z0-9-<=/\\s\\.]{0,35}$"; | ||
| 87 | + Pattern pattern = Pattern.compile(patternStr); | ||
| 88 | + Matcher matcher = pattern.matcher(shp_name); | ||
| 89 | + if (!matcher.find()){ | ||
| 90 | + throw new FWBException(FWBExceptionType.FWB_SHP_NAME_ERR); | ||
| 91 | + } | ||
| 92 | + return shp_name; | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + public void setShp_name(String shp_name) { | ||
| 96 | + this.shp_name = shp_name; | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + public String getShp_adr() throws FWBException { | ||
| 100 | + String patternStr = "^[A-Z0-9-<=/\\s\\.]{0,35}$"; | ||
| 101 | + Pattern pattern = Pattern.compile(patternStr); | ||
| 102 | + Matcher matcher = pattern.matcher(shp_adr); | ||
| 103 | + if (!matcher.find()){ | ||
| 104 | + throw new FWBException(FWBExceptionType.FWB_SHP_ADR_ERR); | ||
| 105 | + } | ||
| 106 | + return shp_adr; | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + public void setShp_adr(String shp_adr) { | ||
| 110 | + this.shp_adr = shp_adr; | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + public String getShp_loc_place() throws FWBException { | ||
| 114 | + String patternStr = "^[A-Z0-9-<=/\\s\\.]{0,17}$"; | ||
| 115 | + Pattern pattern = Pattern.compile(patternStr); | ||
| 116 | + Matcher matcher = pattern.matcher(shp_loc_place); | ||
| 117 | + if (!matcher.find()){ | ||
| 118 | + throw new FWBException(FWBExceptionType.FWB_SHP_PLC_ERR); | ||
| 119 | + } | ||
| 120 | + return shp_loc_place; | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + public void setShp_loc_place(String shp_loc_place) { | ||
| 124 | + this.shp_loc_place = shp_loc_place; | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + public String getShp_loc_province() throws FWBException { | ||
| 128 | + String patternStr = "^[A-Z0-9-<=/\\s\\.]{0,9}$"; | ||
| 129 | + Pattern pattern = Pattern.compile(patternStr); | ||
| 130 | + Matcher matcher = pattern.matcher(shp_loc_province); | ||
| 131 | + if (!matcher.find()){ | ||
| 132 | + throw new FWBException(FWBExceptionType.FWB_SHP_PVC_ERR); | ||
| 133 | + } | ||
| 134 | + return shp_loc_province; | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + public void setShp_loc_province(String shp_loc_province) { | ||
| 138 | + this.shp_loc_province = shp_loc_province; | ||
| 139 | + } | ||
| 140 | + | ||
| 141 | + public String getShp_country() throws FWBException { | ||
| 142 | + String patternStr = "^[A-Z]{2}$"; | ||
| 143 | + Pattern pattern = Pattern.compile(patternStr); | ||
| 144 | + Matcher matcher = pattern.matcher(shp_country); | ||
| 145 | + if (!matcher.find()){ | ||
| 146 | + throw new FWBException(FWBExceptionType.FWB_SHP_CNT_ERR); | ||
| 147 | + } | ||
| 148 | + return shp_country; | ||
| 149 | + } | ||
| 150 | + | ||
| 151 | + public void setShp_country(String shp_country) { | ||
| 152 | + this.shp_country = shp_country; | ||
| 153 | + } | ||
| 154 | + | ||
| 155 | + public String getShp_postcode() throws FWBException { | ||
| 156 | + String patternStr = "^[A-Z0-9-<=/\\s\\.]{0,9}$"; | ||
| 157 | + Pattern pattern = Pattern.compile(patternStr); | ||
| 158 | + Matcher matcher = pattern.matcher(shp_postcode); | ||
| 159 | + if (!matcher.find()){ | ||
| 160 | + throw new FWBException(FWBExceptionType.FWB_SHP_PC_ERR); | ||
| 161 | + } | ||
| 162 | + return shp_postcode; | ||
| 163 | + } | ||
| 164 | + | ||
| 165 | + public void setShp_postcode(String shp_postcode) { | ||
| 166 | + this.shp_postcode = shp_postcode; | ||
| 167 | + } | ||
| 168 | + | ||
| 169 | + public String getShp_contact_id() throws FWBException { | ||
| 170 | + String patternStr = "^FX|TE|TL$"; | ||
| 171 | + Pattern pattern = Pattern.compile(patternStr); | ||
| 172 | + Matcher matcher = pattern.matcher(shp_contact_id); | ||
| 173 | + if (!matcher.find()){ | ||
| 174 | + throw new FWBException(FWBExceptionType.FWB_SHP_CID_ERR); | ||
| 175 | + } | ||
| 176 | + return shp_contact_id; | ||
| 177 | + } | ||
| 178 | + | ||
| 179 | + public void setShp_contact_id(String shp_contact_id) { | ||
| 180 | + this.shp_contact_id = shp_contact_id; | ||
| 181 | + } | ||
| 182 | + | ||
| 183 | + public String getShp_contact_number() throws FWBException { | ||
| 184 | + String patternStr = "^[A-Z0-9]{1,25}$"; | ||
| 185 | + Pattern pattern = Pattern.compile(patternStr); | ||
| 186 | + Matcher matcher = pattern.matcher(shp_contact_number); | ||
| 187 | + if (!matcher.find()){ | ||
| 188 | + throw new FWBException(FWBExceptionType.FWB_SHP_CN_ERR); | ||
| 189 | + } | ||
| 190 | + return shp_contact_number; | ||
| 191 | + } | ||
| 192 | + | ||
| 193 | + public void setShp_contact_number(String shp_contact_number) { | ||
| 194 | + this.shp_contact_number = shp_contact_number; | ||
| 195 | + } | ||
| 196 | + | ||
| 197 | + @Override | ||
| 198 | + public String getFWBNodeText() throws FWBException { | ||
| 199 | + String SPLIT_CODE = "/"; | ||
| 200 | + String CRLF = "\n"; | ||
| 201 | + StringBuilder sb = new StringBuilder(""); | ||
| 202 | + if (hasText(shp_account_number)){ | ||
| 203 | + sb.append(SPLIT_CODE).append(getShp_account_number()); | ||
| 204 | + } | ||
| 205 | + sb.append(CRLF); | ||
| 206 | + sb.append(SPLIT_CODE).append(getShp_name()).append(CRLF); | ||
| 207 | + sb.append(SPLIT_CODE).append(getShp_adr()).append(CRLF); | ||
| 208 | + sb.append(SPLIT_CODE).append(getShp_loc_place()); | ||
| 209 | + if (hasText(shp_loc_province)){ | ||
| 210 | + sb.append(SPLIT_CODE).append(getShp_loc_province()); | ||
| 211 | + } | ||
| 212 | + sb.append(CRLF); | ||
| 213 | + sb.append(SPLIT_CODE).append(getShp_country()); | ||
| 214 | + if (hasText(shp_postcode)) { | ||
| 215 | + sb.append(SPLIT_CODE).append(getShp_postcode()); | ||
| 216 | + }else { | ||
| 217 | + if (hasText(shp_contact_number)){ | ||
| 218 | + sb.append(SPLIT_CODE); | ||
| 219 | + } | ||
| 220 | + } | ||
| 221 | + | ||
| 222 | + //联系方式可重复不限次数,todo:处理这种联系方式 有多个信息的 | ||
| 223 | + if (hasText(shp_contact_number)){ | ||
| 224 | + sb.append(SPLIT_CODE).append(getShp_contact_id()).append(SPLIT_CODE).append(getShp_contact_number()); | ||
| 225 | + } | ||
| 226 | + //todo:此节点循环的报文内容获取方式 | ||
| 227 | + | ||
| 228 | + sb.append(CRLF); | ||
| 229 | + | ||
| 230 | + return sb.toString(); | ||
| 231 | + } | ||
| 232 | + | ||
| 233 | + @Override | ||
| 234 | + public String getNodeName() { | ||
| 235 | + return "SHP"; | ||
| 236 | + } | ||
| 60 | } | 237 | } |
| 61 | 238 |
| 1 | package com.sunyo.wlpt.base.model.efreight.fwb; | 1 | package com.sunyo.wlpt.base.model.efreight.fwb; |
| 2 | 2 | ||
| 3 | +import com.sunyo.wlpt.base.model.efreight.BASE; | ||
| 4 | +import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBException; | ||
| 5 | +import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBExceptionType; | ||
| 6 | + | ||
| 7 | +import java.util.regex.Matcher; | ||
| 8 | +import java.util.regex.Pattern; | ||
| 9 | + | ||
| 3 | /** | 10 | /** |
| 4 | * SSR | 11 | * SSR |
| 5 | - * special service request | 12 | + * Special Service Request |
| 6 | * 特殊服务请求 | 13 | * 特殊服务请求 |
| 7 | * optional (may be included) 可选(有可能包含) | 14 | * optional (may be included) 可选(有可能包含) |
| 8 | * 请求最多可重复3次 | 15 | * 请求最多可重复3次 |
| 9 | * DEMO: | 16 | * DEMO: |
| 10 | * /SSR/RQUEST TXT/REQUST TXT/REQUEST TXT | 17 | * /SSR/RQUEST TXT/REQUST TXT/REQUEST TXT |
| 11 | */ | 18 | */ |
| 12 | -public class FWB_SSR { | 19 | +public class FWB_SSR extends BASE implements FWB_BASE { |
| 13 | /** | 20 | /** |
| 14 | * 特殊服务请求内容 | 21 | * 特殊服务请求内容 |
| 15 | * [A-Z0-9-<=/\s\.]{0,65} | 22 | * [A-Z0-9-<=/\s\.]{0,65} |
| 16 | */ | 23 | */ |
| 17 | private String ssr_request_content; | 24 | private String ssr_request_content; |
| 25 | + | ||
| 26 | + public String getSsr_request_content() throws FWBException { | ||
| 27 | + | ||
| 28 | + String patternStr = "^[A-Z0-9-<=/\\s\\.]{0,65}$"; | ||
| 29 | + Pattern pattern = Pattern.compile(patternStr); | ||
| 30 | + Matcher matcher = pattern.matcher(ssr_request_content); | ||
| 31 | + if (!matcher.find()){ | ||
| 32 | + throw new FWBException(FWBExceptionType.FWB_SSR_CONT_ERR); | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + return ssr_request_content; | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + public void setSsr_request_content(String ssr_request_content) { | ||
| 39 | + this.ssr_request_content = ssr_request_content; | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + @Override | ||
| 43 | + public String getFWBNodeText() throws FWBException { | ||
| 44 | + String SPLIT_CODE = "/"; | ||
| 45 | + String CRLF = "\n"; | ||
| 46 | + StringBuilder sb = new StringBuilder(""); | ||
| 47 | + | ||
| 48 | + if (hasText(ssr_request_content)){ | ||
| 49 | + sb.append(getNodeName()); | ||
| 50 | + sb.append(SPLIT_CODE).append(getSsr_request_content()); | ||
| 51 | + sb.append(CRLF); | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + return sb.toString(); | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + @Override | ||
| 58 | + public String getNodeName() { | ||
| 59 | + return "SSR"; | ||
| 60 | + } | ||
| 18 | } | 61 | } |
| @@ -32,6 +32,56 @@ public enum FWBExceptionType { | @@ -32,6 +32,56 @@ public enum FWBExceptionType { | ||
| 32 | FWB_RTG_AIRPORT_ERR("422","涉及航站信息有误"), | 32 | FWB_RTG_AIRPORT_ERR("422","涉及航站信息有误"), |
| 33 | FWB_RTG_CARRIER_ERR("422","涉及承运人信息有误"), | 33 | FWB_RTG_CARRIER_ERR("422","涉及承运人信息有误"), |
| 34 | 34 | ||
| 35 | + FWB_SHP_ACC_ERR("522","发货人账号信息格式有误"), | ||
| 36 | + FWB_SHP_NAME_ERR("543","发货人名称信息格式有误"), | ||
| 37 | + FWB_SHP_ADR_ERR("553","发货人地址信息格式有误"), | ||
| 38 | + FWB_SHP_PLC_ERR("563","发货人城市信息格式有误"), | ||
| 39 | + FWB_SHP_PVC_ERR("565","发货人省份信息格式有误"), | ||
| 40 | + FWB_SHP_CNT_ERR("572","发货人国家信息格式有误"), | ||
| 41 | + FWB_SHP_PC_ERR("573","发货人邮编信息格式有误"), | ||
| 42 | + FWB_SHP_CID_ERR("582","发货人联系方式代码格式有误"), | ||
| 43 | + FWB_SHP_CN_ERR("584","发货人联系方式信息格式有误"), | ||
| 44 | + | ||
| 45 | + FWB_CNE_ACC_ERR("622","收货人账号信息格式有误"), | ||
| 46 | + FWB_CNE_NAME_ERR("643","收货人名称信息格式有误"), | ||
| 47 | + FWB_CNE_ADR_ERR("653","收货人地址信息格式有误"), | ||
| 48 | + FWB_CNE_PLC_ERR("663","收货人城市信息格式有误"), | ||
| 49 | + FWB_CNE_PVC_ERR("665","收货人省份信息格式有误"), | ||
| 50 | + FWB_CNE_CNT_ERR("672","收货人国家信息格式有误"), | ||
| 51 | + FWB_CNE_PC_ERR("673","收货人邮编信息格式有误"), | ||
| 52 | + FWB_CNE_CID_ERR("682","收货人联系方式代码格式有误"), | ||
| 53 | + FWB_CNE_CN_ERR("684","收货人联系方式信息格式有误"), | ||
| 54 | + | ||
| 55 | + | ||
| 56 | + FWB_AGT_ACC_ERR("722","代理人账号信息格式有误"), | ||
| 57 | + FWB_AGT_IATA_ERR("724","代理人IATA注册号信息格式有误"), | ||
| 58 | + FWB_AGT_CASS_ERR("726","代理人CASS注册号信息格式有误"), | ||
| 59 | + FWB_AGT_PID_ERR("728","代理人参与者标识符信息格式有误"), | ||
| 60 | + FWB_AGT_NAME_ERR("742","代理人名称信息格式有误"), | ||
| 61 | + FWB_AGT_ADR_ERR("752","代理人地址信息格式有误"), | ||
| 62 | + | ||
| 63 | + FWB_SSR_CONT_ERR("883","SSR特殊服务请求内容信息格式有误"), | ||
| 64 | + | ||
| 65 | + FWB_NFY_NAME_ERR("933","被通知人名称信息格式有误"), | ||
| 66 | + FWB_NFY_ADR_ERR("943"," 被通知人地址信息格式有误"), | ||
| 67 | + FWB_NFY_PLC_ERR("953"," 被通知人城市信息格式有误"), | ||
| 68 | + FWB_NFY_PVC_ERR("955"," 被通知人省份信息格式有误"), | ||
| 69 | + FWB_NFY_CNT_ERR("962"," 被通知人国家信息格式有误"), | ||
| 70 | + FWB_NFY_PC_ERR("964"," 被通知人邮编信息格式有误"), | ||
| 71 | + FWB_NFY_CID_ERR("972"," 被通知人联系方式代码格式有误"), | ||
| 72 | + FWB_NFY_CN_ERR("974"," 被通知人联系方式信息格式有误"), | ||
| 73 | + | ||
| 74 | + FWB_ACC_ID_ERR ("1022","ACC财务信息ID格式有误"), | ||
| 75 | + FWB_ACC_INFO_ERR("1024","ACC财务信息内容格式有误"), | ||
| 76 | + | ||
| 77 | + FWB_CVD_CUR_ERR("1130","CVD收费声明货币单位格式有误"), | ||
| 78 | + FWB_CVD_CC_ERR("1150","CVD收费代码格式有误"), | ||
| 79 | + FWB_CVD_PCCD_ERR("1170","CVD预付/到付声明格式有误"), | ||
| 80 | + FWB_CVD_VCD_ERR("1180","运费申报价值对承运人声明格式有误"), | ||
| 81 | + FWB_CVD_DVC_ERR("11101","海关声明价值格式有误"), | ||
| 82 | + FWB_CVD_VID_ERR("11112","保险声明价值格式有误"), | ||
| 83 | + | ||
| 84 | + | ||
| 35 | 85 | ||
| 36 | REF_ERROR("203", "缺少 REF Sender Reference - Sender Office Message Address"), | 86 | REF_ERROR("203", "缺少 REF Sender Reference - Sender Office Message Address"), |
| 37 | REF_SOMA_REGEX_FAILD("2031", "REF- Sender Office Message Address RegEx Faild"), | 87 | REF_SOMA_REGEX_FAILD("2031", "REF- Sender Office Message Address RegEx Faild"), |
| 1 | +import com.sun.org.apache.regexp.internal.RE; | ||
| 1 | import com.sunyo.wlpt.base.model.efreight.fwb.*; | 2 | import com.sunyo.wlpt.base.model.efreight.fwb.*; |
| 2 | import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBException; | 3 | import com.sunyo.wlpt.base.model.efreight.fwb.exception.FWBException; |
| 3 | 4 | ||
| 4 | public class FWBTest { | 5 | public class FWBTest { |
| 5 | - | ||
| 6 | public static void main(String[] args) { | 6 | public static void main(String[] args) { |
| 7 | 7 | ||
| 8 | - FWB_WAYBILL_TEST(); | ||
| 9 | -// FWB_FLT_TEST(); | ||
| 10 | - FWB_RTG_TEST(); | ||
| 11 | - REF_TEST(); | ||
| 12 | - | ||
| 13 | -// OCI_TEST(); | ||
| 14 | - | ||
| 15 | 8 | ||
| 16 | - } | 9 | + System.out.println( |
| 10 | + FWB_WAYBILL_TEST() | ||
| 11 | + + FWB_FLT_TEST() | ||
| 12 | + + FWB_RTG_TEST() | ||
| 13 | + + FWB_SHP_TEST() | ||
| 14 | + + FWB_AGT_TEST() | ||
| 15 | + + FWB_SSR_TEST() | ||
| 16 | + + FWB_NFY_TEST() | ||
| 17 | + + FWB_ACC_TEST() | ||
| 18 | + + FWB_CVD_TEST() | ||
| 19 | + ); | ||
| 20 | +// REF_TEST(); | ||
| 17 | 21 | ||
| 18 | - static void OCI_TEST(){ | ||
| 19 | - FWB_OCI fwb_oci = new FWB_OCI(); | ||
| 20 | - fwb_oci.setOci_csrc_id("T"); | ||
| 21 | - fwb_oci.setOci_csrc_info("USCI91440101MA9Y9E79XG"); | ||
| 22 | - fwb_oci.setOci_country_code("CN"); | ||
| 23 | - fwb_oci.setOci_information_id("SHP"); | ||
| 24 | - try { | ||
| 25 | - String oci = fwb_oci.getFWBNodeText(); | ||
| 26 | - System.out.println(oci); | ||
| 27 | - } catch (FWBException e) { | ||
| 28 | - e.printStackTrace(); | ||
| 29 | - } | ||
| 30 | - } | 22 | +// OCI_TEST(); |
| 31 | 23 | ||
| 32 | - static void REF_TEST(){ | ||
| 33 | - FWB_REF fwb_ref = new FWB_REF(); | ||
| 34 | - fwb_ref.setRef_address("CGOFDIE"); | ||
| 35 | - fwb_ref.setRef_file_reference("EC1A2C4CBC3D1"); | ||
| 36 | - fwb_ref.setRef_participant_id("AGT"); | ||
| 37 | - fwb_ref.setRef_participant_code("MECCGO01"); | ||
| 38 | - fwb_ref.setRef_participant_airport("CGO"); | ||
| 39 | 24 | ||
| 40 | - try { | ||
| 41 | - String oci = fwb_ref.getNodeName() + fwb_ref.getFWBNodeText(); | ||
| 42 | - System.out.println(oci); | ||
| 43 | - } catch (FWBException e) { | ||
| 44 | - e.printStackTrace(); | ||
| 45 | - } | ||
| 46 | } | 25 | } |
| 47 | 26 | ||
| 48 | static String FWB_WAYBILL_TEST(){ | 27 | static String FWB_WAYBILL_TEST(){ |
| @@ -67,7 +46,7 @@ public class FWBTest { | @@ -67,7 +46,7 @@ public class FWBTest { | ||
| 67 | return ""; | 46 | return ""; |
| 68 | } | 47 | } |
| 69 | 48 | ||
| 70 | - static void FWB_FLT_TEST(){ | 49 | + static String FWB_FLT_TEST(){ |
| 71 | FWB_FLT flt = new FWB_FLT(); | 50 | FWB_FLT flt = new FWB_FLT(); |
| 72 | flt.setCariier("CV"); | 51 | flt.setCariier("CV"); |
| 73 | flt.setFlightNumber("732"); | 52 | flt.setFlightNumber("732"); |
| @@ -75,24 +54,165 @@ public class FWBTest { | @@ -75,24 +54,165 @@ public class FWBTest { | ||
| 75 | 54 | ||
| 76 | try { | 55 | try { |
| 77 | String nodeText = flt.getNodeName() + flt.getFWBNodeText() + "\n"; | 56 | String nodeText = flt.getNodeName() + flt.getFWBNodeText() + "\n"; |
| 78 | - System.out.println(FWB_WAYBILL_TEST()+nodeText); | 57 | + return nodeText; |
| 58 | +// System.out.println(FWB_WAYBILL_TEST()+nodeText); | ||
| 79 | } catch (FWBException e) { | 59 | } catch (FWBException e) { |
| 80 | e.printStackTrace(); | 60 | e.printStackTrace(); |
| 81 | } | 61 | } |
| 62 | + return ""; | ||
| 82 | } | 63 | } |
| 83 | 64 | ||
| 84 | - static void FWB_RTG_TEST(){ | 65 | + static String FWB_RTG_TEST(){ |
| 85 | FWB_RTG var = new FWB_RTG(); | 66 | FWB_RTG var = new FWB_RTG(); |
| 86 | -// var.setDestinationAirport("ICN"); | ||
| 87 | - var.setDestinationCarrier("F5"); | ||
| 88 | - var.setOnwardAirport("SIN"); | 67 | + var.setDestinationAirport("ICN"); |
| 68 | + var.setDestinationCarrier("CV"); | ||
| 69 | +// var.setOnwardAirport("SIN"); | ||
| 89 | // var.setOnwardCarrier("K9"); | 70 | // var.setOnwardCarrier("K9"); |
| 90 | 71 | ||
| 91 | try { | 72 | try { |
| 92 | String nodeText = var.getNodeName() + var.getFWBNodeText() + "\n"; | 73 | String nodeText = var.getNodeName() + var.getFWBNodeText() + "\n"; |
| 93 | - System.out.println(FWB_WAYBILL_TEST()+nodeText); | 74 | +// System.out.println(FWB_WAYBILL_TEST()+nodeText); |
| 75 | + return nodeText; | ||
| 76 | + } catch (FWBException e) { | ||
| 77 | + e.printStackTrace(); | ||
| 78 | + } | ||
| 79 | + return ""; | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + static String FWB_SHP_TEST(){ | ||
| 83 | + FWB_SHP var = new FWB_SHP(); | ||
| 84 | + var.setShp_name("HENAN CIVIL AVIATION DEVELOPMENT"); | ||
| 85 | + var.setShp_account_number("ABC"); | ||
| 86 | + var.setShp_adr("HNCA BUILDING YUHONG WORLD"); | ||
| 87 | + var.setShp_loc_place("ZHENGZHOU"); | ||
| 88 | + var.setShp_loc_province("HENAN"); | ||
| 89 | + var.setShp_country("CN"); | ||
| 90 | + var.setShp_postcode(""); | ||
| 91 | + var.setShp_contact_id("TE"); | ||
| 92 | + var.setShp_contact_number("450000"); | ||
| 93 | + | ||
| 94 | + | ||
| 95 | + try { | ||
| 96 | + String nodeText = var.getNodeName() + var.getFWBNodeText(); | ||
| 97 | + return nodeText; | ||
| 94 | } catch (FWBException e) { | 98 | } catch (FWBException e) { |
| 95 | e.printStackTrace(); | 99 | e.printStackTrace(); |
| 96 | } | 100 | } |
| 101 | + return ""; | ||
| 97 | } | 102 | } |
| 103 | + | ||
| 104 | + static String FWB_AGT_TEST(){ | ||
| 105 | + FWB_AGT var = new FWB_AGT(); | ||
| 106 | + var.setAgt_account_number(""); | ||
| 107 | + var.setAgt_IATA_number("0831714"); | ||
| 108 | + var.setAgt_CASS_ADR("0215"); | ||
| 109 | +// var.setAgt_participant_id("CAG"); | ||
| 110 | + var.setAgt_name("BOLLORE LOGISTICS CHINA CO LTD "); | ||
| 111 | + var.setAgt_ADR("SHANGHAI"); | ||
| 112 | + | ||
| 113 | + | ||
| 114 | + try { | ||
| 115 | + String nodeText = var.getFWBNodeText() ; | ||
| 116 | + return nodeText; | ||
| 117 | + } catch (FWBException e) { | ||
| 118 | + e.printStackTrace(); | ||
| 119 | + } | ||
| 120 | + return ""; | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + static String FWB_SSR_TEST(){ | ||
| 124 | + FWB_SSR var = new FWB_SSR(); | ||
| 125 | + var.setSsr_request_content("ALSO CNEE OPERATIONAL CODE 086500 NETTING CODE 0462 VAT NO 486017"); | ||
| 126 | + | ||
| 127 | + try { | ||
| 128 | + String nodeText = var.getFWBNodeText() ; | ||
| 129 | + return nodeText; | ||
| 130 | + } catch (FWBException e) { | ||
| 131 | + e.printStackTrace(); | ||
| 132 | + } | ||
| 133 | + return ""; | ||
| 134 | + } | ||
| 135 | + | ||
| 136 | + static String FWB_NFY_TEST(){ | ||
| 137 | + FWB_NFY var = new FWB_NFY(); | ||
| 138 | + var.setNfy_name("DSV AIR SEA AB - I200"); | ||
| 139 | + var.setNfy_ADR("NO.3 UNIT 2F-W2 WAREHOUSE NO.83 SH"); | ||
| 140 | + var.setNfy_LOC_city("SHANGHAI"); | ||
| 141 | + var.setNfy_LOC_province(""); | ||
| 142 | + var.setNfy_country("CN"); | ||
| 143 | + var.setNfy_postcode(""); | ||
| 144 | + var.setNfy_contact_id("TE"); | ||
| 145 | + var.setNfy_contact_NUM("TE00862160278315"); | ||
| 146 | + try { | ||
| 147 | + String nodeText = var.getFWBNodeText() ; | ||
| 148 | + return nodeText; | ||
| 149 | + } catch (FWBException e) { | ||
| 150 | + e.printStackTrace(); | ||
| 151 | + } | ||
| 152 | + return ""; | ||
| 153 | + } | ||
| 154 | + | ||
| 155 | + static String FWB_ACC_TEST(){ | ||
| 156 | + FWB_ACC var = new FWB_ACC(); | ||
| 157 | + var.setAcc_info_id("GEN"); | ||
| 158 | + var.setAcc_info("FREIGHT PREPAID"); | ||
| 159 | + try { | ||
| 160 | + String nodeText = var.getFWBNodeText() ; | ||
| 161 | + return nodeText; | ||
| 162 | + } catch (FWBException e) { | ||
| 163 | + e.printStackTrace(); | ||
| 164 | + } | ||
| 165 | + return ""; | ||
| 166 | + } | ||
| 167 | + | ||
| 168 | + static String FWB_CVD_TEST(){ | ||
| 169 | + FWB_CVD var = new FWB_CVD(); | ||
| 170 | + var.setCvd_currency_code("INR"); | ||
| 171 | +// var.setCvd_charge_code("PX"); | ||
| 172 | + var.setCvd_charge_prepaid("PP"); | ||
| 173 | + var.setCvd_value_for_carriage("NVD"); | ||
| 174 | + var.setCvd_value_for_customs("NCV"); | ||
| 175 | + var.setCvd_amount_of_insurance("XXX"); | ||
| 176 | + | ||
| 177 | + try { | ||
| 178 | + String nodeText = var.getFWBNodeText() ; | ||
| 179 | + return nodeText; | ||
| 180 | + } catch (FWBException e) { | ||
| 181 | + e.printStackTrace(); | ||
| 182 | + } | ||
| 183 | + return ""; | ||
| 184 | + } | ||
| 185 | + | ||
| 186 | + | ||
| 187 | + static void OCI_TEST(){ | ||
| 188 | + FWB_OCI fwb_oci = new FWB_OCI(); | ||
| 189 | + fwb_oci.setOci_csrc_id("T"); | ||
| 190 | + fwb_oci.setOci_csrc_info("USCI91440101MA9Y9E79XG"); | ||
| 191 | + fwb_oci.setOci_country_code("CN"); | ||
| 192 | + fwb_oci.setOci_information_id("SHP"); | ||
| 193 | + try { | ||
| 194 | + String oci = fwb_oci.getFWBNodeText(); | ||
| 195 | + System.out.println(oci); | ||
| 196 | + } catch (FWBException e) { | ||
| 197 | + e.printStackTrace(); | ||
| 198 | + } | ||
| 199 | + } | ||
| 200 | + | ||
| 201 | + static void REF_TEST(){ | ||
| 202 | + FWB_REF fwb_ref = new FWB_REF(); | ||
| 203 | + fwb_ref.setRef_address("CGOFDIE"); | ||
| 204 | + fwb_ref.setRef_file_reference("EC1A2C4CBC3D1"); | ||
| 205 | + fwb_ref.setRef_participant_id("AGT"); | ||
| 206 | + fwb_ref.setRef_participant_code("MECCGO01"); | ||
| 207 | + fwb_ref.setRef_participant_airport("CGO"); | ||
| 208 | + | ||
| 209 | + try { | ||
| 210 | + String oci = fwb_ref.getNodeName() + fwb_ref.getFWBNodeText(); | ||
| 211 | + System.out.println(oci); | ||
| 212 | + } catch (FWBException e) { | ||
| 213 | + e.printStackTrace(); | ||
| 214 | + } | ||
| 215 | + } | ||
| 216 | + | ||
| 217 | + | ||
| 98 | } | 218 | } |
-
请 注册 或 登录 后发表评论