修改vipprice,用户会员类型修改
This commit is contained in:
@@ -38,6 +38,8 @@ public class BookLabelAndMarketController {
|
|||||||
private ShopProductService productService;
|
private ShopProductService productService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserVipService userVipService;
|
private UserVipService userVipService;
|
||||||
|
@Autowired
|
||||||
|
private ShopProductService shopProductService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 图书标签树
|
* 图书标签树
|
||||||
@@ -385,19 +387,9 @@ public class BookLabelAndMarketController {
|
|||||||
wrapper.orderByDesc(ShopProduct::getSumSales);
|
wrapper.orderByDesc(ShopProduct::getSumSales);
|
||||||
List<Map<String,Object>> list = toLabelService.listMaps(wrapper);
|
List<Map<String,Object>> list = toLabelService.listMaps(wrapper);
|
||||||
for (Map<String,Object> map:list){
|
for (Map<String,Object> map:list){
|
||||||
//vip价格,不是vip或者活动价更低,返回0
|
ShopProduct shopProduct = shopProductService.getById(map.get("id").toString());
|
||||||
if (map.get("is_vip_price").toString().equals("1")){
|
if (shopProduct.getIsVipPrice()==1){
|
||||||
BigDecimal b = new BigDecimal(0);
|
map.put("vip_price",shopProductService.getVipPrice(shopProduct));
|
||||||
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);
|
return R.ok().put("result", list);
|
||||||
|
|||||||
@@ -190,23 +190,12 @@ public class BuyOrderController {
|
|||||||
public R getShopProductListByIds(@RequestBody Map<String,Object> params){
|
public R getShopProductListByIds(@RequestBody Map<String,Object> params){
|
||||||
String[] productIds = params.get("productIds").toString().split(",");
|
String[] productIds = params.get("productIds").toString().split(",");
|
||||||
LambdaQueryWrapper<ShopProduct> wrapper = new LambdaQueryWrapper();
|
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));
|
wrapper.in(ShopProduct::getProductId,Arrays.asList(productIds));
|
||||||
List<ShopProduct> shopProductList = shopProductService.list(wrapper);
|
List<ShopProduct> shopProductList = shopProductService.list(wrapper);
|
||||||
for (ShopProduct shopProduct:shopProductList){
|
for (ShopProduct shopProduct:shopProductList){
|
||||||
//vip价格,不是vip或者活动价更低,返回0
|
|
||||||
if (shopProduct.getIsVipPrice()==1){
|
if (shopProduct.getIsVipPrice()==1){
|
||||||
BigDecimal b = new BigDecimal(0);
|
shopProduct.setVipPrice(shopProductService.getVipPrice(shopProduct));
|
||||||
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);
|
return R.ok().put("shopProductList",shopProductList);
|
||||||
|
|||||||
@@ -322,19 +322,8 @@ public class ShopProductController {
|
|||||||
booklist.add(String.valueOf(bookId));
|
booklist.add(String.valueOf(bookId));
|
||||||
list.add(byId);
|
list.add(byId);
|
||||||
}
|
}
|
||||||
//vip价格,不是vip或者活动价更低,返回0
|
|
||||||
if (shopProduct.getIsVipPrice()==1){
|
if (shopProduct.getIsVipPrice()==1){
|
||||||
BigDecimal b = new BigDecimal(0);
|
shopProduct.setVipPrice(shopProductService.getVipPrice(shopProduct));
|
||||||
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>()
|
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>()
|
List<BuyOrderProduct> buyOrderProducts = buyOrderProductService.getBaseMapper().selectList(new LambdaQueryWrapper<BuyOrderProduct>()
|
||||||
.eq(BuyOrderProduct::getOrderId, b.getOrderId()));
|
.eq(BuyOrderProduct::getOrderId, b.getOrderId()));
|
||||||
for (BuyOrderProduct bb : buyOrderProducts){
|
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())));
|
.eq(ShopProduct::getProductId,bb.getProductId())));
|
||||||
UserRecord userRecord = userRecordDao.selectOne(new QueryWrapper<UserRecord>()
|
UserRecord userRecord = userRecordDao.selectOne(new QueryWrapper<UserRecord>()
|
||||||
.eq("userid", ShiroUtils.getUId())
|
.eq("userid", ShiroUtils.getUId())
|
||||||
|
|||||||
@@ -82,19 +82,8 @@ public class OrderCartServiceImpl extends ServiceImpl<OrderCartDao, OrderCartEnt
|
|||||||
}
|
}
|
||||||
shopCartVo.setActivityPrice(price);
|
shopCartVo.setActivityPrice(price);
|
||||||
shopCartVo.setIsVipPrice(productEntity.getIsVipPrice());
|
shopCartVo.setIsVipPrice(productEntity.getIsVipPrice());
|
||||||
//vip价格,不是vip或者活动价更低,返回0
|
|
||||||
if (productEntity.getIsVipPrice()==1){
|
if (productEntity.getIsVipPrice()==1){
|
||||||
BigDecimal b = new BigDecimal(0);
|
shopCartVo.setVipPrice(shopProductService.getVipPrice(productEntity));
|
||||||
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);
|
cartList.add(shopCartVo);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,6 +93,7 @@ public class ShopProductServiceImpl extends ServiceImpl<ShopProductDao, ShopProd
|
|||||||
public PageUtils getNewBook(Map<String, Object> params) {
|
public PageUtils getNewBook(Map<String, Object> params) {
|
||||||
IPage<ShopProduct> page = this.page(
|
IPage<ShopProduct> page = this.page(
|
||||||
new Query<ShopProduct>().getPage(params),
|
new Query<ShopProduct>().getPage(params),
|
||||||
|
|
||||||
new QueryWrapper<ShopProduct>().eq("is_new",1).orderByDesc("create_time")
|
new QueryWrapper<ShopProduct>().eq("is_new",1).orderByDesc("create_time")
|
||||||
);
|
);
|
||||||
return new PageUtils(page);
|
return new PageUtils(page);
|
||||||
|
|||||||
@@ -2,7 +2,13 @@ package com.peanut.modules.common.controller;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.peanut.common.utils.R;
|
import com.peanut.common.utils.R;
|
||||||
|
import com.peanut.modules.book.service.BuyOrderProductService;
|
||||||
|
import com.peanut.modules.book.service.ShopProductService;
|
||||||
|
import com.peanut.modules.common.entity.BuyOrder;
|
||||||
|
import com.peanut.modules.common.entity.BuyOrderProduct;
|
||||||
|
import com.peanut.modules.common.entity.ShopProduct;
|
||||||
import com.peanut.modules.common.entity.TransactionDetailsEntity;
|
import com.peanut.modules.common.entity.TransactionDetailsEntity;
|
||||||
|
import com.peanut.modules.common.service.BuyOrderService;
|
||||||
import com.peanut.modules.common.service.TransactionDetailsService;
|
import com.peanut.modules.common.service.TransactionDetailsService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
@@ -24,6 +30,12 @@ public class TransactionDetailsController {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private TransactionDetailsService transactionDetailsService;
|
private TransactionDetailsService transactionDetailsService;
|
||||||
|
@Autowired
|
||||||
|
private BuyOrderService buyOrderService;
|
||||||
|
@Autowired
|
||||||
|
private BuyOrderProductService buyOrderProductService;
|
||||||
|
@Autowired
|
||||||
|
private ShopProductService shopProductService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取付款记录列表
|
* 获取付款记录列表
|
||||||
@@ -37,6 +49,29 @@ public class TransactionDetailsController {
|
|||||||
}
|
}
|
||||||
wrapper.orderByDesc(TransactionDetailsEntity::getCreateTime);
|
wrapper.orderByDesc(TransactionDetailsEntity::getCreateTime);
|
||||||
List<TransactionDetailsEntity> list = transactionDetailsService.list(wrapper);
|
List<TransactionDetailsEntity> list = transactionDetailsService.list(wrapper);
|
||||||
|
for (TransactionDetailsEntity detail:list){
|
||||||
|
if ("购买商品".equals(detail.getOrderType())){
|
||||||
|
String productName = "";
|
||||||
|
String orderSn = detail.getRemark().substring(8);
|
||||||
|
BuyOrder buyOrder = buyOrderService.getOne(new LambdaQueryWrapper<BuyOrder>()
|
||||||
|
.eq(BuyOrder::getOrderSn,orderSn));
|
||||||
|
if (buyOrder!=null){
|
||||||
|
List<BuyOrderProduct> products = buyOrderProductService.list(new LambdaQueryWrapper<BuyOrderProduct>()
|
||||||
|
.eq(BuyOrderProduct::getOrderId,buyOrder.getOrderId()));
|
||||||
|
for (BuyOrderProduct buyOrderProduct : products) {
|
||||||
|
ShopProduct shopProduct = shopProductService.getById(buyOrderProduct.getProductId());
|
||||||
|
if (shopProduct != null){
|
||||||
|
if (StringUtils.isNotBlank(productName)){
|
||||||
|
productName += ";"+shopProduct.getProductName();
|
||||||
|
}else {
|
||||||
|
productName += shopProduct.getProductName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
detail.setProductName(productName);
|
||||||
|
}
|
||||||
|
}
|
||||||
return R.ok().put("transactionDetailsList",list);
|
return R.ok().put("transactionDetailsList",list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.peanut.modules.common.controller;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
|
import com.peanut.common.utils.HttpContextUtil;
|
||||||
import com.peanut.common.utils.R;
|
import com.peanut.common.utils.R;
|
||||||
import com.peanut.common.utils.ShiroUtils;
|
import com.peanut.common.utils.ShiroUtils;
|
||||||
import com.peanut.config.Constants;
|
import com.peanut.config.Constants;
|
||||||
@@ -22,6 +23,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@@ -64,14 +67,38 @@ public class UserVipController {
|
|||||||
List<UserVip> l4 = userVipService.list(new LambdaQueryWrapper<UserVip>().eq(UserVip::getUserId,ShiroUtils.getUId()).eq(UserVip::getType,4).orderByDesc(UserVip::getEndTime));
|
List<UserVip> l4 = userVipService.list(new LambdaQueryWrapper<UserVip>().eq(UserVip::getUserId,ShiroUtils.getUId()).eq(UserVip::getType,4).orderByDesc(UserVip::getEndTime));
|
||||||
List<UserVip> l5 = userVipService.list(new LambdaQueryWrapper<UserVip>().eq(UserVip::getUserId,ShiroUtils.getUId()).eq(UserVip::getType,5).orderByDesc(UserVip::getEndTime));
|
List<UserVip> l5 = userVipService.list(new LambdaQueryWrapper<UserVip>().eq(UserVip::getUserId,ShiroUtils.getUId()).eq(UserVip::getType,5).orderByDesc(UserVip::getEndTime));
|
||||||
List<UserVip> l6 = userVipService.list(new LambdaQueryWrapper<UserVip>().eq(UserVip::getUserId,ShiroUtils.getUId()).eq(UserVip::getType,6).orderByDesc(UserVip::getEndTime));
|
List<UserVip> l6 = userVipService.list(new LambdaQueryWrapper<UserVip>().eq(UserVip::getUserId,ShiroUtils.getUId()).eq(UserVip::getType,6).orderByDesc(UserVip::getEndTime));
|
||||||
if (l4.size()>0&&l5.size()>0&&l6.size()>0&&l4.get(0).getState()==0&&l5.get(0).getState()==0&&l6.get(0).getState()==0){
|
if (l4.size()>0&&l5.size()>0&&l6.size()>0){
|
||||||
Date t4 = l4.get(0).getEndTime();
|
Date t4 = l4.get(0).getEndTime();
|
||||||
Date t5 = l5.get(0).getEndTime();
|
Date t5 = l5.get(0).getEndTime();
|
||||||
Date t6 = l6.get(0).getEndTime();
|
Date t6 = l6.get(0).getEndTime();
|
||||||
Map map = new HashMap();
|
if (t4.getTime()==t5.getTime()&&t5.getTime()==t6.getTime()){
|
||||||
map.put("type",1);
|
Map map = new HashMap();
|
||||||
map.put("endTime",t4.getTime()<t5.getTime()?(t4.getTime()<t6.getTime()?t4:(t5.getTime()<t6.getTime()?t5:t6)):(t5.getTime()<t6.getTime()?t5:t6));
|
map.put("type",1);
|
||||||
resList.add(map);
|
map.put("endTime",t4);
|
||||||
|
resList.add(map);
|
||||||
|
}else {
|
||||||
|
List<Map<String,Object>> tempList = new ArrayList();
|
||||||
|
Map map4 = new HashMap();
|
||||||
|
map4.put("type",4);
|
||||||
|
map4.put("endTime",t4);
|
||||||
|
tempList.add(map4);
|
||||||
|
Map map5 = new HashMap();
|
||||||
|
map5.put("type",5);
|
||||||
|
map5.put("endTime",t5);
|
||||||
|
tempList.add(map5);
|
||||||
|
Map map6 = new HashMap();
|
||||||
|
map6.put("type",6);
|
||||||
|
map6.put("endTime",t6);
|
||||||
|
tempList.add(map6);
|
||||||
|
tempList = tempList.stream().sorted((map1,map2)->{
|
||||||
|
return Long.compare(((Date)map1.get("endTime")).getTime(),((Date)map2.get("endTime")).getTime());
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
resList.addAll(tempList);
|
||||||
|
Map map1 = new HashMap();
|
||||||
|
map1.put("type",1);
|
||||||
|
map1.put("endTime",tempList.get(0).get("endTime"));
|
||||||
|
resList.add(map1);
|
||||||
|
}
|
||||||
}else {
|
}else {
|
||||||
if (l4.size()>0){
|
if (l4.size()>0){
|
||||||
Map map = new HashMap();
|
Map map = new HashMap();
|
||||||
@@ -90,17 +117,38 @@ public class UserVipController {
|
|||||||
map.put("type",6);
|
map.put("type",6);
|
||||||
map.put("endTime",l6.get(0).getEndTime());
|
map.put("endTime",l6.get(0).getEndTime());
|
||||||
resList.add(map);
|
resList.add(map);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<UserVip> l7 = userVipService.list(new LambdaQueryWrapper<UserVip>().eq(UserVip::getUserId,ShiroUtils.getUId()).eq(UserVip::getType,7).orderByDesc(UserVip::getEndTime));
|
List<UserVip> l7 = userVipService.list(new LambdaQueryWrapper<UserVip>().eq(UserVip::getUserId,ShiroUtils.getUId()).eq(UserVip::getType,7).orderByDesc(UserVip::getEndTime));
|
||||||
List<UserVip> l8 = userVipService.list(new LambdaQueryWrapper<UserVip>().eq(UserVip::getUserId,ShiroUtils.getUId()).eq(UserVip::getType,8).orderByDesc(UserVip::getEndTime));
|
List<UserVip> l8 = userVipService.list(new LambdaQueryWrapper<UserVip>().eq(UserVip::getUserId,ShiroUtils.getUId()).eq(UserVip::getType,8).orderByDesc(UserVip::getEndTime));
|
||||||
if (l7.size()>0&&l8.size()>0&&l7.get(0).getState()==0&&l8.get(0).getState()==0){
|
if (l7.size()>0&&l8.size()>0){
|
||||||
Date t7 = l7.get(0).getEndTime();
|
Date t7 = l7.get(0).getEndTime();
|
||||||
Date t8 = l8.get(0).getEndTime();
|
Date t8 = l8.get(0).getEndTime();
|
||||||
Map map = new HashMap();
|
if (t7.getTime()==t8.getTime()){
|
||||||
map.put("type",2);
|
Map map = new HashMap();
|
||||||
map.put("endTime",t7.getTime()<t8.getTime()?t7:t8);
|
map.put("type",2);
|
||||||
resList.add(map);
|
map.put("endTime",t7);
|
||||||
|
resList.add(map);
|
||||||
|
}else {
|
||||||
|
List<Map<String,Object>> tempList = new ArrayList();
|
||||||
|
Map map7 = new HashMap();
|
||||||
|
map7.put("type",7);
|
||||||
|
map7.put("endTime",t7);
|
||||||
|
tempList.add(map7);
|
||||||
|
Map map8 = new HashMap();
|
||||||
|
map8.put("type",8);
|
||||||
|
map8.put("endTime",t8);
|
||||||
|
tempList.add(map8);
|
||||||
|
tempList = tempList.stream().sorted((map1,map2)->{
|
||||||
|
return Long.compare(((Date)map1.get("endTime")).getTime(),((Date)map2.get("endTime")).getTime());
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
resList.addAll(tempList);
|
||||||
|
Map map2 = new HashMap();
|
||||||
|
map2.put("type",2);
|
||||||
|
map2.put("endTime",tempList.get(0).get("endTime"));
|
||||||
|
resList.add(map2);
|
||||||
|
}
|
||||||
}else {
|
}else {
|
||||||
if (l7.size()>0){
|
if (l7.size()>0){
|
||||||
Map map = new HashMap();
|
Map map = new HashMap();
|
||||||
@@ -116,7 +164,7 @@ public class UserVipController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
resList = resList.stream().sorted((map1,map2)->{
|
resList = resList.stream().sorted((map1,map2)->{
|
||||||
return Long.compare(((Date)map2.get("endTime")).getTime(),((Date)map1.get("endTime")).getTime());
|
return Long.compare(((Date)map1.get("endTime")).getTime(),((Date)map2.get("endTime")).getTime());
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
return R.ok().put("list", resList);
|
return R.ok().put("list", resList);
|
||||||
}
|
}
|
||||||
@@ -126,10 +174,18 @@ public class UserVipController {
|
|||||||
@RequestMapping("/getVipBuyConfigList")
|
@RequestMapping("/getVipBuyConfigList")
|
||||||
public R getVipBuyConfigList() {
|
public R getVipBuyConfigList() {
|
||||||
List<List> ll = new ArrayList<>();
|
List<List> ll = new ArrayList<>();
|
||||||
ll.add(Arrays.asList(1));
|
//根部不同平台返回不同列表
|
||||||
ll.add(Arrays.asList(4,5,6));
|
HttpServletRequest request = HttpContextUtil.getHttpServletRequest();
|
||||||
ll.add(Arrays.asList(2));
|
String appType = request.getHeader("appType")==null?"":request.getHeader("appType");
|
||||||
ll.add(Arrays.asList(7,8));
|
if ("psyche".equals(appType)){
|
||||||
|
ll.add(Arrays.asList(8,7));
|
||||||
|
ll.add(Arrays.asList(2));
|
||||||
|
}else {
|
||||||
|
ll.add(Arrays.asList(1));
|
||||||
|
ll.add(Arrays.asList(4,5,6));
|
||||||
|
ll.add(Arrays.asList(2));
|
||||||
|
ll.add(Arrays.asList(7,8));
|
||||||
|
}
|
||||||
List<Map<String,Object>> resList = new ArrayList<>();
|
List<Map<String,Object>> resList = new ArrayList<>();
|
||||||
for (List l : ll) {
|
for (List l : ll) {
|
||||||
LambdaQueryWrapper<VipBuyConfigEntity> wrapper = new LambdaQueryWrapper();
|
LambdaQueryWrapper<VipBuyConfigEntity> wrapper = new LambdaQueryWrapper();
|
||||||
|
|||||||
@@ -59,6 +59,8 @@ public class TransactionDetailsEntity implements Serializable {
|
|||||||
|
|
||||||
private String tel;
|
private String tel;
|
||||||
|
|
||||||
|
|
||||||
private String note;
|
private String note;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String productName;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public class MedicalLabelAndMarketController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ShopProductService productService;
|
private ShopProductService productService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserVipService userVipService;
|
private com.peanut.modules.book.service.ShopProductService shopProductService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分类标签树
|
* 分类标签树
|
||||||
@@ -68,19 +68,8 @@ public class MedicalLabelAndMarketController {
|
|||||||
Page<ShopProduct> page = productService.page(new Page<>(
|
Page<ShopProduct> page = productService.page(new Page<>(
|
||||||
Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())),wrapper);
|
Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())),wrapper);
|
||||||
for (ShopProduct shopProduct:page.getRecords()){
|
for (ShopProduct shopProduct:page.getRecords()){
|
||||||
//vip价格,不是vip或者活动价更低,返回0
|
|
||||||
if (shopProduct.getIsVipPrice()==1){
|
if (shopProduct.getIsVipPrice()==1){
|
||||||
BigDecimal b = new BigDecimal(0);
|
shopProduct.setVipPrice(shopProductService.getVipPrice(shopProduct));
|
||||||
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("result", page);
|
return R.ok().put("result", page);
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ 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.R;
|
import com.peanut.common.utils.R;
|
||||||
import com.peanut.common.utils.ShiroUtils;
|
import com.peanut.common.utils.ShiroUtils;
|
||||||
|
import com.peanut.modules.book.service.ShopProductService;
|
||||||
import com.peanut.modules.common.dao.*;
|
import com.peanut.modules.common.dao.*;
|
||||||
import com.peanut.modules.common.entity.*;
|
import com.peanut.modules.common.entity.*;
|
||||||
import com.peanut.modules.common.service.MyUserService;
|
import com.peanut.modules.common.service.MyUserService;
|
||||||
@@ -27,9 +28,9 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
|
|||||||
@Autowired
|
@Autowired
|
||||||
private UserVipService userVipService;
|
private UserVipService userVipService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private CourseToSociologyDao courseToSociologyDao;
|
private ShopProductService shopProductService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private CourseToMedicineDao courseToMedicineDao;
|
private CourseToSociologyDao courseToSociologyDao;
|
||||||
@Autowired
|
@Autowired
|
||||||
private CourseCatalogueDao courseCatalogueDao;
|
private CourseCatalogueDao courseCatalogueDao;
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -45,8 +46,6 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
|
|||||||
@Autowired
|
@Autowired
|
||||||
private UserCourseStudyingDao studyingDao;
|
private UserCourseStudyingDao studyingDao;
|
||||||
@Autowired
|
@Autowired
|
||||||
private MyUserDao userDao;
|
|
||||||
@Autowired
|
|
||||||
private ShopProductDao shopProductDao;
|
private ShopProductDao shopProductDao;
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserVipDao userVipDao;
|
private UserVipDao userVipDao;
|
||||||
@@ -126,9 +125,14 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
|
|||||||
if (StringUtils.isNotEmpty(course.getRelationProductIds())){
|
if (StringUtils.isNotEmpty(course.getRelationProductIds())){
|
||||||
String[] ids = course.getRelationProductIds().split(",");
|
String[] ids = course.getRelationProductIds().split(",");
|
||||||
List<ShopProduct> shopProductList = shopProductDao.selectList(new LambdaQueryWrapper<ShopProduct>()
|
List<ShopProduct> shopProductList = shopProductDao.selectList(new LambdaQueryWrapper<ShopProduct>()
|
||||||
.select(ShopProduct::getProductId,ShopProduct::getProductImages,ShopProduct::getProductName,ShopProduct::getActivityPrice,ShopProduct::getPrice)
|
.select(ShopProduct::getProductId,ShopProduct::getProductImages,ShopProduct::getProductName,ShopProduct::getActivityPrice,ShopProduct::getPrice,ShopProduct::getIsVipPrice,ShopProduct::getGoodsType)
|
||||||
.in(ShopProduct::getProductId, ids)
|
.in(ShopProduct::getProductId, ids)
|
||||||
.orderByAsc(ShopProduct::getSort));
|
.orderByAsc(ShopProduct::getSort));
|
||||||
|
for (ShopProduct shopProduct : shopProductList) {
|
||||||
|
if (!userVipService.noVip()&&shopProduct.getIsVipPrice()==1){
|
||||||
|
shopProduct.setVipPrice(shopProductService.getVipPrice(shopProduct));
|
||||||
|
}
|
||||||
|
}
|
||||||
flag.put("shopProductList",shopProductList);
|
flag.put("shopProductList",shopProductList);
|
||||||
}
|
}
|
||||||
//目录信息
|
//目录信息
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import com.peanut.modules.common.dao.ShopProductBookDao;
|
|||||||
import com.peanut.modules.common.dao.ShopProductCourseDao;
|
import com.peanut.modules.common.dao.ShopProductCourseDao;
|
||||||
import com.peanut.modules.common.dao.ShopProductDao;
|
import com.peanut.modules.common.dao.ShopProductDao;
|
||||||
import com.peanut.modules.common.entity.*;
|
import com.peanut.modules.common.entity.*;
|
||||||
|
import com.peanut.modules.common.service.UserVipService;
|
||||||
import com.peanut.modules.common.to.ParamTo;
|
import com.peanut.modules.common.to.ParamTo;
|
||||||
import com.peanut.modules.sociology.service.ShopProductService;
|
import com.peanut.modules.sociology.service.ShopProductService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -30,7 +31,9 @@ public class ShopProductServiceImpl extends ServiceImpl<ShopProductDao, ShopProd
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ShopProductBookDao shopProductBookDao;
|
private ShopProductBookDao shopProductBookDao;
|
||||||
@Autowired
|
@Autowired
|
||||||
private BookDao bookDao;
|
private UserVipService userVipService;
|
||||||
|
@Autowired
|
||||||
|
private com.peanut.modules.book.service.ShopProductService shopProductService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page getMarketProductList(ParamTo param) {
|
public Page getMarketProductList(ParamTo param) {
|
||||||
@@ -58,6 +61,9 @@ 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.noVip()&&product.getIsVipPrice()==1){
|
||||||
|
product.setVipPrice(shopProductService.getVipPrice(product));
|
||||||
|
}
|
||||||
flag.put("detail",product);//基础信息
|
flag.put("detail",product);//基础信息
|
||||||
//查询包含的书
|
//查询包含的书
|
||||||
MPJLambdaWrapper<ShopProductBookEntity> shopProductBookEntityMPJLambdaWrapper = new MPJLambdaWrapper<>();
|
MPJLambdaWrapper<ShopProductBookEntity> shopProductBookEntityMPJLambdaWrapper = new MPJLambdaWrapper<>();
|
||||||
@@ -108,6 +114,16 @@ public class ShopProductServiceImpl extends ServiceImpl<ShopProductDao, ShopProd
|
|||||||
List<ShopProduct> shopProducts = this.getBaseMapper().selectList(new LambdaQueryWrapper<ShopProduct>().in(ShopProduct::getProductId, is));
|
List<ShopProduct> shopProducts = this.getBaseMapper().selectList(new LambdaQueryWrapper<ShopProduct>().in(ShopProduct::getProductId, is));
|
||||||
flag.put("GLProducts",shopProducts);
|
flag.put("GLProducts",shopProducts);
|
||||||
}
|
}
|
||||||
|
if (flag.containsKey("GLProducts")){
|
||||||
|
List<ShopProduct> shopProducts = (List)flag.get("GLProducts");
|
||||||
|
if (shopProducts.size()>0){
|
||||||
|
for (ShopProduct shopProduct : shopProducts) {
|
||||||
|
if (!userVipService.noVip()&&shopProduct.getIsVipPrice()==1){
|
||||||
|
shopProduct.setVipPrice(shopProductService.getVipPrice(shopProduct));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user