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
7a2aa3b8
Commit
7a2aa3b8
authored
Oct 09, 2020
by
zhiheng.zhang
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop' into develop
parents
f5b59cd4
5a70722f
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
258 additions
and
86 deletions
+258
-86
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/adapter/OrderSdkAdapter.java
+3
-0
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/request/order/CreateOrderProductRequest.java
+2
-0
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/request/order/OrderProductAddInfoDto.java
+2
-0
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/request/order/OrderSpecialExtraAttrRequest.java
+23
-0
assortment-shoppingcart-sdk/src/main/java/com/freemud/sdk/api/assortment/shoppingcart/constant/ShoppingCartConstant.java
+7
-0
order-application-service/src/main/java/cn/freemud/adapter/DeliveryAdapter.java
+31
-2
order-application-service/src/main/java/cn/freemud/adapter/OrderAdapter.java
+24
-2
order-application-service/src/main/java/cn/freemud/entities/dto/QueryOrdersResponseDto.java
+2
-0
shopping-cart-application-service/src/main/java/cn/freemud/adapter/ShoppingCartConvertAdapter.java
+20
-8
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/CartGoods.java
+4
-0
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/ComboxGoodsRequestVo.java
+5
-0
shopping-cart-application-service/src/main/java/cn/freemud/enums/ShoppingCartOperationType.java
+2
-2
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/ShoppingCartMCoffeeServiceImpl.java
+79
-42
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/CalculationServiceImpl.java
+4
-1
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/CouponDiscountCalculation.java
+37
-24
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/SetMealCalculation.java
+7
-5
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/entity/CopyShoppingCartRequestVo.java
+6
-0
No files found.
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/adapter/OrderSdkAdapter.java
View file @
7a2aa3b8
...
@@ -2766,6 +2766,9 @@ public class OrderSdkAdapter {
...
@@ -2766,6 +2766,9 @@ public class OrderSdkAdapter {
if
(
CollectionUtils
.
isNotEmpty
(
product
.
getSpecialCodes
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
product
.
getSpecialCodes
()))
{
extInfo
.
setSpecialCodes
(
product
.
getSpecialCodes
());
extInfo
.
setSpecialCodes
(
product
.
getSpecialCodes
());
}
}
if
(
CollectionUtils
.
isNotEmpty
(
product
.
getSpecialAttrs
()))
{
extInfo
.
setSpecialAttrs
(
product
.
getSpecialAttrs
());
}
if
(
0
!=
product
.
getTax
()){
if
(
0
!=
product
.
getTax
()){
extInfo
.
setTax
(
product
.
getTax
());
extInfo
.
setTax
(
product
.
getTax
());
}
}
...
...
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/request/order/CreateOrderProductRequest.java
View file @
7a2aa3b8
...
@@ -178,4 +178,6 @@ public class CreateOrderProductRequest extends BaseConfig {
...
@@ -178,4 +178,6 @@ public class CreateOrderProductRequest extends BaseConfig {
private
String
taxId
;
private
String
taxId
;
private
List
<
String
>
specialCodes
;
private
List
<
String
>
specialCodes
;
private
List
<
OrderSpecialExtraAttrRequest
>
specialAttrs
;
}
}
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/request/order/OrderProductAddInfoDto.java
View file @
7a2aa3b8
...
@@ -72,4 +72,6 @@ public class OrderProductAddInfoDto extends BaseConfig {
...
@@ -72,4 +72,6 @@ public class OrderProductAddInfoDto extends BaseConfig {
private
String
taxId
;
private
String
taxId
;
private
List
<
String
>
specialCodes
;
private
List
<
String
>
specialCodes
;
private
List
<
OrderSpecialExtraAttrRequest
>
specialAttrs
;
}
}
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/request/order/OrderSpecialExtraAttrRequest.java
0 → 100644
View file @
7a2aa3b8
package
com
.
freemud
.
sdk
.
api
.
assortment
.
order
.
request
.
order
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.List
;
@Data
@AllArgsConstructor
@NoArgsConstructor
public
class
OrderSpecialExtraAttrRequest
{
/**
* 属性名
*/
private
String
attributeName
;
/**
* 入机code
*/
private
String
specialCode
;
}
assortment-shoppingcart-sdk/src/main/java/com/freemud/sdk/api/assortment/shoppingcart/constant/ShoppingCartConstant.java
View file @
7a2aa3b8
...
@@ -50,5 +50,12 @@ public class ShoppingCartConstant {
...
@@ -50,5 +50,12 @@ public class ShoppingCartConstant {
*/
*/
public
static
final
int
PRODUCT_DOWN
=
104
;
public
static
final
int
PRODUCT_DOWN
=
104
;
public
static
final
String
CART_PRODUCT_INVALID_STATE
=
"您选择的【$spuName】商品已失效;"
;
public
static
final
String
CART_PRODUCT_INVALID_STATE
=
"您选择的【$spuName】商品已失效;"
;
/**
* 必选商品组无勾选商品
*/
public
static
final
int
PRODUCT_GROUP_EMPTY
=
109
;
public
static
final
String
CART_PRODUCT_GROUP_EMPTY_STATE
=
"您选择的【$spuName】商品有未选商品"
;
}
}
order-application-service/src/main/java/cn/freemud/adapter/DeliveryAdapter.java
View file @
7a2aa3b8
...
@@ -17,6 +17,7 @@ import com.freemud.sdk.api.assortment.order.enums.OldOrderAccountType;
...
@@ -17,6 +17,7 @@ import com.freemud.sdk.api.assortment.order.enums.OldOrderAccountType;
import
com.freemud.sdk.api.assortment.order.enums.QueryOrderAccountType
;
import
com.freemud.sdk.api.assortment.order.enums.QueryOrderAccountType
;
import
com.freemud.sdk.api.assortment.order.request.order.CreateOrderProductRequest
;
import
com.freemud.sdk.api.assortment.order.request.order.CreateOrderProductRequest
;
import
com.freemud.sdk.api.assortment.order.request.order.OrderProductAddInfoDto
;
import
com.freemud.sdk.api.assortment.order.request.order.OrderProductAddInfoDto
;
import
com.freemud.sdk.api.assortment.order.request.order.OrderSpecialExtraAttrRequest
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -184,7 +185,21 @@ public class DeliveryAdapter {
...
@@ -184,7 +185,21 @@ public class DeliveryAdapter {
order
.
getProductList
().
forEach
(
productList
->
{
order
.
getProductList
().
forEach
(
productList
->
{
ProductInfo
deliveryProductInfo
=
new
ProductInfo
();
ProductInfo
deliveryProductInfo
=
new
ProductInfo
();
deliveryProductInfo
.
setProductCode
(
productList
.
getProductId
());
deliveryProductInfo
.
setProductCode
(
productList
.
getProductId
());
deliveryProductInfo
.
setProductName
(
productList
.
getProductName
());
String
productName
=
StringUtils
.
isBlank
(
productList
.
getSpecificationName
())
?
productList
.
getProductName
()
:
productList
.
getSpecificationName
();
OrderProductAddInfoDto
extInfo
=
JSON
.
parseObject
(
productList
.
getExtInfo
(),
OrderProductAddInfoDto
.
class
);
if
(
CollectionUtils
.
isNotEmpty
(
extInfo
.
getSpecialAttrs
()))
{
String
attr
=
""
;
for
(
OrderSpecialExtraAttrRequest
special
:
extInfo
.
getSpecialAttrs
())
{
if
(
special
.
getAttributeName
().
indexOf
(
"冰"
)
>=
0
)
{
attr
+=
special
.
getAttributeName
()+
","
;
}
}
if
(
attr
.
length
()
>
0
)
{
attr
=
attr
.
substring
(
0
,
attr
.
length
()-
1
);
productName
+=
"("
+
attr
+
")"
;
}
}
deliveryProductInfo
.
setProductName
(
productName
);
deliveryProductInfo
.
setProductNumber
(
productList
.
getNumber
());
deliveryProductInfo
.
setProductNumber
(
productList
.
getNumber
());
deliveryProductInfo
.
setProductPrice
(
productList
.
getSalePrice
().
intValue
());
deliveryProductInfo
.
setProductPrice
(
productList
.
getSalePrice
().
intValue
());
//餐道使用
//餐道使用
...
@@ -200,7 +215,21 @@ public class DeliveryAdapter {
...
@@ -200,7 +215,21 @@ public class DeliveryAdapter {
productList
.
getComboProduct
().
forEach
(
comboProduct
->
{
productList
.
getComboProduct
().
forEach
(
comboProduct
->
{
ProductInfo
deliveryComboProductInfo
=
new
ProductInfo
();
ProductInfo
deliveryComboProductInfo
=
new
ProductInfo
();
deliveryComboProductInfo
.
setProductCode
(
comboProduct
.
getProductId
());
deliveryComboProductInfo
.
setProductCode
(
comboProduct
.
getProductId
());
deliveryComboProductInfo
.
setProductName
(
comboProduct
.
getProductName
());
String
productNameCombo
=
StringUtils
.
isBlank
(
comboProduct
.
getSpecificationName
())
?
comboProduct
.
getProductName
()
:
comboProduct
.
getSpecificationName
();
OrderProductAddInfoDto
extInfoCombo
=
JSON
.
parseObject
(
comboProduct
.
getExtInfo
(),
OrderProductAddInfoDto
.
class
);
if
(
CollectionUtils
.
isNotEmpty
(
extInfoCombo
.
getSpecialAttrs
()))
{
String
attr
=
""
;
for
(
OrderSpecialExtraAttrRequest
special
:
extInfoCombo
.
getSpecialAttrs
())
{
if
(
special
.
getAttributeName
().
indexOf
(
"冰"
)
>=
0
)
{
attr
+=
special
.
getAttributeName
()+
","
;
}
}
if
(
attr
.
length
()
>
0
)
{
attr
=
attr
.
substring
(
0
,
attr
.
length
()-
1
);
productNameCombo
+=
"("
+
attr
+
")"
;
}
}
deliveryComboProductInfo
.
setProductName
(
productNameCombo
);
deliveryComboProductInfo
.
setProductNumber
(
comboProduct
.
getNumber
()/
productList
.
getNumber
());
deliveryComboProductInfo
.
setProductNumber
(
comboProduct
.
getNumber
()/
productList
.
getNumber
());
deliveryComboProductInfo
.
setProductPrice
(
comboProduct
.
getSalePrice
().
intValue
());
deliveryComboProductInfo
.
setProductPrice
(
comboProduct
.
getSalePrice
().
intValue
());
//餐道使用
//餐道使用
...
...
order-application-service/src/main/java/cn/freemud/adapter/OrderAdapter.java
View file @
7a2aa3b8
...
@@ -41,6 +41,7 @@ import cn.freemud.request.wechat.dto.SignMessageBuilder;
...
@@ -41,6 +41,7 @@ import cn.freemud.request.wechat.dto.SignMessageBuilder;
import
cn.freemud.service.impl.OrderCommonService
;
import
cn.freemud.service.impl.OrderCommonService
;
import
cn.freemud.utils.*
;
import
cn.freemud.utils.*
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.freemud.api.assortment.datamanager.entity.db.AssortmentOpenPlatformPartnerWxappConfig
;
import
com.freemud.api.assortment.datamanager.entity.db.AssortmentOpenPlatformPartnerWxappConfig
;
import
com.freemud.api.assortment.datamanager.entity.vo.AssortmentCustomerInfoVo
;
import
com.freemud.api.assortment.datamanager.entity.vo.AssortmentCustomerInfoVo
;
...
@@ -1889,7 +1890,22 @@ public class OrderAdapter {
...
@@ -1889,7 +1890,22 @@ public class OrderAdapter {
ProductVo
productVo
=
new
ProductVo
();
ProductVo
productVo
=
new
ProductVo
();
productVo
.
setId
(
productBean
.
getId
());
productVo
.
setId
(
productBean
.
getId
());
productVo
.
setPid
(
StringUtils
.
isBlank
(
productBean
.
getSpecification
())
?
productBean
.
getProductId
()
:
productBean
.
getSpecification
());
productVo
.
setPid
(
StringUtils
.
isBlank
(
productBean
.
getSpecification
())
?
productBean
.
getProductId
()
:
productBean
.
getSpecification
());
productVo
.
setName
(
StringUtils
.
isBlank
(
productBean
.
getSpecificationName
())
?
productBean
.
getProductName
()
:
productBean
.
getSpecificationName
());
String
productName
=
StringUtils
.
isBlank
(
productBean
.
getSpecificationName
())
?
productBean
.
getProductName
()
:
productBean
.
getSpecificationName
();
OrderProductAddInfoDto
extInfo
=
JSON
.
parseObject
(
productBean
.
getExtInfo
(),
OrderProductAddInfoDto
.
class
);
if
(
CollectionUtils
.
isNotEmpty
(
extInfo
.
getSpecialAttrs
()))
{
String
attr
=
""
;
for
(
OrderSpecialExtraAttrRequest
special
:
extInfo
.
getSpecialAttrs
())
{
if
(
special
.
getAttributeName
().
indexOf
(
"冰"
)
>=
0
)
{
attr
+=
special
.
getAttributeName
()+
","
;
}
}
if
(
attr
.
length
()
>
0
)
{
attr
=
attr
.
substring
(
0
,
attr
.
length
()-
1
);
productName
+=
"("
+
attr
+
")"
;
}
}
productVo
.
setName
(
productName
);
productVo
.
setSpuName
(
productBean
.
getProductName
());
productVo
.
setSpuName
(
productBean
.
getProductName
());
productVo
.
setPicture
(
productBean
.
getPicture
());
productVo
.
setPicture
(
productBean
.
getPicture
());
productVo
.
setSequence
(
productBean
.
getSequence
());
productVo
.
setSequence
(
productBean
.
getSequence
());
...
@@ -2323,7 +2339,13 @@ public class OrderAdapter {
...
@@ -2323,7 +2339,13 @@ public class OrderAdapter {
createOrderProductDemoDto
.
setClassificationId
(
cartGoodsDetailDto
.
getClassificationId
());
createOrderProductDemoDto
.
setClassificationId
(
cartGoodsDetailDto
.
getClassificationId
());
createOrderProductDemoDto
.
setClassificationName
(
cartGoodsDetailDto
.
getClassificationName
());
createOrderProductDemoDto
.
setClassificationName
(
cartGoodsDetailDto
.
getClassificationName
());
if
(
CollectionUtils
.
isNotEmpty
(
cartGoodsDetailDto
.
getSpecialExtra
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
cartGoodsDetailDto
.
getSpecialExtra
()))
{
createOrderProductDemoDto
.
setSpecialCodes
(
cartGoodsDetailDto
.
getSpecialExtra
().
stream
().
map
(
ShoppingCartGoodsDto
.
CartGoodsDetailDto
.
CartGoodsExtra
::
getSpecialCode
).
collect
(
Collectors
.
toList
()));
// createOrderProductDemoDto.setSpecialCodes(cartGoodsDetailDto.getSpecialExtra().stream().map(ShoppingCartGoodsDto.CartGoodsDetailDto.CartGoodsExtra::getSpecialCode).collect(Collectors.toList()));
createOrderProductDemoDto
.
setSpecialAttrs
(
new
ArrayList
<>());
createOrderProductDemoDto
.
setSpecialCodes
(
new
ArrayList
<>());
cartGoodsDetailDto
.
getSpecialExtra
().
stream
().
forEach
(
o
->
{
createOrderProductDemoDto
.
getSpecialAttrs
().
add
(
new
OrderSpecialExtraAttrRequest
(
o
.
getAttributeName
(),
o
.
getSpecialCode
()));
createOrderProductDemoDto
.
getSpecialCodes
().
add
(
o
.
getSpecialCode
());
});
}
}
return
createOrderProductDemoDto
;
return
createOrderProductDemoDto
;
}
}
...
...
order-application-service/src/main/java/cn/freemud/entities/dto/QueryOrdersResponseDto.java
View file @
7a2aa3b8
...
@@ -360,6 +360,8 @@ public class QueryOrdersResponseDto {
...
@@ -360,6 +360,8 @@ public class QueryOrdersResponseDto {
*/
*/
private
String
addInfo
;
private
String
addInfo
;
private
String
extInfo
;
/**
/**
* 套餐--type:6
* 套餐--type:6
*/
*/
...
...
shopping-cart-application-service/src/main/java/cn/freemud/adapter/ShoppingCartConvertAdapter.java
View file @
7a2aa3b8
...
@@ -533,6 +533,9 @@ public class ShoppingCartConvertAdapter {
...
@@ -533,6 +533,9 @@ public class ShoppingCartConvertAdapter {
List
<
ValidateSkuProductType
>
result
=
new
ArrayList
<>();
List
<
ValidateSkuProductType
>
result
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
productComboList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
productComboList
))
{
for
(
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
domain
.
CartGoods
.
ComboxGoods
comboxGoods
:
productComboList
)
{
for
(
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
domain
.
CartGoods
.
ComboxGoods
comboxGoods
:
productComboList
)
{
if
(
"0"
.
equals
(
comboxGoods
.
getGoodsId
())){
continue
;
}
ValidateSkuProductType
validateSkuProductType
=
new
ValidateSkuProductType
();
ValidateSkuProductType
validateSkuProductType
=
new
ValidateSkuProductType
();
validateSkuProductType
.
setProductId
(
StringUtils
.
isNotEmpty
(
comboxGoods
.
getSpuId
())
?
comboxGoods
.
getSpuId
()
:
comboxGoods
.
getSkuId
());
validateSkuProductType
.
setProductId
(
StringUtils
.
isNotEmpty
(
comboxGoods
.
getSpuId
())
?
comboxGoods
.
getSpuId
()
:
comboxGoods
.
getSkuId
());
validateSkuProductType
.
setSkuId
(
comboxGoods
.
getSkuId
());
validateSkuProductType
.
setSkuId
(
comboxGoods
.
getSkuId
());
...
@@ -659,7 +662,9 @@ public class ShoppingCartConvertAdapter {
...
@@ -659,7 +662,9 @@ public class ShoppingCartConvertAdapter {
* @return
* @return
*/
*/
private
void
updateComboxGoodsInfoForMCoffee
(
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
domain
.
CartGoods
.
ComboxGoods
comboxGoods
,
ProductBeanDTO
parentProductBean
,
boolean
isComboxGoods
)
{
private
void
updateComboxGoodsInfoForMCoffee
(
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
domain
.
CartGoods
.
ComboxGoods
comboxGoods
,
ProductBeanDTO
parentProductBean
,
boolean
isComboxGoods
)
{
if
(
"0"
.
equals
(
comboxGoods
.
getGoodsId
())){
return
;
}
ProductBeanDTO
.
ProductComboType
productComboType
=
new
ProductBeanDTO
.
ProductComboType
();
ProductBeanDTO
.
ProductComboType
productComboType
=
new
ProductBeanDTO
.
ProductComboType
();
ProductBeanDTO
.
ProductGroupType
.
GroupDetailType
groupDetailType
=
new
ProductBeanDTO
.
ProductGroupType
.
GroupDetailType
();
ProductBeanDTO
.
ProductGroupType
.
GroupDetailType
groupDetailType
=
new
ProductBeanDTO
.
ProductGroupType
.
GroupDetailType
();
if
(
isComboxGoods
)
{
if
(
isComboxGoods
)
{
...
@@ -833,16 +838,23 @@ public class ShoppingCartConvertAdapter {
...
@@ -833,16 +838,23 @@ public class ShoppingCartConvertAdapter {
//更新当前商品行价格
//更新当前商品行价格
Long
newOrigOriginalPrice
=
0L
;
Long
newOrigOriginalPrice
=
0L
;
if
(
isSetMealProduct
)
{
if
(
isSetMealProduct
)
{
newOrigOriginalPrice
+=
cartGoods
.
getProductComboList
().
stream
().
mapToLong
(
t
->
t
.
getOriginalAmount
()).
sum
();
Long
comboxGoodsOriginalPrice
=
cartGoods
.
getProductComboList
().
stream
().
mapToLong
(
t
->
t
.
getOriginalAmount
()).
sum
();
newOrigOriginalPrice
+=
cartGoods
.
getProductGroupList
().
stream
().
mapToLong
(
t
->
t
.
getOriginalAmount
()).
sum
();
Long
groupGoodsOriginalPrice
=
cartGoods
.
getProductGroupList
().
stream
().
mapToLong
(
t
->
t
.
getOriginalAmount
()).
sum
();
Long
comboxGoodsFinalPrice
=
cartGoods
.
getProductComboList
().
stream
().
mapToLong
(
t
->
t
.
getFinalPrice
()).
sum
();
Long
groupGoodsFinalPrice
=
cartGoods
.
getProductGroupList
().
stream
().
mapToLong
(
t
->
t
.
getFinalPrice
()).
sum
();
cartGoods
.
setOriginalPrice
(
comboxGoodsOriginalPrice
);
cartGoods
.
setOriginalAmount
((
comboxGoodsOriginalPrice
+
groupGoodsOriginalPrice
)*
cartGoods
.
getQty
());
cartGoods
.
setAmount
((
comboxGoodsFinalPrice
+
groupGoodsFinalPrice
)
*
cartGoods
.
getQty
());
//咨询商品服务,套餐售价取originalPrice
cartGoods
.
setFinalPrice
(
comboxGoodsFinalPrice
);
}
else
{
}
else
{
newOrigOriginalPrice
=
isSkuProduct
?
skuProduct
.
getFinalPrice
()
:
spuProduct
.
getFinalPrice
();
newOrigOriginalPrice
=
isSkuProduct
?
skuProduct
.
getFinalPrice
()
:
spuProduct
.
getFinalPrice
();
cartGoods
.
setOriginalPrice
(
newOrigOriginalPrice
);
cartGoods
.
setOriginalAmount
(
newOrigOriginalPrice
*
cartGoods
.
getQty
());
cartGoods
.
setAmount
(
newOrigOriginalPrice
*
cartGoods
.
getQty
());
//咨询商品服务,套餐售价取originalPrice
cartGoods
.
setFinalPrice
(
isSkuProduct
?
skuProduct
.
getFinalPrice
()
:
spuProduct
.
getFinalPrice
());
}
}
cartGoods
.
setOriginalPrice
(
newOrigOriginalPrice
);
cartGoods
.
setOriginalAmount
(
newOrigOriginalPrice
*
cartGoods
.
getQty
());
cartGoods
.
setAmount
(
newOrigOriginalPrice
*
cartGoods
.
getQty
());
//咨询商品服务,套餐售价取originalPrice
cartGoods
.
setFinalPrice
(
isSetMealProduct
?
spuProduct
.
getOriginalPrice
()
:
isSkuProduct
?
skuProduct
.
getFinalPrice
()
:
spuProduct
.
getFinalPrice
());
cartGoods
.
setWeight
(
isSkuProduct
?
skuProduct
.
getWeight
()
:
spuProduct
.
getWeight
());
cartGoods
.
setWeight
(
isSkuProduct
?
skuProduct
.
getWeight
()
:
spuProduct
.
getWeight
());
cartGoods
.
setUnit
(
isSkuProduct
?
skuProduct
.
getUnit
()
:
spuProduct
.
getUnit
());
cartGoods
.
setUnit
(
isSkuProduct
?
skuProduct
.
getUnit
()
:
spuProduct
.
getUnit
());
cartGoods
.
setWeightType
(
CommonsConstant
.
WEIGHT_PRODUCT
.
equals
(
spuProduct
.
getWeightType
()));
cartGoods
.
setWeightType
(
CommonsConstant
.
WEIGHT_PRODUCT
.
equals
(
spuProduct
.
getWeightType
()));
...
...
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/CartGoods.java
View file @
7a2aa3b8
...
@@ -52,6 +52,10 @@ public class CartGoods {
...
@@ -52,6 +52,10 @@ public class CartGoods {
* 商品券code
* 商品券code
*/
*/
private
String
couponCode
;
private
String
couponCode
;
/**
* 商品券名称
*/
private
String
couponName
;
private
String
spuId
;
private
String
spuId
;
private
String
skuId
;
private
String
skuId
;
...
...
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/ComboxGoodsRequestVo.java
View file @
7a2aa3b8
...
@@ -30,6 +30,11 @@ public class ComboxGoodsRequestVo {
...
@@ -30,6 +30,11 @@ public class ComboxGoodsRequestVo {
* 商品组Id
* 商品组Id
*/
*/
private
String
productGroupId
;
private
String
productGroupId
;
/**
* 麦咖啡空键位
*/
private
String
emptyKey
;
/**
/**
* 商品额外的属性
* 商品额外的属性
*/
*/
...
...
shopping-cart-application-service/src/main/java/cn/freemud/enums/ShoppingCartOperationType.java
View file @
7a2aa3b8
...
@@ -17,8 +17,8 @@ public enum ShoppingCartOperationType {
...
@@ -17,8 +17,8 @@ public enum ShoppingCartOperationType {
ADD_PRODUCT_COUPON
(
1
,
"增加商品券"
),
ADD_PRODUCT_COUPON
(
1
,
"增加商品券"
),
ADD_SUPER_PRICE_GOODS
(
2
,
"增加超值加购商品"
),
ADD_SUPER_PRICE_GOODS
(
2
,
"增加超值加购商品"
),
UPDATE3
(
3
,
"切换门店校验"
),
CHECK
(
3
,
"切换门店校验"
),
UPDATE4
(
4
,
"确认切换门店"
)
CONFIRM
(
4
,
"确认切换门店"
)
;
;
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/ShoppingCartMCoffeeServiceImpl.java
View file @
7a2aa3b8
...
@@ -4,6 +4,7 @@ import ch.qos.logback.classic.Level;
...
@@ -4,6 +4,7 @@ import ch.qos.logback.classic.Level;
import
cn.freemud.adapter.ActivityAdapter
;
import
cn.freemud.adapter.ActivityAdapter
;
import
cn.freemud.adapter.ShoppingCartConvertAdapter
;
import
cn.freemud.adapter.ShoppingCartConvertAdapter
;
import
cn.freemud.base.entity.BaseResponse
;
import
cn.freemud.base.entity.BaseResponse
;
import
cn.freemud.constant.ResponseCodeConstant
;
import
cn.freemud.constant.ShoppingCartConstant
;
import
cn.freemud.constant.ShoppingCartConstant
;
import
cn.freemud.entities.dto.*
;
import
cn.freemud.entities.dto.*
;
import
cn.freemud.entities.dto.activity.ActivityQueryDto
;
import
cn.freemud.entities.dto.activity.ActivityQueryDto
;
...
@@ -45,6 +46,9 @@ import com.freemud.application.sdk.api.ordercenter.service.OrderSdkService;
...
@@ -45,6 +46,9 @@ 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.application.sdk.api.productcenter.service.ProductService
;
import
com.freemud.application.sdk.api.productcenter.service.ProductService
;
import
com.freemud.sdk.api.assortment.shoppingcart.constant.CartResponseConstant
;
import
com.freemud.sdk.api.assortment.shoppingcart.constant.CartResponseConstant
;
import
com.freemud.application.sdk.api.storecenter.request.StoreInfoRequest
;
import
com.freemud.application.sdk.api.storecenter.response.StoreResponse
;
import
com.freemud.application.sdk.api.storecenter.service.StoreCenterService
;
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.domain.CartGoodsStates
;
import
com.freemud.sdk.api.assortment.shoppingcart.domain.CartGoodsStates
;
import
com.freemud.sdk.api.assortment.shoppingcart.enums.BusinessTypeEnum
;
import
com.freemud.sdk.api.assortment.shoppingcart.enums.BusinessTypeEnum
;
...
@@ -100,6 +104,8 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -100,6 +104,8 @@ public class ShoppingCartMCoffeeServiceImpl {
private
CouponDiscountCalculation
couponDiscountCalculation
;
private
CouponDiscountCalculation
couponDiscountCalculation
;
@Autowired
@Autowired
private
OrderSdkService
orderSdkService
;
private
OrderSdkService
orderSdkService
;
@Autowired
private
StoreCenterService
storeCenterService
;
@Autowired
@Autowired
private
ProductClient
productClient
;
private
ProductClient
productClient
;
...
@@ -574,7 +580,7 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -574,7 +580,7 @@ public class ShoppingCartMCoffeeServiceImpl {
}
}
List
<
CartGoods
>
onlyCheckGoodsList
=
new
ArrayList
<>();
List
<
CartGoods
>
onlyCheckGoodsList
=
new
ArrayList
<>();
if
(
requestVo
.
getOperationType
()
==
ShoppingCartOperationType
.
UPDATE3
.
getCode
()){
if
(
requestVo
.
getOperationType
()
==
ShoppingCartOperationType
.
CHECK
.
getCode
()){
onlyCheckGoodsList
.
addAll
(
cartGoodsList
);
onlyCheckGoodsList
.
addAll
(
cartGoodsList
);
// 新门店check购物车中所有商品
// 新门店check购物车中所有商品
onlyCheckGoodsList
=
checkCartGoods
(
partnerId
,
toStoreId
,
orderType
,
menuType
,
shoppingCartGoodsResponseVo
,
onlyCheckGoodsList
);
onlyCheckGoodsList
=
checkCartGoods
(
partnerId
,
toStoreId
,
orderType
,
menuType
,
shoppingCartGoodsResponseVo
,
onlyCheckGoodsList
);
...
@@ -583,7 +589,7 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -583,7 +589,7 @@ public class ShoppingCartMCoffeeServiceImpl {
cartGoodsList
=
checkCartGoods
(
partnerId
,
toStoreId
,
orderType
,
menuType
,
shoppingCartGoodsResponseVo
,
cartGoodsList
);
cartGoodsList
=
checkCartGoods
(
partnerId
,
toStoreId
,
orderType
,
menuType
,
shoppingCartGoodsResponseVo
,
cartGoodsList
);
}
}
if
(
requestVo
.
getOperationType
()
==
ShoppingCartOperationType
.
UPDATE3
.
getCode
())
{
if
(
requestVo
.
getOperationType
()
==
ShoppingCartOperationType
.
CHECK
.
getCode
())
{
if
(
StringUtils
.
isNotEmpty
(
shoppingCartGoodsResponseVo
.
getToastMsg
())){
if
(
StringUtils
.
isNotEmpty
(
shoppingCartGoodsResponseVo
.
getToastMsg
())){
//设置更新响应信息,校验失败只弹框提示消息,不切换门店,故将门店id重置为原来门店
//设置更新响应信息,校验失败只弹框提示消息,不切换门店,故将门店id重置为原来门店
shoppingCartGoodsResponseVo
.
setProducts
(
cartGoodsList
);
shoppingCartGoodsResponseVo
.
setProducts
(
cartGoodsList
);
...
@@ -609,7 +615,7 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -609,7 +615,7 @@ public class ShoppingCartMCoffeeServiceImpl {
}
}
}
}
// 新门店check购物车中所有商品
// 新门店check购物车中所有商品
if
(
requestVo
.
getOperationType
()
==
ShoppingCartOperationType
.
UPDATE4
.
getCode
())
{
if
(
requestVo
.
getOperationType
()
==
ShoppingCartOperationType
.
CONFIRM
.
getCode
())
{
// 重新存储新门店购物车
// 重新存储新门店购物车
assortmentSdkService
.
setShoppingCart
(
partnerId
,
toStoreId
,
userId
,
cartGoodsList
,
sessionId
,
""
,
shoppingCartBaseService
);
assortmentSdkService
.
setShoppingCart
(
partnerId
,
toStoreId
,
userId
,
cartGoodsList
,
sessionId
,
""
,
shoppingCartBaseService
);
//清空商品券商品
//清空商品券商品
...
@@ -660,23 +666,31 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -660,23 +666,31 @@ public class ShoppingCartMCoffeeServiceImpl {
if
(
orderInfo
==
null
||
orderInfo
.
getResult
()
==
null
)
{
if
(
orderInfo
==
null
||
orderInfo
.
getResult
()
==
null
)
{
return
ResponseUtil
.
error
(
ResponseResult
.
ORDER_QUERYORDER_ERROR
);
return
ResponseUtil
.
error
(
ResponseResult
.
ORDER_QUERYORDER_ERROR
);
}
}
if
(
orderInfo
.
getResult
().
getOrderType
()
==
3
||
orderInfo
.
getResult
().
getOrderType
()
==
4
)
{
List
<
CartGoods
>
cartGoodsList
=
getOrderGoods
(
orderInfo
.
getResult
());
menuType
=
"saasdelivery"
;
orderType
=
2
;
}
String
storeId
=
orderInfo
.
getResult
().
getStoreId
();
String
storeId
=
orderInfo
.
getResult
().
getStoreId
();
if
(
StringUtils
.
isNotEmpty
(
requestVo
.
getShopId
())){
if
(
StringUtils
.
isNotEmpty
(
requestVo
.
getShopId
())){
storeId
=
requestVo
.
getShopId
();
storeId
=
requestVo
.
getShopId
();
}
}
if
(
orderInfo
.
getResult
().
getOrderType
()
==
3
||
orderInfo
.
getResult
().
getOrderType
()
==
4
)
{
BaseResponse
storeCheckResponse
=
checkOrderByStore
(
orderInfo
.
getResult
().
getPartnerId
(),
storeId
,
LogThreadLocal
.
getTrackingNo
());
menuType
=
"saasdelivery"
;
if
(!
ResponseCodeConstant
.
RESPONSE_SUCCESS_STR
.
equals
(
storeCheckResponse
.
getCode
()))
{
orderType
=
2
;
return
storeCheckResponse
;
}
List
<
CartGoods
>
cartGoodsList
=
getOrderGoods
(
orderInfo
.
getResult
());
if
(
CollectionUtils
.
isEmpty
(
cartGoodsList
))
{
return
ResponseUtil
.
error
(
ResponseResult
.
SHOPPING_CART_GETINFO_INVAILD
);
}
}
// check购物车中所有商品
cartGoodsList
=
checkCartGoods
(
partnerId
,
storeId
,
orderType
,
menuType
,
shoppingCartGoodsResponseVo
,
cartGoodsList
);
// 如果购物车商品不为空, 则check购物车中所有商品
// 如果购物车商品不为空, 则check购物车中所有商品
if
(
CollectionUtils
.
isNotEmpty
(
cartGoodsList
))
{
if
(
shoppingCartGoodsResponseVo
.
getChanged
()
&&
requestVo
.
getOperationType
()
==
ShoppingCartOperationType
.
CHECK
.
getCode
())
{
// check购物车中所有商品
return
ResponseUtil
.
success
(
shoppingCartGoodsResponseVo
);
cartGoodsList
=
checkCartGoods
(
partnerId
,
storeId
,
orderType
,
menuType
,
shoppingCartGoodsResponseVo
,
cartGoodsList
);
// 重新存储最新购物车
assortmentSdkService
.
setShoppingCart
(
partnerId
,
storeId
,
userId
,
cartGoodsList
,
sessionId
,
""
,
shoppingCartBaseService
);
}
}
// 重新存储最新购物车
assortmentSdkService
.
setShoppingCart
(
partnerId
,
storeId
,
userId
,
cartGoodsList
,
sessionId
,
""
,
shoppingCartBaseService
);
// 促销活动的优惠金额计算
// 促销活动的优惠金额计算
calculationService
.
updateShoppingCartGoodsDiscount
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
menuType
,
null
,
null
,
calculationService
.
updateShoppingCartGoodsDiscount
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
menuType
,
null
,
null
,
cartGoodsList
,
new
ArrayList
<>(),
new
ArrayList
<>(),
shoppingCartGoodsResponseVo
);
cartGoodsList
,
new
ArrayList
<>(),
new
ArrayList
<>(),
shoppingCartGoodsResponseVo
);
...
@@ -686,6 +700,29 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -686,6 +700,29 @@ public class ShoppingCartMCoffeeServiceImpl {
return
ResponseUtil
.
success
(
shoppingCartGoodsResponseVo
);
return
ResponseUtil
.
success
(
shoppingCartGoodsResponseVo
);
}
}
/**
* 门店相关校验
*/
private
BaseResponse
checkOrderByStore
(
String
partnerId
,
String
shopId
,
String
trackingNo
)
{
// 获取门店信息
StoreInfoRequest
storeInfoRequest
=
new
StoreInfoRequest
(
partnerId
,
shopId
,
null
);
StoreResponse
storeResponse
=
storeCenterService
.
getStoreInfo
(
storeInfoRequest
,
trackingNo
);
if
(
storeResponse
==
null
||
storeResponse
.
getBizVO
()
==
null
)
{
return
ResponseUtil
.
error
(
ResponseResult
.
STORE_NOT_FOUND
);
}
StoreResponse
.
BizVO
storeResponseDto
=
storeResponse
.
getBizVO
();
// 校验门店是否营业
if
(
storeResponseDto
.
getActiveFlag
()
==
null
||
storeResponseDto
.
getActiveFlag
()
!=
1
||
storeResponseDto
.
getState
()
==
null
||
storeResponseDto
.
getState
().
equals
(
"3"
))
{
return
ResponseUtil
.
error
(
ResponseResult
.
STORE_ITEM_STOP_BUSINESS
);
}
if
(
storeResponseDto
.
getActiveFlag
()
==
1
&&
storeResponseDto
.
getState
().
equals
(
"2"
))
{
return
ResponseUtil
.
error
(
ResponseResult
.
STORE_ITEM_CHECK_CLOSE
);
}
return
ResponseUtil
.
success
();
}
private
List
<
CartGoods
>
getOrderGoods
(
OrderInfoReqs
orderInfo
)
{
private
List
<
CartGoods
>
getOrderGoods
(
OrderInfoReqs
orderInfo
)
{
if
(
orderInfo
==
null
||
CollectionUtils
.
isEmpty
(
orderInfo
.
getOrderItemList
()))
{
if
(
orderInfo
==
null
||
CollectionUtils
.
isEmpty
(
orderInfo
.
getOrderItemList
()))
{
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_PRODUCT_NOT_EXIST
);
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_PRODUCT_NOT_EXIST
);
...
@@ -705,7 +742,9 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -705,7 +742,9 @@ public class ShoppingCartMCoffeeServiceImpl {
cartGoods
.
setGoodsType
(
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
constant
.
GoodsTypeEnum
.
SET_MEAL_GOODS
.
getGoodsType
());
cartGoods
.
setGoodsType
(
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
constant
.
GoodsTypeEnum
.
SET_MEAL_GOODS
.
getGoodsType
());
}
else
if
(
10
==
orderItem
.
getProductType
())
{
}
else
if
(
10
==
orderItem
.
getProductType
())
{
cartGoods
.
setGoodsType
(
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
constant
.
GoodsTypeEnum
.
SKU_GOODS
.
getGoodsType
());
cartGoods
.
setGoodsType
(
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
constant
.
GoodsTypeEnum
.
SKU_GOODS
.
getGoodsType
());
}
else
{
}
else
if
(!
orderItem
.
getProductId
().
equals
(
orderItem
.
getProductSpec
()))
{
cartGoods
.
setGoodsType
(
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
constant
.
GoodsTypeEnum
.
SKU_GOODS
.
getGoodsType
());
}
else
{
cartGoods
.
setGoodsType
(
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
constant
.
GoodsTypeEnum
.
COMMON_GOODS
.
getGoodsType
());
cartGoods
.
setGoodsType
(
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
constant
.
GoodsTypeEnum
.
COMMON_GOODS
.
getGoodsType
());
}
}
if
((
"早餐啡常搭"
.
equals
(
orderItem
.
getProductName
())
&&
"早餐啡常搭"
.
equals
(
orderItem
.
getProductSpecName
()))
if
((
"早餐啡常搭"
.
equals
(
orderItem
.
getProductName
())
&&
"早餐啡常搭"
.
equals
(
orderItem
.
getProductSpecName
()))
...
@@ -713,6 +752,10 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -713,6 +752,10 @@ public class ShoppingCartMCoffeeServiceImpl {
cartGoods
.
setName
(
orderItem
.
getProductName
());
cartGoods
.
setName
(
orderItem
.
getProductName
());
cartGoods
.
setSpuName
(
orderItem
.
getProductName
());
cartGoods
.
setSpuName
(
orderItem
.
getProductName
());
cartGoods
.
setSkuName
(
orderItem
.
getProductName
());
cartGoods
.
setSkuName
(
orderItem
.
getProductName
());
}
else
{
cartGoods
.
setName
(
orderItem
.
getProductName
());
cartGoods
.
setSkuName
(
orderItem
.
getProductSpecName
());
cartGoods
.
setSpuName
(
orderItem
.
getProductName
());
}
}
if
(
ObjectUtils
.
equals
(
ProductTypeEnum
.
SETMEAL_PRODUCT
.
getCode
(),
orderItem
.
getProductType
())
||
ObjectUtils
.
equals
(
ProductTypeEnum
.
SETMEAL_UPPRICE_PRODUCT
.
getCode
(),
orderItem
.
getProductType
()))
{
if
(
ObjectUtils
.
equals
(
ProductTypeEnum
.
SETMEAL_PRODUCT
.
getCode
(),
orderItem
.
getProductType
())
||
ObjectUtils
.
equals
(
ProductTypeEnum
.
SETMEAL_UPPRICE_PRODUCT
.
getCode
(),
orderItem
.
getProductType
()))
{
// 获取套餐子商品列表
// 获取套餐子商品列表
...
@@ -731,7 +774,7 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -731,7 +774,7 @@ public class ShoppingCartMCoffeeServiceImpl {
private
CartGoods
.
ComboxGoods
getComboxGoods
(
CartGoods
cartGoods
,
OrderItemResp
orderItemResp
)
{
private
CartGoods
.
ComboxGoods
getComboxGoods
(
CartGoods
cartGoods
,
OrderItemResp
orderItemResp
)
{
CartGoods
.
ComboxGoods
comboxGoods
=
new
CartGoods
.
ComboxGoods
();
CartGoods
.
ComboxGoods
comboxGoods
=
new
CartGoods
.
ComboxGoods
();
comboxGoods
.
setSkuId
(
orderItemResp
.
getProduct
Id
());
comboxGoods
.
setSkuId
(
orderItemResp
.
getProduct
Spec
());
comboxGoods
.
setGoodsId
(
orderItemResp
.
getProductId
());
comboxGoods
.
setGoodsId
(
orderItemResp
.
getProductId
());
comboxGoods
.
setQty
(
orderItemResp
.
getProductQuantity
());
comboxGoods
.
setQty
(
orderItemResp
.
getProductQuantity
());
comboxGoods
.
setOriginalPrice
(
orderItemResp
.
getProductPrice
().
longValue
());
comboxGoods
.
setOriginalPrice
(
orderItemResp
.
getProductPrice
().
longValue
());
...
@@ -753,32 +796,6 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -753,32 +796,6 @@ public class ShoppingCartMCoffeeServiceImpl {
if
(
map
.
containsKey
(
"isFixedProduct"
)
&&
!(
boolean
)
map
.
get
(
"isFixedProduct"
))
{
if
(
map
.
containsKey
(
"isFixedProduct"
)
&&
!(
boolean
)
map
.
get
(
"isFixedProduct"
))
{
cartGoods
.
getProductGroupList
().
add
(
comboxGoods
);
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
;
return
comboxGoods
;
}
}
...
@@ -1090,6 +1107,20 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -1090,6 +1107,20 @@ public class ShoppingCartMCoffeeServiceImpl {
productCombox
.
setExtra
(
vo
.
getExtra
());
productCombox
.
setExtra
(
vo
.
getExtra
());
productCombox
.
setSpecialExtra
(
vo
.
getSpecialExtra
());
productCombox
.
setSpecialExtra
(
vo
.
getSpecialExtra
());
productCombox
.
setProductGroupId
(
StringUtils
.
isEmpty
(
vo
.
getProductGroupId
())
?
null
:
Long
.
parseLong
(
vo
.
getProductGroupId
()));
productCombox
.
setProductGroupId
(
StringUtils
.
isEmpty
(
vo
.
getProductGroupId
())
?
null
:
Long
.
parseLong
(
vo
.
getProductGroupId
()));
if
(
StringUtils
.
isNotEmpty
(
vo
.
getEmptyKey
())){
productCombox
.
setGoodsId
(
"0"
);
productCombox
.
setSkuId
(
"0"
);
productCombox
.
setSpuId
(
"0"
);
productCombox
.
setCustomerCode
(
vo
.
getEmptyKey
());
productCombox
.
setName
(
"无"
);
productCombox
.
setSpuName
(
"无"
);
productCombox
.
setSkuName
(
"无"
);
productCombox
.
setFinalPrice
(
0L
);
productCombox
.
setOriginalPrice
(
0L
);
productCombox
.
setOriginalAmount
(
0L
);
productCombox
.
setAmount
(
0L
);
productCombox
.
setQty
(
1
);
}
//加料商品集
//加料商品集
if
(
CollectionUtils
.
isNotEmpty
(
vo
.
getProductMaterialList
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
vo
.
getProductMaterialList
()))
{
List
<
CartGoods
.
MaterialGoods
>
comboxMaterialGoodsList
=
new
ArrayList
<>();
List
<
CartGoods
.
MaterialGoods
>
comboxMaterialGoodsList
=
new
ArrayList
<>();
...
@@ -1245,6 +1276,7 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -1245,6 +1276,7 @@ public class ShoppingCartMCoffeeServiceImpl {
ValiadShopProductResponse
validateResult
=
valiadResponse
.
getData
();
ValiadShopProductResponse
validateResult
=
valiadResponse
.
getData
();
CartGoodsStates
cartGoodsStates
=
new
CartGoodsStates
();
CartGoodsStates
cartGoodsStates
=
new
CartGoodsStates
();
String
toastMsg
=
""
;
//非法商品(商品是否存在、商品是否处于上架状态)自动移除,返回前端提示
//非法商品(商品是否存在、商品是否处于上架状态)自动移除,返回前端提示
if
(
CollectionUtils
.
isNotEmpty
(
validateResult
.
getFailureList
())){
if
(
CollectionUtils
.
isNotEmpty
(
validateResult
.
getFailureList
())){
List
<
String
>
invalidSpu
=
new
ArrayList
<>();
List
<
String
>
invalidSpu
=
new
ArrayList
<>();
...
@@ -1273,11 +1305,16 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -1273,11 +1305,16 @@ public class ShoppingCartMCoffeeServiceImpl {
List
<
ProductBeanDTO
>
productList
=
validateResult
.
getFailureList
().
stream
().
map
(
ValiadShopProductResult:
:
getProductType
).
collect
(
Collectors
.
toList
());
List
<
ProductBeanDTO
>
productList
=
validateResult
.
getFailureList
().
stream
().
map
(
ValiadShopProductResult:
:
getProductType
).
collect
(
Collectors
.
toList
());
shoppingCartConvertAdapter
.
updateCartGoodsInfoForMCoffee
(
cartGoods
,
productList
);
shoppingCartConvertAdapter
.
updateCartGoodsInfoForMCoffee
(
cartGoods
,
productList
);
}
}
if
(
PRODUCT_GROUP_EMPTY
==
validaProduct
.
getCode
())
{
cartGoodsStates
.
setHasInvalidGoods
(
true
);
cartGoods
.
setCartGoodsUid
(
null
);
toastMsg
=
toastMsg
.
concat
(
CART_PRODUCT_GROUP_EMPTY_STATE
.
replace
(
"$spuName"
,
StringUtils
.
join
(
Arrays
.
asList
(
spuName
),
","
)));
break
;
}
}
}
}
}
}
}
String
toastMsg
=
""
;
if
(
CollectionUtils
.
isNotEmpty
(
invalidSpu
)){
if
(
CollectionUtils
.
isNotEmpty
(
invalidSpu
)){
toastMsg
=
toastMsg
.
concat
(
CART_PRODUCT_INVALID_STATE
.
replace
(
"$spuName"
,
StringUtils
.
join
(
invalidSpu
,
","
)));
toastMsg
=
toastMsg
.
concat
(
CART_PRODUCT_INVALID_STATE
.
replace
(
"$spuName"
,
StringUtils
.
join
(
invalidSpu
,
","
)));
}
}
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/CalculationServiceImpl.java
View file @
7a2aa3b8
...
@@ -301,7 +301,7 @@ public class CalculationServiceImpl {
...
@@ -301,7 +301,7 @@ public class CalculationServiceImpl {
* 配送金额
* 配送金额
*/
*/
private
Long
calculateDeliveryAmount
(
String
receiveId
,
String
partnerId
,
String
storeId
,
String
menuType
)
{
private
Long
calculateDeliveryAmount
(
String
receiveId
,
String
partnerId
,
String
storeId
,
String
menuType
)
{
Long
deliveryAmount
=
0
l
;
Long
deliveryAmount
=
100
0
l
;
if
(
StringUtils
.
isBlank
(
receiveId
)
||
!
BusinessTypeEnum
.
SAAS_DELIVERY
.
getCode
().
equals
(
menuType
))
{
if
(
StringUtils
.
isBlank
(
receiveId
)
||
!
BusinessTypeEnum
.
SAAS_DELIVERY
.
getCode
().
equals
(
menuType
))
{
return
deliveryAmount
;
return
deliveryAmount
;
}
}
...
@@ -379,6 +379,9 @@ public class CalculationServiceImpl {
...
@@ -379,6 +379,9 @@ public class CalculationServiceImpl {
//可选搭配
//可选搭配
if
(
cartGoods
!=
null
&&
CollectionUtils
.
isNotEmpty
(
cartGoods
.
getProductGroupList
()))
{
if
(
cartGoods
!=
null
&&
CollectionUtils
.
isNotEmpty
(
cartGoods
.
getProductGroupList
()))
{
for
(
CartGoods
.
ComboxGoods
materialGoods
:
cartGoods
.
getProductGroupList
())
{
for
(
CartGoods
.
ComboxGoods
materialGoods
:
cartGoods
.
getProductGroupList
())
{
if
(
"0"
.
equals
(
materialGoods
.
getGoodsId
())){
continue
;
}
ActivityCalculationDiscountRequestDto
.
CalculationDiscountGoods
.
Material
material
=
new
ActivityCalculationDiscountRequestDto
.
CalculationDiscountGoods
.
Material
();
ActivityCalculationDiscountRequestDto
.
CalculationDiscountGoods
.
Material
material
=
new
ActivityCalculationDiscountRequestDto
.
CalculationDiscountGoods
.
Material
();
material
.
setType
(
2
);
material
.
setType
(
2
);
material
.
setGoodsId
(
materialGoods
.
getGoodsId
());
material
.
setGoodsId
(
materialGoods
.
getGoodsId
());
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/CouponDiscountCalculation.java
View file @
7a2aa3b8
...
@@ -75,9 +75,9 @@ public class CouponDiscountCalculation {
...
@@ -75,9 +75,9 @@ public class CouponDiscountCalculation {
*/
*/
public
void
updateShoppingCartGoodsDiscount
(
CouponPromotionVO
couponPromotionVO
,
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscountResult
,
List
<
CartGoods
>
cartGoodsList
,
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
)
{
public
void
updateShoppingCartGoodsDiscount
(
CouponPromotionVO
couponPromotionVO
,
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscountResult
,
List
<
CartGoods
>
cartGoodsList
,
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
)
{
if
(
calculationDiscountResult
==
null
||
CollectionUtils
.
isEmpty
(
calculationDiscountResult
.
get
Coupon
Discounts
())
if
(
calculationDiscountResult
==
null
||
CollectionUtils
.
isEmpty
(
calculationDiscountResult
.
getDiscounts
())
||
!
calculationDiscountResult
.
get
CouponDiscounts
().
stream
().
anyMatch
(
discount
->
(
ActivityTypeEnum
.
TYPE_3
.
getCode
().
equals
(
discount
.
getActivity
Type
())
||
!
calculationDiscountResult
.
get
Discounts
().
stream
().
anyMatch
(
discount
->
(
ActivityTypeEnum
.
TYPE_3
.
getCode
().
equals
(
discount
.
get
Type
())
||(
ActivityTypeEnum
.
TYPE_31
.
getCode
().
equals
(
discount
.
get
ActivityType
()))
||
(
ActivityTypeEnum
.
TYPE_32
.
getCode
().
equals
(
discount
.
getActivity
Type
()))
)))
{
||(
ActivityTypeEnum
.
TYPE_31
.
getCode
().
equals
(
discount
.
get
Type
()))
||
(
ActivityTypeEnum
.
TYPE_32
.
getCode
().
equals
(
discount
.
get
Type
()))
)))
{
return
;
return
;
}
}
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
>
goodsList
=
calculationDiscountResult
.
getGoods
();
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
>
goodsList
=
calculationDiscountResult
.
getGoods
();
...
@@ -109,33 +109,44 @@ public class CouponDiscountCalculation {
...
@@ -109,33 +109,44 @@ public class CouponDiscountCalculation {
continue
;
continue
;
}
}
cartGoods
.
setAmount
(
goodsMap
.
get
(
cartGoods
.
getGoodsId
()).
getRealAmount
());
cartGoods
.
setAmount
(
goodsMap
.
get
(
cartGoods
.
getGoodsId
()).
getRealAmount
());
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
>
discounts
=
goodsMap
.
get
(
cartGoods
.
getGoodsId
()).
getDiscounts
();
if
(
CollectionUtils
.
isNotEmpty
(
discounts
))
{
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
goodsDiscount
=
discounts
.
stream
().
filter
(
t
->
ActivityTypeEnum
.
TYPE_32
.
getCode
().
equals
(
t
.
getType
())).
findFirst
().
get
();
cartGoods
.
setCouponName
(
goodsDiscount
.
getActivityName
());
}
}
}
}
}
// 当couponCode不为空时,需计算优惠价格
// 当couponCode不为空时,需计算优惠价格
long
couponDiscount
=
0
;
long
couponDiscount
=
0
;
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
CouponResults
>
couponResultsList
=
calculationDiscountResult
.
getCouponDiscounts
();
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Discount
>
discounts
=
calculationDiscountResult
.
getDiscounts
();
if
(
CollectionUtils
.
isNotEmpty
(
couponResultsList
))
{
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Discount
>
couponDiscounts
=
discounts
.
stream
().
filter
(
discount
->
(
ActivityTypeEnum
.
TYPE_3
.
getCode
().
equals
(
discount
.
getType
())
for
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
CouponResults
couponResults
:
couponResultsList
)
{
||
(
ActivityTypeEnum
.
TYPE_31
.
getCode
().
equals
(
discount
.
getType
()))
||
(
ActivityTypeEnum
.
TYPE_32
.
getCode
().
equals
(
discount
.
getType
())))).
collect
(
Collectors
.
toList
());
couponDiscount
=
couponDiscount
+
(
couponResults
.
getDiscountAmount
()
==
null
?
0
:
couponResults
.
getDiscountAmount
());
if
(
CollectionUtils
.
isNotEmpty
(
couponDiscounts
))
{
for
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Discount
couponResults
:
couponDiscounts
)
{
couponDiscount
=
couponDiscount
+
(
couponResults
.
getDiscount
()
==
null
?
0
:
couponResults
.
getDiscount
());
}
}
}
}
shoppingCartGoodsResponseVo
.
setCouponDiscount
(
couponDiscount
);
shoppingCartGoodsResponseVo
.
setCouponDiscount
(
couponDiscount
);
}
}
/**
/**
* 商品均摊
* 商品均摊
*/
*/
public
void
updateShoppingCartGoodsApportion
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscountResult
,
ShoppingCartGoodsDto
shoppingCartGoodsDto
){
public
void
updateShoppingCartGoodsApportion
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscountResult
,
ShoppingCartGoodsDto
shoppingCartGoodsDto
){
if
(
calculationDiscountResult
==
null
||
CollectionUtils
.
isEmpty
(
calculationDiscountResult
.
get
Coupon
Discounts
())
if
(
calculationDiscountResult
==
null
||
CollectionUtils
.
isEmpty
(
calculationDiscountResult
.
getDiscounts
())
||
!
calculationDiscountResult
.
get
CouponDiscounts
().
stream
().
anyMatch
(
discount
->
(
ActivityTypeEnum
.
TYPE_3
.
getCode
().
equals
(
discount
.
getActivity
Type
())
||
!
calculationDiscountResult
.
get
Discounts
().
stream
().
anyMatch
(
discount
->
(
ActivityTypeEnum
.
TYPE_3
.
getCode
().
equals
(
discount
.
get
Type
())
||(
ActivityTypeEnum
.
TYPE_31
.
getCode
().
equals
(
discount
.
get
ActivityType
()))
||
(
ActivityTypeEnum
.
TYPE_32
.
getCode
().
equals
(
discount
.
getActivity
Type
()))
)))
{
||(
ActivityTypeEnum
.
TYPE_31
.
getCode
().
equals
(
discount
.
get
Type
()))
||
(
ActivityTypeEnum
.
TYPE_32
.
getCode
().
equals
(
discount
.
get
Type
()))
)))
{
return
;
return
;
}
}
//订单级别券优惠
//订单级别券优惠
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
CouponResults
>
couponDiscounts
=
calculationDiscountResult
.
getCouponDiscounts
();
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Discount
>
couponDiscounts
=
calculationDiscountResult
.
getDiscounts
();
if
(
CollectionUtils
.
isEmpty
(
couponDiscounts
))
{
return
;
}
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Discount
>
discounts
=
couponDiscounts
.
stream
().
filter
(
discount
->
(
ActivityTypeEnum
.
TYPE_3
.
getCode
().
equals
(
discount
.
getType
())
||
(
ActivityTypeEnum
.
TYPE_31
.
getCode
().
equals
(
discount
.
getType
()))
||
(
ActivityTypeEnum
.
TYPE_32
.
getCode
().
equals
(
discount
.
getType
())))).
collect
(
Collectors
.
toList
());
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
>
goodsList
=
calculationDiscountResult
.
getGoods
();
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
>
goodsList
=
calculationDiscountResult
.
getGoods
();
if
(
CollectionUtils
.
isEmpty
(
goodsList
))
{
if
(
CollectionUtils
.
isEmpty
(
goodsList
))
{
...
@@ -149,18 +160,20 @@ public class CouponDiscountCalculation {
...
@@ -149,18 +160,20 @@ public class CouponDiscountCalculation {
//商品券商品
//商品券商品
if
(
StringUtils
.
isNotEmpty
(
cartGoods
.
getCouponCode
()))
{
if
(
StringUtils
.
isNotEmpty
(
cartGoods
.
getCouponCode
()))
{
List
<
ActivityDiscountsDto
>
productActivityDiscountsDtos
=
new
ArrayList
<>();
List
<
ActivityDiscountsDto
>
productActivityDiscountsDtos
=
new
ArrayList
<>();
for
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
CouponResults
couponDiscount
:
couponDiscounts
)
{
if
(
CollectionUtils
.
isNotEmpty
(
discounts
))
{
if
(
couponDiscount
.
getCouponCode
().
equals
(
cartGoods
.
getCouponCode
())){
for
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Discount
couponDiscount
:
discounts
)
{
ActivityDiscountsDto
activityDiscountsDto
=
new
ActivityDiscountsDto
();
if
(
couponDiscount
.
getActivityCode
().
equals
(
cartGoods
.
getCouponCode
()))
{
activityDiscountsDto
.
setActivityCode
(
couponDiscount
.
getCouponCode
());
ActivityDiscountsDto
activityDiscountsDto
=
new
ActivityDiscountsDto
();
activityDiscountsDto
.
setActivityName
(
couponDiscount
.
getActivityName
());
activityDiscountsDto
.
setActivityCode
(
couponDiscount
.
getActivityCode
());
activityDiscountsDto
.
setActivityType
(
couponDiscount
.
getActivityType
());
activityDiscountsDto
.
setActivityName
(
couponDiscount
.
getActivityName
());
activityDiscountsDto
.
setDiscountAmount
(
0
-
couponDiscount
.
getDiscountAmount
());
activityDiscountsDto
.
setActivityType
(
couponDiscount
.
getType
());
productActivityDiscountsDtos
.
add
(
activityDiscountsDto
);
activityDiscountsDto
.
setDiscountAmount
(
0
-
couponDiscount
.
getDiscount
());
productActivityDiscountsDtos
.
add
(
activityDiscountsDto
);
cartGoods
.
setTotalDiscountAmount
(-
activityDiscountsDto
.
getDiscountAmount
());
cartGoods
.
setSalePrice
(
0L
);
cartGoods
.
setTotalDiscountAmount
(-
activityDiscountsDto
.
getDiscountAmount
());
cartGoods
.
setActivityDiscountsDtos
(
productActivityDiscountsDtos
);
cartGoods
.
setSalePrice
(
0L
);
cartGoods
.
setActivityDiscountsDtos
(
productActivityDiscountsDtos
);
}
}
}
}
}
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/SetMealCalculation.java
View file @
7a2aa3b8
...
@@ -70,13 +70,15 @@ public class SetMealCalculation {
...
@@ -70,13 +70,15 @@ public class SetMealCalculation {
long
productComboTotalAmount
=
productComboAmount
*
cartGoods
.
getQty
();
long
productComboTotalAmount
=
productComboAmount
*
cartGoods
.
getQty
();
cartGoods
.
setOriginalAmount
(
productGroupTotalAmount
+
productComboTotalAmount
);
cartGoods
.
setOriginalAmount
(
productGroupTotalAmount
+
productComboTotalAmount
);
cartGoods
.
setOriginalPrice
(
productGroupTotalAmount
+
productComboTotalAmount
);
cartGoods
.
setOriginalPrice
(
productComboTotalAmount
);
cartGoods
.
setAmount
(
productGroupTotalAmount
+
productComboTotalAmount
);
cartGoods
.
setFinalPrice
(
productComboTotalAmount
);
// 套餐(固定商品)现价
// 套餐(固定商品)现价
String
toastMsg
=
getTotalAmount
(
cartGoods
,
productGroupAmount
,
numberMap
,
goodsMap
);
//
String toastMsg = getTotalAmount(cartGoods, productGroupAmount, numberMap, goodsMap);
if
(
StringUtils
.
isNotEmpty
(
toastMsg
))
{
//
if (StringUtils.isNotEmpty(toastMsg)) {
shoppingCartGoodsResponseVo
.
setToastMsg
(
toastMsg
);
//
shoppingCartGoodsResponseVo.setToastMsg(toastMsg);
}
//
}
}
}
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/entity/CopyShoppingCartRequestVo.java
View file @
7a2aa3b8
...
@@ -44,4 +44,10 @@ public class CopyShoppingCartRequestVo {
...
@@ -44,4 +44,10 @@ public class CopyShoppingCartRequestVo {
@NotEmpty
(
message
=
"orderId不能为空"
)
@NotEmpty
(
message
=
"orderId不能为空"
)
private
String
orderId
;
private
String
orderId
;
/**
* 操作类型 ShoppingCartOperationType 枚举
* 校验通过直接返回购物车商品数据
*/
private
Integer
operationType
;
}
}
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