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); }