提交代码

dev-discount
胡锐 2 years ago
parent 775fb06b08
commit e29c4aea59
  1. 17
      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.setProfitSharingStatus(false);
order.setExceptionStatus(false); order.setExceptionStatus(false);
order.setCreateTime(new Date()); order.setCreateTime(new Date());
order.setPayGold(0); order.setPayGold(createOrderModel.getPayGold()!=null?createOrderModel.getPayGold():0);
order.setDeductionCouponPrice(new BigDecimal("0")); order.setDeductionCouponPrice(new BigDecimal("0"));
order.setDeductionProductPrice(new BigDecimal("0")); order.setDeductionProductPrice(new BigDecimal("0"));
order.setCompanyId(createOrderModel.getCompanyId()); order.setCompanyId(createOrderModel.getCompanyId());
@ -392,26 +392,19 @@ public class OrderServiceImpl implements OrderService {
for (HighChildOrder childOrder : order.getHighChildOrderList()) { for (HighChildOrder childOrder : order.getHighChildOrderList()) {
childOrder.setOrderNo(order.getOrderNo()); childOrder.setOrderNo(order.getOrderNo());
childOrder.setSurplusRefundNum(childOrder.getSaleCount()); 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) { 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)); childOrder.setSurplusRefundPrice(order.getPayPrice().multiply(ratio).setScale(2, BigDecimal.ROUND_DOWN));
} else { } else {
childOrder.setSurplusRefundPrice(new BigDecimal("0")); childOrder.setSurplusRefundPrice(new BigDecimal("0"));
} }
// 计算子订单退款积分 // 计算子订单退款积分
if (order.getPayGold() > 0) { if (order.getPayGold() > 0) {
BigDecimal ratio = childOrder.getTotalActualPrice() childOrder.setSurplusRefundIntegral(new BigDecimal(order.getPayGold().toString()).multiply(ratio).setScale(2).intValue());
.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 { } else {
childOrder.setSurplusRefundIntegral(0); childOrder.setSurplusRefundIntegral(0);
} }

Loading…
Cancel
Save