Commit 7d75d2c6 authored by neo.wang's avatar neo.wang

Merge branch 'dev_neo' into 'dev'

[DEV] add some  data for data save in bb

See merge request root/atms!66
parents c1904df7 4c8882f2
...@@ -3,7 +3,7 @@ package pwc.taxtech.atms.dto.vatdto; ...@@ -3,7 +3,7 @@ package pwc.taxtech.atms.dto.vatdto;
import pwc.taxtech.atms.constant.enums.CellDataSourceType; import pwc.taxtech.atms.constant.enums.CellDataSourceType;
public class FormulaDataSourceDto extends DataSourceDto { public class FormulaDataSourceDto extends DataSourceDto {
Integer type; public Integer type;
public FormulaDataSourceDto() { public FormulaDataSourceDto() {
super(); super();
......
...@@ -39,6 +39,7 @@ public class ReportCellDataSourceDto extends FormulaDataSourceDto { ...@@ -39,6 +39,7 @@ public class ReportCellDataSourceDto extends FormulaDataSourceDto {
public static ReportCellDataSourceDto extractFromGroup(BBParasBo bbParasBo, CurrentPeriodBo currentPeriodBo, public static ReportCellDataSourceDto extractFromGroup(BBParasBo bbParasBo, CurrentPeriodBo currentPeriodBo,
CellData cellData, CellTemplatePerGroupDto cellTemplateData) { CellData cellData, CellTemplatePerGroupDto cellTemplateData) {
ReportCellDataSourceDto dataSource = new ReportCellDataSourceDto(); ReportCellDataSourceDto dataSource = new ReportCellDataSourceDto();
dataSource.name = DataSourceName.ReportDataSource;
dataSource.year = currentPeriodBo.curYear; dataSource.year = currentPeriodBo.curYear;
dataSource.period = currentPeriodBo.curPeriod; dataSource.period = currentPeriodBo.curPeriod;
dataSource.columnIndex = bbParasBo.getColumnIndex(); dataSource.columnIndex = bbParasBo.getColumnIndex();
......
...@@ -9,6 +9,7 @@ import pwc.taxtech.atms.dto.vatdto.CellTemplatePerGroupDto; ...@@ -9,6 +9,7 @@ import pwc.taxtech.atms.dto.vatdto.CellTemplatePerGroupDto;
import pwc.taxtech.atms.dto.vatdto.FormulaDataSourceDto; import pwc.taxtech.atms.dto.vatdto.FormulaDataSourceDto;
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.service.impl.DistributedIDService;
import pwc.taxtech.atms.vat.dao.CellDataMapper; import pwc.taxtech.atms.vat.dao.CellDataMapper;
import pwc.taxtech.atms.vat.dao.FormulaProjectMapper; import pwc.taxtech.atms.vat.dao.FormulaProjectMapper;
import pwc.taxtech.atms.vat.dao.ReportMapper; import pwc.taxtech.atms.vat.dao.ReportMapper;
...@@ -18,6 +19,7 @@ import pwc.taxtech.atms.vat.entity.DataSource; ...@@ -18,6 +19,7 @@ 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.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;
...@@ -32,6 +34,8 @@ public class FormulaAgent extends VatAbstractService { ...@@ -32,6 +34,8 @@ public class FormulaAgent extends VatAbstractService {
public ReportMapper reportMapper; public ReportMapper reportMapper;
@Autowired @Autowired
public CellDataMapper cellDataMapper; public CellDataMapper cellDataMapper;
@Autowired
public DistributedIDService distributedIDService;
public List<CellTemplatePerGroupDto> getCellTemplateGroupDto(Long templateGroupId, String projectId) { public List<CellTemplatePerGroupDto> getCellTemplateGroupDto(Long templateGroupId, String projectId) {
...@@ -73,20 +77,20 @@ public class FormulaAgent extends VatAbstractService { ...@@ -73,20 +77,20 @@ public class FormulaAgent extends VatAbstractService {
return null; return null;
} }
public void save(List<FormulaDataSourceDto> dataSourceDtos){ public void save(List<FormulaDataSourceDto> dataSourceDtos) {
dataSourceDtos.forEach(m->{ dataSourceDtos.forEach(m -> {
DataSource ds = new DataSource(); DataSource ds = new DataSource();
ds.setAmount(m.getAmount()); ds.setAmount(m.getAmount()==null?new BigDecimal(0) :m.getAmount());
ds.setCreateBy(m.getCreator()); ds.setCreateBy(m.getCreator());
ds.setCreateTime(m.getCreateTime()); ds.setCreateTime(m.getCreateTime());
ds.setDescription(m.getDescription()); ds.setDescription(m.getDescription() == null ? "" : m.getDescription());
ds.setKeyValueDataId(m.getKeyValueDataID()); ds.setKeyValueDataId(m.getKeyValueDataID());
ds.setName(m.getName()); ds.setName(m.getName());
ds.setId(m.getId()); ds.setId(m.getId());
ds.setType(m.getType()); ds.setType(m.type);
ds.setUpdateBy(m.getUpdater()); ds.setUpdateBy(m.getUpdater());
ds.setUpdateTime(m.getUpdateTime()); ds.setUpdateTime(m.getUpdateTime());
ds.setId(distributedIDService.nextId());
dataSourceMapper.insert(ds); dataSourceMapper.insert(ds);
}); });
......
...@@ -116,6 +116,8 @@ public class ReportFormulaFactory { ...@@ -116,6 +116,8 @@ public class ReportFormulaFactory {
MyAsserts.assertNotNull(cellData, Exceptions.BB_CELL_DATA_NULL); MyAsserts.assertNotNull(cellData, Exceptions.BB_CELL_DATA_NULL);
nullCellDto = ReportCellDataSourceDto.extractFromGroup(bo, curPeriod, cellData, cellTemplateData); nullCellDto = ReportCellDataSourceDto.extractFromGroup(bo, curPeriod, cellData, cellTemplateData);
closeDataSource.clean();
closeDataSource.addDS(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