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
6069a4fe
Commit
6069a4fe
authored
Aug 08, 2020
by
xiaoer.li@freemud.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
支持按加料显示不同的行记录
parent
119bfc12
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
34 deletions
+39
-34
shopping-cart-application-service/pom.xml
+1
-1
shopping-cart-application-service/src/main/java/cn/freemud/entities/dto/ActivityCalculationDiscountRequestDto.java
+1
-0
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/CartGoods.java
+6
-1
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/BuySendPromotionService.java
+26
-24
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/MaterialPromotionService.java
+5
-8
No files found.
shopping-cart-application-service/pom.xml
View file @
6069a4fe
...
...
@@ -45,7 +45,7 @@
<dependency>
<groupId>
cn.freemud
</groupId>
<artifactId>
assortment-shoppingcart-sdk
</artifactId>
<version>
1.1.3.73
3
.RELEASE
</version>
<version>
1.1.3.73
4
.RELEASE
</version>
</dependency>
<dependency>
<groupId>
com.freemud.application.service.sdk
</groupId>
...
...
shopping-cart-application-service/src/main/java/cn/freemud/entities/dto/ActivityCalculationDiscountRequestDto.java
View file @
6069a4fe
...
...
@@ -122,6 +122,7 @@ public class ActivityCalculationDiscountRequestDto {
CalculationDiscountGoods
that
=
(
CalculationDiscountGoods
)
o
;
return
Objects
.
equals
(
goodsId
,
that
.
goodsId
)
&&
Objects
.
equals
(
category
,
that
.
category
)
&&
Objects
.
equals
(
cartGoodsUid
,
that
.
cartGoodsUid
)
&&
Objects
.
equals
(
originalPrice
,
that
.
originalPrice
);
}
...
...
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/CartGoods.java
View file @
6069a4fe
...
...
@@ -314,7 +314,9 @@ public class CartGoods {
originalString
.
append
(
goods
.
toString
());
}
}
if
(
CollectionUtils
.
isNotEmpty
(
productMaterialList
))
{
productMaterialList
.
stream
().
sorted
(
Comparator
.
comparing
(
MaterialGoods:
:
getSpuId
)).
forEach
(
e
->
originalString
.
append
(
e
.
getSpuId
()));
}
//当前字符串
CartGoods
cartGoods
=
(
CartGoods
)
o
;
...
...
@@ -333,6 +335,9 @@ public class CartGoods {
currentString
.
append
(
goods
.
toString
());
}
}
if
(
CollectionUtils
.
isNotEmpty
(
cartGoods
.
getProductMaterialList
()))
{
cartGoods
.
getProductMaterialList
().
stream
().
sorted
(
Comparator
.
comparing
(
MaterialGoods:
:
getSpuId
)).
forEach
(
e
->
currentString
.
append
(
e
.
getSpuId
()));
}
return
StringUtils
.
equals
(
originalString
.
toString
(),
currentString
.
toString
());
}
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/BuySendPromotionService.java
View file @
6069a4fe
...
...
@@ -59,10 +59,6 @@ public class BuySendPromotionService implements IPromotionService {
if
(
CollectionUtils
.
isEmpty
(
sendActivityList
))
{
return
;
}
//ActivityCalculationDiscountResponseDto.CalculationDiscountResult.SendActivity sendActivity = getSendActivity(sendActivityList, ActivityTypeEnum.TYPE_61);
//if (sendActivity == null) {
// return;
//}
//Todo 获取多个赠品list
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
SendActivity
>
sendActivityLists
=
getSendActivityList
(
ActivityTypeEnum
.
TYPE_61
,
sendActivityList
);
...
...
@@ -70,14 +66,6 @@ public class BuySendPromotionService implements IPromotionService {
if
(
sendActivityLists
.
size
()
==
0
)
{
return
;
}
//List<ActivityCalculationDiscountResponseDto.CalculationDiscountResult.SendActivity.SendGoods> sendGoodsList = sendActivity.getSendGoods();
//if (CollectionUtils.isEmpty(sendGoodsList)) {
// return;
//}
//Integer maxNum = sendActivity.getMaxNum();
//List<String> activitySpuIds = sendGoodsList.stream().map(each -> each.getCategory()).collect(Collectors.toList());
//Map<String, ActivityCalculationDiscountResponseDto.CalculationDiscountResult.SendActivity.SendGoods> sendGoodsMap = getSendGoodsMap(sendGoodsList);
//Todo
List
<
String
>
activitySpuIds
=
new
ArrayList
<>();
Map
<
String
,
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
SendActivity
.
SendGoods
>
sendGoodsMap
=
new
HashMap
<>();
...
...
@@ -130,11 +118,6 @@ public class BuySendPromotionService implements IPromotionService {
}
*/
for
(
CartGoods
cartGoods
:
newCartGoodsList
)
{
//Integer max = maxNums.get(cartGoods.getGoodsId());
////if (max <= 0) continue;
//if (max < cartGoods.getQty()) {
// cartGoods.setQty(max);
//}
givePackAmount
=
givePackAmount
+
cartGoods
.
getPackPrice
()
*
cartGoods
.
getQty
();
giveTotalAmount
=
giveTotalAmount
+
cartGoods
.
getOriginalPrice
()
*
cartGoods
.
getQty
();
cartGoods
.
setOriginalAmount
(
cartGoods
.
getOriginalPrice
()
*
cartGoods
.
getQty
());
...
...
@@ -265,13 +248,15 @@ public class BuySendPromotionService implements IPromotionService {
}
}
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
SendActivity
.
SendGoods
sendGoods
=
sendGoodsMap
.
get
(
cartGood
.
getGoodsId
());
CartGoods
cartGoods
=
shoppingCartConvertAdapter
.
convent2CartGoods
(
cartGood
,
sendGoods
.
getNowPrice
());
cartGoods
.
setClassificationId
(
cartGood
.
getClassificationId
());
cartGoods
.
setClassificationName
(
cartGood
.
getClassificationName
());
cartGoods
.
setQty
(
sendGoods
.
getSendNumber
()
>
0
?
sendGoods
.
getSendNumber
()
:
SEND_NUMBER
);
String
s
=
currentSubName
(
cartGood
);
CartGoods
newCartGoods
=
shoppingCartConvertAdapter
.
convent2CartGoods
(
cartGood
,
sendGoods
.
getNowPrice
());
newCartGoods
.
setClassificationId
(
cartGood
.
getClassificationId
());
newCartGoods
.
setClassificationName
(
cartGood
.
getClassificationName
());
newCartGoods
.
setQty
(
sendGoods
.
getSendNumber
()
>
0
?
sendGoods
.
getSendNumber
()
:
SEND_NUMBER
);
//赠品不允许有加料
cartGood
.
setProductMaterialList
(
new
ArrayList
());
newCartGoodsList
.
add
(
cartGoods
);
newCartGoods
.
setProductMaterialList
(
new
ArrayList
());
newCartGoods
.
setSubName
(
s
);
newCartGoodsList
.
add
(
newCartGoods
);
}
...
...
@@ -289,7 +274,7 @@ public class BuySendPromotionService implements IPromotionService {
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_GIFTS_PRODUCT_NOT_EXIST
);
}
for
(
CartGoods
cartGoods
:
newCartGoodsList
)
{
for
(
CartGoods
cartGoods
:
newCartGoodsList
)
{
Optional
<
ProductBeanDTO
>
productBeanDTO
=
productBeanList
.
stream
().
filter
(
productBean
->
ObjectUtils
.
equals
(
productBean
.
getPid
(),
cartGoods
.
getGoodsId
())).
findFirst
();
if
(!
productBeanDTO
.
isPresent
())
{
continue
;
...
...
@@ -298,4 +283,21 @@ public class BuySendPromotionService implements IPromotionService {
cartGoods
.
setWeight
(
productBeanDTO
.
get
().
getWeight
());
}
}
/**
* 提取当前属性名
*
* @param cartGoods
* @return
*/
private
String
currentSubName
(
CartGoods
cartGoods
)
{
String
subName
=
cartGoods
.
getSubName
();
if
(
CollectionUtils
.
isEmpty
(
cartGoods
.
getProductMaterialList
()))
{
return
subName
;
}
StringBuilder
currentString
=
new
StringBuilder
();
cartGoods
.
getProductMaterialList
().
stream
().
forEach
(
e
->
currentString
.
append
(
"/"
+
e
.
getSpuName
()));
String
replace
=
StringUtils
.
replace
(
subName
,
currentString
.
toString
(),
""
);
return
replace
;
}
}
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/MaterialPromotionService.java
View file @
6069a4fe
...
...
@@ -44,11 +44,9 @@ public class MaterialPromotionService implements IPromotionService {
@Override
public
void
updateShoppingCartGoodsDiscount
(
CouponPromotionVO
couponPromotionVO
,
ActivityQueryDto
activityQueryDto
,
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscountResult
,
List
<
CartGoods
>
cartGoodsList
,
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
,
UserLoginInfoDto
userLoginInfoDto
,
ShoppingCartInfoRequestVo
shoppingCartInfoRequestVo
)
{
HashMap
<
String
,
MaterialApportion
>
map
=
getApportionGoodsDetail
(
calculationDiscountResult
);
if
(
map
!=
null
&&
!
map
.
isEmpty
()
)
{
if
(
map
.
size
()
>
0
)
{
for
(
CartGoods
cartGoods
:
cartGoodsList
)
{
//非正常商品
if
(
CollectionUtils
.
isEmpty
(
cartGoods
.
getProductMaterialList
()))
continue
;
if
(
CollectionUtils
.
isEmpty
(
cartGoods
.
getProductMaterialList
()))
continue
;
for
(
CartGoods
.
MaterialGoods
materialGoods
:
cartGoods
.
getProductMaterialList
())
{
MaterialApportion
apportion
=
map
.
get
(
materialGoods
.
getSpuId
());
//设置小料行单价和行总价
...
...
@@ -86,7 +84,7 @@ public class MaterialPromotionService implements IPromotionService {
public
void
updateShoppingCartGoodsApportion
(
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
,
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscountResult
,
ShoppingCartGoodsDto
shoppingCartGoodsDto
,
CreateOrderVo
.
PremiumExchangeActivity
premiumExchangeActivity
,
ShoppingCartInfoRequestVo
shoppingCartInfoRequestVo
)
{
HashMap
<
String
,
MaterialApportion
>
map
=
getApportionGoodsDetail
(
calculationDiscountResult
);
List
<
ShoppingCartGoodsDto
.
CartGoodsDetailDto
>
products
=
shoppingCartGoodsDto
.
getProducts
();
if
(
map
!=
null
&&
map
.
size
()
>
0
)
{
if
(
map
.
size
()
>
0
)
{
for
(
ShoppingCartGoodsDto
.
CartGoodsDetailDto
product
:
products
)
{
if
(
CollectionUtils
.
isEmpty
(
product
.
getMaterialList
()))
continue
;
for
(
ShoppingCartGoodsDto
.
CartGoodsDetailDto
.
MaterialGoods
materialGoods
:
product
.
getMaterialList
())
{
...
...
@@ -126,12 +124,11 @@ public class MaterialPromotionService implements IPromotionService {
* @return
*/
private
HashMap
<
String
,
MaterialApportion
>
getApportionGoodsDetail
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscountResult
)
{
HashMap
<
String
,
MaterialApportion
>
mApportion
=
new
HashMap
<>();
// 遍历促销
if
(
calculationDiscountResult
==
null
||
CollectionUtils
.
isEmpty
(
calculationDiscountResult
.
getApportionGoods
()))
{
return
null
;
return
mApportion
;
}
HashMap
<
String
,
MaterialApportion
>
mApportion
=
new
HashMap
<>();
for
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
ApportionGoods
apportionGood
:
calculationDiscountResult
.
getApportionGoods
())
{
if
(
CollectionUtils
.
isEmpty
(
apportionGood
.
getSmallMaterial
()))
continue
;
for
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
ApportionGoods
.
Material
material
:
apportionGood
.
getSmallMaterial
())
{
...
...
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