Commit a2947ee5 by 姜海波

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

# Conflicts:
#	shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
parents a0d2a199 2d05dbc7
......@@ -144,6 +144,7 @@ public class OrderAdapter {
.name(OldOrderAccountType.FULL_DISTRIBUTION_FEE.getDesc())
.price(deliveryAmount-discountDeliveryAmount)
.accountType(QueryOrderAccountType.FULL_DISTRIBUTION_FEE)
.accountId(shoppingCartGoodsDto.getDiscountDeliveryActivityCode())
.build();
orderAccountDtos.add(createOrderAccountDto);
......@@ -614,6 +615,7 @@ public class OrderAdapter {
.name(OldOrderAccountType.FULL_DISTRIBUTION_FEE.getDesc())
.price(deliveryAmount-discountDeliveryAmount)
.accountType(QueryOrderAccountType.FULL_DISTRIBUTION_FEE)
.accountId(shoppingCartGoodsDto.getDiscountDeliveryActivityCode())
.build();
orderAccountDtos.add(createOrderAccountDto);
......
......@@ -89,6 +89,12 @@ public class ShoppingCartGoodsDto {
@Builder.Default
private Boolean isDiscountDelivery = false;
/**
* 配送费活动号
*
*/
private String discountDeliveryActivityCode;
@Data
public static class CartGoodsDetailDto {
/**
......
......@@ -115,6 +115,12 @@ public class ShoppingCartGoodsDto {
@Builder.Default
private Boolean isDiscountDelivery = false;
/**
* 配送费活动号
*
*/
private String discountDeliveryActivityCode;
@Data
public static class CartGoodsDetailDto {
......
......@@ -119,7 +119,10 @@ public class ShoppingCartGoodsResponseVo extends ShoppingCartGoodsBaseResponseV
*/
private String deliveryDiscountDesc;
/**
* 减免后配送费
*/
private String discountDeliveryActivityCode;
}
......@@ -638,14 +638,11 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
updateShoppingCartGoodsApportion(shoppingCartGoodsResponseVo, calculationDiscountResult, shoppingCartGoodsDto, premiumExchangeActivity, shoppingCartInfoRequestVo);
getNeedCardAmount(shoppingCartInfoRequestVo, shoppingCartGoodsDto);
/*Long packAmount = shoppingCartGoodsResponseVo.getPackAmount() == null ? 0 : shoppingCartGoodsResponseVo.getPackAmount();
shoppingCartGoodsDto.setTotalAmount(shoppingCartGoodsDto.getTotalAmount() - packAmount);
shoppingCartGoodsDto.setOriginalTotalAmount(shoppingCartGoodsDto.getOriginalTotalAmount() - packAmount);
shoppingCartGoodsDto.setPackageAmount(packAmount);*/
shoppingCartGoodsDto.setDeliveryAmount(shoppingCartGoodsResponseVo.getDeliveryAmount());
shoppingCartGoodsDto.setDiscountDeliveryAmount(shoppingCartGoodsResponseVo.getDiscountDeliveryAmount());
shoppingCartGoodsDto.setThresholdAmount(shoppingCartGoodsResponseVo.getThresholdAmount());
shoppingCartGoodsDto.setIsDiscountDelivery(shoppingCartGoodsResponseVo.getIsDiscountDelivery());
shoppingCartGoodsDto.setDiscountDeliveryActivityCode(shoppingCartGoodsResponseVo.getDiscountDeliveryActivityCode());
return ResponseUtil.success(shoppingCartGoodsDto);
}
......@@ -1007,6 +1004,17 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
*/
if(BusinessTypeEnum.SAAS_DELIVERY.getCode().equals(menuType)) {
List<ActivityTypeEnum> activityTypeEnums = new LinkedList<>();
activityTypeEnums.add(ActivityTypeEnum.TYPE_14);
ActivityQueryResponseDto activityQueryResponseDto = activityService.queryActivityByType(activityQueryDto, activityTypeEnums, null);
ActivityResponseDto activityResponse =null;
if (activityQueryResponseDto != null &&activityQueryResponseDto.getResult()!=null && activityQueryResponseDto.getResult().size()>0) {
activityResponse = activityQueryResponseDto.getResult().get(0);
shoppingCartGoodsResponseVo.setDiscountDeliveryActivityCode(activityResponse.getActivityCode());
}
ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Discount discount=null;
if (calculationDiscountResult != null && CollectionUtils.isNotEmpty(calculationDiscountResult.getDiscounts())) {
Optional<ActivityCalculationDiscountResponseDto.CalculationDiscountResult.Discount> discountop
......@@ -1020,32 +1028,28 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
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));
shoppingCartGoodsResponseVo.setDeliveryDiscountDesc(String.format(desc, discount.getThresholdAmount().doubleValue() / 100
, (calculationDiscountResult.getDeliveryAmount().doubleValue() - calculationDiscountResult.getDistributionFee().doubleValue()) / 100));
}else{
String desc = DELIVERY_DISCOUNT_DESC2;
shoppingCartGoodsResponseVo.setDeliveryDiscountDesc(String.format(desc, discount.getThresholdAmount() / 100));
shoppingCartGoodsResponseVo.setDeliveryDiscountDesc(String.format(desc, discount.getThresholdAmount().doubleValue() / 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);
ActivityQueryResponseDto activityQueryResponseDto = activityService.queryActivityByType(activityQueryDto, activityTypeEnums, null);
if (activityQueryResponseDto != null &&activityQueryResponseDto.getResult()!=null && activityQueryResponseDto.getResult().size()>0) {
if (activityResponse!=null) {
ActivityResponseDto activityResponse = activityQueryResponseDto.getResult().get(0);
BenefitBeanDto beanDto=activityResponse.getBenefits().get(0);
if(beanDto.getBenefitType() == 1||beanDto.getDiscountAmount()>=deliveryAmount){
String desc = DELIVERY_DISCOUNT_DESC2;
shoppingCartGoodsResponseVo.setDeliveryDiscountDesc(String.format(desc, beanDto.getThresholdAmount() /100 ));
shoppingCartGoodsResponseVo.setDeliveryDiscountDesc(String.format(desc, beanDto.getThresholdAmount().doubleValue() /100 ));
}else{
String desc = DELIVERY_DISCOUNT_DESC1;
shoppingCartGoodsResponseVo.setDeliveryDiscountDesc(String.format(desc, beanDto.getThresholdAmount() /100 ,beanDto.getDiscountAmount() / 100));
shoppingCartGoodsResponseVo.setDeliveryDiscountDesc(String.format(desc, beanDto.getThresholdAmount().doubleValue() /100 ,beanDto.getDiscountAmount().doubleValue() / 100));
}
shoppingCartGoodsResponseVo.setDeliveryAmount(deliveryAmount);
......@@ -1054,7 +1058,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
}else{
String desc = DELIVERY_DISCOUNT_DESC3;
shoppingCartGoodsResponseVo.setDeliveryDiscountDesc(String.format(desc, deliveryAmount / 100));
shoppingCartGoodsResponseVo.setDeliveryDiscountDesc(String.format(desc, deliveryAmount.doubleValue() / 100));
shoppingCartGoodsResponseVo.setDeliveryAmount(deliveryAmount);
shoppingCartGoodsResponseVo.setDiscountDeliveryAmount(deliveryAmount);
shoppingCartGoodsResponseVo.setIsDiscountDelivery(false);
......@@ -1062,97 +1066,6 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
}
}
// 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