作者 朱兆平

航班目的站解析优化,电报序号入库优化,板箱号节点适配优化:增加ULD Position Information的适配

Signed-off-by: mrz <17966059@qq.com>
@@ -236,8 +236,8 @@ public class FFMInfo implements Serializable { @@ -236,8 +236,8 @@ public class FFMInfo implements Serializable {
236 * 所以这里需要加个校验 236 * 所以这里需要加个校验
237 */ 237 */
238 currentLine++; 238 currentLine++;
239 - destination(lineList.get(currentLine).trim());  
240 - currentLine++; 239 +// destination(lineList.get(currentLine).trim());
  240 +// currentLine++;
241 wayBillParseStartLine = currentLine; 241 wayBillParseStartLine = currentLine;
242 }else if ("CONT".equals(keyword) || "LAST".equals(keyword) ){ 242 }else if ("CONT".equals(keyword) || "LAST".equals(keyword) ){
243 islast = keyword; 243 islast = keyword;
@@ -317,13 +317,16 @@ public class FFMInfo implements Serializable { @@ -317,13 +317,16 @@ public class FFMInfo implements Serializable {
317 // 现在创建 matcher 对象 317 // 现在创建 matcher 对象
318 Matcher m_nil = r_nil.matcher(text); 318 Matcher m_nil = r_nil.matcher(text);
319 if (m_nil.find()){ 319 if (m_nil.find()){
320 - log.info("4.1 航班目的站货物为空");  
321 - throw new FFMResolveException("航班第一目的站货物为空,解析结束"); 320 + log.info("4.1 航班第一目的站货物为空");
  321 + //throw new FFMResolveException("航班第一目的站货物为空,解析结束");
  322 + //todo:第一目的站为空,后面的目的站可能不为空继续解析下一行
  323 + return;
  324 +
322 } 325 }
323 326
324 //校验是否是目的站节点 327 //校验是否是目的站节点
325 //校验正则1,取前三位验证是否是机场代码 328 //校验正则1,取前三位验证是否是机场代码
326 - String pattern = "^[A-Z]{3}$|^[A-Z]{3}/\\d{2}[A-Z]{3}\\d{4}"; 329 + String pattern = "^[A-Z]{3}$|^[A-Z]{3}/\\d{2}[A-Z]{3}\\d{4}|^[A-Z]{3}/(\\d{2}[A-Z]{3}\\d{4})(/\\d{2}[A-Z]{3}\\d{4})";
327 // 创建 Pattern 对象 330 // 创建 Pattern 对象
328 Pattern r = Pattern.compile(pattern); 331 Pattern r = Pattern.compile(pattern);
329 // 现在创建 matcher 对象 332 // 现在创建 matcher 对象
@@ -348,9 +351,22 @@ public class FFMInfo implements Serializable { @@ -348,9 +351,22 @@ public class FFMInfo implements Serializable {
348 * 多航班目的站解析 351 * 多航班目的站解析
349 */ 352 */
350 private void multiDestinationParse(String line) throws FFMResolveException { 353 private void multiDestinationParse(String line) throws FFMResolveException {
  354 + line = line.trim();
  355 + //校验目的站是否空货
  356 + String pattern_nil = "^[A-Z]{3}/NIL";
  357 + Pattern r_nil = Pattern.compile(pattern_nil);
  358 + // 现在创建 matcher 对象
  359 + Matcher m_nil = r_nil.matcher(line);
  360 + if (m_nil.find()){
  361 + log.info("4.1 航班第一目的站货物为空");
  362 + //throw new FFMResolveException("航班第一目的站货物为空,解析结束");
  363 + //todo:第一目的站为空,后面的目的站可能不为空继续解析下一行
  364 + return;
  365 +
  366 + }
351 367
352 //校验正则1,取前三位验证是否是机场代码 368 //校验正则1,取前三位验证是否是机场代码
353 - String pattern_f = "^[A-Z]{3}$|^[A-Z]{3}/\\d{2}[A-Z]{3}\\d{4}"; 369 + String pattern_f = "^[A-Z]{3}$|^[A-Z]{3}/\\d{2}[A-Z]{3}\\d{4}|^[A-Z]{3}/(\\d{2}[A-Z]{3}\\d{4})(/\\d{2}[A-Z]{3}\\d{4})";
354 // 创建 Pattern 对象 370 // 创建 Pattern 对象
355 Pattern r_f = Pattern.compile(pattern_f); 371 Pattern r_f = Pattern.compile(pattern_f);
356 // 现在创建 matcher 对象 372 // 现在创建 matcher 对象
@@ -438,7 +454,7 @@ public class FFMInfo implements Serializable { @@ -438,7 +454,7 @@ public class FFMInfo implements Serializable {
438 454
439 log.debug("[ULD] 此行为ULD信息行"); 455 log.debug("[ULD] 此行为ULD信息行");
440 //板箱格式适配 456 //板箱格式适配
441 - String patternULD = "^ULD/([A-Z]{3}\\S{4,5}\\S{2})"; 457 + String patternULD = "^ULD/([A-Z]{3}\\S{4,5}\\S{2})(-[A-Z])?";
442 Pattern rULD = Pattern.compile(patternULD); 458 Pattern rULD = Pattern.compile(patternULD);
443 // 现在创建 matcher 对象 459 // 现在创建 matcher 对象
444 Matcher mULD = rULD.matcher(line); 460 Matcher mULD = rULD.matcher(line);
@@ -449,9 +465,12 @@ public class FFMInfo implements Serializable { @@ -449,9 +465,12 @@ public class FFMInfo implements Serializable {
449 // } 465 // }
450 String uld= mULD.group(1); 466 String uld= mULD.group(1);
451 log.debug("[ULD] 当前ULD已变更为{}",uld); 467 log.debug("[ULD] 当前ULD已变更为{}",uld);
  468 + if(mULD.groupCount()>1){
  469 + log.debug("[ULD] ULD Position Information{}",mULD.group(2));
  470 + }
452 return uld; 471 return uld;
453 }else { 472 }else {
454 - throw new FFMResolveException(line+"的ULD节点格式错误,无法适配正则(^ULD/([A-Z]{3})(\\S{5})(\\S{2})"); 473 + throw new FFMResolveException(line+"的ULD节点格式错误,无法适配正则(^ULD/([A-Z]{3}\\S{4,5}\\S{2})(-[A-Z])?)");
455 } 474 }
456 475
457 476
@@ -782,6 +801,7 @@ public class FFMInfo implements Serializable { @@ -782,6 +801,7 @@ public class FFMInfo implements Serializable {
782 * 返回的关键字 三字码关键字 机场代码关键字 文件结尾关键字 CONT,LAST 801 * 返回的关键字 三字码关键字 机场代码关键字 文件结尾关键字 CONT,LAST
783 */ 802 */
784 public String keyword(@NotNull String text){ 803 public String keyword(@NotNull String text){
  804 + text = text.trim();
785 //取每行前三位 805 //取每行前三位
786 if (StringUtils.isNotBlank(text) && text.length()>3){ 806 if (StringUtils.isNotBlank(text) && text.length()>3){
787 String s_3 = text.substring(0,3); 807 String s_3 = text.substring(0,3);
@@ -794,6 +814,7 @@ public class FFMInfo implements Serializable { @@ -794,6 +814,7 @@ public class FFMInfo implements Serializable {
794 } 814 }
795 }else if(text.length()==3){ 815 }else if(text.length()==3){
796 log.info("[KEYWORD] {}很大可能是机场目的站",text); 816 log.info("[KEYWORD] {}很大可能是机场目的站",text);
  817 + return text;
797 } 818 }
798 819
799 return "NOT_KEYWORD"; 820 return "NOT_KEYWORD";
@@ -54,6 +54,7 @@ public class FFMResolveImpl implements FFMResolve { @@ -54,6 +54,7 @@ public class FFMResolveImpl implements FFMResolve {
54 }else { 54 }else {
55 log.error("{}{}机场代码未备案",ffm.getOriginatingstationBill(),ffm.getDestinationstationBill()); 55 log.error("{}{}机场代码未备案",ffm.getOriginatingstationBill(),ffm.getDestinationstationBill());
56 } 56 }
  57 + ffm.setReportorder(String.valueOf(Integer.parseInt(ffm.getReportorder())));
57 int result = ffmInfoDao.insertSelective(ffm); 58 int result = ffmInfoDao.insertSelective(ffm);
58 if (result <=0){ 59 if (result <=0){
59 log.error("{}入库失败",ffm.getWaybillnomaster()); 60 log.error("{}入库失败",ffm.getWaybillnomaster());