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