vip优惠商品添加用户是否vip判断
This commit is contained in:
@@ -388,7 +388,7 @@ public class BookLabelAndMarketController {
|
||||
List<Map<String,Object>> list = toLabelService.listMaps(wrapper);
|
||||
for (Map<String,Object> 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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<BuyOrderProduct> buyOrderProductList = buyOrder.getProductList();
|
||||
for (BuyOrderProduct buyOrderProduct : buyOrderProductList) {
|
||||
BigDecimal pvda = shopProductService.getVipDiscountAmount(shopProductService.getById(buyOrderProduct.getProductId()));
|
||||
@@ -172,7 +172,7 @@ public class BuyOrderController {
|
||||
List<BuyOrderProduct> 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<ShopProduct> 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)) {
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
//添加获取标签逻辑
|
||||
|
||||
@@ -765,7 +765,7 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> 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);
|
||||
|
||||
@@ -82,7 +82,7 @@ public class OrderCartServiceImpl extends ServiceImpl<OrderCartDao, OrderCartEnt
|
||||
}
|
||||
shopCartVo.setActivityPrice(price);
|
||||
shopCartVo.setIsVipPrice(productEntity.getIsVipPrice());
|
||||
if (productEntity.getIsVipPrice()==1){
|
||||
if (userVipService.isVip()&&productEntity.getIsVipPrice()==1){
|
||||
shopCartVo.setVipPrice(shopProductService.getVipPrice(productEntity));
|
||||
}
|
||||
cartList.add(shopCartVo);
|
||||
|
||||
@@ -54,10 +54,10 @@ public class ShopProductServiceImpl extends ServiceImpl<ShopProductDao, ShopProd
|
||||
@Override
|
||||
public BigDecimal getVipDiscountAmount(ShopProduct shopProduct) {
|
||||
BigDecimal p = new BigDecimal(0);
|
||||
if (shopProduct.getIsVipPrice()==1){
|
||||
if (userVipService.isVip()&&shopProduct.getIsVipPrice()==1){
|
||||
if (userVipService.is4569SVip()||userVipService.is78SVip()){
|
||||
p = shopProduct.getPrice().multiply(new BigDecimal(0.8));
|
||||
}else if (!userVipService.noVip()){
|
||||
}else if (userVipService.isVip()){
|
||||
p = shopProduct.getPrice().multiply(new BigDecimal(0.9));
|
||||
}
|
||||
//如果有折扣价,比折扣价低就返回vip折扣金额
|
||||
@@ -76,7 +76,7 @@ public class ShopProductServiceImpl extends ServiceImpl<ShopProductDao, ShopProd
|
||||
BigDecimal b = new BigDecimal(0);
|
||||
if (userVipService.is4569SVip()||userVipService.is78SVip()){
|
||||
b = shopProduct.getPrice().multiply(new BigDecimal(0.8)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||
}else if (!userVipService.noVip()){
|
||||
}else if (userVipService.isVip()){
|
||||
b = shopProduct.getPrice().multiply(new BigDecimal(0.9)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||
}else {
|
||||
BigDecimal activityPrice = shopProduct.getActivityPrice();
|
||||
|
||||
@@ -9,7 +9,7 @@ import java.util.Set;
|
||||
|
||||
public interface UserVipService extends IService<UserVip> {
|
||||
|
||||
boolean noVip();
|
||||
boolean isVip();
|
||||
boolean noMedicalVip();
|
||||
boolean isMedicalVip();
|
||||
boolean isChineseWesternVip();
|
||||
|
||||
@@ -31,14 +31,14 @@ public class UserVipServiceImpl extends ServiceImpl<UserVipDao, UserVip> impleme
|
||||
private VipBuyConfigDao vipBuyConfigDao;
|
||||
|
||||
@Override
|
||||
public boolean noVip() {
|
||||
public boolean isVip() {
|
||||
List<UserVip> userVipList = userVipDao.selectList(new LambdaQueryWrapper<UserVip>()
|
||||
.eq(UserVip::getUserId, ShiroUtils.getUId())
|
||||
.eq(UserVip::getState,0));
|
||||
if (userVipList.size() > 0) {
|
||||
return false;
|
||||
}else {
|
||||
return true;
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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<ShopProduct> 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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<ShopProduct> 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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> 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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class ShopProductServiceImpl extends ServiceImpl<ShopProductDao, ShopProd
|
||||
wrapper.orderByAsc(ShopProductToSociologyMarket::getSort);
|
||||
Page<ShopProduct> 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<ShopProductDao, ShopProd
|
||||
public Map<String, Object> getProductDetail(Integer productId) {
|
||||
ShopProduct product = this.getById(productId);
|
||||
HashMap<String, Object> 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<ShopProductDao, ShopProd
|
||||
List<ShopProduct> 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));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user