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
a5fe03ad
Commit
a5fe03ad
authored
Jun 22, 2021
by
徐康
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
合并行
parent
905442c9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
20 deletions
+25
-20
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/CouponDiscountCalculation.java
+25
-20
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/CouponDiscountCalculation.java
View file @
a5fe03ad
...
@@ -224,13 +224,13 @@ public class CouponDiscountCalculation {
...
@@ -224,13 +224,13 @@ public class CouponDiscountCalculation {
cartGoods
.
setQty
(
b3S1DiscountOptional
.
get
().
getActualGoodsNumber
());
cartGoods
.
setQty
(
b3S1DiscountOptional
.
get
().
getActualGoodsNumber
());
cartGoods
.
setCouponCode
(
b3S1DiscountOptional
.
get
().
getActivityCode
());
cartGoods
.
setCouponCode
(
b3S1DiscountOptional
.
get
().
getActivityCode
());
cartGoods
.
setCouponName
(
b3S1DiscountOptional
.
get
().
getActivityName
());
cartGoods
.
setCouponName
(
b3S1DiscountOptional
.
get
().
getActivityName
());
cartGoods
.
setAmount
(
goodsMap
.
get
(
cartGoods
.
getCartGoodsUid
()).
getRealAmount
());
cartGoods
.
setIsB3S1CouponGoods
(
1
);
cartGoods
.
setIsB3S1CouponGoods
(
1
);
cartGoodsNew
.
setCartGoodsUid
(
UUID
.
randomUUID
().
toString
());
cartGoodsNew
.
setCartGoodsUid
(
UUID
.
randomUUID
().
toString
());
cartGoodsNew
.
setQty
(
newNum
);
cartGoodsNew
.
setQty
(
newNum
);
cartGoodsNew
.
setCouponCode
(
null
);
cartGoodsNew
.
setCouponCode
(
null
);
cartGoodsNew
.
setCouponName
(
null
);
cartGoodsNew
.
setCouponName
(
null
);
cartGoodsNew
.
setAmount
(
cartGoods
.
getOriginalPrice
()
*
cartGoods
.
getQty
());
cartGoodsNew
.
setAmount
(
cartGoods
.
getOriginalPrice
()
*
cartGoods
.
getQty
());
cartGoods
.
setAmount
(
goodsMap
.
get
(
cartGoods
.
getCartGoodsUid
()).
getRealAmount
());
newCartGoodsList
.
add
(
cartGoodsNew
);
newCartGoodsList
.
add
(
cartGoodsNew
);
}
else
if
(
cartGoods
.
getQty
()
==
b3S1DiscountOptional
.
get
().
getActualGoodsNumber
())
{
}
else
if
(
cartGoods
.
getQty
()
==
b3S1DiscountOptional
.
get
().
getActualGoodsNumber
())
{
cartGoods
.
setCouponCode
(
b3S1DiscountOptional
.
get
().
getActivityCode
());
cartGoods
.
setCouponCode
(
b3S1DiscountOptional
.
get
().
getActivityCode
());
...
@@ -252,25 +252,6 @@ public class CouponDiscountCalculation {
...
@@ -252,25 +252,6 @@ public class CouponDiscountCalculation {
}
}
if
(
haveB3S1Fav
)
{
if
(
haveB3S1Fav
)
{
// List<CartGoods> nowCartGoodsList = new ArrayList<>();
// AtomicBoolean changed = new AtomicBoolean();
// changed.set(false);
// if(CollectionUtils.isNotEmpty(cartGoodsList)){
// ApiLog.debug("合并买3赠1商品券 【merge-before】 : {} ", JSONObject.toJSONString(cartGoodsList));
// cartGoodsList.forEach(newCartGood -> {
// int index;
// if ((index = nowCartGoodsList.indexOf(newCartGood)) >= 0) {
// changed.set(true);
// nowCartGoodsList.get(index).setQty(nowCartGoodsList.get(index).getQty() + newCartGood.getQty());
// } else {
// nowCartGoodsList.add(newCartGood);
// }
// });
// }
// if(changed.get()) {
// cartGoodsList.clear();
// cartGoodsList.addAll(nowCartGoodsList);
// }
int
index
=
0
;
int
index
=
0
;
for
(
int
i
=
0
;
i
<
cartGoodsList
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
cartGoodsList
.
size
();
i
++)
{
...
@@ -288,6 +269,30 @@ public class CouponDiscountCalculation {
...
@@ -288,6 +269,30 @@ public class CouponDiscountCalculation {
index
++;
index
++;
}
}
}
}
List
<
CartGoods
>
nowCartGoodsList
=
new
ArrayList
<>();
nowCartGoodsList
.
addAll
(
cartGoodsList
);
AtomicBoolean
changed
=
new
AtomicBoolean
();
changed
.
set
(
false
);
if
(
CollectionUtils
.
isNotEmpty
(
cartGoodsList
)){
ApiLog
.
debug
(
"合并买3赠1商品券 【merge-before】 : {} "
,
JSONObject
.
toJSONString
(
nowCartGoodsList
));
for
(
int
i
=
cartGoodsList
.
size
()
-
1
;
i
>=
1
;
i
--)
{
CartGoods
cartGoods
=
cartGoodsList
.
get
(
i
);
int
index2
=
nowCartGoodsList
.
indexOf
(
cartGoods
);
if
(
index2
<
i
)
{
changed
.
set
(
true
);
nowCartGoodsList
.
get
(
index2
).
setQty
(
nowCartGoodsList
.
get
(
index2
).
getQty
()
+
cartGoods
.
getQty
());
nowCartGoodsList
.
remove
(
i
);
}
ApiLog
.
debug
(
"合并买3赠1商品券 【merge-ing】 : {} "
,
JSONObject
.
toJSONString
(
nowCartGoodsList
));
}
ApiLog
.
debug
(
"合并买3赠1商品券 【merge-after】 : {} "
,
JSONObject
.
toJSONString
(
nowCartGoodsList
));
}
if
(
changed
.
get
())
{
cartGoodsList
.
clear
();
cartGoodsList
.
addAll
(
nowCartGoodsList
);
}
}
}
// 当couponCode不为空时,需计算优惠价格
// 当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