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
60fab572
Commit
60fab572
authored
Aug 08, 2020
by
徐康
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop' into develop
parents
c0a18e81
db4dc6b9
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
143 additions
and
52 deletions
+143
-52
assortment-shoppingcart-sdk/pom.xml
+1
-1
assortment-shoppingcart-sdk/readme.md
+2
-2
assortment-shoppingcart-sdk/src/main/java/com/freemud/sdk/api/assortment/shoppingcart/adapter/ShoppingCartAdapter.java
+5
-2
assortment-shoppingcart-sdk/src/main/java/com/freemud/sdk/api/assortment/shoppingcart/domain/GetMenuResponseDto.java
+2
-2
shopping-cart-application-service/pom.xml
+1
-1
shopping-cart-application-service/src/main/java/cn/freemud/controller/MCoffeeShoppingCartController.java
+9
-0
shopping-cart-application-service/src/main/java/cn/freemud/entities/dto/ActivityCalculationDiscountRequestDto.java
+5
-0
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/AddShoppingCartGoodsRequestVo.java
+10
-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
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/ShoppingCartMCoffeeServiceImpl.java
+31
-0
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/CalculationServiceImpl.java
+40
-11
No files found.
assortment-shoppingcart-sdk/pom.xml
View file @
60fab572
...
...
@@ -10,7 +10,7 @@
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
assortment-shoppingcart-sdk
</artifactId>
<version>
1.1.
8
-SNAPSHOT
</version>
<version>
1.1.
9
-SNAPSHOT
</version>
<dependencies>
<dependency>
...
...
assortment-shoppingcart-sdk/readme.md
View file @
60fab572
...
...
@@ -6,4 +6,4 @@
| 1.1.2-SNAPSHOT| 券码接口新增参数:channelCodeList | 梁崇福 | 2020-05-13 |
| 1.1.4-SNAPSHOT| 券码接口修改为channel_codes | 梁崇福 | 2020-06-08 |
| 1.1.5-SNAPSHOT| 增加统计分类编号:classificationId,classificationName | | 2020-06-12 |
| 1.1.8-SNAPSHOT| 加料 | 李小二 | 2020-07-30 |
\ No newline at end of file
| 1.1.9-SNAPSHOT| 加料 | 李小二 | 2020-07-30 |
\ No newline at end of file
assortment-shoppingcart-sdk/src/main/java/com/freemud/sdk/api/assortment/shoppingcart/adapter/ShoppingCartAdapter.java
View file @
60fab572
...
...
@@ -321,6 +321,8 @@ public class ShoppingCartAdapter {
cartGoods
.
setWeight
(
isSkuProduct
?
skuProduct
.
getWeight
()
:
spuProduct
.
getWeight
());
cartGoods
.
setUnit
(
isSkuProduct
?
skuProduct
.
getUnit
()
:
spuProduct
.
getUnit
());
cartGoods
.
setWeightType
(
CommonsConstant
.
WEIGHT_PRODUCT
.
equals
(
spuProduct
.
getWeightType
()));
cartGoods
.
setMaterialAmount
(
0L
);
cartGoods
.
setOriginalMaterialAmount
(
0L
);
// todo 设置加料
this
.
checkMaterialProduct
(
cartGoods
,
spuProduct
);
...
...
@@ -337,6 +339,7 @@ public class ShoppingCartAdapter {
* @param spuProduct
*/
private
void
checkMaterialProduct
(
CartGoods
cartGoods
,
ProductBeanDTO
spuProduct
)
{
if
(
CollectionUtils
.
isEmpty
(
cartGoods
.
getProductMaterialList
()))
return
;
//加料信息为空
if
(
CollectionUtils
.
isEmpty
(
spuProduct
.
getAdditionalGroupList
()))
return
;
...
...
@@ -359,7 +362,7 @@ public class ShoppingCartAdapter {
material
.
setSpuId
(
detail
.
getProductId
());
//行单价 \ 行总价
material
.
setFinalPrice
(
detail
.
getProductFinalPrice
().
longValue
());
material
.
setAmount
(
detail
.
getProductFinalPrice
().
longValue
());
material
.
setAmount
(
detail
.
getProductFinalPrice
().
longValue
()
*
cartGoods
.
getQty
()
);
//原行单价*数量
material
.
setOriginalAmount
(
detail
.
getProductFinalPrice
().
longValue
()
*
cartGoods
.
getQty
());
material
.
setOriginalPrice
(
detail
.
getProductFinalPrice
().
longValue
());
...
...
@@ -376,7 +379,7 @@ public class ShoppingCartAdapter {
//加料行记录原价总价
cartGoods
.
setOriginalMaterialAmount
(
originalMaterAmount
);
cartGoods
.
setOriginalAmount
(
cartGoods
.
getOriginalAmount
()
+
originalMaterAmount
);
cartGoods
.
setSubName
(
materialSubName
);
cartGoods
.
setSubName
(
StringUtils
.
strip
(
materialSubName
,
"/"
)
);
}
private
boolean
updateComboxGoodsInfo
(
CartGoods
cartGoods
,
CartGoods
.
ComboxGoods
comboxGoods
,
ProductBeanDTO
parentProductBean
,
List
<
ProductBeanDTO
>
productBeans
,
CartGoodsStates
cartGoodsStates
,
List
<
String
>
invalidGoodsIdList
)
{
...
...
assortment-shoppingcart-sdk/src/main/java/com/freemud/sdk/api/assortment/shoppingcart/domain/GetMenuResponseDto.java
View file @
60fab572
...
...
@@ -167,7 +167,7 @@ public class GetMenuResponseDto {
private
int
updateStatus
;
private
boolean
valid
;
private
int
version
;
private
List
<
ProductLabelName
List
Bean
>
labelNames
;
private
List
<
ProductLabelNameBean
>
labelNames
;
private
List
<
ProductAttributeGroupListBean
>
productAttributeGroupList
;
private
List
<
ProductPictureListBean
>
productPictureList
;
private
List
<?>
productSpecification
;
...
...
@@ -239,7 +239,7 @@ public class GetMenuResponseDto {
@NoArgsConstructor
@Data
public
static
class
ProductLabelName
List
Bean
{
public
static
class
ProductLabelNameBean
{
private
String
id
;
private
String
name
;
private
String
partnerId
;
...
...
shopping-cart-application-service/pom.xml
View file @
60fab572
...
...
@@ -45,7 +45,7 @@
<dependency>
<groupId>
cn.freemud
</groupId>
<artifactId>
assortment-shoppingcart-sdk
</artifactId>
<version>
1.1.
8
-SNAPSHOT
</version>
<version>
1.1.
9
-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
com.freemud.application.service.sdk
</groupId>
...
...
shopping-cart-application-service/src/main/java/cn/freemud/controller/MCoffeeShoppingCartController.java
View file @
60fab572
...
...
@@ -66,6 +66,15 @@ public class MCoffeeShoppingCartController {
}
/**
* 查询购物车可使用优惠券
*/
@ApiAnnotation
(
logMessage
=
"availableCoupon"
)
@PostMapping
(
value
=
"/availableCoupon"
)
public
BaseResponse
availableCoupon
(
@Validated
@LogParams
@RequestBody
ShoppingCartInfoRequestVo
request
)
{
return
shoppingCartMCoffeeService
.
availableCoupon
(
request
);
}
/**
* 清空购物车
*/
@ApiAnnotation
(
logMessage
=
"clearCartGoods"
)
...
...
shopping-cart-application-service/src/main/java/cn/freemud/entities/dto/ActivityCalculationDiscountRequestDto.java
View file @
60fab572
...
...
@@ -86,6 +86,10 @@ public class ActivityCalculationDiscountRequestDto {
/**
* 商品ID
*/
private
String
goodsCode
;
/**
* 商品ID
*/
private
String
goodsId
;
/**
* 购物车行uid
...
...
@@ -122,6 +126,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/AddShoppingCartGoodsRequestVo.java
View file @
60fab572
...
...
@@ -80,4 +80,14 @@ public class AddShoppingCartGoodsRequestVo extends BaseRequestVo{
*/
private
String
receiveId
;
/**
* 操作类型 1= 添加商品券 2=加价购
*/
private
Integer
operationType
;
/**
* 优惠券号
*/
private
String
couponCode
;
}
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/CartGoods.java
View file @
60fab572
...
...
@@ -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 @
60fab572
...
...
@@ -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 @
60fab572
...
...
@@ -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
())
{
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/ShoppingCartMCoffeeServiceImpl.java
View file @
60fab572
...
...
@@ -261,6 +261,37 @@ public class ShoppingCartMCoffeeServiceImpl {
return
ResponseUtil
.
success
(
shoppingCartGoodsResponseVo
);
}
/**
* 查询购物车可用券
*/
public
BaseResponse
availableCoupon
(
ShoppingCartInfoRequestVo
shoppingCartInfoRequestVo
)
{
if
(
StringUtils
.
isEmpty
(
shoppingCartInfoRequestVo
.
getShopId
()))
{
throw
new
ServiceException
(
ResponseResult
.
SHOPPING_CART_SHOP_ID_NOT_EMPTY
);
}
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
=
new
ShoppingCartGoodsResponseVo
();
ActivityClassifyCouponBean
availableCoupon
=
new
ActivityClassifyCouponBean
();
// 获取用户信息
CustomerInfoVo
assortmentCustomerInfoVo
=
getCustomerInfoVo
(
shoppingCartInfoRequestVo
.
getSessionId
());
String
userId
=
assortmentCustomerInfoVo
.
getMemberId
();
String
partnerId
=
shoppingCartInfoRequestVo
.
getPartnerId
();
String
storeId
=
shoppingCartInfoRequestVo
.
getShopId
();
String
appId
=
shoppingCartInfoRequestVo
.
getAppId
();
String
couponCode
=
shoppingCartInfoRequestVo
.
getCouponCode
();
String
activityCode
=
shoppingCartInfoRequestVo
.
getActivityCode
();
String
menuType
=
shoppingCartInfoRequestVo
.
getMenuType
();
Integer
orderType
=
shoppingCartInfoRequestVo
.
getOrderType
();
String
receiveId
=
shoppingCartInfoRequestVo
.
getReceiveId
();
// 获取购物车商品
List
<
CartGoods
>
cartGoodsList
=
assortmentSdkService
.
getShoppingCart
(
partnerId
,
storeId
,
userId
,
null
,
""
,
shoppingCartBaseService
);
// 促销计算-查询用户券-券码校验可用券
availableCoupon
=
calculationService
.
availableCoupon
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
menuType
,
receiveId
,
null
,
cartGoodsList
,
new
ArrayList
<>(),
new
ArrayList
<>(),
shoppingCartGoodsResponseVo
);
return
ResponseUtil
.
success
(
availableCoupon
);
}
/**
* 清空购物车
*
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/CalculationServiceImpl.java
View file @
60fab572
...
...
@@ -87,8 +87,12 @@ public class CalculationServiceImpl {
List
<
CartGoods
>
cartGoodsList
,
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
,
List
<
ShoppingCartInfoRequestVo
.
SendGoods
>
sendGoodsList
,
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
)
{
Long
deliveryAmount
=
calculateDeliveryAmount
(
receiveId
,
partnerId
,
storeId
,
appId
,
shoppingCartGoodsResponseVo
);
Long
deliveryAmount
=
0L
;
QueryDeliverDetailResponse
response
=
calculateDeliveryAmount
(
receiveId
,
partnerId
,
storeId
,
appId
);
if
(
response
!=
null
){
shoppingCartGoodsResponseVo
.
setDeliveryFeeZeroReason
(
response
.
getDeliveryFeeZeroReason
()
!=
null
?
response
.
getDeliveryFeeZeroReason
()
:
0
);
deliveryAmount
=
response
.
getDeliveryAmount
();
}
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscount
=
getCalculationDiscount
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
,
isMember
,
menuType
,
deliveryAmount
,
cartGoodsList
,
coupons
,
sendGoodsList
);
...
...
@@ -117,7 +121,7 @@ public class CalculationServiceImpl {
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountGoods
>
calculationDiscountGoodsList
=
new
ArrayList
<>();
for
(
CartGoods
cartGoods
:
cartGoodsList
)
{
addCalculationDiscountGoods
(
calculationDiscountGoodsList
,
cartGoods
.
getGoodsId
(),
cartGoods
.
getQty
(),
cartGoods
.
getFinalPrice
(),
cartGoods
.
getMemberDiscount
());
addCalculationDiscountGoods
(
calculationDiscountGoodsList
,
cartGoods
.
get
CustomerCode
(),
cartGoods
.
get
GoodsId
(),
cartGoods
.
getQty
(),
cartGoods
.
getFinalPrice
(),
cartGoods
.
getMemberDiscount
());
}
if
(
BusinessTypeEnum
.
SAAS_DELIVERY
.
getCode
().
equals
(
menuType
))
{
...
...
@@ -126,7 +130,7 @@ public class CalculationServiceImpl {
// 当加价购商品不为空时
if
(
CollectionUtils
.
isNotEmpty
(
sendGoodsList
))
{
for
(
ShoppingCartInfoRequestVo
.
SendGoods
sendGoods
:
sendGoodsList
)
{
this
.
addCalculationDiscountGoods
(
calculationDiscountGoodsList
,
sendGoods
.
getGoodsId
(),
sendGoods
.
getQty
(),
sendGoods
.
getOriginalPrice
(),
100
);
this
.
addCalculationDiscountGoods
(
calculationDiscountGoodsList
,
sendGoods
.
getGoodsId
(),
sendGoods
.
get
GoodsId
(),
sendGoods
.
get
Qty
(),
sendGoods
.
getOriginalPrice
(),
100
);
}
}
calculationDiscountGoodsList
.
removeIf
(
calculationDiscountGoods
->
(
calculationDiscountGoods
.
getGoodsQuantity
().
equals
(
0
)));
...
...
@@ -276,10 +280,10 @@ public class CalculationServiceImpl {
/**
* 配送金额
*/
private
Long
calculateDeliveryAmount
(
String
receiveId
,
String
partnerId
,
String
storeId
,
String
wxappid
,
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
)
{
Long
deliveryAmount
=
0L
;
private
QueryDeliverDetailResponse
calculateDeliveryAmount
(
String
receiveId
,
String
partnerId
,
String
storeId
,
String
wxappid
)
{
if
(
StringUtils
.
isBlank
(
receiveId
))
{
return
deliveryAmount
;
return
null
;
}
String
trackingNo
=
LogThreadLocal
.
getTrackingNo
();
...
...
@@ -302,10 +306,8 @@ public class CalculationServiceImpl {
if
(
queryDeliverDetailResponse
.
getData
().
getDeliveryAmount
()
==
null
)
{
throw
new
ServiceException
(
ResponseResult
.
STORE_DELIVERY_AMOUNT_ERROR
);
}
shoppingCartGoodsResponseVo
.
setDeliveryFeeZeroReason
(
queryDeliverDetailResponse
.
getData
().
getDeliveryFeeZeroReason
()
!=
null
?
queryDeliverDetailResponse
.
getData
().
getDeliveryFeeZeroReason
()
:
0
);
deliveryAmount
=
queryDeliverDetailResponse
.
getData
().
getDeliveryAmount
();
return
deliveryAmount
;
return
queryDeliverDetailResponse
.
getData
()
;
}
...
...
@@ -343,8 +345,9 @@ public class CalculationServiceImpl {
* @param originalPrice
*/
private
void
addCalculationDiscountGoods
(
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountGoods
>
calculationDiscountGoodsList
,
String
goodsId
,
Integer
goodsQuantity
,
Long
originalPrice
,
Integer
memberDiscount
)
{
String
goods
Code
,
String
goods
Id
,
Integer
goodsQuantity
,
Long
originalPrice
,
Integer
memberDiscount
)
{
ActivityCalculationDiscountRequestDto
.
CalculationDiscountGoods
calculationDiscountGoods
=
new
ActivityCalculationDiscountRequestDto
.
CalculationDiscountGoods
();
calculationDiscountGoods
.
setGoodsCode
(
goodsCode
);
calculationDiscountGoods
.
setGoodsId
(
goodsId
);
calculationDiscountGoods
.
setGoodsQuantity
(
goodsQuantity
);
calculationDiscountGoods
.
setOriginalPrice
(
originalPrice
);
...
...
@@ -385,4 +388,30 @@ public class CalculationServiceImpl {
}
/**
* 可选优惠券
*/
public
ActivityClassifyCouponBean
availableCoupon
(
String
partnerId
,
String
storeId
,
String
userId
,
String
appId
,
Integer
orderType
,
boolean
isMember
,
String
menuType
,
String
receiveId
,
String
couponCode
,
List
<
CartGoods
>
cartGoodsList
,
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
,
List
<
ShoppingCartInfoRequestVo
.
SendGoods
>
sendGoodsList
,
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
){
Long
deliveryAmount
=
0L
;
QueryDeliverDetailResponse
response
=
calculateDeliveryAmount
(
receiveId
,
partnerId
,
storeId
,
appId
);
if
(
response
!=
null
){
shoppingCartGoodsResponseVo
.
setDeliveryFeeZeroReason
(
response
.
getDeliveryFeeZeroReason
()
!=
null
?
response
.
getDeliveryFeeZeroReason
()
:
0
);
deliveryAmount
=
response
.
getDeliveryAmount
();
}
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscount
=
getCalculationDiscount
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
,
isMember
,
menuType
,
deliveryAmount
,
cartGoodsList
,
coupons
,
sendGoodsList
);
//优惠券
CouponPromotionVO
couponPromotionVO
=
couponDiscountCalculation
.
getCouponPromotionVO
(
partnerId
,
storeId
,
userId
,
couponCode
,
orderType
);
couponDiscountCalculation
.
updateShoppingCartGoodsDiscount
(
couponPromotionVO
,
calculationDiscount
,
cartGoodsList
,
shoppingCartGoodsResponseVo
);
return
shoppingCartGoodsResponseVo
.
getAvailableCoupon
();
}
}
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