From a492ebe299a94e04b325cfb34a6e27e60adbd1dd Mon Sep 17 00:00:00 2001 From: yuanye <418471657@qq.com> Date: Fri, 24 May 2024 16:22:50 +0800 Subject: [PATCH] Changes --- .../java/com/hfkj/service/goods/GoodsMsgService.java | 9 +++++++++ .../hfkj/service/goods/impl/GoodsMsgServiceImpl.java | 11 +++++++++++ .../java/com/hfkj/service/order/BsOrderService.java | 1 + .../com/hfkj/service/order/OrderCreateService.java | 4 ++-- 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/service/src/main/java/com/hfkj/service/goods/GoodsMsgService.java b/service/src/main/java/com/hfkj/service/goods/GoodsMsgService.java index f73930f..09f9b08 100644 --- a/service/src/main/java/com/hfkj/service/goods/GoodsMsgService.java +++ b/service/src/main/java/com/hfkj/service/goods/GoodsMsgService.java @@ -75,4 +75,13 @@ public interface GoodsMsgService { */ List getList(Map map); + + /** + * 查询订单列表 + * @param goodsId + * @param num + * @return + */ + void addSaleNum(Long goodsId , Integer num); + } diff --git a/service/src/main/java/com/hfkj/service/goods/impl/GoodsMsgServiceImpl.java b/service/src/main/java/com/hfkj/service/goods/impl/GoodsMsgServiceImpl.java index 005f0c0..c9ba172 100644 --- a/service/src/main/java/com/hfkj/service/goods/impl/GoodsMsgServiceImpl.java +++ b/service/src/main/java/com/hfkj/service/goods/impl/GoodsMsgServiceImpl.java @@ -94,4 +94,15 @@ public class GoodsMsgServiceImpl implements GoodsMsgService { return goodsMsgMapper.selectByExample(example); } + + @Override + public void addSaleNum(Long goodsId, Integer num) { + GoodsMsg goodsMsg = queryDetail(goodsId); + + if (goodsMsg != null) { + goodsMsg.setSaleNum(goodsMsg.getSaleNum() + num); + update(goodsMsg); + } + + } } diff --git a/service/src/main/java/com/hfkj/service/order/BsOrderService.java b/service/src/main/java/com/hfkj/service/order/BsOrderService.java index d6d7954..6060e11 100644 --- a/service/src/main/java/com/hfkj/service/order/BsOrderService.java +++ b/service/src/main/java/com/hfkj/service/order/BsOrderService.java @@ -82,4 +82,5 @@ public interface BsOrderService { */ List getOrderList(Map param); + } diff --git a/service/src/main/java/com/hfkj/service/order/OrderCreateService.java b/service/src/main/java/com/hfkj/service/order/OrderCreateService.java index 53b444c..dfd35a1 100644 --- a/service/src/main/java/com/hfkj/service/order/OrderCreateService.java +++ b/service/src/main/java/com/hfkj/service/order/OrderCreateService.java @@ -218,14 +218,14 @@ public class OrderCreateService { bsOrderGoodsService.create(orderGoods); + goodsMsgService.addSaleNum(orderGoods.getGoodsId() , orderGoods.getGoodsCount()); + jsonObject.put("orderGoodsId", orderGoods.getId()); if (object.getLong("shopCartId") != null) { shoppingCartService.delete(object.getLong("shopCartId")); } - - orderChild.setBusiness(jsonObject); return orderChild;