Commit 4fcc0db1 by 徐康

餐具商品

parent 7cf8e9e4
......@@ -2122,6 +2122,9 @@ public class OrderAdapter {
//套餐
productVo.setParentProductId(productBean.getParentProductId());
productVo.setProductType(productBean.getProductType());
if(ProductTypeEnum.TABLEWARE_PRODUCT.getCode().equals(productBean.getProductType())) {
productVo.setIsTableware(true);
}
productVo.setUnit(productBean.getUnit());
productVo.setWeight(productBean.getWeight() != null ? productBean.getWeight().doubleValue() : 0);
return productVo;
......@@ -2438,7 +2441,11 @@ public class OrderAdapter {
createOrderProductDemoDto.setPicture(cartGoodsDetailDto.getPicture());
createOrderProductDemoDto.setAddInfo(cartGoodsDetailDto.getAttributeNames());
createOrderProductDemoDto.setDiscountId(cartGoodsDetailDto.getCouponCode());
if(!cartGoodsDetailDto.getIsTableware()) {
createOrderProductDemoDto.setProductType(productType);
} else {
createOrderProductDemoDto.setProductType(ProductTypeEnum.TABLEWARE_PRODUCT.getCode());
}
createOrderProductDemoDto.setParentProductId(cartGoodsDetailDto.getParentProductId());
createOrderProductDemoDto.setIsFixedProduct(cartGoodsDetailDto.getIsFixedProduct());
createOrderProductDemoDto.setCustomerCode(cartGoodsDetailDto.getCustomerCode());
......
......@@ -197,6 +197,10 @@ public class ShoppingCartGoodsDto {
*/
private boolean isStockLimit;
/**
* 是否餐具商品
*/
private Boolean isTableware = false;
/**
* 商品重量
*/
private Double weight;
......
......@@ -128,6 +128,11 @@ public class ProductVo {
private Integer productType;
/**
* 是否餐具商品
*/
private Boolean isTableware = false;
/**
* 商品单位
*/
private String unit;
......
......@@ -33,6 +33,7 @@ import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.util.*;
......@@ -45,6 +46,9 @@ public class ShoppingCartConvertAdapter {
private static final String ATTRIBUTEID = "attributeId";
private static final String ATTRIBUTENAME = "attributeName";
@Value("${mccafe.tableware.skuId}")
private String mcCafeTablewareSkuId;
public ShoppingCartGoodsDto.CartGoodsDetailDto getCartGoodsDetailDto(CreateOrderVo.PremiumExchangeActivity.Product product, GetProductsVo getProductsVo, String goodsId, ActivityCalculationDiscountResponseDto.CalculationDiscountResult.SendActivity.SendGoods sendGoods) {
ShoppingCartGoodsDto.CartGoodsDetailDto cartGoodsDetailDto = new ShoppingCartGoodsDto.CartGoodsDetailDto();
cartGoodsDetailDto.setOriginalPrice(getProductsVo.getFinalPrice());
......@@ -119,6 +123,9 @@ public class ShoppingCartConvertAdapter {
cartGoodsDetailDto.setSpecialExtra(cartGoods.getSpecialExtra());
cartGoodsDetailDto.setClassificationId(cartGoods.getClassificationId());
cartGoodsDetailDto.setClassificationName(cartGoods.getClassificationName());
if(mcCafeTablewareSkuId.equals(cartGoods.getSkuId())) {
cartGoodsDetailDto.setIsTableWare(true);
}
if (GoodsTypeEnum.SET_MEAL_GOODS.getGoodsType().equals(cartGoods.getGoodsType())) {
cartGoodsDetailDto.setProductType(ProductType.SETMEAL.getCode());
} else if (cartGoods.isWeightType()) {
......
......@@ -218,6 +218,10 @@ public class ShoppingCartGoodsDto {
*/
private boolean isStockLimit;
/**
* 是否餐具商品
*/
private Boolean isTableWare = false;
/**
* 商品货号
*/
private String productCode;
......
......@@ -164,6 +164,10 @@ public class CartGoods {
*/
private boolean isStockLimit;
/**
* 是否餐具商品
*/
private Boolean isTableWare = false;
/**
* 第三方商品编码
*/
private String customerCode;
......
......@@ -119,6 +119,8 @@ public class ShoppingCartMCoffeeServiceImpl {
private String mcCafeUniversalCouponCode;
@Value("${mccafe.pay.card.fee}")
private String payCardFee;
@Value("${mccafe.tableware.skuId}")
private String mcCafeTablewareSkuId;
/**
* 添加商品、超值加购、商品券
......@@ -169,6 +171,13 @@ public class ShoppingCartMCoffeeServiceImpl {
if (CollectionUtils.isEmpty(oldCartGoodsList)) {
oldCartGoodsList = new ArrayList<>();
}
if(mcCafeTablewareSkuId.equals(skuId)) {
for(CartGoods cartGoods : oldCartGoodsList) {
if(mcCafeTablewareSkuId.equals(cartGoods.getSkuId())) {
return ResponseUtil.error(ResponseResult.SHOPPING_CART_ADD_ERROR.getCode(), "不能重复添加餐具商品");
}
}
}
//商品券已添加情况校验
List<ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon> coupons = checkGoodsCoupon(oldCartGoodsList, operationType, couponCode,goodsId, addShoppingCartGoodsRequestVo);
......@@ -1391,6 +1400,21 @@ public class ShoppingCartMCoffeeServiceImpl {
if (CollectionUtils.isNotEmpty(reduceGoods)) {
allCartGoodsList.addAll(reduceGoods);
}
//如果是餐具商品,则放到最后
if (CollectionUtils.isNotEmpty(allCartGoodsList)) {
int size = allCartGoodsList.size();
for(int i=0;i<size;i++) {
if(allCartGoodsList.get(i).getSkuId().equals(mcCafeTablewareSkuId) && i != size-1) {
CartGoods cartGoods = allCartGoodsList.get(i);
cartGoods.setIsTableWare(true);
allCartGoodsList.remove(i);
allCartGoodsList.add(cartGoods);
i--;
}
}
}
return allCartGoodsList;
}
......
......@@ -24,3 +24,4 @@ management.security.enabled=false
management.health.rabbit.enabled=false
mccafe.tableware.skuId=12345
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment