Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
order-group
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jenkins
order-group
Commits
402b6035
Commit
402b6035
authored
Mar 25, 2020
by
姜海波
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整配送费 逻辑
parent
bd2d8495
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
105 additions
and
24 deletions
+105
-24
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
+105
-24
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
View file @
402b6035
...
@@ -1006,32 +1006,32 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -1006,32 +1006,32 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
/**
/**
* 满额减配送费
* 满额减配送费
*/
*/
if
(
BusinessTypeEnum
.
SAAS_DELIVERY
.
getCode
().
equals
(
menuType
))
{
if
(
BusinessTypeEnum
.
SAAS_DELIVERY
.
getCode
().
equals
(
menuType
))
{
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Discount
discount
=
null
;
if
(
calculationDiscountResult
!=
null
&&
CollectionUtils
.
isNotEmpty
(
calculationDiscountResult
.
getDiscounts
()))
{
if
(
calculationDiscountResult
!=
null
&&
CollectionUtils
.
isNotEmpty
(
calculationDiscountResult
.
getDiscounts
()))
{
Optional
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Discount
>
discountop
Optional
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Discount
>
discount
=
calculationDiscountResult
.
getDiscounts
().
stream
()
=
calculationDiscountResult
.
getDiscounts
().
stream
()
.
filter
(
discount1
->
{
.
filter
(
discount1
->
{
return
ActivityTypeEnum
.
TYPE_14
.
getCode
().
equals
(
discount1
.
getType
());
return
ActivityTypeEnum
.
TYPE_14
.
getCode
().
equals
(
discount1
.
getType
());
})
})
.
findFirst
();
.
findFirst
();
discount
=
discountop
.
orElseGet
(()
->
{
return
null
;});
if
(
discount
.
isPresent
())
{
}
if
(
discount
!=
null
){
if
(
calculationDiscountResult
.
getDistributionFee
()>
0
){
if
(
calculationDiscountResult
.
getDistributionFee
()>
0
){
String
desc
=
DELIVERY_DISCOUNT_DESC1
;
String
desc
=
DELIVERY_DISCOUNT_DESC1
;
shoppingCartGoodsResponseVo
.
setDeliveryDiscountDesc
(
String
.
format
(
desc
,
discount
.
get
()
.
getThresholdAmount
()
/
100
shoppingCartGoodsResponseVo
.
setDeliveryDiscountDesc
(
String
.
format
(
desc
,
discount
.
getThresholdAmount
()
/
100
,
(
calculationDiscountResult
.
getDeliveryAmount
()
-
calculationDiscountResult
.
getDistributionFee
())
/
100
));
,
(
calculationDiscountResult
.
getDeliveryAmount
()
-
calculationDiscountResult
.
getDistributionFee
())
/
100
));
}
else
{
}
else
{
String
desc
=
DELIVERY_DISCOUNT_DESC2
;
String
desc
=
DELIVERY_DISCOUNT_DESC2
;
shoppingCartGoodsResponseVo
.
setDeliveryDiscountDesc
(
String
.
format
(
desc
,
discount
.
get
()
.
getThresholdAmount
()
/
100
));
shoppingCartGoodsResponseVo
.
setDeliveryDiscountDesc
(
String
.
format
(
desc
,
discount
.
getThresholdAmount
()
/
100
));
}
}
shoppingCartGoodsResponseVo
.
setDeliveryAmount
(
calculationDiscountResult
.
getDeliveryAmount
());
shoppingCartGoodsResponseVo
.
setDeliveryAmount
(
calculationDiscountResult
.
getDeliveryAmount
());
shoppingCartGoodsResponseVo
.
setDiscountDeliveryAmount
(
calculationDiscountResult
.
getDistributionFee
());
shoppingCartGoodsResponseVo
.
setDiscountDeliveryAmount
(
calculationDiscountResult
.
getDistributionFee
());
shoppingCartGoodsResponseVo
.
setThresholdAmount
(
discount
.
get
()
.
getThresholdAmount
());
shoppingCartGoodsResponseVo
.
setThresholdAmount
(
discount
.
getThresholdAmount
());
shoppingCartGoodsResponseVo
.
setIsDiscountDelivery
(
true
);
shoppingCartGoodsResponseVo
.
setIsDiscountDelivery
(
true
);
}
else
{
}
else
{
List
<
ActivityTypeEnum
>
activityTypeEnums
=
new
LinkedList
<>();
List
<
ActivityTypeEnum
>
activityTypeEnums
=
new
LinkedList
<>();
activityTypeEnums
.
add
(
ActivityTypeEnum
.
TYPE_14
);
activityTypeEnums
.
add
(
ActivityTypeEnum
.
TYPE_14
);
...
@@ -1041,7 +1041,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -1041,7 +1041,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
ActivityResponseDto
activityResponse
=
activityQueryResponseDto
.
getResult
().
get
(
0
);
ActivityResponseDto
activityResponse
=
activityQueryResponseDto
.
getResult
().
get
(
0
);
BenefitBeanDto
beanDto
=
activityResponse
.
getBenefits
().
get
(
0
);
BenefitBeanDto
beanDto
=
activityResponse
.
getBenefits
().
get
(
0
);
if
(
beanDto
.
getDiscountAmount
()>=(
calculationDiscountResult
.
getDeliveryAmount
())
){
if
(
beanDto
.
getDiscountAmount
()>=
deliveryAmount
){
String
desc
=
DELIVERY_DISCOUNT_DESC2
;
String
desc
=
DELIVERY_DISCOUNT_DESC2
;
shoppingCartGoodsResponseVo
.
setDeliveryDiscountDesc
(
String
.
format
(
desc
,
beanDto
.
getThresholdAmount
()
/
100
));
shoppingCartGoodsResponseVo
.
setDeliveryDiscountDesc
(
String
.
format
(
desc
,
beanDto
.
getThresholdAmount
()
/
100
));
}
else
{
}
else
{
...
@@ -1049,29 +1049,110 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -1049,29 +1049,110 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
shoppingCartGoodsResponseVo
.
setDeliveryDiscountDesc
(
String
.
format
(
desc
,
beanDto
.
getThresholdAmount
()
/
100
,
beanDto
.
getDiscountAmount
()
/
100
));
shoppingCartGoodsResponseVo
.
setDeliveryDiscountDesc
(
String
.
format
(
desc
,
beanDto
.
getThresholdAmount
()
/
100
,
beanDto
.
getDiscountAmount
()
/
100
));
}
}
shoppingCartGoodsResponseVo
.
setDeliveryAmount
(
calculationDiscountResult
.
getDeliveryAmount
()
);
shoppingCartGoodsResponseVo
.
setDeliveryAmount
(
deliveryAmount
);
shoppingCartGoodsResponseVo
.
setDiscountDeliveryAmount
(
calculationDiscountResult
.
getDeliveryAmount
()
);
shoppingCartGoodsResponseVo
.
setDiscountDeliveryAmount
(
deliveryAmount
);
shoppingCartGoodsResponseVo
.
setIsDiscountDelivery
(
false
);
shoppingCartGoodsResponseVo
.
setIsDiscountDelivery
(
false
);
}
else
{
}
else
{
String
desc
=
DELIVERY_DISCOUNT_DESC3
;
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
{
String
desc
=
DELIVERY_DISCOUNT_DESC3
;
shoppingCartGoodsResponseVo
.
setDeliveryDiscountDesc
(
String
.
format
(
desc
,
deliveryAmount
/
100
));
shoppingCartGoodsResponseVo
.
setDeliveryDiscountDesc
(
String
.
format
(
desc
,
deliveryAmount
/
100
));
shoppingCartGoodsResponseVo
.
setDeliveryAmount
(
deliveryAmount
);
shoppingCartGoodsResponseVo
.
setDeliveryAmount
(
deliveryAmount
);
shoppingCartGoodsResponseVo
.
setDiscountDeliveryAmount
(
deliveryAmount
);
shoppingCartGoodsResponseVo
.
setDiscountDeliveryAmount
(
deliveryAmount
);
shoppingCartGoodsResponseVo
.
setIsDiscountDelivery
(
false
);
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);
// }
// }
// }
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment