总体计划成本接口修改

This commit is contained in:
2025-12-12 10:40:47 +08:00
parent ee864c882a
commit 29cdd7b3e7

View File

@ -212,16 +212,16 @@ public class XzdCbysZjhcbServiceImpl extends ServiceImpl<XzdCbysZjhcbMapper, Xzd
BigDecimal totalTaxAmount = BigDecimal.ZERO; //税额 BigDecimal totalTaxAmount = BigDecimal.ZERO; //税额
BigDecimal totalTaxExclAmount = BigDecimal.ZERO; //不含税金额 BigDecimal totalTaxExclAmount = BigDecimal.ZERO; //不含税金额
for (BusBillofquantitiesLimitListBo item : bo.getBos()) {//计算含税金额 for (BusBillofquantitiesLimitListBo item : bo.getBos()) {//计算含税金额
BigDecimal amount = item.getQuantity().multiply(item.getUnitPrice()).setScale(4, RoundingMode.HALF_UP); BigDecimal amount = item.getQuantity().multiply(item.getUnitPrice());
//税率 //税率
BigDecimal rate = BigDecimal.ZERO; BigDecimal rate = BigDecimal.ZERO;
if (item.getTaxRate() != null){ if (item.getTaxRate() != null){
rate=item.getTaxRate().divide(new BigDecimal("100"), 4, RoundingMode.HALF_UP); rate=item.getTaxRate().divide(new BigDecimal("100"));
} }
//税额 //税额
BigDecimal taxAmount = amount.multiply(rate).setScale(4, RoundingMode.HALF_UP); BigDecimal taxAmount = amount.multiply(rate);
//不含税金额 //不含税金额
BigDecimal taxExclAmount = amount.subtract(taxAmount).setScale(4, RoundingMode.HALF_UP); BigDecimal taxExclAmount = amount.subtract(taxAmount);
totalTaxInclAmount = totalTaxInclAmount.add(amount); totalTaxInclAmount = totalTaxInclAmount.add(amount);
totalTaxAmount = totalTaxAmount.add(taxAmount); totalTaxAmount = totalTaxAmount.add(taxAmount);
totalTaxExclAmount = totalTaxExclAmount.add(taxExclAmount); totalTaxExclAmount = totalTaxExclAmount.add(taxExclAmount);
@ -235,9 +235,9 @@ public class XzdCbysZjhcbServiceImpl extends ServiceImpl<XzdCbysZjhcbMapper, Xzd
if (totalTaxExclAmount.compareTo(update.getTotalTaxExclAmount()) != 0){ if (totalTaxExclAmount.compareTo(update.getTotalTaxExclAmount()) != 0){
throw new ServiceException("不含税金额不一致"); throw new ServiceException("不含税金额不一致");
} }
update.setTotalTaxInclAmount(totalTaxInclAmount); update.setTotalTaxInclAmount(totalTaxInclAmount.setScale(4, RoundingMode.HALF_UP));
update.setTotalTaxAmount(totalTaxAmount); update.setTotalTaxAmount(totalTaxAmount.setScale(4, RoundingMode.HALF_UP));
update.setTotalTaxExclAmount(totalTaxExclAmount); update.setTotalTaxExclAmount(totalTaxExclAmount.setScale(4, RoundingMode.HALF_UP));
Boolean b = limitListService.updateByBo(bo.getBos()); Boolean b = limitListService.updateByBo(bo.getBos());
} }
return baseMapper.updateById(update) > 0; return baseMapper.updateById(update) > 0;