Commit 3cc464e7 by chongfu.liang

商品券

parent 07c79717
......@@ -379,6 +379,7 @@ public abstract class AbstractAddGoodsService implements AddGoodsService {
calCostBO.setChanged(addGoodsToShoppingCartBO.getChanged());
calCostBO.setShoppingCartContext(addGoodsToShoppingCartBO.getShoppingCartContext());
calCostBO.setToastMsg(addGoodsToShoppingCartBO.getToastMsg());
calCostBO.setValidCouponMap(addGoodsToShoppingCartBO.getValidCouponMap());
calCostBO.setIsMember(addGoodsToShoppingCartBO.getIsMember());
return calCostBO;
......@@ -438,6 +439,7 @@ public abstract class AbstractAddGoodsService implements AddGoodsService {
return before;
}
CalculationDiscountBO calculationDiscountBO = promotionManager.calculationDiscount(before.getGetCalculationDiscountBO(), baseRequestDTO.getManagerService().getPromotionService());
calculationDiscountBO.getResult().setValidCouponMap(before.getValidCouponMap());
before.setCalculationDiscountBO(calculationDiscountBO);
return before;
......
......@@ -380,6 +380,7 @@ public class AbstractApportionService implements GetShoppingCartGoodsApportionSe
return before;
}
CalculationDiscountBO calculationDiscountBO = promotionManager.calculationDiscount(before.getGetCalculationDiscountBO(), baseRequestDTO.getManagerService().getPromotionService());
calculationDiscountBO.getResult().setValidCouponMap(before.getValidCouponMap());
before.setCalculationDiscountBO(calculationDiscountBO);
return before;
......
......@@ -308,6 +308,7 @@ public abstract class AbstractUpdateGoodsQtyService implements UpdateGoodsQtySer
calCostBO.setCartGoods(addGoodsToShoppingCartBO.getCartGoods());
calCostBO.setChanged(addGoodsToShoppingCartBO.getChanged());
calCostBO.setShoppingCartContext(addGoodsToShoppingCartBO.getShoppingCartContext());
calCostBO.setValidCouponMap(addGoodsToShoppingCartBO.getValidCouponMap());
calCostBO.setToastMsg(addGoodsToShoppingCartBO.getToastMsg());
calCostBO.setIsMember(addGoodsToShoppingCartBO.getIsMember());
return calCostBO;
......@@ -363,6 +364,7 @@ public abstract class AbstractUpdateGoodsQtyService implements UpdateGoodsQtySer
return before;
}
CalculationDiscountBO calculationDiscountBO = promotionManager.calculationDiscount(before.getGetCalculationDiscountBO(), baseRequestDTO.getManagerService().getPromotionService());
calculationDiscountBO.getResult().setValidCouponMap(before.getValidCouponMap());
before.setCalculationDiscountBO(calculationDiscountBO);
return before;
......
......@@ -101,6 +101,7 @@ public class PlatformAddGoodsService extends AbstractAddGoodsService {
} else {
calCostBO.setGetCalculationDiscountBO(calculationSharingDiscountRequestDto);
}
calCostBO.setValidCouponMap(discountResultBO.getValidCouponMap());
calCostBO.setCartGoods(discountResultBO.getCartGoods());
return calCostBO;
}
......
......@@ -10,16 +10,17 @@ import cn.freemud.demo.entities.bo.promotion.GetCalculationDiscountBO;
import cn.freemud.demo.entities.bo.store.GetStoreBO;
import cn.freemud.demo.entities.bo.store.GetStoreInfoBO;
import cn.freemud.demo.entities.bo.store.StoreInfoBO;
import cn.freemud.demo.manager.coupon.CouponService;
import cn.freemud.demo.manager.customer.CustomerManager;
import cn.freemud.demo.manager.product.ProductManager;
import cn.freemud.demo.manager.store.StoreManager;
import cn.freemud.demo.service.impl.AbstractUpdateGoodsQtyService;
import cn.freemud.entities.dto.CheckSpqInfoRequestDto;
import cn.freemud.entities.dto.CheckSpqInfoResponseDto;
import cn.freemud.entities.dto.StoreDeliveryInfoDto;
import cn.freemud.entities.vo.ActivityClassifyCouponBean;
import cn.freemud.entities.vo.CartGoods;
import cn.freemud.enums.*;
import cn.freemud.service.CouponService;
import cn.freemud.utils.PropertyConvertUtil;
import cn.freemud.utils.WebUtil;
import com.freemud.application.sdk.api.log.LogThreadLocal;
......@@ -107,6 +108,7 @@ public class PlatformUpdateGoodsQtyService extends AbstractUpdateGoodsQtyService
} else {
calCostBO.setGetCalculationDiscountBO(calculationSharingDiscountRequestDto);
}
calCostBO.setValidCouponMap(discountResultBO.getValidCouponMap());
calCostBO.setCartGoods(discountResultBO.getCartGoods());
return calCostBO;
}
......@@ -169,17 +171,25 @@ public class PlatformUpdateGoodsQtyService extends AbstractUpdateGoodsQtyService
List<CartGoods> cartGoodsList = addGoodsToShoppingCartBO.getCartGoods();
int cartSize = cartGoodsList.size() - 1;
// 校验商品券
HashMap<String, CheckSpqInfoResponseDto> validCouponMap = new HashMap<>(16);
for (int i = cartSize; i >= 0; i--){
CartGoods cartGoods = cartGoodsList.get(i);
if (cartGoods.getCartGoodsUid().startsWith(CommonsConstant.COUPON_PREFIX)){
GetCheckSpqBo getCheckSpqBo = new GetCheckSpqBo(baseRequestDTO.getPartnerId(), cartGoods.getCartGoodsUid().substring(CommonsConstant.COUPON_PREFIX.length()),
baseRequestDTO.getShopId(), baseRequestDTO.getMenuType(), cartGoods.getSpuId(), cartGoods.getSkuId(), baseRequestDTO.getManagerService().getProductService());
CheckSpqBO checkSpqBO = couponService.checkSpq(getCheckSpqBo);
if (checkSpqBO == null){
String spqId = cartGoods.getCartGoodsUid().substring(CommonsConstant.COUPON_PREFIX.length());
CheckSpqInfoRequestDto checkSpqInfoRequestDto = new CheckSpqInfoRequestDto(baseRequestDTO.getPartnerId(), baseRequestDTO.getShopId(), spqId, baseRequestDTO.getMenuType());
CheckSpqInfoResponseDto checkSpqInfo = null;
if (GoodsTypeEnum.HG_COUPON_GOODS.getGoodsType().equals(cartGoods.getGoodsType())) {
checkSpqInfo = couponService.checkSpqInfo(checkSpqInfoRequestDto, cartGoods.getSkuId());
} else {
checkSpqInfo = couponService.checkSpqInfo(checkSpqInfoRequestDto);
}
if (checkSpqInfo == null){
cartGoodsList.remove(i);
} else {
cartGoods.setCouponProductPrice(checkSpqBO.getProductPrice());
cartGoods.setActivityCode(checkSpqBO.getDetails().getActiveCode());
cartGoods.setCouponProductPrice(checkSpqInfo.getPrice());
cartGoods.setActivityCode(checkSpqInfo.getActiveCode());
validCouponMap.put(spqId, checkSpqInfo);
addGoodsToShoppingCartBO.setValidCouponMap(validCouponMap);
}
}
}
......
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