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
eaa5c377
Commit
eaa5c377
authored
Sep 28, 2020
by
xiaoer.li@freemud.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
对接促销算价Alpha->fix
parent
d34c33b6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
32 deletions
+41
-32
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/CalculationCommonService.java
+41
-20
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/promotion/FullSharingService.java
+0
-12
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/CalculationCommonService.java
View file @
eaa5c377
...
...
@@ -93,29 +93,50 @@ public class CalculationCommonService {
if
(
find
==
null
)
return
;
cartGoods
.
setAmount
(
find
.
getRealAmount
());
cartGoods
.
setOriginalAmount
(
find
.
getOriginalPrice
());
Integer
type
=
2
;
if
(
CollectionUtils
.
isEmpty
(
cartGoods
.
getProductGroupList
()))
return
;
Map
<
String
,
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
SmallMaterial
>
choices
=
find
.
getSmallMaterial
()
.
stream
().
filter
(
d
->
type
.
equals
(
d
.
getType
()))
.
collect
(
Collectors
.
toMap
(
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
SmallMaterial
::
getGoodsId
,
Function
.
identity
(),
(
k1
,
k2
)
->
k1
));
long
amount
=
0L
;
long
original
=
0L
;
//
for
(
CartGoods
.
ComboxGoods
choice
:
cartGoods
.
getProductGroupList
())
{
/**
* 可选搭配
*/
if
(
CollectionUtils
.
isNotEmpty
(
cartGoods
.
getProductGroupList
()))
{
Integer
type2
=
2
;
Map
<
String
,
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
SmallMaterial
>
gChoices
=
find
.
getSmallMaterial
()
.
stream
().
filter
(
d
->
type2
.
equals
(
d
.
getType
()))
.
collect
(
Collectors
.
toMap
(
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
SmallMaterial
::
getGoodsId
,
Function
.
identity
(),
(
k1
,
k2
)
->
k1
));
long
amount
=
0L
;
long
original
=
0L
;
//可选搭配
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
SmallMaterial
mt
=
choices
.
get
(
choice
.
getGoodsId
());
if
(
mt
==
null
)
{
amount
+=
choice
.
getAmount
()
*
cartGoods
.
getQty
();
original
+=
choice
.
getOriginalPrice
()
*
cartGoods
.
getQty
();
}
else
{
amount
+=
mt
.
getRealAmount
();
original
+=
mt
.
getOriginalPrice
()
*
cartGoods
.
getQty
();
choice
.
setAmount
(
mt
.
getRealAmount
().
longValue
());
choice
.
setOriginalAmount
(
original
);
for
(
CartGoods
.
ComboxGoods
choice
:
cartGoods
.
getProductGroupList
())
{
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
SmallMaterial
mt
=
gChoices
.
get
(
choice
.
getGoodsId
());
if
(
mt
==
null
)
{
amount
+=
choice
.
getAmount
()
*
cartGoods
.
getQty
();
original
+=
choice
.
getOriginalPrice
()
*
cartGoods
.
getQty
();
}
else
{
amount
+=
mt
.
getRealAmount
();
original
+=
mt
.
getOriginalPrice
()
*
cartGoods
.
getQty
();
choice
.
setAmount
(
mt
.
getRealAmount
().
longValue
());
choice
.
setOriginalAmount
(
original
);
}
}
cartGoods
.
setAmount
(
cartGoods
.
getAmount
()
+
amount
);
cartGoods
.
setOriginalAmount
(
cartGoods
.
getOriginalMaterialAmount
()
+
original
);
}
/**
* 小料
*/
if
(
CollectionUtils
.
isNotEmpty
(
cartGoods
.
getProductMaterialList
()))
{
Integer
type1
=
1
;
Map
<
String
,
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
SmallMaterial
>
sChoices
=
find
.
getSmallMaterial
()
.
stream
().
filter
(
d
->
type1
.
equals
(
d
.
getType
()))
.
collect
(
Collectors
.
toMap
(
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
SmallMaterial
::
getGoodsId
,
Function
.
identity
(),
(
k1
,
k2
)
->
k1
));
for
(
CartGoods
.
MaterialGoods
mg
:
cartGoods
.
getProductMaterialList
())
{
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
SmallMaterial
sm
=
sChoices
.
get
(
mg
.
getSpuId
());
if
(
sm
!=
null
)
{
mg
.
setAmount
(
sm
.
getRealAmount
().
longValue
());
}
}
}
cartGoods
.
setAmount
(
cartGoods
.
getAmount
()
+
amount
);
cartGoods
.
setOriginalAmount
(
cartGoods
.
getOriginalMaterialAmount
()
+
original
);
}
/**
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/promotion/FullSharingService.java
View file @
eaa5c377
...
...
@@ -126,18 +126,6 @@ public class FullSharingService {
}
}
}
//固定搭配
//if (CollectionUtils.isNotEmpty(cart.getProductComboList())) {
// List<CalculationSharingDiscountResponseDto.CalculationDiscountResult.Goods.GroupCombox> groupCom = discountMap.getGroupCombox();
// HashMap<String, Long> gDiscount = drawnFullDiscount(groupCom, typeEnums);
// if (!gDiscount.isEmpty()) continue;
// for (CartGoods.ComboxGoods com : cart.getProductComboList()) {
// Long md = gDiscount.get(com.getGoodsId());
// if (md!=null) {
// com.setAmount(com.getAmount()+md);
// }
// }
//}
}
/**
...
...
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