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

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

@ -78,7 +78,7 @@ public class OrderCreateService {
if (goodsSpecs == null) { if (goodsSpecs == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的商品规格"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的商品规格");
} }
JSONObject businessObj = orderChild.getBusiness()==null? new JSONObject(): new JSONObject((Map<String, Object>) orderChild.getBusiness()); JSONObject businessObj = orderChild.getBusiness()==null?new JSONObject(): new JSONObject((Map<String, Object>) orderChild.getBusiness());
if (businessObj.getLong("shopCartId") != null) { if (businessObj.getLong("shopCartId") != null) {
shoppingCartService.delete(businessObj.getLong("shopCartId")); shoppingCartService.delete(businessObj.getLong("shopCartId"));
} }
@ -116,7 +116,7 @@ public class OrderCreateService {
orderCoupon.setStatus(OrderChildStatusEnum.status1.getCode()); orderCoupon.setStatus(OrderChildStatusEnum.status1.getCode());
orderCouponService.editData(orderCoupon); orderCouponService.editData(orderCoupon);
for (int i = 0; i < orderCoupon.getGoodsCount(); i++) { for (int i = 0; i <= orderCoupon.getGoodsCount(); i++) {
// 卡券订单卡密 // 卡券订单卡密
BsOrderCouponNo orderCouponNo = new BsOrderCouponNo(); BsOrderCouponNo orderCouponNo = new BsOrderCouponNo();
orderCouponNo.setCouponOrderId(orderCoupon.getId()); orderCouponNo.setCouponOrderId(orderCoupon.getId());

@ -202,13 +202,7 @@ public class BsOrderServiceImpl implements BsOrderService {
childOrder.setSurplusRefundCount(childOrder.getProductCount()); childOrder.setSurplusRefundCount(childOrder.getProductCount());
// 计算 子订单 在交易订单金额中的占比 // 计算 子订单 在交易订单金额中的占比
BigDecimal ratio = childOrder.getProductTotalPrice().divide(order.getTotalPrice(), 2, BigDecimal.ROUND_DOWN).setScale(2); BigDecimal ratio = childOrder.getProductTotalPrice().divide(order.getTotalPrice(), 2, BigDecimal.ROUND_DOWN);
// 计算子订单退款金额。
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"));
}
// 计算子订单退款积分 // 计算子订单退款积分
if (order.getDeduction().getIntegralDiscountPrice() > 0) { if (order.getDeduction().getIntegralDiscountPrice() > 0) {
@ -217,10 +211,27 @@ public class BsOrderServiceImpl implements BsOrderService {
childOrder.setSurplusRefundIntegral(0L); 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.setCouponDiscountPrice(childOrder.getProductTotalPrice().subtract(childOrder.getSurplusRefundPrice()));
childOrder.setIntegralDiscountPrice(childOrder.getSurplusRefundIntegral()); childOrder.setIntegralDiscountPrice(childOrder.getSurplusRefundIntegral());
childOrder.setTotalDeductionPrice( 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())); childOrder.setProductActualPrice(childOrder.getProductTotalPrice().subtract(childOrder.getTotalDeductionPrice()));
orderChildService.editData(childOrder); orderChildService.editData(childOrder);

Loading…
Cancel
Save