|
@@ -6,12 +6,10 @@ import com.caimei365.order.components.ProductService;
|
|
|
import com.caimei365.order.mapper.BaseMapper;
|
|
|
import com.caimei365.order.mapper.CartSellerMapper;
|
|
|
import com.caimei365.order.model.ResponseJson;
|
|
|
+import com.caimei365.order.model.dto.AgainBuyDto;
|
|
|
import com.caimei365.order.model.dto.SellerCartDto;
|
|
|
import com.caimei365.order.model.po.SellerCartPo;
|
|
|
-import com.caimei365.order.model.vo.CartItemVo;
|
|
|
-import com.caimei365.order.model.vo.PromotionPriceVo;
|
|
|
-import com.caimei365.order.model.vo.PromotionsVo;
|
|
|
-import com.caimei365.order.model.vo.CartShopVo;
|
|
|
+import com.caimei365.order.model.vo.*;
|
|
|
import com.caimei365.order.service.CartSellerService;
|
|
|
import com.caimei365.order.utils.MathUtil;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
@@ -25,7 +23,10 @@ import org.springframework.stereotype.Service;
|
|
|
import javax.annotation.Resource;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
+import java.util.concurrent.atomic.AtomicBoolean;
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+import java.util.stream.Stream;
|
|
|
|
|
|
/**
|
|
|
* Description
|
|
@@ -243,8 +244,8 @@ public class CartSellerServiceImpl implements CartSellerService {
|
|
|
* clubId 机构ID
|
|
|
* type 商品类型:1单一商品,2组合商品
|
|
|
* productId 单一商品id
|
|
|
- * productNum 单一商品数量
|
|
|
- * productInfo 组合商品信息:Json字符串格式[{"id":4351,"num":1},{}]
|
|
|
+ * productCount 单一商品数量
|
|
|
+ * productInfo 组合商品信息:Json字符串格式[{"id":4351,"count":1},{}]
|
|
|
* }
|
|
|
*/
|
|
|
@Override
|
|
@@ -258,14 +259,14 @@ public class CartSellerServiceImpl implements CartSellerService {
|
|
|
for (Iterator iterator = productArr.iterator(); iterator.hasNext();) {
|
|
|
JSONObject product = (JSONObject) iterator.next();
|
|
|
Integer productId = product.getInteger("id");
|
|
|
- Integer productNum = product.getInteger("num");
|
|
|
+ Integer productCount = product.getInteger("count");
|
|
|
sellerCartDto.setProductId(productId);
|
|
|
- sellerCartDto.setProductNum(productNum);
|
|
|
+ sellerCartDto.setProductCount(productCount);
|
|
|
addSellerCart(sellerCartDto);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
log.error("组合商品信息格式错误", e);
|
|
|
- return ResponseJson.error("组合商品信息格式错误!Json字符串格式[{\"id\":4351,\"num\":1},{}]", null);
|
|
|
+ return ResponseJson.error("组合商品信息格式错误!Json字符串格式[{\"id\":4351,\"count\":1},{}]", null);
|
|
|
}
|
|
|
}
|
|
|
// 返回购物车种类数量
|
|
@@ -280,7 +281,7 @@ public class CartSellerServiceImpl implements CartSellerService {
|
|
|
SellerCartPo cart = cartSellerMapper.getSellerCart(sellerCartDto);
|
|
|
if (cart != null) {
|
|
|
// 购物车已存在该商品,更新数量
|
|
|
- cart.setNum(cart.getNum() + sellerCartDto.getProductNum());
|
|
|
+ cart.setNum(cart.getNum() + sellerCartDto.getProductCount());
|
|
|
cart.setAddTime(new Date());
|
|
|
cartSellerMapper.updateSellerCart(cart);
|
|
|
} else {
|
|
@@ -289,7 +290,7 @@ public class CartSellerServiceImpl implements CartSellerService {
|
|
|
cart.setServiceProviderId(sellerCartDto.getServiceProviderId());
|
|
|
cart.setClubId(sellerCartDto.getClubId());
|
|
|
cart.setProductId(sellerCartDto.getProductId());
|
|
|
- cart.setNum(sellerCartDto.getProductNum());
|
|
|
+ cart.setNum(sellerCartDto.getProductCount());
|
|
|
cart.setAddTime(new Date());
|
|
|
cartSellerMapper.insertSellerCart(cart);
|
|
|
}
|
|
@@ -301,7 +302,7 @@ public class CartSellerServiceImpl implements CartSellerService {
|
|
|
* @param sellerCartDto {
|
|
|
* serviceProviderId 协销Id
|
|
|
* id 购物车Id
|
|
|
- * productNum 商品数量
|
|
|
+ * productCount 商品数量
|
|
|
* }
|
|
|
*/
|
|
|
@Override
|
|
@@ -310,7 +311,7 @@ public class CartSellerServiceImpl implements CartSellerService {
|
|
|
if (!sellerCartDto.getServiceProviderId().equals(cart.getServiceProviderId())) {
|
|
|
return ResponseJson.error("协销Id不正确!",null);
|
|
|
}
|
|
|
- cart.setNum(cart.getNum() + sellerCartDto.getProductNum());
|
|
|
+ cart.setNum(cart.getNum() + sellerCartDto.getProductCount());
|
|
|
cart.setAddTime(new Date());
|
|
|
cartSellerMapper.updateSellerCart(cart);
|
|
|
return ResponseJson.success(0);
|
|
@@ -339,5 +340,328 @@ public class CartSellerServiceImpl implements CartSellerService {
|
|
|
return ResponseJson.success(0);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 协销购物车结算
|
|
|
+ *
|
|
|
+ * @param serviceProviderId 协销Id
|
|
|
+ * @param clubId 机构Id
|
|
|
+ * @param productIds 商品Ids
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public ResponseJson<Map<String, Object>> settlementSellerCart(Integer serviceProviderId, Integer clubId, String productIds) {
|
|
|
+ log.info("¥¥¥¥¥¥¥¥¥¥ > 商品结算(协销帮机构下单)");
|
|
|
+ // 商品种类
|
|
|
+ AtomicInteger kindCount = new AtomicInteger(0);
|
|
|
+ // 商品总数量
|
|
|
+ AtomicInteger totalCount = new AtomicInteger(0);
|
|
|
+ // 统计商品总金额
|
|
|
+ AtomicDouble totalPrice = new AtomicDouble(0);
|
|
|
+ // 统计总促销满减
|
|
|
+ AtomicDouble reducedPrice = new AtomicDouble(0);
|
|
|
+ // 统计总划线价
|
|
|
+ AtomicDouble totalOriginalPrice = new AtomicDouble(0);
|
|
|
+ // 是否包含充值商品,默认false
|
|
|
+ AtomicBoolean includeRecharge = new AtomicBoolean(false);
|
|
|
+
|
|
|
+ // 促销活动(总)
|
|
|
+ List<PromotionsVo> totalPromotions = new ArrayList<>();
|
|
|
+ // 促销活动Id集合,用于合并促销活动
|
|
|
+ List<Integer> promotionsIds = new ArrayList<>();
|
|
|
+ // 供应商Id集合,用户判断赠品供应商是否在当前供应商中
|
|
|
+ List<Integer> shopIds = new ArrayList<>();
|
|
|
+
|
|
|
+ // 前端接收商品Id信息
|
|
|
+ List<String> productIdList = new ArrayList<>();
|
|
|
+ if (productIds.contains(",")) {
|
|
|
+ productIdList = Stream.of(productIds.split(",")).collect(Collectors.toList());
|
|
|
+ } else {
|
|
|
+ productIdList.add(productIds);
|
|
|
+ }
|
|
|
+ // 获取机构用户Id
|
|
|
+ Integer clubUserId = baseMapper.getUserIdByClubId(clubId);
|
|
|
+ // 供应商列表
|
|
|
+ List<CartShopVo> shopList = cartSellerMapper.getCartShopsByProductIds(serviceProviderId, clubId, productIdList);
|
|
|
+ if (null != shopList && shopList.size()>0) {
|
|
|
+ // 遍历供应商列表
|
|
|
+ List<String> finalIdList = productIdList;
|
|
|
+ shopList.forEach(shop -> {
|
|
|
+ // 该供应商下商品种类
|
|
|
+ AtomicInteger shopKindCount = new AtomicInteger(0);
|
|
|
+ // 该供应商总价
|
|
|
+ AtomicDouble shopPrice = new AtomicDouble(0);
|
|
|
+ // 该供应商满减金额(供应商满减,单品满减)
|
|
|
+ AtomicDouble shopReducedPrice = new AtomicDouble(0);
|
|
|
+ // 供应商促销优惠活动
|
|
|
+ PromotionsVo shopPromotion = baseMapper.getPromotionByShopId(shop.getShopId());
|
|
|
+ // 供应商下商品列表
|
|
|
+ List<CartItemVo> productList = cartSellerMapper.getCartProductsByProductIds(serviceProviderId, clubId, shop.getShopId(), finalIdList);
|
|
|
+ if (null != productList && productList.size()>0) {
|
|
|
+ for (CartItemVo cartItemVo : productList) {
|
|
|
+ // 设置商品图片及税费
|
|
|
+ boolean taxFlag = productService.setCartItemImgAndTax(cartItemVo);
|
|
|
+ // 是否充值商品
|
|
|
+ boolean recharge = productService.isRechargeProduct(cartItemVo.getProductId());
|
|
|
+ if (recharge) {
|
|
|
+ includeRecharge.set(true);
|
|
|
+ }
|
|
|
+ // 获取商品促销信息
|
|
|
+ PromotionsVo promotions = null;
|
|
|
+ // 没有店铺促销时,商品促销才有效
|
|
|
+ if (null == shopPromotion) {
|
|
|
+ // 获取商品促销信息
|
|
|
+ promotions = baseMapper.getPromotionByProductId(cartItemVo.getProductId());
|
|
|
+ /*
|
|
|
+ * 设置商品促销优惠
|
|
|
+ */
|
|
|
+ if (null != promotions) {
|
|
|
+ // 当前促销活动的价格计算列表
|
|
|
+ List<PromotionPriceVo> promotionPriceList = productService.getPromotionProducts(promotions, cartItemVo, taxFlag);
|
|
|
+ // 更新到总促销列表
|
|
|
+ productService.updateTotalPromotions(totalPromotions, promotionsIds, promotions, promotionPriceList);
|
|
|
+ //单品满减-计算供应商总价/满减金额
|
|
|
+ if (promotions.getType() == 1 && promotions.getMode() == 2) {
|
|
|
+ BigDecimal totalAmount = MathUtil.mul(cartItemVo.getNumber(), cartItemVo.getPrice());
|
|
|
+ if (MathUtil.compare(totalAmount, promotions.getTouchPrice()) > -1) {
|
|
|
+ // 如果满足促销条件,设置供应商价格-满减金额,满减总额 + 当前促销满减金额
|
|
|
+ shopPrice.set(MathUtil.sub(shopPrice.get(), promotions.getReducedPrice()).doubleValue());
|
|
|
+ shopReducedPrice.set(MathUtil.add(shopReducedPrice, promotions.getReducedPrice()).doubleValue());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ cartItemVo.setPromotions(promotions);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (null != promotions || null != shopPromotion) {
|
|
|
+ // 商品处于活动状态
|
|
|
+ cartItemVo.setActStatus(1);
|
|
|
+ // 关闭阶梯价格,活动优先
|
|
|
+ cartItemVo.setLadderFlag(0);
|
|
|
+ } else {
|
|
|
+ if (cartItemVo.getLadderFlag() == 1) {
|
|
|
+ // 设置阶梯价
|
|
|
+ productService.setCartLadderPrices(cartItemVo, taxFlag);
|
|
|
+ } else {
|
|
|
+ // 复购价
|
|
|
+ Double repurchase = baseMapper.getRepurchasePrice(cartItemVo.getProductId(), clubUserId);
|
|
|
+ if (null != repurchase && repurchase > 0) {
|
|
|
+ cartItemVo.setPrice(repurchase);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 该供应商下价格累加
|
|
|
+ shopPrice.set(MathUtil.add(shopPrice, MathUtil.mul(cartItemVo.getNumber(), cartItemVo.getPrice())).doubleValue());
|
|
|
+ // 该供应商下商品种类 +1
|
|
|
+ shopKindCount.incrementAndGet();
|
|
|
+ // 总数量 + 当前商品购买数量
|
|
|
+ totalCount.updateAndGet(v -> v + cartItemVo.getNumber());
|
|
|
+ }
|
|
|
+ if (shopKindCount.get() > 0) {
|
|
|
+ // 店铺促销
|
|
|
+ if (null != shopPromotion) {
|
|
|
+ shop.setPromotions(shopPromotion);
|
|
|
+ if (!promotionsIds.contains(shopPromotion.getId())) {
|
|
|
+ promotionsIds.add(shopPromotion.getId());
|
|
|
+ // 店铺满赠
|
|
|
+ if (shopPromotion.getMode() == 3) {
|
|
|
+ // 获取赠品
|
|
|
+ List<CartItemVo> giftList = baseMapper.getPromotionGifts(shopPromotion.getId());
|
|
|
+ shopPromotion.setGiftList(giftList);
|
|
|
+ }
|
|
|
+ // 设置该优惠下的商品列表
|
|
|
+ List<PromotionPriceVo> promotionPriceList = new ArrayList<>();
|
|
|
+ productList.forEach(item -> {
|
|
|
+ PromotionPriceVo promotionPrice = new PromotionPriceVo();
|
|
|
+ promotionPrice.setProductId(item.getProductId());
|
|
|
+ promotionPrice.setNumber(item.getNumber());
|
|
|
+ promotionPrice.setPrice(item.getPrice());
|
|
|
+ promotionPriceList.add(promotionPrice);
|
|
|
+ });
|
|
|
+ shopPromotion.setProductList(promotionPriceList);
|
|
|
+ // 添加到总促销
|
|
|
+ totalPromotions.add(shopPromotion);
|
|
|
+ // 店铺满减-计算供应商总价/满减金额
|
|
|
+ if (shopPromotion.getMode() == 2 && MathUtil.compare(shopPrice, shopPromotion.getTouchPrice()) > -1) {
|
|
|
+ // 该供应商总价 - 满减金额
|
|
|
+ shopPrice.set(MathUtil.sub(shopPrice.get(), shopPromotion.getReducedPrice()).doubleValue());
|
|
|
+ // 该供应商优惠总额 + 满减金额
|
|
|
+ shopReducedPrice.set(MathUtil.add(shopReducedPrice.get(), shopPromotion.getReducedPrice()).doubleValue());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 供应商商品
|
|
|
+ shop.setCartList(productList);
|
|
|
+ // 供应商总价
|
|
|
+ shop.setTotalPrice(shopPrice.get());
|
|
|
+ // 供应商总优惠
|
|
|
+ shop.setReducedPrice(shopReducedPrice.get());
|
|
|
+ // 供应商划线价
|
|
|
+ shop.setOriginalPrice(MathUtil.add(shopPrice.get(), shopReducedPrice.get()).doubleValue());
|
|
|
+
|
|
|
+ // 添加供应商Id集合
|
|
|
+ shopIds.add(shop.getShopId());
|
|
|
+ // 计算总价
|
|
|
+ totalPrice.set(MathUtil.add(totalPrice, shop.getTotalPrice()).doubleValue());
|
|
|
+ // 优惠总额
|
|
|
+ reducedPrice.set(MathUtil.add(reducedPrice, shop.getReducedPrice()).doubleValue());
|
|
|
+ // 总划线价
|
|
|
+ totalOriginalPrice.set(MathUtil.add(totalOriginalPrice, shop.getOriginalPrice()).doubleValue());
|
|
|
+ // 商品种类
|
|
|
+ kindCount.updateAndGet(v -> v + shopKindCount.get());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 供应商下商品种类
|
|
|
+ shop.setCount(shopKindCount.get());
|
|
|
+ });
|
|
|
+ // 删除空数据
|
|
|
+ shopList.removeIf(shop -> (null == shop || shop.getCount() == 0));
|
|
|
+
|
|
|
+ }
|
|
|
+ // 总促销计算
|
|
|
+ totalPromotions.forEach(promotions -> {
|
|
|
+ // 该促销内商品总价
|
|
|
+ double touchPrice = promotions.getProductList().stream().mapToDouble(product -> product.getNumber() * product.getPrice()).sum();
|
|
|
+ // 凑单满减
|
|
|
+ if (promotions.getType() == 2 && promotions.getMode() == 2) {
|
|
|
+ if (MathUtil.compare(touchPrice, promotions.getTouchPrice()) > -1) {
|
|
|
+ // 总价 - 满减金额
|
|
|
+ totalPrice.set(MathUtil.sub(totalPrice, promotions.getReducedPrice()).doubleValue());
|
|
|
+ // 优惠总额 + 满减金额
|
|
|
+ reducedPrice.set(MathUtil.add(reducedPrice, promotions.getReducedPrice()).doubleValue());
|
|
|
+ }
|
|
|
+ } else if (promotions.getMode() == 3) {
|
|
|
+ // 全部满赠
|
|
|
+ promotions.getGiftList().forEach(gift -> {
|
|
|
+ if (shopIds.contains(gift.getShopId())) {
|
|
|
+ // 赠品在当前订单内的供应商下
|
|
|
+ shopList.forEach(shop -> {
|
|
|
+ if (shop.getShopId().equals(gift.getShopId())) {
|
|
|
+ shop.getCartList().add(gift);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ // 获取赠品供应商
|
|
|
+ CartShopVo giftShop = baseMapper.getPromotionGiftsShop(gift.getProductId());
|
|
|
+ shopIds.add(giftShop.getShopId());
|
|
|
+ giftShop.setCartList(new ArrayList<>());
|
|
|
+ giftShop.getCartList().add(gift);
|
|
|
+ shopList.add(giftShop);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // 发票信息
|
|
|
+ InvoiceVo invoice = baseMapper.getUserInvoice(clubUserId);
|
|
|
+ // 可用余额
|
|
|
+ Double availableMoney = baseMapper.getUserAbleUserMoney(clubUserId);
|
|
|
+ // 可用采美豆
|
|
|
+ Integer userBeans = baseMapper.getUserBeans(clubUserId);
|
|
|
+ // 包装返回数据
|
|
|
+ Map<String, Object> resultData = new HashMap<>();
|
|
|
+ resultData.put("list", shopList);
|
|
|
+ resultData.put("kindCount", kindCount);
|
|
|
+ resultData.put("totalCount", totalCount);
|
|
|
+ resultData.put("totalPrice", totalPrice);
|
|
|
+ resultData.put("reducedPrice", reducedPrice);
|
|
|
+ resultData.put("totalOriginalPrice", totalOriginalPrice);
|
|
|
+ resultData.put("promotions", totalPromotions);
|
|
|
+ resultData.put("invoice", invoice);
|
|
|
+ resultData.put("userMoney", availableMoney);
|
|
|
+ resultData.put("userBeans", userBeans);
|
|
|
+ resultData.put("includeRecharge", includeRecharge);
|
|
|
+ return ResponseJson.success(resultData);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 协销二手商品立即购买
|
|
|
+ *
|
|
|
+ * @param serviceProviderId 协销Id
|
|
|
+ * @param clubId 机构Id
|
|
|
+ * @param productId 商品Id
|
|
|
+ * @param productCount 商品数量
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public ResponseJson<Map<String, Object>> settlementSecond(Integer serviceProviderId, Integer clubId, Integer productId, Integer productCount) {
|
|
|
+ // 统计商品总金额
|
|
|
+ Double totalPrice = 0d;
|
|
|
+ // 供应商信息
|
|
|
+ CartShopVo shop = cartSellerMapper.getShopByProductId(productId);
|
|
|
+ if (null != shop) {
|
|
|
+ CartItemVo second = cartSellerMapper.getSecondByProductId(productId);
|
|
|
+ second.setActStatus(0);
|
|
|
+ second.setNumber(productCount);
|
|
|
+ // 计算总价
|
|
|
+ totalPrice = MathUtil.mul(second.getNumber(), second.getPrice()).doubleValue();
|
|
|
+ shop.setTotalPrice(totalPrice);
|
|
|
+ List<CartItemVo> cartList = new ArrayList<>(1);
|
|
|
+ cartList.add(second);
|
|
|
+ shop.setCartList(cartList);
|
|
|
+ }
|
|
|
+ // 获取机构用户Id
|
|
|
+ Integer clubUserId = baseMapper.getUserIdByClubId(clubId);
|
|
|
+ // 发票信息
|
|
|
+ InvoiceVo invoice = baseMapper.getUserInvoice(clubUserId);
|
|
|
+ // 可用余额
|
|
|
+ Double availableMoney = baseMapper.getUserAbleUserMoney(clubUserId);
|
|
|
+ // 可用采美豆
|
|
|
+ Integer userBeans = baseMapper.getUserBeans(clubUserId);
|
|
|
+ // 包装返回数据
|
|
|
+ Map<String, Object> resultData = new HashMap<>();
|
|
|
+ resultData.put("shop", shop);
|
|
|
+ resultData.put("kindCount", 1);
|
|
|
+ resultData.put("totalCount", productCount);
|
|
|
+ resultData.put("totalPrice", totalPrice);
|
|
|
+ resultData.put("invoice", invoice);
|
|
|
+ resultData.put("userMoney", availableMoney);
|
|
|
+ resultData.put("userBeans", userBeans);
|
|
|
+ return ResponseJson.success(resultData);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 协销再来一单
|
|
|
+ *
|
|
|
+ * @param againBuyDto {
|
|
|
+ * serviceProviderId 协销Id
|
|
|
+ * clubId 机构ID
|
|
|
+ * orderId 订单Id
|
|
|
+ * confirmFlag 确认标识 0未确认 1已确认-将失效商品以外的正常商品加入购物车
|
|
|
+ * }
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public ResponseJson<Map<String, Object>> addCartBuyAgain(AgainBuyDto againBuyDto) {
|
|
|
+ // 返回数据
|
|
|
+ Map<String, Object> resultData = new HashMap<>();
|
|
|
+ // 获取订单里用户Id
|
|
|
+ Integer orderUserId = cartSellerMapper.getOrderUserIdByOrderId(againBuyDto.getOrderId());
|
|
|
+ if (null == orderUserId || orderUserId == 0) {
|
|
|
+ return ResponseJson.error("订单异常或不存在!", null);
|
|
|
+ }
|
|
|
+ List<CartItemVo> productList = cartSellerMapper.getOrderProductNum(againBuyDto.getOrderId());
|
|
|
+ // 总商品种类数量
|
|
|
+ Integer total = productList.size();
|
|
|
+ // 移除失效商品
|
|
|
+ productList.removeIf(cartItemVo -> (null == cartItemVo || null == cartItemVo.getValidFlag() || (cartItemVo.getValidFlag() != 2 && cartItemVo.getValidFlag() != 3 && cartItemVo.getValidFlag() != 9)));
|
|
|
+ // 失效商品数量
|
|
|
+ Integer invalid = total - productList.size();
|
|
|
+ if (productList.size() == 0) {
|
|
|
+ return ResponseJson.error(-2, "订单内的商品已全部失效,不能下单!", null);
|
|
|
+ }
|
|
|
+ if (invalid > 0 && (null == againBuyDto.getConfirmFlag() || 1 != againBuyDto.getConfirmFlag())){
|
|
|
+ resultData.put("productList", productList);
|
|
|
+ return ResponseJson.error(-3, "部分商品已失效,不能进行购买。是否先将以下商品加入购物车?", resultData);
|
|
|
+ }
|
|
|
+ // 订单商品加入协销购物车
|
|
|
+ SellerCartDto cart = new SellerCartDto();
|
|
|
+ cart.setServiceProviderId(againBuyDto.getServiceProviderId());
|
|
|
+ cart.setClubId(againBuyDto.getClubId());
|
|
|
+ productList.forEach(cartItemVo -> {
|
|
|
+ cart.setProductId(cartItemVo.getProductId());
|
|
|
+ cart.setProductCount(cartItemVo.getNumber());
|
|
|
+ addSellerCart(cart);
|
|
|
+ });
|
|
|
+ // 包装返回数据
|
|
|
+ resultData.put("userId", orderUserId);
|
|
|
+ resultData.put("clubId", againBuyDto.getClubId());
|
|
|
+ resultData.put("productList", productList);
|
|
|
+ return ResponseJson.success(resultData);
|
|
|
+ }
|
|
|
|
|
|
}
|