From d7adcea5db3823938371718f03036c1c5396aa5c Mon Sep 17 00:00:00 2001 From: dy-hu Date: Thu, 19 Dec 2024 09:34:20 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=96=B0=E5=A2=9E=E6=A0=B9=E6=8D=AE=E5=BA=97?= =?UTF-8?q?=E9=93=BAid=E9=9B=86=E5=90=88=E8=8E=B7=E5=8F=96=E5=95=86?= =?UTF-8?q?=E5=AE=B6id=E9=9B=86=E5=90=88=E6=8E=A5=E5=8F=A3=E4=B8=9A?= =?UTF-8?q?=E5=8A=A1=202.=E6=96=B0=E5=A2=9E=E5=95=86=E5=AE=B6id=E9=9B=86?= =?UTF-8?q?=E5=90=88=E8=8E=B7=E5=8F=96=E5=95=86=E5=AE=B6=E4=BC=98=E6=83=A0?= =?UTF-8?q?=E5=88=B8=E4=BF=A1=E6=81=AF=E6=8E=A5=E5=8F=A3=E4=B8=9A=E5=8A=A1?= =?UTF-8?q?=203.=E4=B8=8B=E5=8D=95=E4=B8=9A=E5=8A=A1=E5=BA=97=E9=93=BA?= =?UTF-8?q?=E4=BC=98=E6=83=A0=E5=88=B8=E6=B1=87=E7=AE=97=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E5=95=86=E5=AE=B6=E4=BC=98=E6=83=A0=E5=88=B8=E6=B1=87=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cereshop/app/dao/buyer/CereBuyerShopCouponDAO.java | 4 ++++ .../app/service/buyer/CereBuyerShopCouponService.java | 4 ++++ .../buyer/impl/CereBuyerShopCouponServiceImpl.java | 10 ++++++++++ .../order/placeOrderTemplate/PlaceOrderTemplate.java | 8 +++++--- .../mybatis/mapper/buyer/CereBuyerShopCouponDAO.xml | 17 +++++++++++++++++ .../mybatis/mapper/business/CerePlatformBusinessDAO.xml | 8 ++++---- 6 files changed, 44 insertions(+), 7 deletions(-) diff --git a/cereshop-app/src/main/java/com/shop/cereshop/app/dao/buyer/CereBuyerShopCouponDAO.java b/cereshop-app/src/main/java/com/shop/cereshop/app/dao/buyer/CereBuyerShopCouponDAO.java index 9d9b228..701f174 100644 --- a/cereshop-app/src/main/java/com/shop/cereshop/app/dao/buyer/CereBuyerShopCouponDAO.java +++ b/cereshop-app/src/main/java/com/shop/cereshop/app/dao/buyer/CereBuyerShopCouponDAO.java @@ -53,4 +53,8 @@ public interface CereBuyerShopCouponDAO extends BaseMapper List selectTakeCount(@Param("buyerUserId") Long buyerUserId, @Param("couponIdList") List couponIdList); + + List findBusinessIdsByShops(@Param("list") List list); + + List findBuyerShopCouponsByBusinessIds(@Param("list") List list); } diff --git a/cereshop-app/src/main/java/com/shop/cereshop/app/service/buyer/CereBuyerShopCouponService.java b/cereshop-app/src/main/java/com/shop/cereshop/app/service/buyer/CereBuyerShopCouponService.java index ee5fdd5..0ec3f50 100644 --- a/cereshop-app/src/main/java/com/shop/cereshop/app/service/buyer/CereBuyerShopCouponService.java +++ b/cereshop-app/src/main/java/com/shop/cereshop/app/service/buyer/CereBuyerShopCouponService.java @@ -42,4 +42,8 @@ public interface CereBuyerShopCouponService { * @return */ List selectTakeCount(Long buyerUserId, List couponIdList); + + List findBusinessIdsByShops(List shopIdList); + + List findBuyerShopCouponsByBusinessIds(List businessIdList); } diff --git a/cereshop-app/src/main/java/com/shop/cereshop/app/service/buyer/impl/CereBuyerShopCouponServiceImpl.java b/cereshop-app/src/main/java/com/shop/cereshop/app/service/buyer/impl/CereBuyerShopCouponServiceImpl.java index 072bce8..da66964 100644 --- a/cereshop-app/src/main/java/com/shop/cereshop/app/service/buyer/impl/CereBuyerShopCouponServiceImpl.java +++ b/cereshop-app/src/main/java/com/shop/cereshop/app/service/buyer/impl/CereBuyerShopCouponServiceImpl.java @@ -79,4 +79,14 @@ public class CereBuyerShopCouponServiceImpl implements CereBuyerShopCouponServic public List selectTakeCount(Long buyerUserId, List couponIdList) { return cereBuyerShopCouponDAO.selectTakeCount(buyerUserId, couponIdList); } + + @Override + public List findBusinessIdsByShops(List shopIdList) { + return cereBuyerShopCouponDAO.findBusinessIdsByShops(shopIdList); + } + + @Override + public List findBuyerShopCouponsByBusinessIds(List businessIdList) { + return null; + } } diff --git a/cereshop-app/src/main/java/com/shop/cereshop/app/service/order/placeOrderTemplate/PlaceOrderTemplate.java b/cereshop-app/src/main/java/com/shop/cereshop/app/service/order/placeOrderTemplate/PlaceOrderTemplate.java index 01f22a6..d22182d 100644 --- a/cereshop-app/src/main/java/com/shop/cereshop/app/service/order/placeOrderTemplate/PlaceOrderTemplate.java +++ b/cereshop-app/src/main/java/com/shop/cereshop/app/service/order/placeOrderTemplate/PlaceOrderTemplate.java @@ -608,9 +608,11 @@ public abstract class PlaceOrderTemplate { } } - //查询所有店铺优惠券数据 + //查询所有店铺优惠券数据(改为获取所有商家优惠券。) List shopIdList = param.getShops().stream().map(OrderProductParam::getShopId).distinct().collect(Collectors.toList()); - List list = cereBuyerShopCouponService.findByIds(shopIdList); + //查询店铺所属的商家id + List businessIdList = cereBuyerShopCouponService.findBusinessIdsByShops(shopIdList); + List list = cereBuyerShopCouponService.findBuyerShopCouponsByBusinessIds(businessIdList); //计算店铺优惠券金额总和--注意订单不是根据店铺作为主键的,但是店铺优惠券是根据店铺作为主键的,要做好怎么分配--TODO pxh if (!EmptyUtils.isEmpty(list)) { @@ -620,7 +622,7 @@ public abstract class PlaceOrderTemplate { Long shopId = param.getShops().stream().filter(o->o.getId() != null && o.getId().equals(cereBuyerShopCoupon.getId())).map(OrderProductParam::getShopId).findAny().orElse(0L); Optional productParam = param.getShops().stream().filter(o->o.getShopId().equals(shopId)).findFirst(); int priceCount = 0; - if (productParam.isPresent()){ + if (productParam != null && productParam.isPresent()){ List skuList = productParam.get().getSkus(); for (ProductSku sku:skuList) { if (sku.getPriceId() != null && sku.getPriceId() > 0) { diff --git a/cereshop-app/src/main/resources/mybatis/mapper/buyer/CereBuyerShopCouponDAO.xml b/cereshop-app/src/main/resources/mybatis/mapper/buyer/CereBuyerShopCouponDAO.xml index bd96fcc..d4aa993 100644 --- a/cereshop-app/src/main/resources/mybatis/mapper/buyer/CereBuyerShopCouponDAO.xml +++ b/cereshop-app/src/main/resources/mybatis/mapper/buyer/CereBuyerShopCouponDAO.xml @@ -250,6 +250,23 @@ ) + + + +