Merge remote-tracking branch 'origin/dev' into dev

master
袁野 6 months ago
commit d0c188239a
  1. 2
      service/src/main/java/com/hfkj/service/order/OrderCreateService.java
  2. 27
      service/src/main/java/com/hfkj/service/order/impl/BsOrderServiceImpl.java

@ -116,7 +116,7 @@ public class OrderCreateService {
orderCoupon.setStatus(OrderChildStatusEnum.status1.getCode());
orderCouponService.editData(orderCoupon);
for (int i = 0; i < orderCoupon.getGoodsCount(); i++) {
for (int i = 0; i <= orderCoupon.getGoodsCount(); i++) {
// 卡券订单卡密
BsOrderCouponNo orderCouponNo = new BsOrderCouponNo();
orderCouponNo.setCouponOrderId(orderCoupon.getId());

@ -202,13 +202,7 @@ public class BsOrderServiceImpl implements BsOrderService {
childOrder.setSurplusRefundCount(childOrder.getProductCount());
// 计算 子订单 在交易订单金额中的占比
BigDecimal ratio = childOrder.getProductTotalPrice().divide(order.getTotalPrice(), 2, BigDecimal.ROUND_DOWN).setScale(2);
// 计算子订单退款金额。
if (order.getPayRealPrice().compareTo(new BigDecimal("0")) == 1) {
childOrder.setSurplusRefundPrice(order.getPayRealPrice().multiply(ratio).setScale(2, BigDecimal.ROUND_DOWN));
} else {
childOrder.setSurplusRefundPrice(new BigDecimal("0"));
}
BigDecimal ratio = childOrder.getProductTotalPrice().divide(order.getTotalPrice(), 2, BigDecimal.ROUND_DOWN);
// 计算子订单退款积分
if (order.getDeduction().getIntegralDiscountPrice() > 0) {
@ -217,10 +211,27 @@ public class BsOrderServiceImpl implements BsOrderService {
childOrder.setSurplusRefundIntegral(0L);
}
if (order.getDeduction().getCouponDiscountActualPrice().compareTo(BigDecimal.ZERO) == 1) {
// 计算子订单退款金额。
if (order.getPayRealPrice().compareTo(BigDecimal.ZERO) == 1) {
// 计算实付金额中的占比
childOrder.setSurplusRefundPrice(order.getPayRealPrice().multiply(ratio).setScale(2, BigDecimal.ROUND_DOWN));
} else {
childOrder.setSurplusRefundPrice(new BigDecimal("0"));
}
} else {
childOrder.setSurplusRefundPrice(
// 商品总金额 - 积分抵扣金额
childOrder.getProductTotalPrice().subtract(
new BigDecimal(childOrder.getSurplusRefundIntegral().toString()).multiply(new BigDecimal("100"))
));
}
childOrder.setCouponDiscountPrice(childOrder.getProductTotalPrice().subtract(childOrder.getSurplusRefundPrice()));
childOrder.setIntegralDiscountPrice(childOrder.getSurplusRefundIntegral());
childOrder.setTotalDeductionPrice(
childOrder.getCouponDiscountPrice().add(new BigDecimal(childOrder.getIntegralDiscountPrice().toString()).multiply(new BigDecimal("100")))
childOrder.getCouponDiscountPrice()
.add(new BigDecimal(childOrder.getIntegralDiscountPrice().toString()).multiply(new BigDecimal("100")))
);
childOrder.setProductActualPrice(childOrder.getProductTotalPrice().subtract(childOrder.getTotalDeductionPrice()));
orderChildService.editData(childOrder);

Loading…
Cancel
Save