From fa3791d101fa907b5b144f7afab2c3cfb0bd9c28 Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Mon, 6 Feb 2023 17:18:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A42=E3=80=820=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/OrderPaySuccessServiceImpl.java | 2 +- .../hai/order/service/impl/OrderServiceImpl.java | 14 ++++++++++++++ .../service/HighDiscountPackageActualService.java | 4 ++-- .../impl/HighDiscountPackageActualServiceImpl.java | 4 ++-- .../com/hai/service/impl/HighOrderServiceImpl.java | 4 ++-- .../service/pay/impl/GoodsOrderServiceImpl.java | 2 +- 6 files changed, 22 insertions(+), 8 deletions(-) diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java index 5b7b3180..d5183219 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java @@ -390,7 +390,7 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService { * @Return void */ private void eCouponPackageHandle(HighOrder order , HighChildOrder highChildOrder) throws Exception { - HighDiscountPackageActual actual = discountPackageActualService.getDetailByChildOrderId(highChildOrder.getId()); + HighDiscountPackageActual actual = discountPackageActualService.getDetailByChildOrderNo(highChildOrder.getOrderNo()); if (actual != null) { List discountList = discountPackageDiscountActualService.getHighDiscountPackageDiscountActualList(actual.getId()); for (HighDiscountPackageDiscountActual discount : discountList) { 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 1764be8a..459f42b7 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 @@ -82,6 +82,9 @@ public class OrderServiceImpl implements OrderService { @Resource private ThirdProductConfig thirdProductConfig; + @Resource + private HighDiscountPackageActualService discountPackageActualService; + @Override public HighOrder insertOrderData(HighOrder order) { @@ -220,6 +223,17 @@ public class OrderServiceImpl implements OrderService { } else if (child.getGoodsType().equals(OrderChildGoodsType.TYPE7.getNumber())) { order.setProductType(OrderProductType.PRODUCT_TYPE7.getNumber()); HighChildOrder childOrder = orderCreateHandleService.couponPackage(child); + + // 查询库存 + List list = discountPackageActualService.getListByPackageId(childOrder.getGoodsId().intValue(), 1); + if (list == null || list.size() == 0) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COUPON_STOCK_INSUFFICIENT, ""); + } + list.get(0).setUserId(order.getMemId().intValue()); + list.get(0).setExt1(childOrder.getOrderNo()); + list.get(0).setStatus(2); // 状态: 1: 待分配 2:预分配(售卖)3:已分配 + discountPackageActualService.updateHighDiscountPackageActual(list.get(0)); + childOrderList.add(childOrder); order.setTitle(childOrder.getGoodsName()); diff --git a/hai-service/src/main/java/com/hai/service/HighDiscountPackageActualService.java b/hai-service/src/main/java/com/hai/service/HighDiscountPackageActualService.java index 4ed49461..e0e56d79 100644 --- a/hai-service/src/main/java/com/hai/service/HighDiscountPackageActualService.java +++ b/hai-service/src/main/java/com/hai/service/HighDiscountPackageActualService.java @@ -56,10 +56,10 @@ public interface HighDiscountPackageActualService { /** * 获取库存 - * @param childOrderId + * @param orderNo * @return */ - HighDiscountPackageActual getDetailByChildOrderId(Long childOrderId); + HighDiscountPackageActual getDetailByChildOrderNo(String orderNo); /** * 查询优惠券包列表 diff --git a/hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageActualServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageActualServiceImpl.java index 9caf932e..bab81b33 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageActualServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighDiscountPackageActualServiceImpl.java @@ -60,9 +60,9 @@ public class HighDiscountPackageActualServiceImpl implements HighDiscountPackage } @Override - public HighDiscountPackageActual getDetailByChildOrderId(Long childOrderId) { + public HighDiscountPackageActual getDetailByChildOrderNo(String orderNo) { HighDiscountPackageActualExample example = new HighDiscountPackageActualExample(); - example.createCriteria().andChildOrderIdEqualTo(childOrderId); + example.createCriteria().andExt1EqualTo(orderNo); List list = discountPackageActualMapper.selectByExample(example); if (list.size() > 0) { return list.get(0); diff --git a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java index 292b9f57..9e1bc437 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java @@ -649,7 +649,7 @@ public class HighOrderServiceImpl implements HighOrderService { } */ if (highChildOrder.getGoodsType() == 7) { - HighDiscountPackageActual actual = discountPackageActualService.getDetailByChildOrderId(highChildOrder.getId()); + HighDiscountPackageActual actual = discountPackageActualService.getDetailByChildOrderNo(highChildOrder.getOrderNo()); if (actual != null) { List discountList = discountPackageDiscountActualService.getHighDiscountPackageDiscountActualList(actual.getId()); for (HighDiscountPackageDiscountActual discount : discountList) { @@ -1032,7 +1032,7 @@ public class HighOrderServiceImpl implements HighOrderService { } if (highChildOrder.getGoodsType() == 7) { - HighDiscountPackageActual actual = discountPackageActualService.getDetailByChildOrderId(highChildOrder.getId()); + HighDiscountPackageActual actual = discountPackageActualService.getDetailByChildOrderNo(highChildOrder.getOrderNo()); if (actual != null) { actual.setChildOrderId(null); actual.setUserId(null); diff --git a/hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java index 2e76e273..779013a9 100644 --- a/hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java @@ -416,7 +416,7 @@ public class GoodsOrderServiceImpl implements PayService { }*/ if (highChildOrder.getGoodsType() == 7) { - HighDiscountPackageActual actual = discountPackageActualService.getDetailByChildOrderId(highChildOrder.getId()); + HighDiscountPackageActual actual = discountPackageActualService.getDetailByChildOrderNo(highChildOrder.getOrderNo()); if (actual != null) { List discountList = discountPackageDiscountActualService.getHighDiscountPackageDiscountActualList(actual.getId()); for (HighDiscountPackageDiscountActual discount : discountList) {