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
05fe7c58
Commit
05fe7c58
authored
Jul 23, 2021
by
周晓航
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
根据模板配置 计算包装费
Signed-off-by: 周晓航 <xiaohang.zhou@freemud.com>
parent
54170d74
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
102 additions
and
64 deletions
+102
-64
shopping-cart-application-service/src/main/java/cn/freemud/handle/CommonFunctionHandle.java
+75
-0
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
+8
-57
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/CalculationCommonService.java
+9
-2
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/CalculationSharingCartService.java
+5
-1
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/CalculationSharingEquallyService.java
+5
-4
No files found.
shopping-cart-application-service/src/main/java/cn/freemud/handle/CommonFunctionHandle.java
0 → 100644
View file @
05fe7c58
package
cn
.
freemud
.
handle
;
import
cn.freemud.entities.dto.console.*
;
import
cn.freemud.entities.vo.ShoppingCartInfoRequestVo
;
import
cn.freemud.enums.CreateOrderType
;
import
cn.freemud.enums.OrderType
;
import
cn.freemud.service.thirdparty.ConsoleApiClient
;
import
com.freemud.application.sdk.api.log.ApiLog
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.util.Objects
;
/**
* @author : xh.Z
* @email : fisherman0510@163.com
* @Date : 2021/7/23 上午11:58
* @description :
*/
@Component
public
class
CommonFunctionHandle
{
@Autowired
private
ConsoleApiClient
consoleApiClient
;
/**
* fisherman 【ID1033456】自提根据模板配置计算餐具包装费
*
* @param shoppingCartInfoRequestVo
* @param newPackAmount
* @return 外卖 true 打包带走 false null 为其他业务问题 不进入需求
*/
public
Long
getPackAmountByStoreConfig
(
ShoppingCartInfoRequestVo
shoppingCartInfoRequestVo
,
Long
newPackAmount
)
{
Boolean
isTakeOut
=
null
;
if
(
Objects
.
equals
(
shoppingCartInfoRequestVo
.
getOrderType
(),
CreateOrderType
.
TAKE_OUT
.
getCode
()))
{
isTakeOut
=
true
;
}
else
if
(
Objects
.
equals
(
shoppingCartInfoRequestVo
.
getReachStoreType
(),
OrderType
.
COLLECT_GOODS
.
getCode
()))
{
isTakeOut
=
false
;
}
ApiLog
.
printLog
(
"自提根据模板配置计算餐具包装费"
,
String
.
valueOf
(
newPackAmount
),
String
.
valueOf
(
isTakeOut
),
null
);
if
(
Objects
.
isNull
(
newPackAmount
)
||
newPackAmount
.
compareTo
(
0L
)
==
0
)
{
return
0L
;
}
if
(
Objects
.
isNull
(
isTakeOut
))
{
return
newPackAmount
;
}
GetStoreMixRequest
request
=
GetStoreMixRequest
.
builder
().
partnerId
(
shoppingCartInfoRequestVo
.
getPartnerId
()).
storeCode
(
shoppingCartInfoRequestVo
.
getShopId
()).
build
();
// 查询 业务设置信息数据
request
.
setQuery
(
QueryFlag
.
builder
().
queryBusinessInfo
(
Boolean
.
TRUE
).
build
());
ConsoleResponseDTO
<
BizDTO
>
responseDTO
=
consoleApiClient
.
getStoreMix
(
request
);
BizDTO
bizVO
=
responseDTO
.
getBizVO
();
if
(
Objects
.
nonNull
(
bizVO
)
&&
Objects
.
nonNull
(
bizVO
.
getBusinessInfo
()))
{
// 查出 有配置 并且有开关 就判断 否则就走 默认值
ExpandFieldsDTO
expandFields
=
bizVO
.
getBusinessInfo
().
getExpandFields
();
if
(
Objects
.
nonNull
(
expandFields
))
{
if
(
isTakeOut
)
{
// 外卖 是否计算 包装费
if
(
Objects
.
nonNull
(
expandFields
.
getDeliveryPackageFeeSwitch
())
&&
ExpandFieldsDTO
.
STR_FALSE
.
equals
(
expandFields
.
getDeliveryPackageFeeSwitch
()))
{
return
0L
;
}
}
else
{
// 打包带走 是否计算包装费
if
(
Objects
.
nonNull
(
expandFields
.
getPickupPackageFeeSwitch
())
&&
ExpandFieldsDTO
.
STR_FALSE
.
equals
(
expandFields
.
getPickupPackageFeeSwitch
()))
{
return
0L
;
}
}
}
}
return
newPackAmount
;
}
}
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/ShoppingCartNewServiceImpl.java
View file @
05fe7c58
...
...
@@ -28,7 +28,6 @@ import cn.freemud.entities.dto.activity.ActivityQueryDto;
import
cn.freemud.entities.dto.activity.ActivityQueryResponseDto
;
import
cn.freemud.entities.dto.calculate.CalculationSharingDiscountRequestDto
;
import
cn.freemud.entities.dto.calculate.CalculationSharingDiscountResponseDto
;
import
cn.freemud.entities.dto.console.*
;
import
cn.freemud.entities.dto.openplatform.WeixinProductRequestDto
;
import
cn.freemud.entities.dto.openplatform.WeixinProductResponseDto
;
import
cn.freemud.entities.dto.shoppingCart.SendPoint
;
...
...
@@ -39,6 +38,7 @@ import cn.freemud.entities.vo.*;
import
cn.freemud.entities.vo.coupon.CouponAvailableCartInfo
;
import
cn.freemud.entities.vo.coupon.CouponAvailableRequestVo
;
import
cn.freemud.enums.*
;
import
cn.freemud.handle.CommonFunctionHandle
;
import
cn.freemud.interceptor.BizServiceException
;
import
cn.freemud.interceptor.ServiceException
;
import
cn.freemud.redis.RedisCache
;
...
...
@@ -208,8 +208,7 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
private
StoreItemAdapter
storeItemAdapter
;
@Autowired
private
ConsoleApiClient
consoleApiClient
;
private
CommonFunctionHandle
commonFunctionHandle
;
/**
* 从微信卡券向购物车中添加商品
...
...
@@ -2157,69 +2156,21 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
||
Objects
.
equals
(
shoppingCartInfoRequestVo
.
getReachStoreType
(),
OrderType
.
EAT_IN
.
getCode
())))
{
shoppingCartGoodsResponseVo
.
setNewPackAmount
(
null
);
}
else
if
((
Objects
.
equals
(
shoppingCartInfoRequestVo
.
getOrderType
(),
CreateOrderType
.
TAKE_OUT
.
getCode
())
||
Objects
.
equals
(
shoppingCartInfoRequestVo
.
getReachStoreType
(),
OrderType
.
COLLECT_GOODS
.
getCode
()))
&&
Objects
.
equals
(
shoppingCartInfoRequestVo
.
getFlag
(),
CouponFlag
.
YES
.
getCode
()))
{
||
Objects
.
equals
(
shoppingCartInfoRequestVo
.
getReachStoreType
(),
OrderType
.
COLLECT_GOODS
.
getCode
())))
{
//fisherman 【ID1033456】自提根据模板配置计算餐具包装费
// 外卖 true 打包带走 false null 为其他业务问题 不进入需求
Boolean
isTakeOut
=
null
;
if
(
Objects
.
equals
(
shoppingCartInfoRequestVo
.
getOrderType
(),
CreateOrderType
.
TAKE_OUT
.
getCode
()))
{
isTakeOut
=
true
;
}
else
if
(
Objects
.
equals
(
shoppingCartInfoRequestVo
.
getReachStoreType
(),
OrderType
.
COLLECT_GOODS
.
getCode
()))
{
isTakeOut
=
false
;
}
Long
packAmount
=
getPackAmountByStoreConfig
(
partnerId
,
storeId
,
shoppingCartGoodsResponseVo
.
getNewPackAmount
(),
isTakeOut
);
Long
packAmount
=
commonFunctionHandle
.
getPackAmountByStoreConfig
(
shoppingCartInfoRequestVo
,
shoppingCartGoodsResponseVo
.
getNewPackAmount
());
shoppingCartGoodsResponseVo
.
setNewPackAmount
(
packAmount
);
if
(
Objects
.
equals
(
shoppingCartInfoRequestVo
.
getFlag
(),
CouponFlag
.
YES
.
getCode
())){
Long
originalTotalAmount
=
shoppingCartGoodsResponseVo
.
getOriginalTotalAmount
()
+
packAmount
;
Long
totalAmount
=
shoppingCartGoodsResponseVo
.
getTotalAmount
()
+
packAmount
;
shoppingCartGoodsResponseVo
.
setOriginalTotalAmount
(
originalTotalAmount
);
shoppingCartGoodsResponseVo
.
setTotalAmount
(
totalAmount
);
}
}
/**
*
* fisherman 【ID1033456】自提根据模板配置计算餐具包装费
* @param partnerId 商户号
* @param storeId 门店号
* @param newPackAmount Shop/ValidateShopProduct 接口返回的包装费
* @param isTakeOut 外卖 true 打包带走 false null 为其他业务问题 不进入需求
* @return
*/
private
Long
getPackAmountByStoreConfig
(
String
partnerId
,
String
storeId
,
Long
newPackAmount
,
Boolean
isTakeOut
)
{
ApiLog
.
printLog
(
"自提根据模板配置计算餐具包装费"
,
String
.
valueOf
(
newPackAmount
),
String
.
valueOf
(
isTakeOut
),
null
);
if
(
Objects
.
isNull
(
newPackAmount
))
{
return
0L
;
}
if
(
Objects
.
isNull
(
isTakeOut
))
{
return
newPackAmount
;
}
GetStoreMixRequest
request
=
GetStoreMixRequest
.
builder
().
partnerId
(
partnerId
).
storeCode
(
storeId
).
build
();
// 查询 业务设置信息数据
request
.
setQuery
(
QueryFlag
.
builder
().
queryBusinessInfo
(
Boolean
.
TRUE
).
build
());
ConsoleResponseDTO
<
BizDTO
>
responseDTO
=
consoleApiClient
.
getStoreMix
(
request
);
BizDTO
bizVO
=
responseDTO
.
getBizVO
();
if
(
Objects
.
nonNull
(
bizVO
)
&&
Objects
.
nonNull
(
bizVO
.
getBusinessInfo
()))
{
// 查出 有配置 并且有开关 就判断 否则就走 默认值
ExpandFieldsDTO
expandFields
=
bizVO
.
getBusinessInfo
().
getExpandFields
();
if
(
Objects
.
nonNull
(
expandFields
))
{
if
(
isTakeOut
)
{
// 外卖 是否计算 包装费
if
(
Objects
.
nonNull
(
expandFields
.
getDeliveryPackageFeeSwitch
())
&&
ExpandFieldsDTO
.
STR_FALSE
.
equals
(
expandFields
.
getDeliveryPackageFeeSwitch
()))
{
return
0L
;
}
}
else
{
// 打包带走 是否计算包装费
if
(
Objects
.
nonNull
(
expandFields
.
getPickupPackageFeeSwitch
())
&&
ExpandFieldsDTO
.
STR_FALSE
.
equals
(
expandFields
.
getPickupPackageFeeSwitch
()))
{
return
0L
;
}
}
}
}
return
newPackAmount
;
}
/**
* 在原价、现价、折扣价上增加第一次使用会员卡的费用
*
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/CalculationCommonService.java
View file @
05fe7c58
...
...
@@ -13,6 +13,7 @@ import cn.freemud.entities.vo.CartGoods;
import
cn.freemud.entities.vo.ShoppingCartGoodsResponseVo
;
import
cn.freemud.entities.vo.ShoppingCartInfoRequestVo
;
import
cn.freemud.enums.*
;
import
cn.freemud.handle.CommonFunctionHandle
;
import
cn.freemud.service.thirdparty.CustomerApplicationClient
;
import
cn.freemud.utils.BeanUtil
;
import
com.alibaba.fastjson.JSON
;
...
...
@@ -60,12 +61,17 @@ public class CalculationCommonService {
@Resource
private
MapperFacade
mapperFacade
;
@Autowired
private
CommonFunctionHandle
commonFunctionHandle
;
/**
* 初始化价格 新算价走了
*/
public
void
initShoppingCart
(
CalculationSharingDiscountResponseDto
.
CalculationDiscountResult
discountResult
,
List
<
CartGoods
>
cartGoodsList
,
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
,
String
couponCode
)
{
,
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
,
String
couponCode
,
ShoppingCartInfoRequestVo
shoppingCartInfoRequestVo
)
{
/**
* 使用促销算价赋值行记录
...
...
@@ -98,7 +104,8 @@ public class CalculationCommonService {
}
shoppingCartGoodsResponseVo
.
setOriginalTotalAmount
(
discountResult
==
null
?
totalOriginalAmount
:
discountResult
.
getOriginalTotalAmount
());
shoppingCartGoodsResponseVo
.
setTotalAmount
(
discountResult
==
null
?
totalAmount
:
discountResult
.
getTotalAmount
());
shoppingCartGoodsResponseVo
.
setNewPackAmount
(
totalPackageAmount
);
//fisherman 【ID1033456】自提根据模板配置计算餐具包装费 新算价一起处理
shoppingCartGoodsResponseVo
.
setNewPackAmount
(
commonFunctionHandle
.
getPackAmountByStoreConfig
(
shoppingCartInfoRequestVo
,
totalPackageAmount
));
// fisehrman 总优惠金额 需要+配送券的优惠金额
if
(
discountResult
==
null
)
{
shoppingCartGoodsResponseVo
.
setTotalDiscountAmount
(
0L
);
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/CalculationSharingCartService.java
View file @
05fe7c58
...
...
@@ -73,7 +73,11 @@ public class CalculationSharingCartService {
/**
* 用促销价格初始化购物车行记录成交价
*/
calculationCommonService
.
initShoppingCart
(
discountResult
,
cartGoodsList
,
shoppingCartGoodsResponseVo
,
couponPromotionVO
!=
null
?
couponPromotionVO
.
getCouponCode
()
:
null
);
calculationCommonService
.
initShoppingCart
(
discountResult
,
cartGoodsList
,
shoppingCartGoodsResponseVo
,
couponPromotionVO
!=
null
?
couponPromotionVO
.
getCouponCode
()
:
null
,
shoppingCartInfoRequestVo
);
if
(
BusinessTypeEnum
.
SAAS_MALL
.
getCode
().
equals
(
menuType
)
&&
null
!=
shoppingCartInfoRequestVo
&&
OrderChannelType
.
SAASMALL
.
getCode
().
equalsIgnoreCase
(
shoppingCartInfoRequestVo
.
getChannelType
()))
{
deliverySharingService
.
mallDeliveryResponse
(
shoppingCartGoodsResponseVo
,
deliveryAmount
,
discountResult
);
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/calculate/CalculationSharingEquallyService.java
View file @
05fe7c58
package
cn
.
freemud
.
service
.
impl
.
calculate
;
import
cn.freemud.constant.ShoppingCartConstant
;
import
cn.freemud.entities.dto.GetMemberCouponListRequestDto
;
import
cn.freemud.entities.dto.UserLoginInfoDto
;
import
cn.freemud.entities.dto.activity.ActivityDiscountsDto
;
import
cn.freemud.entities.dto.activity.ActivityQueryDto
;
...
...
@@ -10,10 +9,8 @@ import cn.freemud.entities.dto.shoppingCart.ShoppingCartGoodsDto;
import
cn.freemud.entities.vo.*
;
import
cn.freemud.enums.ActivityTypeEnum
;
import
cn.freemud.enums.OrderChannelType
;
import
cn.freemud.enums.CouponStatus
;
import
cn.freemud.service.impl.calculate.promotion.*
;
import
com.freemud.sdk.api.assortment.shoppingcart.enums.BusinessTypeEnum
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -77,7 +74,11 @@ public class CalculationSharingEquallyService {
,
ShoppingCartGoodsDto
shoppingCartGoodsDto
,
CreateOrderVo
.
PremiumExchangeActivity
premiumExchangeActivity
)
{
calculationCommonService
.
initShoppingCart
(
discountResult
,
cartGoodsList
,
shoppingCartGoodsResponseVo
,
couponPromotionVO
!=
null
?
couponPromotionVO
.
getCouponCode
()
:
null
);
calculationCommonService
.
initShoppingCart
(
discountResult
,
cartGoodsList
,
shoppingCartGoodsResponseVo
,
couponPromotionVO
!=
null
?
couponPromotionVO
.
getCouponCode
()
:
null
,
shoppingCartInfoRequestVo
);
if
(
BusinessTypeEnum
.
SAAS_MALL
.
getCode
().
equals
(
menuType
)
&&
null
!=
shoppingCartInfoRequestVo
&&
OrderChannelType
.
SAASMALL
.
getCode
().
equalsIgnoreCase
(
shoppingCartInfoRequestVo
.
getChannelType
()))
{
deliverySharingService
.
mallDeliveryResponse
(
shoppingCartGoodsResponseVo
,
deliveryAmount
,
discountResult
);
}
...
...
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