Commit ca06f27b authored by neo's avatar neo

[DEV] add formual datasorce

parent 52edaa46
......@@ -286,29 +286,6 @@ public class ReportGeneratorImpl {
cellData.setProjectId(projectId);
cellData.setPeriod(period);
if (periodCellTemplateConfig.getDataSourceType().intValue() == FormulaDataSourceType.KeyInSource.getCode()) {
if(!isMergeMunual) {
PeriodDataSource dataSource = new PeriodDataSource();
dataSource.setId(distributedIdService.nextId());
if (tempPeriodCellTemplate.isPresent()) {
dataSource.setColumnIndex(tempPeriodCellTemplate.get().getColumnIndex());
dataSource.setRowIndex(tempPeriodCellTemplate.get().getRowIndex());
}
dataSource.setAmount(new BigDecimal("0"));
dataSource.setName("ManualDataSource");
dataSource.setDescription("ManualDataSource");
dataSource.setCreateTime(new Date());
dataSource.setUpdateTime(new Date());
dataSource.setCreateBy("Admin");
dataSource.setUpdateBy("Admin");
dataSource.setPeriod(period);
dataSource.setProjectId(projectId);
dataSource.setCellTemplateId(tempPeriodCellTemplate.get().getCellTemplateId());
dataSource.setType(FormulaDataSourceType.KeyInSource.getCode());
periodDataSourceMapper.insertSelective(dataSource);
}
}
//after insert celldata, insert the celldatasource for link celldata and datasource
PeriodDataSourceExample dataSourceExample = new PeriodDataSourceExample();
......
......@@ -854,6 +854,7 @@ public class ReportServiceImpl {
PeriodCellData cellData = periodCellDataMapper.selectByPrimaryKey(data.getCellId());
if (cellData.getData() != data.getAmount().toString()) {
cellData.setData(data.getAmount().toString());
if(StringUtils.isEmpty(cellData.getFormulaExp()))cellData.setFormulaExp(data.getAmount().toString());
periodCellDataMapper.updateByPrimaryKeySelective(cellData);
}
}
......@@ -861,7 +862,9 @@ public class ReportServiceImpl {
List<DataSourceExtendDto> dataSourceExtendDtos = periodDataSourceMapper.getManualDataSource(data.getCellId());
PeriodCellTemplateExample periodCellTemplateExample = new PeriodCellTemplateExample();
periodCellTemplateExample.createCriteria().andCellTemplateIdEqualTo(Long.parseLong(data.getCellTemplateId())).andPeriodEqualTo(data.getPeriod());
periodCellTemplateExample.createCriteria().andCellTemplateIdEqualTo(Long.parseLong(data.getCellTemplateId()))
.andPeriodEqualTo(data.getPeriod()).andProjectIdEqualTo(projectId);
Optional<PeriodCellTemplate> periodCellTemplate = periodCellTemplateMapper.selectByExample(periodCellTemplateExample).stream().findFirst();
BigDecimal originalAmount = new BigDecimal("0");
......
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