From e29c4aea598bc118aee32511d71ef9f40724e06f Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Tue, 25 Oct 2022 14:21:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order/service/impl/OrderServiceImpl.java | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java index 043f0f63..17008b95 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java @@ -143,7 +143,7 @@ public class OrderServiceImpl implements OrderService { order.setProfitSharingStatus(false); order.setExceptionStatus(false); order.setCreateTime(new Date()); - order.setPayGold(0); + order.setPayGold(createOrderModel.getPayGold()!=null?createOrderModel.getPayGold():0); order.setDeductionCouponPrice(new BigDecimal("0")); order.setDeductionProductPrice(new BigDecimal("0")); order.setCompanyId(createOrderModel.getCompanyId()); @@ -392,26 +392,19 @@ public class OrderServiceImpl implements OrderService { for (HighChildOrder childOrder : order.getHighChildOrderList()) { childOrder.setOrderNo(order.getOrderNo()); childOrder.setSurplusRefundNum(childOrder.getSaleCount()); + + BigDecimal ratio = childOrder.getGoodsPrice().divide(order.getTotalPrice(), 2, BigDecimal.ROUND_DOWN).setScale(2); + // 计算子订单退款金额。 if (order.getPayPrice().compareTo(new BigDecimal("0")) == 1) { - BigDecimal ratio = childOrder.getTotalActualPrice() - .divide(order.getTotalPrice(), 2, BigDecimal.ROUND_DOWN).setScale(2); childOrder.setSurplusRefundPrice(order.getPayPrice().multiply(ratio).setScale(2, BigDecimal.ROUND_DOWN)); - } else { childOrder.setSurplusRefundPrice(new BigDecimal("0")); } // 计算子订单退款积分 if (order.getPayGold() > 0) { - BigDecimal ratio = childOrder.getTotalActualPrice() - .divide(new BigDecimal(order.getPayGold().toString()), 2, BigDecimal.ROUND_DOWN).setScale(2); - - childOrder.setSurplusRefundIntegral( - new BigDecimal(order.getPayGold().toString()) - .multiply(ratio).setScale(2). - multiply(new BigDecimal("100")).intValue() - ); + childOrder.setSurplusRefundIntegral(new BigDecimal(order.getPayGold().toString()).multiply(ratio).setScale(2).intValue()); } else { childOrder.setSurplusRefundIntegral(0); }