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
e0965920
Commit
e0965920
authored
Aug 10, 2020
by
xiaoer.li@freemud.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'remotes/origin/feature/1.9.32_商品加料' into develop
parents
7963887f
f13fc5fb
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
49 additions
and
37 deletions
+49
-37
assortment-shoppingcart-sdk/src/main/java/com/freemud/sdk/api/assortment/shoppingcart/adapter/ShoppingCartAdapter.java
+2
-2
shopping-cart-application-service/src/main/java/cn/freemud/adapter/ShoppingCartConvertAdapter.java
+15
-7
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/CartGoods.java
+1
-1
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/DefaultPromotionService.java
+1
-1
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/MaterialPromotionService.java
+30
-26
No files found.
assortment-shoppingcart-sdk/src/main/java/com/freemud/sdk/api/assortment/shoppingcart/adapter/ShoppingCartAdapter.java
View file @
e0965920
...
@@ -378,8 +378,8 @@ public class ShoppingCartAdapter {
...
@@ -378,8 +378,8 @@ public class ShoppingCartAdapter {
cartGoods
.
setMaterialAmount
(
materialAmount
);
cartGoods
.
setMaterialAmount
(
materialAmount
);
//加料行记录原价总价
//加料行记录原价总价
cartGoods
.
setOriginalMaterialAmount
(
originalMaterAmount
);
cartGoods
.
setOriginalMaterialAmount
(
originalMaterAmount
);
cartGoods
.
setOriginalAmount
(
cartGoods
.
getOriginalAmount
()
+
originalMaterAmount
);
//
cartGoods.setOriginalAmount(cartGoods.getOriginalAmount() + originalMaterAmount);
cartGoods
.
setSubName
(
StringUtils
.
strip
(
materialSubName
,
"/"
));
//
cartGoods.setSubName(StringUtils.strip(materialSubName, "/"));
}
}
private
boolean
updateComboxGoodsInfo
(
CartGoods
cartGoods
,
CartGoods
.
ComboxGoods
comboxGoods
,
ProductBeanDTO
parentProductBean
,
List
<
ProductBeanDTO
>
productBeans
,
CartGoodsStates
cartGoodsStates
,
List
<
String
>
invalidGoodsIdList
)
{
private
boolean
updateComboxGoodsInfo
(
CartGoods
cartGoods
,
CartGoods
.
ComboxGoods
comboxGoods
,
ProductBeanDTO
parentProductBean
,
List
<
ProductBeanDTO
>
productBeans
,
CartGoodsStates
cartGoodsStates
,
List
<
String
>
invalidGoodsIdList
)
{
...
...
shopping-cart-application-service/src/main/java/cn/freemud/adapter/ShoppingCartConvertAdapter.java
View file @
e0965920
...
@@ -135,7 +135,8 @@ public class ShoppingCartConvertAdapter {
...
@@ -135,7 +135,8 @@ public class ShoppingCartConvertAdapter {
||
ObjectUtils
.
equals
(
ActivityTypeEnum
.
TYPE_62
.
getCode
(),
cartGoods
.
getActivityType
()))
{
||
ObjectUtils
.
equals
(
ActivityTypeEnum
.
TYPE_62
.
getCode
(),
cartGoods
.
getActivityType
()))
{
cartGoodsDetailDto
.
setTotalDiscountAmount
(
cartGoods
.
getOriginalAmount
().
intValue
()
-
cartGoods
.
getAmount
().
intValue
());
cartGoodsDetailDto
.
setTotalDiscountAmount
(
cartGoods
.
getOriginalAmount
().
intValue
()
-
cartGoods
.
getAmount
().
intValue
());
}
else
{
}
else
{
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
ApportionGoods
>
collect
=
apportionGoodsList
.
stream
().
filter
(
a
->
ObjectUtils
.
equals
(
cartGoods
.
getSkuId
(),
a
.
getGoodsId
())
||
ObjectUtils
.
equals
(
cartGoods
.
getSpuId
(),
a
.
getGoodsId
())).
collect
(
Collectors
.
toList
());
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
ApportionGoods
>
collect
=
apportionGoodsList
.
stream
().
filter
(
a
->
ObjectUtils
.
equals
(
cartGoods
.
getCartGoodsUid
(),
a
.
getCartGoodsUid
())).
collect
(
Collectors
.
toList
());
//List<ActivityCalculationDiscountResponseDto.CalculationDiscountResult.ApportionGoods> collect = apportionGoodsList.stream().filter(a -> ObjectUtils.equals(cartGoods.getSkuId(), a.getGoodsId()) || ObjectUtils.equals(cartGoods.getSpuId(), a.getGoodsId())).collect(Collectors.toList());
if
(
CollectionUtils
.
isNotEmpty
(
collect
))
{
if
(
CollectionUtils
.
isNotEmpty
(
collect
))
{
setTotalDiscountAndSalePrice
(
collect
,
cartGoodsDetailDto
,
duplicateGoodsMap
);
setTotalDiscountAndSalePrice
(
collect
,
cartGoodsDetailDto
,
duplicateGoodsMap
);
// 设置商品行,优惠活动均摊
// 设置商品行,优惠活动均摊
...
@@ -173,6 +174,7 @@ public class ShoppingCartConvertAdapter {
...
@@ -173,6 +174,7 @@ public class ShoppingCartConvertAdapter {
}
}
/**
/**
* 活动级别的促销均摊
* 获取当前商品的售后价格
* 获取当前商品的售后价格
*
*
* @param apportionGoodsList 促销均摊列表
* @param apportionGoodsList 促销均摊列表
...
@@ -188,19 +190,19 @@ public class ShoppingCartConvertAdapter {
...
@@ -188,19 +190,19 @@ public class ShoppingCartConvertAdapter {
for
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
ApportionGoods
apportionGoods
:
apportionGoodsList
)
{
for
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
ApportionGoods
apportionGoods
:
apportionGoodsList
)
{
//折扣=所有折扣和*百分比(当前行商品数量/购物车总商品数量)
//折扣=所有折扣和*百分比(当前行商品数量/购物车总商品数量)
discountPrice
+=
apportionGoods
.
getApportionDetails
().
stream
().
filter
(
d
->
ObjectUtils
.
notEqual
(
ActivityTypeEnum
.
TYPE_32
.
getCode
(),
d
.
getActivityType
())
discountPrice
+=
apportionGoods
.
getApportionDetails
().
stream
().
filter
(
d
->
ObjectUtils
.
notEqual
(
ActivityTypeEnum
.
TYPE_32
.
getCode
(),
d
.
getActivityType
())
&&
ObjectUtils
.
notEqual
(
ActivityTypeEnum
.
TYPE_104
.
getCode
(),
d
.
getActivityType
())
&&
ObjectUtils
.
notEqual
(
ActivityTypeEnum
.
TYPE_104
.
getCode
(),
d
.
getActivityType
())
//X件Y折
&&
ObjectUtils
.
notEqual
(
ActivityTypeEnum
.
TYPE_2
.
getCode
(),
d
.
getActivityType
())
&&
ObjectUtils
.
notEqual
(
ActivityTypeEnum
.
TYPE_2
.
getCode
(),
d
.
getActivityType
())
//单品特价
&&
ObjectUtils
.
notEqual
(
ActivityTypeEnum
.
TYPE_21
.
getCode
(),
d
.
getActivityType
())
&&
ObjectUtils
.
notEqual
(
ActivityTypeEnum
.
TYPE_21
.
getCode
(),
d
.
getActivityType
())
//单品折扣
).
mapToLong
(
t
->
t
.
getActivityApportionAmount
()
*
apportionGoods
.
getGoodsQuantity
()).
sum
()
*
cartGoodsDetailDto
.
getQty
()
/
goodsTotalQty
;
).
mapToLong
(
t
->
t
.
getActivityApportionAmount
()
*
apportionGoods
.
getGoodsQuantity
()).
sum
()
*
cartGoodsDetailDto
.
getQty
()
/
goodsTotalQty
;
}
}
String
currentGoodsIdMap
=
duplicateGoodsMap
.
get
(
cartGoodsDetailDto
.
get
SkuI
d
());
String
currentGoodsIdMap
=
duplicateGoodsMap
.
get
(
cartGoodsDetailDto
.
get
CartGoodsUi
d
());
if
(
currentGoodsIdMap
!=
null
)
{
if
(
currentGoodsIdMap
!=
null
)
{
String
[]
value
=
currentGoodsIdMap
.
split
(
","
);
String
[]
value
=
currentGoodsIdMap
.
split
(
","
);
//不是最后一行商品,折扣为discountPrice
//不是最后一行商品,折扣为discountPrice
if
(
Integer
.
parseInt
(
value
[
0
])
>
1
)
{
if
(
Integer
.
parseInt
(
value
[
0
])
>
1
)
{
int
totalDiscountPrice
=
Integer
.
parseInt
(
value
[
1
])
+
discountPrice
.
intValue
();
int
totalDiscountPrice
=
Integer
.
parseInt
(
value
[
1
])
+
discountPrice
.
intValue
();
int
index
=
Integer
.
parseInt
(
value
[
0
])
-
1
;
int
index
=
Integer
.
parseInt
(
value
[
0
])
-
1
;
duplicateGoodsMap
.
put
(
cartGoodsDetailDto
.
get
SkuI
d
(),
String
.
format
(
"%s,%s"
,
index
,
totalDiscountPrice
));
duplicateGoodsMap
.
put
(
cartGoodsDetailDto
.
get
CartGoodsUi
d
(),
String
.
format
(
"%s,%s"
,
index
,
totalDiscountPrice
));
}
else
{
}
else
{
//最后一行
//最后一行
Long
totalDiscountAmount
=
0L
;
Long
totalDiscountAmount
=
0L
;
...
@@ -445,4 +447,9 @@ public class ShoppingCartConvertAdapter {
...
@@ -445,4 +447,9 @@ public class ShoppingCartConvertAdapter {
String
skuId
=
StringUtils
.
isNotBlank
(
addShoppingCartGoodsRequestVo
.
getSkuId
())
?
addShoppingCartGoodsRequestVo
.
getSkuId
()
:
""
;
String
skuId
=
StringUtils
.
isNotBlank
(
addShoppingCartGoodsRequestVo
.
getSkuId
())
?
addShoppingCartGoodsRequestVo
.
getSkuId
()
:
""
;
addShoppingCartGoodsRequestVo
.
setSkuId
(
skuId
);
addShoppingCartGoodsRequestVo
.
setSkuId
(
skuId
);
}
}
}
public
String
jointPk
(
String
a
,
String
b
)
{
StringBuffer
stringBuffer
=
new
StringBuffer
();
return
stringBuffer
.
append
(
a
).
append
(
b
).
toString
();
}
}
\ No newline at end of file
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/CartGoods.java
View file @
e0965920
...
@@ -173,7 +173,7 @@ public class CartGoods {
...
@@ -173,7 +173,7 @@ public class CartGoods {
private
List
<
ComboxGoods
>
productGroupList
;
private
List
<
ComboxGoods
>
productGroupList
;
/**
/**
* 商品
加料
* 商品
原始加料数据
*/
*/
private
List
<
MaterialGoods
>
productMaterialList
;
private
List
<
MaterialGoods
>
productMaterialList
;
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/DefaultPromotionService.java
View file @
e0965920
...
@@ -86,7 +86,7 @@ public class DefaultPromotionService implements IPromotionService {
...
@@ -86,7 +86,7 @@ public class DefaultPromotionService implements IPromotionService {
calculationDiscountResult
==
null
?
new
ArrayList
<>()
:
calculationDiscountResult
.
getApportionGoods
();
calculationDiscountResult
==
null
?
new
ArrayList
<>()
:
calculationDiscountResult
.
getApportionGoods
();
Map
<
String
,
String
>
duplicateGoodsMap
=
new
HashMap
<>();
Map
<
String
,
String
>
duplicateGoodsMap
=
new
HashMap
<>();
cartGoodsList
.
stream
().
collect
(
Collectors
.
groupingBy
(
CartGoods:
:
get
GoodsI
d
,
Collectors
.
counting
())).
forEach
((
goodsId
,
count
)
->
{
cartGoodsList
.
stream
().
collect
(
Collectors
.
groupingBy
(
CartGoods:
:
get
CartGoodsUi
d
,
Collectors
.
counting
())).
forEach
((
goodsId
,
count
)
->
{
duplicateGoodsMap
.
put
(
goodsId
,
String
.
format
(
"%s,0"
,
count
));
duplicateGoodsMap
.
put
(
goodsId
,
String
.
format
(
"%s,0"
,
count
));
});
});
for
(
int
i
=
0
,
len
=
cartGoodsList
.
size
();
i
<
len
;
i
++)
{
for
(
int
i
=
0
,
len
=
cartGoodsList
.
size
();
i
<
len
;
i
++)
{
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/MaterialPromotionService.java
View file @
e0965920
package
cn
.
freemud
.
service
.
impl
;
package
cn
.
freemud
.
service
.
impl
;
import
cn.freemud.adapter.ShoppingCartConvertAdapter
;
import
cn.freemud.entities.dto.ActivityCalculationDiscountResponseDto
;
import
cn.freemud.entities.dto.ActivityCalculationDiscountResponseDto
;
import
cn.freemud.entities.dto.UserLoginInfoDto
;
import
cn.freemud.entities.dto.UserLoginInfoDto
;
import
cn.freemud.entities.dto.activity.ActivityDiscountsDto
;
import
cn.freemud.entities.dto.activity.ActivityDiscountsDto
;
...
@@ -10,6 +11,7 @@ import cn.freemud.enums.GoodsTypeEnum;
...
@@ -10,6 +11,7 @@ import cn.freemud.enums.GoodsTypeEnum;
import
cn.freemud.service.IPromotionService
;
import
cn.freemud.service.IPromotionService
;
import
lombok.Data
;
import
lombok.Data
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -28,7 +30,8 @@ import java.util.List;
...
@@ -28,7 +30,8 @@ import java.util.List;
*/
*/
@Service
(
"MaterialPromotionService"
)
@Service
(
"MaterialPromotionService"
)
public
class
MaterialPromotionService
implements
IPromotionService
{
public
class
MaterialPromotionService
implements
IPromotionService
{
@Autowired
private
ShoppingCartConvertAdapter
shoppingCartConvertAdapter
;
/**
/**
* 总优惠和总原价促进已经计算过了,这里只需要累积行记录
* 总优惠和总原价促进已经计算过了,这里只需要累积行记录
* 加料优惠金额
* 加料优惠金额
...
@@ -43,31 +46,22 @@ public class MaterialPromotionService implements IPromotionService {
...
@@ -43,31 +46,22 @@ public class MaterialPromotionService implements IPromotionService {
*/
*/
@Override
@Override
public
void
updateShoppingCartGoodsDiscount
(
CouponPromotionVO
couponPromotionVO
,
ActivityQueryDto
activityQueryDto
,
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscountResult
,
List
<
CartGoods
>
cartGoodsList
,
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
,
UserLoginInfoDto
userLoginInfoDto
,
ShoppingCartInfoRequestVo
shoppingCartInfoRequestVo
)
{
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
.
size
()
>
0
)
{
for
(
CartGoods
cartGoods
:
cartGoodsList
)
{
if
(
CollectionUtils
.
isEmpty
(
cartGoods
.
getProductMaterialList
()))
continue
;
for
(
CartGoods
.
MaterialGoods
materialGoods
:
cartGoods
.
getProductMaterialList
())
{
MaterialApportion
apportion
=
map
.
get
(
materialGoods
.
getSpuId
());
//设置小料行单价和行总价
materialGoods
.
setFinalPrice
(
apportion
.
getSalePrice
());
materialGoods
.
setAmount
(
apportion
.
getAmount
());
}
}
}
long
materialAmount
=
0L
,
materialOriginal
=
0L
;
long
materialAmount
=
0L
,
materialOriginal
=
0L
;
//todo : 加料和商品成交价不需要累计 分开显示
for
(
CartGoods
cartGoods
:
cartGoodsList
)
{
for
(
CartGoods
cartGoods
:
cartGoodsList
)
{
if
(
CollectionUtils
.
isEmpty
(
cartGoods
.
getProductMaterialList
()))
continue
;
if
(
CollectionUtils
.
isEmpty
(
cartGoods
.
getProductMaterialList
()))
continue
;
materialAmount
=
0L
;
materialAmount
=
0L
;
materialOriginal
=
0L
;
materialOriginal
=
0L
;
for
(
CartGoods
.
MaterialGoods
materialGoods
:
cartGoods
.
getProductMaterialList
())
{
for
(
CartGoods
.
MaterialGoods
materialGoods
:
cartGoods
.
getProductMaterialList
())
{
materialAmount
+=
materialGoods
.
getAmount
();
//materialAmount += materialGoods.getFinalPrice()*cartGoods.getQty();
materialOriginal
+=
materialGoods
.
getOriginalPrice
()
*
cartGoods
.
getQty
();
//materialOriginal += materialGoods.getOriginalPrice() * cartGoods.getQty();
materialGoods
.
setAmount
(
materialGoods
.
getFinalPrice
()
*
cartGoods
.
getQty
());
materialGoods
.
setOriginalAmount
(
materialGoods
.
getOriginalPrice
()
*
cartGoods
.
getQty
());
}
}
//设置商品行现总价\行原价 商品总价+小料商品总价
//设置商品行现总价\行原价 商品总价+小料商品总价
cartGoods
.
setAmount
(
cartGoods
.
getAmount
()
+
materialAmount
);
//
cartGoods.setAmount(cartGoods.getAmount() + materialAmount);
cartGoods
.
setOriginalAmount
(
cartGoods
.
getOriginalAmount
()
+
materialOriginal
);
//
cartGoods.setOriginalAmount(cartGoods.getOriginalAmount() + materialOriginal);
}
}
}
}
...
@@ -85,11 +79,13 @@ public class MaterialPromotionService implements IPromotionService {
...
@@ -85,11 +79,13 @@ public class MaterialPromotionService implements IPromotionService {
HashMap
<
String
,
MaterialApportion
>
map
=
getApportionGoodsDetail
(
calculationDiscountResult
);
HashMap
<
String
,
MaterialApportion
>
map
=
getApportionGoodsDetail
(
calculationDiscountResult
);
List
<
ShoppingCartGoodsDto
.
CartGoodsDetailDto
>
products
=
shoppingCartGoodsDto
.
getProducts
();
List
<
ShoppingCartGoodsDto
.
CartGoodsDetailDto
>
products
=
shoppingCartGoodsDto
.
getProducts
();
if
(
map
.
size
()
>
0
)
{
if
(
map
.
size
()
>
0
)
{
String
pk
=
""
;
for
(
ShoppingCartGoodsDto
.
CartGoodsDetailDto
product
:
products
)
{
for
(
ShoppingCartGoodsDto
.
CartGoodsDetailDto
product
:
products
)
{
if
(
CollectionUtils
.
isEmpty
(
product
.
getMaterialList
()))
continue
;
if
(
CollectionUtils
.
isEmpty
(
product
.
getMaterialList
()))
continue
;
for
(
ShoppingCartGoodsDto
.
CartGoodsDetailDto
.
MaterialGoods
materialGoods
:
product
.
getMaterialList
())
{
for
(
ShoppingCartGoodsDto
.
CartGoodsDetailDto
.
MaterialGoods
materialGoods
:
product
.
getMaterialList
())
{
MaterialApportion
material
=
map
.
get
(
materialGoods
.
getSpuId
());
pk
=
shoppingCartConvertAdapter
.
jointPk
(
product
.
getCartGoodsUid
(),
materialGoods
.
getSpuId
());
if
(
material
.
getApportionAmount
().
intValue
()
==
0
)
continue
;
MaterialApportion
material
=
map
.
get
(
pk
);
if
(
material
!=
null
&&
material
.
getApportionAmount
().
intValue
()
==
0
)
continue
;
//设置行记录参加的活动及总优惠
//设置行记录参加的活动及总优惠
ActivityDiscountsDto
activityDiscountsDto
=
new
ActivityDiscountsDto
();
ActivityDiscountsDto
activityDiscountsDto
=
new
ActivityDiscountsDto
();
List
<
ActivityDiscountsDto
>
activityDiscountsDtoList
=
new
ArrayList
<>();
List
<
ActivityDiscountsDto
>
activityDiscountsDtoList
=
new
ArrayList
<>();
...
@@ -100,7 +96,8 @@ public class MaterialPromotionService implements IPromotionService {
...
@@ -100,7 +96,8 @@ public class MaterialPromotionService implements IPromotionService {
activityDiscountsDtoList
.
add
(
activityDiscountsDto
);
activityDiscountsDtoList
.
add
(
activityDiscountsDto
);
materialGoods
.
setActivityDiscountsDtos
(
activityDiscountsDtoList
);
materialGoods
.
setActivityDiscountsDtos
(
activityDiscountsDtoList
);
materialGoods
.
setTotalDiscountAmount
((
materialGoods
.
getOriginalPrice
().
intValue
()
-
materialGoods
.
getSalePrice
().
intValue
())
*
product
.
getQty
());
//materialGoods.setTotalDiscountAmount((materialGoods.getOriginalPrice().intValue() - materialGoods.getSalePrice().intValue()) * product.getQty());
materialGoods
.
setTotalDiscountAmount
(
material
.
getTotalDiscountAmount
());
product
.
setProductType
(
GoodsTypeEnum
.
MATERIAL
.
getGoodsType
());
product
.
setProductType
(
GoodsTypeEnum
.
MATERIAL
.
getGoodsType
());
}
}
}
}
...
@@ -129,16 +126,21 @@ public class MaterialPromotionService implements IPromotionService {
...
@@ -129,16 +126,21 @@ public class MaterialPromotionService implements IPromotionService {
if
(
calculationDiscountResult
==
null
||
CollectionUtils
.
isEmpty
(
calculationDiscountResult
.
getApportionGoods
()))
{
if
(
calculationDiscountResult
==
null
||
CollectionUtils
.
isEmpty
(
calculationDiscountResult
.
getApportionGoods
()))
{
return
mApportion
;
return
mApportion
;
}
}
String
pk
=
""
;
for
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
ApportionGoods
apportionGood
:
calculationDiscountResult
.
getApportionGoods
())
{
for
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
ApportionGoods
apportionGood
:
calculationDiscountResult
.
getApportionGoods
())
{
if
(
CollectionUtils
.
isEmpty
(
apportionGood
.
getSmallMaterial
()))
continue
;
if
(
CollectionUtils
.
isEmpty
(
apportionGood
.
getSmallMaterial
()))
continue
;
for
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
ApportionGoods
.
Material
material
:
apportionGood
.
getSmallMaterial
())
{
for
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
ApportionGoods
.
Material
material
:
apportionGood
.
getSmallMaterial
())
{
if
(
material
.
getApportionAmount
()
==
0
)
continue
;
if
(
material
.
getApportionAmount
()
==
0
)
continue
;
if
(
mApportion
.
get
(
material
.
getGoodsId
())
==
null
)
{
pk
=
shoppingCartConvertAdapter
.
jointPk
(
material
.
getCartGoodsUid
(),
material
.
getGoodsId
());
if
(
mApportion
.
get
(
pk
)
==
null
)
{
MaterialApportion
materialApportion
=
new
MaterialApportion
();
MaterialApportion
materialApportion
=
new
MaterialApportion
();
materialApportion
.
setSalePrice
(
material
.
getNowPrice
());
materialApportion
.
setSalePrice
(
material
.
getNowPrice
());
materialApportion
.
setAmount
(
material
.
getNowPrice
()
*
material
.
getGoodsQuantity
());
materialApportion
.
setAmount
(
material
.
getNowPrice
()
*
material
.
getGoodsQuantity
());
materialApportion
.
setApportionAmount
(
material
.
getApportionAmount
()
*
material
.
getGoodsQuantity
());
materialApportion
.
setApportionAmount
(
material
.
getApportionAmount
()
*
material
.
getGoodsQuantity
());
materialApportion
.
setGoodsId
(
material
.
getGoodsId
());
materialApportion
.
setGoodsId
(
material
.
getGoodsId
());
materialApportion
.
setTotalDiscountAmount
(
material
.
getApportionAmount
()*
material
.
getGoodsQuantity
());
materialApportion
.
setPk
(
pk
);
ApportionDetails
apportionDetails
=
new
ApportionDetails
();
ApportionDetails
apportionDetails
=
new
ApportionDetails
();
if
(
CollectionUtils
.
isNotEmpty
(
material
.
getApportionDetails
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
material
.
getApportionDetails
()))
{
apportionDetails
.
setActivityCode
(
material
.
getApportionDetails
().
get
(
0
).
getActivityCode
());
apportionDetails
.
setActivityCode
(
material
.
getApportionDetails
().
get
(
0
).
getActivityCode
());
...
@@ -146,15 +148,15 @@ public class MaterialPromotionService implements IPromotionService {
...
@@ -146,15 +148,15 @@ public class MaterialPromotionService implements IPromotionService {
apportionDetails
.
setActivityType
(
material
.
getApportionDetails
().
get
(
0
).
getActivityType
());
apportionDetails
.
setActivityType
(
material
.
getApportionDetails
().
get
(
0
).
getActivityType
());
materialApportion
.
setDetails
(
apportionDetails
);
materialApportion
.
setDetails
(
apportionDetails
);
}
}
mApportion
.
put
(
material
.
getGoodsId
()
,
materialApportion
);
mApportion
.
put
(
pk
,
materialApportion
);
continue
;
continue
;
}
}
MaterialApportion
apportion
=
mApportion
.
get
(
material
.
getGoodsId
());
MaterialApportion
apportion
=
mApportion
.
get
(
material
.
getGoodsId
());
apportion
.
setSalePrice
(
apportion
.
getSalePrice
()
+
material
.
getNowPrice
());
apportion
.
setSalePrice
(
apportion
.
getSalePrice
()
+
material
.
getNowPrice
());
apportion
.
setAmount
(
apportion
.
getAmount
()
+
material
.
getNowPrice
()
*
material
.
getGoodsQuantity
());
apportion
.
setAmount
(
apportion
.
getAmount
()
+
material
.
getNowPrice
()
*
material
.
getGoodsQuantity
());
apportion
.
setApportionAmount
(
apportion
.
getApportionAmount
()
+
material
.
getApportionAmount
()
*
material
.
getGoodsQuantity
());
apportion
.
setApportionAmount
(
apportion
.
getApportionAmount
()
+
material
.
getApportionAmount
()
*
material
.
getGoodsQuantity
());
mApportion
.
put
(
material
.
getGoodsId
(),
apportion
);
apportion
.
setTotalDiscountAmount
(
apportion
.
getTotalDiscountAmount
()+
material
.
getApportionAmount
()*
material
.
getGoodsQuantity
()
);
mApportion
.
put
(
pk
,
apportion
);
}
}
}
}
return
mApportion
;
return
mApportion
;
...
@@ -162,12 +164,14 @@ public class MaterialPromotionService implements IPromotionService {
...
@@ -162,12 +164,14 @@ public class MaterialPromotionService implements IPromotionService {
@Data
@Data
private
class
MaterialApportion
{
private
class
MaterialApportion
{
// 累计
private
String
goodsId
;
private
String
goodsId
;
private
Long
salePrice
;
private
Long
salePrice
;
private
Long
amount
;
private
Long
amount
;
private
Integer
apportionAmount
;
private
Integer
apportionAmount
;
//优惠金额
private
Integer
totalDiscountAmount
;
private
ApportionDetails
details
;
private
ApportionDetails
details
;
private
String
pk
;
}
}
@Data
@Data
...
...
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