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
8360d19b
Commit
8360d19b
authored
Oct 29, 2020
by
chongfu.liang
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/qa' into qa
parents
6d423c9c
b952bcad
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
166 additions
and
46 deletions
+166
-46
order-application-service/src/main/java/cn/freemud/adapter/DeliveryAdapter.java
+53
-4
order-application-service/src/main/java/cn/freemud/adapter/OrderAdapter.java
+3
-10
shopping-cart-application-service/src/main/java/cn/freemud/adapter/ShoppingCartConvertAdapter.java
+3
-3
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/ShoppingCartMCoffeeServiceImpl.java
+59
-13
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/CalculationServiceImpl.java
+16
-2
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/CouponDiscountCalculation.java
+15
-12
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/SetMealCalculation.java
+17
-2
No files found.
order-application-service/src/main/java/cn/freemud/adapter/DeliveryAdapter.java
View file @
8360d19b
...
@@ -18,6 +18,7 @@ import com.freemud.sdk.api.assortment.order.enums.QueryOrderAccountType;
...
@@ -18,6 +18,7 @@ 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
com.freemud.sdk.api.assortment.order.request.order.OrderSpecialExtraAttrRequest
;
import
com.freemud.sdk.api.assortment.order.response.order.QueryOrdersResponse
;
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
;
...
@@ -191,14 +192,20 @@ public class DeliveryAdapter {
...
@@ -191,14 +192,20 @@ public class DeliveryAdapter {
String
attr
=
""
;
String
attr
=
""
;
for
(
OrderSpecialExtraAttrRequest
special
:
extInfo
.
getSpecialAttrs
())
{
for
(
OrderSpecialExtraAttrRequest
special
:
extInfo
.
getSpecialAttrs
())
{
if
(
special
.
getAttributeName
().
indexOf
(
"冰"
)
>=
0
)
{
if
(
special
.
getAttributeName
().
indexOf
(
"冰"
)
>=
0
)
{
attr
+=
special
.
getAttributeName
()+
","
;
attr
=
special
.
getAttributeName
();
break
;
}
}
}
}
if
(
attr
.
length
()
>
0
)
{
if
(
attr
.
length
()
>
0
)
{
attr
=
attr
.
substring
(
0
,
attr
.
length
()-
1
);
productName
+=
"("
+
attr
+
")"
;
productName
+=
"("
+
attr
+
")"
;
}
}
}
}
if
(
CollectionUtils
.
isNotEmpty
(
productList
.
getMaterialProduct
()))
{
for
(
QueryOrdersResponseDto
.
DataBean
.
OrderBean
.
ProductBean
material
:
productList
.
getMaterialProduct
())
{
productName
+=
"/"
+
material
.
getSpecificationName
();
}
}
deliveryProductInfo
.
setProductName
(
productName
);
deliveryProductInfo
.
setProductName
(
productName
);
deliveryProductInfo
.
setProductNumber
(
productList
.
getNumber
());
deliveryProductInfo
.
setProductNumber
(
productList
.
getNumber
());
deliveryProductInfo
.
setProductPrice
(
productList
.
getSalePrice
().
intValue
());
deliveryProductInfo
.
setProductPrice
(
productList
.
getSalePrice
().
intValue
());
...
@@ -221,14 +228,20 @@ public class DeliveryAdapter {
...
@@ -221,14 +228,20 @@ public class DeliveryAdapter {
String
attr
=
""
;
String
attr
=
""
;
for
(
OrderSpecialExtraAttrRequest
special
:
extInfoCombo
.
getSpecialAttrs
())
{
for
(
OrderSpecialExtraAttrRequest
special
:
extInfoCombo
.
getSpecialAttrs
())
{
if
(
special
.
getAttributeName
().
indexOf
(
"冰"
)
>=
0
)
{
if
(
special
.
getAttributeName
().
indexOf
(
"冰"
)
>=
0
)
{
attr
+=
special
.
getAttributeName
()+
","
;
attr
=
special
.
getAttributeName
();
break
;
}
}
}
}
if
(
attr
.
length
()
>
0
)
{
if
(
attr
.
length
()
>
0
)
{
attr
=
attr
.
substring
(
0
,
attr
.
length
()-
1
);
productNameCombo
+=
"("
+
attr
+
")"
;
productNameCombo
+=
"("
+
attr
+
")"
;
}
}
}
}
if
(
CollectionUtils
.
isNotEmpty
(
comboProduct
.
getMaterialProduct
()))
{
for
(
QueryOrdersResponseDto
.
DataBean
.
OrderBean
.
ProductBean
material
:
comboProduct
.
getMaterialProduct
())
{
productNameCombo
+=
"/"
+
material
.
getSpecificationName
();
}
}
deliveryComboProductInfo
.
setProductName
(
productNameCombo
);
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
());
...
@@ -241,12 +254,35 @@ public class DeliveryAdapter {
...
@@ -241,12 +254,35 @@ public class DeliveryAdapter {
deliveryComboProductInfo
.
setParentCode
(
Long
.
valueOf
(
comboProduct
.
getParentProductId
().
replace
(
"_"
,
""
)));
deliveryComboProductInfo
.
setParentCode
(
Long
.
valueOf
(
comboProduct
.
getParentProductId
().
replace
(
"_"
,
""
)));
deliveryProductInfo
.
setProductCode
(
deliveryComboProductInfo
.
getParentCode
()+
""
);
deliveryProductInfo
.
setProductCode
(
deliveryComboProductInfo
.
getParentCode
()+
""
);
if
(
CollectionUtils
.
isNotEmpty
(
comboProduct
.
getMaterialProduct
()))
{
comboProduct
.
getMaterialProduct
().
forEach
(
o
->
{
deliveryComboProductInfo
.
setProductPrice
(
deliveryComboProductInfo
.
getProductPrice
()
+
o
.
getSalePrice
().
intValue
());
//餐道使用
deliveryComboProductInfo
.
setCumulatedTotal
(
deliveryComboProductInfo
.
getCumulatedTotal
()
+
comboProduct
.
getNumber
()
*
o
.
getSalePrice
().
intValue
());
deliveryProductInfo
.
setProductPrice
(
deliveryProductInfo
.
getProductPrice
()
+
o
.
getSalePrice
().
intValue
());
//餐道使用
deliveryProductInfo
.
setCumulatedTotal
(
deliveryProductInfo
.
getCumulatedTotal
()
+
comboProduct
.
getNumber
()
*
o
.
getSalePrice
().
intValue
());
});
}
productInfos
.
add
(
deliveryComboProductInfo
);
productInfos
.
add
(
deliveryComboProductInfo
);
});
});
}
}
if
(
CollectionUtils
.
isNotEmpty
(
productList
.
getMaterialProduct
()))
{
productList
.
getMaterialProduct
().
forEach
(
o
->
{
deliveryProductInfo
.
setProductPrice
(
deliveryProductInfo
.
getProductPrice
()
+
o
.
getSalePrice
().
intValue
());
//餐道使用
deliveryProductInfo
.
setCumulatedTotal
(
deliveryProductInfo
.
getCumulatedTotal
()
+
productList
.
getNumber
()
*
o
.
getSalePrice
().
intValue
());
});
}
});
});
deliveryOrderRequestDto
.
setProductTotal
(
productInfos
.
stream
().
mapToInt
(
t
->
t
.
getCumulatedTotal
()).
sum
());
deliveryOrderRequestDto
.
setProductTotal
(
productInfos
.
stream
().
mapToInt
(
t
->
t
.
getCumulatedTotal
()).
sum
());
}
}
deliveryOrderRequestDto
.
setProductInfos
(
productInfos
);
deliveryOrderRequestDto
.
setProductInfos
(
productInfos
);
deliveryOrderRequestDto
.
setOrderSource
(
OrderSourceType
.
ALIPAY
.
getCode
().
equals
(
order
.
getSource
())?
"Alipay"
:
"freemud"
);
deliveryOrderRequestDto
.
setOrderSource
(
OrderSourceType
.
ALIPAY
.
getCode
().
equals
(
order
.
getSource
())?
"Alipay"
:
"freemud"
);
if
(
CollectionUtils
.
isNotEmpty
(
order
.
getAccountList
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
order
.
getAccountList
()))
{
...
@@ -262,6 +298,19 @@ public class DeliveryAdapter {
...
@@ -262,6 +298,19 @@ public class DeliveryAdapter {
createDeliveryPreferentialVo
.
setPreferentialContent
(
accountBean
.
getName
());
createDeliveryPreferentialVo
.
setPreferentialContent
(
accountBean
.
getName
());
createDeliveryPreferentialVo
.
setPreferentialPrice
(
0
-
accountBean
.
getPrice
());
createDeliveryPreferentialVo
.
setPreferentialPrice
(
0
-
accountBean
.
getPrice
());
createDeliveryPreferentialVos
.
add
(
createDeliveryPreferentialVo
);
createDeliveryPreferentialVos
.
add
(
createDeliveryPreferentialVo
);
}
else
if
(
OldOrderAccountType
.
WITH_ORDER_BUY_COUPON_FEE
.
getCode
().
equals
(
accountBean
.
getType
()))
{
ProductInfo
productInfo
=
new
ProductInfo
();
productInfo
.
setProductCode
(
accountBean
.
getAccountId
());
productInfo
.
setProductName
(
accountBean
.
getName
());
productInfo
.
setProductNumber
(
1
);
productInfo
.
setProductPrice
(
accountBean
.
getPrice
().
intValue
());
//餐道使用
productInfo
.
setCumulatedTotal
(
accountBean
.
getPrice
().
intValue
());
productInfo
.
setTaxId
(
"10"
);
productInfo
.
setTaxRate
(
6
d
);
productInfo
.
setParentCode
(-
1
l
);
productInfos
.
add
(
productInfo
);
}
}
});
});
deliveryOrderRequestDto
.
setPreferentials
(
createDeliveryPreferentialVos
);
deliveryOrderRequestDto
.
setPreferentials
(
createDeliveryPreferentialVos
);
...
...
order-application-service/src/main/java/cn/freemud/adapter/OrderAdapter.java
View file @
8360d19b
...
@@ -1196,7 +1196,6 @@ public class OrderAdapter {
...
@@ -1196,7 +1196,6 @@ public class OrderAdapter {
}
}
if
(
ordersBean
.
getHasRefund
()
!=
null
&&
ordersBean
.
getHasRefund
()
&&
CollectionUtils
.
isNotEmpty
(
ordersBean
.
getRefundList
()))
{
if
(
ordersBean
.
getHasRefund
()
!=
null
&&
ordersBean
.
getHasRefund
()
&&
CollectionUtils
.
isNotEmpty
(
ordersBean
.
getRefundList
()))
{
if
(
mcCafePartnerId
.
equals
(
ordersBean
.
getCompanyId
()))
{
if
(
mcCafePartnerId
.
equals
(
ordersBean
.
getCompanyId
()))
{
responseVo
.
setRefundIntervalTime
(
Long
.
valueOf
(
mccafeRefundInterval
));
QueryOrdersResponse
.
DataBean
.
OrderBean
.
RefundBean
latestRefundBean
=
ordersBean
.
getRefundList
().
get
(
0
);
QueryOrdersResponse
.
DataBean
.
OrderBean
.
RefundBean
latestRefundBean
=
ordersBean
.
getRefundList
().
get
(
0
);
for
(
int
i
=
0
;
i
<
ordersBean
.
getRefundList
().
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
ordersBean
.
getRefundList
().
size
();
i
++)
{
...
@@ -1218,17 +1217,11 @@ public class OrderAdapter {
...
@@ -1218,17 +1217,11 @@ public class OrderAdapter {
}
}
}
}
if
(
StringUtils
.
isNotBlank
(
responseVo
.
getRid
()))
{
if
(
StringUtils
.
isBlank
(
responseVo
.
getRid
()))
{
responseVo
.
setRid
(
latestRefundBean
.
getRid
());
responseVo
.
setRefundStatus
(
latestRefundBean
.
getStatus
());
responseVo
.
setRefundStatusDesc
(
Optional
.
ofNullable
(
RefundStatus
.
getByCode
(
latestRefundBean
.
getStatus
()))
.
map
(
RefundStatus:
:
getDesc
).
orElse
(
""
));
responseVo
.
setRefundReason
(
latestRefundBean
.
getReason
());
String
refundCreateTime
=
DateUtil
.
convert2String
(
new
Date
(
Long
.
parseLong
(
latestRefundBean
.
getCreateTime
())),
DateUtil
.
FORMAT_YYYY_MM_DD_HHMMSS
);
responseVo
.
setRefundCreateTime
(
refundCreateTime
);
if
(
new
Date
().
getTime
()
-
Long
.
parseLong
(
latestRefundBean
.
getCreateTime
())
>
Long
.
valueOf
(
mccafeRefundInterval
))
{
if
(
new
Date
().
getTime
()
-
Long
.
parseLong
(
latestRefundBean
.
getCreateTime
())
>
Long
.
valueOf
(
mccafeRefundInterval
))
{
responseVo
.
setAfterRefundInterval
(
true
);
responseVo
.
setAfterRefundInterval
(
true
);
}
}
responseVo
.
setRefundIntervalTime
(
Long
.
valueOf
(
latestRefundBean
.
getCreateTime
())
+
Long
.
valueOf
(
mccafeRefundInterval
));
}
}
}
else
{
}
else
{
...
@@ -2050,7 +2043,7 @@ public class OrderAdapter {
...
@@ -2050,7 +2043,7 @@ public class OrderAdapter {
if
(
OrderAccountType
.
PRODUCT_COUPON
.
getCode
().
equals
(
productDiscount
.
getDiscountType
()))
{
if
(
OrderAccountType
.
PRODUCT_COUPON
.
getCode
().
equals
(
productDiscount
.
getDiscountType
()))
{
hasProductCoupon
=
true
;
hasProductCoupon
=
true
;
Integer
extendType
=
StringUtils
.
isBlank
(
productDiscount
.
getAddInfo
())?
null
:
JSON
.
parseObject
(
productDiscount
.
getAddInfo
()).
getInteger
(
"extendType"
);
Integer
extendType
=
StringUtils
.
isBlank
(
productDiscount
.
getAddInfo
())?
null
:
JSON
.
parseObject
(
productDiscount
.
getAddInfo
()).
getInteger
(
"extendType"
);
if
(
"啡常月享卡"
.
equals
(
productDiscount
.
getDiscountDesc
())
||
(
null
!=
extendType
&&
4
==
extendType
))
{
if
(
null
!=
extendType
&&
(
4
==
extendType
||
5
==
extendType
))
{
productVo
.
setCouponName
(
productDiscount
.
getDiscountDesc
());
productVo
.
setCouponName
(
productDiscount
.
getDiscountDesc
());
}
else
{
}
else
{
productVo
.
setName
(
productDiscount
.
getDiscountDesc
());
productVo
.
setName
(
productDiscount
.
getDiscountDesc
());
...
...
shopping-cart-application-service/src/main/java/cn/freemud/adapter/ShoppingCartConvertAdapter.java
View file @
8360d19b
...
@@ -928,10 +928,10 @@ public class ShoppingCartConvertAdapter {
...
@@ -928,10 +928,10 @@ public class ShoppingCartConvertAdapter {
for
(
ProductBeanDTO
.
ProductGroupType
.
GroupDetailType
groupDetailType
:
groupDetail
){
for
(
ProductBeanDTO
.
ProductGroupType
.
GroupDetailType
groupDetailType
:
groupDetail
){
if
(
groupDetailType
.
getProductId
().
equals
(
productMaterial
.
getSpuId
())){
if
(
groupDetailType
.
getProductId
().
equals
(
productMaterial
.
getSpuId
())){
productMaterial
.
setSpuId
(
groupDetailType
.
getProductId
());
productMaterial
.
setSpuId
(
groupDetailType
.
getProductId
());
productMaterial
.
setAmount
(
groupDetailType
.
getProductPrice
().
longValue
());
productMaterial
.
setAmount
(
groupDetailType
.
getProduct
Final
Price
().
longValue
());
productMaterial
.
setFinalPrice
(
groupDetailType
.
getProductFinalPrice
().
longValue
());
productMaterial
.
setFinalPrice
(
groupDetailType
.
getProductFinalPrice
().
longValue
());
productMaterial
.
setOriginalAmount
(
groupDetailType
.
getProductPrice
().
longValue
());
productMaterial
.
setOriginalAmount
(
groupDetailType
.
getProduct
Final
Price
().
longValue
());
productMaterial
.
setOriginalPrice
(
groupDetailType
.
getProductPrice
().
longValue
());
productMaterial
.
setOriginalPrice
(
groupDetailType
.
getProduct
Final
Price
().
longValue
());
productMaterial
.
setSpuName
(
groupDetailType
.
getProductName
());
productMaterial
.
setSpuName
(
groupDetailType
.
getProductName
());
}
}
}
}
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/ShoppingCartMCoffeeServiceImpl.java
View file @
8360d19b
...
@@ -823,7 +823,10 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -823,7 +823,10 @@ public class ShoppingCartMCoffeeServiceImpl {
cartGoods
.
setQty
(
orderItem
.
getProductQuantity
());
cartGoods
.
setQty
(
orderItem
.
getProductQuantity
());
cartGoods
.
setSpuId
(
orderItem
.
getProductId
());
cartGoods
.
setSpuId
(
orderItem
.
getProductId
());
cartGoods
.
setSkuId
(
orderItem
.
getProductSpec
());
cartGoods
.
setSkuId
(
orderItem
.
getProductSpec
());
cartGoods
.
setOriginalPrice
(
orderItem
.
getProductPrice
().
longValue
());
cartGoods
.
setFinalPrice
(
orderItem
.
getProductPrice
().
longValue
());
cartGoods
.
setFinalPrice
(
orderItem
.
getProductPrice
().
longValue
());
cartGoods
.
setOriginalAmount
(
cartGoods
.
getOriginalPrice
()
*
cartGoods
.
getQty
());
cartGoods
.
setAmount
(
cartGoods
.
getFinalPrice
()
*
cartGoods
.
getQty
());
cartGoods
.
setPic
(
orderItem
.
getProductPicUrl
());
cartGoods
.
setPic
(
orderItem
.
getProductPicUrl
());
if
(
6
==
orderItem
.
getProductType
())
{
if
(
6
==
orderItem
.
getProductType
())
{
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
());
...
@@ -834,14 +837,6 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -834,14 +837,6 @@ public class ShoppingCartMCoffeeServiceImpl {
}
else
{
}
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
(
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
));
}
if
((
"早餐啡常搭"
.
equals
(
orderItem
.
getProductName
())
&&
"早餐啡常搭"
.
equals
(
orderItem
.
getProductSpecName
()))
if
((
"早餐啡常搭"
.
equals
(
orderItem
.
getProductName
())
&&
"早餐啡常搭"
.
equals
(
orderItem
.
getProductSpecName
()))
||
(
"啡常搭"
.
equals
(
orderItem
.
getProductName
())
&&
"啡常搭"
.
equals
(
orderItem
.
getProductSpecName
())))
{
||
(
"啡常搭"
.
equals
(
orderItem
.
getProductName
())
&&
"啡常搭"
.
equals
(
orderItem
.
getProductSpecName
())))
{
cartGoods
.
setName
(
orderItem
.
getProductName
());
cartGoods
.
setName
(
orderItem
.
getProductName
());
...
@@ -852,6 +847,24 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -852,6 +847,24 @@ public class ShoppingCartMCoffeeServiceImpl {
cartGoods
.
setSkuName
(
orderItem
.
getProductSpecName
());
cartGoods
.
setSkuName
(
orderItem
.
getProductSpecName
());
cartGoods
.
setSpuName
(
orderItem
.
getProductName
());
cartGoods
.
setSpuName
(
orderItem
.
getProductName
());
}
}
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
,
orderItemList
);
});
}
if
(
ObjectUtils
.
equals
(
88
,
orderItem
.
getProductType
()))
{
// 获取套餐子商品列表
cartGoods
.
setProductMaterialList
(
new
ArrayList
<>());
String
partnerProductId
=
orderItem
.
getProductId
()
+
"_"
+
orderItem
.
getProductSeq
();
List
<
OrderItemResp
>
materialProducts
=
orderItemList
.
stream
().
filter
(
item
->
ObjectUtils
.
equals
(
partnerProductId
,
item
.
getParentProductId
())).
collect
(
Collectors
.
toList
());
materialProducts
.
forEach
(
material
->
getMaterialGoods
(
cartGoods
,
material
));
}
cartGoodsList
.
add
(
cartGoods
);
cartGoodsList
.
add
(
cartGoods
);
}
}
...
@@ -859,7 +872,7 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -859,7 +872,7 @@ public class ShoppingCartMCoffeeServiceImpl {
}
}
private
CartGoods
.
ComboxGoods
getComboxGoods
(
CartGoods
cartGoods
,
OrderItemResp
orderItemResp
)
{
private
CartGoods
.
ComboxGoods
getComboxGoods
(
CartGoods
cartGoods
,
OrderItemResp
orderItemResp
,
List
<
OrderItemResp
>
orderItemList
)
{
CartGoods
.
ComboxGoods
comboxGoods
=
new
CartGoods
.
ComboxGoods
();
CartGoods
.
ComboxGoods
comboxGoods
=
new
CartGoods
.
ComboxGoods
();
comboxGoods
.
setSkuId
(
orderItemResp
.
getProductSpec
());
comboxGoods
.
setSkuId
(
orderItemResp
.
getProductSpec
());
comboxGoods
.
setGoodsId
(
orderItemResp
.
getProductId
());
comboxGoods
.
setGoodsId
(
orderItemResp
.
getProductId
());
...
@@ -871,8 +884,9 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -871,8 +884,9 @@ public class ShoppingCartMCoffeeServiceImpl {
comboxGoods
.
setSpuName
(
StringUtils
.
isNotEmpty
(
orderItemResp
.
getProductName
())
?
orderItemResp
.
getProductName
()
:
""
);
comboxGoods
.
setSpuName
(
StringUtils
.
isNotEmpty
(
orderItemResp
.
getProductName
())
?
orderItemResp
.
getProductName
()
:
""
);
comboxGoods
.
setSkuName
(
StringUtils
.
isNotEmpty
(
orderItemResp
.
getProductSpecName
())
?
orderItemResp
.
getProductSpecName
()
:
""
);
comboxGoods
.
setSkuName
(
StringUtils
.
isNotEmpty
(
orderItemResp
.
getProductSpecName
())
?
orderItemResp
.
getProductSpecName
()
:
""
);
comboxGoods
.
setSubName
(
StringUtils
.
isNotEmpty
(
orderItemResp
.
getProductSpecName
())
?
orderItemResp
.
getProductSpecName
()
:
""
);
comboxGoods
.
setSubName
(
StringUtils
.
isNotEmpty
(
orderItemResp
.
getProductSpecName
())
?
orderItemResp
.
getProductSpecName
()
:
""
);
comboxGoods
.
setOriginalAmount
(
comboxGoods
.
getOriginalPrice
()
*
comboxGoods
.
getQty
());
if
(!
""
.
equals
(
orderItemResp
.
getProductProperty
()))
{
comboxGoods
.
setAmount
(
comboxGoods
.
getFinalPrice
()
*
comboxGoods
.
getQty
());
if
(
StringUtils
.
isNotBlank
(
orderItemResp
.
getProductProperty
()))
{
List
<
CartGoods
.
CartGoodsExtra
>
extra
=
new
ArrayList
<>();
List
<
CartGoods
.
CartGoodsExtra
>
extra
=
new
ArrayList
<>();
String
[]
split
=
orderItemResp
.
getProductProperty
().
split
(
"/"
);
String
[]
split
=
orderItemResp
.
getProductProperty
().
split
(
"/"
);
for
(
int
i
=
0
;
i
<
split
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
split
.
length
;
i
++)
{
...
@@ -885,16 +899,48 @@ public class ShoppingCartMCoffeeServiceImpl {
...
@@ -885,16 +899,48 @@ public class ShoppingCartMCoffeeServiceImpl {
Map
<
String
,
Object
>
map
=
JSONObject
.
parseObject
(
orderItemResp
.
getExtInfo
(),
Map
.
class
);
Map
<
String
,
Object
>
map
=
JSONObject
.
parseObject
(
orderItemResp
.
getExtInfo
(),
Map
.
class
);
if
(
map
.
containsKey
(
"isFixedProduct"
)
&&
(
boolean
)
map
.
get
(
"isFixedProduct"
))
{
if
(
map
.
containsKey
(
"isFixedProduct"
)
&&
(
boolean
)
map
.
get
(
"isFixedProduct"
))
{
cartGoods
.
getProductComboList
().
add
(
comboxGoods
);
cartGoods
.
getProductComboList
().
add
(
comboxGoods
);
cartGoods
.
setFinalPrice
(
comboxGoods
.
getFinalPrice
());
cartGoods
.
setOriginalPrice
(
comboxGoods
.
getOriginalPrice
());
}
}
if
(
map
.
containsKey
(
"isFixedProduct"
)
&&
!(
boolean
)
map
.
get
(
"isFixedProduct"
))
{
if
(
map
.
containsKey
(
"isFixedProduct"
)
&&
!(
boolean
)
map
.
get
(
"isFixedProduct"
))
{
cartGoods
.
getProductGroupList
().
add
(
comboxGoods
);
cartGoods
.
getProductGroupList
().
add
(
comboxGoods
);
}
}
if
(
ObjectUtils
.
equals
(
88
,
orderItemResp
.
getProductType
()))
{
comboxGoods
.
setProductMaterialList
(
new
ArrayList
<>());
String
partnerProductId
=
orderItemResp
.
getProductId
()
+
"_"
+
orderItemResp
.
getProductSeq
();
List
<
OrderItemResp
>
materialProducts
=
orderItemList
.
stream
().
filter
(
item
->
ObjectUtils
.
equals
(
partnerProductId
,
item
.
getParentProductId
())).
collect
(
Collectors
.
toList
());
materialProducts
.
forEach
(
material
->
getMaterialGoods
(
comboxGoods
,
material
));
}
return
comboxGoods
;
return
comboxGoods
;
}
}
private
CartGoods
.
MaterialGoods
getMaterialGoods
(
CartGoods
cartGoods
,
OrderItemResp
orderItemResp
)
{
CartGoods
.
MaterialGoods
materialGoods
=
new
CartGoods
.
MaterialGoods
();
materialGoods
.
setSpuId
(
orderItemResp
.
getProductId
());
materialGoods
.
setCustomerCode
(
orderItemResp
.
getThirdProductId
());
materialGoods
.
setFinalPrice
(
orderItemResp
.
getSalePrice
().
longValue
());
materialGoods
.
setOriginalPrice
(
orderItemResp
.
getProductPrice
().
longValue
());
materialGoods
.
setOriginalAmount
(
materialGoods
.
getOriginalPrice
());
materialGoods
.
setAmount
(
materialGoods
.
getFinalPrice
());
materialGoods
.
setSpuName
(
orderItemResp
.
getProductName
());
cartGoods
.
getProductMaterialList
().
add
(
materialGoods
);
return
materialGoods
;
}
private
CartGoods
.
MaterialGoods
getMaterialGoods
(
CartGoods
.
ComboxGoods
comboGoods
,
OrderItemResp
orderItemResp
)
{
CartGoods
.
MaterialGoods
materialGoods
=
new
CartGoods
.
MaterialGoods
();
materialGoods
.
setSpuId
(
orderItemResp
.
getProductId
());
materialGoods
.
setCustomerCode
(
orderItemResp
.
getThirdProductId
());
materialGoods
.
setFinalPrice
(
orderItemResp
.
getSalePrice
().
longValue
());
materialGoods
.
setOriginalPrice
(
orderItemResp
.
getProductPrice
().
longValue
());
materialGoods
.
setOriginalAmount
(
materialGoods
.
getOriginalPrice
());
materialGoods
.
setAmount
(
materialGoods
.
getFinalPrice
());
materialGoods
.
setSpuName
(
orderItemResp
.
getProductName
());
comboGoods
.
getProductMaterialList
().
add
(
materialGoods
);
return
materialGoods
;
}
private
void
packgeAdditional
(
ShoppingCartInfoRequestVo
shoppingCartInfoRequestVo
,
CreateOrderVo
.
PremiumExchangeActivity
premiumExchangeActivity
)
{
private
void
packgeAdditional
(
ShoppingCartInfoRequestVo
shoppingCartInfoRequestVo
,
CreateOrderVo
.
PremiumExchangeActivity
premiumExchangeActivity
)
{
ArrayList
<
ShoppingCartInfoRequestVo
.
SendGoods
>
senGoods
=
new
ArrayList
<>();
ArrayList
<
ShoppingCartInfoRequestVo
.
SendGoods
>
senGoods
=
new
ArrayList
<>();
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/CalculationServiceImpl.java
View file @
8360d19b
...
@@ -473,8 +473,9 @@ public class CalculationServiceImpl {
...
@@ -473,8 +473,9 @@ public class CalculationServiceImpl {
totalOriginalAmount
+=
originalAmount
;
totalOriginalAmount
+=
originalAmount
;
totalAmount
+=
amount
;
totalAmount
+=
amount
;
totalPackgeAmount
+=
packAmount
;
totalPackgeAmount
+=
packAmount
;
cartGoods
.
setOriginalAmount
(
originalAmount
);
long
materialPrice
=
getMaterialPrice
(
cartGoods
);
cartGoods
.
setAmount
(
amount
);
cartGoods
.
setOriginalAmount
(
originalAmount
+
materialPrice
);
cartGoods
.
setAmount
(
amount
+
materialPrice
);
cartGoods
.
setPackPrice
(
packAmount
);
cartGoods
.
setPackPrice
(
packAmount
);
}
}
shoppingCartGoodsResponseVo
.
setOriginalTotalAmount
(
calculationDiscount
==
null
?
totalOriginalAmount
:
calculationDiscount
.
getOriginalTotalAmount
());
shoppingCartGoodsResponseVo
.
setOriginalTotalAmount
(
calculationDiscount
==
null
?
totalOriginalAmount
:
calculationDiscount
.
getOriginalTotalAmount
());
...
@@ -489,4 +490,17 @@ public class CalculationServiceImpl {
...
@@ -489,4 +490,17 @@ public class CalculationServiceImpl {
shoppingCartGoodsResponseVo
.
setDiscountDeliveryAmount
(
calculationDiscount
==
null
?
0L
:
calculationDiscount
.
getDistributionFee
());
shoppingCartGoodsResponseVo
.
setDiscountDeliveryAmount
(
calculationDiscount
==
null
?
0L
:
calculationDiscount
.
getDistributionFee
());
}
}
private
Long
getMaterialPrice
(
CartGoods
cartGoods
){
Long
materialPrice
=
0L
;
//单品、多规格加料
if
(
CollectionUtils
.
isNotEmpty
(
cartGoods
.
getProductMaterialList
())){
for
(
CartGoods
.
MaterialGoods
materialGoods
:
cartGoods
.
getProductMaterialList
()){
materialPrice
+=
materialGoods
.
getFinalPrice
()
*
cartGoods
.
getQty
();
}
}
return
materialPrice
;
}
}
}
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/CouponDiscountCalculation.java
View file @
8360d19b
...
@@ -177,12 +177,11 @@ public class CouponDiscountCalculation {
...
@@ -177,12 +177,11 @@ public class CouponDiscountCalculation {
// 匹配随单购悦享卡
// 匹配随单购悦享卡
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Discount
discount
=
discounts
.
stream
().
filter
(
t
->
(
ActivityTypeEnum
.
TYPE_32
.
getCode
().
equals
(
t
.
getType
())
&&
mccafeUniversalCouponCode
.
equals
(
t
.
getActivityCode
()))).
findFirst
().
orElse
(
null
);
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Discount
discount
=
discounts
.
stream
().
filter
(
t
->
(
ActivityTypeEnum
.
TYPE_32
.
getCode
().
equals
(
t
.
getType
())
&&
mccafeUniversalCouponCode
.
equals
(
t
.
getActivityCode
()))).
findFirst
().
orElse
(
null
);
for
(
ShoppingCartGoodsDto
.
CartGoodsDetailDto
cartGoods
:
shoppingCartGoodsDto
.
getProducts
())
{
for
(
ShoppingCartGoodsDto
.
CartGoodsDetailDto
cartGoods
:
shoppingCartGoodsDto
.
getProducts
())
{
if
(
goodsMap
.
get
(
cartGoods
.
getCartGoodsUid
())
==
null
)
{
continue
;
}
//商品券商品
//商品券商品
if
(
StringUtils
.
isNotEmpty
(
cartGoods
.
getCouponCode
())
||
discount
!=
null
)
{
if
(
StringUtils
.
isNotEmpty
(
cartGoods
.
getCouponCode
())
)
{
if
(
goodsMap
.
get
(
cartGoods
.
getCartGoodsUid
())
==
null
)
{
continue
;
}
List
<
ActivityDiscountsDto
>
productActivityDiscountsDtos
=
new
ArrayList
<>();
List
<
ActivityDiscountsDto
>
productActivityDiscountsDtos
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
discounts
))
{
if
(
CollectionUtils
.
isNotEmpty
(
discounts
))
{
for
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Discount
couponDiscount
:
discounts
)
{
for
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Discount
couponDiscount
:
discounts
)
{
...
@@ -202,12 +201,18 @@ public class CouponDiscountCalculation {
...
@@ -202,12 +201,18 @@ public class CouponDiscountCalculation {
}
}
}
}
}
}
if
(
discount
!=
null
)
{
}
cartGoods
.
setCustomerCode
(
goodsMap
.
get
(
cartGoods
.
getCartGoodsUid
()).
getArtNo
());
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
>
list
=
goodsMap
.
get
(
cartGoods
.
getCartGoodsUid
()).
getDiscounts
();
if
(
CollectionUtils
.
isNotEmpty
(
list
)
&&
discount
!=
null
)
{
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
goodsDiscount
=
list
.
stream
().
filter
(
t
->
(
ActivityTypeEnum
.
TYPE_32
.
getCode
().
equals
(
t
.
getType
())
&&
mccafeUniversalCouponCode
.
equals
(
t
.
getActivityCode
()))).
findFirst
().
orElse
(
null
);
if
(
goodsDiscount
!=
null
){
List
<
ActivityDiscountsDto
>
productActivityDiscountsDtos
=
new
ArrayList
<>();
ActivityDiscountsDto
activityDiscountsDto
=
new
ActivityDiscountsDto
();
ActivityDiscountsDto
activityDiscountsDto
=
new
ActivityDiscountsDto
();
activityDiscountsDto
.
setActivityCode
(
d
iscount
.
getActivityCode
());
activityDiscountsDto
.
setActivityCode
(
goodsD
iscount
.
getActivityCode
());
activityDiscountsDto
.
setActivityName
(
d
iscount
.
getActivityName
());
activityDiscountsDto
.
setActivityName
(
goodsD
iscount
.
getActivityName
());
activityDiscountsDto
.
setActivityType
(
d
iscount
.
getType
());
activityDiscountsDto
.
setActivityType
(
goodsD
iscount
.
getType
());
activityDiscountsDto
.
setDiscountAmount
(
0
-
discount
.
getDiscount
());
activityDiscountsDto
.
setDiscountAmount
(
0
-
goodsDiscount
.
getDiscount
().
intValue
());
activityDiscountsDto
.
setExtendType
(
discount
.
getExtendType
());
activityDiscountsDto
.
setExtendType
(
discount
.
getExtendType
());
activityDiscountsDto
.
setTenderId
(
goodsMap
.
get
(
cartGoods
.
getCartGoodsUid
()).
getArtNo
());
activityDiscountsDto
.
setTenderId
(
goodsMap
.
get
(
cartGoods
.
getCartGoodsUid
()).
getArtNo
());
productActivityDiscountsDtos
.
add
(
activityDiscountsDto
);
productActivityDiscountsDtos
.
add
(
activityDiscountsDto
);
...
@@ -215,8 +220,6 @@ public class CouponDiscountCalculation {
...
@@ -215,8 +220,6 @@ public class CouponDiscountCalculation {
cartGoods
.
setSalePrice
(
0L
);
cartGoods
.
setSalePrice
(
0L
);
cartGoods
.
setActivityDiscountsDtos
(
productActivityDiscountsDtos
);
cartGoods
.
setActivityDiscountsDtos
(
productActivityDiscountsDtos
);
}
}
cartGoods
.
setCustomerCode
(
goodsMap
.
get
(
cartGoods
.
getCartGoodsUid
()).
getArtNo
());
}
}
}
}
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/SetMealCalculation.java
View file @
8360d19b
...
@@ -69,9 +69,24 @@ public class SetMealCalculation {
...
@@ -69,9 +69,24 @@ public class SetMealCalculation {
long
productComboAmount
=
cartGoods
.
getProductComboList
().
stream
().
mapToLong
(
t
->
t
.
getFinalPrice
()
*
t
.
getQty
()).
sum
();
long
productComboAmount
=
cartGoods
.
getProductComboList
().
stream
().
mapToLong
(
t
->
t
.
getFinalPrice
()
*
t
.
getQty
()).
sum
();
long
productComboTotalAmount
=
productComboAmount
*
cartGoods
.
getQty
();
long
productComboTotalAmount
=
productComboAmount
*
cartGoods
.
getQty
();
cartGoods
.
setOriginalAmount
(
productGroupTotalAmount
+
productComboTotalAmount
);
long
materialPrice
=
0
l
;
//套餐固定商品加料
if
(
CollectionUtils
.
isNotEmpty
(
cartGoods
.
getProductComboList
())){
for
(
CartGoods
.
ComboxGoods
comboxGoods
:
cartGoods
.
getProductComboList
()){
Long
comboxmaterialPrice
=
0L
;
if
(
CollectionUtils
.
isNotEmpty
(
comboxGoods
.
getProductMaterialList
())){
for
(
CartGoods
.
MaterialGoods
materialGoods
:
comboxGoods
.
getProductMaterialList
()){
comboxmaterialPrice
+=
materialGoods
.
getFinalPrice
()
*
cartGoods
.
getQty
();
}
}
comboxGoods
.
setAmount
(
comboxGoods
.
getAmount
()+
comboxmaterialPrice
);
materialPrice
=
materialPrice
+
comboxmaterialPrice
;
}
}
cartGoods
.
setOriginalAmount
(
productGroupTotalAmount
+
productComboTotalAmount
+
materialPrice
);
cartGoods
.
setOriginalPrice
(
productComboTotalAmount
);
cartGoods
.
setOriginalPrice
(
productComboTotalAmount
);
cartGoods
.
setAmount
(
productGroupTotalAmount
+
productComboTotalAmount
);
cartGoods
.
setAmount
(
productGroupTotalAmount
+
productComboTotalAmount
+
materialPrice
);
cartGoods
.
setFinalPrice
(
productComboTotalAmount
);
cartGoods
.
setFinalPrice
(
productComboTotalAmount
);
// 套餐(固定商品)现价
// 套餐(固定商品)现价
...
...
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