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
10376c29
Commit
10376c29
authored
Aug 12, 2020
by
ping.wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
再来一单
parent
fc95e342
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
184 additions
and
68 deletions
+184
-68
shopping-cart-application-service/pom.xml
+6
-0
shopping-cart-application-service/src/main/java/cn/freemud/controller/MCoffeeShoppingCartController.java
+1
-1
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/ShoppingCartMCoffeeServiceImpl.java
+171
-53
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/CalculationServiceImpl.java
+6
-14
No files found.
shopping-cart-application-service/pom.xml
View file @
10376c29
...
@@ -47,6 +47,12 @@
...
@@ -47,6 +47,12 @@
<artifactId>
assortment-shoppingcart-sdk
</artifactId>
<artifactId>
assortment-shoppingcart-sdk
</artifactId>
<version>
1.1.3.RELEASE
</version>
<version>
1.1.3.RELEASE
</version>
</dependency>
</dependency>
<!-- 再来一单查询订单信息 -->
<dependency>
<groupId>
cn.freemud
</groupId>
<artifactId>
ordercenter-sdk
</artifactId>
<version>
1.3.10.RELEASE
</version>
</dependency>
<dependency>
<dependency>
<groupId>
com.freemud.application.service.sdk
</groupId>
<groupId>
com.freemud.application.service.sdk
</groupId>
<artifactId>
promotioncenter-sdk
</artifactId>
<artifactId>
promotioncenter-sdk
</artifactId>
...
...
shopping-cart-application-service/src/main/java/cn/freemud/controller/MCoffeeShoppingCartController.java
View file @
10376c29
...
@@ -107,7 +107,7 @@ public class MCoffeeShoppingCartController {
...
@@ -107,7 +107,7 @@ public class MCoffeeShoppingCartController {
/**
/**
* 再来一单
* 再来一单
*/
*/
@ApiAnnotation
(
logMessage
=
"
listCartGoods
"
)
@ApiAnnotation
(
logMessage
=
"
copyOrder
"
)
@PostMapping
(
value
=
"/copyOrder"
)
@PostMapping
(
value
=
"/copyOrder"
)
public
BaseResponse
copyOrder
(
@Validated
@LogParams
@RequestBody
CopyShoppingCartRequestVo
request
)
{
public
BaseResponse
copyOrder
(
@Validated
@LogParams
@RequestBody
CopyShoppingCartRequestVo
request
)
{
return
shoppingCartMCoffeeService
.
copyOrder
(
request
);
return
shoppingCartMCoffeeService
.
copyOrder
(
request
);
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/ShoppingCartMCoffeeServiceImpl.java
View file @
10376c29
...
@@ -26,10 +26,14 @@ import com.alibaba.fastjson.JSONArray;
...
@@ -26,10 +26,14 @@ import com.alibaba.fastjson.JSONArray;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.freemud.application.sdk.api.base.SDKCommonBaseContextWare
;
import
com.freemud.application.sdk.api.base.SDKCommonBaseContextWare
;
import
com.freemud.application.sdk.api.log.LogThreadLocal
;
import
com.freemud.application.sdk.api.log.LogThreadLocal
;
import
com.freemud.application.sdk.api.ordercenter.enums.ProductTypeEnum
;
import
com.freemud.application.sdk.api.ordercenter.response.orderInfo.OrderInfoReqs
;
import
com.freemud.application.sdk.api.ordercenter.response.orderInfo.OrderItemResp
;
import
com.freemud.application.sdk.api.ordercenter.response.orderInfo.QueryByCodeResponse
;
import
com.freemud.application.sdk.api.ordercenter.service.OrderSdkService
;
import
com.freemud.application.sdk.api.productcenter.domain.ProductBeanDTO
;
import
com.freemud.application.sdk.api.productcenter.domain.ProductBeanDTO
;
import
com.freemud.sdk.api.assortment.shoppingcart.constant.CommonsConstant
;
import
com.freemud.sdk.api.assortment.shoppingcart.constant.CommonsConstant
;
import
com.freemud.sdk.api.assortment.shoppingcart.request.CheckCartRequest
;
import
com.freemud.sdk.api.assortment.shoppingcart.request.CheckCartRequest
;
import
com.freemud.sdk.api.assortment.shoppingcart.service.ShoppingCartBaseService
;
import
com.freemud.sdk.api.assortment.shoppingcart.service.impl.ShoppingCartBaseServiceImpl
;
import
com.freemud.sdk.api.assortment.shoppingcart.service.impl.ShoppingCartBaseServiceImpl
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
...
@@ -39,12 +43,10 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -39,12 +43,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.*
;
import
java.util.*
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
static
cn
.
freemud
.
constant
.
ShoppingCartConstant
.
SHOPPING_CART_EMPTY_GOODS_LIST
;
import
static
cn
.
freemud
.
constant
.
ShoppingCartConstant
.
SHOPPING_CART_EMPTY_GOODS_LIST
;
import
static
cn
.
freemud
.
constant
.
ShoppingCartConstant
.
SHOPPING_CART_INVALIAD_GOODS
;
import
static
cn
.
freemud
.
constant
.
ShoppingCartConstant
.
SHOPPING_CART_INVALIAD_GOODS
;
import
static
java
.
util
.
stream
.
Collectors
.
toList
;
/**
/**
* All rights Reserved, Designed By www.freemud.cn
* All rights Reserved, Designed By www.freemud.cn
...
@@ -77,6 +79,8 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -77,6 +79,8 @@ public class ShoppingCartMCoffeeServiceImpl {
private
CalculationServiceImpl
calculationService
;
private
CalculationServiceImpl
calculationService
;
@Autowired
@Autowired
private
CouponDiscountCalculation
couponDiscountCalculation
;
private
CouponDiscountCalculation
couponDiscountCalculation
;
@Autowired
private
OrderSdkService
orderSdkService
;
/**
/**
* 添加商品、超值加购、商品券
* 添加商品、超值加购、商品券
...
@@ -121,7 +125,7 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -121,7 +125,7 @@ public class ShoppingCartMCoffeeServiceImpl {
oldCartGoodsList
=
new
ArrayList
<>();
oldCartGoodsList
=
new
ArrayList
<>();
}
}
//商品券已添加情况校验
//商品券已添加情况校验
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
=
checkGoodsCoupon
(
oldCartGoodsList
,
operationType
,
couponCode
);
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
=
checkGoodsCoupon
(
oldCartGoodsList
,
operationType
,
couponCode
);
setClassificationAndPrice
(
addCartGoods
,
productBeanListSpuClass
);
setClassificationAndPrice
(
addCartGoods
,
productBeanListSpuClass
);
//查询多个商品库存信息
//查询多个商品库存信息
Integer
checkQty
=
this
.
checkSkuQty
(
oldCartGoodsList
,
addCartGoods
);
Integer
checkQty
=
this
.
checkSkuQty
(
oldCartGoodsList
,
addCartGoods
);
...
@@ -135,10 +139,10 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -135,10 +139,10 @@ public class ShoppingCartMCoffeeServiceImpl {
}
}
// 购物车数据更新(保存商品原价)
// 购物车数据更新(保存商品原价)
List
<
CartGoods
>
newCartGoods
=
updateCartGoodsLegal
(
partnerId
,
storeId
,
orderType
,
tableNumber
,
menuType
,
userId
,
addCartGoods
,
shoppingCartGoodsResponseVo
,
oldCartGoodsList
);
List
<
CartGoods
>
newCartGoods
=
updateCartGoodsLegal
(
partnerId
,
storeId
,
orderType
,
tableNumber
,
menuType
,
userId
,
addCartGoods
,
shoppingCartGoodsResponseVo
,
oldCartGoodsList
);
// 促销活动等价格计算
// 促销活动等价格计算
calculationService
.
updateShoppingCartGoodsDiscount
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
menuType
,
receiveId
,
null
,
calculationService
.
updateShoppingCartGoodsDiscount
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
menuType
,
receiveId
,
null
,
newCartGoods
,
coupons
,
new
ArrayList
<>(),
shoppingCartGoodsResponseVo
);
newCartGoods
,
coupons
,
new
ArrayList
<>(),
shoppingCartGoodsResponseVo
);
// 返回购物车数据
// 返回购物车数据
...
@@ -148,29 +152,29 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -148,29 +152,29 @@ public class ShoppingCartMCoffeeServiceImpl {
}
}
private
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
checkGoodsCoupon
(
List
<
CartGoods
>
oldCartGoodsList
,
Integer
operationType
,
String
couponCode
)
{
private
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
checkGoodsCoupon
(
List
<
CartGoods
>
oldCartGoodsList
,
Integer
operationType
,
String
couponCode
)
{
if
(
operationType
!=
null
&&
operationType
==
1
&&
StringUtils
.
isBlank
(
couponCode
))
{
if
(
operationType
!=
null
&&
operationType
==
1
&&
StringUtils
.
isBlank
(
couponCode
))
{
throw
new
ServiceException
(
ResponseResult
.
PARAMETER_MISSING
,
"商品券券号为空"
);
throw
new
ServiceException
(
ResponseResult
.
PARAMETER_MISSING
,
"商品券券号为空"
);
}
}
if
(
CollectionUtils
.
isEmpty
(
oldCartGoodsList
)
&&
operationType
!=
null
&&
operationType
==
1
&&
StringUtils
.
isNotBlank
(
couponCode
))
{
if
(
CollectionUtils
.
isEmpty
(
oldCartGoodsList
)
&&
operationType
!=
null
&&
operationType
==
1
&&
StringUtils
.
isNotBlank
(
couponCode
))
{
throw
new
ServiceException
(
ResponseResult
.
PARAMETER_MISSING
,
"请先添加商品再使用商品券"
);
throw
new
ServiceException
(
ResponseResult
.
PARAMETER_MISSING
,
"请先添加商品再使用商品券"
);
}
}
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
=
new
ArrayList
<>();
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
oldCartGoodsList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
oldCartGoodsList
))
{
for
(
CartGoods
cartGoods
:
oldCartGoodsList
){
for
(
CartGoods
cartGoods
:
oldCartGoodsList
)
{
//购物车已存在商品券
//购物车已存在商品券
if
(
StringUtils
.
isNotBlank
(
cartGoods
.
getCouponCode
()))
{
if
(
StringUtils
.
isNotBlank
(
cartGoods
.
getCouponCode
()))
{
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
calculationDiscountCoupon
=
new
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
();
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
calculationDiscountCoupon
=
new
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
();
calculationDiscountCoupon
.
setCode
(
couponCode
);
calculationDiscountCoupon
.
setCode
(
couponCode
);
coupons
.
add
(
calculationDiscountCoupon
);
coupons
.
add
(
calculationDiscountCoupon
);
}
}
if
(
couponCode
!=
null
&&
couponCode
.
equals
(
cartGoods
.
getCouponCode
()))
{
if
(
couponCode
!=
null
&&
couponCode
.
equals
(
cartGoods
.
getCouponCode
()))
{
throw
new
ServiceException
(
ResponseResult
.
PARAMETER_MISSING
,
"商品券已添加"
);
throw
new
ServiceException
(
ResponseResult
.
PARAMETER_MISSING
,
"商品券已添加"
);
}
}
}
}
}
}
//新增商品券
//新增商品券
if
(
StringUtils
.
isNotBlank
(
couponCode
))
{
if
(
StringUtils
.
isNotBlank
(
couponCode
))
{
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
calculationDiscountCoupon
=
new
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
();
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
calculationDiscountCoupon
=
new
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
();
calculationDiscountCoupon
.
setCode
(
couponCode
);
calculationDiscountCoupon
.
setCode
(
couponCode
);
coupons
.
add
(
calculationDiscountCoupon
);
coupons
.
add
(
calculationDiscountCoupon
);
...
@@ -224,14 +228,14 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -224,14 +228,14 @@ public class ShoppingCartMCoffeeServiceImpl {
// checkUpdateStock(partnerId, storeId, menuType, qty, cartGoods);
// checkUpdateStock(partnerId, storeId, menuType, qty, cartGoods);
// check购物车中所有商品
// check购物车中所有商品
cartGoodsList
=
checkCartGoods
(
partnerId
,
storeId
,
orderType
,
menuType
,
shoppingCartGoodsResponseVo
,
cartGoodsList
);
cartGoodsList
=
checkCartGoods
(
partnerId
,
storeId
,
orderType
,
menuType
,
shoppingCartGoodsResponseVo
,
cartGoodsList
);
// 重新存储最新购物车
// 重新存储最新购物车
assortmentSdkService
.
setShoppingCart
(
partnerId
,
storeId
,
userId
,
cartGoodsList
,
sessionId
,
""
,
shoppingCartBaseService
);
assortmentSdkService
.
setShoppingCart
(
partnerId
,
storeId
,
userId
,
cartGoodsList
,
sessionId
,
""
,
shoppingCartBaseService
);
// 当couponCode不为空时,需参与价格计算
// 当couponCode不为空时,需参与价格计算
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
=
getCoupon
(
null
,
null
,
cartGoodsList
)
;
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
=
getCoupon
(
null
,
null
,
cartGoodsList
)
;
// 促销活动的优惠金额计算
// 促销活动的优惠金额计算
calculationService
.
updateShoppingCartGoodsDiscount
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
menuType
,
receiveId
,
null
,
calculationService
.
updateShoppingCartGoodsDiscount
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
menuType
,
receiveId
,
null
,
cartGoodsList
,
coupons
,
new
ArrayList
<>(),
shoppingCartGoodsResponseVo
);
cartGoodsList
,
coupons
,
new
ArrayList
<>(),
shoppingCartGoodsResponseVo
);
//设置更新响应信息
//设置更新响应信息
setAddAndUpdateResponse
(
shoppingCartGoodsResponseVo
,
cartGoodsList
,
shoppingCartGoodsResponseVo
.
getToastMsg
(),
ShoppingCartConstant
.
ADD_AND_UPDATE
,
null
);
setAddAndUpdateResponse
(
shoppingCartGoodsResponseVo
,
cartGoodsList
,
shoppingCartGoodsResponseVo
.
getToastMsg
(),
ShoppingCartConstant
.
ADD_AND_UPDATE
,
null
);
...
@@ -269,16 +273,16 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -269,16 +273,16 @@ public class ShoppingCartMCoffeeServiceImpl {
// 如果购物车商品不为空, 则check购物车中所有商品
// 如果购物车商品不为空, 则check购物车中所有商品
if
(
CollectionUtils
.
isNotEmpty
(
cartGoodsList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
cartGoodsList
))
{
// check购物车中所有商品
// check购物车中所有商品
cartGoodsList
=
checkCartGoods
(
partnerId
,
storeId
,
orderType
,
menuType
,
shoppingCartGoodsResponseVo
,
cartGoodsList
);
cartGoodsList
=
checkCartGoods
(
partnerId
,
storeId
,
orderType
,
menuType
,
shoppingCartGoodsResponseVo
,
cartGoodsList
);
// 重新存储最新购物车
// 重新存储最新购物车
assortmentSdkService
.
setShoppingCart
(
partnerId
,
storeId
,
userId
,
cartGoodsList
,
sessionId
,
""
,
shoppingCartBaseService
);
assortmentSdkService
.
setShoppingCart
(
partnerId
,
storeId
,
userId
,
cartGoodsList
,
sessionId
,
""
,
shoppingCartBaseService
);
}
}
// 当couponCode不为空时,需参与价格计算
// 当couponCode不为空时,需参与价格计算
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
=
getCoupon
(
couponCode
,
null
,
cartGoodsList
)
;
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
=
getCoupon
(
couponCode
,
null
,
cartGoodsList
)
;
// 促销活动的优惠金额计算
// 促销活动的优惠金额计算
calculationService
.
updateShoppingCartGoodsDiscount
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
menuType
,
receiveId
,
null
,
calculationService
.
updateShoppingCartGoodsDiscount
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
menuType
,
receiveId
,
null
,
cartGoodsList
,
coupons
,
new
ArrayList
<>(),
shoppingCartGoodsResponseVo
);
cartGoodsList
,
coupons
,
new
ArrayList
<>(),
shoppingCartGoodsResponseVo
);
//设置更新响应信息
//设置更新响应信息
setAddAndUpdateResponse
(
shoppingCartGoodsResponseVo
,
cartGoodsList
,
shoppingCartGoodsResponseVo
.
getToastMsg
(),
ShoppingCartConstant
.
QUERY_INFO
,
shoppingCartInfoRequestVo
);
setAddAndUpdateResponse
(
shoppingCartGoodsResponseVo
,
cartGoodsList
,
shoppingCartGoodsResponseVo
.
getToastMsg
(),
ShoppingCartConstant
.
QUERY_INFO
,
shoppingCartInfoRequestVo
);
...
@@ -293,7 +297,7 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -293,7 +297,7 @@ public class ShoppingCartMCoffeeServiceImpl {
if
(
StringUtils
.
isEmpty
(
shoppingCartInfoRequestVo
.
getShopId
()))
{
if
(
StringUtils
.
isEmpty
(
shoppingCartInfoRequestVo
.
getShopId
()))
{
return
ResponseUtil
.
error
(
ResponseResult
.
SHOPPING_CART_SHOP_ID_NOT_EMPTY
);
return
ResponseUtil
.
error
(
ResponseResult
.
SHOPPING_CART_SHOP_ID_NOT_EMPTY
);
}
}
ActivityClassifyCouponBean
availableCoupon
;
ActivityClassifyCouponBean
availableCoupon
;
// 获取用户信息
// 获取用户信息
CustomerInfoVo
assortmentCustomerInfoVo
=
getCustomerInfoVo
(
shoppingCartInfoRequestVo
.
getSessionId
());
CustomerInfoVo
assortmentCustomerInfoVo
=
getCustomerInfoVo
(
shoppingCartInfoRequestVo
.
getSessionId
());
String
userId
=
assortmentCustomerInfoVo
.
getMemberId
();
String
userId
=
assortmentCustomerInfoVo
.
getMemberId
();
...
@@ -313,7 +317,7 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -313,7 +317,7 @@ public class ShoppingCartMCoffeeServiceImpl {
return
ResponseUtil
.
error
(
ResponseResult
.
SHOPPING_CART_ADD_INVAILD
);
return
ResponseUtil
.
error
(
ResponseResult
.
SHOPPING_CART_ADD_INVAILD
);
}
}
// 获取购物车商品-查询用户券-券码校验可用券
// 获取购物车商品-查询用户券-券码校验可用券
availableCoupon
=
couponDiscountCalculation
.
availableCoupon
(
partnerId
,
storeId
,
userId
,
couponCode
,
orderType
,
cartGoodsList
);
availableCoupon
=
couponDiscountCalculation
.
availableCoupon
(
partnerId
,
storeId
,
userId
,
couponCode
,
orderType
,
cartGoodsList
);
return
ResponseUtil
.
success
(
availableCoupon
);
return
ResponseUtil
.
success
(
availableCoupon
);
}
}
...
@@ -375,7 +379,7 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -375,7 +379,7 @@ public class ShoppingCartMCoffeeServiceImpl {
String
userId
=
assortmentCustomerInfoVo
.
getMemberId
();
String
userId
=
assortmentCustomerInfoVo
.
getMemberId
();
String
partnerId
=
shoppingCartInfoRequestVo
.
getPartnerId
();
String
partnerId
=
shoppingCartInfoRequestVo
.
getPartnerId
();
String
storeId
=
shoppingCartInfoRequestVo
.
getShopId
();
String
storeId
=
shoppingCartInfoRequestVo
.
getShopId
();
String
appId
=
StringUtils
.
isEmpty
(
shoppingCartInfoRequestVo
.
getAppId
())
?
assortmentCustomerInfoVo
.
getAppId
():
shoppingCartInfoRequestVo
.
getAppId
();
String
appId
=
StringUtils
.
isEmpty
(
shoppingCartInfoRequestVo
.
getAppId
())
?
assortmentCustomerInfoVo
.
getAppId
()
:
shoppingCartInfoRequestVo
.
getAppId
();
String
couponCode
=
shoppingCartInfoRequestVo
.
getCouponCode
();
String
couponCode
=
shoppingCartInfoRequestVo
.
getCouponCode
();
// String activityCode = shoppingCartInfoRequestVo.getActivityCode();
// String activityCode = shoppingCartInfoRequestVo.getActivityCode();
String
tableNumber
=
assortmentCustomerInfoVo
.
getTableNumber
();
String
tableNumber
=
assortmentCustomerInfoVo
.
getTableNumber
();
...
@@ -406,20 +410,20 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -406,20 +410,20 @@ public class ShoppingCartMCoffeeServiceImpl {
// cartGoodsList = JSONArray.parseArray(JSONObject.toJSONString(checkCartRequest.getCartGoodsList()), CartGoods.class);
// cartGoodsList = JSONArray.parseArray(JSONObject.toJSONString(checkCartRequest.getCartGoodsList()), CartGoods.class);
// check购物车中所有商品
// check购物车中所有商品
cartGoodsList
=
checkCartGoods
(
partnerId
,
storeId
,
orderType
,
menuType
,
shoppingCartGoodsResponseVo
,
cartGoodsList
);
cartGoodsList
=
checkCartGoods
(
partnerId
,
storeId
,
orderType
,
menuType
,
shoppingCartGoodsResponseVo
,
cartGoodsList
);
// 重新存储最新购物车
// 重新存储最新购物车
assortmentSdkService
.
setShoppingCart
(
partnerId
,
storeId
,
userId
,
cartGoodsList
,
sessionId
,
tableNumber
,
shoppingCartBaseService
);
assortmentSdkService
.
setShoppingCart
(
partnerId
,
storeId
,
userId
,
cartGoodsList
,
sessionId
,
tableNumber
,
shoppingCartBaseService
);
// 当couponCode不为空时,需参与价格计算
// 当couponCode不为空时,需参与价格计算
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
=
getCoupon
(
couponCode
,
null
,
cartGoodsList
);
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
=
getCoupon
(
couponCode
,
null
,
cartGoodsList
);
//加价购商品
//加价购商品
List
<
ShoppingCartInfoRequestVo
.
SendGoods
>
sendGoodsList
=
shoppingCartInfoRequestVo
.
getSendGoods
();
List
<
ShoppingCartInfoRequestVo
.
SendGoods
>
sendGoodsList
=
shoppingCartInfoRequestVo
.
getSendGoods
();
// //加价购商品组装
// //加价购商品组装
// packgeAdditional(shoppingCartInfoRequestVo, premiumExchangeActivity);
// packgeAdditional(shoppingCartInfoRequestVo, premiumExchangeActivity);
// 促销活动的优惠金额计算
// 促销活动的优惠金额计算
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscount
=
calculationService
.
updateShoppingCartGoodsDiscount
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
menuType
,
receiveId
,
null
,
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscount
=
calculationService
.
updateShoppingCartGoodsDiscount
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
menuType
,
receiveId
,
null
,
cartGoodsList
,
coupons
,
sendGoodsList
,
shoppingCartGoodsResponseVo
);
cartGoodsList
,
coupons
,
sendGoodsList
,
shoppingCartGoodsResponseVo
);
//设置更新响应信息
//设置更新响应信息
setAddAndUpdateResponse
(
shoppingCartGoodsResponseVo
,
cartGoodsList
,
shoppingCartGoodsResponseVo
.
getToastMsg
(),
ShoppingCartConstant
.
QUERY_INFO
,
shoppingCartInfoRequestVo
);
setAddAndUpdateResponse
(
shoppingCartGoodsResponseVo
,
cartGoodsList
,
shoppingCartGoodsResponseVo
.
getToastMsg
(),
ShoppingCartConstant
.
QUERY_INFO
,
shoppingCartInfoRequestVo
);
...
@@ -435,7 +439,7 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -435,7 +439,7 @@ public class ShoppingCartMCoffeeServiceImpl {
*/
*/
public
BaseResponse
switchCartGoodsCheck
(
SwitchShoppingCartRequestVo
requestVo
)
{
public
BaseResponse
switchCartGoodsCheck
(
SwitchShoppingCartRequestVo
requestVo
)
{
String
jsonString
=
JSONObject
.
toJSONString
(
requestVo
);
String
jsonString
=
JSONObject
.
toJSONString
(
requestVo
);
ShoppingCartInfoRequestVo
shoppingCartInfoRequestVo
=
JSONObject
.
parseObject
(
jsonString
,
ShoppingCartInfoRequestVo
.
class
);
ShoppingCartInfoRequestVo
shoppingCartInfoRequestVo
=
JSONObject
.
parseObject
(
jsonString
,
ShoppingCartInfoRequestVo
.
class
);
if
(
StringUtils
.
isEmpty
(
shoppingCartInfoRequestVo
.
getShopId
()))
{
if
(
StringUtils
.
isEmpty
(
shoppingCartInfoRequestVo
.
getShopId
()))
{
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_SHOP_ID_NOT_EMPTY
);
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_SHOP_ID_NOT_EMPTY
);
...
@@ -458,7 +462,7 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -458,7 +462,7 @@ public class ShoppingCartMCoffeeServiceImpl {
// 如果购物车商品不为空, 则check购物车中所有商品
// 如果购物车商品不为空, 则check购物车中所有商品
if
(
CollectionUtils
.
isNotEmpty
(
cartGoodsList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
cartGoodsList
))
{
// check购物车中所有商品
// check购物车中所有商品
checkCartGoods
(
partnerId
,
storeId
,
orderType
,
menuType
,
shoppingCartGoodsResponseVo
,
cartGoodsList
);
checkCartGoods
(
partnerId
,
storeId
,
orderType
,
menuType
,
shoppingCartGoodsResponseVo
,
cartGoodsList
);
}
}
return
ResponseUtil
.
success
(
shoppingCartGoodsResponseVo
);
return
ResponseUtil
.
success
(
shoppingCartGoodsResponseVo
);
}
}
...
@@ -469,11 +473,127 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -469,11 +473,127 @@ public class ShoppingCartMCoffeeServiceImpl {
*/
*/
public
BaseResponse
copyOrder
(
CopyShoppingCartRequestVo
requestVo
)
{
public
BaseResponse
copyOrder
(
CopyShoppingCartRequestVo
requestVo
)
{
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
=
new
ShoppingCartGoodsResponseVo
();
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
=
new
ShoppingCartGoodsResponseVo
();
String
sessionId
=
requestVo
.
getSessionId
();
// 获取用户信息
CustomerInfoVo
assortmentCustomerInfoVo
=
getCustomerInfoVo
(
sessionId
);
String
menuType
=
"saas"
;
Integer
orderType
=
1
;
String
userId
=
assortmentCustomerInfoVo
.
getMemberId
();
String
partnerId
=
requestVo
.
getPartnerId
();
String
storeId
=
requestVo
.
getShopId
();
String
appId
=
requestVo
.
getAppId
();
String
orderId
=
requestVo
.
getOrderId
();
String
trackingNo
=
LogThreadLocal
.
getTrackingNo
();
QueryByCodeResponse
orderInfo
=
orderSdkService
.
getOrderInfo
(
null
,
orderId
,
null
,
null
,
trackingNo
);
if
(
orderInfo
==
null
||
orderInfo
.
getResult
()
==
null
)
{
return
ResponseUtil
.
error
(
ResponseResult
.
ORDER_QUERYORDER_ERROR
);
}
List
<
CartGoods
>
cartGoodsList
=
getOrderGoods
(
orderInfo
.
getResult
());
if
(
orderInfo
.
getResult
().
getOrderType
()
==
3
||
orderInfo
.
getResult
().
getOrderType
()
==
4
){
menuType
=
"saasdelivery"
;
orderType
=
2
;
}
// 如果购物车商品不为空, 则check购物车中所有商品
if
(
CollectionUtils
.
isNotEmpty
(
cartGoodsList
))
{
// check购物车中所有商品
cartGoodsList
=
checkCartGoods
(
partnerId
,
storeId
,
orderType
,
menuType
,
shoppingCartGoodsResponseVo
,
cartGoodsList
);
// 重新存储最新购物车
assortmentSdkService
.
setShoppingCart
(
partnerId
,
storeId
,
userId
,
cartGoodsList
,
sessionId
,
""
,
shoppingCartBaseService
);
}
// 促销活动的优惠金额计算
calculationService
.
updateShoppingCartGoodsDiscount
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
menuType
,
null
,
null
,
cartGoodsList
,
new
ArrayList
<>(),
new
ArrayList
<>(),
shoppingCartGoodsResponseVo
);
//设置更新响应信息
setAddAndUpdateResponse
(
shoppingCartGoodsResponseVo
,
cartGoodsList
,
shoppingCartGoodsResponseVo
.
getToastMsg
(),
ShoppingCartConstant
.
ADD_AND_UPDATE
,
null
);
return
ResponseUtil
.
success
(
shoppingCartGoodsResponseVo
);
return
ResponseUtil
.
success
(
shoppingCartGoodsResponseVo
);
}
}
private
List
<
CartGoods
>
getOrderGoods
(
OrderInfoReqs
orderInfo
)
{
if
(
orderInfo
==
null
||
CollectionUtils
.
isEmpty
(
orderInfo
.
getOrderItemList
()))
{
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_PRODUCT_NOT_EXIST
);
}
List
<
OrderItemResp
>
orderItemList
=
orderInfo
.
getOrderItemList
();
List
<
CartGoods
>
cartGoodsList
=
new
ArrayList
<>();
List
<
OrderItemResp
>
parentOrderItemList
=
orderItemList
.
stream
()
.
filter
(
item
->
StringUtils
.
isEmpty
(
item
.
getParentProductId
())
||
ObjectUtils
.
equals
(
"0"
,
item
.
getParentProductId
()))
.
collect
(
Collectors
.
toList
());
for
(
OrderItemResp
orderItem
:
parentOrderItemList
){
CartGoods
cartGoods
=
new
CartGoods
();
cartGoods
.
setGoodsId
(
orderItem
.
getProductSpec
());
cartGoods
.
setQty
(
orderItem
.
getProductQuantity
());
cartGoods
.
setSpuId
(
orderItem
.
getProductId
());
cartGoods
.
setSkuId
(
orderItem
.
getProductSpec
());
if
(
ObjectUtils
.
equals
(
ProductTypeEnum
.
SETMEAL_PRODUCT
.
getCode
(),
orderItem
.
getProductType
())
||
ObjectUtils
.
equals
(
ProductTypeEnum
.
SETMEAL_UPPRICE_PRODUCT
.
getCode
(),
orderItem
.
getProductType
()))
{
// 获取套餐子商品列表
cartGoods
.
setProductComboList
(
new
ArrayList
<>());
cartGoods
.
setProductGroupList
(
new
ArrayList
<>());
String
partnerProductId
=
orderItem
.
getProductId
()
+
"_"
+
orderItem
.
getProductSeq
();
List
<
OrderItemResp
>
comboProducts
=
orderItemList
.
stream
().
filter
(
item
->
ObjectUtils
.
equals
(
partnerProductId
,
item
.
getParentProductId
())).
collect
(
Collectors
.
toList
());
comboProducts
.
forEach
(
combo
->
getComboxGoods
(
cartGoods
,
combo
));
}
cartGoodsList
.
add
(
cartGoods
);
}
return
cartGoodsList
;
}
private
CartGoods
.
ComboxGoods
getComboxGoods
(
CartGoods
cartGoods
,
OrderItemResp
orderItemResp
)
{
CartGoods
.
ComboxGoods
comboxGoods
=
new
CartGoods
.
ComboxGoods
();
comboxGoods
.
setSkuId
(
orderItemResp
.
getProductId
());
comboxGoods
.
setGoodsId
(
orderItemResp
.
getProductId
());
comboxGoods
.
setQty
(
orderItemResp
.
getProductQuantity
());
comboxGoods
.
setOriginalPrice
(
orderItemResp
.
getProductPrice
().
longValue
());
comboxGoods
.
setFinalPrice
(
orderItemResp
.
getSalePrice
().
longValue
());
if
(!
""
.
equals
(
orderItemResp
.
getProductProperty
())){
List
<
CartGoods
.
CartGoodsExtra
>
extra
=
new
ArrayList
<>();
String
[]
split
=
orderItemResp
.
getProductProperty
().
split
(
"/"
);
for
(
int
i
=
0
;
i
<
split
.
length
;
i
++){
CartGoods
.
CartGoodsExtra
cartGoodsExtra
=
new
CartGoods
.
CartGoodsExtra
();
cartGoodsExtra
.
setAttributeName
(
split
[
i
]);
extra
.
add
(
cartGoodsExtra
);
}
comboxGoods
.
setExtra
(
extra
);
}
Map
<
String
,
Object
>
map
=
JSONObject
.
parseObject
(
orderItemResp
.
getExtInfo
(),
Map
.
class
);
if
(
map
.
containsKey
(
"isFixedProduct"
)
&&
(
boolean
)
map
.
get
(
"isFixedProduct"
)){
cartGoods
.
getProductComboList
().
add
(
comboxGoods
);
}
if
(
map
.
containsKey
(
"isFixedProduct"
)
&&
!(
boolean
)
map
.
get
(
"isFixedProduct"
)){
cartGoods
.
getProductGroupList
().
add
(
comboxGoods
);
}
// comboxGoods.setWeight(orderItemResp.getWeight());
// productBean.setCustomerCode(orderItemResp.getThirdProductId());
// productBean.setProductCode(orderItemResp.getProductCode());
// productBean.setNumber(orderItemResp.getProductQuantity());
// productBean.setOpid(orderItemResp.getProductSeq() == null ? null : orderItemResp.getProductSeq().toString());
// productBean.setSequence(orderItemResp.getProductSeq() == null ? 0 : orderItemResp.getProductSeq());
// productBean.setOrderId(orderItemResp.getOrderCode());
// comboxGoods.setProductId(orderItemResp.getProductId());
// productBean.setParentProductId("");
// productBean.setPicture(orderItemResp.getProductPicUrl());
// productBean.setPrice(orderItemResp.getProductPrice().longValue());
// productBean.setSalePrice(orderItemResp.getSalePrice().longValue());
// productBean.setProductName(orderItemResp.getProductName());
// productBean.setSpecification(orderItemResp.getProductSpec());
// productBean.setSpecificationName(orderItemResp.getProductSpecName());
// productBean.setProductSharePrice(orderItemResp.getProductSharePrice());
// productBean.setSettlementPrice(orderItemResp.getSettlementPrice().longValue());
// productBean.setUnit(orderItemResp.getProductUnit());
//
// // 套餐
// productBean.setParentProductId(orderItemResp.getParentProductId());
// productBean.setProductType(orderItemResp.getProductType());
// productBean.setId(orderItemResp.getId());
return
comboxGoods
;
}
private
void
packgeAdditional
(
ShoppingCartInfoRequestVo
shoppingCartInfoRequestVo
,
CreateOrderVo
.
PremiumExchangeActivity
premiumExchangeActivity
)
{
private
void
packgeAdditional
(
ShoppingCartInfoRequestVo
shoppingCartInfoRequestVo
,
CreateOrderVo
.
PremiumExchangeActivity
premiumExchangeActivity
)
{
...
@@ -534,12 +654,12 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -534,12 +654,12 @@ public class ShoppingCartMCoffeeServiceImpl {
//商品券单独设置一行
//商品券单独设置一行
newCartGoods
=
checkNewCartGoods
(
newCartGoods
,
addCartGoods
);
newCartGoods
=
checkNewCartGoods
(
newCartGoods
,
addCartGoods
);
//加购商品校验
//加购商品校验
List
<
CartGoods
>
allCartGoodsList
=
checkCartGoods
(
partnerId
,
storeId
,
orderType
,
menuType
,
shoppingCartGoodsResponseVo
,
newCartGoods
);
List
<
CartGoods
>
allCartGoodsList
=
checkCartGoods
(
partnerId
,
storeId
,
orderType
,
menuType
,
shoppingCartGoodsResponseVo
,
newCartGoods
);
//添加商品为商品券时,商品校验接口券号未设置,设置商品券号
//添加商品为商品券时,商品校验接口券号未设置,设置商品券号
if
(
StringUtils
.
isNotBlank
(
addCartGoods
.
getCouponCode
()))
{
if
(
StringUtils
.
isNotBlank
(
addCartGoods
.
getCouponCode
()))
{
for
(
CartGoods
cartGoods
:
allCartGoodsList
)
{
for
(
CartGoods
cartGoods
:
allCartGoodsList
)
{
if
(
cartGoods
.
getGoodsId
().
equals
(
addCartGoods
.
getGoodsId
()))
{
if
(
cartGoods
.
getGoodsId
().
equals
(
addCartGoods
.
getGoodsId
()))
{
cartGoods
.
setCouponCode
(
addCartGoods
.
getCouponCode
());
cartGoods
.
setCouponCode
(
addCartGoods
.
getCouponCode
());
cartGoods
.
setGoodsType
(
2
);
cartGoods
.
setGoodsType
(
2
);
break
;
break
;
...
@@ -629,7 +749,7 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -629,7 +749,7 @@ public class ShoppingCartMCoffeeServiceImpl {
break
;
break
;
}
}
}
}
if
(
isadd
)
{
if
(
isadd
)
{
newCartGoods
.
add
(
addCartGoods
);
newCartGoods
.
add
(
addCartGoods
);
}
}
}
else
{
}
else
{
...
@@ -647,6 +767,7 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -647,6 +767,7 @@ public class ShoppingCartMCoffeeServiceImpl {
/**
/**
* 查询用户信息
* 查询用户信息
*
* @param sessionId
* @param sessionId
* @return
* @return
*/
*/
...
@@ -690,18 +811,18 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -690,18 +811,18 @@ public class ShoppingCartMCoffeeServiceImpl {
public
static
void
setClassificationAndPrice
(
CartGoods
cartGoods
,
List
<
ProductBeanDTO
>
productBeanListSpuClass
)
{
public
static
void
setClassificationAndPrice
(
CartGoods
cartGoods
,
List
<
ProductBeanDTO
>
productBeanListSpuClass
)
{
if
(
productBeanListSpuClass
==
null
||
productBeanListSpuClass
.
size
()
==
0
)
{
if
(
productBeanListSpuClass
==
null
||
productBeanListSpuClass
.
size
()
==
0
)
{
return
;
return
;
}
}
cartGoods
.
setClassificationId
(
productBeanListSpuClass
.
get
(
0
).
getCategory
());
cartGoods
.
setClassificationId
(
productBeanListSpuClass
.
get
(
0
).
getCategory
());
cartGoods
.
setClassificationName
(
productBeanListSpuClass
.
get
(
0
).
getCategoryName
());
cartGoods
.
setClassificationName
(
productBeanListSpuClass
.
get
(
0
).
getCategoryName
());
if
(
StringUtils
.
isBlank
(
productBeanListSpuClass
.
get
(
0
).
getCustomerCode
()))
{
if
(
StringUtils
.
isBlank
(
productBeanListSpuClass
.
get
(
0
).
getCustomerCode
()))
{
throw
new
ServiceException
(
ResponseResult
.
PARAMETER_MISSING
,
"商品键位编号为空"
);
throw
new
ServiceException
(
ResponseResult
.
PARAMETER_MISSING
,
"商品键位编号为空"
);
}
}
//超值加购商品赋值
//超值加购商品赋值
if
(
ObjectUtils
.
equals
(
GoodsTypeEnum
.
REDUCE_PRICE_GOODS
.
getGoodsType
(),
cartGoods
.
getGoodsType
()))
{
if
(
ObjectUtils
.
equals
(
GoodsTypeEnum
.
REDUCE_PRICE_GOODS
.
getGoodsType
(),
cartGoods
.
getGoodsType
()))
{
cartGoods
.
setOriginalPrice
(
productBeanListSpuClass
.
get
(
0
).
getOriginalPrice
());
cartGoods
.
setOriginalPrice
(
productBeanListSpuClass
.
get
(
0
).
getOriginalPrice
());
cartGoods
.
setFinalPrice
(
productBeanListSpuClass
.
get
(
0
).
getFinalPrice
());
cartGoods
.
setFinalPrice
(
productBeanListSpuClass
.
get
(
0
).
getFinalPrice
());
cartGoods
.
setPackPrice
(
productBeanListSpuClass
.
get
(
0
).
getPackPrice
());
cartGoods
.
setPackPrice
(
productBeanListSpuClass
.
get
(
0
).
getPackPrice
());
...
@@ -717,8 +838,6 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -717,8 +838,6 @@ public class ShoppingCartMCoffeeServiceImpl {
}
}
}
}
...
@@ -733,7 +852,7 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -733,7 +852,7 @@ public class ShoppingCartMCoffeeServiceImpl {
cartGoods
.
setSkuId
(
skuId
);
cartGoods
.
setSkuId
(
skuId
);
cartGoods
.
setQty
(
qty
);
cartGoods
.
setQty
(
qty
);
cartGoods
.
setCouponCode
(
addShoppingCartGoodsRequestVo
.
getCouponCode
());
cartGoods
.
setCouponCode
(
addShoppingCartGoodsRequestVo
.
getCouponCode
());
Integer
goodsType
=
StringUtils
.
isEmpty
(
skuId
)
||
ObjectUtils
.
equals
(
spuId
,
skuId
)
?
GoodsTypeEnum
.
SPU_GOODS
.
getGoodsType
()
:
GoodsTypeEnum
.
SKU_GOODS
.
getGoodsType
();
Integer
goodsType
=
StringUtils
.
isEmpty
(
skuId
)
||
ObjectUtils
.
equals
(
spuId
,
skuId
)
?
GoodsTypeEnum
.
SPU_GOODS
.
getGoodsType
()
:
GoodsTypeEnum
.
SKU_GOODS
.
getGoodsType
();
if
(
spuId
.
startsWith
(
CommonsConstant
.
COUPON_PREFIX
))
{
if
(
spuId
.
startsWith
(
CommonsConstant
.
COUPON_PREFIX
))
{
goodsType
=
GoodsTypeEnum
.
COUPON_GOODS
.
getGoodsType
();
goodsType
=
GoodsTypeEnum
.
COUPON_GOODS
.
getGoodsType
();
}
else
if
(
CollectionUtils
.
isNotEmpty
(
addShoppingCartGoodsRequestVo
.
getProductComboList
())
||
CollectionUtils
.
isNotEmpty
(
addShoppingCartGoodsRequestVo
.
getProductGroupList
()))
{
}
else
if
(
CollectionUtils
.
isNotEmpty
(
addShoppingCartGoodsRequestVo
.
getProductComboList
())
||
CollectionUtils
.
isNotEmpty
(
addShoppingCartGoodsRequestVo
.
getProductGroupList
()))
{
...
@@ -778,7 +897,7 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -778,7 +897,7 @@ public class ShoppingCartMCoffeeServiceImpl {
* 购物车商品check,加购商品不在菜单不check
* 购物车商品check,加购商品不在菜单不check
*/
*/
private
List
<
CartGoods
>
checkCartGoods
(
String
partnerId
,
String
storeId
,
Integer
orderType
,
String
menuType
,
private
List
<
CartGoods
>
checkCartGoods
(
String
partnerId
,
String
storeId
,
Integer
orderType
,
String
menuType
,
ShoppingCartGoodsBaseResponseVo
shoppingCartGoodsResponseVo
,
List
<
CartGoods
>
cartGoodsList
){
ShoppingCartGoodsBaseResponseVo
shoppingCartGoodsResponseVo
,
List
<
CartGoods
>
cartGoodsList
)
{
//筛选非加购商品--加价购商品不校验是否在菜单,不调用validateShopProduct
//筛选非加购商品--加价购商品不校验是否在菜单,不调用validateShopProduct
List
<
CartGoods
>
checkGoods
=
cartGoodsList
.
stream
().
filter
(
cartGoods
->
cartGoods
.
getGoodsType
()
!=
GoodsTypeEnum
.
REDUCE_PRICE_GOODS
.
getGoodsType
()).
collect
(
Collectors
.
toList
());
List
<
CartGoods
>
checkGoods
=
cartGoodsList
.
stream
().
filter
(
cartGoods
->
cartGoods
.
getGoodsType
()
!=
GoodsTypeEnum
.
REDUCE_PRICE_GOODS
.
getGoodsType
()).
collect
(
Collectors
.
toList
());
...
@@ -786,7 +905,7 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -786,7 +905,7 @@ public class ShoppingCartMCoffeeServiceImpl {
List
<
CartGoods
>
reduceGoods
=
cartGoodsList
.
stream
().
filter
(
cartGoods
->
cartGoods
.
getGoodsType
()
==
GoodsTypeEnum
.
REDUCE_PRICE_GOODS
.
getGoodsType
()).
collect
(
Collectors
.
toList
());
List
<
CartGoods
>
reduceGoods
=
cartGoodsList
.
stream
().
filter
(
cartGoods
->
cartGoods
.
getGoodsType
()
==
GoodsTypeEnum
.
REDUCE_PRICE_GOODS
.
getGoodsType
()).
collect
(
Collectors
.
toList
());
List
<
CartGoods
>
allCartGoodsList
=
new
ArrayList
<>();
List
<
CartGoods
>
allCartGoodsList
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
checkGoods
))
{
if
(
CollectionUtils
.
isNotEmpty
(
checkGoods
))
{
//当商品全部添加完毕,校验购物车商品(是否合法,上下架,点餐方式,是否在当前菜单中...),并移除非法商品
//当商品全部添加完毕,校验购物车商品(是否合法,上下架,点餐方式,是否在当前菜单中...),并移除非法商品
CheckCartRequest
checkCartRequest
=
assortmentSdkService
.
checkShoppingCartSdk
(
checkGoods
,
partnerId
,
CheckCartRequest
checkCartRequest
=
assortmentSdkService
.
checkShoppingCartSdk
(
checkGoods
,
partnerId
,
storeId
,
shoppingCartGoodsResponseVo
,
orderType
,
""
,
menuType
,
shoppingCartBaseService
);
storeId
,
shoppingCartGoodsResponseVo
,
orderType
,
""
,
menuType
,
shoppingCartBaseService
);
...
@@ -798,7 +917,7 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -798,7 +917,7 @@ public class ShoppingCartMCoffeeServiceImpl {
}
}
//添加商品为加价购商品
//添加商品为加价购商品
if
(
CollectionUtils
.
isNotEmpty
(
reduceGoods
))
{
if
(
CollectionUtils
.
isNotEmpty
(
reduceGoods
))
{
allCartGoodsList
.
addAll
(
reduceGoods
);
allCartGoodsList
.
addAll
(
reduceGoods
);
}
}
...
@@ -806,7 +925,7 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -806,7 +925,7 @@ public class ShoppingCartMCoffeeServiceImpl {
}
}
private
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
getCoupon
(
String
couponCode
,
String
activityCode
,
List
<
CartGoods
>
cartGoodsList
)
{
private
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
getCoupon
(
String
couponCode
,
String
activityCode
,
List
<
CartGoods
>
cartGoodsList
)
{
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
=
new
ArrayList
<>();
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
=
new
ArrayList
<>();
if
(
StringUtils
.
isNotEmpty
(
couponCode
))
{
if
(
StringUtils
.
isNotEmpty
(
couponCode
))
{
...
@@ -817,10 +936,10 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -817,10 +936,10 @@ public class ShoppingCartMCoffeeServiceImpl {
}
}
//购物车商品券
//购物车商品券
if
(
CollectionUtils
.
isNotEmpty
(
cartGoodsList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
cartGoodsList
))
{
for
(
CartGoods
cartGoods
:
cartGoodsList
){
for
(
CartGoods
cartGoods
:
cartGoodsList
)
{
//购物车已存在商品券
//购物车已存在商品券
if
(
StringUtils
.
isNotBlank
(
cartGoods
.
getCouponCode
()))
{
if
(
StringUtils
.
isNotBlank
(
cartGoods
.
getCouponCode
()))
{
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
calculationDiscountCoupon
=
new
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
();
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
calculationDiscountCoupon
=
new
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
();
calculationDiscountCoupon
.
setCode
(
couponCode
);
calculationDiscountCoupon
.
setCode
(
couponCode
);
coupons
.
add
(
calculationDiscountCoupon
);
coupons
.
add
(
calculationDiscountCoupon
);
...
@@ -831,5 +950,4 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -831,5 +950,4 @@ public class ShoppingCartMCoffeeServiceImpl {
}
}
}
}
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/CalculationServiceImpl.java
View file @
10376c29
...
@@ -292,14 +292,6 @@ public class CalculationServiceImpl {
...
@@ -292,14 +292,6 @@ public class CalculationServiceImpl {
throw
new
ServiceException
(
ResponseResult
.
USER_GETRECEIVEADDRESS_ERROR
);
throw
new
ServiceException
(
ResponseResult
.
USER_GETRECEIVEADDRESS_ERROR
);
}
}
// QueryDeliveryRequest queryDeliveryRequest = new QueryDeliveryRequest();
// queryDeliveryRequest.setPartnerId(partnerId);
// queryDeliveryRequest.setStoreCode(storeId);
// queryDeliveryRequest.setUserLatitude(queryReceiveAddressResponse.getData().getLatitude());
// queryDeliveryRequest.setUserLongitude(queryReceiveAddressResponse.getData().getLongitude());
// com.freemud.application.sdk.api.base.BaseResponse<QueryDeliverDetailResponse> queryDeliverDetailResponse = storeCenterService.queryDeliverDetail(queryDeliveryRequest, trackingNo);
StoreInfoRequest
storeInfoRequest
=
new
StoreInfoRequest
();
StoreInfoRequest
storeInfoRequest
=
new
StoreInfoRequest
();
storeInfoRequest
.
setPartnerId
(
partnerId
);
storeInfoRequest
.
setPartnerId
(
partnerId
);
storeInfoRequest
.
setStoreCode
(
storeId
);
storeInfoRequest
.
setStoreCode
(
storeId
);
...
@@ -308,12 +300,11 @@ public class CalculationServiceImpl {
...
@@ -308,12 +300,11 @@ public class CalculationServiceImpl {
if
(
storeInfo
==
null
||
storeInfo
.
getStatusCode
()
!=
100
||
storeInfo
.
getBizVO
()
==
null
)
{
if
(
storeInfo
==
null
||
storeInfo
.
getStatusCode
()
!=
100
||
storeInfo
.
getBizVO
()
==
null
)
{
throw
new
ServiceException
(
ResponseResult
.
STORE_ITEM_NOT_DELIVERY
);
throw
new
ServiceException
(
ResponseResult
.
STORE_ITEM_NOT_DELIVERY
);
}
}
// if (storeInfo.getBizVO().getDeliveryPrice() == 0) {
if
(
storeInfo
.
getBizVO
().
getDeliveryPrice
()
==
0
)
{
// throw new ServiceException(ResponseResult.STORE_DELIVERY_AMOUNT_ERROR);
throw
new
ServiceException
(
ResponseResult
.
STORE_DELIVERY_AMOUNT_ERROR
);
// }
}
// Double deliveryPrice = storeInfo.getBizVO().getDeliveryPrice();
Double
deliveryPrice
=
storeInfo
.
getBizVO
().
getDeliveryPrice
();
// deliveryAmount = deliveryPrice.longValue();
deliveryAmount
=
deliveryPrice
.
longValue
();
deliveryAmount
=
700
l
;
return
deliveryAmount
;
return
deliveryAmount
;
}
}
...
@@ -408,6 +399,7 @@ public class CalculationServiceImpl {
...
@@ -408,6 +399,7 @@ public class CalculationServiceImpl {
shoppingCartGoodsResponseVo
.
setNewPackAmount
(
totalPackgeAmount
);
shoppingCartGoodsResponseVo
.
setNewPackAmount
(
totalPackgeAmount
);
shoppingCartGoodsResponseVo
.
setTotalDiscountAmount
(
calculationDiscount
==
null
?
0L
:
calculationDiscount
.
getTotalDiscountAmount
());
shoppingCartGoodsResponseVo
.
setTotalDiscountAmount
(
calculationDiscount
==
null
?
0L
:
calculationDiscount
.
getTotalDiscountAmount
());
if
(
calculationDiscount
!=
null
&&
calculationDiscount
.
getDeliveryAmount
()
==
null
){
if
(
calculationDiscount
!=
null
&&
calculationDiscount
.
getDeliveryAmount
()
==
null
){
shoppingCartGoodsResponseVo
.
setDeliveryAmount
(
deliveryAmount
);
shoppingCartGoodsResponseVo
.
setDiscountDeliveryAmount
(
deliveryAmount
);
shoppingCartGoodsResponseVo
.
setDiscountDeliveryAmount
(
deliveryAmount
);
shoppingCartGoodsResponseVo
.
setOriginalTotalAmount
(
shoppingCartGoodsResponseVo
.
getOriginalTotalAmount
()
+
deliveryAmount
);
shoppingCartGoodsResponseVo
.
setOriginalTotalAmount
(
shoppingCartGoodsResponseVo
.
getOriginalTotalAmount
()
+
deliveryAmount
);
shoppingCartGoodsResponseVo
.
setTotalAmount
(
shoppingCartGoodsResponseVo
.
getTotalAmount
()
+
deliveryAmount
);
shoppingCartGoodsResponseVo
.
setTotalAmount
(
shoppingCartGoodsResponseVo
.
getTotalAmount
()
+
deliveryAmount
);
...
...
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