Commit b003b0e6 by 胡博文

解决空指针问题

parent baba3b2b
...@@ -585,8 +585,12 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -585,8 +585,12 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
private void newCalculationUpdateCouponStatus(String userId, String partnerId, String storeId, Integer bizType, CartGoods cartGoods, List<CartGoods> cartGoodsList, ActivityCalculationDiscountResponseDto.CalculationDiscountResult discountResult) { private void newCalculationUpdateCouponStatus(String userId, String partnerId, String storeId, Integer bizType, CartGoods cartGoods, List<CartGoods> cartGoodsList, ActivityCalculationDiscountResponseDto.CalculationDiscountResult discountResult) {
List<ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Discount> discounts = discountResult.getDiscounts(); List<ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Discount> discounts = null;
if (null != discountResult) {
discounts = discountResult.getDiscounts();
}
List<ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Discount> mnCouponDiscount = null; List<ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Discount> mnCouponDiscount = null;
if (CollectionUtils.isNotEmpty(discounts)) { if (CollectionUtils.isNotEmpty(discounts)) {
mnCouponDiscount = discounts.stream().filter(discount -> ActivityTypeEnum.TYPE_330.getCode().equals(discount.getType())).collect(toList()); mnCouponDiscount = discounts.stream().filter(discount -> ActivityTypeEnum.TYPE_330.getCode().equals(discount.getType())).collect(toList());
} }
......
...@@ -155,6 +155,7 @@ public class CalculationSharingDiscountService { ...@@ -155,6 +155,7 @@ public class CalculationSharingDiscountService {
coupon.setCode(checkSpqInfo.getCouponCode()); coupon.setCode(checkSpqInfo.getCouponCode());
coupon.setActivityCode(checkSpqInfo.getActiveCode()); coupon.setActivityCode(checkSpqInfo.getActiveCode());
ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon calculationDiscountCoupon = coupons.stream().filter(p -> coupon.getActivityCode().equals(p.getActivityCode()) && coupon.getCode().equals(p.getCode())).findFirst().orElse(null); ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon calculationDiscountCoupon = coupons.stream().filter(p -> coupon.getActivityCode().equals(p.getActivityCode()) && coupon.getCode().equals(p.getCode())).findFirst().orElse(null);
// 0是非结算页,1为结算页
accountFlag = accountFlag == null ? 0 : accountFlag; accountFlag = accountFlag == null ? 0 : accountFlag;
if (calculationDiscountCoupon == null) { if (calculationDiscountCoupon == null) {
if (GoodsTypeEnum.BUY_M_SEND_N_COUPON.getGoodsType().equals(cartGoods.getGoodsType()) && accountFlag == 1 ){ if (GoodsTypeEnum.BUY_M_SEND_N_COUPON.getGoodsType().equals(cartGoods.getGoodsType()) && accountFlag == 1 ){
......
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