|
@@ -197,7 +197,7 @@ public class ShoppingCartService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//计算价钱
|
|
//计算价钱
|
|
|
- public ShoppingCart calculatePrice(Long cartId, Long userId) {
|
|
|
|
|
|
|
+ public ShoppingCart calculatePrice(Long cartId, Long userId, Long merchantId) {
|
|
|
|
|
|
|
|
//购物车
|
|
//购物车
|
|
|
ShoppingCart cart = shoppingCartRepo.findById(cartId).orElseThrow(new BusinessException("无购物车"));
|
|
ShoppingCart cart = shoppingCartRepo.findById(cartId).orElseThrow(new BusinessException("无购物车"));
|
|
@@ -234,7 +234,7 @@ public class ShoppingCartService {
|
|
|
BigDecimal total = goodsTotal.add(packingPrice);
|
|
BigDecimal total = goodsTotal.add(packingPrice);
|
|
|
|
|
|
|
|
//按商家创建购物车
|
|
//按商家创建购物车
|
|
|
- Long merchantId = specs.get(0).getGoods().getMerchantId();
|
|
|
|
|
|
|
+ // Long merchantId = specs.get(0).getGoods().getMerchantId();
|
|
|
//商家信息
|
|
//商家信息
|
|
|
MerchantSettings merchant = merchantSettingsRepo.findByMerchantId(merchantId).orElseThrow(new BusinessException("无商户"));
|
|
MerchantSettings merchant = merchantSettingsRepo.findByMerchantId(merchantId).orElseThrow(new BusinessException("无商户"));
|
|
|
|
|
|
|
@@ -328,28 +328,28 @@ public class ShoppingCartService {
|
|
|
|
|
|
|
|
this.changeOrderSpec(save, orderGoodsSpec);
|
|
this.changeOrderSpec(save, orderGoodsSpec);
|
|
|
|
|
|
|
|
- return this.calculatePrice(save.getId(), userId);
|
|
|
|
|
|
|
+ return this.calculatePrice(save.getId(), userId, save.getMerchantId());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//减规格
|
|
//减规格
|
|
|
public ShoppingCart sub(Long specId, Long userId) {
|
|
public ShoppingCart sub(Long specId, Long userId) {
|
|
|
OrderGoodsSpec spec = orderGoodsSpecRepo.findById(specId).orElseThrow(new BusinessException("无订单详情"));
|
|
OrderGoodsSpec spec = orderGoodsSpecRepo.findById(specId).orElseThrow(new BusinessException("无订单详情"));
|
|
|
-
|
|
|
|
|
|
|
+ Long merchantId = spec.getGoods().getMerchantId();
|
|
|
Long cartId = spec.getShoppingCartId();
|
|
Long cartId = spec.getShoppingCartId();
|
|
|
//if (spec.getShoppingCartId() == null) {
|
|
//if (spec.getShoppingCartId() == null) {
|
|
|
orderGoodsSpecRepo.deleteById(specId);
|
|
orderGoodsSpecRepo.deleteById(specId);
|
|
|
//}
|
|
//}
|
|
|
//shoppingCartRepo.findById(spec.getShoppingCartId());
|
|
//shoppingCartRepo.findById(spec.getShoppingCartId());
|
|
|
- return this.calculatePrice(cartId, userId);
|
|
|
|
|
|
|
+ return this.calculatePrice(cartId, userId, merchantId);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
/*
|
|
|
再来一单
|
|
再来一单
|
|
|
*/
|
|
*/
|
|
|
- public OrderInfo again(Long id){
|
|
|
|
|
|
|
+ public OrderInfo again(Long id) {
|
|
|
OrderInfo orderInfo = orderInfoRepo.findById(id).orElseThrow(new BusinessException("无订单"));
|
|
OrderInfo orderInfo = orderInfoRepo.findById(id).orElseThrow(new BusinessException("无订单"));
|
|
|
List<OrderGoodsSpec> orderGoodsSpecs = orderInfo.getOrderGoodsSpecs();
|
|
List<OrderGoodsSpec> orderGoodsSpecs = orderInfo.getOrderGoodsSpecs();
|
|
|
- orderGoodsSpecs.forEach(o->{
|
|
|
|
|
|
|
+ orderGoodsSpecs.forEach(o -> {
|
|
|
|
|
|
|
|
});
|
|
});
|
|
|
|
|
|