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
2cf6a15f
Commit
2cf6a15f
authored
Sep 12, 2020
by
孙昱
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature-yu.sun-20200911' into qa
parents
c574cefb
02c613b9
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
115 additions
and
0 deletions
+115
-0
shopping-cart-application-service/src/main/java/cn/freemud/controller/MCoffeeShoppingCartController.java
+7
-0
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/QueryCartInfoRequestVo.java
+31
-0
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/AssortmentSdkService.java
+21
-0
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/ShoppingCartMCoffeeServiceImpl.java
+9
-0
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/controller/MCoffeeShoppingCartController.java
View file @
2cf6a15f
...
@@ -66,6 +66,13 @@ public class MCoffeeShoppingCartController {
...
@@ -66,6 +66,13 @@ public class MCoffeeShoppingCartController {
return
shoppingCartMCoffeeService
.
getGoodsList
(
request
);
return
shoppingCartMCoffeeService
.
getGoodsList
(
request
);
}
}
@ApiAnnotation
(
logMessage
=
"getCartInfoByUser"
)
@PostMapping
(
value
=
"/getCartInfoByUser"
)
public
BaseResponse
getCartInfoByUser
(
@Validated
@LogParams
@RequestBody
QueryCartInfoRequestVo
requestVo
){
return
shoppingCartMCoffeeService
.
getCartInfoByUser
(
requestVo
);
}
/**
/**
* 查询购物车可使用优惠券
* 查询购物车可使用优惠券
*/
*/
...
...
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/QueryCartInfoRequestVo.java
0 → 100644
View file @
2cf6a15f
package
cn
.
freemud
.
entities
.
vo
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
org.hibernate.validator.constraints.NotEmpty
;
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @version V1.0
* @Title: QueryCartInfoRequestVo
* @Package cn.freemud.entities.vo
* @Description: 简单描述下这个类是做什么用的
* @author: yu.sun
* @date: 2020/9/11 10:35
* @Copyright: 2020 www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/
@Data
public
class
QueryCartInfoRequestVo
{
@ApiModelProperty
(
value
=
"用户Id"
,
required
=
true
)
@NotEmpty
(
message
=
"用户Id不可为空"
)
private
String
userId
;
@ApiModelProperty
(
value
=
"商户Id"
,
required
=
true
)
@NotEmpty
(
message
=
"商户Id不可为空"
)
private
String
partnerId
;
@ApiModelProperty
(
value
=
"门店id"
,
required
=
true
)
@NotEmpty
(
message
=
"门店id不可为空"
)
private
String
storeId
;
}
\ No newline at end of file
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/AssortmentSdkService.java
View file @
2cf6a15f
...
@@ -108,6 +108,27 @@ public class AssortmentSdkService {
...
@@ -108,6 +108,27 @@ public class AssortmentSdkService {
}
}
/**
/**
* 调用聚合sdk获取缓存中购物车信息
*
* @param partnerId
* @param storeId
* @param useId
* @return
*/
public
List
<
CartGoods
>
getShoppingCartForCoupon
(
String
partnerId
,
String
storeId
,
String
useId
,
String
tableNumber
,
ShoppingCartBaseService
shoppingCartService
)
{
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
domain
.
CartParamDto
cartParamDto
=
getCartParamDto
(
partnerId
,
storeId
,
useId
);
cartParamDto
.
setTableNumber
(
tableNumber
);
// 根据不同点餐类型获取不同购物车实例
BaseResponse
<
List
<
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
domain
.
CartGoods
>>
baseResponse
=
shoppingCartService
.
getCartGoodsList
(
cartParamDto
,
LogThreadLocal
.
getTrackingNo
());
if
(
baseResponse
==
null
||
!
ResponseResult
.
SUCCESS
.
getCode
().
equals
(
baseResponse
.
getCode
())
||
CollectionUtils
.
isEmpty
(
baseResponse
.
getResult
()))
{
return
new
ArrayList
<>();
}
return
JSONArray
.
parseArray
(
JSONObject
.
toJSONString
(
baseResponse
.
getResult
()),
CartGoods
.
class
);
}
/**
* 调用聚合sdk设置缓存中购物车信息
* 调用聚合sdk设置缓存中购物车信息
*
*
* @param partnerId
* @param partnerId
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/ShoppingCartMCoffeeServiceImpl.java
View file @
2cf6a15f
...
@@ -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,6 +318,14 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -317,6 +318,14 @@ public class ShoppingCartMCoffeeServiceImpl {
}
}
public
BaseResponse
getCartInfoByUser
(
QueryCartInfoRequestVo
requestVo
){
// 获取购物车商品?
List
<
CartGoods
>
cartGoodsList
=
assortmentSdkService
.
getShoppingCartForCoupon
(
requestVo
.
getPartnerId
(),
requestVo
.
getStoreId
(),
requestVo
.
getUserId
(),
""
,
shoppingCartBaseService
);
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 @
2cf6a15f
...
@@ -321,6 +321,53 @@ public class CouponDiscountCalculation {
...
@@ -321,6 +321,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