|
@@ -111,7 +111,6 @@ public class ReportCalcService {
|
|
|
Map<String, List<ReportCalculationModel>> selectCalcReportDatas = service.selectCalcReportData(reportDefinitionModel.getReportNo());
|
|
|
// 这张报表需要公式计算的 计算单元,配置中,需要明确,一旦公式类型,必须配置Excel来源公式 字典:UNIT_STYLE_TYPE
|
|
|
List<ReportCalculationModel> fillInCalcs = new ArrayList<>(selectCalcReportDatas.get("FillIn").stream().filter(e -> "1".equals(e.getUnitStyleType())).toList());
|
|
|
- fillInCalcs.addAll(selectCalcReportDatas.get("Calc"));
|
|
|
File tempTmpFile = createTempReport(reportDefinitionModel, calcIndex, dataDate, context);
|
|
|
tempTmpFiles.add(tempTmpFile);
|
|
|
log.debug("复制临时模板文件内容到 mainTmpWorkbook 文件中,并将配置的Excel公式,其他报表来源公式均配置到 mainTmpWorkbook 中");
|
|
@@ -133,9 +132,14 @@ public class ReportCalcService {
|
|
|
int finalK = k;
|
|
|
List<ReportCalculationModel> thisCellNumModel = thisRowNumModel.stream().filter(e -> finalK == (e.getReportUnitCell())).toList();
|
|
|
Cell tempCell = CellUtil.getCell(tempRow,k);
|
|
|
- Cell mainTmpCell = null;
|
|
|
+ Cell mainTmpCell = CellUtil.getCell(mainTmpRow,k);;
|
|
|
+ if (thisCellNumModel.size() == 1) {
|
|
|
+ log.debug("读取该报表配置中的手动配置公式的单元格");
|
|
|
+ // 将对应配置的参数处理为公式内容
|
|
|
+ mainTmpCell.setCellFormula(thisCellNumModel.get(0).getUnitCalcInfo());
|
|
|
+ continue;
|
|
|
+ }
|
|
|
if (tempCell != null) {
|
|
|
- mainTmpCell = CellUtil.getCell(mainTmpRow,k);
|
|
|
switch (tempCell.getCellType()) {
|
|
|
case STRING -> mainTmpCell.setCellValue(tempCell.getStringCellValue());
|
|
|
case NUMERIC -> mainTmpCell.setCellValue(tempCell.getNumericCellValue());
|
|
@@ -143,16 +147,7 @@ public class ReportCalcService {
|
|
|
default -> mainTmpCell.setCellValue("");
|
|
|
}
|
|
|
}
|
|
|
- if (thisCellNumModel.size() == 1) {
|
|
|
- log.debug("读取该报表配置中的手动配置公式的单元格");
|
|
|
- if (mainTmpRow.getCell(k) != null) {
|
|
|
- mainTmpCell = mainTmpRow.getCell(k);
|
|
|
- } else {
|
|
|
- mainTmpCell = mainTmpRow.createCell(k);
|
|
|
- }
|
|
|
- // 将对应配置的参数处理为公式内容
|
|
|
- mainTmpCell.setCellFormula(thisCellNumModel.get(0).getUnitCalcInfo());
|
|
|
- }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|