Commit 34585ea5 by huiyang.chen

Merge branch '2020/09/24-运费券-huiyang' into develop

# Conflicts:
#	shopping-cart-application-service/src/main/java/cn/freemud/enums/ResponseResult.java
#	shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/ShoppingCartMCoffeeServiceImpl.java
parents 292604b8 ec204ff4
......@@ -88,6 +88,10 @@ public class ActivityCalculationDiscountRequestDto {
*/
private String goodsCode;
/**
* 商品核销券号
*/
private String couponCode;
/**
* 商品ID
*/
private String goodsId;
......
......@@ -115,4 +115,18 @@ public class ShoppingCartInfoRequestVo extends BaseRequestVo {
private String ruleId;
}
/**
* 万能券、咖啡月卡券
*/
private String coffeeCouponCode;
/**
*
*/
private String coffeeCouponName;
/**
* 咖啡月卡适用商品id
*/
private List<String> goodsId;
}
......@@ -88,6 +88,7 @@ public enum ResponseResult {
SHOPPING_CART_COUPON_USED("44021", "优惠券已加入餐盘"),
SHOPPING_CART_GOODS_COUPON_CAN_NOT_USE("44022", "已加入同样优惠券,第二张暂不可用"),
SHOPPING_CART_LIMIT_ADD("44025", "加购数量超过限制"),
SHOPPING_CART_GOODS_CHECK_ERROR("44023", "当前餐盘中没有可用券的饮品"),
/**
* 订单状态码
......
package cn.freemud.service.impl.mcoffee;
import cn.freemud.adapter.ActivityAdapter;
import cn.freemud.adapter.ShoppingCartConvertAdapter;
import cn.freemud.base.entity.BaseResponse;
import cn.freemud.constant.ShoppingCartConstant;
import cn.freemud.entities.dto.*;
......@@ -323,6 +322,49 @@ public class ShoppingCartMCoffeeServiceImpl {
cartGoodsList = checkCartGoods(partnerId, storeId, orderType, menuType, shoppingCartGoodsResponseVo, cartGoodsList);
// 重新存储最新购物车
assortmentSdkService.setShoppingCart(partnerId, storeId, userId, cartGoodsList, sessionId, "", shoppingCartBaseService);
//校验咖啡月卡的商品是否在购物车里面存在
List<String> goodsId = shoppingCartInfoRequestVo.getGoodsId();
if (CollectionUtils.isNotEmpty(goodsId) && StringUtils.isNotEmpty(shoppingCartInfoRequestVo.getCoffeeCouponCode())){
List<CartGoods> cartGoodsListNew =new ArrayList<>();
for (String id: goodsId ) {
List<CartGoods> CartGoodsList = cartGoodsList.stream().filter(t -> t.getGoodsId().equals(id)).collect(Collectors.toList());
cartGoodsListNew.addAll(CartGoodsList);
}
if (CollectionUtils.isEmpty(cartGoodsListNew)){
return ResponseUtil.error(ResponseResult.SHOPPING_CART_GOODS_CHECK_ERROR);
}
CartGoods cartGoods = cartGoodsListNew.stream().max(Comparator.comparing(CartGoods::getOriginalPrice)).get();
if (cartGoods != null){
//修改购物车商品数量
UpdateShoppingCartGoodsQtyRequestVo vo =new UpdateShoppingCartGoodsQtyRequestVo();
vo.setCartGoodsUid(cartGoods.getCartGoodsUid());
vo.setPartnerId(partnerId);
vo.setQty(cartGoods.getQty() - 1);
vo.setOrderType(orderType);
vo.setShopId(storeId);
vo.setMenuType(menuType);
vo.setChannelType(shoppingCartInfoRequestVo.getChannelType());
vo.setAppId(appId);
updateGoodsQty(vo);
//添加商品券到购物车
MCoffeeAddGoodsRequestVo requestVo =new MCoffeeAddGoodsRequestVo();
requestVo.setAppId(appId);
requestVo.setCategoryName("DSPQ");
requestVo.setCategoryName(shoppingCartInfoRequestVo.getCoffeeCouponName());
requestVo.setChannelType(shoppingCartInfoRequestVo.getChannelType());
requestVo.setMenuType(menuType);
requestVo.setOrderType(orderType);
requestVo.setPartnerId(partnerId);
requestVo.setQty(1);
requestVo.setShopId(storeId);
requestVo.setSkuId(cartGoods.getSkuId());
requestVo.setSpuId(cartGoods.getSpuId());
requestVo.setCouponCode(shoppingCartInfoRequestVo.getCoffeeCouponCode());
addGoods(requestVo);
}
}
cartGoodsList = assortmentSdkService.getShoppingCart(partnerId, storeId, userId, sessionId, "", shoppingCartBaseService);
}
// 当couponCode不为空时,需参与价格计算
List<ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon> coupons = getCoupon(couponCode, null, cartGoodsList);
......
......@@ -366,6 +366,8 @@ public class CalculationServiceImpl {
calculationDiscountGoods.setGoodsQuantity(goodsQuantity);
calculationDiscountGoods.setOriginalPrice(originalPrice);
calculationDiscountGoods.setMemberDiscount(memberDiscount);
//新增咖啡月卡券券号
calculationDiscountGoods.setCouponCode(cartGoods.getCouponCode());
//可选搭配
......@@ -419,11 +421,8 @@ public class CalculationServiceImpl {
shoppingCartGoodsResponseVo.setTotalAmount(shoppingCartGoodsResponseVo.getTotalAmount() + totalPackgeAmount);
shoppingCartGoodsResponseVo.setNewPackAmount(totalPackgeAmount);
shoppingCartGoodsResponseVo.setTotalDiscountAmount(calculationDiscount == null ? 0L : calculationDiscount.getTotalDiscountAmount());
if(calculationDiscount != null && calculationDiscount.getDeliveryAmount() == null){
shoppingCartGoodsResponseVo.setDeliveryAmount(deliveryAmount);
shoppingCartGoodsResponseVo.setDiscountDeliveryAmount(deliveryAmount);
}
shoppingCartGoodsResponseVo.setDeliveryAmount(deliveryAmount);
shoppingCartGoodsResponseVo.setDiscountDeliveryAmount(calculationDiscount.getDistributionFee());
}
}
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