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
f209db48
Commit
f209db48
authored
Aug 20, 2021
by
ping.wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码调整
parent
36552d8a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
47 deletions
+49
-47
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/CalculationSharingDiscountService.java
+49
-47
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/CalculationSharingDiscountService.java
View file @
f209db48
...
...
@@ -111,56 +111,58 @@ public class CalculationSharingDiscountService {
}
if
(
StringUtils
.
isBlank
(
couponCode
))
{
//非商品券
this
.
setCommonDiscountGoods
(
calculationDiscountGoodsList
,
cartGoods
);
}
//商品券->商品券ID换取商品
CheckSpqInfoRequestDto
checkSpqInfoRequestDto
=
new
CheckSpqInfoRequestDto
(
partnerId
,
storeId
,
couponCode
,
menuType
);
CheckSpqInfoResponseDto
checkSpqInfo
=
null
;
if
(
GoodsTypeEnum
.
HG_COUPON_GOODS
.
getGoodsType
().
equals
(
cartGoods
.
getGoodsType
()))
{
checkSpqInfo
=
couponService
.
checkSpqInfo
(
checkSpqInfoRequestDto
,
cartGoods
.
getSkuId
());
}
else
{
checkSpqInfo
=
couponService
.
checkSpqInfo
(
checkSpqInfoRequestDto
);
}
if
(
null
==
checkSpqInfo
)
{
cartGoodsList
.
remove
(
i
);
assortmentSdkService
.
setShoppingCart
(
partnerId
,
storeId
,
userId
,
cartGoodsList
,
null
,
null
,
this
.
shoppingCartBaseService
);
continue
;
//跑业务异常 商品券不存
}
if
(
cartGoods
.
getCartGoodsUid
().
startsWith
(
CommonsConstant
.
COUPON_PREFIX
))
{
validCouponMap
.
put
(
couponCode
,
checkSpqInfo
);
}
if
(!
GoodsTypeEnum
.
BUY_M_SEND_N_COUPON
.
getGoodsType
().
equals
(
cartGoods
.
getGoodsType
()))
{
validCouponMap
.
put
(
couponCode
+
checkSpqInfo
.
getSkuId
(),
checkSpqInfo
);
validCouponMap
.
put
(
couponCode
,
checkSpqInfo
);
}
}
else
{
//商品券->商品券ID换取商品
CheckSpqInfoRequestDto
checkSpqInfoRequestDto
=
new
CheckSpqInfoRequestDto
(
partnerId
,
storeId
,
couponCode
,
menuType
);
CheckSpqInfoResponseDto
checkSpqInfo
=
null
;
if
(
GoodsTypeEnum
.
HG_COUPON_GOODS
.
getGoodsType
().
equals
(
cartGoods
.
getGoodsType
()))
{
checkSpqInfo
=
couponService
.
checkSpqInfo
(
checkSpqInfoRequestDto
,
cartGoods
.
getSkuId
());
}
else
{
checkSpqInfo
=
couponService
.
checkSpqInfo
(
checkSpqInfoRequestDto
);
}
if
(
null
==
checkSpqInfo
)
{
cartGoodsList
.
remove
(
i
);
assortmentSdkService
.
setShoppingCart
(
partnerId
,
storeId
,
userId
,
cartGoodsList
,
null
,
null
,
this
.
shoppingCartBaseService
);
continue
;
//跑业务异常 商品券不存
}
if
(
cartGoods
.
getCartGoodsUid
().
startsWith
(
CommonsConstant
.
COUPON_PREFIX
))
{
validCouponMap
.
put
(
couponCode
,
checkSpqInfo
);
}
if
(!
GoodsTypeEnum
.
BUY_M_SEND_N_COUPON
.
getGoodsType
().
equals
(
cartGoods
.
getGoodsType
()))
{
validCouponMap
.
put
(
couponCode
+
checkSpqInfo
.
getSkuId
(),
checkSpqInfo
);
validCouponMap
.
put
(
couponCode
,
checkSpqInfo
);
}
if
(
spqIdToCartUuid
.
containsKey
(
couponCode
))
{
List
<
String
>
uuidList
=
spqIdToCartUuid
.
get
(
couponCode
);
uuidList
.
add
(
cartGoods
.
getCartGoodsUid
());
spqIdToCartUuid
.
put
(
couponCode
,
uuidList
);
}
else
{
List
<
String
>
uuidList
=
new
ArrayList
<>();
uuidList
.
add
(
cartGoods
.
getCartGoodsUid
());
spqIdToCartUuid
.
put
(
couponCode
,
uuidList
);
}
cartGoods
.
setName
(
checkSpqInfo
.
getCouponName
());
cartGoods
.
setSpuName
(
checkSpqInfo
.
getCouponName
());
cartGoods
.
setStockLimit
(
checkSpqInfo
.
isStockLimit
());
//买M送N券不赋值券名称
if
(
GoodsTypeEnum
.
BUY_M_SEND_N_COUPON
.
getGoodsType
().
equals
(
cartGoods
.
getGoodsType
()))
{
cartGoods
.
setName
(
checkSpqInfo
.
getSkuName
());
cartGoods
.
setSpuName
(
checkSpqInfo
.
getSpuName
());
}
CalculationSharingDiscountRequestDto
.
CalculationDiscountCoupon
coupon
=
new
CalculationSharingDiscountRequestDto
.
CalculationDiscountCoupon
();
coupon
.
setCode
(
checkSpqInfo
.
getCouponCode
());
coupon
.
setActivityCode
(
checkSpqInfo
.
getActiveCode
());
CalculationSharingDiscountRequestDto
.
CalculationDiscountCoupon
calculationDiscountCoupon
=
coupons
.
stream
().
filter
(
p
->
coupon
.
getActivityCode
().
equals
(
p
.
getActivityCode
())
&&
coupon
.
getCode
().
equals
(
p
.
getCode
())).
findFirst
().
orElse
(
null
);
if
(
calculationDiscountCoupon
==
null
)
{
coupons
.
add
(
coupon
);
if
(
spqIdToCartUuid
.
containsKey
(
couponCode
))
{
List
<
String
>
uuidList
=
spqIdToCartUuid
.
get
(
couponCode
);
uuidList
.
add
(
cartGoods
.
getCartGoodsUid
());
spqIdToCartUuid
.
put
(
couponCode
,
uuidList
);
}
else
{
List
<
String
>
uuidList
=
new
ArrayList
<>();
uuidList
.
add
(
cartGoods
.
getCartGoodsUid
());
spqIdToCartUuid
.
put
(
couponCode
,
uuidList
);
}
cartGoods
.
setName
(
checkSpqInfo
.
getCouponName
());
cartGoods
.
setSpuName
(
checkSpqInfo
.
getCouponName
());
cartGoods
.
setStockLimit
(
checkSpqInfo
.
isStockLimit
());
//买M送N券不赋值券名称
if
(
GoodsTypeEnum
.
BUY_M_SEND_N_COUPON
.
getGoodsType
().
equals
(
cartGoods
.
getGoodsType
()))
{
cartGoods
.
setName
(
checkSpqInfo
.
getSkuName
());
cartGoods
.
setSpuName
(
checkSpqInfo
.
getSpuName
());
}
CalculationSharingDiscountRequestDto
.
CalculationDiscountCoupon
coupon
=
new
CalculationSharingDiscountRequestDto
.
CalculationDiscountCoupon
();
coupon
.
setCode
(
checkSpqInfo
.
getCouponCode
());
coupon
.
setActivityCode
(
checkSpqInfo
.
getActiveCode
());
CalculationSharingDiscountRequestDto
.
CalculationDiscountCoupon
calculationDiscountCoupon
=
coupons
.
stream
().
filter
(
p
->
coupon
.
getActivityCode
().
equals
(
p
.
getActivityCode
())
&&
coupon
.
getCode
().
equals
(
p
.
getCode
())).
findFirst
().
orElse
(
null
);
if
(
calculationDiscountCoupon
==
null
)
{
coupons
.
add
(
coupon
);
}
// 添加商品券代表的商品放入促销
String
goodsId
=
StringUtils
.
isNotBlank
(
checkSpqInfo
.
getSkuId
())
?
checkSpqInfo
.
getSkuId
()
:
checkSpqInfo
.
getSpuId
();
this
.
setSpqDiscountGoods
(
calculationDiscountGoodsList
,
cartGoods
,
goodsId
,
checkSpqInfo
.
getPrice
(),
couponCode
);
}
// 添加商品券代表的商品放入促销
String
goodsId
=
StringUtils
.
isNotBlank
(
checkSpqInfo
.
getSkuId
())
?
checkSpqInfo
.
getSkuId
()
:
checkSpqInfo
.
getSpuId
();
this
.
setSpqDiscountGoods
(
calculationDiscountGoodsList
,
cartGoods
,
goodsId
,
checkSpqInfo
.
getPrice
(),
couponCode
);
}
/*加价购商品不为空*/
...
...
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