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
2f20d2c2
Commit
2f20d2c2
authored
Aug 18, 2021
by
ping.wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
买m赠n券
parent
3b0a4ba9
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
11 deletions
+23
-11
shopping-cart-application-service/src/main/java/cn/freemud/service/ShoppingCartNewService.java
+1
-1
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/BuyMSendNCouponDiscountServiceImpl.java
+1
-1
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
+21
-9
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/service/ShoppingCartNewService.java
View file @
2f20d2c2
...
...
@@ -137,7 +137,7 @@ public interface ShoppingCartNewService {
}
/**
* 换购券
* 换购券
买M赠N券
*
* @param partnerId
* @param storeId
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/BuyMSendNCouponDiscountServiceImpl.java
View file @
2f20d2c2
...
...
@@ -54,7 +54,7 @@ public class BuyMSendNCouponDiscountServiceImpl implements IPromotionService {
// cartGood.setQty(actualGoodsNumber);
// cartGood.setAmount(0L);
// cartGoods.setQty(cartGoods.getQty() - actualGoodsNumber);
cartGoods
.
setAmount
(
cartGoods
.
get
Amount
()
-
goodsDiscounts
.
get
(
0
).
getDiscount
());
cartGoods
.
setAmount
(
goods
.
getReal
Amount
()
-
goodsDiscounts
.
get
(
0
).
getDiscount
());
// addSendGoodsList.add(cartGood);
}
if
(
cartGoods
.
getQty
()
==
actualGoodsNumber
)
{
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
View file @
2f20d2c2
...
...
@@ -1450,11 +1450,17 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
cartGoods
.
setName
(
checkSpqInfoResponseDto
.
getCouponName
());
cartGoods
.
setSpuName
(
checkSpqInfoResponseDto
.
getCouponName
());
cartGoods
.
setStockLimit
(
checkSpqInfoResponseDto
.
isStockLimit
());
//买M赠N券,不重复加促销券集合字段
for
(
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
discountCoupon
:
coupons
){
if
(
Objects
.
equals
(
discountCoupon
.
getCode
(),
couponCode
)){
continue
;
}
// 添加请求的优惠券信息
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
coupon
=
new
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
();
coupon
.
setCode
(
checkSpqInfoResponseDto
.
getCouponCode
());
coupon
.
setActivityCode
(
checkSpqInfoResponseDto
.
getActiveCode
());
coupons
.
add
(
coupon
);
}
// 添加商品券代表的商品
// 换购券传给促销要带code
String
goodsId
=
StringUtils
.
isEmpty
(
checkSpqInfoResponseDto
.
getSkuId
())
?
checkSpqInfoResponseDto
.
getSpuId
()
:
checkSpqInfoResponseDto
.
getSkuId
();
...
...
@@ -2018,11 +2024,23 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
private
void
addProductGoods
(
AddShoppingCartGoodsRequestVo
addShoppingCartGoodsRequestVo
,
CartGoods
cartGoods
,
String
spuId2
,
String
userId
,
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
,
String
spuId
,
List
<
CartGoods
>
allCartGoodsList
,
List
<
ProductBean
>
productBeanListSpuClass
,
CouponProductDto
couponProductDto
,
String
couponCode
,
Integer
todayAvailableTimes
)
{
cartGoods
.
setSkuId
(
spuId2
);
cartGoods
.
setOriginalPrice
(
0L
);
cartGoods
.
setOriginalAmount
(
0L
);
cartGoods
.
setAmount
(
0L
);
cartGoods
.
setPackPrice
(
productBeanListSpuClass
.
get
(
0
).
getPackPrice
().
longValue
());
cartGoods
.
setPic
(
productBeanListSpuClass
.
get
(
0
).
getPicture
());
cartGoods
.
setWeight
(
productBeanListSpuClass
.
get
(
0
).
getWeight
());
cartGoods
.
setUnit
(
productBeanListSpuClass
.
get
(
0
).
getUnit
());
// 设置商品类型为商品券
if
(
CouponTypeEnum
.
TYPE_4
.
getCode
().
equals
(
couponProductDto
.
getType
()))
{
cartGoods
.
setGoodsType
(
GoodsTypeEnum
.
HG_COUPON_GOODS
.
getGoodsType
());
}
else
if
(
CouponTypeEnum
.
TYPE_7
.
getCode
().
equals
(
couponProductDto
.
getType
()))
{
cartGoods
.
setGoodsType
(
GoodsTypeEnum
.
BUY_M_SEND_N_COUPON
.
getGoodsType
());
cartGoods
.
setAmount
(
productBeanListSpuClass
.
get
(
0
).
getFinalPrice
());
cartGoods
.
setSkuName
(
productBeanListSpuClass
.
get
(
0
).
getName
());
}
else
{
cartGoods
.
setGoodsType
(
GoodsTypeEnum
.
COUPON_GOODS
.
getGoodsType
());
}
...
...
@@ -2033,10 +2051,12 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
}
// 商品券Id
String
spqId
=
spuId
.
substring
(
CommonsConstant
.
COUPON_PREFIX
.
length
());
cartGoods
.
setSpuId
(
spqId
);
if
(
CollectionUtils
.
isNotEmpty
(
allCartGoodsList
))
{
if
(
Objects
.
equals
(
CouponTypeEnum
.
TYPE_0
.
getCode
(),
couponProductDto
.
getType
())
||
Objects
.
equals
(
CouponTypeEnum
.
TYPE_4
.
getCode
(),
couponProductDto
.
getType
()))
{
int
sum
=
allCartGoodsList
.
stream
().
filter
(
p
->
p
.
getSpuId
().
equals
(
spqId
)).
mapToInt
(
CartGoods:
:
getQty
).
sum
();
//今日可用次数判断
if
(
sum
+
cartGoods
.
getQty
()
>
todayAvailableTimes
)
{
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_GOODS_COUPON_CAN_NOT_USE
);
}
...
...
@@ -2049,15 +2069,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
// }
}
cartGoods
.
setSpuId
(
spqId
);
cartGoods
.
setSkuId
(
spuId2
);
cartGoods
.
setOriginalPrice
(
0L
);
cartGoods
.
setOriginalAmount
(
0L
);
cartGoods
.
setAmount
(
0L
);
cartGoods
.
setPackPrice
(
productBeanListSpuClass
.
get
(
0
).
getPackPrice
().
longValue
());
cartGoods
.
setPic
(
productBeanListSpuClass
.
get
(
0
).
getPicture
());
cartGoods
.
setWeight
(
productBeanListSpuClass
.
get
(
0
).
getWeight
());
cartGoods
.
setUnit
(
productBeanListSpuClass
.
get
(
0
).
getUnit
());
boolean
stockLimit
=
false
;
if
(
productBeanListSpuClass
.
get
(
0
).
getType
()
==
ProductType
.
NOSPEC
.
getCode
()
&&
productBeanListSpuClass
.
get
(
0
).
getStockLimit
()
==
1
)
{
...
...
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