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