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
39c32f72
Commit
39c32f72
authored
Apr 17, 2022
by
查志伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fix 赠品下单属性不匹配问题
parent
12342346
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
10 deletions
+9
-10
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/promotion/GiftSharingService.java
+9
-10
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/promotion/GiftSharingService.java
View file @
39c32f72
...
@@ -24,10 +24,7 @@ import org.apache.commons.lang.ObjectUtils;
...
@@ -24,10 +24,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.stream.Collectors
;
import
java.util.stream.Collectors
;
/**
/**
...
@@ -171,6 +168,7 @@ public class GiftSharingService {
...
@@ -171,6 +168,7 @@ public class GiftSharingService {
if
(
CollectionUtils
.
isNotEmpty
(
products
))
{
if
(
CollectionUtils
.
isNotEmpty
(
products
))
{
Map
<
String
,
ProductBean
>
productMap
=
products
.
stream
().
collect
(
Collectors
.
toMap
(
ProductBean:
:
getPid
,
k
->
k
,
(
k1
,
k2
)
->
k1
));
Map
<
String
,
ProductBean
>
productMap
=
products
.
stream
().
collect
(
Collectors
.
toMap
(
ProductBean:
:
getPid
,
k
->
k
,
(
k1
,
k2
)
->
k1
));
List
<
CartGoods
>
list
=
new
ArrayList
<>();
List
<
CartGoods
>
list
=
new
ArrayList
<>();
Map
<
String
,
Goods
>
map
=
new
HashMap
<>();
for
(
Goods
goods
:
discountResult
.
getGoods
())
{
for
(
Goods
goods
:
discountResult
.
getGoods
())
{
// 过滤掉非赠品的商品
// 过滤掉非赠品的商品
if
(!
CalculationGoodsType
.
TYPE_1
.
getType
().
equals
(
goods
.
getCartGoodType
()))
continue
;
if
(!
CalculationGoodsType
.
TYPE_1
.
getType
().
equals
(
goods
.
getCartGoodType
()))
continue
;
...
@@ -203,16 +201,17 @@ public class GiftSharingService {
...
@@ -203,16 +201,17 @@ public class GiftSharingService {
// nodeId标识activeCode,用于计算均摊时每个商品在每个活动上均摊金额
// nodeId标识activeCode,用于计算均摊时每个商品在每个活动上均摊金额
cartGood
.
setNodeId
(
discount
.
getActivityCode
());
cartGood
.
setNodeId
(
discount
.
getActivityCode
());
// 将有属性的赠品拆分为多行,每行一个,以支持每个赠品可以选择独立的属性
// 将有属性的赠品拆分为多行,每行一个,以支持每个赠品可以选择独立的属性
List
<
CartGoods
>
nl
=
buyAndGiftsPromotionService
.
setGiftExtra
(
cartGood
,
product
,
null
);
list
.
addAll
(
buyAndGiftsPromotionService
.
setGiftExtra
(
cartGood
,
product
,
null
));
nl
.
forEach
(
c
->
{
map
.
put
(
cartGood
.
getGoodsId
(),
goods
);
}
// 因为有涉及到用户选择的属性,存入redis
list
=
giftCacheManager
.
resetGiftCache
(
list
,
null
,
activityQueryDto
.
getPartnerId
(),
activityQueryDto
.
getStoreId
(),
userLoginInfoDto
.
getMemberId
());
list
.
forEach
(
c
->
{
Goods
goods
=
map
.
get
(
c
.
getGoodsId
());
// 构建优惠
// 构建优惠
ShoppingCartGoodsDto
.
CartGoodsDetailDto
cartGoodsDetailDto
=
calculationCommonService
.
convertCartGoods2DetailGoodsList
(
goods
,
c
,
activityQueryDto
.
getPartnerId
());
ShoppingCartGoodsDto
.
CartGoodsDetailDto
cartGoodsDetailDto
=
calculationCommonService
.
convertCartGoods2DetailGoodsList
(
goods
,
c
,
activityQueryDto
.
getPartnerId
());
cartGoodsDetailDtoList
.
add
(
cartGoodsDetailDto
);
cartGoodsDetailDtoList
.
add
(
cartGoodsDetailDto
);
});
});
list
.
addAll
(
nl
);
}
// 因为有涉及到用户选择的属性,存入redis
giftCacheManager
.
resetGiftCache
(
list
,
null
,
activityQueryDto
.
getPartnerId
(),
activityQueryDto
.
getStoreId
(),
userLoginInfoDto
.
getMemberId
());
}
}
}
}
...
...
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