Commit 29735f86 authored by neo.wang's avatar neo.wang

Merge branch 'dev_oracle_neo' into 'dev_oracle'

[dev] add project id for period formula block

See merge request root/atms!124
parents 9e7efe14 a34a02c0
...@@ -249,12 +249,13 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen ...@@ -249,12 +249,13 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
.map(PeriodCellTemplateConfig::getCellTemplateId) .map(PeriodCellTemplateConfig::getCellTemplateId)
.collect(Collectors.toList()); .collect(Collectors.toList());
if (cellTemplateConfigIds.size() > 0) { if (cellTemplateConfigIds.size() > 0) {
periodFormulaBlockMapper.updateReportId(reportId, cellTemplateConfigIds, period); periodFormulaBlockMapper.updateReportId(reportId, cellTemplateConfigIds, period, projectId);
} }
for (PeriodCellTemplateConfig periodCellTemplateConfig : periodCellTemplateConfigs) { for (PeriodCellTemplateConfig periodCellTemplateConfig : periodCellTemplateConfigs) {
PeriodFormulaBlockExample periodFormulaBlockExample2 = new PeriodFormulaBlockExample(); PeriodFormulaBlockExample periodFormulaBlockExample2 = new PeriodFormulaBlockExample();
periodFormulaBlockExample2.createCriteria() periodFormulaBlockExample2.createCriteria()
.andProjectIdEqualTo(projectId)
.andCellTemplateIdEqualTo(periodCellTemplateConfig.getCellTemplateId()) .andCellTemplateIdEqualTo(periodCellTemplateConfig.getCellTemplateId())
.andReportIdEqualTo(reportId) .andReportIdEqualTo(reportId)
.andPeriodEqualTo(period); .andPeriodEqualTo(period);
...@@ -263,11 +264,11 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen ...@@ -263,11 +264,11 @@ public class ReportGeneratorImpl extends VatAbstractService implements ReportGen
//TODO:如果formula 为 ND(100) +ND(22) ,需要使用正则表达式拆分出自定义公式,然后根据自定义公式取formulablock 的数据进行替换 //TODO:如果formula 为 ND(100) +ND(22) ,需要使用正则表达式拆分出自定义公式,然后根据自定义公式取formulablock 的数据进行替换
String regex = "[A-Z]*\\([\\-A-Za-z0-9\\\"\\,\\.\\u4e00-\\u9fa5\\%]*\\)"; String regex = "[A-Z]*\\([\\-A-Za-z0-9\\\"\\,\\.\\u4e00-\\u9fa5\\%]*\\)";
Pattern p = Pattern.compile(regex); Pattern p = Pattern.compile(regex);
String sourceFormula = StringUtils.isNotBlank(periodCellTemplateConfig.getKeyValueParsedFormula())? String sourceFormula = StringUtils.isNotBlank(periodCellTemplateConfig.getKeyValueParsedFormula()) ?
periodCellTemplateConfig.getKeyValueParsedFormula(): periodCellTemplateConfig.getKeyValueParsedFormula() :
periodCellTemplateConfig.getFormula(); periodCellTemplateConfig.getFormula();
String resultFormula = StringUtils.isNotBlank(periodCellTemplateConfig.getKeyValueParsedFormula())? String resultFormula = StringUtils.isNotBlank(periodCellTemplateConfig.getKeyValueParsedFormula()) ?
periodCellTemplateConfig.getKeyValueParsedFormula(): periodCellTemplateConfig.getKeyValueParsedFormula() :
periodCellTemplateConfig.getFormula(); periodCellTemplateConfig.getFormula();
Matcher m = p.matcher(sourceFormula); Matcher m = p.matcher(sourceFormula);
Boolean isFind = false; Boolean isFind = false;
......
...@@ -444,7 +444,8 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi ...@@ -444,7 +444,8 @@ public class ReportServiceImpl extends VatAbstractService implements ReportServi
List<CellData> currentCellDataList = cellDataMapper.selectByExample(cellDataExample); List<CellData> currentCellDataList = cellDataMapper.selectByExample(cellDataExample);
PeriodFormulaBlockExample periodFormulaBlockExample = new PeriodFormulaBlockExample(); PeriodFormulaBlockExample periodFormulaBlockExample = new PeriodFormulaBlockExample();
periodFormulaBlockExample.createCriteria().andPeriodEqualTo(report.getPeriod()).andReportIdEqualTo(reportId); periodFormulaBlockExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(report.getPeriod())
.andReportIdEqualTo(reportId);
List<PeriodFormulaBlock> formulaBlocks = periodFormulaBlockMapper.selectByExample(periodFormulaBlockExample); List<PeriodFormulaBlock> formulaBlocks = periodFormulaBlockMapper.selectByExample(periodFormulaBlockExample);
dataDto.setFormulaBlocks(formulaBlocks); dataDto.setFormulaBlocks(formulaBlocks);
//todo: 关键字数据源稍后再加 //todo: 关键字数据源稍后再加
......
...@@ -140,7 +140,7 @@ public class BB extends FunctionBase implements FreeRefFunction { ...@@ -140,7 +140,7 @@ public class BB extends FunctionBase implements FreeRefFunction {
cellValue, formulaContext.getPeriod(), cellValue, formulaContext.getPeriod(),
formulaContext.getReportTemplateGroupId(), bo.getColumnIndex() - 1, bo.getRowIndex() - 1); formulaContext.getReportTemplateGroupId(), bo.getColumnIndex() - 1, bo.getRowIndex() - 1);
saveFormulaBlock(formulaContext.getPeriod(), ec, saveFormulaBlock(formulaContext.getPeriod(), ec,
bo.expression(), bo.expressionData(), dataSourceId); bo.expression(), bo.expressionData(), dataSourceId, formulaContext.getProjectId());
} }
} }
} }
......
...@@ -135,7 +135,7 @@ public class FSJZ extends FunctionBase implements FreeRefFunction { ...@@ -135,7 +135,7 @@ public class FSJZ extends FunctionBase implements FreeRefFunction {
//save datasource //save datasource
Long dataSourceId = saveDataSource(ec, formulaDataSourceDtoList, FormulaDataSourceDetailType.BSPLFormulaDataSourceDto, val, period, formulaContext.getReportTemplateGroupId()); Long dataSourceId = saveDataSource(ec, formulaDataSourceDtoList, FormulaDataSourceDetailType.BSPLFormulaDataSourceDto, val, period, formulaContext.getReportTemplateGroupId());
//save formulablock //save formulablock
saveFormulaBlock(period, ec, formulaExpression, val, dataSourceId); saveFormulaBlock(period, ec, formulaExpression, val, dataSourceId, formulaContext.getProjectId());
return new NumberEval(val.doubleValue()); return new NumberEval(val.doubleValue());
} else { } else {
...@@ -199,7 +199,7 @@ public class FSJZ extends FunctionBase implements FreeRefFunction { ...@@ -199,7 +199,7 @@ public class FSJZ extends FunctionBase implements FreeRefFunction {
Long dataSourceId = saveDataSource(ec, dsList, FormulaDataSourceDetailType.BSPLFormulaDataSourceDto, val, Long dataSourceId = saveDataSource(ec, dsList, FormulaDataSourceDetailType.BSPLFormulaDataSourceDto, val,
period, formulaContext.getReportTemplateGroupId()); period, formulaContext.getReportTemplateGroupId());
//save formulablock //save formulablock
saveFormulaBlock(period, ec, formulaExpression, val, dataSourceId); saveFormulaBlock(period, ec, formulaExpression, val, dataSourceId, formulaContext.getProjectId());
return new NumberEval(val.doubleValue()); return new NumberEval(val.doubleValue());
} }
} }
......
...@@ -36,10 +36,10 @@ public class FWND extends FunctionBase implements FreeRefFunction { ...@@ -36,10 +36,10 @@ public class FWND extends FunctionBase implements FreeRefFunction {
example.createCriteria().andOrganizationIdEqualTo(formulaContext.getOrganizationId()).andYearEqualTo(year); example.createCriteria().andOrganizationIdEqualTo(formulaContext.getOrganizationId()).andYearEqualTo(year);
List<Project> projects = SpringContextUtil.projectMapper.selectByExample(example); List<Project> projects = SpringContextUtil.projectMapper.selectByExample(example);
if (projects != null && projects.size() > 0) { if (projects != null && projects.size() > 0) {
saveFormulaBlock(0, ec, formulaExpression, new BigDecimal("1"), 0L); saveFormulaBlock(0, ec, formulaExpression, new BigDecimal("1"), 0L, formulaContext.getProjectId());
return new NumberEval(1); return new NumberEval(1);
} else { } else {
saveFormulaBlock(0, ec, formulaExpression, new BigDecimal("0"), 0L); saveFormulaBlock(0, ec, formulaExpression, new BigDecimal("0"), 0L, formulaContext.getProjectId());
return new NumberEval(0); return new NumberEval(0);
} }
} }
......
...@@ -15,10 +15,12 @@ import pwc.taxtech.atms.vat.entity.DataSourceDetail; ...@@ -15,10 +15,12 @@ import pwc.taxtech.atms.vat.entity.DataSourceDetail;
import pwc.taxtech.atms.vat.entity.PeriodFormulaBlock; import pwc.taxtech.atms.vat.entity.PeriodFormulaBlock;
import pwc.taxtech.atms.vat.service.impl.FormulaAgent; import pwc.taxtech.atms.vat.service.impl.FormulaAgent;
import javax.tools.JavaCompiler;
import java.lang.reflect.Array;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class FunctionBase { public class FunctionBase {
protected final Logger logger = LoggerFactory.getLogger(this.getClass()); protected final Logger logger = LoggerFactory.getLogger(this.getClass());
...@@ -130,8 +132,8 @@ public class FunctionBase { ...@@ -130,8 +132,8 @@ public class FunctionBase {
dataSource.setPeriod(period); dataSource.setPeriod(period);
SpringContextUtil.dataSourceMapper.insertSelective(dataSource); SpringContextUtil.dataSourceMapper.insertSelective(dataSource);
for (Object obj : dataSourceList) { for (Object obj : dataSourceList) {
if (obj.getClass()==java.util.ArrayList.class) { if (obj.getClass() == java.util.ArrayList.class) {
for (Object obj2 : (ArrayList<Object>)obj) { for (Object obj2 : (ArrayList<Object>) obj) {
DataSourceDetail dataSourceDetail = new DataSourceDetail(); DataSourceDetail dataSourceDetail = new DataSourceDetail();
dataSourceDetail.setId(SpringContextUtil.distributedIdService.nextId()); dataSourceDetail.setId(SpringContextUtil.distributedIdService.nextId());
dataSourceDetail.setDataSourceId(dataSourceId); dataSourceDetail.setDataSourceId(dataSourceId);
...@@ -152,11 +154,12 @@ public class FunctionBase { ...@@ -152,11 +154,12 @@ public class FunctionBase {
} }
public void saveFormulaBlock(int period, OperationEvaluationContext ec, public void saveFormulaBlock(int period, OperationEvaluationContext ec,
String formulaExpression, BigDecimal val, Long dataSourceId) { String formulaExpression, BigDecimal val, Long dataSourceId, String projectId) {
Long cellTemplateId = getCellTemplateId(period, ec); Long cellTemplateId = getCellTemplateId(period, ec);
Date creatime = new Date(); Date creatime = new Date();
PeriodFormulaBlock periodFormulaBlock = new PeriodFormulaBlock(); PeriodFormulaBlock periodFormulaBlock = new PeriodFormulaBlock();
periodFormulaBlock.setId(SpringContextUtil.distributedIdService.nextId()); periodFormulaBlock.setId(SpringContextUtil.distributedIdService.nextId());
periodFormulaBlock.setProjectId(projectId);
periodFormulaBlock.setPeriod(period); periodFormulaBlock.setPeriod(period);
periodFormulaBlock.setReportId(0L); periodFormulaBlock.setReportId(0L);
periodFormulaBlock.setCellTemplateId(cellTemplateId); periodFormulaBlock.setCellTemplateId(cellTemplateId);
...@@ -171,10 +174,11 @@ public class FunctionBase { ...@@ -171,10 +174,11 @@ public class FunctionBase {
} }
public void saveFormulaBlock(int period, OperationEvaluationContext ec, public void saveFormulaBlock(int period, OperationEvaluationContext ec,
String formulaExpression, String val, Long dataSourceId) { String formulaExpression, String val, Long dataSourceId, String projectId) {
Long cellTemplateId = getCellTemplateId(period, ec); Long cellTemplateId = getCellTemplateId(period, ec);
Date creatime = new Date(); Date creatime = new Date();
PeriodFormulaBlock periodFormulaBlock = new PeriodFormulaBlock(); PeriodFormulaBlock periodFormulaBlock = new PeriodFormulaBlock();
periodFormulaBlock.setProjectId(projectId);
periodFormulaBlock.setId(SpringContextUtil.distributedIdService.nextId()); periodFormulaBlock.setId(SpringContextUtil.distributedIdService.nextId());
periodFormulaBlock.setPeriod(period); periodFormulaBlock.setPeriod(period);
periodFormulaBlock.setReportId(0L); periodFormulaBlock.setReportId(0L);
......
...@@ -89,7 +89,7 @@ public class GZSD extends FunctionBase implements FreeRefFunction { ...@@ -89,7 +89,7 @@ public class GZSD extends FunctionBase implements FreeRefFunction {
Long dataSourceId = saveDataSource(ec, Collections.singletonList(dataSourceDtoList), Long dataSourceId = saveDataSource(ec, Collections.singletonList(dataSourceDtoList),
FormulaDataSourceDetailType.FormulaDataSourceDto, decimal_zero, formulaContext.getPeriod(), FormulaDataSourceDetailType.FormulaDataSourceDto, decimal_zero, formulaContext.getPeriod(),
formulaContext.getReportTemplateGroupId()); formulaContext.getReportTemplateGroupId());
saveFormulaBlock(formulaContext.getPeriod(), ec, formulaExpression, decimal_zero, dataSourceId); saveFormulaBlock(formulaContext.getPeriod(), ec, formulaExpression, decimal_zero, dataSourceId, formulaContext.getProjectId());
return NumberEval.ZERO; return NumberEval.ZERO;
} }
} }
...@@ -112,7 +112,7 @@ public class GZSD extends FunctionBase implements FreeRefFunction { ...@@ -112,7 +112,7 @@ public class GZSD extends FunctionBase implements FreeRefFunction {
Long dataSourceId = saveDataSource(ec, Collections.singletonList(dataSourceDtoList), Long dataSourceId = saveDataSource(ec, Collections.singletonList(dataSourceDtoList),
FormulaDataSourceDetailType.FormulaDataSourceDto, val, formulaContext.getPeriod(), FormulaDataSourceDetailType.FormulaDataSourceDto, val, formulaContext.getPeriod(),
formulaContext.getReportTemplateGroupId()); formulaContext.getReportTemplateGroupId());
saveFormulaBlock(formulaContext.getPeriod(), ec, formulaExpression, val, dataSourceId); saveFormulaBlock(formulaContext.getPeriod(), ec, formulaExpression, val, dataSourceId, formulaContext.getProjectId());
return new NumberEval(val.doubleValue()); return new NumberEval(val.doubleValue());
} else { } else {
//todo: @本期应(实)纳税额 ,@GDZC.BQ.QMYE 这种类型的数据,重新计算,按照keyvalue的配置 //todo: @本期应(实)纳税额 ,@GDZC.BQ.QMYE 这种类型的数据,重新计算,按照keyvalue的配置
...@@ -131,7 +131,7 @@ public class GZSD extends FunctionBase implements FreeRefFunction { ...@@ -131,7 +131,7 @@ public class GZSD extends FunctionBase implements FreeRefFunction {
Long dataSourceId = saveDataSource(ec, Collections.singletonList(dataSourceDtoList), Long dataSourceId = saveDataSource(ec, Collections.singletonList(dataSourceDtoList),
FormulaDataSourceDetailType.FormulaDataSourceDto, decimal_zero, formulaContext.getPeriod(), FormulaDataSourceDetailType.FormulaDataSourceDto, decimal_zero, formulaContext.getPeriod(),
formulaContext.getReportTemplateGroupId()); formulaContext.getReportTemplateGroupId());
saveFormulaBlock(formulaContext.getPeriod(), ec, formulaExpression, decimal_zero, dataSourceId); saveFormulaBlock(formulaContext.getPeriod(), ec, formulaExpression, decimal_zero, dataSourceId, formulaContext.getProjectId());
return NumberEval.ZERO; return NumberEval.ZERO;
} }
......
...@@ -13,7 +13,12 @@ import pwc.taxtech.atms.dto.vatdto.InputInvoiceDataSourceDto; ...@@ -13,7 +13,12 @@ import pwc.taxtech.atms.dto.vatdto.InputInvoiceDataSourceDto;
import pwc.taxtech.atms.vat.entity.InputVatInvoice; import pwc.taxtech.atms.vat.entity.InputVatInvoice;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/// <summary> /// <summary>
...@@ -58,13 +63,13 @@ public class JXFP extends FunctionBase implements FreeRefFunction { ...@@ -58,13 +63,13 @@ public class JXFP extends FunctionBase implements FreeRefFunction {
certificationPeriod = getPeriod(certificationPeriod, yearOffset); certificationPeriod = getPeriod(certificationPeriod, yearOffset);
if (yearOffset < 0) { if (yearOffset < 0) {
saveFormulaBlock(period,ec,formulaExpression,new BigDecimal("0.0"),0L); saveFormulaBlock(period, ec, formulaExpression, new BigDecimal("0.0"), 0L, formulaContext.getProjectId());
return NumberEval.ZERO; return NumberEval.ZERO;
} }
period = getPeriod(period, yearOffset); period = getPeriod(period, yearOffset);
if (yearOffset < 0) { if (yearOffset < 0) {
saveFormulaBlock(period,ec,formulaExpression,new BigDecimal("0.0"),0L); saveFormulaBlock(period, ec, formulaExpression, new BigDecimal("0.0"), 0L, formulaContext.getProjectId());
return NumberEval.ZERO; return NumberEval.ZERO;
} }
...@@ -94,13 +99,13 @@ public class JXFP extends FunctionBase implements FreeRefFunction { ...@@ -94,13 +99,13 @@ public class JXFP extends FunctionBase implements FreeRefFunction {
inputVATInvoices = SpringContextUtil.inputVatInvoiceDao.getInputVATInvoice(period, invoiceType, null, inputVATInvoices = SpringContextUtil.inputVatInvoiceDao.getInputVATInvoice(period, invoiceType, null,
null, Constant.InputInvoiceCertificationResult.NotPass); null, Constant.InputInvoiceCertificationResult.NotPass);
} else { } else {
saveFormulaBlock(period,ec,formulaExpression,new BigDecimal("0.0"),0L); saveFormulaBlock(period, ec, formulaExpression, new BigDecimal("0.0"), 0L, formulaContext.getProjectId());
return NumberEval.ZERO; return NumberEval.ZERO;
} }
if (certificationPeriod != -99 && certificationPeriod != 99 if (certificationPeriod != -99 && certificationPeriod != 99
&& (certificationPeriod < 1 || certificationPeriod > 12)) { && (certificationPeriod < 1 || certificationPeriod > 12)) {
saveFormulaBlock(period,ec,formulaExpression,new BigDecimal("0.0"),0L); saveFormulaBlock(period, ec, formulaExpression, new BigDecimal("0.0"), 0L, formulaContext.getProjectId());
return NumberEval.ZERO; return NumberEval.ZERO;
} else if (!formulaContext.getIsYear()) { } else if (!formulaContext.getIsYear()) {
if (certificationPeriod == -99) { if (certificationPeriod == -99) {
...@@ -154,25 +159,29 @@ public class JXFP extends FunctionBase implements FreeRefFunction { ...@@ -154,25 +159,29 @@ public class JXFP extends FunctionBase implements FreeRefFunction {
double val = dataSource.stream().mapToDouble(a -> a.getAmount().doubleValue()).sum(); double val = dataSource.stream().mapToDouble(a -> a.getAmount().doubleValue()).sum();
Long dataSourceId = saveDataSource(ec, Collections.singletonList(dataSource), Long dataSourceId = saveDataSource(ec, Collections.singletonList(dataSource),
FormulaDataSourceDetailType.InputInvoiceDataSourceDto, FormulaDataSourceDetailType.InputInvoiceDataSourceDto,
BigDecimal.valueOf(val),formulaContext.getPeriod(),formulaContext.getReportTemplateGroupId()); BigDecimal.valueOf(val), formulaContext.getPeriod(), formulaContext.getReportTemplateGroupId());
saveFormulaBlock(formulaContext.getPeriod(), ec, formulaExpression, BigDecimal.valueOf(val), dataSourceId); saveFormulaBlock(formulaContext.getPeriod(), ec, formulaExpression, BigDecimal.valueOf(val), dataSourceId,
formulaContext.getProjectId());
return new NumberEval(val); return new NumberEval(val);
} else if (resultType == 1) { } else if (resultType == 1) {
double val = dataSource.stream().mapToDouble(a -> a.getTaxAmount().doubleValue()).sum(); double val = dataSource.stream().mapToDouble(a -> a.getTaxAmount().doubleValue()).sum();
Long dataSourceId = saveDataSource(ec, Collections.singletonList(dataSource), Long dataSourceId = saveDataSource(ec, Collections.singletonList(dataSource),
FormulaDataSourceDetailType.InputInvoiceDataSourceDto, FormulaDataSourceDetailType.InputInvoiceDataSourceDto,
BigDecimal.valueOf(val),formulaContext.getPeriod(),formulaContext.getReportTemplateGroupId()); BigDecimal.valueOf(val), formulaContext.getPeriod(), formulaContext.getReportTemplateGroupId());
saveFormulaBlock(formulaContext.getPeriod(), ec, formulaExpression, BigDecimal.valueOf(val), dataSourceId); saveFormulaBlock(formulaContext.getPeriod(), ec, formulaExpression, BigDecimal.valueOf(val), dataSourceId,
formulaContext.getProjectId());
return new NumberEval(val); return new NumberEval(val);
} else if (resultType == 2) { } else if (resultType == 2) {
double val = dataSource.size(); double val = dataSource.size();
Long dataSourceId = saveDataSource(ec, Collections.singletonList(dataSource), Long dataSourceId = saveDataSource(ec, Collections.singletonList(dataSource),
FormulaDataSourceDetailType.InputInvoiceDataSourceDto, FormulaDataSourceDetailType.InputInvoiceDataSourceDto,
BigDecimal.valueOf(val),formulaContext.getPeriod(),formulaContext.getReportTemplateGroupId()); BigDecimal.valueOf(val), formulaContext.getPeriod(), formulaContext.getReportTemplateGroupId());
saveFormulaBlock(period, ec, formulaExpression, BigDecimal.valueOf(val), dataSourceId); saveFormulaBlock(period, ec, formulaExpression, BigDecimal.valueOf(val), dataSourceId,
formulaContext.getProjectId());
return new NumberEval(val); return new NumberEval(val);
} }
saveFormulaBlock(period,ec,formulaExpression,new BigDecimal("0.0"),0L); saveFormulaBlock(period, ec, formulaExpression, new BigDecimal("0.0"), 0L,
formulaContext.getProjectId());
return NumberEval.ZERO; return NumberEval.ZERO;
} }
} }
...@@ -14,7 +14,11 @@ import pwc.taxtech.atms.dto.vatdto.InputInvoiceDetailDataSourceDto; ...@@ -14,7 +14,11 @@ import pwc.taxtech.atms.dto.vatdto.InputInvoiceDetailDataSourceDto;
import pwc.taxtech.atms.vat.dpo.InputVATInvoiceResultDto; import pwc.taxtech.atms.vat.dpo.InputVATInvoiceResultDto;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -84,7 +88,7 @@ public class JXFPMX extends FunctionBase implements FreeRefFunction { ...@@ -84,7 +88,7 @@ public class JXFPMX extends FunctionBase implements FreeRefFunction {
if (!goodsName.equals("99")) { if (!goodsName.equals("99")) {
inputInvoice = inputInvoice.stream() inputInvoice = inputInvoice.stream()
.filter(a -> a.getGoodsMapping() != null&&a.getGoodsMapping().getStdGoodsName()!=null && a.getGoodsMapping().getStdGoodsName().equals(goodsName)) .filter(a -> a.getGoodsMapping() != null && a.getGoodsMapping().getStdGoodsName() != null && a.getGoodsMapping().getStdGoodsName().equals(goodsName))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
...@@ -133,15 +137,15 @@ public class JXFPMX extends FunctionBase implements FreeRefFunction { ...@@ -133,15 +137,15 @@ public class JXFPMX extends FunctionBase implements FreeRefFunction {
double val = dataSouce.stream().mapToDouble(a -> a.getAmount().doubleValue()).sum(); double val = dataSouce.stream().mapToDouble(a -> a.getAmount().doubleValue()).sum();
Long dataSourceId = saveDataSource(ec, Collections.singletonList(dataSouce), Long dataSourceId = saveDataSource(ec, Collections.singletonList(dataSouce),
FormulaDataSourceDetailType.InputInvoiceDetailDataSourceDto, FormulaDataSourceDetailType.InputInvoiceDetailDataSourceDto,
new BigDecimal(val),period,formulaContext.getReportTemplateGroupId()); new BigDecimal(val), period, formulaContext.getReportTemplateGroupId());
saveFormulaBlock(period, ec, formulaExpression, new BigDecimal(val), dataSourceId); saveFormulaBlock(period, ec, formulaExpression, new BigDecimal(val), dataSourceId, formulaContext.getProjectId());
return new NumberEval(val); return new NumberEval(val);
} else if (amountType == 1) { } else if (amountType == 1) {
double val = dataSouce.stream().mapToDouble(a -> a.getTaxAmount().doubleValue()).sum(); double val = dataSouce.stream().mapToDouble(a -> a.getTaxAmount().doubleValue()).sum();
Long dataSourceId = saveDataSource(ec, Collections.singletonList(dataSouce), Long dataSourceId = saveDataSource(ec, Collections.singletonList(dataSouce),
FormulaDataSourceDetailType.InputInvoiceDetailDataSourceDto, FormulaDataSourceDetailType.InputInvoiceDetailDataSourceDto,
new BigDecimal(val),period,formulaContext.getReportTemplateGroupId()); new BigDecimal(val), period, formulaContext.getReportTemplateGroupId());
saveFormulaBlock(period, ec, formulaExpression, new BigDecimal(val), dataSourceId); saveFormulaBlock(period, ec, formulaExpression, new BigDecimal(val), dataSourceId, formulaContext.getProjectId());
return new NumberEval(val); return new NumberEval(val);
} }
......
...@@ -115,15 +115,15 @@ public class XXFP extends FunctionBase implements FreeRefFunction { ...@@ -115,15 +115,15 @@ public class XXFP extends FunctionBase implements FreeRefFunction {
double val = dataSource.stream().mapToDouble(a -> a.getAmount().doubleValue()).sum(); double val = dataSource.stream().mapToDouble(a -> a.getAmount().doubleValue()).sum();
Long dataSoureId = saveDataSource(ec, Collections.singletonList(dataSource), Long dataSoureId = saveDataSource(ec, Collections.singletonList(dataSource),
FormulaDataSourceDetailType.OutputInvoiceDataSourceDto, FormulaDataSourceDetailType.OutputInvoiceDataSourceDto,
new BigDecimal(val),period,formulaContext.getReportTemplateGroupId()); new BigDecimal(val), period, formulaContext.getReportTemplateGroupId());
saveFormulaBlock(period, ec, formulaExpression, new BigDecimal(val), dataSoureId); saveFormulaBlock(period, ec, formulaExpression, new BigDecimal(val), dataSoureId, formulaContext.getProjectId());
return new NumberEval(val); return new NumberEval(val);
} else if (amountType == 1) { } else if (amountType == 1) {
double val = dataSource.stream().mapToDouble(a -> a.getTaxAmount().doubleValue()).sum(); double val = dataSource.stream().mapToDouble(a -> a.getTaxAmount().doubleValue()).sum();
Long dataSoureId = saveDataSource(ec, Collections.singletonList(dataSource), Long dataSoureId = saveDataSource(ec, Collections.singletonList(dataSource),
FormulaDataSourceDetailType.OutputInvoiceDataSourceDto, FormulaDataSourceDetailType.OutputInvoiceDataSourceDto,
new BigDecimal(val),period,formulaContext.getReportTemplateGroupId()); new BigDecimal(val), period, formulaContext.getReportTemplateGroupId());
saveFormulaBlock(period, ec, formulaExpression, new BigDecimal(val), dataSoureId); saveFormulaBlock(period, ec, formulaExpression, new BigDecimal(val), dataSoureId, formulaContext.getProjectId());
return new NumberEval(val); return new NumberEval(val);
} }
return NumberEval.ZERO; return NumberEval.ZERO;
......
...@@ -129,7 +129,7 @@ public class ZC extends FunctionBase implements FreeRefFunction { ...@@ -129,7 +129,7 @@ public class ZC extends FunctionBase implements FreeRefFunction {
Long dataSourceId = saveDataSource(ec, Collections.singletonList(dataSource), Long dataSourceId = saveDataSource(ec, Collections.singletonList(dataSource),
FormulaDataSourceDetailType.AssetDetailDataSourceDto, FormulaDataSourceDetailType.AssetDetailDataSourceDto,
totalData, formulaContext.getPeriod(), formulaContext.getReportTemplateGroupId()); totalData, formulaContext.getPeriod(), formulaContext.getReportTemplateGroupId());
saveFormulaBlock(0, ec, formulaExpression, totalData, dataSourceId); saveFormulaBlock(0, ec, formulaExpression, totalData, dataSourceId, formulaContext.getProjectId());
return new NumberEval(totalData.doubleValue()); return new NumberEval(totalData.doubleValue());
} }
} }
...@@ -107,5 +107,6 @@ public interface PeriodFormulaBlockMapper extends MyVatMapper { ...@@ -107,5 +107,6 @@ public interface PeriodFormulaBlockMapper extends MyVatMapper {
*/ */
int updateByPrimaryKey(PeriodFormulaBlock record); int updateByPrimaryKey(PeriodFormulaBlock record);
void updateReportId(@Param("reportId") Long reportId, @Param("cellTemplateConfigIds") List<Long> cellTemplateConfigIds, @Param("period") Integer period); void updateReportId(@Param("reportId") Long reportId, @Param("cellTemplateConfigIds") List<Long> cellTemplateConfigIds,
@Param("period") Integer period, @Param("projectId") String projectId);
} }
\ No newline at end of file
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
REPORT_ID= #{reportId,jdbcType=BIGINT} REPORT_ID= #{reportId,jdbcType=BIGINT}
WHERE WHERE
PERIOD= #{period,jdbcType=INTEGER} PERIOD= #{period,jdbcType=INTEGER}
AND PROJECT_ID= #{projectId,jdbcType=INTEGER}
AND CELL_TEMPLATE_ID IN AND CELL_TEMPLATE_ID IN
<foreach collection="cellTemplateConfigIds" open="(" close=")" separator="," item="item"> <foreach collection="cellTemplateConfigIds" open="(" close=")" separator="," item="item">
#{item} #{item}
......
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