Commit 3fb96405 authored by neo's avatar neo

[dev] when not fund celltemplate get and insert datasource

parent ad11e28d
...@@ -95,4 +95,16 @@ public class BBParasBo { ...@@ -95,4 +95,16 @@ public class BBParasBo {
this.year = curYear; this.year = curYear;
this.formulaExpression=otherBo.formulaExpression; this.formulaExpression=otherBo.formulaExpression;
} }
@Override
public String toString() {
return "BBParasBo{" +
"reportCode='" + reportCode + '\'' +
", columnIndex=" + columnIndex +
", rowIndex=" + rowIndex +
", period=" + period +
", year=" + year +
", formulaExpression='" + formulaExpression + '\'' +
'}';
}
} }
...@@ -35,4 +35,12 @@ public class CurrentPeriodBo { ...@@ -35,4 +35,12 @@ public class CurrentPeriodBo {
return new CurrentPeriodBo(parameterPeriod); return new CurrentPeriodBo(parameterPeriod);
} }
} }
@Override
public String toString() {
return "CurrentPeriodBo{" +
"curYear=" + curYear +
", curPeriod=" + curPeriod +
'}';
}
} }
package pwc.taxtech.atms.exception; package pwc.taxtech.atms.exception;
public class Exceptions { public class Exceptions {
public static final FormulaException BB_CELL_TEMP_NULL = new FormulaException("cell template data is null"); public static final FormulaException BB_CELL_TEMP_NULL = new FormulaException("cell template group is null or empty");
public static final FormulaException BB_REPORT_NULL = new FormulaException("cell report is null"); public static final FormulaException BB_REPORT_NULL = new FormulaException("cell report is null");
public static final FormulaException BB_CELL_DATA_NULL = new FormulaException("cell data is null"); public static final FormulaException BB_CELL_DATA_NULL = new FormulaException("cell data is null");
public static final FormulaException BB_CELL_DATA_EMPTY = new FormulaException("cell data is empty"); public static final FormulaException BB_CELL_DATA_EMPTY = new FormulaException("cell data is empty");
......
...@@ -57,11 +57,14 @@ public class BB extends FunctionBase implements FreeRefFunction { ...@@ -57,11 +57,14 @@ public class BB extends FunctionBase implements FreeRefFunction {
ReportCellDataSourceDto nullCellDto = ReportCellDataSourceDto.nullDataSource(bo, curPeriod); ReportCellDataSourceDto nullCellDto = ReportCellDataSourceDto.nullDataSource(bo, curPeriod);
ds.add(nullCellDto); ds.add(nullCellDto);
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; BigDecimal cellValue = BigDecimal.ZERO;
try { try {
CellTemplatePerGroupDto cellTemplateData = agent.getCellTemplateGroupDto(formulaContext.getReportTemplateGroupID(),
formulaContext.getProjectID()).stream().filter(dto -> dto.getRowIndex() == bo.getColumnIndex() - 1
&& dto.getColumnIndex() == bo.getColumnIndex() - 1).findFirst().orElseThrow(() -> {
throw Exceptions.BB_CELL_TEMP_NULL;
});
MyAsserts.assertNotNull(cellTemplateData, Exceptions.BB_CELL_TEMP_NULL); MyAsserts.assertNotNull(cellTemplateData, Exceptions.BB_CELL_TEMP_NULL);
nullCellDto.fixedWithGroup(cellTemplateData); nullCellDto.fixedWithGroup(cellTemplateData);
...@@ -129,6 +132,7 @@ public class BB extends FunctionBase implements FreeRefFunction { ...@@ -129,6 +132,7 @@ public class BB extends FunctionBase implements FreeRefFunction {
LOGGER.debug("cell static value "); LOGGER.debug("cell static value ");
return cellValue; return cellValue;
} finally { } finally {
LOGGER.warn("error for bb cacls for {} and current for {}", bo.toString(), curPeriod.toString());
Long dataSourceID = saveDataSource(ec, ds, FormulaDataSourceDetailType.ReportCellDataSourceDto, Long dataSourceID = saveDataSource(ec, ds, FormulaDataSourceDetailType.ReportCellDataSourceDto,
cellValue, formulaContext.getPeriod(), formulaContext.getReportTemplateGroupID()); cellValue, formulaContext.getPeriod(), formulaContext.getReportTemplateGroupID());
saveFormulaBlock(formulaContext.getPeriod(), ec, bo.expression(curPeriod.getCurPeriod(), curPeriod.getCurYear()), cellValue, dataSourceID); saveFormulaBlock(formulaContext.getPeriod(), 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