折扣
This commit is contained in:
@@ -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<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);
|
||||
}
|
||||
}
|
||||
return R.ok().put("result", list);
|
||||
}
|
||||
|
||||
|
||||
@@ -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<BuyOrderProduct> 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<BuyOrderProduct> 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<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.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);
|
||||
}
|
||||
}
|
||||
return R.ok().put("shopProductList",shopProductList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单详情
|
||||
*
|
||||
@@ -216,6 +280,10 @@ public class BuyOrderController {
|
||||
List<Integer> 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());
|
||||
}
|
||||
|
||||
@@ -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<ShopProductToLabelEntity> shopProductToLabelEntities = shopProductToLabelService.getBaseMapper().selectList(new QueryWrapper<ShopProductToLabelEntity>()
|
||||
.eq("product_id", productId).eq("del_flag", 0));
|
||||
|
||||
@@ -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<ShopProduct> {
|
||||
|
||||
List<ShopProduct> appGetCategoryList(Integer catId);
|
||||
|
||||
BigDecimal getVipDiscountAmount(ShopProduct shopProduct);
|
||||
|
||||
BigDecimal getVipPrice(ShopProduct shopProduct);
|
||||
|
||||
PageUtils getNewBook(Map<String, Object> params);
|
||||
|
||||
|
||||
@@ -464,7 +464,8 @@ 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.getById(bb.getProductId()));
|
||||
bb.setProduct(shopProductService.getOne(new LambdaQueryWrapper<ShopProduct>().select(ShopProduct::getProductId,ShopProduct::getProductName,ShopProduct::getProductImages,ShopProduct::getPrice,ShopProduct::getActivityPrice,ShopProduct::getIsVipPrice)
|
||||
.eq(ShopProduct::getProductId,bb.getProductId())));
|
||||
UserRecord userRecord = userRecordDao.selectOne(new QueryWrapper<UserRecord>()
|
||||
.eq("userid", ShiroUtils.getUId())
|
||||
.eq("orderdid", b.getOrderId())
|
||||
@@ -710,6 +711,7 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> 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<BuyOrderDao, BuyOrder> 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<ExpressOrder> expressOrderQueryWrapper = new QueryWrapper<>();
|
||||
|
||||
@@ -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 ServiceImpl<OrderCartDao, OrderCartEnt
|
||||
|
||||
@Autowired
|
||||
private ShopProductService shopProductService;
|
||||
@Autowired
|
||||
private UserVipService userVipService;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -78,6 +81,21 @@ public class OrderCartServiceImpl extends ServiceImpl<OrderCartDao, OrderCartEnt
|
||||
price = productEntity.getActivityPrice();
|
||||
}
|
||||
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);
|
||||
}
|
||||
cartList.add(shopCartVo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<ShopProductDao, ShopProduct> implements ShopProductService {
|
||||
|
||||
@Autowired
|
||||
private UserVipService userVipService;
|
||||
|
||||
@Override
|
||||
public PageUtils queryPage(Map<String, Object> params) {
|
||||
@@ -46,6 +51,44 @@ public class ShopProductServiceImpl extends ServiceImpl<ShopProductDao, ShopProd
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal getVipDiscountAmount(ShopProduct shopProduct) {
|
||||
BigDecimal p = new BigDecimal(0);
|
||||
if (shopProduct.getIsVipPrice()==1){
|
||||
if (userVipService.is456SVip()||userVipService.is78SVip()){
|
||||
p = shopProduct.getPrice().multiply(new BigDecimal(0.8));
|
||||
}else if (!userVipService.noVip()){
|
||||
p = shopProduct.getPrice().multiply(new BigDecimal(0.9));
|
||||
}
|
||||
//如果有折扣价,比折扣价低就返回vip折扣金额
|
||||
if (shopProduct.getActivityPrice().compareTo(new BigDecimal(0))>0
|
||||
&&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<String, Object> params) {
|
||||
IPage<ShopProduct> page = this.page(
|
||||
|
||||
@@ -30,6 +30,15 @@ public class ShopCartVo {
|
||||
* 商品活动单价
|
||||
*/
|
||||
private BigDecimal activityPrice;
|
||||
/**
|
||||
* 是否有vip折扣
|
||||
*/
|
||||
private Integer isVipPrice;
|
||||
|
||||
/**
|
||||
* 商品vip价格
|
||||
*/
|
||||
private BigDecimal vipPrice;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -55,6 +55,10 @@ public class BuyOrderResponseVo {
|
||||
* 扣减金额
|
||||
*/
|
||||
private BigDecimal districtPrice;
|
||||
/**
|
||||
* vip优惠金额
|
||||
*/
|
||||
private BigDecimal vipDiscountAmount;
|
||||
/**
|
||||
* 运费
|
||||
*/
|
||||
|
||||
@@ -31,6 +31,10 @@ public class GoodsResponseVo {
|
||||
* 商品价格
|
||||
*/
|
||||
private BigDecimal productPrice;
|
||||
/**
|
||||
* 商品vip价格
|
||||
*/
|
||||
private BigDecimal vipPrice;
|
||||
/**
|
||||
* 商品数量
|
||||
*/
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
@@ -82,6 +82,10 @@ public class BuyOrder implements Serializable {
|
||||
* 优惠金额
|
||||
*/
|
||||
private BigDecimal districtMoney;
|
||||
/**
|
||||
* VIP优惠金额
|
||||
*/
|
||||
private BigDecimal vipDiscountAmount;
|
||||
/**
|
||||
* 实收金额
|
||||
*/
|
||||
|
||||
@@ -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<ShopProductCourseEntity> courseIds;
|
||||
|
||||
//vip价格
|
||||
@TableField(exist = false)
|
||||
private BigDecimal vipPrice;
|
||||
}
|
||||
|
||||
@@ -9,12 +9,15 @@ import java.util.Set;
|
||||
|
||||
public interface UserVipService extends IService<UserVip> {
|
||||
|
||||
boolean noVip();
|
||||
boolean noMedicalVip();
|
||||
boolean isMedicalVip();
|
||||
boolean isAcupunctureVip();
|
||||
boolean istumorVip();
|
||||
boolean isSociologyVip();
|
||||
boolean isPsycheVip();
|
||||
boolean is456SVip();
|
||||
boolean is78SVip();
|
||||
|
||||
//是否是这门课的vip
|
||||
UserVip ownCourseCatalogueByVip(int courseId);
|
||||
|
||||
@@ -30,6 +30,18 @@ public class UserVipServiceImpl extends ServiceImpl<UserVipDao, UserVip> impleme
|
||||
@Autowired
|
||||
private VipBuyConfigDao vipBuyConfigDao;
|
||||
|
||||
@Override
|
||||
public boolean noVip() {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean noMedicalVip() {
|
||||
List<UserVip> userVipList = userVipDao.selectList(new LambdaQueryWrapper<UserVip>()
|
||||
@@ -67,6 +79,23 @@ public class UserVipServiceImpl extends ServiceImpl<UserVipDao, UserVip> 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<UserVip> userVipList = userVipDao.selectList(new LambdaQueryWrapper<UserVip>()
|
||||
.eq(UserVip::getUserId, ShiroUtils.getUId())
|
||||
|
||||
@@ -47,6 +47,8 @@ public class WechatPayConfig implements Serializable {
|
||||
private String zmzmappId;
|
||||
@Value("${wxpay.wumenappId}")
|
||||
private String wumenappId;
|
||||
@Value("${wxpay.xlkjappId}")
|
||||
private String xlkjappId;
|
||||
/**
|
||||
* 商户号
|
||||
*/
|
||||
|
||||
@@ -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<String, Object> map = new HashMap<>();
|
||||
paramMap.put("appid", appid);
|
||||
|
||||
@@ -95,6 +95,8 @@ public class WxpayServiceImpl extends ServiceImpl<PayWechatOrderDao, PayWechatOr
|
||||
appid = wechatPayConfig.getZmzmappId();
|
||||
} else if ("wumen".equals(paymentInfo.getAppName())) {
|
||||
appid = wechatPayConfig.getWumenappId();
|
||||
} else if ("xlkj".equals(paymentInfo.getAppName())) {
|
||||
appid = wechatPayConfig.getXlkjappId();
|
||||
}
|
||||
// app id
|
||||
paramMap.put("appid", appid);
|
||||
|
||||
@@ -52,6 +52,20 @@ public class PsycheCourseController {
|
||||
return R.ok().put("courseList",courseList);
|
||||
}
|
||||
|
||||
//免费课程
|
||||
@RequestMapping("/getFreeCourse")
|
||||
public R getFreeCourse(){
|
||||
MPJLambdaWrapper<CourseEntity> 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<CourseEntity> courseList = courseService.list(wrapper);
|
||||
return R.ok().put("courseList",courseList);
|
||||
}
|
||||
|
||||
//我的课程-过期课程
|
||||
@RequestMapping("/getCourseExpire")
|
||||
public R getCourseExpire(){
|
||||
|
||||
Reference in New Issue
Block a user