修改VIP商品优惠
This commit is contained in:
@@ -765,11 +765,11 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
|
|||||||
goodsResponseVo.setProductName(shopProduct.getProductName());
|
goodsResponseVo.setProductName(shopProduct.getProductName());
|
||||||
goodsResponseVo.setProductImage(shopProduct.getProductImages());
|
goodsResponseVo.setProductImage(shopProduct.getProductImages());
|
||||||
goodsResponseVo.setProductPrice(shopProduct.getPrice());
|
goodsResponseVo.setProductPrice(shopProduct.getPrice());
|
||||||
// if (userVipService.isVip()&&shopProduct.getIsVipPrice()==1){
|
if (userVipService.isVip(userId)&&shopProduct.getIsVipPrice()==1){
|
||||||
// goodsResponseVo.setVipPrice(shopProductService.getVipPrice(shopProduct));
|
goodsResponseVo.setVipPrice(shopProductService.getVipPrice(shopProduct));
|
||||||
// }else {
|
}else {
|
||||||
goodsResponseVo.setVipPrice(BigDecimal.ZERO);
|
goodsResponseVo.setVipPrice(BigDecimal.ZERO);
|
||||||
// }
|
}
|
||||||
goodsResponseVo.setQuantity(buyOrderProduct.getQuantity());
|
goodsResponseVo.setQuantity(buyOrderProduct.getQuantity());
|
||||||
goodsResponseVo.setProductId(shopProduct.getProductId());
|
goodsResponseVo.setProductId(shopProduct.getProductId());
|
||||||
QueryWrapper<ExpressOrder> expressOrderQueryWrapper = new QueryWrapper<>();
|
QueryWrapper<ExpressOrder> expressOrderQueryWrapper = new QueryWrapper<>();
|
||||||
|
|||||||
@@ -78,13 +78,14 @@ public class ShopProductServiceImpl extends ServiceImpl<ShopProductDao, ShopProd
|
|||||||
b = shopProduct.getPrice().multiply(new BigDecimal(0.8)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
b = shopProduct.getPrice().multiply(new BigDecimal(0.8)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
||||||
}else if (userVipService.isVip()){
|
}else if (userVipService.isVip()){
|
||||||
b = shopProduct.getPrice().multiply(new BigDecimal(0.9)).setScale(2,BigDecimal.ROUND_HALF_UP);
|
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;
|
|
||||||
}
|
}
|
||||||
|
// else {
|
||||||
|
// BigDecimal activityPrice = shopProduct.getActivityPrice();
|
||||||
|
// b = (activityPrice == null || activityPrice.equals(BigDecimal.ZERO)) ? shopProduct.getPrice() : activityPrice;
|
||||||
|
// }
|
||||||
if (shopProduct.getActivityPrice().compareTo(new BigDecimal(0))>0
|
if (shopProduct.getActivityPrice().compareTo(new BigDecimal(0))>0
|
||||||
&&b.compareTo(shopProduct.getActivityPrice())>0){
|
&&b.compareTo(shopProduct.getActivityPrice())>0){
|
||||||
b = shopProduct.getActivityPrice();
|
b = new BigDecimal(0);
|
||||||
}
|
}
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import java.util.Set;
|
|||||||
public interface UserVipService extends IService<UserVip> {
|
public interface UserVipService extends IService<UserVip> {
|
||||||
|
|
||||||
boolean isVip();
|
boolean isVip();
|
||||||
|
boolean isVip(int uid);
|
||||||
boolean noMedicalVip();
|
boolean noMedicalVip();
|
||||||
boolean isMedicalVip();
|
boolean isMedicalVip();
|
||||||
boolean isChineseWesternVip();
|
boolean isChineseWesternVip();
|
||||||
|
|||||||
@@ -42,6 +42,19 @@ public class UserVipServiceImpl extends ServiceImpl<UserVipDao, UserVip> impleme
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isVip(int uid) {
|
||||||
|
if (uid >= 10000){
|
||||||
|
List<UserVip> userVipList = userVipDao.selectList(new LambdaQueryWrapper<UserVip>()
|
||||||
|
.eq(UserVip::getUserId, uid)
|
||||||
|
.eq(UserVip::getState,0));
|
||||||
|
if (userVipList.size() > 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean noMedicalVip() {
|
public boolean noMedicalVip() {
|
||||||
List<UserVip> userVipList = userVipDao.selectList(new LambdaQueryWrapper<UserVip>()
|
List<UserVip> userVipList = userVipDao.selectList(new LambdaQueryWrapper<UserVip>()
|
||||||
@@ -57,37 +70,37 @@ public class UserVipServiceImpl extends ServiceImpl<UserVipDao, UserVip> impleme
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isMedicalVip() {
|
public boolean isMedicalVip() {
|
||||||
return isVip(4);
|
return isVipByType(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isChineseWesternVip() {
|
public boolean isChineseWesternVip() {
|
||||||
return isVip(9);
|
return isVipByType(9);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAcupunctureVip() {
|
public boolean isAcupunctureVip() {
|
||||||
return isVip(5);
|
return isVipByType(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean istumorVip() {
|
public boolean istumorVip() {
|
||||||
return isVip(6);
|
return isVipByType(6);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSociologyVip() {
|
public boolean isSociologyVip() {
|
||||||
return isVip(7);
|
return isVipByType(7);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isPsycheVip() {
|
public boolean isPsycheVip() {
|
||||||
return isVip(8);
|
return isVipByType(8);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean is4569SVip() {
|
public boolean is4569SVip() {
|
||||||
if (isVip(4)&&isVip(9)&&isVip(5)&&isVip(6)){
|
if (isVipByType(4)&&isVipByType(9)&&isVipByType(5)&&isVipByType(6)){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -95,22 +108,24 @@ public class UserVipServiceImpl extends ServiceImpl<UserVipDao, UserVip> impleme
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean is78SVip() {
|
public boolean is78SVip() {
|
||||||
if (isVip(7)&&isVip(8)){
|
if (isVipByType(7)&&isVipByType(8)){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isVip(int type) {
|
public boolean isVipByType(int type) {
|
||||||
List<UserVip> userVipList = userVipDao.selectList(new LambdaQueryWrapper<UserVip>()
|
int uid = ShiroUtils.getUId();
|
||||||
.eq(UserVip::getUserId, ShiroUtils.getUId())
|
if (uid >= 10000) {
|
||||||
.eq(UserVip::getState,0)
|
List<UserVip> userVipList = userVipDao.selectList(new LambdaQueryWrapper<UserVip>()
|
||||||
.eq(UserVip::getType,type));
|
.eq(UserVip::getUserId, uid)
|
||||||
if (userVipList.size() > 0) {
|
.eq(UserVip::getState,0)
|
||||||
return true;
|
.eq(UserVip::getType,type));
|
||||||
}else {
|
if (userVipList.size() > 0) {
|
||||||
return false;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserVip ownCourseCatalogueByVip(MyUserEntity u,int courseId) {
|
public UserVip ownCourseCatalogueByVip(MyUserEntity u,int courseId) {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
|
import com.peanut.common.utils.ShiroUtils;
|
||||||
import com.peanut.modules.common.dao.BookDao;
|
import com.peanut.modules.common.dao.BookDao;
|
||||||
import com.peanut.modules.common.dao.ShopProductBookDao;
|
import com.peanut.modules.common.dao.ShopProductBookDao;
|
||||||
import com.peanut.modules.common.dao.ShopProductCourseDao;
|
import com.peanut.modules.common.dao.ShopProductCourseDao;
|
||||||
@@ -67,10 +68,11 @@ public class ShopProductServiceImpl extends ServiceImpl<ShopProductDao, ShopProd
|
|||||||
public Map<String, Object> getProductDetail(Integer productId) {
|
public Map<String, Object> getProductDetail(Integer productId) {
|
||||||
ShopProduct product = this.getById(productId);
|
ShopProduct product = this.getById(productId);
|
||||||
HashMap<String, Object> flag = new HashMap<>();
|
HashMap<String, Object> flag = new HashMap<>();
|
||||||
// if (userVipService.isVip()&&product.getIsVipPrice()==1){
|
if (userVipService.isVip(ShiroUtils.getUId())&&product.getIsVipPrice()==1){
|
||||||
// product.setVipPrice(shopProductService.getVipPrice(product));
|
product.setVipPrice(shopProductService.getVipPrice(product));
|
||||||
// }
|
}else {
|
||||||
product.setVipPrice(BigDecimal.ZERO);
|
product.setVipPrice(BigDecimal.ZERO);
|
||||||
|
}
|
||||||
flag.put("detail",product);//基础信息
|
flag.put("detail",product);//基础信息
|
||||||
//查询包含的书
|
//查询包含的书
|
||||||
MPJLambdaWrapper<ShopProductBookEntity> shopProductBookEntityMPJLambdaWrapper = new MPJLambdaWrapper<>();
|
MPJLambdaWrapper<ShopProductBookEntity> shopProductBookEntityMPJLambdaWrapper = new MPJLambdaWrapper<>();
|
||||||
@@ -126,9 +128,9 @@ public class ShopProductServiceImpl extends ServiceImpl<ShopProductDao, ShopProd
|
|||||||
if (shopProducts.size()>0){
|
if (shopProducts.size()>0){
|
||||||
for (ShopProduct shopProduct : shopProducts) {
|
for (ShopProduct shopProduct : shopProducts) {
|
||||||
shopProduct.setVipPrice(BigDecimal.ZERO);
|
shopProduct.setVipPrice(BigDecimal.ZERO);
|
||||||
// if (userVipService.isVip()&&shopProduct.getIsVipPrice()==1){
|
if (userVipService.isVip(ShiroUtils.getUId())&&shopProduct.getIsVipPrice()==1){
|
||||||
// shopProduct.setVipPrice(shopProductService.getVipPrice(shopProduct));
|
shopProduct.setVipPrice(shopProductService.getVipPrice(shopProduct));
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user