更新
This commit is contained in:
@@ -8,12 +8,15 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.peanut.common.utils.ExcludeEmptyQueryWrapper;
|
||||
import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.common.utils.Query;
|
||||
import com.peanut.config.Constants;
|
||||
import com.peanut.modules.book.dao.BuyOrderDao;
|
||||
import com.peanut.modules.book.dao.BuyOrderProductDao;
|
||||
import com.peanut.modules.book.dao.ExpressOrderDao;
|
||||
import com.peanut.modules.book.dao.ShopProductBookDao;
|
||||
import com.peanut.modules.book.entity.*;
|
||||
import com.peanut.modules.book.service.*;
|
||||
import com.peanut.modules.book.to.UserOrderDto;
|
||||
@@ -61,6 +64,9 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
|
||||
@Autowired
|
||||
ShopProductService shopProductService;
|
||||
|
||||
@Autowired
|
||||
private BookService bookService;
|
||||
|
||||
@Autowired
|
||||
private BuyOrderProductService buyOrderProductService;
|
||||
|
||||
@@ -72,7 +78,13 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
|
||||
@Autowired
|
||||
private ExpressOrderDao expressOrderDao;
|
||||
@Autowired
|
||||
private BuyOrderProductDao buyOrderProductDao;
|
||||
@Autowired
|
||||
private ShopProductBookDao shopProductBookDao;
|
||||
@Autowired
|
||||
private OssService ossService;
|
||||
@Autowired
|
||||
private ShopProductBookService shopProductBookService;
|
||||
|
||||
protected Logger logger = LoggerFactory.getLogger(BuyOrderServiceImpl.class);
|
||||
|
||||
@@ -404,7 +416,7 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
|
||||
ShopProduct product = shopProductService.getById(productId);
|
||||
//定义快递商品
|
||||
ExpressCommodity commodity = new ExpressCommodity();
|
||||
commodity.setGoodsName(product.getProductName());
|
||||
commodity.setGoodsName(product.getProductName()+" ×"+buyOrderProduct.getQuantity());
|
||||
commodity.setGoodsquantity(buyOrderProduct.getQuantity());
|
||||
commodity.setGoodsWeight((product.getWeight().doubleValue())/1000);
|
||||
totalWeight = totalWeight.add(
|
||||
@@ -607,6 +619,7 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
|
||||
goodsResponseVo.setProductImage(shopProduct.getProductImages());
|
||||
goodsResponseVo.setProductPrice(shopProduct.getPrice());
|
||||
goodsResponseVo.setQuantity(buyOrderProduct.getQuantity());
|
||||
goodsResponseVo.setProductId(shopProduct.getProductId());
|
||||
QueryWrapper<ExpressOrder> expressOrderQueryWrapper = new QueryWrapper<>();
|
||||
expressOrderQueryWrapper.eq("id", buyOrderProduct.getExpressOrderId());
|
||||
ExpressOrder expressOrder = expressOrderService.getOne(expressOrderQueryWrapper);
|
||||
@@ -617,6 +630,11 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
|
||||
expressResponseVo.setPrintTemplate(expressOrder.getPrintTemplate());
|
||||
}
|
||||
goodsResponseVo.setExpressInfo(expressResponseVo);
|
||||
|
||||
//设置商品对应的具体书
|
||||
List<BookEntity> bookByProductId = shopProductBookService.getBookByProductId(buyOrderProduct.getProductId());
|
||||
goodsResponseVo.setBooks(bookByProductId);
|
||||
|
||||
goodsResponseVoList.add(goodsResponseVo);
|
||||
}
|
||||
responseVo.setGoodsList(goodsResponseVoList);
|
||||
@@ -628,6 +646,25 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
|
||||
List<Integer> collect = buyOrderProductService.getBaseMapper().selectList(b_wrapper).stream().map(BuyOrderProduct::getExpressOrderId).collect(Collectors.toList());
|
||||
if(collect.size()>0){
|
||||
List<ExpressOrder> expressOrders = expressOrderService.getBaseMapper().selectList(new LambdaQueryWrapper<ExpressOrder>().in(ExpressOrder::getId, collect));
|
||||
for (ExpressOrder e : expressOrders){
|
||||
MPJLambdaWrapper<BuyOrderProduct> buyOrderProductMPJLambdaWrapper = new MPJLambdaWrapper<>();
|
||||
buyOrderProductMPJLambdaWrapper.selectAll(ShopProduct.class);
|
||||
buyOrderProductMPJLambdaWrapper.select(BuyOrderProduct::getQuantity);
|
||||
buyOrderProductMPJLambdaWrapper.select(BuyOrder::getOrderSn);
|
||||
buyOrderProductMPJLambdaWrapper.leftJoin(ShopProduct.class,ShopProduct::getProductId,BuyOrderProduct::getProductId);
|
||||
buyOrderProductMPJLambdaWrapper.leftJoin(BuyOrder.class,BuyOrder::getOrderId,BuyOrderProduct::getOrderId);
|
||||
buyOrderProductMPJLambdaWrapper.eq(BuyOrderProduct::getExpressOrderId,e.getId());
|
||||
List<ShopProduct> shopProducts = buyOrderProductDao.selectJoinList(ShopProduct.class, buyOrderProductMPJLambdaWrapper);
|
||||
for(ShopProduct s : shopProducts){
|
||||
MPJLambdaWrapper<ShopProductBookEntity> shopProductBookEntityMPJLambdaWrapper = new MPJLambdaWrapper<>();
|
||||
shopProductBookEntityMPJLambdaWrapper.selectAll(BookEntity.class);
|
||||
shopProductBookEntityMPJLambdaWrapper.leftJoin(BookEntity.class,BookEntity::getId,ShopProductBookEntity::getBookId);
|
||||
shopProductBookEntityMPJLambdaWrapper.eq(ShopProductBookEntity::getProductId,s.getProductId());
|
||||
List<BookEntity> bookEntities = shopProductBookDao.selectJoinList(BookEntity.class, shopProductBookEntityMPJLambdaWrapper);
|
||||
s.setBooks(bookEntities);
|
||||
}
|
||||
e.setProducts(shopProducts);
|
||||
}
|
||||
responseVo.setExpressOrders(expressOrders);
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ public class ExpressOrderServiceImpl extends ServiceImpl<ExpressOrderDao, Expres
|
||||
orderRequestVo.setCustomerName(Constants.EXPRESS_YD_CUSTOMER_NAME);
|
||||
orderRequestVo.setCustomerPwd(Constants.EXPRESS_YD_CUSTOMER_PWD);
|
||||
}
|
||||
orderRequestVo.setExpType(2);//1特快2标快
|
||||
orderRequestVo.setExpType(231);//1特快2标快
|
||||
orderRequestVo.setCost(expressOrder.getExpressFee().doubleValue());
|
||||
// 发货人
|
||||
ExpressUserInfoVo sender = new ExpressUserInfoVo();
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service("shopProductBookService")
|
||||
public class ShopProductBookServiceImpl extends ServiceImpl<ShopProductBookDao, ShopProductBookEntity> implements ShopProductBookService {
|
||||
@@ -87,6 +88,12 @@ public class ShopProductBookServiceImpl extends ServiceImpl<ShopProductBookDao,
|
||||
return ids;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BookEntity> getBookByProductId(Integer productId) {
|
||||
List<Integer> collect = getBaseMapper().selectList(new QueryWrapper<ShopProductBookEntity>().eq("product_id", productId)).stream().map(ShopProductBookEntity::getBookId).collect(Collectors.toList());
|
||||
return collect.size()==0?null:bookService.list(new LambdaQueryWrapper<BookEntity>().in(BookEntity::getId, collect));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getProductByBookId(Integer bookId) {
|
||||
LambdaQueryWrapper<ShopProductBookEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
Reference in New Issue
Block a user