修改vipprice,用户会员类型修改
This commit is contained in:
@@ -38,6 +38,8 @@ public class BookLabelAndMarketController {
|
||||
private ShopProductService productService;
|
||||
@Autowired
|
||||
private UserVipService userVipService;
|
||||
@Autowired
|
||||
private ShopProductService shopProductService;
|
||||
|
||||
/**
|
||||
* 图书标签树
|
||||
@@ -385,19 +387,9 @@ public class BookLabelAndMarketController {
|
||||
wrapper.orderByDesc(ShopProduct::getSumSales);
|
||||
List<Map<String,Object>> list = toLabelService.listMaps(wrapper);
|
||||
for (Map<String,Object> 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);
|
||||
ShopProduct shopProduct = shopProductService.getById(map.get("id").toString());
|
||||
if (shopProduct.getIsVipPrice()==1){
|
||||
map.put("vip_price",shopProductService.getVipPrice(shopProduct));
|
||||
}
|
||||
}
|
||||
return R.ok().put("result", list);
|
||||
|
||||
@@ -190,23 +190,12 @@ public class BuyOrderController {
|
||||
public R getShopProductListByIds(@RequestBody Map<String,Object> params){
|
||||
String[] productIds = params.get("productIds").toString().split(",");
|
||||
LambdaQueryWrapper<ShopProduct> wrapper = new LambdaQueryWrapper();
|
||||
wrapper.select(ShopProduct::getProductId,ShopProduct::getProductName,ShopProduct::getProductImages,ShopProduct::getPrice,ShopProduct::getActivityPrice,ShopProduct::getIsVipPrice);
|
||||
wrapper.select(ShopProduct::getProductId,ShopProduct::getProductName,ShopProduct::getProductImages,ShopProduct::getPrice,ShopProduct::getActivityPrice,ShopProduct::getIsVipPrice,ShopProduct::getGoodsType);
|
||||
wrapper.in(ShopProduct::getProductId,Arrays.asList(productIds));
|
||||
List<ShopProduct> 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);
|
||||
shopProduct.setVipPrice(shopProductService.getVipPrice(shopProduct));
|
||||
}
|
||||
}
|
||||
return R.ok().put("shopProductList",shopProductList);
|
||||
|
||||
@@ -322,19 +322,8 @@ 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);
|
||||
shopProduct.setVipPrice(shopProductService.getVipPrice(shopProduct));
|
||||
}
|
||||
//添加获取标签逻辑
|
||||
List<ShopProductToLabelEntity> shopProductToLabelEntities = shopProductToLabelService.getBaseMapper().selectList(new QueryWrapper<ShopProductToLabelEntity>()
|
||||
|
||||
@@ -464,7 +464,7 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
|
||||
List<BuyOrderProduct> buyOrderProducts = buyOrderProductService.getBaseMapper().selectList(new LambdaQueryWrapper<BuyOrderProduct>()
|
||||
.eq(BuyOrderProduct::getOrderId, b.getOrderId()));
|
||||
for (BuyOrderProduct bb : buyOrderProducts){
|
||||
bb.setProduct(shopProductService.getOne(new LambdaQueryWrapper<ShopProduct>().select(ShopProduct::getProductId,ShopProduct::getProductName,ShopProduct::getProductImages,ShopProduct::getPrice,ShopProduct::getActivityPrice,ShopProduct::getIsVipPrice)
|
||||
bb.setProduct(shopProductService.getOne(new LambdaQueryWrapper<ShopProduct>().select(ShopProduct::getProductId,ShopProduct::getProductName,ShopProduct::getProductImages,ShopProduct::getPrice,ShopProduct::getActivityPrice,ShopProduct::getIsVipPrice,ShopProduct::getGoodsType)
|
||||
.eq(ShopProduct::getProductId,bb.getProductId())));
|
||||
UserRecord userRecord = userRecordDao.selectOne(new QueryWrapper<UserRecord>()
|
||||
.eq("userid", ShiroUtils.getUId())
|
||||
|
||||
@@ -82,19 +82,8 @@ public class OrderCartServiceImpl extends ServiceImpl<OrderCartDao, OrderCartEnt
|
||||
}
|
||||
shopCartVo.setActivityPrice(price);
|
||||
shopCartVo.setIsVipPrice(productEntity.getIsVipPrice());
|
||||
//vip价格,不是vip或者活动价更低,返回0
|
||||
if (productEntity.getIsVipPrice()==1){
|
||||
BigDecimal b = new BigDecimal(0);
|
||||
if (userVipService.is456SVip()||userVipService.is78SVip()){
|
||||
b = productEntity.getPrice().multiply(new BigDecimal(0.8)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||
}else if (!userVipService.noVip()){
|
||||
b = productEntity.getPrice().multiply(new BigDecimal(0.9)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||
}
|
||||
if (productEntity.getActivityPrice().compareTo(new BigDecimal(0))>0
|
||||
&&b.compareTo(productEntity.getActivityPrice())>0){
|
||||
b = new BigDecimal(0);
|
||||
}
|
||||
shopCartVo.setVipPrice(b);
|
||||
shopCartVo.setVipPrice(shopProductService.getVipPrice(productEntity));
|
||||
}
|
||||
cartList.add(shopCartVo);
|
||||
}
|
||||
|
||||
@@ -93,6 +93,7 @@ public class ShopProductServiceImpl extends ServiceImpl<ShopProductDao, ShopProd
|
||||
public PageUtils getNewBook(Map<String, Object> params) {
|
||||
IPage<ShopProduct> page = this.page(
|
||||
new Query<ShopProduct>().getPage(params),
|
||||
|
||||
new QueryWrapper<ShopProduct>().eq("is_new",1).orderByDesc("create_time")
|
||||
);
|
||||
return new PageUtils(page);
|
||||
|
||||
Reference in New Issue
Block a user