From 13b32ccd555afd1cc1ad0270130517f4a8f7837b Mon Sep 17 00:00:00 2001 From: wyn <1074145239@qq.com> Date: Tue, 2 Jun 2026 17:53:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8C=87=E5=AE=9A2023=E9=A2=84=E5=94=AE?= =?UTF-8?q?=E4=B9=A6=E5=8F=AA=E6=9C=89=E5=A6=87=E5=B9=BC=E7=94=9F=E6=AE=96?= =?UTF-8?q?vip=E9=80=81=E7=A7=AF=E5=88=86=EF=BC=8C=E5=85=B6=E4=BB=96vip?= =?UTF-8?q?=E9=80=81=E4=BC=98=E6=83=A0=E5=88=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/BuyOrderServiceImpl.java | 4 +-- .../service/impl/CouponServiceImpl.java | 26 +++++++++---------- .../impl/JfTransactionDetailsServiceImpl.java | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/peanut/modules/book/service/impl/BuyOrderServiceImpl.java b/src/main/java/com/peanut/modules/book/service/impl/BuyOrderServiceImpl.java index e221129..4e82c22 100644 --- a/src/main/java/com/peanut/modules/book/service/impl/BuyOrderServiceImpl.java +++ b/src/main/java/com/peanut/modules/book/service/impl/BuyOrderServiceImpl.java @@ -1094,10 +1094,10 @@ public class BuyOrderServiceImpl extends ServiceImpl impl if(buyOrder.getOrderType().equals("vip")){ userVipService.refundVip(buyOrder); }else{ - //撤回本订单购买赠送的优惠券 - couponService.refundZSCouponHistoryByOrder(buyOrder); //恢复用户权益(点穴/时辰取穴/五运六气/肿瘤古方) myUserService.rollbackUserPowers(buyOrder,user, orderProducts); + //撤回本订单购买赠送的优惠券 + couponService.refundZSCouponHistoryByOrder(buyOrder); //撤回电子书权限 userEbookBuyService.rollbackUserEbooks(buyOrder, orderProducts); //撤回课程权限 diff --git a/src/main/java/com/peanut/modules/common/service/impl/CouponServiceImpl.java b/src/main/java/com/peanut/modules/common/service/impl/CouponServiceImpl.java index 2e8d35b..b48f774 100644 --- a/src/main/java/com/peanut/modules/common/service/impl/CouponServiceImpl.java +++ b/src/main/java/com/peanut/modules/common/service/impl/CouponServiceImpl.java @@ -324,16 +324,19 @@ public class CouponServiceImpl extends ServiceImpl impl isVip = true; } System.out.println("isVip:"+isVip); + boolean isFyszVip = userVipList.stream().anyMatch(userVip -> Integer.valueOf(10).equals(userVip.getType())); BigDecimal refundAllJF = BigDecimal.ZERO; Boolean isRefundCoupon = false; for (Map map : buyOrderProducts) { ShopProduct shopProduct = shopProductDao.selectById(map.get("product_id").toString()); System.out.println("goodsType:"+shopProduct.getGoodsType()); if ("03".equals(shopProduct.getGoodsType())){ + int productId = Integer.parseInt(map.get("product_id").toString()); int couponId = Integer.parseInt(map.get("coupon_id").toString()); CouponEntity couponEntity = couponDao.selectById(couponId); + boolean shouldRefundJf = couponEntity.getCouponType()==0 && ((productId == 2023 && isFyszVip) || (productId != 2023 && isVip)); //现金券 - if (couponEntity.getCouponType()==0 && isVip){ + if (shouldRefundJf){ BigDecimal quantity = new BigDecimal(map.get("quantity").toString()); BigDecimal sumRefundJF = couponEntity.getCouponAmount().multiply(quantity); refundAllJF = refundAllJF.add(sumRefundJF); @@ -376,17 +379,20 @@ public class CouponServiceImpl extends ServiceImpl impl List> buyOrderProducts = couponToProductDao.selectJoinMaps(wrapper); for (Map map : buyOrderProducts) { ShopProduct shopProduct = shopProductDao.selectById(map.get("product_id").toString()); - //vip身份用户,买送优惠券的预售书时候,不送优惠券改自动送积分 + //预售书赠送规则: + //1) 指定预售书(2023):仅妇幼生殖vip(type=10)且现金券时,改为送积分 + //2) 其他预售书:保持原规则(任意vip且现金券时,改为送积分) if ("03".equals(shopProduct.getGoodsType())){ MyUserEntity userEntity = userDao.selectById(order.getUserId()); List userVipList = userVipDao.selectList(new LambdaQueryWrapper() .eq(UserVip::getUserId, userEntity.getId()) .eq(UserVip::getState,0)); - if (userVipList.size() > 0) { - int couponId = Integer.parseInt(map.get("coupon_id").toString()); - CouponEntity couponEntity = couponDao.selectById(couponId); - //现金券 - if (couponEntity.getCouponType()==0){ + int productId = Integer.parseInt(map.get("product_id").toString()); + int couponId = Integer.parseInt(map.get("coupon_id").toString()); + CouponEntity couponEntity = couponDao.selectById(couponId); + boolean isFyszVip = userVipList.stream().anyMatch(userVip -> Integer.valueOf(10).equals(userVip.getType())); + boolean couponToJf = couponEntity.getCouponType() == 0 && ((productId == 2023 && isFyszVip) || (productId != 2023 && userVipList.size() > 0)); + if (couponToJf){ BigDecimal jf = BigDecimal.ZERO; for (int i=0;i impl jfTransactionDetails.setRemark("vip用户买预售书送的优惠券换积分,订单号:"+order.getOrderSn()); jfTransactionDetailsDao.insert(jfTransactionDetails); } - }else { - for (int i=0;i