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
order-group-application
order-group
Commits
2b13053f
Commit
2b13053f
authored
Dec 30, 2020
by
xiaoer.li@freemud.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/feature/2.1.13-新品限购' into qa
parents
9794319e
3e2bfd8b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
2 deletions
+34
-2
shopping-cart-application-service/src/main/java/cn/freemud/enums/ResponseResult.java
+2
-1
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
+16
-1
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/CalculationSharingDiscountService.java
+16
-0
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/enums/ResponseResult.java
View file @
2b13053f
...
@@ -179,7 +179,8 @@ public enum ResponseResult {
...
@@ -179,7 +179,8 @@ public enum ResponseResult {
/**
/**
* coco验证券错误
* coco验证券错误
*/
*/
COCO_COUPON_VALIDATOR_FAIL
(
"49000"
,
"优惠券验证错误"
)
COCO_COUPON_VALIDATOR_FAIL
(
"49000"
,
"优惠券验证错误"
),
NEW_PURCHASE
(
"49001"
,
"超过限购数量了"
)
;
;
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
View file @
2b13053f
...
@@ -1234,6 +1234,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -1234,6 +1234,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Discount
discountDTO
=
result
.
getDiscounts
().
stream
().
filter
(
d
->
221
==
d
.
getType
()).
findFirst
().
get
();
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Discount
discountDTO
=
result
.
getDiscounts
().
stream
().
filter
(
d
->
221
==
d
.
getType
()).
findFirst
().
get
();
convert2SendPoint
(
result
,
discountDTO
);
convert2SendPoint
(
result
,
discountDTO
);
}
}
this
.
checkPurchase
(
result
);
result
.
setValidCouponMap
(
validCouponMap
);
result
.
setValidCouponMap
(
validCouponMap
);
result
.
setDeliveryAmount
(
distributionFee
);
result
.
setDeliveryAmount
(
distributionFee
);
result
.
setDistributionFee
(
result
.
getDistributionFee
());
result
.
setDistributionFee
(
result
.
getDistributionFee
());
...
@@ -1252,7 +1253,21 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
...
@@ -1252,7 +1253,21 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
}
}
throw
new
ServiceException
(
ResponseResult
.
OPERATE_TOO_OFTEN
);
throw
new
ServiceException
(
ResponseResult
.
OPERATE_TOO_OFTEN
);
}
}
private
void
checkPurchase
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
result
)
{
if
(
CollectionUtils
.
isEmpty
(
result
.
getGoods
()))
{
return
;
}
Integer
type
=
16
;
for
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
good
:
result
.
getGoods
())
{
if
(
CollectionUtils
.
isNotEmpty
(
good
.
getDiscounts
()))
{
for
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
discount
:
good
.
getDiscounts
())
{
if
(
type
.
equals
(
discount
.
getType
())
&&
good
.
getGoodsQuantity
()>=
discount
.
getActualGoodsNumber
())
{
throw
new
ServiceException
(
ResponseResult
.
NEW_PURCHASE
);
}
}
}
}
}
private
void
convert2SendPoint
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
result
,
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Discount
discountDTO
)
{
private
void
convert2SendPoint
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
result
,
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Discount
discountDTO
)
{
SendPoint
sendPointNew
=
new
SendPoint
();
SendPoint
sendPointNew
=
new
SendPoint
();
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/CalculationSharingDiscountService.java
View file @
2b13053f
...
@@ -193,6 +193,7 @@ public class CalculationSharingDiscountService {
...
@@ -193,6 +193,7 @@ public class CalculationSharingDiscountService {
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Discount
discountDTO
=
result
.
getDiscounts
().
stream
().
filter
(
d
->
221
==
d
.
getType
()).
findFirst
().
get
();
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Discount
discountDTO
=
result
.
getDiscounts
().
stream
().
filter
(
d
->
221
==
d
.
getType
()).
findFirst
().
get
();
convert2SendPoint
(
result
,
discountDTO
);
convert2SendPoint
(
result
,
discountDTO
);
}
}
this
.
checkPurchase
(
result
);
result
.
setValidCouponMap
(
validCouponMap
);
result
.
setValidCouponMap
(
validCouponMap
);
result
.
setDeliveryAmount
(
deliveryAmount
);
result
.
setDeliveryAmount
(
deliveryAmount
);
result
.
setDistributionFee
(
result
.
getDistributionFee
());
result
.
setDistributionFee
(
result
.
getDistributionFee
());
...
@@ -209,6 +210,21 @@ public class CalculationSharingDiscountService {
...
@@ -209,6 +210,21 @@ public class CalculationSharingDiscountService {
return
null
;
return
null
;
}
}
private
void
checkPurchase
(
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
result
)
{
if
(
CollectionUtils
.
isEmpty
(
result
.
getGoods
()))
{
return
;
}
Integer
type
=
16
;
for
(
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
good
:
result
.
getGoods
())
{
if
(
CollectionUtils
.
isNotEmpty
(
good
.
getDiscounts
()))
{
for
(
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
discount
:
good
.
getDiscounts
())
{
if
(
type
.
equals
(
discount
.
getType
())
&&
good
.
getGoodsQuantity
()>=
discount
.
getActualGoodsNumber
())
{
throw
new
ServiceException
(
ResponseResult
.
NEW_PURCHASE
);
}
}
}
}
}
private
void
convert2SendPoint
(
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
result
,
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Discount
discountDTO
)
{
private
void
convert2SendPoint
(
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
result
,
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Discount
discountDTO
)
{
SendPoint
sendPointNew
=
new
SendPoint
();
SendPoint
sendPointNew
=
new
SendPoint
();
...
...
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