|
@@ -350,21 +350,20 @@ public final class ReportParseUtils {
|
|
return formatMonthEnd(year, month);
|
|
return formatMonthEnd(year, month);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (ReportType.WEEKLY.equals(reportType) || ReportType.LETTER.equals(reportType) || ReportType.OTHER.equals(reportType)) {
|
|
|
|
- // 先用严格的日期匹配
|
|
|
|
- Matcher matcher = PatternConsts.STRICT_DAY_PATTERN.matcher(text);
|
|
|
|
- if (matcher.find()) {
|
|
|
|
- return matcher.group();
|
|
|
|
- }
|
|
|
|
- // 匹配不了时
|
|
|
|
- matcher = PatternConsts.DAY_PATTERN.matcher(text);
|
|
|
|
- if (matcher.find()) {
|
|
|
|
- String date = matcher.group();
|
|
|
|
- if (NumberUtil.isNumber(date) && date.length() >= 10) {
|
|
|
|
- return StrUtil.sub(date, 0, 10);
|
|
|
|
- }
|
|
|
|
- return date;
|
|
|
|
|
|
+ // 其他所有场景下都支持的日期匹配规则
|
|
|
|
+ // 先用严格的日期匹配
|
|
|
|
+ Matcher matcher = PatternConsts.STRICT_DAY_PATTERN.matcher(text);
|
|
|
|
+ if (matcher.find()) {
|
|
|
|
+ return matcher.group();
|
|
|
|
+ }
|
|
|
|
+ // 匹配不了时
|
|
|
|
+ matcher = PatternConsts.DAY_PATTERN.matcher(text);
|
|
|
|
+ if (matcher.find()) {
|
|
|
|
+ String date = matcher.group();
|
|
|
|
+ if (NumberUtil.isNumber(date) && date.length() >= 10) {
|
|
|
|
+ return StrUtil.sub(date, 0, 10);
|
|
}
|
|
}
|
|
|
|
+ return date;
|
|
}
|
|
}
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
@@ -537,5 +536,20 @@ public final class ReportParseUtils {
|
|
reportType = matchReportType(emailType, text);
|
|
reportType = matchReportType(emailType, text);
|
|
System.out.println(emailType + ",reportType=" + reportType + ",reportDate=" + matchReportDate(reportType, text));
|
|
System.out.println(emailType + ",reportType=" + reportType + ",reportDate=" + matchReportDate(reportType, text));
|
|
|
|
|
|
|
|
+ text = "证券投资基金_20250331_季报";
|
|
|
|
+ emailType = EmailUtil.getEmailTypeBySubject(text);
|
|
|
|
+ reportType = matchReportType(emailType, text);
|
|
|
|
+ System.out.println(emailType + ",reportType=" + reportType + ",reportDate=" + matchReportDate(reportType, text));
|
|
|
|
+
|
|
|
|
+ text = "证券投资基金_20241231_年报";
|
|
|
|
+ emailType = EmailUtil.getEmailTypeBySubject(text);
|
|
|
|
+ reportType = matchReportType(emailType, text);
|
|
|
|
+ System.out.println(emailType + ",reportType=" + reportType + ",reportDate=" + matchReportDate(reportType, text));
|
|
|
|
+
|
|
|
|
+ text = "证券投资基金_20250430_月报";
|
|
|
|
+ emailType = EmailUtil.getEmailTypeBySubject(text);
|
|
|
|
+ reportType = matchReportType(emailType, text);
|
|
|
|
+ System.out.println(emailType + ",reportType=" + reportType + ",reportDate=" + matchReportDate(reportType, text));
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|