Commit 66d37b22 authored by neo's avatar neo

[dev] split evalateAll to bb evalate and other fumular evalate

parent c4f79b1f
......@@ -95,6 +95,9 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
addFunctionsToWorkbook(newWorkbook, formulaContext);
int sheetCount = newWorkbook.getNumberOfSheets();
List<Cell> otherFormulaCells=new ArrayList<>();
List<Cell> bbFormulaCells=new ArrayList<>();
for (int i = 0; i < sheetCount; i++) {
Sheet sheet = newWorkbook.getSheetAt(i);
String code = sheet.getSheetName();
......@@ -140,19 +143,29 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
if (StringUtils.isNotBlank(v.getFormula()) && !v.getFormula().contains("@")) {
cell.setCellFormula(v.getFormula());
logger.debug("formula:" + v.getFormula());
if(v.getFormula().startsWith("BB(")){
bbFormulaCells.add(cell);
}else {
otherFormulaCells.add(cell);
}
//kv 公式处理
} else if (v.getFormula().startsWith("@")) {
if (StringUtils.isNotBlank(v.getKeyValueParsedFormula())) {
cell.setCellFormula(v.getKeyValueParsedFormula());
logger.debug("formula:" + v.getKeyValueParsedFormula());
otherFormulaCells.add(cell);
}
}
});
}
}
FormulaEvaluator evaluator = newWorkbook.getCreationHelper().createFormulaEvaluator();
evaluator.evaluateAll();
otherFormulaCells.stream().forEach(m->{
evaluator.evaluateFormulaCellEnum(m);
});
bbFormulaCells.stream().forEach(n->{
evaluator.evaluateFormulaCellEnum(n);
});
//todo:loop all the cell which existing in the cellTemplateConfig, save the data to DB
for (int i = 0; i < sheetCount; i++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment