com.macro.mall.portal.domain.PromotionProduct Java Examples

The following examples show how to use com.macro.mall.portal.domain.PromotionProduct. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OmsPromotionServiceImpl.java    From mall-swarm with Apache License 2.0 6 votes vote down vote up
/**
 * 对没满足优惠条件的商品进行处理
 */
private void handleNoReduce(List<CartPromotionItem> cartPromotionItemList, List<OmsCartItem> itemList,PromotionProduct promotionProduct) {
    for (OmsCartItem item : itemList) {
        CartPromotionItem cartPromotionItem = new CartPromotionItem();
        BeanUtils.copyProperties(item,cartPromotionItem);
        cartPromotionItem.setPromotionMessage("无优惠");
        cartPromotionItem.setReduceAmount(new BigDecimal(0));
        PmsSkuStock skuStock = getOriginalPrice(promotionProduct,item.getProductSkuId());
        if(skuStock!=null){
            cartPromotionItem.setRealStock(skuStock.getStock()-skuStock.getLockStock());
        }
        cartPromotionItem.setIntegration(promotionProduct.getGiftPoint());
        cartPromotionItem.setGrowth(promotionProduct.getGiftGrowth());
        cartPromotionItemList.add(cartPromotionItem);
    }
}
 
Example #2
Source File: OmsPromotionServiceImpl.java    From macrozheng with Apache License 2.0 6 votes vote down vote up
/**
 * 对没满足优惠条件的商品进行处理
 */
private void handleNoReduce(List<CartPromotionItem> cartPromotionItemList, List<OmsCartItem> itemList,PromotionProduct promotionProduct) {
    for (OmsCartItem item : itemList) {
        CartPromotionItem cartPromotionItem = new CartPromotionItem();
        BeanUtils.copyProperties(item,cartPromotionItem);
        cartPromotionItem.setPromotionMessage("无优惠");
        cartPromotionItem.setReduceAmount(new BigDecimal(0));
        PmsSkuStock skuStock = getOriginalPrice(promotionProduct,item.getProductSkuId());
        if(skuStock!=null){
            cartPromotionItem.setRealStock(skuStock.getStock()-skuStock.getLockStock());
        }
        cartPromotionItem.setIntegration(promotionProduct.getGiftPoint());
        cartPromotionItem.setGrowth(promotionProduct.getGiftGrowth());
        cartPromotionItemList.add(cartPromotionItem);
    }
}
 
Example #3
Source File: OmsPromotionServiceImpl.java    From mall with Apache License 2.0 6 votes vote down vote up
/**
 * 对没满足优惠条件的商品进行处理
 */
private void handleNoReduce(List<CartPromotionItem> cartPromotionItemList, List<OmsCartItem> itemList,PromotionProduct promotionProduct) {
    for (OmsCartItem item : itemList) {
        CartPromotionItem cartPromotionItem = new CartPromotionItem();
        BeanUtils.copyProperties(item,cartPromotionItem);
        cartPromotionItem.setPromotionMessage("无优惠");
        cartPromotionItem.setReduceAmount(new BigDecimal(0));
        PmsSkuStock skuStock = getOriginalPrice(promotionProduct,item.getProductSkuId());
        if(skuStock!=null){
            cartPromotionItem.setRealStock(skuStock.getStock()-skuStock.getLockStock());
        }
        cartPromotionItem.setIntegration(promotionProduct.getGiftPoint());
        cartPromotionItem.setGrowth(promotionProduct.getGiftGrowth());
        cartPromotionItemList.add(cartPromotionItem);
    }
}
 
Example #4
Source File: OmsPromotionServiceImpl.java    From mall-swarm with Apache License 2.0 5 votes vote down vote up
/**
 * 查询所有商品的优惠相关信息
 */
private List<PromotionProduct> getPromotionProductList(List<OmsCartItem> cartItemList) {
    List<Long> productIdList = new ArrayList<>();
    for(OmsCartItem cartItem:cartItemList){
        productIdList.add(cartItem.getProductId());
    }
    return portalProductDao.getPromotionProductList(productIdList);
}
 
Example #5
Source File: PortalProductDaoTests.java    From macrozheng-mall with MIT License 5 votes vote down vote up
@Test
public void testGetPromotionProductList(){
    List<Long> ids = new ArrayList<>();
    ids.add(26L);
    ids.add(27L);
    ids.add(28L);
    ids.add(29L);
    List<PromotionProduct> promotionProductList = portalProductDao.getPromotionProductList(ids);
    Assert.assertEquals(4,promotionProductList.size());
}
 
Example #6
Source File: OmsPromotionServiceImpl.java    From macrozheng-mall with MIT License 5 votes vote down vote up
/**
 * 根据商品id获取商品的促销信息
 */
private PromotionProduct getPromotionProductById(Long productId, List<PromotionProduct> promotionProductList) {
    for (PromotionProduct promotionProduct : promotionProductList) {
        if (productId.equals(promotionProduct.getId())) {
            return promotionProduct;
        }
    }
    return null;
}
 
Example #7
Source File: OmsPromotionServiceImpl.java    From macrozheng-mall with MIT License 5 votes vote down vote up
/**
 * 获取商品的原价
 */
private PmsSkuStock getOriginalPrice(PromotionProduct promotionProduct, Long productSkuId) {
    for (PmsSkuStock skuStock : promotionProduct.getSkuStockList()) {
        if (productSkuId.equals(skuStock.getId())) {
            return skuStock;
        }
    }
    return null;
}
 
Example #8
Source File: OmsPromotionServiceImpl.java    From macrozheng-mall with MIT License 5 votes vote down vote up
/**
 * 获取购物车中指定商品的总价
 */
private BigDecimal getCartItemAmount(List<OmsCartItem> itemList, List<PromotionProduct> promotionProductList) {
    BigDecimal amount = new BigDecimal(0);
    for (OmsCartItem item : itemList) {
        //计算出商品原价
        PromotionProduct promotionProduct = getPromotionProductById(item.getProductId(), promotionProductList);
        PmsSkuStock skuStock = getOriginalPrice(promotionProduct,item.getProductSkuId());
        amount = amount.add(skuStock.getPrice().multiply(new BigDecimal(item.getQuantity())));
    }
    return amount;
}
 
Example #9
Source File: OmsPromotionServiceImpl.java    From macrozheng-mall with MIT License 5 votes vote down vote up
/**
 * 对没满足优惠条件的商品进行处理
 */
private void handleNoReduce(List<CartPromotionItem> cartPromotionItemList, List<OmsCartItem> itemList,PromotionProduct promotionProduct) {
    for (OmsCartItem item : itemList) {
        CartPromotionItem cartPromotionItem = new CartPromotionItem();
        BeanUtils.copyProperties(item,cartPromotionItem);
        cartPromotionItem.setPromotionMessage("无优惠");
        cartPromotionItem.setReduceAmount(new BigDecimal(0));
        PmsSkuStock skuStock = getOriginalPrice(promotionProduct,item.getProductSkuId());
        cartPromotionItem.setRealStock(skuStock.getStock()-skuStock.getLockStock());
        cartPromotionItem.setIntegration(promotionProduct.getGiftPoint());
        cartPromotionItem.setGrowth(promotionProduct.getGiftGrowth());
        cartPromotionItemList.add(cartPromotionItem);
    }
}
 
Example #10
Source File: OmsPromotionServiceImpl.java    From macrozheng-mall with MIT License 5 votes vote down vote up
/**
 * 查询所有商品的优惠相关信息
 */
private List<PromotionProduct> getPromotionProductList(List<OmsCartItem> cartItemList) {
    List<Long> productIdList = new ArrayList<>();
    for(OmsCartItem cartItem:cartItemList){
        productIdList.add(cartItem.getProductId());
    }
    return portalProductDao.getPromotionProductList(productIdList);
}
 
Example #11
Source File: PortalProductDaoTests.java    From mall with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetPromotionProductList(){
    List<Long> ids = new ArrayList<>();
    ids.add(26L);
    ids.add(27L);
    ids.add(28L);
    ids.add(29L);
    List<PromotionProduct> promotionProductList = portalProductDao.getPromotionProductList(ids);
    Assert.assertEquals(4,promotionProductList.size());
}
 
Example #12
Source File: OmsPromotionServiceImpl.java    From mall with Apache License 2.0 5 votes vote down vote up
/**
 * 根据商品id获取商品的促销信息
 */
private PromotionProduct getPromotionProductById(Long productId, List<PromotionProduct> promotionProductList) {
    for (PromotionProduct promotionProduct : promotionProductList) {
        if (productId.equals(promotionProduct.getId())) {
            return promotionProduct;
        }
    }
    return null;
}
 
Example #13
Source File: OmsPromotionServiceImpl.java    From mall with Apache License 2.0 5 votes vote down vote up
/**
 * 获取商品的原价
 */
private PmsSkuStock getOriginalPrice(PromotionProduct promotionProduct, Long productSkuId) {
    for (PmsSkuStock skuStock : promotionProduct.getSkuStockList()) {
        if (productSkuId.equals(skuStock.getId())) {
            return skuStock;
        }
    }
    return null;
}
 
Example #14
Source File: OmsPromotionServiceImpl.java    From mall with Apache License 2.0 5 votes vote down vote up
/**
 * 获取购物车中指定商品的总价
 */
private BigDecimal getCartItemAmount(List<OmsCartItem> itemList, List<PromotionProduct> promotionProductList) {
    BigDecimal amount = new BigDecimal(0);
    for (OmsCartItem item : itemList) {
        //计算出商品原价
        PromotionProduct promotionProduct = getPromotionProductById(item.getProductId(), promotionProductList);
        PmsSkuStock skuStock = getOriginalPrice(promotionProduct,item.getProductSkuId());
        amount = amount.add(skuStock.getPrice().multiply(new BigDecimal(item.getQuantity())));
    }
    return amount;
}
 
Example #15
Source File: OmsPromotionServiceImpl.java    From mall with Apache License 2.0 5 votes vote down vote up
/**
 * 查询所有商品的优惠相关信息
 */
private List<PromotionProduct> getPromotionProductList(List<OmsCartItem> cartItemList) {
    List<Long> productIdList = new ArrayList<>();
    for(OmsCartItem cartItem:cartItemList){
        productIdList.add(cartItem.getProductId());
    }
    return portalProductDao.getPromotionProductList(productIdList);
}
 
Example #16
Source File: PortalProductDaoTests.java    From macrozheng with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetPromotionProductList(){
    List<Long> ids = new ArrayList<>();
    ids.add(26L);
    ids.add(27L);
    ids.add(28L);
    ids.add(29L);
    List<PromotionProduct> promotionProductList = portalProductDao.getPromotionProductList(ids);
    Assert.assertEquals(4,promotionProductList.size());
}
 
Example #17
Source File: OmsPromotionServiceImpl.java    From macrozheng with Apache License 2.0 5 votes vote down vote up
/**
 * 根据商品id获取商品的促销信息
 */
private PromotionProduct getPromotionProductById(Long productId, List<PromotionProduct> promotionProductList) {
    for (PromotionProduct promotionProduct : promotionProductList) {
        if (productId.equals(promotionProduct.getId())) {
            return promotionProduct;
        }
    }
    return null;
}
 
Example #18
Source File: OmsPromotionServiceImpl.java    From macrozheng with Apache License 2.0 5 votes vote down vote up
/**
 * 获取商品的原价
 */
private PmsSkuStock getOriginalPrice(PromotionProduct promotionProduct, Long productSkuId) {
    for (PmsSkuStock skuStock : promotionProduct.getSkuStockList()) {
        if (productSkuId.equals(skuStock.getId())) {
            return skuStock;
        }
    }
    return null;
}
 
Example #19
Source File: OmsPromotionServiceImpl.java    From macrozheng with Apache License 2.0 5 votes vote down vote up
/**
 * 获取购物车中指定商品的总价
 */
private BigDecimal getCartItemAmount(List<OmsCartItem> itemList, List<PromotionProduct> promotionProductList) {
    BigDecimal amount = new BigDecimal(0);
    for (OmsCartItem item : itemList) {
        //计算出商品原价
        PromotionProduct promotionProduct = getPromotionProductById(item.getProductId(), promotionProductList);
        PmsSkuStock skuStock = getOriginalPrice(promotionProduct,item.getProductSkuId());
        amount = amount.add(skuStock.getPrice().multiply(new BigDecimal(item.getQuantity())));
    }
    return amount;
}
 
Example #20
Source File: OmsPromotionServiceImpl.java    From macrozheng with Apache License 2.0 5 votes vote down vote up
/**
 * 查询所有商品的优惠相关信息
 */
private List<PromotionProduct> getPromotionProductList(List<OmsCartItem> cartItemList) {
    List<Long> productIdList = new ArrayList<>();
    for(OmsCartItem cartItem:cartItemList){
        productIdList.add(cartItem.getProductId());
    }
    return portalProductDao.getPromotionProductList(productIdList);
}
 
Example #21
Source File: PortalProductDaoTests.java    From mall-swarm with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetPromotionProductList(){
    List<Long> ids = new ArrayList<>();
    ids.add(26L);
    ids.add(27L);
    ids.add(28L);
    ids.add(29L);
    List<PromotionProduct> promotionProductList = portalProductDao.getPromotionProductList(ids);
    Assert.assertEquals(4,promotionProductList.size());
}
 
Example #22
Source File: OmsPromotionServiceImpl.java    From mall-swarm with Apache License 2.0 5 votes vote down vote up
/**
 * 根据商品id获取商品的促销信息
 */
private PromotionProduct getPromotionProductById(Long productId, List<PromotionProduct> promotionProductList) {
    for (PromotionProduct promotionProduct : promotionProductList) {
        if (productId.equals(promotionProduct.getId())) {
            return promotionProduct;
        }
    }
    return null;
}
 
Example #23
Source File: OmsPromotionServiceImpl.java    From mall-swarm with Apache License 2.0 5 votes vote down vote up
/**
 * 获取商品的原价
 */
private PmsSkuStock getOriginalPrice(PromotionProduct promotionProduct, Long productSkuId) {
    for (PmsSkuStock skuStock : promotionProduct.getSkuStockList()) {
        if (productSkuId.equals(skuStock.getId())) {
            return skuStock;
        }
    }
    return null;
}
 
Example #24
Source File: OmsPromotionServiceImpl.java    From mall-swarm with Apache License 2.0 5 votes vote down vote up
/**
 * 获取购物车中指定商品的总价
 */
private BigDecimal getCartItemAmount(List<OmsCartItem> itemList, List<PromotionProduct> promotionProductList) {
    BigDecimal amount = new BigDecimal(0);
    for (OmsCartItem item : itemList) {
        //计算出商品原价
        PromotionProduct promotionProduct = getPromotionProductById(item.getProductId(), promotionProductList);
        PmsSkuStock skuStock = getOriginalPrice(promotionProduct,item.getProductSkuId());
        amount = amount.add(skuStock.getPrice().multiply(new BigDecimal(item.getQuantity())));
    }
    return amount;
}
 
Example #25
Source File: PortalProductDao.java    From mall with Apache License 2.0 votes vote down vote up
List<PromotionProduct> getPromotionProductList(@Param("ids") List<Long> ids); 
Example #26
Source File: PortalProductDao.java    From macrozheng-mall with MIT License votes vote down vote up
List<PromotionProduct> getPromotionProductList(@Param("ids") List<Long> ids); 
Example #27
Source File: PortalProductDao.java    From macrozheng with Apache License 2.0 votes vote down vote up
List<PromotionProduct> getPromotionProductList(@Param("ids") List<Long> ids); 
Example #28
Source File: PortalProductDao.java    From mall-swarm with Apache License 2.0 votes vote down vote up
List<PromotionProduct> getPromotionProductList(@Param("ids") List<Long> ids);