Commit 73740947 authored by neo's avatar neo

[dev] save datasource add projcect id from content

parent 85911d18
...@@ -17,7 +17,6 @@ import pwc.taxtech.atms.dto.vatdto.CurrentPeriodBo; ...@@ -17,7 +17,6 @@ import pwc.taxtech.atms.dto.vatdto.CurrentPeriodBo;
import pwc.taxtech.atms.dto.vatdto.ReportCellDataSourceDto; import pwc.taxtech.atms.dto.vatdto.ReportCellDataSourceDto;
import pwc.taxtech.atms.exception.Exceptions; import pwc.taxtech.atms.exception.Exceptions;
import pwc.taxtech.atms.exception.FormulaException; import pwc.taxtech.atms.exception.FormulaException;
import pwc.taxtech.atms.vat.entity.CellData;
import pwc.taxtech.atms.vat.entity.PeriodCellData; import pwc.taxtech.atms.vat.entity.PeriodCellData;
import java.lang.reflect.Field; import java.lang.reflect.Field;
...@@ -139,7 +138,8 @@ public class BB extends FunctionBase implements FreeRefFunction { ...@@ -139,7 +138,8 @@ public class BB extends FunctionBase implements FreeRefFunction {
LOGGER.warn("error for bb cacls for {} and current for {}", bo.toString(), curPeriod.toString()); LOGGER.warn("error for bb cacls for {} and current for {}", bo.toString(), curPeriod.toString());
Long dataSourceId = saveDataSource(ec, dataSource, FormulaDataSourceDetailType.ReportCellDataSourceDto, Long dataSourceId = saveDataSource(ec, dataSource, FormulaDataSourceDetailType.ReportCellDataSourceDto,
cellValue, formulaContext.getPeriod(), cellValue, formulaContext.getPeriod(),
formulaContext.getReportTemplateGroupId(), bo.getColumnIndex() - 1, bo.getRowIndex() - 1); formulaContext.getReportTemplateGroupId(), bo.getColumnIndex() - 1, bo.getRowIndex() - 1,
formulaContext.getProjectId());
saveFormulaBlock(formulaContext.getPeriod(), ec, saveFormulaBlock(formulaContext.getPeriod(), ec,
bo.expression(), bo.expressionData(), dataSourceId, formulaContext.getProjectId()); bo.expression(), bo.expressionData(), dataSourceId, formulaContext.getProjectId());
} }
......
...@@ -8,7 +8,11 @@ import pwc.taxtech.atms.common.util.SpringContextUtil; ...@@ -8,7 +8,11 @@ import pwc.taxtech.atms.common.util.SpringContextUtil;
import pwc.taxtech.atms.constant.enums.FormulaDataSourceDetailType; import pwc.taxtech.atms.constant.enums.FormulaDataSourceDetailType;
import pwc.taxtech.atms.constant.enums.KeyValueConfigResultType; import pwc.taxtech.atms.constant.enums.KeyValueConfigResultType;
import pwc.taxtech.atms.dto.vatdto.BSPLFormulaDataSourceDto; import pwc.taxtech.atms.dto.vatdto.BSPLFormulaDataSourceDto;
import pwc.taxtech.atms.vat.entity.*; import pwc.taxtech.atms.vat.entity.Balance;
import pwc.taxtech.atms.vat.entity.BalanceStdManual;
import pwc.taxtech.atms.vat.entity.PeriodEnterpriseAccount;
import pwc.taxtech.atms.vat.entity.VatEnterpriseAccount;
import pwc.taxtech.atms.vat.entity.VatStandardAccount;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -92,7 +96,7 @@ public class FSJZ extends FunctionBase implements FreeRefFunction { ...@@ -92,7 +96,7 @@ public class FSJZ extends FunctionBase implements FreeRefFunction {
if (balanceStdManual != null) { if (balanceStdManual != null) {
List<VatEnterpriseAccount> vatEnterpriseAccountList = SpringContextUtil List<VatEnterpriseAccount> vatEnterpriseAccountList = SpringContextUtil
.periodEnterpriseAccountMapper .periodEnterpriseAccountMapper
.getListWithAccountCode(accountCode,formulaContext.getProjectId(),period); .getListWithAccountCode(accountCode, formulaContext.getProjectId(), period);
if (period == 99) { if (period == 99) {
val = new BigDecimal(((balanceStdManual.getYearDebitNet() != null ? balanceStdManual.getYearDebitNet() : 0).doubleValue() val = new BigDecimal(((balanceStdManual.getYearDebitNet() != null ? balanceStdManual.getYearDebitNet() : 0).doubleValue()
- (balanceStdManual.getYearCreditNet() != null ? balanceStdManual.getYearCreditNet() : 0).doubleValue()) - (balanceStdManual.getYearCreditNet() != null ? balanceStdManual.getYearCreditNet() : 0).doubleValue())
...@@ -130,7 +134,8 @@ public class FSJZ extends FunctionBase implements FreeRefFunction { ...@@ -130,7 +134,8 @@ public class FSJZ extends FunctionBase implements FreeRefFunction {
} }
//todo: sava data //todo: sava data
//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(), formulaContext.getProjectId());
//save formulablock //save formulablock
saveFormulaBlock(period, ec, formulaExpression, val, dataSourceId, formulaContext.getProjectId()); saveFormulaBlock(period, ec, formulaExpression, val, dataSourceId, formulaContext.getProjectId());
...@@ -194,7 +199,7 @@ public class FSJZ extends FunctionBase implements FreeRefFunction { ...@@ -194,7 +199,7 @@ public class FSJZ extends FunctionBase implements FreeRefFunction {
//todo: sava data //todo: sava data
//save datasource //save datasource
Long dataSourceId = saveDataSource(ec, dsList, FormulaDataSourceDetailType.BSPLFormulaDataSourceDto, val, Long dataSourceId = saveDataSource(ec, dsList, FormulaDataSourceDetailType.BSPLFormulaDataSourceDto, val,
period, formulaContext.getReportTemplateGroupId()); period, formulaContext.getReportTemplateGroupId(), formulaContext.getProjectId());
//save formulablock //save formulablock
saveFormulaBlock(period, ec, formulaExpression, val, dataSourceId, formulaContext.getProjectId()); saveFormulaBlock(period, ec, formulaExpression, val, dataSourceId, formulaContext.getProjectId());
return new NumberEval(val.doubleValue()); return new NumberEval(val.doubleValue());
......
...@@ -88,7 +88,7 @@ public class GZSD extends FunctionBase implements FreeRefFunction { ...@@ -88,7 +88,7 @@ public class GZSD extends FunctionBase implements FreeRefFunction {
dataSourceDtoList.add(formulaDataSourceDto); dataSourceDtoList.add(formulaDataSourceDto);
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(), formulaContext.getProjectId());
saveFormulaBlock(formulaContext.getPeriod(), ec, formulaExpression, decimal_zero, dataSourceId, formulaContext.getProjectId()); saveFormulaBlock(formulaContext.getPeriod(), ec, formulaExpression, decimal_zero, dataSourceId, formulaContext.getProjectId());
return NumberEval.ZERO; return NumberEval.ZERO;
} }
...@@ -111,7 +111,7 @@ public class GZSD extends FunctionBase implements FreeRefFunction { ...@@ -111,7 +111,7 @@ public class GZSD extends FunctionBase implements FreeRefFunction {
dataSourceDtoList.add(formulaDataSourceDto); dataSourceDtoList.add(formulaDataSourceDto);
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(), formulaContext.getProjectId());
saveFormulaBlock(formulaContext.getPeriod(), ec, formulaExpression, val, dataSourceId, formulaContext.getProjectId()); saveFormulaBlock(formulaContext.getPeriod(), ec, formulaExpression, val, dataSourceId, formulaContext.getProjectId());
return new NumberEval(val.doubleValue()); return new NumberEval(val.doubleValue());
} else { } else {
...@@ -130,7 +130,7 @@ public class GZSD extends FunctionBase implements FreeRefFunction { ...@@ -130,7 +130,7 @@ public class GZSD extends FunctionBase implements FreeRefFunction {
dataSourceDtoList.add(formulaDataSourceDto); dataSourceDtoList.add(formulaDataSourceDto);
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(), formulaContext.getProjectId());
saveFormulaBlock(formulaContext.getPeriod(), ec, formulaExpression, decimal_zero, dataSourceId, formulaContext.getProjectId()); saveFormulaBlock(formulaContext.getPeriod(), ec, formulaExpression, decimal_zero, dataSourceId, formulaContext.getProjectId());
return NumberEval.ZERO; return NumberEval.ZERO;
......
...@@ -159,7 +159,8 @@ public class JXFP extends FunctionBase implements FreeRefFunction { ...@@ -159,7 +159,8 @@ 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(),
formulaContext.getProjectId());
saveFormulaBlock(formulaContext.getPeriod(), ec, formulaExpression, BigDecimal.valueOf(val), dataSourceId, saveFormulaBlock(formulaContext.getPeriod(), ec, formulaExpression, BigDecimal.valueOf(val), dataSourceId,
formulaContext.getProjectId()); formulaContext.getProjectId());
return new NumberEval(val); return new NumberEval(val);
...@@ -167,7 +168,7 @@ public class JXFP extends FunctionBase implements FreeRefFunction { ...@@ -167,7 +168,7 @@ public class JXFP extends FunctionBase implements FreeRefFunction {
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(), formulaContext.getProjectId());
saveFormulaBlock(formulaContext.getPeriod(), ec, formulaExpression, BigDecimal.valueOf(val), dataSourceId, saveFormulaBlock(formulaContext.getPeriod(), ec, formulaExpression, BigDecimal.valueOf(val), dataSourceId,
formulaContext.getProjectId()); formulaContext.getProjectId());
return new NumberEval(val); return new NumberEval(val);
...@@ -175,7 +176,7 @@ public class JXFP extends FunctionBase implements FreeRefFunction { ...@@ -175,7 +176,7 @@ public class JXFP extends FunctionBase implements FreeRefFunction {
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(), formulaContext.getProjectId());
saveFormulaBlock(period, ec, formulaExpression, BigDecimal.valueOf(val), dataSourceId, saveFormulaBlock(period, ec, formulaExpression, BigDecimal.valueOf(val), dataSourceId,
formulaContext.getProjectId()); formulaContext.getProjectId());
return new NumberEval(val); return new NumberEval(val);
......
...@@ -137,14 +137,14 @@ public class JXFPMX extends FunctionBase implements FreeRefFunction { ...@@ -137,14 +137,14 @@ 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(), formulaContext.getProjectId());
saveFormulaBlock(period, ec, formulaExpression, new BigDecimal(val), dataSourceId, formulaContext.getProjectId()); 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(), formulaContext.getProjectId());
saveFormulaBlock(period, ec, formulaExpression, new BigDecimal(val), dataSourceId, formulaContext.getProjectId()); saveFormulaBlock(period, ec, formulaExpression, new BigDecimal(val), dataSourceId, formulaContext.getProjectId());
return new NumberEval(val); return new NumberEval(val);
} }
......
...@@ -115,14 +115,14 @@ public class XXFP extends FunctionBase implements FreeRefFunction { ...@@ -115,14 +115,14 @@ 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(), formulaContext.getProjectId());
saveFormulaBlock(period, ec, formulaExpression, new BigDecimal(val), dataSoureId, formulaContext.getProjectId()); 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(), formulaContext.getProjectId());
saveFormulaBlock(period, ec, formulaExpression, new BigDecimal(val), dataSoureId, formulaContext.getProjectId()); saveFormulaBlock(period, ec, formulaExpression, new BigDecimal(val), dataSoureId, formulaContext.getProjectId());
return new NumberEval(val); return new NumberEval(val);
} }
......
...@@ -128,7 +128,7 @@ public class ZC extends FunctionBase implements FreeRefFunction { ...@@ -128,7 +128,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(), formulaContext.getProjectId());
saveFormulaBlock(0, ec, formulaExpression, totalData, dataSourceId, formulaContext.getProjectId()); saveFormulaBlock(0, ec, formulaExpression, totalData, dataSourceId, formulaContext.getProjectId());
return new NumberEval(totalData.doubleValue()); return new NumberEval(totalData.doubleValue());
} }
......
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