作者 朱兆平

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

Signed-off-by: mrz <17966059@qq.com>
... ... @@ -236,8 +236,8 @@ public class FFMInfo implements Serializable {
* 所以这里需要加个校验
*/
currentLine++;
destination(lineList.get(currentLine).trim());
currentLine++;
// destination(lineList.get(currentLine).trim());
// currentLine++;
wayBillParseStartLine = currentLine;
}else if ("CONT".equals(keyword) || "LAST".equals(keyword) ){
islast = keyword;
... ... @@ -317,13 +317,16 @@ public class FFMInfo implements Serializable {
// 现在创建 matcher 对象
Matcher m_nil = r_nil.matcher(text);
if (m_nil.find()){
log.info("4.1 航班目的站货物为空");
throw new FFMResolveException("航班第一目的站货物为空,解析结束");
log.info("4.1 航班第一目的站货物为空");
//throw new FFMResolveException("航班第一目的站货物为空,解析结束");
//todo:第一目的站为空,后面的目的站可能不为空继续解析下一行
return;
}
//校验是否是目的站节点
//校验正则1,取前三位验证是否是机场代码
String pattern = "^[A-Z]{3}$|^[A-Z]{3}/\\d{2}[A-Z]{3}\\d{4}";
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})";
// 创建 Pattern 对象
Pattern r = Pattern.compile(pattern);
// 现在创建 matcher 对象
... ... @@ -348,9 +351,22 @@ public class FFMInfo implements Serializable {
* 多航班目的站解析
*/
private void multiDestinationParse(String line) throws FFMResolveException {
line = line.trim();
//校验目的站是否空货
String pattern_nil = "^[A-Z]{3}/NIL";
Pattern r_nil = Pattern.compile(pattern_nil);
// 现在创建 matcher 对象
Matcher m_nil = r_nil.matcher(line);
if (m_nil.find()){
log.info("4.1 航班第一目的站货物为空");
//throw new FFMResolveException("航班第一目的站货物为空,解析结束");
//todo:第一目的站为空,后面的目的站可能不为空继续解析下一行
return;
}
//校验正则1,取前三位验证是否是机场代码
String pattern_f = "^[A-Z]{3}$|^[A-Z]{3}/\\d{2}[A-Z]{3}\\d{4}";
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})";
// 创建 Pattern 对象
Pattern r_f = Pattern.compile(pattern_f);
// 现在创建 matcher 对象
... ... @@ -438,7 +454,7 @@ public class FFMInfo implements Serializable {
log.debug("[ULD] 此行为ULD信息行");
//板箱格式适配
String patternULD = "^ULD/([A-Z]{3}\\S{4,5}\\S{2})";
String patternULD = "^ULD/([A-Z]{3}\\S{4,5}\\S{2})(-[A-Z])?";
Pattern rULD = Pattern.compile(patternULD);
// 现在创建 matcher 对象
Matcher mULD = rULD.matcher(line);
... ... @@ -449,9 +465,12 @@ public class FFMInfo implements Serializable {
// }
String uld= mULD.group(1);
log.debug("[ULD] 当前ULD已变更为{}",uld);
if(mULD.groupCount()>1){
log.debug("[ULD] ULD Position Information{}",mULD.group(2));
}
return uld;
}else {
throw new FFMResolveException(line+"的ULD节点格式错误,无法适配正则(^ULD/([A-Z]{3})(\\S{5})(\\S{2})");
throw new FFMResolveException(line+"的ULD节点格式错误,无法适配正则(^ULD/([A-Z]{3}\\S{4,5}\\S{2})(-[A-Z])?)");
}
... ... @@ -782,6 +801,7 @@ public class FFMInfo implements Serializable {
* 返回的关键字 三字码关键字 机场代码关键字 文件结尾关键字 CONT,LAST
*/
public String keyword(@NotNull String text){
text = text.trim();
//取每行前三位
if (StringUtils.isNotBlank(text) && text.length()>3){
String s_3 = text.substring(0,3);
... ... @@ -794,6 +814,7 @@ public class FFMInfo implements Serializable {
}
}else if(text.length()==3){
log.info("[KEYWORD] {}很大可能是机场目的站",text);
return text;
}
return "NOT_KEYWORD";
... ...
... ... @@ -54,6 +54,7 @@ public class FFMResolveImpl implements FFMResolve {
}else {
log.error("{}{}机场代码未备案",ffm.getOriginatingstationBill(),ffm.getDestinationstationBill());
}
ffm.setReportorder(String.valueOf(Integer.parseInt(ffm.getReportorder())));
int result = ffmInfoDao.insertSelective(ffm);
if (result <=0){
log.error("{}入库失败",ffm.getWaybillnomaster());
... ...