From d6f320863b81498876dc0fa4c964e451bbcefac5 Mon Sep 17 00:00:00 2001 From: wuchunlei Date: Mon, 3 Mar 2025 15:55:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=98=E6=89=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BookLabelAndMarketController.java | 27 ++++++- .../book/controller/BuyOrderController.java | 76 +++++++++++++++++++ .../controller/ShopProductController.java | 22 +++++- .../book/service/ShopProductService.java | 4 + .../service/impl/BuyOrderServiceImpl.java | 9 ++- .../service/impl/OrderCartServiceImpl.java | 18 +++++ .../service/impl/ShopProductServiceImpl.java | 43 +++++++++++ .../peanut/modules/book/vo/ShopCartVo.java | 9 +++ .../book/vo/response/BuyOrderResponseVo.java | 4 + .../book/vo/response/GoodsResponseVo.java | 4 + .../controller/CourseRelearnController.java | 2 + .../controller/OfflineActivityController.java | 2 + .../common/controller/UserVipController.java | 2 + .../modules/common/entity/BuyOrder.java | 4 + .../modules/common/entity/ShopProduct.java | 8 ++ .../common/service/UserVipService.java | 3 + .../service/impl/UserVipServiceImpl.java | 29 +++++++ .../pay/weChatPay/config/WechatPayConfig.java | 2 + .../controller/WeChatPayController.java | 2 + .../service/impl/WxpayServiceImpl.java | 2 + .../controller/PsycheCourseController.java | 14 ++++ 21 files changed, 280 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/peanut/modules/book/controller/BookLabelAndMarketController.java b/src/main/java/com/peanut/modules/book/controller/BookLabelAndMarketController.java index d17f915d..ddc16e2a 100644 --- a/src/main/java/com/peanut/modules/book/controller/BookLabelAndMarketController.java +++ b/src/main/java/com/peanut/modules/book/controller/BookLabelAndMarketController.java @@ -6,12 +6,15 @@ import com.github.yulichang.wrapper.MPJLambdaWrapper; import com.peanut.common.utils.R; import com.peanut.modules.common.entity.*; import com.peanut.modules.book.service.*; +import com.peanut.modules.common.service.UserVipService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; + +import java.math.BigDecimal; import java.util.List; import java.util.Map; @@ -33,6 +36,8 @@ public class BookLabelAndMarketController { private ShopProductToBookMarketService toMarketService; @Autowired private ShopProductService productService; + @Autowired + private UserVipService userVipService; /** * 图书标签树 @@ -375,12 +380,26 @@ public class BookLabelAndMarketController { wrapper.eq(ShopProductToBookLabel::getBookLabelId,labelId); wrapper.leftJoin(ShopProduct.class,ShopProduct::getProductId,ShopProductToBookLabel::getProductId); // wrapper.selectAll(ShopProduct.class); - wrapper.select(ShopProduct::getProductId,ShopProduct::getProductName,ShopProduct::getSumSales,ShopProduct::getIsFreeMail,ShopProduct::getPrice,ShopProduct::getActivityPrice,ShopProduct::getProductStock,ShopProduct::getProductImageList,ShopProduct::getGoodsType,ShopProduct::getProductImages,ShopProduct::getIsNew,ShopProduct::getPublisher); - - + wrapper.select(ShopProduct::getProductId,ShopProduct::getProductName,ShopProduct::getSumSales,ShopProduct::getIsVipPrice,ShopProduct::getIsFreeMail,ShopProduct::getPrice,ShopProduct::getActivityPrice,ShopProduct::getProductStock,ShopProduct::getProductImageList,ShopProduct::getGoodsType,ShopProduct::getProductImages,ShopProduct::getIsNew,ShopProduct::getPublisher); // wrapper.orderByAsc(ShopProductToBookLabel::getSort); wrapper.orderByDesc(ShopProduct::getSumSales); - List list = toLabelService.listMaps(wrapper); + List> list = toLabelService.listMaps(wrapper); + for (Map map:list){ + //vip价格,不是vip或者活动价更低,返回0 + if (map.get("is_vip_price").toString().equals("1")){ + BigDecimal b = new BigDecimal(0); + if (userVipService.is456SVip()||userVipService.is78SVip()){ + b = ((BigDecimal) map.get("price")).multiply(new BigDecimal(0.8)).setScale(2,BigDecimal.ROUND_HALF_UP); + }else if (!userVipService.noVip()){ + b = ((BigDecimal) map.get("price")).multiply(new BigDecimal(0.9)).setScale(2,BigDecimal.ROUND_HALF_UP); + } + if (((BigDecimal) map.get("activity_price")).compareTo(new BigDecimal(0))>0 + &&b.compareTo(((BigDecimal) map.get("activity_price")))>0){ + b = new BigDecimal(0); + } + map.put("vip_price",b); + } + } return R.ok().put("result", list); } 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 5be41a32..f261f0ca 100644 --- a/src/main/java/com/peanut/modules/book/controller/BuyOrderController.java +++ b/src/main/java/com/peanut/modules/book/controller/BuyOrderController.java @@ -22,6 +22,7 @@ import com.peanut.modules.common.entity.*; import com.peanut.modules.common.service.CouponHistoryService; import com.peanut.modules.common.service.CouponService; import com.peanut.modules.common.service.JfTransactionDetailsService; +import com.peanut.modules.common.service.UserVipService; import com.peanut.modules.pay.weChatPay.dto.WechatPaymentInfo; import com.peanut.modules.pay.weChatPay.service.WxpayService; import com.peanut.modules.sys.entity.SysConfigEntity; @@ -55,6 +56,8 @@ public class BuyOrderController { @Autowired private ShopProductService shopProductService; @Autowired + private UserVipService userVipService; + @Autowired private BuyOrderDetailService buyOrderDetailService; @Autowired private OrderCartService orderCartService; @@ -148,6 +151,67 @@ public class BuyOrderController { return R.ok().put("map",m); } + //获取商品vip折扣金额 + @RequestMapping("/getVipDiscountAmount") + public R getVipDiscountAmount(@RequestBody BuyOrder buyOrder){ + BigDecimal b = new BigDecimal(0); + if (!userVipService.noVip()){ + List buyOrderProductList = buyOrder.getProductList(); + for (BuyOrderProduct buyOrderProduct : buyOrderProductList) { + BigDecimal pvda = shopProductService.getVipDiscountAmount(shopProductService.getById(buyOrderProduct.getProductId())); + b = b.add(pvda.multiply(new BigDecimal(buyOrderProduct.getQuantity()))); + } + } + return R.ok().put("discountAmount",b); + } + + //获取商品活动折扣金额 + @RequestMapping("/getDistrictAmount") + public R getDistrictAmount(@RequestBody BuyOrder buyOrder){ + BigDecimal total = new BigDecimal(0); + List buyOrderProductList = buyOrder.getProductList(); + for (BuyOrderProduct buyOrderProduct : buyOrderProductList) { + ShopProduct shopProduct = shopProductService.getById(buyOrderProduct.getProductId()); + if (!userVipService.noVip()){ + BigDecimal pvda = shopProductService.getVipDiscountAmount(shopProductService.getById(buyOrderProduct.getProductId())); + if (pvda.compareTo(BigDecimal.ZERO)>0){ + continue; + } + } + if (shopProduct.getActivityPrice().compareTo(BigDecimal.ZERO)>0){ + total = total.add((shopProduct.getPrice().subtract(shopProduct.getActivityPrice())).multiply(new BigDecimal(buyOrderProduct.getQuantity()))); + } + } + return R.ok().put("districtAmount",total); + } + + // + @RequestMapping("/getShopProductListByIds") + public R getShopProductListByIds(@RequestBody Map params){ + String[] productIds = params.get("productIds").toString().split(","); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper(); + wrapper.select(ShopProduct::getProductId,ShopProduct::getProductName,ShopProduct::getProductImages,ShopProduct::getPrice,ShopProduct::getActivityPrice,ShopProduct::getIsVipPrice); + wrapper.in(ShopProduct::getProductId,Arrays.asList(productIds)); + List shopProductList = shopProductService.list(wrapper); + for (ShopProduct shopProduct:shopProductList){ + //vip价格,不是vip或者活动价更低,返回0 + if (shopProduct.getIsVipPrice()==1){ + BigDecimal b = new BigDecimal(0); + if (userVipService.is456SVip()||userVipService.is78SVip()){ + b = shopProduct.getPrice().multiply(new BigDecimal(0.8)).setScale(2,BigDecimal.ROUND_HALF_UP); + }else if (!userVipService.noVip()){ + b = shopProduct.getPrice().multiply(new BigDecimal(0.9)).setScale(2,BigDecimal.ROUND_HALF_UP); + } + if (shopProduct.getActivityPrice().compareTo(new BigDecimal(0))>0 + &&b.compareTo(shopProduct.getActivityPrice())>0){ + b = new BigDecimal(0); + } + shopProduct.setVipPrice(b); + } + } + return R.ok().put("shopProductList",shopProductList); + } + /** * 订单详情 * @@ -216,6 +280,10 @@ public class BuyOrderController { List prescript_b = Arrays.asList(43,62,124); boolean prescriot_b_check = false; + if (buyOrder.getVipDiscountAmount()!=null&&buyOrder.getVipDiscountAmount().compareTo(new BigDecimal(0))>0 + &&buyOrder.getCouponId()!=null&&buyOrder.getCouponId()!=0){ + return R.error(500, "优惠不能叠加"); + } // 遍历商品总价计算 for (BuyOrderProduct buyOrderProduct : buyOrderProductList) { @@ -236,6 +304,10 @@ public class BuyOrderController { int quantity = buyOrderProduct.getQuantity(); ShopProduct product = shopProductService.getById(productId); BigDecimal price = getRealPrice(product); + if (buyOrder.getVipDiscountAmount()!=null&&buyOrder.getVipDiscountAmount().compareTo(new BigDecimal(0))>0 + &&product.getIsVipPrice()==1){ + price = shopProductService.getVipPrice(product); + } if (!handleStock(buyOrderProduct, product)) { return R.error(500, "库存不足"); } @@ -359,6 +431,8 @@ public class BuyOrderController { paymentInfo.setAppName("wumen"); } else if (buyOrder.getCome()==1) { paymentInfo.setAppName("zmzm"); + } else if (buyOrder.getCome()==3) { + paymentInfo.setAppName("xlkj"); } wxpayService.prepay(paymentInfo); } @@ -596,6 +670,8 @@ public class BuyOrderController { paymentInfo.setAppName("wumen"); } else if (buyOrder.getCome()==1) { paymentInfo.setAppName("zmzm"); + } else if (buyOrder.getCome()==3) { + paymentInfo.setAppName("xlkj"); }else { paymentInfo.setAppName(buyOrder.getAppName()); } diff --git a/src/main/java/com/peanut/modules/book/controller/ShopProductController.java b/src/main/java/com/peanut/modules/book/controller/ShopProductController.java index f4f75b96..a907ac96 100644 --- a/src/main/java/com/peanut/modules/book/controller/ShopProductController.java +++ b/src/main/java/com/peanut/modules/book/controller/ShopProductController.java @@ -1,5 +1,6 @@ package com.peanut.modules.book.controller; +import java.math.BigDecimal; import java.util.*; import java.util.stream.Collectors; @@ -7,6 +8,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.peanut.modules.book.service.*; import com.peanut.modules.book.vo.ShopProductVo; import com.peanut.modules.common.entity.*; +import com.peanut.modules.common.service.UserVipService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PathVariable; @@ -43,6 +45,8 @@ public class ShopProductController { private ShopProductToLabelService shopProductToLabelService; @Autowired private BuyOrderDetailService buyOrderDetailService; + @Autowired + private UserVipService userVipService; /** * 精选商品 列表 @@ -276,6 +280,9 @@ public class ShopProductController { } for (ShopProductBookEntity spbe : ss) { ShopProduct ca_sp = shopProductService.getById(spbe.getProductId()); + if (ca_sp.getIsVipPrice()==1){ + ca_sp.setVipPrice(shopProductService.getVipPrice(ca_sp)); + } frag.add(ca_sp); } @@ -315,7 +322,20 @@ public class ShopProductController { booklist.add(String.valueOf(bookId)); list.add(byId); } - + //vip价格,不是vip或者活动价更低,返回0 + if (shopProduct.getIsVipPrice()==1){ + BigDecimal b = new BigDecimal(0); + if (userVipService.is456SVip()||userVipService.is78SVip()){ + b = shopProduct.getPrice().multiply(new BigDecimal(0.8)).setScale(2,BigDecimal.ROUND_HALF_UP); + }else if (!userVipService.noVip()){ + b = shopProduct.getPrice().multiply(new BigDecimal(0.9)).setScale(2,BigDecimal.ROUND_HALF_UP); + } + if (shopProduct.getActivityPrice().compareTo(new BigDecimal(0))>0 + &&b.compareTo(shopProduct.getActivityPrice())>0){ + b = new BigDecimal(0); + } + shopProduct.setVipPrice(b); + } //添加获取标签逻辑 List shopProductToLabelEntities = shopProductToLabelService.getBaseMapper().selectList(new QueryWrapper() .eq("product_id", productId).eq("del_flag", 0)); diff --git a/src/main/java/com/peanut/modules/book/service/ShopProductService.java b/src/main/java/com/peanut/modules/book/service/ShopProductService.java index 645314cd..03ee6214 100644 --- a/src/main/java/com/peanut/modules/book/service/ShopProductService.java +++ b/src/main/java/com/peanut/modules/book/service/ShopProductService.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.peanut.common.utils.PageUtils; import com.peanut.modules.common.entity.ShopProduct; +import java.math.BigDecimal; import java.util.List; import java.util.Map; @@ -23,6 +24,9 @@ public interface ShopProductService extends IService { List appGetCategoryList(Integer catId); + BigDecimal getVipDiscountAmount(ShopProduct shopProduct); + + BigDecimal getVipPrice(ShopProduct shopProduct); PageUtils getNewBook(Map params); 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 f8148c93..2fbef9a6 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 @@ -464,7 +464,8 @@ public class BuyOrderServiceImpl extends ServiceImpl impl List buyOrderProducts = buyOrderProductService.getBaseMapper().selectList(new LambdaQueryWrapper() .eq(BuyOrderProduct::getOrderId, b.getOrderId())); for (BuyOrderProduct bb : buyOrderProducts){ - bb.setProduct(shopProductService.getById(bb.getProductId())); + bb.setProduct(shopProductService.getOne(new LambdaQueryWrapper().select(ShopProduct::getProductId,ShopProduct::getProductName,ShopProduct::getProductImages,ShopProduct::getPrice,ShopProduct::getActivityPrice,ShopProduct::getIsVipPrice) + .eq(ShopProduct::getProductId,bb.getProductId()))); UserRecord userRecord = userRecordDao.selectOne(new QueryWrapper() .eq("userid", ShiroUtils.getUId()) .eq("orderdid", b.getOrderId()) @@ -710,6 +711,7 @@ public class BuyOrderServiceImpl extends ServiceImpl impl responseVo.setRealPrice(buyOrder.getRealMoney()); responseVo.setShippingPrice(buyOrder.getShippingMoney()); responseVo.setDistrictPrice(buyOrder.getDistrictMoney()); + responseVo.setVipDiscountAmount(buyOrder.getVipDiscountAmount()); responseVo.setJfDeduction(buyOrder.getJfDeduction()); responseVo.setAddressId(buyOrder.getAddressId()); responseVo.setOrderType(buyOrder.getOrderType()); @@ -763,6 +765,11 @@ public class BuyOrderServiceImpl extends ServiceImpl impl goodsResponseVo.setProductName(shopProduct.getProductName()); goodsResponseVo.setProductImage(shopProduct.getProductImages()); goodsResponseVo.setProductPrice(shopProduct.getPrice()); + if (shopProduct.getIsVipPrice()==1){ + goodsResponseVo.setVipPrice(shopProductService.getVipPrice(shopProduct)); + }else { + goodsResponseVo.setVipPrice(BigDecimal.ZERO); + } goodsResponseVo.setQuantity(buyOrderProduct.getQuantity()); goodsResponseVo.setProductId(shopProduct.getProductId()); QueryWrapper expressOrderQueryWrapper = new QueryWrapper<>(); diff --git a/src/main/java/com/peanut/modules/book/service/impl/OrderCartServiceImpl.java b/src/main/java/com/peanut/modules/book/service/impl/OrderCartServiceImpl.java index 11cb1195..8d39cd65 100644 --- a/src/main/java/com/peanut/modules/book/service/impl/OrderCartServiceImpl.java +++ b/src/main/java/com/peanut/modules/book/service/impl/OrderCartServiceImpl.java @@ -3,6 +3,7 @@ package com.peanut.modules.book.service.impl; import com.peanut.modules.common.entity.ShopProduct; import com.peanut.modules.book.service.ShopProductService; import com.peanut.modules.book.vo.ShopCartVo; +import com.peanut.modules.common.service.UserVipService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -28,6 +29,8 @@ public class OrderCartServiceImpl extends ServiceImpl0 + &&b.compareTo(productEntity.getActivityPrice())>0){ + b = new BigDecimal(0); + } + shopCartVo.setVipPrice(b); + } cartList.add(shopCartVo); } } diff --git a/src/main/java/com/peanut/modules/book/service/impl/ShopProductServiceImpl.java b/src/main/java/com/peanut/modules/book/service/impl/ShopProductServiceImpl.java index c26840e2..b2826e3a 100644 --- a/src/main/java/com/peanut/modules/book/service/impl/ShopProductServiceImpl.java +++ b/src/main/java/com/peanut/modules/book/service/impl/ShopProductServiceImpl.java @@ -1,8 +1,11 @@ package com.peanut.modules.book.service.impl; import com.peanut.common.utils.ExcludeEmptyQueryWrapper; +import com.peanut.modules.common.service.UserVipService; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.math.BigDecimal; import java.util.List; import java.util.Map; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -18,6 +21,8 @@ import com.peanut.modules.book.service.ShopProductService; @Service("shopProductService") public class ShopProductServiceImpl extends ServiceImpl implements ShopProductService { + @Autowired + private UserVipService userVipService; @Override public PageUtils queryPage(Map params) { @@ -46,6 +51,44 @@ public class ShopProductServiceImpl extends ServiceImpl0 + &&p.compareTo(shopProduct.getActivityPrice())>0){ + p = new BigDecimal(0); + }else { + p = shopProduct.getPrice().subtract(p).setScale(2,BigDecimal.ROUND_HALF_UP); + } + } + return p; + } + + @Override + public BigDecimal getVipPrice(ShopProduct shopProduct) { + BigDecimal b = new BigDecimal(0); + if (userVipService.is456SVip()||userVipService.is78SVip()){ + b = shopProduct.getPrice().multiply(new BigDecimal(0.8)).setScale(2,BigDecimal.ROUND_HALF_UP); + }else if (!userVipService.noVip()){ + b = shopProduct.getPrice().multiply(new BigDecimal(0.9)).setScale(2,BigDecimal.ROUND_HALF_UP); + }else { + BigDecimal activityPrice = shopProduct.getActivityPrice(); + b = (activityPrice == null || activityPrice.equals(BigDecimal.ZERO)) ? shopProduct.getPrice() : activityPrice; + } + if (shopProduct.getActivityPrice().compareTo(new BigDecimal(0))>0 + &&b.compareTo(shopProduct.getActivityPrice())>0){ + b = shopProduct.getActivityPrice(); + } + return b; + } + @Override public PageUtils getNewBook(Map params) { IPage page = this.page( diff --git a/src/main/java/com/peanut/modules/book/vo/ShopCartVo.java b/src/main/java/com/peanut/modules/book/vo/ShopCartVo.java index 68de0154..bdbadfb4 100644 --- a/src/main/java/com/peanut/modules/book/vo/ShopCartVo.java +++ b/src/main/java/com/peanut/modules/book/vo/ShopCartVo.java @@ -30,6 +30,15 @@ public class ShopCartVo { * 商品活动单价 */ private BigDecimal activityPrice; + /** + * 是否有vip折扣 + */ + private Integer isVipPrice; + + /** + * 商品vip价格 + */ + private BigDecimal vipPrice; /** diff --git a/src/main/java/com/peanut/modules/book/vo/response/BuyOrderResponseVo.java b/src/main/java/com/peanut/modules/book/vo/response/BuyOrderResponseVo.java index 7756c03f..c0a815c4 100644 --- a/src/main/java/com/peanut/modules/book/vo/response/BuyOrderResponseVo.java +++ b/src/main/java/com/peanut/modules/book/vo/response/BuyOrderResponseVo.java @@ -55,6 +55,10 @@ public class BuyOrderResponseVo { * 扣减金额 */ private BigDecimal districtPrice; + /** + * vip优惠金额 + */ + private BigDecimal vipDiscountAmount; /** * 运费 */ diff --git a/src/main/java/com/peanut/modules/book/vo/response/GoodsResponseVo.java b/src/main/java/com/peanut/modules/book/vo/response/GoodsResponseVo.java index 7e75f8cb..657ae1fc 100644 --- a/src/main/java/com/peanut/modules/book/vo/response/GoodsResponseVo.java +++ b/src/main/java/com/peanut/modules/book/vo/response/GoodsResponseVo.java @@ -31,6 +31,10 @@ public class GoodsResponseVo { * 商品价格 */ private BigDecimal productPrice; + /** + * 商品vip价格 + */ + private BigDecimal vipPrice; /** * 商品数量 */ diff --git a/src/main/java/com/peanut/modules/common/controller/CourseRelearnController.java b/src/main/java/com/peanut/modules/common/controller/CourseRelearnController.java index 504a3ae8..d5568f32 100644 --- a/src/main/java/com/peanut/modules/common/controller/CourseRelearnController.java +++ b/src/main/java/com/peanut/modules/common/controller/CourseRelearnController.java @@ -172,6 +172,8 @@ public class CourseRelearnController { paymentInfo.setAppName("wumen"); } else if (buyOrder.getCome()==1) { paymentInfo.setAppName("zmzm"); + } else if (buyOrder.getCome()==3) { + paymentInfo.setAppName("xlkj"); }else { paymentInfo.setAppName(buyOrder.getAppName()); } diff --git a/src/main/java/com/peanut/modules/common/controller/OfflineActivityController.java b/src/main/java/com/peanut/modules/common/controller/OfflineActivityController.java index 512b9103..8899c588 100644 --- a/src/main/java/com/peanut/modules/common/controller/OfflineActivityController.java +++ b/src/main/java/com/peanut/modules/common/controller/OfflineActivityController.java @@ -76,6 +76,8 @@ public class OfflineActivityController { paymentInfo.setAppName("wumen"); } else if (buyOrder.getCome()==1) { paymentInfo.setAppName("zmzm"); + } else if (buyOrder.getCome()==3) { + paymentInfo.setAppName("xlkj"); }else { paymentInfo.setAppName(buyOrder.getAppName()); } diff --git a/src/main/java/com/peanut/modules/common/controller/UserVipController.java b/src/main/java/com/peanut/modules/common/controller/UserVipController.java index decd20ba..ae0bf7dc 100644 --- a/src/main/java/com/peanut/modules/common/controller/UserVipController.java +++ b/src/main/java/com/peanut/modules/common/controller/UserVipController.java @@ -300,6 +300,8 @@ public class UserVipController { paymentInfo.setAppName("wumen"); } else if (buyOrder.getCome()==1) { paymentInfo.setAppName("zmzm"); + } else if (buyOrder.getCome()==3) { + paymentInfo.setAppName("xlkj"); }else { paymentInfo.setAppName(buyOrder.getAppName()); } diff --git a/src/main/java/com/peanut/modules/common/entity/BuyOrder.java b/src/main/java/com/peanut/modules/common/entity/BuyOrder.java index 6e1bbe45..d5dc6e63 100644 --- a/src/main/java/com/peanut/modules/common/entity/BuyOrder.java +++ b/src/main/java/com/peanut/modules/common/entity/BuyOrder.java @@ -82,6 +82,10 @@ public class BuyOrder implements Serializable { * 优惠金额 */ private BigDecimal districtMoney; + /** + * VIP优惠金额 + */ + private BigDecimal vipDiscountAmount; /** * 实收金额 */ diff --git a/src/main/java/com/peanut/modules/common/entity/ShopProduct.java b/src/main/java/com/peanut/modules/common/entity/ShopProduct.java index a3a34ff9..a0ffe499 100644 --- a/src/main/java/com/peanut/modules/common/entity/ShopProduct.java +++ b/src/main/java/com/peanut/modules/common/entity/ShopProduct.java @@ -42,6 +42,10 @@ public class ShopProduct implements Serializable { * 商品活动价格 */ private BigDecimal activityPrice; + /** + * 是否有vip折扣 + */ + private Integer isVipPrice; /** * 商品重量 */ @@ -186,4 +190,8 @@ public class ShopProduct implements Serializable { //课程id @TableField(exist = false) private List courseIds; + + //vip价格 + @TableField(exist = false) + private BigDecimal vipPrice; } diff --git a/src/main/java/com/peanut/modules/common/service/UserVipService.java b/src/main/java/com/peanut/modules/common/service/UserVipService.java index 7701da2e..9069bf46 100644 --- a/src/main/java/com/peanut/modules/common/service/UserVipService.java +++ b/src/main/java/com/peanut/modules/common/service/UserVipService.java @@ -9,12 +9,15 @@ import java.util.Set; public interface UserVipService extends IService { + boolean noVip(); boolean noMedicalVip(); boolean isMedicalVip(); boolean isAcupunctureVip(); boolean istumorVip(); boolean isSociologyVip(); boolean isPsycheVip(); + boolean is456SVip(); + boolean is78SVip(); //是否是这门课的vip UserVip ownCourseCatalogueByVip(int courseId); diff --git a/src/main/java/com/peanut/modules/common/service/impl/UserVipServiceImpl.java b/src/main/java/com/peanut/modules/common/service/impl/UserVipServiceImpl.java index 504270f8..fe6e208a 100644 --- a/src/main/java/com/peanut/modules/common/service/impl/UserVipServiceImpl.java +++ b/src/main/java/com/peanut/modules/common/service/impl/UserVipServiceImpl.java @@ -30,6 +30,18 @@ public class UserVipServiceImpl extends ServiceImpl impleme @Autowired private VipBuyConfigDao vipBuyConfigDao; + @Override + public boolean noVip() { + List userVipList = userVipDao.selectList(new LambdaQueryWrapper() + .eq(UserVip::getUserId, ShiroUtils.getUId()) + .eq(UserVip::getState,0)); + if (userVipList.size() > 0) { + return false; + }else { + return true; + } + } + @Override public boolean noMedicalVip() { List userVipList = userVipDao.selectList(new LambdaQueryWrapper() @@ -67,6 +79,23 @@ public class UserVipServiceImpl extends ServiceImpl impleme public boolean isPsycheVip() { return isVip(8); } + + @Override + public boolean is456SVip() { + if (isVip(4)&&isVip(5)&&isVip(6)){ + return true; + } + return false; + } + + @Override + public boolean is78SVip() { + if (isVip(7)&&isVip(8)){ + return true; + } + return false; + } + public boolean isVip(int type) { List userVipList = userVipDao.selectList(new LambdaQueryWrapper() .eq(UserVip::getUserId, ShiroUtils.getUId()) diff --git a/src/main/java/com/peanut/modules/pay/weChatPay/config/WechatPayConfig.java b/src/main/java/com/peanut/modules/pay/weChatPay/config/WechatPayConfig.java index dccde641..cc16cfb1 100644 --- a/src/main/java/com/peanut/modules/pay/weChatPay/config/WechatPayConfig.java +++ b/src/main/java/com/peanut/modules/pay/weChatPay/config/WechatPayConfig.java @@ -47,6 +47,8 @@ public class WechatPayConfig implements Serializable { private String zmzmappId; @Value("${wxpay.wumenappId}") private String wumenappId; + @Value("${wxpay.xlkjappId}") + private String xlkjappId; /** * 商户号 */ 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 d802dae5..2cf91d14 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 @@ -70,6 +70,8 @@ public class WeChatPayController { appid = wechatPayConfig.getZmzmappId(); } else if ("wumen".equals(paymentInfo.getAppName())) { appid = wechatPayConfig.getWumenappId(); + } else if ("xlkj".equals(paymentInfo.getAppName())) { + appid = wechatPayConfig.getXlkjappId(); } Map map = new HashMap<>(); paramMap.put("appid", appid); diff --git a/src/main/java/com/peanut/modules/pay/weChatPay/service/impl/WxpayServiceImpl.java b/src/main/java/com/peanut/modules/pay/weChatPay/service/impl/WxpayServiceImpl.java index a1ec5e73..4e95e3a4 100644 --- a/src/main/java/com/peanut/modules/pay/weChatPay/service/impl/WxpayServiceImpl.java +++ b/src/main/java/com/peanut/modules/pay/weChatPay/service/impl/WxpayServiceImpl.java @@ -95,6 +95,8 @@ public class WxpayServiceImpl extends ServiceImpl wrapper = new MPJLambdaWrapper<>(); + wrapper.distinct(); + wrapper.rightJoin(CourseToPsyche.class,CourseToPsyche::getCourseId,CourseEntity::getId); + wrapper.leftJoin(CourseCatalogueEntity.class,CourseCatalogueEntity::getCourseId,CourseEntity::getId); + wrapper.eq(CourseCatalogueEntity::getType,0); + wrapper.selectAll(CourseEntity.class); + wrapper.orderByAsc(CourseEntity::getSort); + List courseList = courseService.list(wrapper); + return R.ok().put("courseList",courseList); + } + //我的课程-过期课程 @RequestMapping("/getCourseExpire") public R getCourseExpire(){