Commit ad2f589b authored by neo's avatar neo

[bugfix] bb formula save double datasource item

parent 3d06b96c
......@@ -45,41 +45,37 @@ public class ReportCellDataSourceDto extends DataSourceDto {
return nulDataSource;
}
public static ReportCellDataSourceDto extractFromGroup(BBParasBo bbParasBo, CurrentPeriodBo currentPeriodBo,
public void extractFromGroup(BBParasBo bbParasBo, CurrentPeriodBo currentPeriodBo,
CellData cellData, CellTemplatePerGroupDto cellTemplateData) {
ReportCellDataSourceDto dataSource = new ReportCellDataSourceDto();
dataSource.name = DataSourceName.ReportDataSource;
dataSource.year = currentPeriodBo.curYear;
dataSource.period = currentPeriodBo.curPeriod;
dataSource.columnIndex = bbParasBo.getColumnIndex() - 1;
dataSource.columnName = cellTemplateData.getColumnName();
dataSource.rowIndex = bbParasBo.getRowIndex() - 1;
dataSource.rowName = cellTemplateData.getRowName();
dataSource.reportTemplateID = cellTemplateData.getReportTemplateID();
dataSource.cellDataID = cellData.getId() + "";
dataSource.cellTemplateID = cellData.getCellTemplateId() + "";
dataSource.resultType = cellTemplateData.getResultType();
dataSource.isOnlyManualInput = false;
dataSource.reportName = bbParasBo.getReportCode();
return dataSource;
this.name = DataSourceName.ReportDataSource;
this.year = currentPeriodBo.curYear;
this.period = currentPeriodBo.curPeriod;
this.columnIndex = bbParasBo.getColumnIndex() - 1;
this.columnName = cellTemplateData.getColumnName();
this.rowIndex = bbParasBo.getRowIndex() - 1;
this.rowName = cellTemplateData.getRowName();
this.reportTemplateID = cellTemplateData.getReportTemplateID();
this.cellDataID = cellData.getId() + "";
this.cellTemplateID = cellData.getCellTemplateId() + "";
this.resultType = cellTemplateData.getResultType();
this.isOnlyManualInput = false;
this.reportName = bbParasBo.getReportCode();
}
public static ReportCellDataSourceDto extractFromGroup(BBParasBo bbParasBo, Integer period, Integer year,
public void extractFromGroup(BBParasBo bbParasBo, Integer period, Integer year,
CellTemplatePerGroupDto cellTemplateData) {
ReportCellDataSourceDto dataSource = new ReportCellDataSourceDto();
dataSource.name = DataSourceName.ReportDataSource;
dataSource.year = year;
dataSource.period = period;
dataSource.columnIndex = bbParasBo.getColumnIndex() - 1;
dataSource.columnName = cellTemplateData.getColumnName();
dataSource.rowIndex = bbParasBo.getRowIndex() - 1;
dataSource.rowName = cellTemplateData.getRowName();
dataSource.reportTemplateID = cellTemplateData.getReportTemplateID();
dataSource.cellTemplateID = cellTemplateData.getCellTemplateID() + "";
dataSource.resultType = cellTemplateData.getResultType();
dataSource.isOnlyManualInput = false;
dataSource.reportName = bbParasBo.getReportCode();
return dataSource;
this.name = DataSourceName.ReportDataSource;
this.year = year;
this.period = period;
this.columnIndex = bbParasBo.getColumnIndex() - 1;
this.columnName = cellTemplateData.getColumnName();
this.rowIndex = bbParasBo.getRowIndex() - 1;
this.rowName = cellTemplateData.getRowName();
this.reportTemplateID = cellTemplateData.getReportTemplateID();
this.cellTemplateID = cellTemplateData.getCellTemplateID() + "";
this.resultType = cellTemplateData.getResultType();
this.isOnlyManualInput = false;
this.reportName = bbParasBo.getReportCode();
}
public void fixedWithGroup(CellTemplatePerGroupDto dto) {
......
......@@ -2,14 +2,11 @@ package pwc.taxtech.atms.vat.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.common.datasource.ShardingContextHolder;
import pwc.taxtech.atms.common.util.MyAsserts;
import pwc.taxtech.atms.constant.enums.EnumServiceType;
import pwc.taxtech.atms.dao.FormulaAdminMapper;
import pwc.taxtech.atms.dto.GroupId;
import pwc.taxtech.atms.dto.vatdto.CellTemplatePerGroupDto;
import pwc.taxtech.atms.dto.vatdto.ReportCellDataSourceDto;
import pwc.taxtech.atms.entitiy.ProjectServiceType;
import pwc.taxtech.atms.entitiy.ProjectServiceTypeExample;
import pwc.taxtech.atms.exception.Exceptions;
......@@ -18,12 +15,9 @@ import pwc.taxtech.atms.vat.dao.FormulaProjectMapper;
import pwc.taxtech.atms.vat.dao.ReportMapper;
import pwc.taxtech.atms.vat.entity.CellData;
import pwc.taxtech.atms.vat.entity.CellDataExample;
import pwc.taxtech.atms.vat.entity.DataSource;
import pwc.taxtech.atms.vat.entity.Report;
import pwc.taxtech.atms.vat.entity.ReportExample;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import static pwc.taxtech.atms.constant.Constant.FIRST_OR_DEFAULT;
......@@ -82,7 +76,7 @@ public class FormulaAgent extends VatAbstractService {
return adminMp.getPastProjectDbName(year, orgId);
}
public CellData getCellData( String templateId,String cellId, int periodId) {
public CellData getCellData(String templateId, String cellId, int periodId) {
Report report = getReportByTemplate(templateId, periodId);
MyAsserts.assertNotNull(report, Exceptions.BB_REPORT_NULL);
......
......@@ -102,7 +102,7 @@ public class BB extends FunctionBase implements FreeRefFunction {
bo.putPeriodCellTempate(formulaContext.getPeriod(), Long.parseLong(cellTemplateData.getCellTemplateID()));
cellValue = new BigDecimal(OperandResolver.coerceValueToDouble(eval));
nullCellDto = ReportCellDataSourceDto.extractFromGroup(bo, formulaContext.getPeriod(), formulaContext.getYear(), cellTemplateData);
nullCellDto.extractFromGroup(bo, formulaContext.getPeriod(), formulaContext.getYear(), cellTemplateData);
nullCellDto.setAmount(cellValue);
dataSource.add(nullCellDto);
return cellValue;
......@@ -132,8 +132,7 @@ public class BB extends FunctionBase implements FreeRefFunction {
}
}
nullCellDto = ReportCellDataSourceDto.extractFromGroup(bo, curPeriod, cellData, cellTemplateData);
dataSource.add(nullCellDto);
nullCellDto.extractFromGroup(bo, curPeriod, cellData, cellTemplateData);
// todo: fix datasource name by templateList(neo)
MyAsserts.assertNotNull(cellData.getData(), Exceptions.BB_CELL_DATA_NULL);
......
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