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
1d63d696
Commit
1d63d696
authored
Oct 27, 2020
by
xiaoer.li@freemud.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'remotes/origin/feature/促销算价基于最新master的分支' into qa
parents
e2db6760
1fcb6fce
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
36 deletions
+35
-36
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/CalculationCommonService.java
+4
-3
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/CalculationSharingDiscountService.java
+21
-21
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/CalculationSharingEquallyService.java
+1
-1
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/promotion/AdditionSharingService.java
+9
-11
shopping-cart-application-service/src/test/java/cn.freemud/service/CartTest.java
+0
-0
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/CalculationCommonService.java
View file @
1d63d696
...
@@ -337,7 +337,7 @@ public class CalculationCommonService {
...
@@ -337,7 +337,7 @@ public class CalculationCommonService {
cartGoodsDetailDto
.
setOriginalPrice
(
cartGoods
.
getOriginalPrice
());
cartGoodsDetailDto
.
setOriginalPrice
(
cartGoods
.
getOriginalPrice
());
if
(
calculationGoods
!=
null
)
{
if
(
calculationGoods
!=
null
)
{
cartGoodsDetailDto
.
setTotalDiscountAmount
(
calculationGoods
.
getDiscountAmount
().
intValue
());
cartGoodsDetailDto
.
setTotalDiscountAmount
(
calculationGoods
.
getDiscountAmount
().
intValue
());
cartGoodsDetailDto
.
setOriginalPrice
(
calculationGoods
.
getOriginalPrice
());
//
cartGoodsDetailDto.setOriginalPrice(calculationGoods.getOriginalPrice());
}
}
else
{
else
{
cartGoodsDetailDto
.
setTotalDiscountAmount
(
cartGoods
.
getOriginalAmount
().
intValue
()
-
cartGoods
.
getAmount
().
intValue
());
cartGoodsDetailDto
.
setTotalDiscountAmount
(
cartGoods
.
getOriginalAmount
().
intValue
()
-
cartGoods
.
getAmount
().
intValue
());
...
@@ -413,9 +413,10 @@ public class CalculationCommonService {
...
@@ -413,9 +413,10 @@ public class CalculationCommonService {
cartGoodsDetailDto
.
setTotalDiscountAmount
(
cartGoodsDetailDto
.
getTotalDiscountAmount
()
+
discountSum
);
cartGoodsDetailDto
.
setTotalDiscountAmount
(
cartGoodsDetailDto
.
getTotalDiscountAmount
()
+
discountSum
);
originalPriceSum
=
0L
;
originalPriceSum
=
0L
;
for
(
ShoppingCartGoodsDto
.
CartGoodsDetailDto
goodsDetailDto
:
groupList
)
{
for
(
ShoppingCartGoodsDto
.
CartGoodsDetailDto
goodsDetailDto
:
groupList
)
{
originalPriceSum
+=
goodsDetailDto
.
getOriginalPrice
()
*
(
goodsDetailDto
.
getQty
()
/
cartGoods
.
getQty
());
//originalPriceSum += goodsDetailDto.getOriginalPrice() * (goodsDetailDto.getQty() / cartGoods.getQty());
//originalPriceSum += goodsDetailDto.getOriginalPrice() * cartGoods.getQty();
}
}
cartGoodsDetailDto
.
setOriginalPrice
(
cartGoodsDetailDto
.
getOriginalPrice
()+
originalPriceSum
);
//
cartGoodsDetailDto.setOriginalPrice(cartGoodsDetailDto.getOriginalPrice()+originalPriceSum);
}
}
cartGoodsDetailDto
.
setComboProducts
(
combs
);
cartGoodsDetailDto
.
setComboProducts
(
combs
);
List
<
ShoppingCartGoodsDto
.
CartGoodsDetailDto
.
CartGoodsExtra
>
cartGoodsExtras
=
BeanUtil
.
convertBeans
(
cartGoods
.
getExtra
(),
ShoppingCartGoodsDto
.
CartGoodsDetailDto
.
CartGoodsExtra
::
new
);
List
<
ShoppingCartGoodsDto
.
CartGoodsDetailDto
.
CartGoodsExtra
>
cartGoodsExtras
=
BeanUtil
.
convertBeans
(
cartGoods
.
getExtra
(),
ShoppingCartGoodsDto
.
CartGoodsDetailDto
.
CartGoodsExtra
::
new
);
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/CalculationSharingDiscountService.java
View file @
1d63d696
...
@@ -91,31 +91,31 @@ public class CalculationSharingDiscountService {
...
@@ -91,31 +91,31 @@ public class CalculationSharingDiscountService {
if
(
null
==
checkSpqInfo
)
{
if
(
null
==
checkSpqInfo
)
{
cartGoodsList
.
remove
(
i
);
cartGoodsList
.
remove
(
i
);
assortmentSdkService
.
setShoppingCart
(
partnerId
,
storeId
,
userId
,
cartGoodsList
,
null
,
null
,
this
.
shoppingCartBaseService
);
assortmentSdkService
.
setShoppingCart
(
partnerId
,
storeId
,
userId
,
cartGoodsList
,
null
,
null
,
this
.
shoppingCartBaseService
);
//跑业务异常 商品券不存
////跑业务异常 商品券不存
//if (GoodsTypeEnum.HG_COUPON_GOODS.getGoodsType().equals(cartGoods.getGoodsType())) {
// throw new ServiceException(ResponseResult.SHOPPING_CART_HG_COUPON_NOT_EXIST);
//} else {
// throw new ServiceException(ResponseResult.SHOPPING_CART_COUPON_NOT_EXIST);
//}
}
else
{
validCouponMap
.
put
(
spqId
,
checkSpqInfo
);
cartGoods
.
setName
(
checkSpqInfo
.
getCouponName
());
cartGoods
.
setSpuName
(
checkSpqInfo
.
getCouponName
());
CalculationSharingDiscountRequestDto
.
CalculationDiscountCoupon
coupon
=
new
CalculationSharingDiscountRequestDto
.
CalculationDiscountCoupon
();
coupon
.
setCode
(
checkSpqInfo
.
getCouponCode
());
coupon
.
setActivityCode
(
checkSpqInfo
.
getActiveCode
());
log
.
info
(
"coupons={},coupon={}"
,
JSON
.
toJSONString
(
coupons
),
JSON
.
toJSONString
(
coupon
));
coupons
.
add
(
coupon
);
// 添加商品券代表的商品放入促销
String
goodsId
=
StringUtils
.
isNotBlank
(
checkSpqInfo
.
getSkuId
())
?
checkSpqInfo
.
getSkuId
()
:
checkSpqInfo
.
getSpuId
();
if
(
GoodsTypeEnum
.
HG_COUPON_GOODS
.
getGoodsType
().
equals
(
cartGoods
.
getGoodsType
()))
{
if
(
GoodsTypeEnum
.
HG_COUPON_GOODS
.
getGoodsType
().
equals
(
cartGoods
.
getGoodsType
()))
{
th
row
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_HG_COUPON_NOT_EXIST
);
th
is
.
setSpqDiscountGoods
(
calculationDiscountGoodsList
,
cartGoods
,
goodsId
,
checkSpqInfo
.
getPrice
(),
cartGoods
.
getSpuId
()
);
}
else
{
}
else
{
th
row
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_COUPON_NOT_EXIST
);
th
is
.
setSpqDiscountGoods
(
calculationDiscountGoodsList
,
cartGoods
,
goodsId
,
checkSpqInfo
.
getPrice
()
);
}
}
}
}
validCouponMap
.
put
(
spqId
,
checkSpqInfo
);
cartGoods
.
setName
(
checkSpqInfo
.
getCouponName
());
cartGoods
.
setSpuName
(
checkSpqInfo
.
getCouponName
());
CalculationSharingDiscountRequestDto
.
CalculationDiscountCoupon
coupon
=
new
CalculationSharingDiscountRequestDto
.
CalculationDiscountCoupon
();
coupon
.
setCode
(
checkSpqInfo
.
getCouponCode
());
coupon
.
setActivityCode
(
checkSpqInfo
.
getActiveCode
());
log
.
info
(
"coupons={},coupon={}"
,
JSON
.
toJSONString
(
coupons
),
JSON
.
toJSONString
(
coupon
));
coupons
.
add
(
coupon
);
// 添加商品券代表的商品放入促销
String
goodsId
=
StringUtils
.
isNotBlank
(
checkSpqInfo
.
getSkuId
())
?
checkSpqInfo
.
getSkuId
():
checkSpqInfo
.
getSpuId
();
if
(
GoodsTypeEnum
.
HG_COUPON_GOODS
.
getGoodsType
().
equals
(
cartGoods
.
getGoodsType
()))
{
this
.
setSpqDiscountGoods
(
calculationDiscountGoodsList
,
cartGoods
,
goodsId
,
checkSpqInfo
.
getPrice
(),
cartGoods
.
getSpuId
());
}
else
{
this
.
setSpqDiscountGoods
(
calculationDiscountGoodsList
,
cartGoods
,
goodsId
,
checkSpqInfo
.
getPrice
());
}
}
}
}
}
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/CalculationSharingEquallyService.java
View file @
1d63d696
...
@@ -121,7 +121,7 @@ public class CalculationSharingEquallyService {
...
@@ -121,7 +121,7 @@ public class CalculationSharingEquallyService {
/**
/**
* 加价购商品
* 加价购商品
*/
*/
additionSharingService
.
equally
(
shoppingCartInfoRequestVo
,
shoppingCartGoodsDto
,
discountResult
,
premiumExchangeActivity
);
additionSharingService
.
equally
(
shoppingCartInfoRequestVo
,
shoppingCartGoodsDto
,
discountResult
,
premiumExchangeActivity
,
shoppingCartGoodsResponseVo
);
/**
/**
* 积分抵扣
* 积分抵扣
*/
*/
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/promotion/AdditionSharingService.java
View file @
1d63d696
...
@@ -231,7 +231,8 @@ public class AdditionSharingService {
...
@@ -231,7 +231,8 @@ public class AdditionSharingService {
public
void
equally
(
ShoppingCartInfoRequestVo
shoppingCartInfoRequestVo
public
void
equally
(
ShoppingCartInfoRequestVo
shoppingCartInfoRequestVo
,
ShoppingCartGoodsDto
shoppingCartGoodsDto
,
ShoppingCartGoodsDto
shoppingCartGoodsDto
,
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
discountResult
,
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
discountResult
,
CreateOrderVo
.
PremiumExchangeActivity
premiumExchangeActivity
)
{
,
CreateOrderVo
.
PremiumExchangeActivity
premiumExchangeActivity
,
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
)
{
if
(
discountResult
==
null
||
CollectionUtils
.
isEmpty
(
discountResult
.
getGoods
())
||
premiumExchangeActivity
==
null
||
CollectionUtils
.
isEmpty
(
premiumExchangeActivity
.
getProducts
()))
{
if
(
discountResult
==
null
||
CollectionUtils
.
isEmpty
(
discountResult
.
getGoods
())
||
premiumExchangeActivity
==
null
||
CollectionUtils
.
isEmpty
(
premiumExchangeActivity
.
getProducts
()))
{
return
;
return
;
...
@@ -252,12 +253,12 @@ public class AdditionSharingService {
...
@@ -252,12 +253,12 @@ public class AdditionSharingService {
if
(
getProductsVoMap
.
isEmpty
())
{
if
(
getProductsVoMap
.
isEmpty
())
{
throw
new
ServiceException
(
ResponseResult
.
PREMIUM_EXCHANGE_ACTIVITY_NOT_EXIST
);
throw
new
ServiceException
(
ResponseResult
.
PREMIUM_EXCHANGE_ACTIVITY_NOT_EXIST
);
}
}
log
.
info
(
"getProductsVoMap:{}"
,
JSON
.
toJSONString
(
getProductsVoMap
));
// 获取计算返回的价格
// 获取计算返回的价格
Long
originalTotalAmount
=
shoppingCartGoods
Dt
o
.
getOriginalTotalAmount
();
Long
originalTotalAmount
=
shoppingCartGoods
ResponseV
o
.
getOriginalTotalAmount
();
Long
totalAmount
=
shoppingCartGoodsDto
.
getTotalAmount
();
//
Long totalAmount = shoppingCartGoodsDto.getTotalAmount();
Long
totalDiscountAmount
=
shoppingCartGoodsDto
.
getTotalDiscountAmount
();
//
Long totalDiscountAmount = shoppingCartGoodsDto.getTotalDiscountAmount();
//加价换购活动总优惠
//加价换购活动总优惠
Long
currenttotalDiscountAmount
=
0L
;
for
(
CreateOrderVo
.
PremiumExchangeActivity
.
Product
product
:
premiumExchangeActivity
.
getProducts
())
{
for
(
CreateOrderVo
.
PremiumExchangeActivity
.
Product
product
:
premiumExchangeActivity
.
getProducts
())
{
String
goodsId
=
StringUtils
.
isEmpty
(
product
.
getSkuId
())
?
product
.
getSpuId
()
:
product
.
getSkuId
();
String
goodsId
=
StringUtils
.
isEmpty
(
product
.
getSkuId
())
?
product
.
getSpuId
()
:
product
.
getSkuId
();
...
@@ -266,15 +267,15 @@ public class AdditionSharingService {
...
@@ -266,15 +267,15 @@ public class AdditionSharingService {
continue
;
continue
;
}
}
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
hgGood
=
manyHgs
.
stream
().
filter
(
d
->
goodsId
.
equals
(
d
.
getGoodsId
())).
findFirst
().
orElse
(
null
);
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
hgGood
=
manyHgs
.
stream
().
filter
(
d
->
goodsId
.
equals
(
d
.
getGoodsId
())).
findFirst
().
orElse
(
null
);
if
(
hgGood
==
null
)
{
if
(
hgGood
==
null
)
{
continue
;
continue
;
}
}
ShoppingCartGoodsDto
.
CartGoodsDetailDto
cartGoodsDetailDto
=
this
.
getCartGoodsDetailDto
(
product
,
getProductsVo
,
goodsId
,
hgGood
);
ShoppingCartGoodsDto
.
CartGoodsDetailDto
cartGoodsDetailDto
=
this
.
getCartGoodsDetailDto
(
product
,
getProductsVo
,
goodsId
,
hgGood
);
shoppingCartGoodsDto
.
getProducts
().
add
(
cartGoodsDetailDto
);
shoppingCartGoodsDto
.
getProducts
().
add
(
cartGoodsDetailDto
);
//2.计算优惠价格
//2.计算优惠价格
originalTotalAmount
+=
getProductsVo
.
getFinalPrice
();
originalTotalAmount
+=
getProductsVo
.
getFinalPrice
();
totalDiscountAmount
+=
cartGoodsDetailDto
.
getTotalDiscountAmount
();
//
totalDiscountAmount += cartGoodsDetailDto.getTotalDiscountAmount();
currenttotalDiscountAmount
+=
cartGoodsDetailDto
.
getTotalDiscountAmount
();
//
currenttotalDiscountAmount += cartGoodsDetailDto.getTotalDiscountAmount();
// 3.设置商品行优惠明细
// 3.设置商品行优惠明细
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
sendActivity
=
hgGood
.
getDiscounts
().
get
(
0
);
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
GoodsDiscount
sendActivity
=
hgGood
.
getDiscounts
().
get
(
0
);
ActivityDiscountsDto
activityDiscountsDto
=
new
ActivityDiscountsDto
();
ActivityDiscountsDto
activityDiscountsDto
=
new
ActivityDiscountsDto
();
...
@@ -318,6 +319,4 @@ public class AdditionSharingService {
...
@@ -318,6 +319,4 @@ public class AdditionSharingService {
cartGoodsDetailDto
.
setExtraList
(
cartGoodsExtraList
);
cartGoodsDetailDto
.
setExtraList
(
cartGoodsExtraList
);
return
cartGoodsDetailDto
;
return
cartGoodsDetailDto
;
}
}
}
}
\ No newline at end of file
shopping-cart-application-service/src/test/java/cn.freemud/service/CartTest.java
View file @
1d63d696
This diff is collapsed.
Click to expand it.
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