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
c353473b
Commit
c353473b
authored
Dec 04, 2020
by
缪晖
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/2.0.1-collageOrder-刘鹏飞' into 'develop'
运费均摊计算公式调整 See merge request
!39
parents
3fc74cc0
e4aa70af
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
20 deletions
+23
-20
order-application-service/src/main/java/cn/freemud/service/impl/CollageOrderServiceImpl.java
+2
-1
shopping-cart-application-service/src/main/java/cn/freemud/entities/dto/ActivityCalculationDiscountResponseDto.java
+5
-0
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/CartGoods.java
+6
-0
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/BuySendPromotionService.java
+1
-0
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartCollageServiceImpl.java
+9
-19
No files found.
order-application-service/src/main/java/cn/freemud/service/impl/CollageOrderServiceImpl.java
View file @
c353473b
...
...
@@ -125,7 +125,8 @@ public class CollageOrderServiceImpl implements CollageOrderService {
if
(
order
.
getOrderCostDetailList
()
!=
null
)
{
OrderCostResp
orderCostResp
=
order
.
getOrderCostDetailList
().
stream
().
filter
(
detail
->
(
detail
.
getCostType
().
equals
(
2
)
&&
detail
.
getBillType
().
equals
(
1
))).
findFirst
().
orElse
(
new
OrderCostResp
());
BigDecimal
deliveryPrice
=
orderCostResp
.
getActualCostAmount
()
==
null
?
new
BigDecimal
(
0
)
:
orderCostResp
.
getActualCostAmount
();
deliveryAmount
=
Math
.
floorDiv
(
deliveryPrice
.
longValue
(),
payerUserIdList
.
size
());
// 运费均摊时算上拼单发起人
deliveryAmount
=
Math
.
floorDiv
(
deliveryPrice
.
longValue
(),
payerUserIdList
.
size
()
+
1
);
}
groupBuyDto
.
setAmount
(
itemAmount
+
packAmount
+
deliveryAmount
);
groupBuyDto
.
setNickName
(
productList
.
stream
().
filter
(
product
->
payerUserId
.
equals
(
product
.
getUserId
())).
findFirst
().
get
().
getNickName
());
...
...
shopping-cart-application-service/src/main/java/cn/freemud/entities/dto/ActivityCalculationDiscountResponseDto.java
View file @
c353473b
...
...
@@ -374,6 +374,11 @@ public class ActivityCalculationDiscountResponseDto {
* 赠送商品数量
*/
private
Integer
sendNumber
;
/**
* 买一赠一时,存赠送主商品的cartGoodsUid用于标记是哪个商品赠送的
*/
private
String
originalGoodsUid
;
}
}
...
...
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/CartGoods.java
View file @
c353473b
...
...
@@ -28,6 +28,12 @@ public class CartGoods {
* 购物车一行的Id(后台生成)
*/
private
String
cartGoodsUid
=
UUID
.
randomUUID
().
toString
();
/**
* 买一赠一时,存赠送主商品的cartGoodsUid用于标记是哪个商品赠送的
*/
private
String
originalGoodsUid
;
/**
* 单规格spuId,多规格skuId
*/
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/BuySendPromotionService.java
View file @
c353473b
...
...
@@ -249,6 +249,7 @@ public class BuySendPromotionService implements IPromotionService {
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
SendActivity
.
SendGoods
sendGoods
=
sendGoodsMap
.
get
(
cartGood
.
getGoodsId
());
String
s
=
currentSubName
(
cartGood
);
CartGoods
newCartGoods
=
shoppingCartConvertAdapter
.
convent2CartGoods
(
cartGood
,
sendGoods
.
getNowPrice
());
newCartGoods
.
setOriginalGoodsUid
(
sendGoodsMap
.
get
(
cartGood
.
getSpuId
()).
getOriginalGoodsUid
());
newCartGoods
.
setClassificationId
(
cartGood
.
getClassificationId
());
newCartGoods
.
setClassificationName
(
cartGood
.
getClassificationName
());
newCartGoods
.
setQty
(
sendGoods
.
getSendNumber
()
>
0
?
sendGoods
.
getSendNumber
()
:
SEND_NUMBER
);
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartCollageServiceImpl.java
View file @
c353473b
...
...
@@ -242,25 +242,14 @@ public class ShoppingCartCollageServiceImpl extends AbstractShoppingCartImpl imp
Map
<
String
,
List
<
CartGoods
>>
userGoods
=
new
HashMap
<>();
if
(
cartGoods
!=
null
&&
!
cartGoods
.
isEmpty
()){
CartGoods
createUserGood
=
cartGoods
.
stream
().
filter
(
good
->
createUserId
.
equals
(
good
.
getUserId
())).
findFirst
().
orElse
(
null
);
if
(
null
==
createUserGood
)
{
// 若拼单发起人未购买商品,则将赠品按购物车行分给加购人
cartGoods
.
stream
().
filter
(
good
->
null
==
good
.
getUserId
()).
collect
(
Collectors
.
toList
()).
forEach
(
cartGoodsNullUser
->
{
CartGoods
parentGood
=
cartGoods
.
stream
().
filter
(
good
->
good
.
getCartGoodsUid
().
equals
(
cartGoodsNullUser
.
getCartGoodsUid
())).
findFirst
().
orElse
(
null
);
cartGoodsNullUser
.
setUserId
(
parentGood
==
null
?
createUserId
:
parentGood
.
getUserId
());
cartGoodsNullUser
.
setOpenId
(
parentGood
==
null
?
null
:
parentGood
.
getOpenId
());
cartGoodsNullUser
.
setUserName
(
parentGood
==
null
?
null
:
parentGood
.
getUserName
());
cartGoodsNullUser
.
setPhotoUrl
(
parentGood
==
null
?
null
:
parentGood
.
getPhotoUrl
());
});
}
else
{
cartGoods
.
stream
().
filter
(
good
->
null
==
good
.
getUserId
()).
collect
(
Collectors
.
toList
()).
forEach
(
cartGoodsNullUser
->
{
cartGoodsNullUser
.
setUserId
(
createUserGood
.
getUserId
());
cartGoodsNullUser
.
setOpenId
(
createUserGood
.
getOpenId
());
cartGoodsNullUser
.
setUserName
(
createUserGood
.
getUserName
());
cartGoodsNullUser
.
setPhotoUrl
(
createUserGood
.
getPhotoUrl
());
});
}
// 若拼单发起人未购买商品,则将赠品按购物车行分给加购人,若未找到加购行id,默认给创建人
cartGoods
.
stream
().
filter
(
good
->
null
==
good
.
getUserId
()).
collect
(
Collectors
.
toList
()).
forEach
(
cartGoodsNullUser
->
{
CartGoods
parentGood
=
cartGoods
.
stream
().
filter
(
good
->
(
StringUtils
.
isBlank
(
good
.
getOriginalGoodsUid
())
&&
good
.
getCartGoodsUid
().
equals
(
cartGoodsNullUser
.
getOriginalGoodsUid
()))).
findFirst
().
orElse
(
null
);
cartGoodsNullUser
.
setUserId
(
parentGood
==
null
?
createUserId
:
parentGood
.
getUserId
());
cartGoodsNullUser
.
setOpenId
(
parentGood
==
null
?
null
:
parentGood
.
getOpenId
());
cartGoodsNullUser
.
setUserName
(
parentGood
==
null
?
null
:
parentGood
.
getUserName
());
cartGoodsNullUser
.
setPhotoUrl
(
parentGood
==
null
?
null
:
parentGood
.
getPhotoUrl
());
});
userGoods
=
cartGoods
.
stream
().
filter
(
good
->
null
!=
good
.
getUserId
()).
collect
(
Collectors
.
groupingBy
(
CartGoods:
:
getUserId
));
}
...
...
@@ -776,6 +765,7 @@ public class ShoppingCartCollageServiceImpl extends AbstractShoppingCartImpl imp
try
{
System
.
out
.
println
(
"start discount"
);
System
.
out
.
println
(
JSON
.
toJSONString
(
activityCalculationDiscountRequestDto
));
// 调用老促销接口
activityCalculationDiscountResponseDto
=
activityClient
.
calculationDiscount
(
activityCalculationDiscountRequestDto
);
}
catch
(
Exception
ex
)
{
ErrorLog
.
errorConvertJson
(
SDKCommonBaseContextWare
.
getAppName
(),
LogThreadLocal
.
getTrackingNo
(),
getClass
(),
"shoppingCartCollageServiceImpl getActivityCalculationDiscountResponse:"
+
ex
.
getMessage
(),
ex
);
...
...
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