Commit b33ad0f4 by 刘鹏飞

coco半价行小料半价显示

parent e667eee5
......@@ -277,7 +277,28 @@ public class CocoShoppingCartRelationServiceImpl implements ShoppingCartRelation
List<CartGoods> halfProduct = new ArrayList<>();
for(int x = 0 ; x < products.size() ; x ++){
CartGoods product = products.get(x);
// 小料信息
if(goodsDiscountsMap.get(product.getCartGoodsUid()) == null){
continue;
}
List<CalculationSharingDiscountResponseDto.CalculationDiscountResult.Goods.SmallMaterial> smallMaterial = goodsDiscountsMap.get(product.getCartGoodsUid()).getSmallMaterial();
Integer smallMaterialOriTotal = 0;
Long halfSmallMaterialOriTotal = 0L;
for(CalculationSharingDiscountResponseDto.CalculationDiscountResult.Goods.SmallMaterial sm : smallMaterial){
List<CalculationSharingDiscountResponseDto.CalculationDiscountResult.Goods.GoodsDiscount> smDiscounts = sm.getDiscounts();
for(CalculationSharingDiscountResponseDto.CalculationDiscountResult.Goods.GoodsDiscount smDiscount : smDiscounts){
if(ObjectUtils.equals(smDiscount.getType(),ActivityTypeEnum.TYPE_53.getCode())){
halfSmallMaterialOriTotal = halfSmallMaterialOriTotal + smDiscount.getSignleDiscount();
}
}
smallMaterialOriTotal = smallMaterialOriTotal + sm.getOriginalPrice();
}
// 商品的单价 = 商品单价+小料单价
Long originalPrice = (new Long(smallMaterialOriTotal) + product.getOriginalPrice());
// 要添加的半价行数量,该字段从促销返回
Integer num = 0;
// 商品优惠的金额
......@@ -292,7 +313,9 @@ public class CocoShoppingCartRelationServiceImpl implements ShoppingCartRelation
// 第二件优惠活动,在点餐页需要给优惠商品单独显示一行
// 复制商品加到购物车
discountAmount = discount.getDiscount();
Long newPrice = product.getOriginalPrice() - discountAmount;
// 现单价 = 商品原单价+小料原单价-商品现单价小料现单价
Long newPrice = originalPrice - discountAmount - halfSmallMaterialOriTotal;
// 构建半价行
CartGoods cartGoods = buildNewLine(product,ActivityTypeEnum.TYPE_53.getCode(),1,newPrice,product.getGoodsId());
halfProduct.add(cartGoods);
......@@ -328,19 +351,8 @@ public class CocoShoppingCartRelationServiceImpl implements ShoppingCartRelation
product.setGoodsId(null);
}
ApiLog.info("coco小料",goodsDiscountsMap.get(product.getCartGoodsUid()),goodsDiscountsMap.get(product.getCartGoodsUid()).getSmallMaterial());
// 小料信息
if(goodsDiscountsMap.get(product.getCartGoodsUid()) == null){
continue;
}
List<CalculationSharingDiscountResponseDto.CalculationDiscountResult.Goods.SmallMaterial> smallMaterial = goodsDiscountsMap.get(product.getCartGoodsUid()).getSmallMaterial();
Integer smallMaterialOriTotal = 0;
for(CalculationSharingDiscountResponseDto.CalculationDiscountResult.Goods.SmallMaterial sm : smallMaterial){
smallMaterialOriTotal = smallMaterialOriTotal + sm.getOriginalPrice();
}
// 商品的单价 = 商品单价+小料单价
product.setOriginalPrice(new Long(smallMaterialOriTotal) + product.getOriginalPrice());
product.setOriginalPrice(originalPrice);
// 商品现单价 = 商品现单价+小料现单价
product.setFinalPrice(new Long(smallMaterialOriTotal) + product.getFinalPrice());
......
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