From b321ad333a1306c56f1799754ba7498e4da651f2 Mon Sep 17 00:00:00 2001 From: wangjinlei <751475802@qq.com> Date: Thu, 7 Dec 2023 15:23:31 +0800 Subject: [PATCH] bug --- .../book/controller/BuyOrderController.java | 15 ++++++++++++--- .../peanut/modules/book/entity/MyUserEntity.java | 4 ++++ .../alipay/service/impl/AliPayServiceImpl.java | 5 +++++ .../weChatPay/controller/WeChatPayController.java | 5 +++++ 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/peanut/modules/book/controller/BuyOrderController.java b/src/main/java/com/peanut/modules/book/controller/BuyOrderController.java index ca82cd1c..552e3bf7 100644 --- a/src/main/java/com/peanut/modules/book/controller/BuyOrderController.java +++ b/src/main/java/com/peanut/modules/book/controller/BuyOrderController.java @@ -262,15 +262,21 @@ public class BuyOrderController { List buyOrderProductList = buyOrder.getProductList(); // 订单总金额 BigDecimal totalPrice = new BigDecimal(0); - //是否存在手摸或脚模 + //是否存在手摸或脚模,修改用户的脉穴权限 List sjc =Arrays.asList(128,129,130,131); boolean sj_check = false; + //是否存在时辰取穴的权限触发商品 + List scqq = Arrays.asList(133,134,135); + boolean scqq_check = false; // 遍历商品总价计算 for (BuyOrderProduct buyOrderProduct : buyOrderProductList) { if(sjc.contains(buyOrderProduct.getProductId())){ sj_check = true; } + if(scqq.contains(buyOrderProduct.getProductId())){ + scqq_check = true; + } Integer productId = buyOrderProduct.getProductId(); int quantity = buyOrderProduct.getQuantity(); @@ -309,7 +315,7 @@ public class BuyOrderController { if (Constants.PAYMENT_METHOD_VIRTUAL.equals(buyOrder.getPaymentMethod())) { buyOrder.setOrderStatus(Constants.ORDER_STATUS_TO_BE_SHIPPED); MyUserEntity user = this.myUserService.getById(buyOrder.getUserId()); - if (usePeanutCoin(user, totalPrice,sj_check)) { + if (usePeanutCoin(user, totalPrice,sj_check,scqq_check)) { // 更新订单状态 buyOrderService.updateOrderStatus(user.getId(), buyOrder.getOrderSn(), "0"); recordTransaction(buyOrder, user, totalPrice); @@ -861,12 +867,15 @@ public class BuyOrderController { * @param totalPrice * @return */ - private boolean usePeanutCoin(MyUserEntity user, BigDecimal totalPrice,boolean sj_check) { + private boolean usePeanutCoin(MyUserEntity user, BigDecimal totalPrice,boolean sj_check,boolean scqq_check) { if (user.getPeanutCoin().compareTo(totalPrice) >= 0) { user.setPeanutCoin(user.getPeanutCoin().subtract(totalPrice)); if (sj_check){ user.setPointPower(1); } + if(scqq_check){ + user.setTgdzPower(1); + } this.myUserService.updateById(user); return true; } diff --git a/src/main/java/com/peanut/modules/book/entity/MyUserEntity.java b/src/main/java/com/peanut/modules/book/entity/MyUserEntity.java index 173585bd..e8fcb547 100644 --- a/src/main/java/com/peanut/modules/book/entity/MyUserEntity.java +++ b/src/main/java/com/peanut/modules/book/entity/MyUserEntity.java @@ -87,6 +87,10 @@ public class MyUserEntity implements Serializable { */ private Integer pointPower; + /** + * 是否有时辰取穴的权限 + */ + private Integer tgdzPower; /** * 创建时间 diff --git a/src/main/java/com/peanut/modules/pay/alipay/service/impl/AliPayServiceImpl.java b/src/main/java/com/peanut/modules/pay/alipay/service/impl/AliPayServiceImpl.java index 2cbb894b..086d57d2 100644 --- a/src/main/java/com/peanut/modules/pay/alipay/service/impl/AliPayServiceImpl.java +++ b/src/main/java/com/peanut/modules/pay/alipay/service/impl/AliPayServiceImpl.java @@ -221,6 +221,11 @@ public class AliPayServiceImpl implements AliPayService { userInfo.setPointPower(1); userService.updateById(userInfo); } + if(collect.contains(133)||collect.contains(134)||collect.contains(135)){ + MyUserEntity userInfo = userService.getById(orderEntity.getUserId()); + userInfo.setTgdzPower(1); + userService.updateById(userInfo); + } } diff --git a/src/main/java/com/peanut/modules/pay/weChatPay/controller/WeChatPayController.java b/src/main/java/com/peanut/modules/pay/weChatPay/controller/WeChatPayController.java index 6b6e86f4..499075f5 100644 --- a/src/main/java/com/peanut/modules/pay/weChatPay/controller/WeChatPayController.java +++ b/src/main/java/com/peanut/modules/pay/weChatPay/controller/WeChatPayController.java @@ -157,6 +157,11 @@ public class WeChatPayController { userInfo.setPointPower(1); userService.updateById(userInfo); } + if(collect.contains(133)||collect.contains(134)||collect.contains(135)){ + MyUserEntity userInfo = userService.getById(order.getUserId()); + userInfo.setTgdzPower(1); + userService.updateById(userInfo); + } buyOrderService.updateOrderStatus(order.getUserId(), order.getOrderSn(), "0");