|
@@ -5,6 +5,7 @@ import cn.hutool.core.exceptions.ExceptionUtil;
|
|
import cn.hutool.core.map.MapUtil;
|
|
import cn.hutool.core.map.MapUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import com.simuwang.base.common.conts.Constants;
|
|
import com.simuwang.base.common.conts.Constants;
|
|
|
|
+import com.simuwang.base.common.enums.ReportType;
|
|
import com.simuwang.base.common.exception.ReportParseException;
|
|
import com.simuwang.base.common.exception.ReportParseException;
|
|
import com.simuwang.base.mapper.EmailFieldMappingMapper;
|
|
import com.simuwang.base.mapper.EmailFieldMappingMapper;
|
|
import com.simuwang.base.pojo.dto.report.*;
|
|
import com.simuwang.base.pojo.dto.report.*;
|
|
@@ -317,18 +318,14 @@ public abstract class AbstractPDReportParser<T extends ReportData> extends Abstr
|
|
if (string == null) {
|
|
if (string == null) {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
- // 所有报告的正则识别方式(年在最后)
|
|
|
|
- String patterns = "年度|年报|季度|季报|季|月度|月报|月|年";
|
|
|
|
- // 编译正则表达式模式
|
|
|
|
- Pattern pattern = Pattern.compile(patterns);
|
|
|
|
- // 创建Matcher对象
|
|
|
|
- Matcher matcher = pattern.matcher(string);
|
|
|
|
- // 尝试匹配
|
|
|
|
- if (matcher.find()) {
|
|
|
|
- return matcher.group();
|
|
|
|
- } else {
|
|
|
|
- return null;
|
|
|
|
|
|
+ // 类型识别---先识别季度报告,没有季度再识别年度报告,最后识别月报
|
|
|
|
+ ReportType reportType = ReportType.MONTHLY;
|
|
|
|
+ if (StrUtil.containsAny(string, ReportType.QUARTERLY.getPatterns())) {
|
|
|
|
+ reportType = ReportType.QUARTERLY;
|
|
|
|
+ } else if (StrUtil.containsAny(string, ReportType.ANNUALLY.getPatterns())) {
|
|
|
|
+ reportType = ReportType.ANNUALLY;
|
|
}
|
|
}
|
|
|
|
+ return reportType.getLabel();
|
|
}
|
|
}
|
|
|
|
|
|
private int getLastDayOfMonth(int year, int month) {
|
|
private int getLastDayOfMonth(int year, int month) {
|