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
a44ee5f2
Commit
a44ee5f2
authored
Dec 23, 2020
by
刘鹏飞
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop' into develop
parents
98a59bea
3c87539e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
67 additions
and
28 deletions
+67
-28
shopping-cart-application-service/src/main/java/cn/freemud/adapter/ShoppingCartConvertAdapter.java
+32
-20
shopping-cart-application-service/src/main/java/cn/freemud/adapter/ShoppingCartMccafeAdapter.java
+14
-2
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/CalculationServiceImpl.java
+6
-6
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/SetMealCalculation.java
+15
-0
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/adapter/ShoppingCartConvertAdapter.java
View file @
a44ee5f2
...
...
@@ -758,7 +758,6 @@ public class ShoppingCartConvertAdapter {
productComboType
=
parentProductBean
.
getProductComboList
().
stream
().
filter
(
p
->
ObjectUtils
.
equals
(
comboxGoods
.
getGoodsId
(),
p
.
getProductId
())).
findFirst
().
orElse
(
new
ProductTypeBeanDTO
.
ProductComboType
());
}
else
{
Map
<
String
,
ProductTypeBeanDTO
.
ProductGroupType
.
GroupDetailType
>
map
=
new
HashMap
<>();
// subProductTypeMap.get(comboxGoods.getSkuId()).getAdditionalGroupList().stream().map(t->t.getGroupDetail()).forEach(group->group.forEach(detailType-> map.put(detailType.getProductId(),detailType)));
parentProductBean
.
getProductGroupList
().
stream
().
map
(
t
->
t
.
getGroupDetail
()).
forEach
(
group
->
group
.
forEach
(
detailType
->
map
.
put
(
detailType
.
getProductId
(),
detailType
)));
groupDetailType
=
map
.
get
(
comboxGoods
.
getGoodsId
());
}
...
...
@@ -800,26 +799,26 @@ public class ShoppingCartConvertAdapter {
comboxGoods
.
getProductMaterialList
().
stream
().
forEach
(
materialGood
->
materialList
.
add
(
materialMap
.
get
(
materialGood
.
getSpuId
())));
List
<
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
domain
.
CartGoods
.
MaterialGoods
>
productMaterialList
=
new
ArrayList
<>();
Long
materialAmount
=
0L
;
Long
originalMaterAmount
=
0L
;
if
(
CollectionUtils
.
isNotEmpty
(
materialList
)){
for
(
ProductTypeBeanDTO
.
ProductGroupType
.
GroupDetailType
detailType
:
materialList
)
{
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
domain
.
CartGoods
.
MaterialGoods
materialGoods
=
new
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
domain
.
CartGoods
.
MaterialGoods
();
materialGoods
.
setCustomerCode
(
StringUtils
.
isNotEmpty
(
detailType
.
getCustomerCode
())
?
detailType
.
getCustomerCode
()
:
""
);
materialGoods
.
setAmount
(
null
!=
detailType
.
getMarkUpPrice
()
?
detailType
.
getMarkUpPrice
().
longValue
()
:
0
);
materialGoods
.
setFinalPrice
(
null
!=
detailType
.
getProductFinalPrice
()
?
detailType
.
getProductFinalPrice
().
longValue
()
:
0
);
materialGoods
.
setSpuName
(
StringUtils
.
isNotEmpty
(
detailType
.
getProductName
())
?
detailType
.
getProductName
()
:
""
);
materialGoods
.
setSpuId
(
StringUtils
.
isNotEmpty
(
detailType
.
getProductId
())
?
detailType
.
getProductId
()
:
""
);
materialGoods
.
setOriginalPrice
(
null
!=
detailType
.
getProductFinalPrice
()
?
detailType
.
getProductFinalPrice
().
longValue
()
:
0
);
materialGoods
.
setOriginalAmount
(
null
!=
detailType
.
getProductFinalPrice
()
?
detailType
.
getProductFinalPrice
().
longValue
()
:
0
);
materialGoods
.
setCustomerCode
(
StringUtils
.
isNotEmpty
(
detailType
.
getCustomerCode
())
?
detailType
.
getCustomerCode
()
:
""
);
materialGoods
.
setAmount
(
null
!=
detailType
.
getMarkUpPrice
()
?
detailType
.
getMarkUpPrice
().
longValue
()
:
0
);
materialGoods
.
setFinalPrice
(
null
!=
detailType
.
getProductFinalPrice
()
?
detailType
.
getProductFinalPrice
().
longValue
()
:
0
);
materialGoods
.
setSpuName
(
StringUtils
.
isNotEmpty
(
detailType
.
getProductName
())
?
detailType
.
getProductName
()
:
""
);
materialGoods
.
setSpuId
(
StringUtils
.
isNotEmpty
(
detailType
.
getProductId
())
?
detailType
.
getProductId
()
:
""
);
materialGoods
.
setOriginalPrice
(
null
!=
detailType
.
getProductFinalPrice
()
?
detailType
.
getProductFinalPrice
().
longValue
()
:
0
);
materialGoods
.
setOriginalAmount
(
null
!=
detailType
.
getProductFinalPrice
()
?
detailType
.
getProductFinalPrice
().
longValue
()
*
comboxGoods
.
getQty
()
:
0
);
productMaterialList
.
add
(
materialGoods
);
materialAmount
+=
detailType
.
getProductFinalPrice
().
longValue
()
*
comboxGoods
.
getQty
();
originalMaterAmount
+=
detailType
.
getProductFinalPrice
().
longValue
()
*
comboxGoods
.
getQty
();
}
}
comboxGoods
.
setMaterialAmount
(
materialAmount
);
comboxGoods
.
setProductMaterialList
(
productMaterialList
);
}
}
...
...
@@ -839,7 +838,9 @@ public class ShoppingCartConvertAdapter {
private
void
checkMaterialProductForMCoffee
(
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
domain
.
CartGoods
cartGoods
,
ProductTypeBeanDTO
spuProduct
)
{
if
(
CollectionUtils
.
isEmpty
(
cartGoods
.
getProductMaterialList
()))
return
;
if
(
CollectionUtils
.
isEmpty
(
cartGoods
.
getProductMaterialList
()))
{
return
;
}
//加料信息为空
if
(
CollectionUtils
.
isEmpty
(
spuProduct
.
getAdditionalGroupList
()))
{
checkSkuMaterialProductForMccafe
(
cartGoods
,
spuProduct
);
...
...
@@ -868,7 +869,9 @@ public class ShoppingCartConvertAdapter {
String
materialSubName
=
cartGoods
.
getSubName
();
for
(
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
domain
.
CartGoods
.
MaterialGoods
materialGoods
:
cartGoods
.
getProductMaterialList
())
{
ProductTypeBeanDTO
.
ProductGroupType
.
GroupDetailType
detail
=
materialHash
.
get
(
materialGoods
.
getSpuId
());
if
(
detail
==
null
)
continue
;
if
(
detail
==
null
)
{
continue
;
}
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
domain
.
CartGoods
.
MaterialGoods
material
=
new
com
.
freemud
.
sdk
.
api
.
assortment
.
shoppingcart
.
domain
.
CartGoods
.
MaterialGoods
();
material
.
setSpuName
(
detail
.
getProductName
());
material
.
setSpuId
(
detail
.
getProductId
());
...
...
@@ -960,6 +963,11 @@ public class ShoppingCartConvertAdapter {
}
}
}
//可选商品组加料价格加到购物车行记录上
Long
materialAmount
=
cartGoods
.
getProductGroupList
().
stream
().
mapToLong
(
group
->
(
null
!=
group
.
getMaterialAmount
()
?
group
.
getMaterialAmount
()
:
0
)).
sum
();
cartGoods
.
setOriginalMaterialAmount
(
materialAmount
);
cartGoods
.
setMaterialAmount
(
materialAmount
);
}
}
//更新当前商品行价格
...
...
@@ -987,12 +995,16 @@ public class ShoppingCartConvertAdapter {
cartGoods
.
setWeight
(
isSkuProduct
?
skuProduct
.
getWeight
()
:
spuProduct
.
getWeight
());
cartGoods
.
setUnit
(
isSkuProduct
?
skuProduct
.
getUnit
()
:
spuProduct
.
getUnit
());
cartGoods
.
setWeightType
(
CommonsConstant
.
WEIGHT_PRODUCT
.
equals
(
spuProduct
.
getWeightType
()));
cartGoods
.
setMaterialAmount
(
0L
);
cartGoods
.
setOriginalMaterialAmount
(
0L
);
if
(
null
==
cartGoods
.
getMaterialAmount
())
{
cartGoods
.
setMaterialAmount
(
0L
);
}
if
(
null
==
cartGoods
.
getOriginalMaterialAmount
())
{
cartGoods
.
setOriginalMaterialAmount
(
0L
);
}
// todo 设置加料
this
.
checkMaterialProductForMCoffee
(
cartGoods
,
spuProduct
);
}
catch
(
Exception
ex
)
{
System
.
out
.
println
(
ex
.
getLocalizedMessage
());
ErrorLog
.
infoConvertJson
(
this
.
getClass
(),
"updateCartGoodsInfoForMCoffee_Error"
,
ex
);
cartGoods
.
setCartGoodsUid
(
null
);
}
...
...
shopping-cart-application-service/src/main/java/cn/freemud/adapter/ShoppingCartMccafeAdapter.java
View file @
a44ee5f2
...
...
@@ -118,6 +118,19 @@ public class ShoppingCartMccafeAdapter {
return
cartGoodsDetailDtos
;
}
/**
* @param cartGoods
* @return
*/
public
List
<
ShoppingCartGoodsDto
.
CartGoodsDetailDto
>
convertCartGoods2DetailGoodsList
(
CartGoods
cartGoods
,
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
ApportionGoods
>
apportionGoodsList
,
Map
<
String
,
String
>
duplicateGoodsMap
)
{
List
<
ShoppingCartGoodsDto
.
CartGoodsDetailDto
>
cartGoodsDetailDtos
=
new
ArrayList
<>();
if
(
StringUtils
.
isEmpty
(
cartGoods
.
getCouponCode
())
&&
GoodsTypeEnum
.
SET_MEAL_GOODS
.
getGoodsType
().
equals
(
cartGoods
.
getGoodsType
()))
{
return
cartGoodsDetailDtos
;
}
else
{
cartGoodsDetailDtos
.
add
(
convertCartGoods2DetailGoods
(
cartGoods
,
apportionGoodsList
,
duplicateGoodsMap
));
}
return
cartGoodsDetailDtos
;
}
/**
* @param cartGoods
...
...
@@ -267,4 +280,4 @@ public class ShoppingCartMccafeAdapter {
}
cartGoodsDetailDto
.
setActivityDiscountsDtos
(
activityDiscountsDtoList
);
}
}
\ No newline at end of file
}
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/CalculationServiceImpl.java
View file @
a44ee5f2
...
...
@@ -2,6 +2,7 @@ package cn.freemud.service.impl.mcoffee.calculation;
import
cn.freemud.adapter.ActivityAdapter
;
import
cn.freemud.adapter.ShoppingCartConvertAdapter
;
import
cn.freemud.adapter.ShoppingCartMccafeAdapter
;
import
cn.freemud.base.entity.BaseResponse
;
import
cn.freemud.constant.ResponseCodeConstant
;
import
cn.freemud.entities.dto.*
;
...
...
@@ -12,7 +13,6 @@ import cn.freemud.entities.dto.shoppingCart.ShoppingCartGoodsDto;
import
cn.freemud.entities.vo.*
;
import
cn.freemud.enums.ActivityChannelEnum
;
import
cn.freemud.enums.ActivityTypeEnum
;
import
cn.freemud.enums.GoodsTypeEnum
;
import
cn.freemud.enums.ResponseResult
;
import
cn.freemud.interceptor.ServiceException
;
import
cn.freemud.service.CommonService
;
...
...
@@ -24,9 +24,7 @@ import com.freemud.application.sdk.api.log.LogThreadLocal;
import
com.freemud.application.sdk.api.membercenter.request.QueryReceiveAddressRequest
;
import
com.freemud.application.sdk.api.membercenter.response.QueryReceiveAddressResponse
;
import
com.freemud.application.sdk.api.membercenter.service.MemberCenterService
;
import
com.freemud.application.sdk.api.storecenter.request.QueryDeliveryRequest
;
import
com.freemud.application.sdk.api.storecenter.request.StoreInfoRequest
;
import
com.freemud.application.sdk.api.storecenter.response.QueryDeliverDetailResponse
;
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.enums.BusinessTypeEnum
;
...
...
@@ -81,8 +79,9 @@ public class CalculationServiceImpl {
@Autowired
private
MaterialCalculation
materialCalculation
;
@Autowired
private
ShoppingCart
ConvertAdapter
shoppingCartConvert
Adapter
;
private
ShoppingCart
MccafeAdapter
shoppingCartMccafe
Adapter
;
/**
* 更新购物车行优惠信息
...
...
@@ -205,7 +204,8 @@ public class CalculationServiceImpl {
});
for
(
int
i
=
0
,
len
=
cartGoodsList
.
size
();
i
<
len
;
i
++)
{
CartGoods
cartGoods
=
cartGoodsList
.
get
(
i
);
List
<
ShoppingCartGoodsDto
.
CartGoodsDetailDto
>
cartGoodsDetailDtos
=
shoppingCartConvertAdapter
.
convertCartGoods2DetailGoodsList
(
cartGoods
,
apportionGoodsList
,
duplicateGoodsMap
);
// List<ShoppingCartGoodsDto.CartGoodsDetailDto> cartGoodsDetailDtos = shoppingCartConvertAdapter.convertCartGoods2DetailGoodsList(cartGoods, apportionGoodsList,duplicateGoodsMap);
List
<
ShoppingCartGoodsDto
.
CartGoodsDetailDto
>
cartGoodsDetailDtos
=
shoppingCartMccafeAdapter
.
convertCartGoods2DetailGoodsList
(
cartGoods
,
apportionGoodsList
,
duplicateGoodsMap
);
cartGoodsDetailDtoList
.
addAll
(
cartGoodsDetailDtos
);
}
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
Discount
>
discounts
=
calculationDiscountResult
==
null
?
new
ArrayList
<>()
:
calculationDiscountResult
.
getDiscounts
();
...
...
@@ -510,7 +510,7 @@ public class CalculationServiceImpl {
//单品、多规格加料
if
(
CollectionUtils
.
isNotEmpty
(
cartGoods
.
getProductMaterialList
())){
for
(
CartGoods
.
MaterialGoods
materialGoods
:
cartGoods
.
getProductMaterialList
()){
materialPrice
+=
materialGoods
.
getFinalPrice
()
*
cartGoods
.
getQty
(
);
materialPrice
+=
(
null
!=
materialGoods
.
getFinalPrice
()
?
materialGoods
.
getFinalPrice
()
:
0
)
*
(
null
!=
cartGoods
.
getQty
()
?
cartGoods
.
getQty
()
:
0
);
}
}
return
materialPrice
;
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/SetMealCalculation.java
View file @
a44ee5f2
...
...
@@ -92,6 +92,21 @@ public class SetMealCalculation {
}
}
//套餐可选商品加料
if
(
CollectionUtils
.
isNotEmpty
(
cartGoods
.
getProductGroupList
())){
for
(
CartGoods
.
ComboxGoods
comboxGoods
:
cartGoods
.
getProductGroupList
()){
Long
productGroupmaterialPrice
=
0L
;
if
(
CollectionUtils
.
isNotEmpty
(
comboxGoods
.
getProductMaterialList
())){
for
(
CartGoods
.
MaterialGoods
materialGoods
:
comboxGoods
.
getProductMaterialList
()){
productGroupmaterialPrice
+=
null
!=
materialGoods
.
getFinalPrice
()
?
materialGoods
.
getFinalPrice
()
*
cartGoods
.
getQty
()
:
0
;
}
}
comboxGoods
.
setAmount
((
null
==
comboxGoods
.
getAmount
()
?
0
:
comboxGoods
.
getAmount
())+
productGroupmaterialPrice
);
materialPrice
=
materialPrice
+
productGroupmaterialPrice
;
}
}
Long
amount
=
null
!=
cartGoods
.
getFinalPrice
()
?
cartGoods
.
getFinalPrice
()*
cartGoods
.
getQty
()
+
productGroupTotalAmount
+
materialPrice
:
productGroupTotalAmount
+
productComboTotalAmount
+
materialPrice
;
...
...
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