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
248b3b66
Commit
248b3b66
authored
Nov 29, 2021
by
查志伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
购物车新算价赠品显示bug修复
parent
8ae6c36f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
19 deletions
+6
-19
shopping-cart-application-service/src/main/java/cn/freemud/service/active/impl/PlatformActiveServiceImpl.java
+6
-19
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/service/active/impl/PlatformActiveServiceImpl.java
View file @
248b3b66
...
@@ -29,11 +29,7 @@ import org.apache.commons.lang.ObjectUtils;
...
@@ -29,11 +29,7 @@ import org.apache.commons.lang.ObjectUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
@Service
(
"platformActiveService"
)
@Service
(
"platformActiveService"
)
...
@@ -86,17 +82,17 @@ public class PlatformActiveServiceImpl implements ActiveService {
...
@@ -86,17 +82,17 @@ public class PlatformActiveServiceImpl implements ActiveService {
String
storeId
,
String
storeId
,
String
userId
,
String
userId
,
Integer
flag
)
{
Integer
flag
)
{
Map
<
String
,
ProductBean
>
productMap
=
products
.
stream
().
collect
(
Collectors
.
toMap
(
ProductBean:
:
getPid
,
k
->
k
,
(
k1
,
k2
)
->
k1
));
Map
<
String
,
Goods
>
discountForGift
=
this
.
getDiscountForGift
(
discountResult
);
List
<
CartGoods
>
list
=
new
ArrayList
<>();
List
<
CartGoods
>
list
=
new
ArrayList
<>();
for
(
ProductBean
product
:
products
)
{
for
(
Goods
goods
:
discountResult
.
getGoods
())
{
Goods
goods
=
discountForGift
.
get
(
product
.
getPid
());
// 过滤掉非赠品的商品
if
(!
CalculationGoodsType
.
TYPE_1
.
getType
().
equals
(
goods
.
getCartGoodType
()))
continue
;
ProductBean
product
=
productMap
.
get
(
goods
.
getGoodsId
());
GoodsDiscount
discount
=
goods
.
getDiscounts
()
GoodsDiscount
discount
=
goods
.
getDiscounts
()
.
stream
()
.
stream
()
.
filter
(
g
->
ActivityTypeEnum
.
TYPE_63
.
getCode
().
equals
(
g
.
getType
())
||
ActivityTypeEnum
.
TYPE_62
.
getCode
().
equals
(
g
.
getType
())
||
ActivityTypeEnum
.
TYPE_61
.
getCode
().
equals
(
g
.
getType
())
||
ActivityTypeEnum
.
TYPE_230
.
getCode
().
equals
(
g
.
getType
()))
.
filter
(
g
->
ActivityTypeEnum
.
TYPE_63
.
getCode
().
equals
(
g
.
getType
())
||
ActivityTypeEnum
.
TYPE_62
.
getCode
().
equals
(
g
.
getType
())
||
ActivityTypeEnum
.
TYPE_61
.
getCode
().
equals
(
g
.
getType
())
||
ActivityTypeEnum
.
TYPE_230
.
getCode
().
equals
(
g
.
getType
()))
.
findFirst
()
.
findFirst
()
.
get
();
.
get
();
CartGoods
cartGood
=
new
CartGoods
();
CartGoods
cartGood
=
new
CartGoods
();
cartGood
.
setGoodsId
(
goods
.
getGoodsId
());
cartGood
.
setGoodsId
(
goods
.
getGoodsId
());
cartGood
.
setGoodsType
(
1
);
cartGood
.
setGoodsType
(
1
);
...
@@ -128,13 +124,4 @@ public class PlatformActiveServiceImpl implements ActiveService {
...
@@ -128,13 +124,4 @@ public class PlatformActiveServiceImpl implements ActiveService {
addcartGoodsList
.
addAll
(
giftCacheManager
.
resetGiftCache
(
list
,
null
,
partnerId
,
storeId
,
userId
));
addcartGoodsList
.
addAll
(
giftCacheManager
.
resetGiftCache
(
list
,
null
,
partnerId
,
storeId
,
userId
));
}
}
public
Map
<
String
,
Goods
>
getDiscountForGift
(
CalculationDiscountResult
discountResult
)
{
Map
<
String
,
Goods
>
gifts
=
discountResult
.
getGoods
()
.
stream
()
.
filter
(
d
->
CalculationGoodsType
.
TYPE_1
.
getType
().
equals
(
d
.
getCartGoodType
()))
.
collect
(
Collectors
.
toMap
(
Goods:
:
getGoodsId
,
Function
.
identity
(),
(
k1
,
k2
)
->
k1
));
return
gifts
;
}
}
}
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