Commit 5192642d authored by zhkwei's avatar zhkwei

1、资产导入本年折旧额根据年限改动;2、ZC公式报错问题

parent b72420dd
......@@ -571,6 +571,14 @@ public class AssetListServiceImpl extends BaseService {
for(CitAssetsList citAsset:assetsLists){
//获取税务每月折旧额,(原值-残值)/税法折旧期间
citAsset.setTaxMonthDepreciationAmount((citAsset.getAcquisitionValue().subtract(citAsset.getResidualRate())).divide(new BigDecimal(citAsset.getTaxDepreciationPeriod()), 2));
//获取税务截止本年累计折旧额, 本年折旧期间* 每月折旧额
citAsset.setTaxToCurrentYearDepreciationAmount(citAsset.getTaxMonthDepreciationAmount().multiply(new BigDecimal(citAsset.getTaxToCurrentYearDepreciationPeriod())));
//获取税务本年折旧额, 截至本年累计折旧期间*每月折旧额
citAsset.setTaxCurrentYearDepreciationAmount(citAsset.getTaxMonthDepreciationAmount().multiply(new BigDecimal(citAsset.getTaxYearDepreciationPeriod())));
//获取累计差异, 截止本年累计折旧额(税务)- 截止本年累计折旧额(财务)
citAsset.setTotalDifferenceAmount(citAsset.getTaxToCurrentYearDepreciationAmount().subtract(citAsset.getAccountTotalDepreciationAmount()));
//获取当年差异
citAsset.setYearDifferenceAmount(citAsset.getTaxCurrentYearDepreciationAmount().subtract(citAsset.getAccountYearDepreciationAmount()));
assetListMapper.updateByPrimaryKeySelective(citAsset);
}
return null;
......
......@@ -54,76 +54,72 @@ public class ZC extends FunctionBase implements FreeRefFunction {
logger.debug(formulaExpression);
int curYear = formulaContext.getYear() + year;
// String dbName =
// SpringContextUtil.projectDao.getDbNameWithYearAndOrgId(formulaContext.getOrganizationId(), curYear);
List<AssetDetailDataSourceDto> dataSource = new ArrayList<>();
BigDecimal totalData = new BigDecimal("0");
List<Object> dataSource = new ArrayList<>();
try {
List<CitAssetDetailResultDto> assetDetailResultDtos =
CitAssetDetailResultDto assetDetailResultDto =
SpringContextUtil.assetsListMapper.getCitAssetDetialResult(assetType, assetDetailType,formulaContext.getProjectId());
if(assetDetailResultDtos != null&&assetDetailResultDtos.size()>0){
System.out.println(assetDetailResultDtos.size());
}
for (CitAssetDetailResultDto x : assetDetailResultDtos) {
AssetDetailDataSourceDto assetDetailDataSourceDto = new AssetDetailDataSourceDto();
assetDetailDataSourceDto.setResultType(KeyValueConfigResultType.Accounting.getCode());
assetDetailDataSourceDto.setAccountAcquisitionValue(FormulaHelper.roundValue(x.getAssetsList().getAccountAcquisitionValue(), KeyValueConfigResultType.Accounting, null, formulaContext));
assetDetailDataSourceDto.setAccountMonthDepreciationAmount(FormulaHelper.roundValue(x.getAssetsList().getAccountMonthDepreciationAmount(), KeyValueConfigResultType.Accounting, null, formulaContext));
assetDetailDataSourceDto.setAccountYearDepreciationAmount(FormulaHelper.roundValue(x.getAssetsList().getYearDepreciationAmount(), KeyValueConfigResultType.Accounting, null, formulaContext));
assetDetailDataSourceDto.setAccountTotalepreciationAmount(FormulaHelper.roundValue(x.getAssetsList().getAccountTotalDepreciationAmount(), KeyValueConfigResultType.Accounting, null, formulaContext));
assetDetailDataSourceDto.setYearEndValue(FormulaHelper.roundValue(x.getAssetsList().getYearEndValue(), KeyValueConfigResultType.Accounting, null, formulaContext));
assetDetailDataSourceDto.setTaxMonthDepreciationAmount(FormulaHelper.roundValue(x.getAssetsList().getTaxMonthDepreciationAmount(), KeyValueConfigResultType.Accounting, null, formulaContext));
assetDetailDataSourceDto.setTaxToCurrentYearDepreciationAmount(FormulaHelper.roundValue(x.getAssetsList().getTaxToCurrentYearDepreciationAmount(), KeyValueConfigResultType.Accounting, null, formulaContext));
assetDetailDataSourceDto.setTaxCurrentYearDepreciationAmount(FormulaHelper.roundValue(x.getAssetsList().getTaxCurrentYearDepreciationAmount(), KeyValueConfigResultType.Accounting, null, formulaContext));
assetDetailDataSourceDto.setTotalDifferenceAmount(FormulaHelper.roundValue(x.getAssetsList().getTotalDifferenceAmount(), KeyValueConfigResultType.Accounting, null, formulaContext));
assetDetailDataSourceDto.setYearDifferenceAmount(FormulaHelper.roundValue(x.getAssetsList().getYearDifferenceAmount(), KeyValueConfigResultType.Accounting, null, formulaContext));
assetDetailDataSourceDto.setDataType(dataType);
assetDetailDataSourceDto.setName(Constant.DataSourceName.AssetListDataSource);
assetDetailDataSourceDto.setOperationType(EnumOperationType.Single.getCode());
dataSource.add(assetDetailDataSourceDto);
// for (CitAssetDetailResultDto x : assetDetailResultDtos) {
// if(x == null){
// continue;
// }
// AssetDetailDataSourceDto assetDetailDataSourceDto = new AssetDetailDataSourceDto();
// assetDetailDataSourceDto.setResultType(KeyValueConfigResultType.Accounting.getCode());
// assetDetailDataSourceDto.setAccountAcquisitionValue(FormulaHelper.roundValue(x.getAssetsList().getAccountAcquisitionValue(), KeyValueConfigResultType.Accounting, null, formulaContext));
// assetDetailDataSourceDto.setAccountMonthDepreciationAmount(FormulaHelper.roundValue(x.getAssetsList().getAccountMonthDepreciationAmount(), KeyValueConfigResultType.Accounting, null, formulaContext));
// assetDetailDataSourceDto.setAccountYearDepreciationAmount(FormulaHelper.roundValue(x.getAssetsList().getYearDepreciationAmount(), KeyValueConfigResultType.Accounting, null, formulaContext));
// assetDetailDataSourceDto.setAccountTotalepreciationAmount(FormulaHelper.roundValue(x.getAssetsList().getAccountTotalDepreciationAmount(), KeyValueConfigResultType.Accounting, null, formulaContext));
// assetDetailDataSourceDto.setYearEndValue(FormulaHelper.roundValue(x.getAssetsList().getYearEndValue(), KeyValueConfigResultType.Accounting, null, formulaContext));
// assetDetailDataSourceDto.setTaxMonthDepreciationAmount(FormulaHelper.roundValue(x.getAssetsList().getTaxMonthDepreciationAmount(), KeyValueConfigResultType.Accounting, null, formulaContext));
// assetDetailDataSourceDto.setTaxToCurrentYearDepreciationAmount(FormulaHelper.roundValue(x.getAssetsList().getTaxToCurrentYearDepreciationAmount(), KeyValueConfigResultType.Accounting, null, formulaContext));
// assetDetailDataSourceDto.setTaxCurrentYearDepreciationAmount(FormulaHelper.roundValue(x.getAssetsList().getTaxCurrentYearDepreciationAmount(), KeyValueConfigResultType.Accounting, null, formulaContext));
// assetDetailDataSourceDto.setTotalDifferenceAmount(FormulaHelper.roundValue(x.getAssetsList().getTotalDifferenceAmount(), KeyValueConfigResultType.Accounting, null, formulaContext));
// assetDetailDataSourceDto.setYearDifferenceAmount(FormulaHelper.roundValue(x.getAssetsList().getYearDifferenceAmount(), KeyValueConfigResultType.Accounting, null, formulaContext));
// assetDetailDataSourceDto.setDataType(dataType);
// assetDetailDataSourceDto.setName(Constant.DataSourceName.AssetListDataSource);
// assetDetailDataSourceDto.setOperationType(EnumOperationType.Single.getCode());
// dataSource.add(assetDetailDataSourceDto);
// }
dataSource.add(assetDetailResultDto);
if(assetDetailResultDto != null){
switch (dataType) {
case 1:
totalData = assetDetailResultDto.getAssetsList().getAccountAcquisitionValue();
break;
case 2:
totalData = assetDetailResultDto.getAssetsList().getAccountYearDepreciationAmount();
break;
case 3:
totalData = assetDetailResultDto.getAssetsList().getAccountTotalDepreciationAmount();
break;
case 4:
totalData = assetDetailResultDto.getAssetsList().getAccountMonthDepreciationAmount();
break;
case 5:
totalData = assetDetailResultDto.getAssetsList().getYearEndValue();
break;
case 6:
totalData = assetDetailResultDto.getAssetsList().getTaxMonthDepreciationAmount();
break;
case 7:
totalData = assetDetailResultDto.getAssetsList().getTaxToCurrentYearDepreciationAmount();
break;
case 8:
totalData = assetDetailResultDto.getAssetsList().getTaxCurrentYearDepreciationAmount();
break;
case 9:
totalData = assetDetailResultDto.getAssetsList().getTotalDifferenceAmount();
break;
case 10:
totalData = assetDetailResultDto.getAssetsList().getYearDifferenceAmount();
break;
default:
break;
}
}
// dataSource = dataSource.stream()
// .sorted(Comparator.comparing(AssetDetailDataSourceDto::getAssetGroupName)
// .thenComparing(AssetDetailDataSourceDto::getAssetDetailGroupName))
// .collect(Collectors.toList());
switch (dataType) {
case 1:
totalData = new BigDecimal(dataSource.stream().mapToDouble(a -> a.getAccountAcquisitionValue().doubleValue()).sum());
break;
case 2:
totalData = new BigDecimal(dataSource.stream().mapToDouble(a -> a.getAccountYearDepreciationAmount().doubleValue()).sum());
break;
case 3:
totalData = new BigDecimal(dataSource.stream().mapToDouble(a -> a.getAccountTotalepreciationAmount().doubleValue()).sum());
break;
case 4:
totalData = new BigDecimal(dataSource.stream().mapToDouble(a -> a.getAccountMonthDepreciationAmount().doubleValue()).sum());
break;
case 5:
totalData = new BigDecimal(dataSource.stream().mapToDouble(a -> a.getYearEndValue().doubleValue()).sum());
break;
case 6:
totalData = new BigDecimal(dataSource.stream().mapToDouble(a -> a.getTaxMonthDepreciationAmount().doubleValue()).sum());
break;
case 7:
totalData = new BigDecimal(dataSource.stream().mapToDouble(a -> a.getTaxToCurrentYearDepreciationAmount().doubleValue()).sum());
break;
case 8:
totalData = new BigDecimal(dataSource.stream().mapToDouble(a -> a.getTaxCurrentYearDepreciationAmount().doubleValue()).sum());
break;
case 9:
dataSource = dataSource.stream().filter(a -> a.getIsRetain() != null && a.getIsRetain()).collect(Collectors.toList());
totalData = new BigDecimal(dataSource.stream().mapToDouble(a -> a.getTotalDifferenceAmount().doubleValue()).sum());
break;
case 10:
dataSource = dataSource.stream().filter(a -> a.getIsRetain() != null && a.getIsRetain()).collect(Collectors.toList());
totalData = new BigDecimal(dataSource.stream().mapToDouble(a -> a.getYearDifferenceAmount().doubleValue()).sum());
break;
default:
break;
}
}catch (Exception e){
e.printStackTrace();
logger.error("计算ZC公式报错");
......
......@@ -119,7 +119,7 @@ public interface CitAssetsListMapper extends MyMapper {
*/
List<CitAssetEamMapping> getAssetEamMapping(CitAssetsList citAsset);
List<CitAssetDetailResultDto> getCitAssetDetialResult(@Param("assetType") Integer assetType,
CitAssetDetailResultDto getCitAssetDetialResult(@Param("assetType") Integer assetType,
@Param("assetDetailType") Integer assetDetailType,
@Param("projectId") String projectId);
......
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