Commit b54c6e27 by 姜海波

Merge remote-tracking branch 'remotes/origin/feature-2020/2/10-1.9.15-免配送费二期-海波' into qa

parents bcb67bcb 402b6035
......@@ -1005,73 +1005,154 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
/**
* 满额减配送费
*/
if(BusinessTypeEnum.SAAS_DELIVERY.getCode().equals(menuType)) {
ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Discount discount=null;
if (calculationDiscountResult != null && CollectionUtils.isNotEmpty(calculationDiscountResult.getDiscounts())) {
Optional<ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Discount> discount
Optional<ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Discount> discountop
= calculationDiscountResult.getDiscounts().stream()
.filter(discount1 -> {
return ActivityTypeEnum.TYPE_14.getCode().equals(discount1.getType());
})
.findFirst();
discount=discountop.orElseGet(() -> {return null ;});
}
if(discount!=null){
if(calculationDiscountResult.getDistributionFee()>0){
String desc = DELIVERY_DISCOUNT_DESC1;
shoppingCartGoodsResponseVo.setDeliveryDiscountDesc(String.format(desc, discount.getThresholdAmount() / 100
, (calculationDiscountResult.getDeliveryAmount() - calculationDiscountResult.getDistributionFee()) / 100));
}else{
String desc = DELIVERY_DISCOUNT_DESC2;
shoppingCartGoodsResponseVo.setDeliveryDiscountDesc(String.format(desc, discount.getThresholdAmount() / 100));
}
shoppingCartGoodsResponseVo.setDeliveryAmount(calculationDiscountResult.getDeliveryAmount());
shoppingCartGoodsResponseVo.setDiscountDeliveryAmount(calculationDiscountResult.getDistributionFee());
shoppingCartGoodsResponseVo.setThresholdAmount(discount.getThresholdAmount());
shoppingCartGoodsResponseVo.setIsDiscountDelivery(true);
}else{
List<ActivityTypeEnum> activityTypeEnums = new LinkedList<>();
activityTypeEnums.add(ActivityTypeEnum.TYPE_14);
if (discount.isPresent()) {
if(calculationDiscountResult.getDistributionFee()>0){
String desc = DELIVERY_DISCOUNT_DESC1;
shoppingCartGoodsResponseVo.setDeliveryDiscountDesc(String.format(desc, discount.get().getThresholdAmount() / 100
, (calculationDiscountResult.getDeliveryAmount() - calculationDiscountResult.getDistributionFee()) / 100));
}else{
String desc = DELIVERY_DISCOUNT_DESC2;
shoppingCartGoodsResponseVo.setDeliveryDiscountDesc(String.format(desc, discount.get().getThresholdAmount() / 100));
}
shoppingCartGoodsResponseVo.setDeliveryAmount(calculationDiscountResult.getDeliveryAmount());
shoppingCartGoodsResponseVo.setDiscountDeliveryAmount(calculationDiscountResult.getDistributionFee());
shoppingCartGoodsResponseVo.setThresholdAmount(discount.get().getThresholdAmount());
shoppingCartGoodsResponseVo.setIsDiscountDelivery(true);
} else {
List<ActivityTypeEnum> activityTypeEnums = new LinkedList<>();
activityTypeEnums.add(ActivityTypeEnum.TYPE_14);
ActivityQueryResponseDto activityQueryResponseDto = activityService.queryActivityByType(activityQueryDto, activityTypeEnums, null);
if (activityQueryResponseDto != null &&activityQueryResponseDto.getResult()!=null && activityQueryResponseDto.getResult().size()>0) {
ActivityResponseDto activityResponse = activityQueryResponseDto.getResult().get(0);
BenefitBeanDto beanDto=activityResponse.getBenefits().get(0);
if(beanDto.getDiscountAmount()>=(calculationDiscountResult.getDeliveryAmount())){
String desc = DELIVERY_DISCOUNT_DESC2;
shoppingCartGoodsResponseVo.setDeliveryDiscountDesc(String.format(desc, beanDto.getThresholdAmount() /100 ));
}else{
String desc = DELIVERY_DISCOUNT_DESC1;
shoppingCartGoodsResponseVo.setDeliveryDiscountDesc(String.format(desc, beanDto.getThresholdAmount() /100 ,beanDto.getDiscountAmount() / 100));
}
ActivityQueryResponseDto activityQueryResponseDto = activityService.queryActivityByType(activityQueryDto, activityTypeEnums, null);
if (activityQueryResponseDto != null &&activityQueryResponseDto.getResult()!=null && activityQueryResponseDto.getResult().size()>0) {
shoppingCartGoodsResponseVo.setDeliveryAmount(calculationDiscountResult.getDeliveryAmount());
shoppingCartGoodsResponseVo.setDiscountDeliveryAmount(calculationDiscountResult.getDeliveryAmount());
shoppingCartGoodsResponseVo.setIsDiscountDelivery(false);
ActivityResponseDto activityResponse = activityQueryResponseDto.getResult().get(0);
BenefitBeanDto beanDto=activityResponse.getBenefits().get(0);
if(beanDto.getDiscountAmount()>=deliveryAmount){
String desc = DELIVERY_DISCOUNT_DESC2;
shoppingCartGoodsResponseVo.setDeliveryDiscountDesc(String.format(desc, beanDto.getThresholdAmount() /100 ));
}else{
String desc = DELIVERY_DISCOUNT_DESC3;
shoppingCartGoodsResponseVo.setDeliveryDiscountDesc(String.format(desc, calculationDiscountResult.getDeliveryAmount() / 100));
shoppingCartGoodsResponseVo.setDeliveryAmount(calculationDiscountResult.getDeliveryAmount());
shoppingCartGoodsResponseVo.setDiscountDeliveryAmount(calculationDiscountResult.getDeliveryAmount());
shoppingCartGoodsResponseVo.setIsDiscountDelivery(false);
String desc = DELIVERY_DISCOUNT_DESC1;
shoppingCartGoodsResponseVo.setDeliveryDiscountDesc(String.format(desc, beanDto.getThresholdAmount() /100 ,beanDto.getDiscountAmount() / 100));
}
shoppingCartGoodsResponseVo.setDeliveryAmount(deliveryAmount);
shoppingCartGoodsResponseVo.setDiscountDeliveryAmount(deliveryAmount);
shoppingCartGoodsResponseVo.setIsDiscountDelivery(false);
}else{
String desc = DELIVERY_DISCOUNT_DESC3;
shoppingCartGoodsResponseVo.setDeliveryDiscountDesc(String.format(desc, deliveryAmount / 100));
shoppingCartGoodsResponseVo.setDeliveryAmount(deliveryAmount);
shoppingCartGoodsResponseVo.setDiscountDeliveryAmount(deliveryAmount);
shoppingCartGoodsResponseVo.setIsDiscountDelivery(false);
}
} else {
String desc = DELIVERY_DISCOUNT_DESC3;
shoppingCartGoodsResponseVo.setDeliveryDiscountDesc(String.format(desc, deliveryAmount / 100));
shoppingCartGoodsResponseVo.setDeliveryAmount(deliveryAmount);
shoppingCartGoodsResponseVo.setDiscountDeliveryAmount(deliveryAmount);
shoppingCartGoodsResponseVo.setIsDiscountDelivery(false);
}
}
// if(BusinessTypeEnum.SAAS_DELIVERY.getCode().equals(menuType)) {
// if (calculationDiscountResult != null && CollectionUtils.isNotEmpty(calculationDiscountResult.getDiscounts())) {
//
// Optional<ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Discount> discount
// = calculationDiscountResult.getDiscounts().stream()
// .filter(discount1 -> {
// return ActivityTypeEnum.TYPE_14.getCode().equals(discount1.getType());
// })
// .findFirst();
//
// if (discount.isPresent()) {
//
// if(calculationDiscountResult.getDistributionFee()>0){
// String desc = DELIVERY_DISCOUNT_DESC1;
// shoppingCartGoodsResponseVo.setDeliveryDiscountDesc(String.format(desc, discount.get().getThresholdAmount() / 100
// , (calculationDiscountResult.getDeliveryAmount() - calculationDiscountResult.getDistributionFee()) / 100));
// }else{
// String desc = DELIVERY_DISCOUNT_DESC2;
// shoppingCartGoodsResponseVo.setDeliveryDiscountDesc(String.format(desc, discount.get().getThresholdAmount() / 100));
// }
// shoppingCartGoodsResponseVo.setDeliveryAmount(calculationDiscountResult.getDeliveryAmount());
// shoppingCartGoodsResponseVo.setDiscountDeliveryAmount(calculationDiscountResult.getDistributionFee());
// shoppingCartGoodsResponseVo.setThresholdAmount(discount.get().getThresholdAmount());
// shoppingCartGoodsResponseVo.setIsDiscountDelivery(true);
// } else {
//
// List<ActivityTypeEnum> activityTypeEnums = new LinkedList<>();
// activityTypeEnums.add(ActivityTypeEnum.TYPE_14);
//
// ActivityQueryResponseDto activityQueryResponseDto = activityService.queryActivityByType(activityQueryDto, activityTypeEnums, null);
// if (activityQueryResponseDto != null &&activityQueryResponseDto.getResult()!=null && activityQueryResponseDto.getResult().size()>0) {
//
// ActivityResponseDto activityResponse = activityQueryResponseDto.getResult().get(0);
// BenefitBeanDto beanDto=activityResponse.getBenefits().get(0);
//
// if(beanDto.getDiscountAmount()>=(calculationDiscountResult.getDeliveryAmount())){
// String desc = DELIVERY_DISCOUNT_DESC2;
// shoppingCartGoodsResponseVo.setDeliveryDiscountDesc(String.format(desc, beanDto.getThresholdAmount() /100 ));
// }else{
// String desc = DELIVERY_DISCOUNT_DESC1;
// shoppingCartGoodsResponseVo.setDeliveryDiscountDesc(String.format(desc, beanDto.getThresholdAmount() /100 ,beanDto.getDiscountAmount() / 100));
// }
//
// shoppingCartGoodsResponseVo.setDeliveryAmount(calculationDiscountResult.getDeliveryAmount());
// shoppingCartGoodsResponseVo.setDiscountDeliveryAmount(calculationDiscountResult.getDeliveryAmount());
// shoppingCartGoodsResponseVo.setIsDiscountDelivery(false);
//
// }else{
// String desc = DELIVERY_DISCOUNT_DESC3;
// shoppingCartGoodsResponseVo.setDeliveryDiscountDesc(String.format(desc, calculationDiscountResult.getDeliveryAmount() / 100));
// shoppingCartGoodsResponseVo.setDeliveryAmount(calculationDiscountResult.getDeliveryAmount());
// shoppingCartGoodsResponseVo.setDiscountDeliveryAmount(calculationDiscountResult.getDeliveryAmount());
// shoppingCartGoodsResponseVo.setIsDiscountDelivery(false);
// }
//
//
//
// }
// } else {
//
// List<ActivityTypeEnum> activityTypeEnums = new LinkedList<>();
// activityTypeEnums.add(ActivityTypeEnum.TYPE_14);
//
// ActivityQueryResponseDto activityQueryResponseDto = activityService.queryActivityByType(activityQueryDto, activityTypeEnums, null);
// if (activityQueryResponseDto != null &&activityQueryResponseDto.getResult()!=null && activityQueryResponseDto.getResult().size()>0) {
//
// ActivityResponseDto activityResponse = activityQueryResponseDto.getResult().get(0);
// BenefitBeanDto beanDto=activityResponse.getBenefits().get(0);
//
// if(beanDto.getDiscountAmount()>=deliveryAmount){
// String desc = DELIVERY_DISCOUNT_DESC2;
// shoppingCartGoodsResponseVo.setDeliveryDiscountDesc(String.format(desc, beanDto.getThresholdAmount() /100 ));
// }else{
// String desc = DELIVERY_DISCOUNT_DESC1;
// shoppingCartGoodsResponseVo.setDeliveryDiscountDesc(String.format(desc, beanDto.getThresholdAmount() /100 ,beanDto.getDiscountAmount() / 100));
// }
//
// shoppingCartGoodsResponseVo.setDeliveryAmount(deliveryAmount);
// shoppingCartGoodsResponseVo.setDiscountDeliveryAmount(deliveryAmount);
// shoppingCartGoodsResponseVo.setIsDiscountDelivery(false);
//
// }else{
// String desc = DELIVERY_DISCOUNT_DESC3;
// shoppingCartGoodsResponseVo.setDeliveryDiscountDesc(String.format(desc, deliveryAmount / 100));
// shoppingCartGoodsResponseVo.setDeliveryAmount(deliveryAmount);
// shoppingCartGoodsResponseVo.setDiscountDeliveryAmount(deliveryAmount);
// shoppingCartGoodsResponseVo.setIsDiscountDelivery(false);
// }
// }
// }
}
/**
......
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