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 68da670d..308e5aaf 100644 --- a/src/main/java/com/peanut/modules/book/controller/BookLabelAndMarketController.java +++ b/src/main/java/com/peanut/modules/book/controller/BookLabelAndMarketController.java @@ -388,7 +388,7 @@ public class BookLabelAndMarketController { List> list = toLabelService.listMaps(wrapper); for (Map map:list){ ShopProduct shopProduct = shopProductService.getById(map.get("product_id").toString()); - if (shopProduct.getIsVipPrice()==1){ + if (userVipService.isVip()&&shopProduct.getIsVipPrice()==1){ map.put("vip_price",shopProductService.getVipPrice(shopProduct)); } } 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 cc2f3250..fb4df327 100644 --- a/src/main/java/com/peanut/modules/book/controller/BuyOrderController.java +++ b/src/main/java/com/peanut/modules/book/controller/BuyOrderController.java @@ -155,7 +155,7 @@ public class BuyOrderController { @RequestMapping("/getVipDiscountAmount") public R getVipDiscountAmount(@RequestBody BuyOrder buyOrder){ BigDecimal b = new BigDecimal(0); - if (!userVipService.noVip()){ + if (userVipService.isVip()){ List buyOrderProductList = buyOrder.getProductList(); for (BuyOrderProduct buyOrderProduct : buyOrderProductList) { BigDecimal pvda = shopProductService.getVipDiscountAmount(shopProductService.getById(buyOrderProduct.getProductId())); @@ -172,7 +172,7 @@ public class BuyOrderController { List buyOrderProductList = buyOrder.getProductList(); for (BuyOrderProduct buyOrderProduct : buyOrderProductList) { ShopProduct shopProduct = shopProductService.getById(buyOrderProduct.getProductId()); - if (!userVipService.noVip()){ + if (userVipService.isVip()){ BigDecimal pvda = shopProductService.getVipDiscountAmount(shopProductService.getById(buyOrderProduct.getProductId())); if (pvda.compareTo(BigDecimal.ZERO)>0){ continue; @@ -194,7 +194,7 @@ public class BuyOrderController { wrapper.in(ShopProduct::getProductId,Arrays.asList(productIds)); List shopProductList = shopProductService.list(wrapper); for (ShopProduct shopProduct:shopProductList){ - if (shopProduct.getIsVipPrice()==1){ + if (userVipService.isVip()&&shopProduct.getIsVipPrice()==1){ shopProduct.setVipPrice(shopProductService.getVipPrice(shopProduct)); } } @@ -294,7 +294,7 @@ public class BuyOrderController { ShopProduct product = shopProductService.getById(productId); BigDecimal price = getRealPrice(product); if (buyOrder.getVipDiscountAmount()!=null&&buyOrder.getVipDiscountAmount().compareTo(new BigDecimal(0))>0 - &&product.getIsVipPrice()==1){ + &&userVipService.isVip()&&product.getIsVipPrice()==1){ price = shopProductService.getVipPrice(product); } if (!handleStock(buyOrderProduct, product)) { 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 fa9ec9e1..0be8ce97 100644 --- a/src/main/java/com/peanut/modules/book/controller/ShopProductController.java +++ b/src/main/java/com/peanut/modules/book/controller/ShopProductController.java @@ -280,7 +280,7 @@ public class ShopProductController { } for (ShopProductBookEntity spbe : ss) { ShopProduct ca_sp = shopProductService.getById(spbe.getProductId()); - if (!userVipService.noVip()&&ca_sp.getIsVipPrice()==1){ + if (userVipService.isVip()&&ca_sp.getIsVipPrice()==1){ ca_sp.setVipPrice(shopProductService.getVipPrice(ca_sp)); } frag.add(ca_sp); @@ -322,7 +322,7 @@ public class ShopProductController { booklist.add(String.valueOf(bookId)); list.add(byId); } - if (shopProduct.getIsVipPrice()==1){ + if (userVipService.isVip()&&shopProduct.getIsVipPrice()==1){ shopProduct.setVipPrice(shopProductService.getVipPrice(shopProduct)); } //添加获取标签逻辑 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 1e8f954b..069f1236 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 @@ -765,7 +765,7 @@ public class BuyOrderServiceImpl extends ServiceImpl impl goodsResponseVo.setProductName(shopProduct.getProductName()); goodsResponseVo.setProductImage(shopProduct.getProductImages()); goodsResponseVo.setProductPrice(shopProduct.getPrice()); - if (shopProduct.getIsVipPrice()==1){ + if (userVipService.isVip()&&shopProduct.getIsVipPrice()==1){ goodsResponseVo.setVipPrice(shopProductService.getVipPrice(shopProduct)); }else { goodsResponseVo.setVipPrice(BigDecimal.ZERO); 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 c28c62b8..e081e3f3 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 @@ -82,7 +82,7 @@ public class OrderCartServiceImpl extends ServiceImpl { - boolean noVip(); + boolean isVip(); boolean noMedicalVip(); boolean isMedicalVip(); boolean isChineseWesternVip(); 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 ca53bbaf..c5684b78 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 @@ -31,14 +31,14 @@ public class UserVipServiceImpl extends ServiceImpl impleme private VipBuyConfigDao vipBuyConfigDao; @Override - public boolean noVip() { + public boolean isVip() { List userVipList = userVipDao.selectList(new LambdaQueryWrapper() .eq(UserVip::getUserId, ShiroUtils.getUId()) .eq(UserVip::getState,0)); if (userVipList.size() > 0) { - return false; - }else { return true; + }else { + return false; } } diff --git a/src/main/java/com/peanut/modules/medical/controller/MedicalLabelAndMarketController.java b/src/main/java/com/peanut/modules/medical/controller/MedicalLabelAndMarketController.java index 089f18d0..14c49f4a 100644 --- a/src/main/java/com/peanut/modules/medical/controller/MedicalLabelAndMarketController.java +++ b/src/main/java/com/peanut/modules/medical/controller/MedicalLabelAndMarketController.java @@ -34,6 +34,8 @@ public class MedicalLabelAndMarketController { private ShopProductService productService; @Autowired private com.peanut.modules.book.service.ShopProductService shopProductService; + @Autowired + private UserVipService userVipService; /** * 分类标签树 @@ -68,7 +70,7 @@ public class MedicalLabelAndMarketController { Page page = productService.page(new Page<>( Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())),wrapper); for (ShopProduct shopProduct:page.getRecords()){ - if (shopProduct.getIsVipPrice()==1){ + if (userVipService.isVip()&&shopProduct.getIsVipPrice()==1){ shopProduct.setVipPrice(shopProductService.getVipPrice(shopProduct)); } } diff --git a/src/main/java/com/peanut/modules/psyche/controller/PsycheHomeController.java b/src/main/java/com/peanut/modules/psyche/controller/PsycheHomeController.java index 7340fef4..363c8c30 100644 --- a/src/main/java/com/peanut/modules/psyche/controller/PsycheHomeController.java +++ b/src/main/java/com/peanut/modules/psyche/controller/PsycheHomeController.java @@ -37,6 +37,8 @@ public class PsycheHomeController { private ShopProductService shopProductService; @Autowired private com.peanut.modules.book.service.ShopProductService spService; + @Autowired + private UserVipService userVipService; //获取标签列表 @RequestMapping("/getPsycheLabels") @@ -83,7 +85,7 @@ public class PsycheHomeController { Page shopProductPage = shopProductService.page(new Page<>( Long.parseLong(params.get("page").toString()), Long.parseLong(params.get("limit").toString())),wrapper); for (ShopProduct shopProduct:shopProductPage.getRecords()){ - if (shopProduct.getIsVipPrice()==1){ + if (userVipService.isVip()&&shopProduct.getIsVipPrice()==1){ shopProduct.setVipPrice(spService.getVipPrice(shopProduct)); } } diff --git a/src/main/java/com/peanut/modules/sociology/service/impl/CourseServiceImpl.java b/src/main/java/com/peanut/modules/sociology/service/impl/CourseServiceImpl.java index b22813ed..7076d150 100644 --- a/src/main/java/com/peanut/modules/sociology/service/impl/CourseServiceImpl.java +++ b/src/main/java/com/peanut/modules/sociology/service/impl/CourseServiceImpl.java @@ -129,7 +129,7 @@ public class CourseServiceImpl extends ServiceImpl impl .in(ShopProduct::getProductId, ids) .orderByAsc(ShopProduct::getSort)); for (ShopProduct shopProduct : shopProductList) { - if (!userVipService.noVip()&&shopProduct.getIsVipPrice()==1){ + if (userVipService.isVip()&&shopProduct.getIsVipPrice()==1){ shopProduct.setVipPrice(shopProductService.getVipPrice(shopProduct)); } } diff --git a/src/main/java/com/peanut/modules/sociology/service/impl/ShopProductServiceImpl.java b/src/main/java/com/peanut/modules/sociology/service/impl/ShopProductServiceImpl.java index e3d58423..16af177e 100644 --- a/src/main/java/com/peanut/modules/sociology/service/impl/ShopProductServiceImpl.java +++ b/src/main/java/com/peanut/modules/sociology/service/impl/ShopProductServiceImpl.java @@ -44,7 +44,7 @@ public class ShopProductServiceImpl extends ServiceImpl shopProductPage = this.getBaseMapper().selectJoinPage(new Page<>(param.getPage(), param.getLimit()), ShopProduct.class, wrapper); for (ShopProduct shopProduct:shopProductPage.getRecords()){ - if (shopProduct.getIsVipPrice()==1){ + if (userVipService.isVip()&&shopProduct.getIsVipPrice()==1){ shopProduct.setVipPrice(shopProductService.getVipPrice(shopProduct)); } } @@ -66,7 +66,7 @@ public class ShopProductServiceImpl extends ServiceImpl getProductDetail(Integer productId) { ShopProduct product = this.getById(productId); HashMap flag = new HashMap<>(); - if (product.getIsVipPrice()==1){ + if (userVipService.isVip()&&product.getIsVipPrice()==1){ product.setVipPrice(shopProductService.getVipPrice(product)); } flag.put("detail",product);//基础信息 @@ -123,7 +123,7 @@ public class ShopProductServiceImpl extends ServiceImpl shopProducts = (List)flag.get("GLProducts"); if (shopProducts.size()>0){ for (ShopProduct shopProduct : shopProducts) { - if (!userVipService.noVip()&&shopProduct.getIsVipPrice()==1){ + if (userVipService.isVip()&&shopProduct.getIsVipPrice()==1){ shopProduct.setVipPrice(shopProductService.getVipPrice(shopProduct)); } }