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
b13bbc6d
Commit
b13bbc6d
authored
Dec 13, 2021
by
周晓航
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增夜间配送参数nightDistributionFee,调用促销算价处理
Signed-off-by: 周晓航 <xiaohang.zhou@freemud.com>
parent
f70fb10b
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
60 additions
and
19 deletions
+60
-19
shopping-cart-application-service/src/main/java/cn/freemud/entities/dto/calculate/ActivityCalculationDiscountRequestDto.java
+5
-0
shopping-cart-application-service/src/main/java/cn/freemud/service/delivery/DeliveryService.java
+2
-2
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartMallServiceImpl.java
+8
-6
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
+20
-8
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/CalculationSharingDiscountService.java
+25
-3
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/entities/dto/calculate/ActivityCalculationDiscountRequestDto.java
View file @
b13bbc6d
...
...
@@ -76,6 +76,11 @@ public class ActivityCalculationDiscountRequestDto {
private
Long
distributionFee
;
/**
* 是否有夜间配送费, 白天配送费 综合, 该字段依据门店是否设置 为依据
*/
private
Long
nightDistributionFee
=
0L
;
/**
* 购买月卡费用(分)
*/
private
Long
payCardFee
;
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/delivery/DeliveryService.java
View file @
b13bbc6d
...
...
@@ -66,8 +66,8 @@ public interface DeliveryService {
if
(
DateTimeUtil
.
isEffectiveDate
(
nowTime
,
startTime
,
endTime
))
{
ExtraDeliveryDto
extraDeliveryDto
=
new
ExtraDeliveryDto
(
info
.
getType
(),
amount
);
list
.
add
(
extraDeliveryDto
);
// 金额 增加
amount
+=
info
.
getPrice
();
// 金额 增加
, 原来配送费金额不变
//
amount += info.getPrice();
}
}
catch
(
ParseException
e
)
{
// 报错表示 时间格式设置错误, 默认当做不计算
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartMallServiceImpl.java
View file @
b13bbc6d
...
...
@@ -37,7 +37,10 @@ import cn.freemud.interceptor.ServiceException;
import
cn.freemud.service.BuriedPointService
;
import
cn.freemud.service.ItemService
;
import
cn.freemud.service.ShoppingCartNewService
;
import
cn.freemud.service.impl.calculate.*
;
import
cn.freemud.service.impl.calculate.CalculationSharingCartService
;
import
cn.freemud.service.impl.calculate.CalculationSharingDiscountService
;
import
cn.freemud.service.impl.calculate.CalculationSharingEquallyService
;
import
cn.freemud.service.impl.calculate.CalculationSharingValidatorService
;
import
cn.freemud.service.shoppingCart.ShoppingCartRelationFactory
;
import
cn.freemud.service.shoppingCart.ShoppingCartRelationService
;
import
cn.freemud.service.thirdparty.CustomerApplicationClient
;
...
...
@@ -63,7 +66,6 @@ import org.apache.commons.collections4.CollectionUtils;
import
org.apache.commons.lang.ObjectUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
java.util.*
;
...
...
@@ -193,7 +195,7 @@ public class ShoppingCartMallServiceImpl implements ShoppingCartNewService {
ActivityQueryDto
activityQueryDto
=
activityAdapter
.
getActivityQueryDto
(
partnerId
,
storeId
,
userId
,
appId
,
addShoppingCartGoodsRequestVo
.
getOrderType
());
CalculationDiscountResult
discountResult
=
null
;
discountResult
=
sharingDiscountService
.
getCalculationSharingDiscountResult
(
menuType
,
partnerId
,
storeId
,
userId
,
appId
,
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
allCartGoodsList
,
new
ArrayList
<>(),
null
,
deliveryAmount
,
null
,
null
,
accountType
,
new
DiscountSharingDto
());
discountResult
=
sharingDiscountService
.
getCalculationSharingDiscountResult
(
menuType
,
partnerId
,
storeId
,
userId
,
appId
,
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
allCartGoodsList
,
new
ArrayList
<>(),
null
,
deliveryAmount
,
null
,
null
,
accountType
,
new
DiscountSharingDto
()
,
0L
);
sharingCartService
.
distribute
(
discountResult
,
allCartGoodsList
,
shoppingCartGoodsResponseVo
,
null
,
null
,
null
,
activityQueryDto
,
menuType
,
deliveryAmount
,
ShoppingCartConstant
.
ADD_AND_UPDATE
,
partnerId
,
null
,
userId
,
storeId
);
buildShoppingCartGoodsResponse
(
shoppingCartGoodsResponseVo
,
discountResult
,
null
,
partnerId
);
...
...
@@ -288,7 +290,7 @@ public class ShoppingCartMallServiceImpl implements ShoppingCartNewService {
,
new
ArrayList
()
//券
,
null
//加价购商品
,
deliveryAmount
,
null
,
null
,
accountFlag
,
new
DiscountSharingDto
());
,
null
,
null
,
accountFlag
,
new
DiscountSharingDto
()
,
0L
);
sharingCartService
.
distribute
(
discountResult
,
cartGoodsList
...
...
@@ -447,7 +449,7 @@ public class ShoppingCartMallServiceImpl implements ShoppingCartNewService {
,
coupons
,
sendGoods
,
deliveryAmount
,
null
,
null
,
accountFlag
,
new
DiscountSharingDto
());
,
null
,
null
,
accountFlag
,
new
DiscountSharingDto
()
,
0L
);
sharingCartService
.
distribute
(
calculationSharingDiscountResult
,
cartGoodsList
,
shoppingCartGoodsResponseVo
...
...
@@ -605,7 +607,7 @@ public class ShoppingCartMallServiceImpl implements ShoppingCartNewService {
,
coupons
,
shoppingCartInfoRequestVo
.
getSendGoods
()
,
deliveryAmount
,
shoppingCartInfoRequestVo
,
null
,
accountFlag
,
new
DiscountSharingDto
());
,
shoppingCartInfoRequestVo
,
null
,
accountFlag
,
new
DiscountSharingDto
()
,
0L
);
// 活动校验
calculationSharingValidatorService
.
validator
(
discountResult
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
View file @
b13bbc6d
...
...
@@ -22,6 +22,7 @@ import cn.freemud.constant.ResponseCodeConstant;
import
cn.freemud.constant.ShoppingCartConstant
;
import
cn.freemud.demo.controller.ShoppingCartDemoController
;
import
cn.freemud.demo.entities.dto.goods.add.list.BaseListCartGoodsVO
;
import
cn.freemud.entities.ExtraDeliveryDto
;
import
cn.freemud.entities.dto.*
;
import
cn.freemud.entities.dto.activity.ActivityDiscountsDto
;
import
cn.freemud.entities.dto.activity.ActivityQueryDto
;
...
...
@@ -34,9 +35,9 @@ import cn.freemud.entities.dto.order.PackAmountConfig;
import
cn.freemud.entities.dto.other.ValidCouponBo
;
import
cn.freemud.entities.dto.pay.*
;
import
cn.freemud.entities.dto.product.CheckCartRequest
;
import
cn.freemud.entities.dto.shoppingCart.PromotionResultVO
;
import
cn.freemud.entities.dto.product.info.ProductBean
;
import
cn.freemud.entities.dto.product.info.SkuProductBean
;
import
cn.freemud.entities.dto.shoppingCart.PromotionResultVO
;
import
cn.freemud.entities.dto.shoppingCart.SendPoint
;
import
cn.freemud.entities.dto.shoppingCart.ShoppingCartGoodsDto
;
import
cn.freemud.entities.dto.user.GetUserScoreUseDetailRequest
;
...
...
@@ -384,7 +385,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
,
appId
,
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
allCartGoodsList
,
new
ArrayList
<>()
//结算页选中的代金券
,
null
//加价购商品
,
deliveryAmount
,
null
,
bizType
,
accountFlag
,
new
DiscountSharingDto
());
,
deliveryAmount
,
null
,
bizType
,
accountFlag
,
new
DiscountSharingDto
()
,
this
.
getNightDistributionFee
(
shoppingCartGoodsResponseVo
.
getDeliveryAmountList
())
);
//更新购物车券状态
newCalculationUpdateCouponStatus
(
userId
,
partnerId
,
storeId
,
bizType
,
cartGoods
,
allCartGoodsList
,
discountResult
);
sharingCartService
.
distribute
(
discountResult
,
allCartGoodsList
,
shoppingCartGoodsResponseVo
,
null
...
...
@@ -533,7 +534,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
,
new
ArrayList
()
//券
,
null
//加价购商品
,
deliveryAmount
,
null
,
bizType
,
accountFlag
,
new
DiscountSharingDto
());
,
null
,
bizType
,
accountFlag
,
new
DiscountSharingDto
()
,
this
.
getNightDistributionFee
(
shoppingCartGoodsResponseVo
.
getDeliveryAmountList
())
);
//校验加购数量
if
(
discountResult
!=
null
)
{
sendGoodsQtyCheckForUpdate
(
cartGoodsList
,
oldQty
,
appId
,
partnerId
,
userId
,
storeId
,
cartGoodsUid
,
""
,
shoppingCartBaseService
,
discountResult
.
getSendGoods
(),
bizType
);
...
...
@@ -736,6 +737,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
assortmentSdkService
.
setShoppingCart
(
partnerId
,
storeId
,
userId
,
cartGoodsList
,
assortmentCustomerInfoVo
.
getSessionId
(),
""
,
this
.
shoppingCartBaseService
,
bizType
);
}
// 获取基础运费,并且 组装 deliveryAmountList字段: 额外配送费 如夜间配送费等
Long
deliveryAmount
=
calculateDeliveryAmount
(
receiveId
,
partnerId
,
storeId
,
userLoginInfoDto
.
getWxAppid
(),
shoppingCartGoodsResponseVo
,
shoppingCartInfoRequestVo
.
getOrderType
());
ActivityQueryDto
activityQueryDto
=
activityAdapter
.
getActivityQueryDto
(
partnerId
,
storeId
,
userId
,
appId
,
shoppingCartInfoRequestVo
.
getOrderType
());
...
...
@@ -778,7 +780,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
,
sendGoods
,
deliveryAmount
,
null
,
bizType
,
accountFlag
,
new
DiscountSharingDto
());
,
bizType
,
accountFlag
,
new
DiscountSharingDto
()
,
this
.
getNightDistributionFee
(
shoppingCartGoodsResponseVo
.
getDeliveryAmountList
())
);
sharingCartService
.
distribute
(
calculationSharingDiscountResult
,
cartGoodsList
,
shoppingCartGoodsResponseVo
...
...
@@ -1210,7 +1212,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
,
coupons
,
shoppingCartInfoRequestVo
.
getSendGoods
()
,
deliveryAmount
,
shoppingCartInfoRequestVo
,
bizType
,
accountFlag
,
new
DiscountSharingDto
());
,
shoppingCartInfoRequestVo
,
bizType
,
accountFlag
,
new
DiscountSharingDto
()
,
this
.
getNightDistributionFee
(
shoppingCartGoodsResponseVo
.
getDeliveryAmountList
())
);
// 活动校验
calculationSharingValidatorService
.
validator
(
discountResult
...
...
@@ -3125,7 +3127,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
,
coupons
//券
,
null
//加价购商品
,
0L
,
null
,
bizType
,
accountFlag
,
new
DiscountSharingDto
());
,
null
,
bizType
,
accountFlag
,
new
DiscountSharingDto
()
,
0L
);
premiumExchangeResponseVo
=
activityAdapter
.
convert2PremiumExchangeSharing
(
discountResult
);
}
else
{
...
...
@@ -3295,7 +3297,8 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
CouponAvailableCartInfo
couponAvailableCartInfo
;
List
<
String
>
orgCodes
=
commonService
.
getOrgIdsForCoupon
(
partnerId
,
storeId
);
Long
deliveryAmount
=
calculateDeliveryAmount
(
requestVo
.
getReceiveId
(),
partnerId
,
storeId
,
assortmentCustomerInfoVo
.
getWxAppId
(),
new
ShoppingCartGoodsResponseVo
(),
requestVo
.
getOrderType
());
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
=
new
ShoppingCartGoodsResponseVo
();
Long
deliveryAmount
=
calculateDeliveryAmount
(
requestVo
.
getReceiveId
(),
partnerId
,
storeId
,
assortmentCustomerInfoVo
.
getWxAppId
(),
shoppingCartGoodsResponseVo
,
requestVo
.
getOrderType
());
// 获取购物车商品
List
<
CartGoods
>
cartGoodsList
=
assortmentSdkService
.
getShoppingCartForCoupon
(
partnerId
,
requestVo
.
getStoreId
(),
userId
,
""
,
shoppingCartBaseService
,
bizType
);
if
(
grayPush
(
partnerId
,
storeId
,
"2"
))
{
...
...
@@ -3313,7 +3316,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
,
new
ArrayList
<>()
//券
,
null
//加价购商品
,
deliveryAmount
,
null
,
bizType
,
accountFlag
,
sharingDto
);
,
null
,
bizType
,
accountFlag
,
sharingDto
,
this
.
getNightDistributionFee
(
shoppingCartGoodsResponseVo
.
getDeliveryAmountList
())
);
couponAvailableCartInfo
=
activityAdapter
.
convert2CouponAvailableCartInfoSharing
(
partnerId
,
storeId
,
discountResult
,
orgCodes
);
}
else
{
...
...
@@ -3525,4 +3528,13 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
return
fullReplace
;
}
private
long
getNightDistributionFee
(
List
<
ExtraDeliveryDto
>
deliveryAmountList
){
if
(
CollectionUtils
.
isEmpty
(
deliveryAmountList
))
{
return
0L
;
}
return
deliveryAmountList
.
stream
()
.
filter
(
s
->
s
.
getType
()
!=
ExtraDeliveryDto
.
TYPE_DEFAULT
)
.
mapToLong
(
ExtraDeliveryDto:
:
getDeliveryAmount
)
.
sum
();
}
}
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/CalculationSharingDiscountService.java
View file @
b13bbc6d
...
...
@@ -3,6 +3,7 @@ package cn.freemud.service.impl.calculate;
import
cn.freemud.constant.ResponseCodeConstant
;
import
cn.freemud.entities.dto.CheckSpqInfoRequestDto
;
import
cn.freemud.entities.dto.CheckSpqInfoResponseDto
;
import
cn.freemud.entities.dto.activity.DiscountSharingDto
;
import
cn.freemud.entities.dto.calculate.*
;
import
cn.freemud.entities.dto.shoppingCart.SendPoint
;
import
cn.freemud.entities.vo.CartGoods
;
...
...
@@ -20,7 +21,6 @@ import cn.freemud.service.active.ActiveService;
import
cn.freemud.service.impl.AssortmentSdkService
;
import
cn.freemud.service.thirdparty.ActivityClient
;
import
cn.freemud.utils.PropertyConvertUtil
;
import
cn.freemud.entities.dto.activity.DiscountSharingDto
;
import
com.freemud.sdk.api.assortment.shoppingcart.constant.CommonsConstant
;
import
com.freemud.sdk.api.assortment.shoppingcart.enums.BusinessTypeEnum
;
import
com.freemud.sdk.api.assortment.shoppingcart.service.impl.ShoppingCartBaseServiceImpl
;
...
...
@@ -69,14 +69,36 @@ public class CalculationSharingDiscountService {
}
// 新算价
/**
* 新算价
* @param menuType
* @param partnerId
* @param storeId
* @param userId
* @param appId
* @param orderType
* @param isMember
* @param cartGoodsList
* @param coupons
* @param sendGoodsList
* @param deliveryAmount
* @param shoppingCartInfoRequestVo
* @param bizType
* @param accountFlag
* @param sharingDto
* @param nightDistributionFee 是否有夜间配送费设置 不参与的需求 可以传递 0L
* @return
*/
public
CalculationDiscountResult
getCalculationSharingDiscountResult
(
String
menuType
,
String
partnerId
,
String
storeId
,
String
userId
,
String
appId
,
Integer
orderType
,
boolean
isMember
,
List
<
CartGoods
>
cartGoodsList
,
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
,
List
<
ShoppingCartInfoRequestVo
.
SendGoods
>
sendGoodsList
,
Long
deliveryAmount
,
ShoppingCartInfoRequestVo
shoppingCartInfoRequestVo
,
Integer
bizType
,
Integer
accountFlag
,
DiscountSharingDto
sharingDto
)
{
,
ShoppingCartInfoRequestVo
shoppingCartInfoRequestVo
,
Integer
bizType
,
Integer
accountFlag
,
DiscountSharingDto
sharingDto
,
long
nightDistributionFee
)
{
ActivityCalculationDiscountRequestDto
calculationSharingDiscountRequestDto
=
this
.
commonSharingDto
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
);
// 是否有夜间配送费 设置
calculationSharingDiscountRequestDto
.
setNightDistributionFee
(
nightDistributionFee
);
// 校验后有效的商品券map
HashMap
<
String
,
CheckSpqInfoResponseDto
>
validCouponMap
=
new
HashMap
<>(
16
);
...
...
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