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
02c613b9
Commit
02c613b9
authored
Sep 11, 2020
by
孙昱
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sunyu::update::update api about queryCartInfoByUser
parent
e075d22e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
3 deletions
+52
-3
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/ShoppingCartMCoffeeServiceImpl.java
+5
-3
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/CouponDiscountCalculation.java
+47
-0
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/ShoppingCartMCoffeeServiceImpl.java
View file @
02c613b9
...
@@ -19,6 +19,7 @@ import cn.freemud.service.impl.FullSubtractionActivityServiceImpl;
...
@@ -19,6 +19,7 @@ import cn.freemud.service.impl.FullSubtractionActivityServiceImpl;
import
cn.freemud.service.impl.mcoffee.calculation.CalculationServiceImpl
;
import
cn.freemud.service.impl.mcoffee.calculation.CalculationServiceImpl
;
import
cn.freemud.service.impl.mcoffee.calculation.CouponDiscountCalculation
;
import
cn.freemud.service.impl.mcoffee.calculation.CouponDiscountCalculation
;
import
cn.freemud.service.impl.mcoffee.entity.CopyShoppingCartRequestVo
;
import
cn.freemud.service.impl.mcoffee.entity.CopyShoppingCartRequestVo
;
import
cn.freemud.service.impl.mcoffee.entity.CouponAvailableReq
;
import
cn.freemud.service.impl.mcoffee.entity.MCoffeeAddGoodsRequestVo
;
import
cn.freemud.service.impl.mcoffee.entity.MCoffeeAddGoodsRequestVo
;
import
cn.freemud.service.impl.mcoffee.entity.SwitchShoppingCartRequestVo
;
import
cn.freemud.service.impl.mcoffee.entity.SwitchShoppingCartRequestVo
;
import
cn.freemud.service.thirdparty.CustomerApplicationClient
;
import
cn.freemud.service.thirdparty.CustomerApplicationClient
;
...
@@ -317,9 +318,10 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -317,9 +318,10 @@ public class ShoppingCartMCoffeeServiceImpl {
public
BaseResponse
getCartInfoByUser
(
QueryCartInfoRequestVo
requestVo
){
public
BaseResponse
getCartInfoByUser
(
QueryCartInfoRequestVo
requestVo
){
// 获取购物车商品
// 获取购物车商品?
List
<
CartGoods
>
cartGoodsList
=
assortmentSdkService
.
getShoppingCartForCoupon
(
requestVo
.
getPartnerId
(),
requestVo
.
getStoreId
(),
requestVo
.
getUserId
(),
""
,
shoppingCartBaseService
);
List
<
CartGoods
>
cartGoodsList
=
assortmentSdkService
.
getShoppingCartForCoupon
(
requestVo
.
getPartnerId
(),
requestVo
.
getStoreId
(),
requestVo
.
getUserId
(),
""
,
shoppingCartBaseService
);
return
ResponseUtil
.
success
(
cartGoodsList
);
List
<
CouponAvailableReq
>
resList
=
couponDiscountCalculation
.
buildAvailableCoupons
(
requestVo
,
cartGoodsList
);
return
ResponseUtil
.
success
(
resList
);
}
}
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/CouponDiscountCalculation.java
View file @
02c613b9
...
@@ -323,6 +323,53 @@ public class CouponDiscountCalculation {
...
@@ -323,6 +323,53 @@ public class CouponDiscountCalculation {
}
}
public
List
<
CouponAvailableReq
>
buildAvailableCoupons
(
QueryCartInfoRequestVo
requestVo
,
List
<
CartGoods
>
cartGoods
){
List
<
CouponAvailableReq
>
resList
=
new
ArrayList
<>();
CouponAvailableReq
res
=
new
CouponAvailableReq
();
res
.
setProviderId
(
requestVo
.
getPartnerId
());
res
.
setMerchantId
(
requestVo
.
getPartnerId
());
res
.
setStoreId
(
requestVo
.
getStoreId
());
List
<
String
>
couponList
=
new
ArrayList
<>();
res
.
setChannelIdList
(
commonService
.
getOrgCodes
(
requestVo
.
getPartnerId
(),
requestVo
.
getStoreId
()));
List
<
CouponProductVo
>
productList
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
cartGoods
))
{
cartGoods
.
forEach
(
cartGood
->
{
if
(
StringUtils
.
isNotEmpty
(
cartGood
.
getCouponCode
()))
{
couponList
.
add
(
cartGood
.
getCouponCode
());
res
.
setCouponCodes
(
couponList
);
}
if
(
CollectionUtils
.
isNotEmpty
(
cartGood
.
getProductComboList
()))
{
cartGood
.
getProductComboList
().
forEach
(
comboxGoods
->
{
CouponProductVo
couponProductVo
=
new
CouponProductVo
();
couponProductVo
.
setAmount
(
Integer
.
valueOf
(
comboxGoods
.
getAmount
().
toString
()));
couponProductVo
.
setKeyProductCode
(
comboxGoods
.
getCustomerCode
());
couponProductVo
.
setQuantity
(
comboxGoods
.
getQty
());
couponProductVo
.
setProductId
(
comboxGoods
.
getGoodsId
());
couponProductVo
.
setCategoryCode
(
null
);
productList
.
add
(
couponProductVo
);
});
}
if
(
CollectionUtils
.
isNotEmpty
(
cartGood
.
getProductGroupList
()))
{
cartGood
.
getProductGroupList
().
forEach
(
comboxGoods
->
{
CouponProductVo
couponProductVo
=
new
CouponProductVo
();
couponProductVo
.
setAmount
(
Integer
.
valueOf
(
comboxGoods
.
getAmount
().
toString
()));
couponProductVo
.
setKeyProductCode
(
comboxGoods
.
getCustomerCode
());
couponProductVo
.
setQuantity
(
comboxGoods
.
getQty
());
couponProductVo
.
setProductId
(
comboxGoods
.
getGoodsId
());
couponProductVo
.
setCategoryCode
(
null
);
productList
.
add
(
couponProductVo
);
});
}
});
res
.
setProductList
(
productList
);
Long
totalAmount
=
createProductRequest
(
cartGoods
,
productList
);
res
.
setTotalAmount
(
Integer
.
valueOf
(
totalAmount
.
toString
()));
resList
.
add
(
res
);
}
return
resList
;
}
// public String getAppSecret(String partnerId) {
// public String getAppSecret(String partnerId) {
...
...
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