|
@@ -2,16 +2,15 @@ package com.yonge.cooleshow.portal.service.impl;
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import com.yonge.cooleshow.mbg.mapper.OmsCartItemMapper;
|
|
|
-import com.yonge.cooleshow.mbg.model.OmsCartItem;
|
|
|
-import com.yonge.cooleshow.mbg.model.OmsCartItemExample;
|
|
|
-import com.yonge.cooleshow.mbg.model.UmsMember;
|
|
|
+import com.yonge.cooleshow.mbg.mapper.PmsProductMapper;
|
|
|
+import com.yonge.cooleshow.mbg.mapper.PmsSkuStockMapper;
|
|
|
+import com.yonge.cooleshow.mbg.model.*;
|
|
|
import com.yonge.cooleshow.portal.dao.PortalProductDao;
|
|
|
import com.yonge.cooleshow.portal.domain.CartProduct;
|
|
|
import com.yonge.cooleshow.portal.domain.CartPromotionItem;
|
|
|
-import com.yonge.cooleshow.portal.service.OmsCartItemService;
|
|
|
-import com.yonge.cooleshow.portal.service.OmsPromotionService;
|
|
|
-import com.yonge.cooleshow.portal.service.PortalBrandService;
|
|
|
-import com.yonge.cooleshow.portal.service.UmsMemberService;
|
|
|
+import com.yonge.cooleshow.portal.domain.PmsPortalProductDetail;
|
|
|
+import com.yonge.cooleshow.portal.service.*;
|
|
|
+import com.yonge.toolset.base.exception.BizException;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
@@ -38,7 +37,10 @@ public class OmsCartItemServiceImpl implements OmsCartItemService {
|
|
|
private UmsMemberService memberService;
|
|
|
|
|
|
@Autowired
|
|
|
- private PortalBrandService portalBrandService;
|
|
|
+ private PmsProductMapper pmsProductMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private PmsSkuStockMapper skuStockMapper;
|
|
|
|
|
|
@Override
|
|
|
public int add(OmsCartItem cartItem) {
|
|
@@ -49,6 +51,27 @@ public class OmsCartItemServiceImpl implements OmsCartItemService {
|
|
|
cartItem.setDeleteStatus(0);
|
|
|
OmsCartItem existCartItem = getCartItem(cartItem);
|
|
|
if (existCartItem == null) {
|
|
|
+ PmsProduct pmsProduct = pmsProductMapper.selectByPrimaryKey(cartItem.getId());
|
|
|
+
|
|
|
+ if (pmsProduct == null) {
|
|
|
+ throw new BizException("商品不存在");
|
|
|
+ }
|
|
|
+ cartItem.setProductPic(pmsProduct.getPic());
|
|
|
+ cartItem.setProductName(pmsProduct.getName());
|
|
|
+ cartItem.setProductSubTitle(pmsProduct.getSubTitle());
|
|
|
+ cartItem.setProductCategoryId(pmsProduct.getProductCategoryId());
|
|
|
+ cartItem.setProductBrand(pmsProduct.getName());
|
|
|
+ cartItem.setProductSn(pmsProduct.getProductSn());
|
|
|
+ if (cartItem.getProductSkuId() != null) {
|
|
|
+ PmsSkuStock pmsSkuStock = skuStockMapper.selectByPrimaryKey(cartItem.getProductSkuId());
|
|
|
+
|
|
|
+ if (pmsSkuStock == null) {
|
|
|
+ throw new BizException("商品规格不存在");
|
|
|
+ }
|
|
|
+ cartItem.setProductSkuCode(pmsSkuStock.getSkuCode());
|
|
|
+ cartItem.setProductAttr(pmsSkuStock.getSpData());
|
|
|
+ }
|
|
|
+
|
|
|
cartItem.setCreateDate(new Date());
|
|
|
count = cartItemMapper.insert(cartItem);
|
|
|
} else {
|