修复购物车数量及其列表sku规格显示等问题

This commit is contained in:
hupeng
2019-12-19 20:22:15 +08:00
parent 4a18e76373
commit f112b50c66
12 changed files with 17 additions and 342 deletions

View File

@ -4,10 +4,7 @@ import cn.hutool.core.util.IdUtil;
import co.yixiang.modules.order.entity.YxStoreOrderCartInfo;
import co.yixiang.modules.order.mapper.YxStoreOrderCartInfoMapper;
import co.yixiang.modules.order.service.YxStoreOrderCartInfoService;
import co.yixiang.modules.order.web.param.YxStoreOrderCartInfoQueryParam;
import co.yixiang.modules.order.web.vo.YxStoreOrderCartInfoQueryVo;
import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.common.web.vo.Paging;
import co.yixiang.modules.shop.web.vo.YxStoreCartQueryVo;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -16,10 +13,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

View File

@ -41,13 +41,10 @@ import co.yixiang.modules.shop.service.YxStoreProductReplyService;
import co.yixiang.modules.shop.service.YxStoreProductService;
import co.yixiang.modules.shop.service.YxSystemConfigService;
import co.yixiang.modules.shop.web.vo.YxStoreCartQueryVo;
//import co.yixiang.modules.task.CancelOrderService;
import co.yixiang.modules.user.entity.*;
import co.yixiang.modules.user.service.*;
import co.yixiang.modules.user.web.vo.YxUserAddressQueryVo;
import co.yixiang.modules.user.web.vo.YxUserQueryVo;
//import co.yixiang.redisson.DelayJob;
//import co.yixiang.redisson.DelayJobService;
import co.yixiang.modules.task.DelayJobService;
import co.yixiang.modules.user.web.vo.YxWechatUserQueryVo;
import co.yixiang.modules.wechat.entity.YxWechatTemplate;
@ -66,11 +63,6 @@ import com.github.binarywang.wxpay.config.WxPayConfig;
import com.github.binarywang.wxpay.exception.WxPayException;
import com.github.binarywang.wxpay.service.WxPayService;
import lombok.extern.slf4j.Slf4j;
//import org.redisson.RedissonDelayedQueue;
//import org.redisson.api.RDelayedQueue;
//import org.redisson.api.RQueue;
//import org.redisson.api.RedissonClient;
//import org.apache.webservice.config.annotation.Service;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.beans.factory.annotation.Autowired;

View File

@ -3,20 +3,14 @@ package co.yixiang.modules.order.service.impl;
import co.yixiang.modules.order.entity.YxStoreOrderStatus;
import co.yixiang.modules.order.mapper.YxStoreOrderStatusMapper;
import co.yixiang.modules.order.service.YxStoreOrderStatusService;
import co.yixiang.modules.order.web.param.YxStoreOrderStatusQueryParam;
import co.yixiang.modules.order.web.vo.YxStoreOrderStatusQueryVo;
import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.common.web.vo.Paging;
import co.yixiang.utils.OrderUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.io.Serializable;
/**

View File

@ -166,16 +166,17 @@ public class YxStoreCartServiceImpl extends BaseServiceImpl<YxStoreCartMapper, Y
for (YxStoreCart storeCart : carts) {
YxStoreProductQueryVo storeProduct = null;
if(storeCart.getCombinationId() > 0){
storeProduct = storeCombinationMapper.combinatiionInfo(storeCart.getCombinationId());
storeProduct = ObjectUtil.clone(storeCombinationMapper.combinatiionInfo(storeCart.getCombinationId()));
}else if(storeCart.getSeckillId() > 0){
storeProduct = storeSeckillMapper.seckillInfo(storeCart.getSeckillId());
storeProduct = ObjectUtil.clone(storeSeckillMapper.seckillInfo(storeCart.getSeckillId()));
}else{
storeProduct = productService
.getYxStoreProductById(storeCart.getProductId());
//必须得重新克隆创建一个新对象
storeProduct = ObjectUtil.clone(productService
.getYxStoreProductById(storeCart.getProductId()));
}
YxStoreCartQueryVo storeCartQueryVo = cartMap.toDto(storeCart);
storeCartQueryVo.setProductInfo(storeProduct);
if(ObjectUtil.isNull(storeProduct)){
YxStoreCart yxStoreCart = new YxStoreCart();
yxStoreCart.setIsDel(1);
@ -192,6 +193,7 @@ public class YxStoreCartServiceImpl extends BaseServiceImpl<YxStoreCartMapper, Y
invalid.add(storeCartQueryVo);
}else{
storeProduct.setAttrInfo(productAttrValue);
storeCartQueryVo.setProductInfo(storeProduct);
//设置真实价格
//设置VIP价格
@ -211,6 +213,7 @@ public class YxStoreCartServiceImpl extends BaseServiceImpl<YxStoreCartMapper, Y
storeCartQueryVo.setTrueStock(productAttrValue.getStock());
valid.add(storeCartQueryVo);
}
}else{
//设置VIP价格
@ -229,11 +232,14 @@ public class YxStoreCartServiceImpl extends BaseServiceImpl<YxStoreCartMapper, Y
storeCartQueryVo.setCostPrice(storeProduct.getCost()
.doubleValue());
storeCartQueryVo.setTrueStock(storeProduct.getStock());
storeCartQueryVo.setProductInfo(storeProduct);
valid.add(storeCartQueryVo);
}
}
}
Map<String,Object> map = new LinkedHashMap<>();
map.put("valid",valid);
map.put("invalid",invalid);
@ -313,7 +319,7 @@ public class YxStoreCartServiceImpl extends BaseServiceImpl<YxStoreCartMapper, Y
storeCart.setIsNew(isNew);
if(ObjectUtil.isNotNull(cart)){
if(isNew == 0){
storeCart.setCartNum(cartNum + storeCart.getCartNum());
storeCart.setCartNum(cartNum + cart.getCartNum());
}
storeCart.setId(cart.getId());
yxStoreCartMapper.updateById(storeCart);