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
105202ec
Commit
105202ec
authored
Sep 29, 2020
by
xiaoer.li
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'remotes/origin/feature/促销算价基于最新master的分支' into qa
parents
61a5e920
ba8f87ef
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
19 deletions
+29
-19
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/CalculationCommonService.java
+27
-17
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/promotion/CouponSharingService.java
+2
-2
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/CalculationCommonService.java
View file @
105202ec
...
@@ -57,7 +57,7 @@ public class CalculationCommonService {
...
@@ -57,7 +57,7 @@ public class CalculationCommonService {
/**
/**
* 使用促销算价赋值行记录
* 使用促销算价赋值行记录
*/
*/
log
.
info
(
"initShoppingCart
:{}"
,
JSON
.
toJSON
(
cartGoodsLis
t
));
log
.
info
(
"initShoppingCart
={},discountResult={}"
,
JSON
.
toJSON
(
cartGoodsList
),
JSON
.
toJSON
(
discountResul
t
));
List
<
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
>
goods
=
null
;
List
<
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
>
goods
=
null
;
if
(
discountResult
!=
null
&&
CollectionUtils
.
isNotEmpty
(
discountResult
.
getGoods
()))
{
if
(
discountResult
!=
null
&&
CollectionUtils
.
isNotEmpty
(
discountResult
.
getGoods
()))
{
goods
=
discountResult
.
getGoods
();
goods
=
discountResult
.
getGoods
();
...
@@ -65,17 +65,18 @@ public class CalculationCommonService {
...
@@ -65,17 +65,18 @@ public class CalculationCommonService {
long
totalOriginalAmount
=
0L
,
totalAmount
=
0L
,
totalPackageAmount
=
0L
;
long
totalOriginalAmount
=
0L
,
totalAmount
=
0L
,
totalPackageAmount
=
0L
;
long
originalAmount
=
0L
,
amount
=
0L
,
packageAmount
=
0L
;
long
originalAmount
=
0L
,
amount
=
0L
,
packageAmount
=
0L
;
for
(
CartGoods
cartGoods
:
cartGoodsList
)
{
for
(
CartGoods
cartGoods
:
cartGoodsList
)
{
originalAmount
=
0L
;
originalAmount
=
0L
;
amount
=
0L
;
packageAmount
=
0L
;
amount
=
0L
;
packageAmount
=
0L
;
//原价行记录
originalAmount
=
cartGoods
.
getOriginalPrice
()
*
cartGoods
.
getQty
();
cartGoods
.
setOriginalAmount
(
originalAmount
);
this
.
rowRealAmount
(
goods
,
cartGoods
);
this
.
rowRealAmount
(
goods
,
cartGoods
);
//成交价行记录
//成交价行记录
amount
=
cartGoods
.
getAmount
();
amount
=
cartGoods
.
getAmount
();
totalAmount
+=
amount
;
totalAmount
+=
amount
;
//原价行记录
totalOriginalAmount
+=
cartGoods
.
getOriginalAmount
();
originalAmount
=
cartGoods
.
getOriginalPrice
()
*
cartGoods
.
getQty
();
cartGoods
.
setOriginalAmount
(
originalAmount
);
totalOriginalAmount
+=
originalAmount
;
//包装费行记录
//包装费行记录
packageAmount
=
cartGoods
.
getPackPrice
()
*
cartGoods
.
getQty
();
packageAmount
=
cartGoods
.
getPackPrice
()
*
cartGoods
.
getQty
();
cartGoods
.
setPackPrice
(
packageAmount
);
cartGoods
.
setPackPrice
(
packageAmount
);
...
@@ -96,34 +97,39 @@ public class CalculationCommonService {
...
@@ -96,34 +97,39 @@ public class CalculationCommonService {
if
(
find
==
null
)
return
;
if
(
find
==
null
)
return
;
cartGoods
.
setAmount
(
find
.
getRealAmount
());
cartGoods
.
setAmount
(
find
.
getRealAmount
());
cartGoods
.
setOriginalAmount
(
find
.
getOriginalPrice
());
//cartGoods.setOriginalAmount(find.getOriginalPrice());
/**
* 套餐的原价
*/
Long
originPrice
=
0L
;
if
(
CollectionUtils
.
isNotEmpty
(
cartGoods
.
getProductComboList
()))
{
for
(
CartGoods
.
ComboxGoods
com
:
cartGoods
.
getProductComboList
())
{
originPrice
+=
com
.
getFinalPrice
()*
cartGoods
.
getQty
();
}
}
/**
/**
* 可选搭配
* 可选搭配
*/
*/
if
(
CollectionUtils
.
isNotEmpty
(
cartGoods
.
getProductGroupList
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
cartGoods
.
getProductGroupList
()))
{
Integer
type2
=
2
;
Integer
type2
=
2
;
Map
<
String
,
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
SmallMaterial
>
gChoices
=
find
.
getSmallMaterial
()
Map
<
String
,
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
SmallMaterial
>
gChoices
=
find
.
getSmallMaterial
()
.
stream
().
filter
(
d
->
type2
.
equals
(
d
.
getType
()))
.
stream
().
filter
(
d
->
type2
.
equals
(
d
.
getType
()))
.
collect
(
Collectors
.
toMap
(
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
SmallMaterial
::
getGoodsId
,
Function
.
identity
(),
(
k1
,
k2
)
->
k1
));
.
collect
(
Collectors
.
toMap
(
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
SmallMaterial
::
getGoodsId
,
Function
.
identity
(),
(
k1
,
k2
)
->
k1
));
long
amount
=
0L
;
long
amount
=
0L
;
long
original
=
0L
;
//可选搭配
//可选搭配
for
(
CartGoods
.
ComboxGoods
choice
:
cartGoods
.
getProductGroupList
())
{
for
(
CartGoods
.
ComboxGoods
choice
:
cartGoods
.
getProductGroupList
())
{
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
SmallMaterial
mt
=
gChoices
.
get
(
choice
.
getGoodsId
());
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Goods
.
SmallMaterial
mt
=
gChoices
.
get
(
choice
.
getGoodsId
());
if
(
mt
==
null
)
{
if
(
mt
==
null
)
{
amount
+=
choice
.
getAmount
()
*
c
artGoods
.
getQty
();
amount
+=
choice
.
getAmount
()
*
c
hoice
.
getQty
();
original
+=
choice
.
getOriginalPrice
()
*
cartGoods
.
getQty
();
}
}
else
{
else
{
amount
+=
mt
.
getRealAmount
();
amount
+=
mt
.
getRealAmount
();
original
+=
choice
.
getFinalPrice
()
*
choice
.
getQty
();
choice
.
setAmount
(
mt
.
getRealAmount
().
longValue
());
choice
.
setAmount
(
mt
.
getRealAmount
().
longValue
());
choice
.
setOriginalAmount
(
original
);
}
}
originPrice
+=
choice
.
getFinalPrice
()
*
choice
.
getQty
();
}
}
cartGoods
.
setAmount
(
cartGoods
.
getAmount
()
+
amount
);
cartGoods
.
setAmount
(
cartGoods
.
getAmount
()
+
amount
);
cartGoods
.
setOriginalAmount
(
cartGoods
.
getOriginalMaterialAmount
()
+
original
);
}
}
/**
/**
* 小料
* 小料
...
@@ -141,6 +147,10 @@ public class CalculationCommonService {
...
@@ -141,6 +147,10 @@ public class CalculationCommonService {
}
}
}
}
}
}
if
(
GoodsTypeEnum
.
SET_MEAL_GOODS
.
getGoodsType
().
equals
(
cartGoods
.
getGoodsType
()))
{
cartGoods
.
setOriginalAmount
(
originPrice
);
}
}
}
/**
/**
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/promotion/CouponSharingService.java
View file @
105202ec
...
@@ -74,8 +74,8 @@ public class CouponSharingService {
...
@@ -74,8 +74,8 @@ public class CouponSharingService {
//List<CalculationSharingDiscountResponseDto.CalculationDiscountResult.CouponResults> couponResultsList = calculationDiscountResult.getCouponDiscounts();
//List<CalculationSharingDiscountResponseDto.CalculationDiscountResult.CouponResults> couponResultsList = calculationDiscountResult.getCouponDiscounts();
List
<
Integer
>
asList
=
Arrays
.
asList
(
3
,
31
);
List
<
Integer
>
asList
=
Arrays
.
asList
(
3
,
31
);
List
<
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Discount
>
couponResultsList
=
calculationDiscountResult
.
getDiscounts
();
List
<
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Discount
>
couponResultsList
=
calculationDiscountResult
.
getDiscounts
();
Optional
<
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Discount
>
first
=
couponResultsList
.
stream
().
filter
(
d
->
asList
.
contains
(
d
.
getType
())).
findFirst
(
);
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
.
Discount
first
=
couponResultsList
.
stream
().
filter
(
d
->
asList
.
contains
(
d
.
getType
())).
findFirst
().
orElse
(
null
);
couponDiscount
=
first
.
get
()
.
getDiscount
().
longValue
();
if
(
first
!=
null
)
couponDiscount
=
first
.
getDiscount
().
longValue
();
}
}
shoppingCartGoodsResponseVo
.
setCouponDiscount
(
couponDiscount
);
shoppingCartGoodsResponseVo
.
setCouponDiscount
(
couponDiscount
);
//循环购物车商品券
//循环购物车商品券
...
...
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