diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java index 369d92c7..ce0eee89 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java @@ -266,6 +266,7 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { childOrder.setSaleCount(1); childOrder.setTotalPrice(childOrder.getGoodsPrice().multiply(new BigDecimal(childOrder.getSaleCount().toString()))); childOrder.setTotalActualPrice(childOrder.getGoodsActualPrice().multiply(new BigDecimal(childOrder.getSaleCount().toString()))); + childOrder.setTotalDeductionPrice(new BigDecimal("O")); childOrder.setChildOrderStatus(OrderChildStatus.STATUS1.getNumber()); childOrder.setGiveawayType(false); childOrder.setPraiseStatus(0); 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 8b52c974..26489f52 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 @@ -391,18 +391,24 @@ public class OrderServiceImpl implements OrderService { childOrder.setSurplusRefundNum(childOrder.getSaleCount()); // 计算子订单退款金额。 if (order.getPayPrice().compareTo(new BigDecimal("0")) == 1) { - childOrder.setSurplusRefundPrice(childOrder.getTotalActualPrice() - .divide(order.getPayPrice(), 4, BigDecimal.ROUND_DOWN) - .multiply(new BigDecimal("100")).setScale(2)); + BigDecimal ratio = childOrder.getTotalActualPrice() + .divide(order.getPayPrice(), 2, BigDecimal.ROUND_DOWN).setScale(2); + childOrder.setSurplusRefundPrice(order.getPayPrice().multiply(ratio).setScale(2)); + } else { childOrder.setSurplusRefundPrice(new BigDecimal("0")); } // 计算子订单退款积分 if (order.getPayGold() > 0) { - childOrder.setSurplusRefundIntegral(childOrder.getTotalActualPrice() - .divide(new BigDecimal(order.getPayGold().toString()), 4, BigDecimal.ROUND_DOWN) - .multiply(new BigDecimal("100")).setScale(2).multiply(new BigDecimal("10000")).intValue()); + 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() + ); } else { childOrder.setSurplusRefundIntegral(0); }