Commit 5fe42420 by 周晓航

发券商品 替换成普通商品 测试

parent a090c59a
......@@ -2922,7 +2922,6 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
throw new ServiceException(ResponseResult.SHOPPING_CART_SHOP_ID_NOT_EMPTY);
}
if (replaceGoodsRequestVo.getShopId().equals(replaceGoodsRequestVo.getOldShopId())) {
// 门店号 一致 不作处理 测试结束 需要放开
return ResponseUtil.success();
}
......@@ -2944,7 +2943,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
// 删除购物车中的不匹配商品 加购信息不包含营销促销活动和优惠券,价格以切换后的当前门店为准
List<Integer> excludeType = Arrays.asList(
// 换购券
//GoodsTypeEnum.HG_COUPON_GOODS.getGoodsType(),
GoodsTypeEnum.HG_COUPON_GOODS.getGoodsType(),
// 万能券商品
GoodsTypeEnum.ALL_COUPON_GOODS.getGoodsType(),
// 虚拟商品
......@@ -2952,14 +2951,22 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
// 异常商品
GoodsTypeEnum.EXCEPTION_GOODS.getGoodsType());
List<CartGoods> excludeGoods = allCartGoodsList.stream().filter(cartGoods -> !excludeType.contains(cartGoods.getGoodsType())).collect(toList());
LogUtil.info("replaceGoodsType begin ", null ,JSON.toJSONString(excludeGoods));
List<CartGoods> HGcouponGoods = allCartGoodsList.stream().filter(cartGoods -> cartGoods.getGoodsType().equals(GoodsTypeEnum.HG_COUPON_GOODS.getGoodsType())).collect(toList());
if (!CollectionUtils.isEmpty(HGcouponGoods)) {
// 替换 换购券的商品 变成普通商品 --> 优惠券商品变成 普通商品带到其他门店去
List<CartGoods> goodsList = new ArrayList<>(HGcouponGoods.size());
HGcouponGoods.forEach(cartGoods -> {
goodsList.add(replaceGoodsType(cartGoods));
});
excludeGoods.addAll(goodsList);
}
LogUtil.info("replaceGoodsType end ", null ,JSON.toJSONString(excludeGoods));
if (CollectionUtils.isEmpty(excludeGoods)) {
return ResponseUtil.error(ResponseResult.SHOPPING_CART_REPLACE_GOODS_AND_CLEAR);
}
if (replaceGoodsRequestVo.getHook()!=null) {
testDemo(excludeGoods,replaceGoodsRequestVo,userId);
return ResponseUtil.success();
}
boolean fullReplace = true;
if (excludeGoods.size()!=allCartGoodsList.size()) {
......@@ -3033,6 +3040,30 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
return ResponseUtil.success();
}
/**
* 替换 优惠券商品 变成普通商品
* @param excludeGood
*/
private CartGoods replaceGoodsType(CartGoods excludeGood) {
CartGoods ret = new CartGoods();
String skuId = excludeGood.getSkuId();
// 优惠券换购商品 spuid:88608274545893050894 "goodsId": "spq88608274545893050894"
ret.setGoodsId(skuId);
ret.setAddCartTime(System.currentTimeMillis());
ret.setSpuId(skuId);
ret.setSkuId(skuId);
ret.setQty(excludeGood.getQty());
ret.setCouponCode(null);
ret.setGoodsType(GoodsTypeEnum.SPU_GOODS.getGoodsType());
ret.setExtra(excludeGood.getExtra());
ret.setNodeId(excludeGood.getNodeId());
ret.setCategoryName(excludeGood.getCategoryName());
ret.setProductComboList(excludeGood.getProductComboList());
ret.setProductGroupList(excludeGood.getProductGroupList());
ret.setProductMaterialList(excludeGood.getProductMaterialList());
return ret;
}
private void testDemo(List<CartGoods> excludeGoods, ShopGoodsReplaceVo replaceGoodsRequestVo, String userId ) {
String partnerId = replaceGoodsRequestVo.getPartnerId();
String storeId = replaceGoodsRequestVo.getShopId();
......
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