Commit 0a2494a2 authored by Administrator's avatar Administrator

Merge branch 'dev_wzk' into 'dev_mysql'

Dev wzk

See merge request root/atms!336
parents ea1d1d24 65dd9937
...@@ -6,11 +6,14 @@ import org.apache.poi.ss.formula.eval.ValueEval; ...@@ -6,11 +6,14 @@ import org.apache.poi.ss.formula.eval.ValueEval;
import org.apache.poi.ss.formula.functions.FreeRefFunction; import org.apache.poi.ss.formula.functions.FreeRefFunction;
import pwc.taxtech.atms.common.util.SpringContextUtil; import pwc.taxtech.atms.common.util.SpringContextUtil;
import pwc.taxtech.atms.constant.Constant; import pwc.taxtech.atms.constant.Constant;
import pwc.taxtech.atms.constant.DataSourceName;
import pwc.taxtech.atms.constant.enums.EnumOperationType; import pwc.taxtech.atms.constant.enums.EnumOperationType;
import pwc.taxtech.atms.constant.enums.FormulaDataSourceDetailType; import pwc.taxtech.atms.constant.enums.FormulaDataSourceDetailType;
import pwc.taxtech.atms.constant.enums.FormulaDataSourceType;
import pwc.taxtech.atms.constant.enums.KeyValueConfigResultType; import pwc.taxtech.atms.constant.enums.KeyValueConfigResultType;
import pwc.taxtech.atms.dpo.CitAssetDetailResultDto; import pwc.taxtech.atms.dpo.CitAssetDetailResultDto;
import pwc.taxtech.atms.dto.vatdto.AssetDetailDataSourceDto; import pwc.taxtech.atms.dto.vatdto.AssetDetailDataSourceDto;
import pwc.taxtech.atms.dto.vatdto.ReportCellDataSourceDto;
import pwc.taxtech.atms.vat.dpo.AssetDetailResultDto; import pwc.taxtech.atms.vat.dpo.AssetDetailResultDto;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -55,9 +58,10 @@ public class ZC extends FunctionBase implements FreeRefFunction { ...@@ -55,9 +58,10 @@ public class ZC extends FunctionBase implements FreeRefFunction {
int curYear = formulaContext.getYear() + year; int curYear = formulaContext.getYear() + year;
BigDecimal totalData = new BigDecimal("0"); BigDecimal totalData = new BigDecimal("0.00");
List<Object> dataSource = new ArrayList<>(); List<ReportCellDataSourceDto> dataSource = new ArrayList<>();
ReportCellDataSourceDto dto = new ReportCellDataSourceDto();
try { try {
CitAssetDetailResultDto assetDetailResultDto = CitAssetDetailResultDto assetDetailResultDto =
SpringContextUtil.assetsListMapper.getCitAssetDetialResult(assetType, assetDetailType,formulaContext.getProjectId()); SpringContextUtil.assetsListMapper.getCitAssetDetialResult(assetType, assetDetailType,formulaContext.getProjectId());
...@@ -82,7 +86,17 @@ public class ZC extends FunctionBase implements FreeRefFunction { ...@@ -82,7 +86,17 @@ public class ZC extends FunctionBase implements FreeRefFunction {
// assetDetailDataSourceDto.setOperationType(EnumOperationType.Single.getCode()); // assetDetailDataSourceDto.setOperationType(EnumOperationType.Single.getCode());
// dataSource.add(assetDetailDataSourceDto); // dataSource.add(assetDetailDataSourceDto);
// } // }
dataSource.add(assetDetailResultDto);
dto.setRowIndex(ec.getRowIndex());
dto.setColumnIndex(ec.getColumnIndex());
dto.setPeriod(formulaContext.getPeriod());
dto.setReportTemplateId(formulaContext.getReportTemplateGroupId().toString());
dto.setYear(formulaContext.getYear());
dto.setIsOnlyManualInput(Boolean.FALSE);
dto.setReportName(formulaContext.getReportTemplateGroupId().toString());
dto.setName(Constant.DataSourceName.AssetListDataSource);
// dto.setType(FormulaDataSourceType.AssetListSource.getCode());
if(assetDetailResultDto != null){ if(assetDetailResultDto != null){
switch (dataType) { switch (dataType) {
case 1: case 1:
...@@ -119,18 +133,21 @@ public class ZC extends FunctionBase implements FreeRefFunction { ...@@ -119,18 +133,21 @@ public class ZC extends FunctionBase implements FreeRefFunction {
break; break;
} }
} }
dto.setAmount(totalData);
dataSource.add(dto);
return new NumberEval(totalData.doubleValue());
}catch (Exception e){ }catch (Exception e){
e.printStackTrace(); e.printStackTrace();
logger.error("计算ZC公式报错"); logger.error("计算ZC公式报错");
return new NumberEval(0); dto.setAmount(new BigDecimal("0.00"));
return new NumberEval(0.00);
}finally { }finally {
Long dataSourceId = saveDataSource(ec, Collections.singletonList(dataSource), Long dataSourceId = saveDataSource(ec, Collections.singletonList(dataSource),
FormulaDataSourceDetailType.AssetDetailDataSourceDto, FormulaDataSourceDetailType.AssetDetailDataSourceDto,
totalData, formulaContext.getPeriod(), formulaContext.getReportTemplateGroupId(), formulaContext.getProjectId()); totalData, formulaContext.getPeriod(), formulaContext.getReportTemplateGroupId(), formulaContext.getProjectId());
saveFormulaBlock(0, ec, formulaExpression, totalData, dataSourceId, formulaContext.getProjectId()); saveFormulaBlock(formulaContext.getPeriod(), ec, formulaExpression, totalData, dataSourceId, formulaContext.getProjectId());
} }
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