提交代码

dev-discount
胡锐 2 years ago
parent d6b11e01e8
commit 4e6606fb00
  1. 1
      hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java
  2. 18
      hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java

@ -266,6 +266,7 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService {
childOrder.setSaleCount(1); childOrder.setSaleCount(1);
childOrder.setTotalPrice(childOrder.getGoodsPrice().multiply(new BigDecimal(childOrder.getSaleCount().toString()))); childOrder.setTotalPrice(childOrder.getGoodsPrice().multiply(new BigDecimal(childOrder.getSaleCount().toString())));
childOrder.setTotalActualPrice(childOrder.getGoodsActualPrice().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.setChildOrderStatus(OrderChildStatus.STATUS1.getNumber());
childOrder.setGiveawayType(false); childOrder.setGiveawayType(false);
childOrder.setPraiseStatus(0); childOrder.setPraiseStatus(0);

@ -391,18 +391,24 @@ public class OrderServiceImpl implements OrderService {
childOrder.setSurplusRefundNum(childOrder.getSaleCount()); childOrder.setSurplusRefundNum(childOrder.getSaleCount());
// 计算子订单退款金额。 // 计算子订单退款金额。
if (order.getPayPrice().compareTo(new BigDecimal("0")) == 1) { if (order.getPayPrice().compareTo(new BigDecimal("0")) == 1) {
childOrder.setSurplusRefundPrice(childOrder.getTotalActualPrice() BigDecimal ratio = childOrder.getTotalActualPrice()
.divide(order.getPayPrice(), 4, BigDecimal.ROUND_DOWN) .divide(order.getPayPrice(), 2, BigDecimal.ROUND_DOWN).setScale(2);
.multiply(new BigDecimal("100")).setScale(2)); childOrder.setSurplusRefundPrice(order.getPayPrice().multiply(ratio).setScale(2));
} else { } else {
childOrder.setSurplusRefundPrice(new BigDecimal("0")); childOrder.setSurplusRefundPrice(new BigDecimal("0"));
} }
// 计算子订单退款积分 // 计算子订单退款积分
if (order.getPayGold() > 0) { if (order.getPayGold() > 0) {
childOrder.setSurplusRefundIntegral(childOrder.getTotalActualPrice() BigDecimal ratio = childOrder.getTotalActualPrice()
.divide(new BigDecimal(order.getPayGold().toString()), 4, BigDecimal.ROUND_DOWN) .divide(new BigDecimal(order.getPayGold().toString()), 2, BigDecimal.ROUND_DOWN).setScale(2);
.multiply(new BigDecimal("100")).setScale(2).multiply(new BigDecimal("10000")).intValue());
childOrder.setSurplusRefundIntegral(
new BigDecimal(order.getPayGold().toString())
.multiply(ratio).setScale(2).
multiply(new BigDecimal("100")).intValue()
);
} else { } else {
childOrder.setSurplusRefundIntegral(0); childOrder.setSurplusRefundIntegral(0);
} }

Loading…
Cancel
Save