小程序提交的数据小数位数超出2位,后端已修复

This commit is contained in:
yuyang 2022-05-25 15:34:41 +08:00
parent d8a6be7b08
commit 18babf610c

View File

@ -558,7 +558,7 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void saveInvoiceInfo(SaveInvoiceInfoRequest saveInvoiceInfoRequest) throws Exception { public void saveInvoiceInfo(SaveInvoiceInfoRequest saveInvoiceInfoRequest) throws Exception {
//System.out.println("<<<<<<<<<<111<<<<<<<<发票>>>>>>>>>>111>>>>>>>>"+saveInvoiceInfoRequest.toString());
//判断传入的历史订单是否被其他发票包含 //判断传入的历史订单是否被其他发票包含
List<Integer> historyOrderIds = saveInvoiceInfoRequest.getHistoryOrderIds(); List<Integer> historyOrderIds = saveInvoiceInfoRequest.getHistoryOrderIds();
List<XhpcInvoiceMapHistoryOrder> lockOrderList = xhpcInvoiceMapHistoryOrderMapper.getLockedOnesByHistoryOrderId(historyOrderIds); List<XhpcInvoiceMapHistoryOrder> lockOrderList = xhpcInvoiceMapHistoryOrderMapper.getLockedOnesByHistoryOrderId(historyOrderIds);
@ -616,7 +616,10 @@ public class XhpcInvoiceServiceImpl implements XhpcInvoiceService {
totalServicePrice += (xhpcHistoryOrder.getServicePriceTotal().doubleValue() - xhpcHistoryOrder.getPromotionDiscount().doubleValue()); totalServicePrice += (xhpcHistoryOrder.getServicePriceTotal().doubleValue() - xhpcHistoryOrder.getPromotionDiscount().doubleValue());
totalActPrice += xhpcHistoryOrder.getTotalPrice().doubleValue(); totalActPrice += xhpcHistoryOrder.getTotalPrice().doubleValue();
} }
if (!BigDecimal.valueOf(totalActPrice).equals(saveInvoiceInfoRequest.getInvoiceMoney())) { System.out.println("<<<<<<<<<<111<<<<<<<<发票 totalActPrice>>>>>>>>>>111>>>>>>>>"+totalActPrice);
BigDecimal bigDecimal = saveInvoiceInfoRequest.getInvoiceMoney().setScale(2, BigDecimal.ROUND_HALF_UP);
System.out.println("<<<<<<<<<<111<<<<<<<<发票 bigDecimal>>>>>>>>>>111>>>>>>>>"+bigDecimal);
if (!BigDecimal.valueOf(totalActPrice).equals(bigDecimal)) {
throw new Exception("传入的发票金额与实际包含的历史订单总金额参数不匹配"); throw new Exception("传入的发票金额与实际包含的历史订单总金额参数不匹配");
} }
xhpcInvoice.setInvoiceOrderEletricTotalMoney(BigDecimal.valueOf(totalPowerPrice)); xhpcInvoice.setInvoiceOrderEletricTotalMoney(BigDecimal.valueOf(totalPowerPrice));