Commit 81da00f8 by huiyang.chen

Merge branch 'feature/20201112_fixbug-getCouponNameByCode_yu.sun' into qa

# Conflicts:
#	assortment-ordercenter-sdk/pom.xml
#	order-application-service/pom.xml
#	shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/ShoppingCartMCoffeeServiceImpl.java
parents 5046dd48 7ddf01d5
...@@ -143,3 +143,4 @@ ...@@ -143,3 +143,4 @@
| 2.0.15.RELEASE | 麦咖啡加料 | 徐康 | 2020-10-30 | | 2.0.15.RELEASE | 麦咖啡加料 | 徐康 | 2020-10-30 |
| 2.0.16.RELEASE | 麦咖啡问题修复 | 徐康 | 2020-11-09 | | 2.0.16.RELEASE | 麦咖啡问题修复 | 徐康 | 2020-11-09 |
| 2.1.2.RELEASE | 活动扣减库存 | 缪晖 | 2020-11-11 | | 2.1.2.RELEASE | 活动扣减库存 | 缪晖 | 2020-11-11 |
| 2.1.3-RELEASE | 退款增加自动退款配置的null判断 | 刘鹏飞 | 2020-11-12 |
...@@ -20,6 +20,7 @@ import cn.freemud.interceptor.ServiceException; ...@@ -20,6 +20,7 @@ import cn.freemud.interceptor.ServiceException;
import cn.freemud.service.ActivityService; import cn.freemud.service.ActivityService;
import cn.freemud.service.CouponService; import cn.freemud.service.CouponService;
import cn.freemud.service.impl.AssortmentSdkService; import cn.freemud.service.impl.AssortmentSdkService;
import cn.freemud.service.impl.CouponServiceImpl;
import cn.freemud.service.impl.FullSubtractionActivityServiceImpl; import cn.freemud.service.impl.FullSubtractionActivityServiceImpl;
import cn.freemud.service.impl.mcoffee.calculation.CalculationServiceImpl; import cn.freemud.service.impl.mcoffee.calculation.CalculationServiceImpl;
import cn.freemud.service.impl.mcoffee.calculation.CouponDiscountCalculation; import cn.freemud.service.impl.mcoffee.calculation.CouponDiscountCalculation;
...@@ -110,7 +111,8 @@ public class ShoppingCartMCoffeeServiceImpl { ...@@ -110,7 +111,8 @@ public class ShoppingCartMCoffeeServiceImpl {
private OrderSdkService orderSdkService; private OrderSdkService orderSdkService;
@Autowired @Autowired
private StoreCenterService storeCenterService; private StoreCenterService storeCenterService;
@Autowired
private CouponServiceImpl couponService;
@Autowired @Autowired
private ProductClient productClient; private ProductClient productClient;
@Autowired @Autowired
...@@ -183,6 +185,14 @@ public class ShoppingCartMCoffeeServiceImpl { ...@@ -183,6 +185,14 @@ public class ShoppingCartMCoffeeServiceImpl {
addCartGoods.setSpuName(addShoppingCartGoodsRequestVo.getGroupName()); addCartGoods.setSpuName(addShoppingCartGoodsRequestVo.getGroupName());
addCartGoods.setName(addShoppingCartGoodsRequestVo.getGroupName()); addCartGoods.setName(addShoppingCartGoodsRequestVo.getGroupName());
} }
//根据券号获取券名称
String couponName = "";
if (StringUtils.isNotEmpty(couponCode)){
CustomerInfoVo userLoginInfoDto = getCustomerInfoVo(sessionId);
couponName = getCouponNameByCode(couponCode,userLoginInfoDto,
BusinessTypeEnum.getByType(addShoppingCartGoodsRequestVo.getMenuType()).getCode(),storeId);
addCartGoods.setCouponName(couponName);
}
// 如果购物车中有商品券,则当前添加的商品是特价商品时,需要提示“已选商品券,与其他优惠商品不同享,商品将恢复原价” // 如果购物车中有商品券,则当前添加的商品是特价商品时,需要提示“已选商品券,与其他优惠商品不同享,商品将恢复原价”
boolean haveCouponProduct = oldCartGoodsList.parallelStream().anyMatch(k -> k.getCartGoodsUid().startsWith(CommonsConstant.COUPON_PREFIX)); boolean haveCouponProduct = oldCartGoodsList.parallelStream().anyMatch(k -> k.getCartGoodsUid().startsWith(CommonsConstant.COUPON_PREFIX));
...@@ -235,6 +245,7 @@ public class ShoppingCartMCoffeeServiceImpl { ...@@ -235,6 +245,7 @@ public class ShoppingCartMCoffeeServiceImpl {
} }
List<ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon> coupons = new ArrayList<>(); List<ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon> coupons = new ArrayList<>();
if (CollectionUtils.isNotEmpty(oldCartGoodsList)) { if (CollectionUtils.isNotEmpty(oldCartGoodsList)) {
Boolean isContinue =true;
for (CartGoods cartGoods : oldCartGoodsList) { for (CartGoods cartGoods : oldCartGoodsList) {
//购物车已存在商品券 //购物车已存在商品券
if (StringUtils.isNotBlank(cartGoods.getCouponCode())) { if (StringUtils.isNotBlank(cartGoods.getCouponCode())) {
...@@ -246,6 +257,19 @@ public class ShoppingCartMCoffeeServiceImpl { ...@@ -246,6 +257,19 @@ public class ShoppingCartMCoffeeServiceImpl {
//使用券的是,如果购物车已经存在这个券,先清除,再添加 //使用券的是,如果购物车已经存在这个券,先清除,再添加
cartGoods.setQty(0); cartGoods.setQty(0);
} }
if (StringUtils.isNotEmpty(goodsId) && StringUtils.isNotEmpty(couponCode) && goodsId.equals(cartGoods.getSkuId()) && StringUtils.isBlank(cartGoods.getCouponCode()) && isContinue) {
// 如果购物车商品存在商品规格,替换时复制规格信息
if (CollectionUtils.isNotEmpty(cartGoods.getSpecialExtra())) {
addShoppingCartGoodsRequestVo.setSpecialExtra(cartGoods.getSpecialExtra());
}
if (cartGoods.getQty() > 1 ){
cartGoods.setQty(cartGoods.getQty() - 1);
}else {
//如果购物车存在相同的商品,则先删除购物车商品,在新增商品券购物车行
cartGoods.setQty(0);
}
isContinue= false;
}
//同样商品券不能使用 //同样商品券不能使用
/* if (StringUtils.isNotEmpty(couponCode)&& StringUtils.isNotEmpty(cartGoods.getCouponCode()) && goodsId.equals(cartGoods.getGoodsId())) { /* if (StringUtils.isNotEmpty(couponCode)&& StringUtils.isNotEmpty(cartGoods.getCouponCode()) && goodsId.equals(cartGoods.getGoodsId())) {
throw new ServiceException(ResponseResult.SHOPPING_CART_GOODS_COUPON_CAN_NOT_USE); throw new ServiceException(ResponseResult.SHOPPING_CART_GOODS_COUPON_CAN_NOT_USE);
...@@ -1827,4 +1851,25 @@ public class ShoppingCartMCoffeeServiceImpl { ...@@ -1827,4 +1851,25 @@ public class ShoppingCartMCoffeeServiceImpl {
} }
return requestVo; return requestVo;
} }
private String getCouponNameByCode(String couponCode,CustomerInfoVo userInfo,String menuType,String storeId){
String couponName = "";
String partnerId = userInfo.getPartnerId();
GetMemberCouponRequestVo requestVo = new GetMemberCouponRequestVo();
requestVo.setPartnerId(partnerId);
requestVo.setCouponCode(couponCode);
requestVo.setStoreId(storeId);
GetCouponDetailResponseDto couponDetailResponseDto = couponService.getMemberCoupon(requestVo);
if (couponDetailResponseDto == null || !couponDetailResponseDto.getResult().equals(ResponseCodeConstant.RESPONSE_SUCCESS_1) || CollectionUtils.isEmpty(couponDetailResponseDto.getDetails())) {
return couponName;
}
if (null != couponDetailResponseDto && CollectionUtils.isNotEmpty(couponDetailResponseDto.getDetails())
&& null != couponDetailResponseDto.getDetails().get(0)){
couponName = couponDetailResponseDto.getDetails().get(0).getActive().getActiveName();
}
return couponName;
}
} }
\ 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