Commit b0ed6274 by huiyang.chen

Merge branch '2020/11/2-商品券bug-huiyang' into qa

parents 6aa9d9c9 72c21db0
......@@ -172,7 +172,12 @@ public class ShoppingCartMCoffeeServiceImpl {
}
//商品券已添加情况校验
List<ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon> coupons = checkGoodsCoupon(oldCartGoodsList, operationType, couponCode,goodsId);
List<CartGoods.MaterialGoods> productMaterialList =new ArrayList<>();
List<ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon> coupons = checkGoodsCoupon(oldCartGoodsList, operationType, couponCode,goodsId, productMaterialList);
if (CollectionUtils.isNotEmpty(productMaterialList)){
// 复制加料信息
addShoppingCartGoodsRequestVo.setProductMaterialList(adapterProductMateria(productMaterialList));
}
CartGoods addCartGoods = convent2CartGoods(addShoppingCartGoodsRequestVo, goodsId ,vo);
setClassificationAndPrice(addCartGoods, productBeanListSpuClass);
if(StringUtils.isNotEmpty(addShoppingCartGoodsRequestVo.getGroupName())) {
......@@ -201,6 +206,18 @@ public class ShoppingCartMCoffeeServiceImpl {
return ResponseUtil.success(shoppingCartGoodsResponseVo);
}
private List<MaterialRequestVo> adapterProductMateria(List<CartGoods.MaterialGoods> productMaterialList){
List<MaterialRequestVo> materialRequestVos = new ArrayList<>();
for (CartGoods.MaterialGoods materialGoods: productMaterialList) {
MaterialRequestVo vo =new MaterialRequestVo();
vo.setSpuId(materialGoods.getSpuId());
vo.setCustomerCode(materialGoods.getCustomerCode());
vo.setGroupId(materialGoods.getGroupId());
}
return materialRequestVos;
}
private MCoffeeProductIdsVo validCoupon(String partnerId, String storeId, String spuId, List<Long> productIds, String menuType) {
CheckSpqInfoRequestDto checkSpqInfoRequestDto = new CheckSpqInfoRequestDto(partnerId, storeId, spuId.substring(CommonsConstant.COUPON_PREFIX.length()), menuType);
CouponService couponService = SDKCommonBaseContextWare.getBean(CouponService.class);
......@@ -218,7 +235,7 @@ public class ShoppingCartMCoffeeServiceImpl {
}
private List<ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon> checkGoodsCoupon(List<CartGoods> oldCartGoodsList, Integer operationType, String couponCode,String goodsId) {
private List<ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon> checkGoodsCoupon(List<CartGoods> oldCartGoodsList, Integer operationType, String couponCode,String goodsId, List<CartGoods.MaterialGoods> productMaterialList) {
if (operationType != null && operationType == 1 && StringUtils.isBlank(couponCode)) {
throw new ServiceException(ResponseResult.PARAMETER_MISSING, "商品券券号为空");
}
......@@ -239,6 +256,9 @@ public class ShoppingCartMCoffeeServiceImpl {
cartGoods.setQty(0);
}
if (StringUtils.isNotEmpty(goodsId) && StringUtils.isNotEmpty(couponCode) && goodsId.equals(cartGoods.getSkuId()) && StringUtils.isBlank(cartGoods.getCouponCode())) {
if (CollectionUtils.isNotEmpty(cartGoods.getProductMaterialList())) {
productMaterialList.addAll(cartGoods.getProductMaterialList());
}
if (cartGoods.getQty() > 1 ){
cartGoods.setQty(cartGoods.getQty() - 1);
}else {
......
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