|
@@ -39,15 +39,6 @@ public abstract class AbstractPDReportParser<T extends ReportData> extends Abstr
|
|
|
*/
|
|
|
protected List<String> textList;
|
|
|
|
|
|
-// @Value("${email.report.ai-parser-url}")
|
|
|
-// private String aiParserUrl;
|
|
|
-
|
|
|
-// protected String aiFileId;
|
|
|
-//
|
|
|
-// protected String aiParserContent;
|
|
|
-//
|
|
|
-// protected Boolean aiParse = false;
|
|
|
-
|
|
|
public AbstractPDReportParser(EmailFieldMappingMapper fieldMappingMapper) {
|
|
|
super(fieldMappingMapper);
|
|
|
}
|
|
@@ -81,37 +72,22 @@ public abstract class AbstractPDReportParser<T extends ReportData> extends Abstr
|
|
|
if (i >= 1 && params.getReportType() == ReportType.LETTER) {
|
|
|
break;
|
|
|
}
|
|
|
- Integer rows = tableList.stream().map(Table::getRowCount)
|
|
|
- .filter(rowCount -> rowCount >= 1).reduce(0, Integer::sum);
|
|
|
- if (rows >= 1) {
|
|
|
- for (Table table : tableList) {
|
|
|
- int rowCount = table.getRowCount();
|
|
|
- if (rowCount >= 1) {
|
|
|
- tables.add(table);
|
|
|
- }
|
|
|
+ for (Table table : tableList) {
|
|
|
+ int rowCount = table.getRowCount();
|
|
|
+ if (rowCount >= 1) {
|
|
|
+ tables.add(table);
|
|
|
}
|
|
|
- } else {
|
|
|
-// this.aiParse = true;
|
|
|
-// Map<String, Object> paramsMap = MapUtil.newHashMap(4);
|
|
|
-// paramsMap.put("filepath", filepath);
|
|
|
-// paramsMap.put("file_id", params.getAiFileId());
|
|
|
-// String body = null;
|
|
|
-// try {
|
|
|
-// body = HttpUtil.get(this.aiParserUrl, paramsMap);
|
|
|
-// JSONObject jsonObject = JSONUtil.parseObj(body);
|
|
|
-// this.aiFileId = MapUtil.getStr(jsonObject, "file_id");
|
|
|
-// String content = StrUtil.split(jsonObject.getStr("content"), "```").get(1);
|
|
|
-// this.aiParserContent = "{" + StrUtil.subAfter(content, "{", false) + "}";
|
|
|
-// } catch (Exception e) {
|
|
|
-// this.logger.warn("{} ai解析失败,解析结果{},错误原因:{}", filename, body, ExceptionUtil.stacktraceToString(e));
|
|
|
-// }
|
|
|
- throw new ReportParseException(ReportParseStatus.NOT_A_FIXED_FORMAT, filename);
|
|
|
}
|
|
|
i++;
|
|
|
}
|
|
|
if (tables.isEmpty()) {
|
|
|
throw new ReportParseException(ReportParseStatus.REPORT_IS_SCAN, filename);
|
|
|
}
|
|
|
+ Integer rows = tables.stream().map(Table::getRowCount)
|
|
|
+ .filter(rowCount -> rowCount >= 1).reduce(0, Integer::sum);
|
|
|
+ if (rows < 1) {
|
|
|
+ throw new ReportParseException(ReportParseStatus.NOT_A_FIXED_FORMAT, filename);
|
|
|
+ }
|
|
|
this.initTableInfo(tables);
|
|
|
}
|
|
|
T reportData = this.buildReportData(params, filename);
|
|
@@ -140,9 +116,6 @@ public abstract class AbstractPDReportParser<T extends ReportData> extends Abstr
|
|
|
super.init();
|
|
|
// 先初始化为null
|
|
|
this.textList = null;
|
|
|
-// this.aiFileId = null;
|
|
|
-// this.aiParserContent = null;
|
|
|
-// this.aiParse = false;
|
|
|
}
|
|
|
|
|
|
/**
|