Commit 3cc464e7 by chongfu.liang

商品券

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