Commit 310b7040 authored by neo's avatar neo

[bugfix] add bb log info

parent 022e2975
......@@ -15,6 +15,7 @@ import pwc.taxtech.atms.dto.vatdto.CellTemplatePerGroupDto;
import pwc.taxtech.atms.dto.vatdto.CurrentPeriodBo;
import pwc.taxtech.atms.dto.vatdto.ReportCellDataSourceDto;
import pwc.taxtech.atms.exception.Exceptions;
import pwc.taxtech.atms.exception.FormulaException;
import pwc.taxtech.atms.vat.entity.CellData;
import java.math.BigDecimal;
......@@ -35,7 +36,9 @@ public class BB extends FunctionBase implements FreeRefFunction {
try {
return wrapExceptionEval(args, ec);
} catch (Exception e) {
LOGGER.warn("un expect exception", e);
if (e instanceof FormulaException)
LOGGER.warn("Formula Exception || ", e);
else
e.printStackTrace();
return defaultEval;
}
......@@ -46,6 +49,7 @@ public class BB extends FunctionBase implements FreeRefFunction {
}
public BigDecimal bb(BBParasBo bo, OperationEvaluationContext ec) throws Exception {
List<Object> ds = new ArrayList<>();
CurrentPeriodBo curPeriod = CurrentPeriodBo.getPeriod(bo.getPeriod().intValue(), formulaContext.getPeriod());
curPeriod.fixedCurYear(getYear(bo.getYear()));
......@@ -56,7 +60,8 @@ public class BB extends FunctionBase implements FreeRefFunction {
CellTemplatePerGroupDto cellTemplateData = agent.getCellTemplateGroupDto(formulaContext.getReportTemplateGroupID(),
formulaContext.getProjectID()).stream().filter(dto -> dto.getRowIndex() == bo.getColumnIndex() - 1
&& dto.getColumnIndex() == bo.getColumnIndex() - 1).findFirst().get();
BigDecimal cellValue = BigDecimal.ZERO;
try {
MyAsserts.assertNotNull(cellTemplateData, Exceptions.BB_CELL_TEMP_NULL);
nullCellDto.fixedWithGroup(cellTemplateData);
......@@ -105,15 +110,16 @@ public class BB extends FunctionBase implements FreeRefFunction {
MyAsserts.assertNotNull(cellData.getData(), Exceptions.BB_CELL_DATA_NULL);
// cellValue= RoundValue(cellValue, cellDataType)TODO:maybe fixd round by cellDataTyep(KV neo)
BigDecimal cellValue = new BigDecimal(cellData.getData()).setScale(4,
cellValue = new BigDecimal(cellData.getData()).setScale(4,
BigDecimal.ROUND_HALF_DOWN);
Long dataSourceID = saveDataSource(ec, ds, FormulaDataSourceDetailType.ReportCellDataSourceDto,
cellValue, curPeriod.getCurPeriod(), formulaContext.getReportTemplateGroupID());
saveFormulaBlock(curPeriod.getCurPeriod(), ec, bo.expression(curPeriod.getCurPeriod(), curPeriod.getCurYear()), cellValue, dataSourceID);
nullCellDto.setAmount(cellValue);
LOGGER.debug("cell static value ");
return cellValue;
} finally {
Long dataSourceID = saveDataSource(ec, ds, FormulaDataSourceDetailType.ReportCellDataSourceDto,
cellValue, curPeriod.getCurPeriod(), formulaContext.getReportTemplateGroupID());
saveFormulaBlock(curPeriod.getCurPeriod(), ec, bo.expression(curPeriod.getCurPeriod(), curPeriod.getCurYear()), cellValue, dataSourceID);
}
}
}
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