|
@@ -16,6 +16,7 @@ import java.awt.geom.Rectangle2D;
|
|
import java.util.Comparator;
|
|
import java.util.Comparator;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
+import java.util.Objects;
|
|
import java.util.function.Function;
|
|
import java.util.function.Function;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -27,8 +28,18 @@ import java.util.function.Function;
|
|
public class PDQuarterlyReportParser<T extends QuarterlyReportData> extends AbstractPDReportParser<T> {
|
|
public class PDQuarterlyReportParser<T extends QuarterlyReportData> extends AbstractPDReportParser<T> {
|
|
protected static final List<String> INDUSTRY_COLUMN_NAMES = ListUtil.list(false);
|
|
protected static final List<String> INDUSTRY_COLUMN_NAMES = ListUtil.list(false);
|
|
protected static final List<String> SHARE_CHANGE_COLUMN_NAMES = ListUtil.list(false);
|
|
protected static final List<String> SHARE_CHANGE_COLUMN_NAMES = ListUtil.list(false);
|
|
|
|
+ protected static final List<String> FINANCIAL_INDICATORS_COLUMN_NAMES = ListUtil.list(false);
|
|
|
|
|
|
static {
|
|
static {
|
|
|
|
+ // 财务指标
|
|
|
|
+ FINANCIAL_INDICATORS_COLUMN_NAMES.add("期末基金净资产");
|
|
|
|
+ FINANCIAL_INDICATORS_COLUMN_NAMES.add("报告期期末单位净值");
|
|
|
|
+ FINANCIAL_INDICATORS_COLUMN_NAMES.add("本期利润");
|
|
|
|
+ FINANCIAL_INDICATORS_COLUMN_NAMES.add("本期已实现收益");
|
|
|
|
+ FINANCIAL_INDICATORS_COLUMN_NAMES.add("期末可供分配利润");
|
|
|
|
+ FINANCIAL_INDICATORS_COLUMN_NAMES.add("期末可供分配基金份额利润");
|
|
|
|
+ FINANCIAL_INDICATORS_COLUMN_NAMES.add("基金份额累计净值增长率");
|
|
|
|
+
|
|
// 中国证监会行业标准
|
|
// 中国证监会行业标准
|
|
INDUSTRY_COLUMN_NAMES.add("农、林、牧、渔业");
|
|
INDUSTRY_COLUMN_NAMES.add("农、林、牧、渔业");
|
|
INDUSTRY_COLUMN_NAMES.add("采矿业");
|
|
INDUSTRY_COLUMN_NAMES.add("采矿业");
|
|
@@ -107,7 +118,7 @@ public class PDQuarterlyReportParser<T extends QuarterlyReportData> extends Abst
|
|
// 主要财务指标或份额变动
|
|
// 主要财务指标或份额变动
|
|
if (CollUtil.containsAny(texts, SHARE_CHANGE_COLUMN_NAMES)) {
|
|
if (CollUtil.containsAny(texts, SHARE_CHANGE_COLUMN_NAMES)) {
|
|
this.shareChangeTables.add(table);
|
|
this.shareChangeTables.add(table);
|
|
- } else {
|
|
|
|
|
|
+ } else if (CollUtil.containsAny(texts, FINANCIAL_INDICATORS_COLUMN_NAMES)) {
|
|
this.financialIndicatorsTables.add(table);
|
|
this.financialIndicatorsTables.add(table);
|
|
}
|
|
}
|
|
} else if (colCount == 4) {
|
|
} else if (colCount == 4) {
|
|
@@ -156,30 +167,42 @@ public class PDQuarterlyReportParser<T extends QuarterlyReportData> extends Abst
|
|
List<ReportShareChangeDTO> shareChanges = this.buildLevelDto(fileId, this.shareChangeTables,
|
|
List<ReportShareChangeDTO> shareChanges = this.buildLevelDto(fileId, this.shareChangeTables,
|
|
ReportShareChangeDTO.class, function);
|
|
ReportShareChangeDTO.class, function);
|
|
// 主要财务指标
|
|
// 主要财务指标
|
|
- List<ReportFinancialIndicatorsDTO> financialIndicators = this.buildLevelDto(fileId, this.financialIndicatorsTables,
|
|
|
|
- ReportFinancialIndicatorsDTO.class, function);
|
|
|
|
|
|
+ List<ReportFinancialIndicatorsDTO> financialIndicators = this.buildFinancialIndicatorsInfo(fileId, function);
|
|
// 资产配置
|
|
// 资产配置
|
|
List<ReportAssetAllocationDTO> assetAllocations = this.buildAssetAllocationInfo(fileId);
|
|
List<ReportAssetAllocationDTO> assetAllocations = this.buildAssetAllocationInfo(fileId);
|
|
// 行业配置
|
|
// 行业配置
|
|
List<ReportInvestmentIndustryDTO> investmentIndustries = this.buildInvestmentIndustryInfo(fileId);
|
|
List<ReportInvestmentIndustryDTO> investmentIndustries = this.buildInvestmentIndustryInfo(fileId);
|
|
// 返回数据构建
|
|
// 返回数据构建
|
|
- QuarterlyReportData reportData = new QuarterlyReportData(reportInfo, fundInfo);
|
|
|
|
- reportData.setShareChange(shareChanges);
|
|
|
|
- reportData.setFinancialIndicators(financialIndicators);
|
|
|
|
- reportData.setAssetAllocation(assetAllocations);
|
|
|
|
- reportData.setInvestmentIndustry(investmentIndustries);
|
|
|
|
- return this.buildExtData(reportInfo, fundInfo, shareChanges, assetAllocations, investmentIndustries, function);
|
|
|
|
|
|
+ return this.buildReportData(reportInfo, fundInfo, shareChanges, financialIndicators, assetAllocations, investmentIndustries);
|
|
}
|
|
}
|
|
|
|
|
|
- protected T buildExtData(ReportBaseInfoDTO reportInfo, ReportFundInfoDTO fundInfo,
|
|
|
|
- List<ReportShareChangeDTO> shareChanges,
|
|
|
|
- List<ReportAssetAllocationDTO> assetAllocations,
|
|
|
|
- List<ReportInvestmentIndustryDTO> investmentIndustries,
|
|
|
|
- Function<Table, Map<String, Object>> function) {
|
|
|
|
- Integer fileId = reportInfo.getFileId();
|
|
|
|
- // 主要财务指标
|
|
|
|
- List<ReportFinancialIndicatorsDTO> financialIndicators = this.buildLevelDto(fileId, this.financialIndicatorsTables,
|
|
|
|
- ReportFinancialIndicatorsDTO.class, function);
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 主要财务指标数据构建(包括分级基金,并且一个表格可能跨页)
|
|
|
|
+ *
|
|
|
|
+ * @param fileId 文件id
|
|
|
|
+ * @param function 字段映射关系
|
|
|
|
+ * @return /
|
|
|
|
+ */
|
|
|
|
+ protected List<ReportFinancialIndicatorsDTO> buildFinancialIndicatorsInfo(Integer fileId, Function<Table, Map<String, Object>> function) {
|
|
|
|
+ return this.buildLevelDto(fileId, this.financialIndicatorsTables, ReportFinancialIndicatorsDTO.class, function);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 子类重写,放在cast异常
|
|
|
|
+ *
|
|
|
|
+ * @param reportInfo 报告基本信息
|
|
|
|
+ * @param fundInfo 基金基本信息
|
|
|
|
+ * @param shareChanges 份额变动
|
|
|
|
+ * @param financialIndicators 基本财务指标
|
|
|
|
+ * @param assetAllocations 资产配置
|
|
|
|
+ * @param investmentIndustries 行业配置
|
|
|
|
+ * @return /
|
|
|
|
+ */
|
|
|
|
+ protected T buildReportData(ReportBaseInfoDTO reportInfo, ReportFundInfoDTO fundInfo,
|
|
|
|
+ List<ReportShareChangeDTO> shareChanges,
|
|
|
|
+ List<ReportFinancialIndicatorsDTO> financialIndicators,
|
|
|
|
+ List<ReportAssetAllocationDTO> assetAllocations,
|
|
|
|
+ List<ReportInvestmentIndustryDTO> investmentIndustries) {
|
|
QuarterlyReportData reportData = new QuarterlyReportData(reportInfo, fundInfo);
|
|
QuarterlyReportData reportData = new QuarterlyReportData(reportInfo, fundInfo);
|
|
reportData.setShareChange(shareChanges);
|
|
reportData.setShareChange(shareChanges);
|
|
reportData.setFinancialIndicators(financialIndicators);
|
|
reportData.setFinancialIndicators(financialIndicators);
|
|
@@ -213,9 +236,13 @@ public class PDQuarterlyReportParser<T extends QuarterlyReportData> extends Abst
|
|
if (StrUtil.containsAny(text, "序号", "行业类别")) {
|
|
if (StrUtil.containsAny(text, "序号", "行业类别")) {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
+ String industryName = ReportParseUtils.cleaningValue(table.getCell(i, j).getText());
|
|
|
|
+ if (StrUtil.isBlank(industryName) || Objects.equals("合计", industryName)) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
ReportInvestmentIndustryDTO dto = new ReportInvestmentIndustryDTO(fileId);
|
|
ReportInvestmentIndustryDTO dto = new ReportInvestmentIndustryDTO(fileId);
|
|
dto.setInvestType(investType);
|
|
dto.setInvestType(investType);
|
|
- dto.setIndustryName(ReportParseUtils.cleaningValue(table.getCell(i, j).getText()));
|
|
|
|
|
|
+ dto.setIndustryName(industryName);
|
|
dto.setMarketValue(ReportParseUtils.cleaningValue(table.getCell(i, j + 1).getText()));
|
|
dto.setMarketValue(ReportParseUtils.cleaningValue(table.getCell(i, j + 1).getText()));
|
|
dto.setRatio(ReportParseUtils.cleaningValue(table.getCell(i, j + 2).getText()));
|
|
dto.setRatio(ReportParseUtils.cleaningValue(table.getCell(i, j + 2).getText()));
|
|
dtos.add(dto);
|
|
dtos.add(dto);
|