Commit 48162bcf by 周晓航

新增夜间配送参数nightDistributionFee,调用促销算价处理

Signed-off-by: 周晓航 <xiaohang.zhou@freemud.com>
parent b13bbc6d
......@@ -336,15 +336,15 @@ public abstract class AbstractShoppingCartImpl implements ShoppingCartNewService
public CalculationDiscountResult getCalculationDiscountResult(String menuType
, String partnerId, String storeId, String userId, String appId, String wxappid, Integer orderType, boolean isMember
, List<CartGoods> cartGoodsList, List<ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon> coupons
, List<ShoppingCartInfoRequestVo.SendGoods> sendGoodsList, String receiveId, Long deliveryAmount){
, List<ShoppingCartInfoRequestVo.SendGoods> sendGoodsList, String receiveId, Long deliveryAmount, long nightDistributionFee){
// 获取优惠信息
CalculationDiscountResult calculationDiscountResult=null;
//外卖场景下 查询门店配送信息
if(BusinessTypeEnum.SAAS_DELIVERY.getCode().equals(menuType)){
calculationDiscountResult = this.getActivityCalculationDiscountResponse(partnerId, storeId, userId, appId, orderType,isMember, cartGoodsList, coupons, sendGoodsList,BusinessTypeEnum.getByType(menuType).getCode(),deliveryAmount,null, null);
calculationDiscountResult = this.getActivityCalculationDiscountResponse(partnerId, storeId, userId, appId, orderType,isMember, cartGoodsList, coupons, sendGoodsList,BusinessTypeEnum.getByType(menuType).getCode(),deliveryAmount,null, null, nightDistributionFee);
}else{
calculationDiscountResult = this.getActivityCalculationDiscountResponse(partnerId, storeId, userId, appId, orderType,isMember, cartGoodsList, coupons, sendGoodsList,BusinessTypeEnum.getByType(menuType).getCode(),null,null, null);
calculationDiscountResult = this.getActivityCalculationDiscountResponse(partnerId, storeId, userId, appId, orderType,isMember, cartGoodsList, coupons, sendGoodsList,BusinessTypeEnum.getByType(menuType).getCode(),null,null, null,0L);
}
return calculationDiscountResult;
......@@ -359,7 +359,7 @@ public abstract class AbstractShoppingCartImpl implements ShoppingCartNewService
* @param shoppingCartGoodsResponseVo
*/
public void updateShoppingCartGoodsDiscount(CouponPromotionVO couponPromotionVO, ActivityQueryDto activityQueryDto, CalculationDiscountResult calculationDiscountResult, List<CartGoods> cartGoodsList
, ShoppingCartGoodsResponseVo shoppingCartGoodsResponseVo, ShoppingCartInfoRequestVo shoppingCartInfoRequestVo, UserLoginInfoDto userLoginInfoDto,String menuType,Long deliveryAmount) {
, ShoppingCartGoodsResponseVo shoppingCartGoodsResponseVo, ShoppingCartInfoRequestVo shoppingCartInfoRequestVo, UserLoginInfoDto userLoginInfoDto,String menuType,Long deliveryAmount,long nightDistributionFee) {
//默认计算优惠
DefaultPromotionService defaultPromotionService = (DefaultPromotionService) PromotionFactory.getPromotionService(ShoppingCartPromotionEnum.DEFAULT_PROMOTION);
defaultPromotionService.updateShoppingCartGoodsDiscount(couponPromotionVO, activityQueryDto, calculationDiscountResult, cartGoodsList, shoppingCartGoodsResponseVo, userLoginInfoDto, shoppingCartInfoRequestVo);
......@@ -476,7 +476,8 @@ public abstract class AbstractShoppingCartImpl implements ShoppingCartNewService
shoppingCartGoodsResponseVo.setThresholdAmount(discount.getThresholdAmount());
shoppingCartGoodsResponseVo.setIsDiscountDelivery(true);
}else{
// fisherman 老算价, deliverAmount 不包含 nightDistributionFee 但是页面需要展示总价 所以 这里相加一下 做处理
Long deliverAmountNew = deliveryAmount + nightDistributionFee;
if (activityResponse!=null) {
if(beanDto.getBenefitType() == 1){
......
......@@ -3,6 +3,7 @@ package cn.freemud.service;
import cn.freemud.adapter.ActivityAdapter;
import cn.freemud.base.entity.BaseResponse;
import cn.freemud.constant.ShoppingCartConstant;
import cn.freemud.entities.ExtraDeliveryDto;
import cn.freemud.entities.dto.ActivityResponseDto;
import cn.freemud.entities.dto.GetMemberInfoRequestDto;
import cn.freemud.entities.dto.GetMemberInfoResponseVo;
......@@ -97,7 +98,8 @@ public interface ShoppingCartNewService {
boolean isMember,
List<CartGoods> cartGoodsList,
List<ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon> coupons,
List<ShoppingCartInfoRequestVo.SendGoods> sendGoodsList, String menuType, Long distributionFee, Integer bizType, Integer accountFlag);
List<ShoppingCartInfoRequestVo.SendGoods> sendGoodsList, String menuType, Long distributionFee, Integer bizType, Integer accountFlag,
long nightDistributionFee);
List<CartGoods> updateCartGoodsLegal(CartGoods cartGoods, String userId, ShoppingCartGoodsBaseResponseVo shoppingCartGoodsResponseVo, AddShoppingCartGoodsRequestVo addShoppingCartGoodsRequestVo, List<CartGoods> oldAllCartGoodsList);
......@@ -317,4 +319,14 @@ public interface ShoppingCartNewService {
};
BaseResponse getV3Promotion(BaseRequestVo request);
default long getNightDistributionFee(List<ExtraDeliveryDto> deliveryAmountList){
if (CollectionUtils.isEmpty(deliveryAmountList)) {
return 0L;
}
return deliveryAmountList.stream()
.filter(s -> s.getType() != ExtraDeliveryDto.TYPE_DEFAULT)
.mapToLong(ExtraDeliveryDto::getDeliveryAmount)
.sum();
}
}
......@@ -640,7 +640,7 @@ public class ShoppingCartMallServiceImpl implements ShoppingCartNewService {
@Override
public CalculationDiscountResult getActivityCalculationDiscountResponse(
String partnerId, String storeId, String userId, String appId, Integer orderType, boolean isMember, List<CartGoods> cartGoodsList,
List<ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon> coupons, List<ShoppingCartInfoRequestVo.SendGoods> sendGoodsList, String menuType, Long distributionFee, Integer bizType, Integer accountFlag) {
List<ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon> coupons, List<ShoppingCartInfoRequestVo.SendGoods> sendGoodsList, String menuType, Long distributionFee, Integer bizType, Integer accountFlag,long nightDistributionFee) {
return null;
}
......
......@@ -434,7 +434,7 @@ public class ShoppingCartMealServiceImpl implements ShoppingCartNewService {
if (CollectionUtils.isEmpty(cartGoodsList)) {
return;
}
CalculationDiscountResult calculationDiscountResult = this.getActivityCalculationDiscountResponse(partnerId, storeId, userId, appId, orderType, isMember, cartGoodsList, new ArrayList<>(), new ArrayList<>(), BusinessTypeEnum.SAAS_MALL.getCode(), 0L,null, null);
CalculationDiscountResult calculationDiscountResult = this.getActivityCalculationDiscountResponse(partnerId, storeId, userId, appId, orderType, isMember, cartGoodsList, new ArrayList<>(), new ArrayList<>(), BusinessTypeEnum.SAAS_MALL.getCode(), 0L,null, null,0L);
if(calculationDiscountResult == null) {
return;
}
......@@ -563,7 +563,7 @@ public class ShoppingCartMealServiceImpl implements ShoppingCartNewService {
@Override
public CalculationDiscountResult getActivityCalculationDiscountResponse(String partnerId, String storeId, String userId, String appId, Integer orderType, boolean isMember,
List<CartGoods> cartGoodsList, List<ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon> coupons, List<ShoppingCartInfoRequestVo.SendGoods> sendGoodsList,String menuType,Long distributionFee,Integer bizType, Integer accountFlag) {
List<CartGoods> cartGoodsList, List<ActivityCalculationDiscountRequestDto.CalculationDiscountCoupon> coupons, List<ShoppingCartInfoRequestVo.SendGoods> sendGoodsList,String menuType,Long distributionFee,Integer bizType, Integer accountFlag,long nightDistributionFee) {
ActivityCalculationDiscountRequestDto activityCalculationDiscountRequestDto = getActivityCalculationDiscountRequestDto(partnerId, storeId, userId, appId, orderType);
List<ActivityCalculationDiscountRequestDto.CalculationDiscountGoods> calculationDiscountGoodsList = new ArrayList<>();
cartGoodsList = cartGoodsList.stream().filter(t -> !isWeightProduct(t)).collect(Collectors.toList());
......@@ -579,6 +579,7 @@ public class ShoppingCartMealServiceImpl implements ShoppingCartNewService {
activityCalculationDiscountRequestDto.setCoupons(coupons);
activityCalculationDiscountRequestDto.setOrgIds(commonService.getOrgIdsForCoupon(partnerId, storeId));
activityCalculationDiscountRequestDto.setDistributionFee(distributionFee);
activityCalculationDiscountRequestDto.setNightDistributionFee(nightDistributionFee);
activityCalculationDiscountRequestDto.setIsMember(isMember);
ActivityCalculationDiscountResponseDto activityCalculationDiscountResponseDto = activityClient.calculationDiscount(activityCalculationDiscountRequestDto);
// try {
......
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