Commit b72946f4 by chongfu.liang

商品券多次添加fix

parent a9acc7c4
...@@ -37,4 +37,7 @@ public class CheckSpqInfoResponseDto { ...@@ -37,4 +37,7 @@ public class CheckSpqInfoResponseDto {
*/ */
private Integer couponType; private Integer couponType;
private List<CartGoods.CartGoodsExtra> extras; private List<CartGoods.CartGoodsExtra> extras;
private Boolean isMultiCoupon;
} }
...@@ -119,7 +119,7 @@ public interface ShoppingCartNewService { ...@@ -119,7 +119,7 @@ public interface ShoppingCartNewService {
, String couponCode , String couponCode
, List<Long> productIds , List<Long> productIds
, String menuType , String menuType
, CouponProductDto couponProductDto) { , CouponProductDto couponProductDto, Integer couponQty) {
String spuId2; String spuId2;
CheckSpqInfoRequestDto checkSpqInfoRequestDto = new CheckSpqInfoRequestDto(partnerId, storeId, couponCode, menuType); CheckSpqInfoRequestDto checkSpqInfoRequestDto = new CheckSpqInfoRequestDto(partnerId, storeId, couponCode, menuType);
CouponService couponService = SDKCommonBaseContextWare.getBean(CouponService.class); CouponService couponService = SDKCommonBaseContextWare.getBean(CouponService.class);
...@@ -127,6 +127,9 @@ public interface ShoppingCartNewService { ...@@ -127,6 +127,9 @@ public interface ShoppingCartNewService {
if (checkSpqInfoResponseDto == null) { if (checkSpqInfoResponseDto == null) {
throw new ServiceException(ResponseResult.SHOPPING_CART_COUPON_NOT_EXIST); throw new ServiceException(ResponseResult.SHOPPING_CART_COUPON_NOT_EXIST);
} }
if (!checkSpqInfoResponseDto.getIsMultiCoupon() && couponQty > 1) {
throw new ServiceException(ResponseResult.SHOPPING_CART_GOODS_COUPON_CAN_NOT_USE);
}
if (couponProductDto != null) { if (couponProductDto != null) {
couponProductDto.setType(checkSpqInfoResponseDto.getCouponType()); couponProductDto.setType(checkSpqInfoResponseDto.getCouponType());
} }
...@@ -152,7 +155,7 @@ public interface ShoppingCartNewService { ...@@ -152,7 +155,7 @@ public interface ShoppingCartNewService {
, List<Long> productIds , List<Long> productIds
, String menuType , String menuType
, String goodsId , String goodsId
, CouponProductDto couponProductDto) { , CouponProductDto couponProductDto, Integer couponQty) {
String spuId2; String spuId2;
CheckSpqInfoRequestDto checkSpqInfoRequestDto = new CheckSpqInfoRequestDto(partnerId, storeId, couponCode, menuType); CheckSpqInfoRequestDto checkSpqInfoRequestDto = new CheckSpqInfoRequestDto(partnerId, storeId, couponCode, menuType);
CouponService couponService = SDKCommonBaseContextWare.getBean(CouponService.class); CouponService couponService = SDKCommonBaseContextWare.getBean(CouponService.class);
...@@ -161,6 +164,9 @@ public interface ShoppingCartNewService { ...@@ -161,6 +164,9 @@ public interface ShoppingCartNewService {
if (checkSpqInfoResponseDto == null) { if (checkSpqInfoResponseDto == null) {
throw new ServiceException(ResponseResult.SHOPPING_CART_COUPON_MIX_NOT_EXIST); throw new ServiceException(ResponseResult.SHOPPING_CART_COUPON_MIX_NOT_EXIST);
} }
if (!checkSpqInfoResponseDto.getIsMultiCoupon() && couponQty > 1) {
throw new ServiceException(ResponseResult.SHOPPING_CART_GOODS_COUPON_CAN_NOT_USE);
}
productIds.add(Long.parseLong(checkSpqInfoResponseDto.getSkuId())); productIds.add(Long.parseLong(checkSpqInfoResponseDto.getSkuId()));
couponProductDto.setType(checkSpqInfoResponseDto.getCouponType()); couponProductDto.setType(checkSpqInfoResponseDto.getCouponType());
spuId2 = checkSpqInfoResponseDto.getSkuId(); spuId2 = checkSpqInfoResponseDto.getSkuId();
......
...@@ -750,6 +750,11 @@ public class CouponServiceImpl implements CouponService { ...@@ -750,6 +750,11 @@ public class CouponServiceImpl implements CouponService {
dto.setActiveCode(couponDetailResponseDto.getDetails().get(0).getActive().getActiveCode()); dto.setActiveCode(couponDetailResponseDto.getDetails().get(0).getActive().getActiveCode());
dto.setCouponName(couponDetailResponseDto.getDetails().get(0).getTitle()); dto.setCouponName(couponDetailResponseDto.getDetails().get(0).getTitle());
dto.setActivityName(couponDetailResponseDto.getDetails().get(0).getActive().getActiveName()); dto.setActivityName(couponDetailResponseDto.getDetails().get(0).getActive().getActiveName());
if (couponDetailResponseDto.getDetails().get(0).getActive().getMaxRedeemTimes() != null && couponDetailResponseDto.getDetails().get(0).getActive().getMaxRedeemTimes() > 1){
dto.setIsMultiCoupon(true);
} else {
dto.setIsMultiCoupon(false);
}
dto.setPrice(productsVo.getFinalPrice()); dto.setPrice(productsVo.getFinalPrice());
dto.setSpuId(productsVo.getSpuId()); dto.setSpuId(productsVo.getSpuId());
dto.setSpuName(productsVo.getSkuName()); dto.setSpuName(productsVo.getSkuName());
...@@ -912,6 +917,11 @@ public class CouponServiceImpl implements CouponService { ...@@ -912,6 +917,11 @@ public class CouponServiceImpl implements CouponService {
return null; return null;
} }
CheckSpqInfoResponseDto dto = new CheckSpqInfoResponseDto(); CheckSpqInfoResponseDto dto = new CheckSpqInfoResponseDto();
if (couponDetailResponseDto.getDetails().get(0).getActive().getMaxRedeemTimes() != null && couponDetailResponseDto.getDetails().get(0).getActive().getMaxRedeemTimes() > 1){
dto.setIsMultiCoupon(true);
} else {
dto.setIsMultiCoupon(false);
}
dto.setCouponCode(couponCode); dto.setCouponCode(couponCode);
dto.setActiveCode(couponActivityDetail.getActive().getActiveCode()); dto.setActiveCode(couponActivityDetail.getActive().getActiveCode());
dto.setCouponName(couponActivityDetail.getTitle()); dto.setCouponName(couponActivityDetail.getTitle());
......
...@@ -296,11 +296,11 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -296,11 +296,11 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
} else { } else {
//校验券是否有效 这里是新的商品券支持多商品及换购券 //校验券是否有效 这里是新的商品券支持多商品及换购券
if (StringUtils.isNotBlank(skuId)) { if (StringUtils.isNotBlank(skuId)) {
spuId2 = validCoupon(partnerId, storeId, couponCode, productIds, BusinessTypeEnum.getByType(addShoppingCartGoodsRequestVo.getMenuType()).getCode(), skuId, couponProductDto); spuId2 = validCoupon(partnerId, storeId, couponCode, productIds, BusinessTypeEnum.getByType(addShoppingCartGoodsRequestVo.getMenuType()).getCode(), skuId, couponProductDto, addShoppingCartGoodsRequestVo.getQty());
cartGoods.setGoodsId(spuId); cartGoods.setGoodsId(spuId);
} else { } else {
// 老版本商品券 // 老版本商品券
spuId2 = validCoupon(partnerId, storeId, couponCode, productIds, BusinessTypeEnum.getByType(addShoppingCartGoodsRequestVo.getMenuType()).getCode(), couponProductDto); spuId2 = validCoupon(partnerId, storeId, couponCode, productIds, BusinessTypeEnum.getByType(addShoppingCartGoodsRequestVo.getMenuType()).getCode(), couponProductDto, addShoppingCartGoodsRequestVo.getQty());
} }
} }
// 获取商品详细信息 // 获取商品详细信息
......
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