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
cfd1697e
Commit
cfd1697e
authored
Aug 11, 2020
by
ping.wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
税率代码与门店配送费
parent
9e319bbb
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
314 additions
and
55 deletions
+314
-55
assortment-shoppingcart-sdk/pom.xml
+2
-2
assortment-shoppingcart-sdk/src/main/java/com/freemud/sdk/api/assortment/shoppingcart/adapter/ShoppingCartAdapter.java
+3
-0
assortment-shoppingcart-sdk/src/main/java/com/freemud/sdk/api/assortment/shoppingcart/domain/CartGoods.java
+16
-1
shopping-cart-application-service/pom.xml
+2
-2
shopping-cart-application-service/src/main/java/cn/freemud/adapter/ShoppingCartConvertAdapter.java
+4
-2
shopping-cart-application-service/src/main/java/cn/freemud/controller/MCoffeeShoppingCartController.java
+22
-0
shopping-cart-application-service/src/main/java/cn/freemud/entities/dto/shoppingCart/ShoppingCartGoodsDto.java
+2
-2
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/CartGoods.java
+15
-0
shopping-cart-application-service/src/main/java/cn/freemud/enums/ShoppingCartOperationType.java
+49
-0
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/ShoppingCartMCoffeeServiceImpl.java
+41
-19
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/CalculationServiceImpl.java
+35
-27
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/entity/CopyShoppingCartRequestVo.java
+47
-0
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/entity/SwitchShoppingCartRequestVo.java
+76
-0
No files found.
assortment-shoppingcart-sdk/pom.xml
View file @
cfd1697e
...
...
@@ -42,7 +42,7 @@
<dependency>
<groupId>
com.freemud.application.service.sdk
</groupId>
<artifactId>
productcenter-sdk
</artifactId>
<version>
3.6.
4
.SNAPSHOT
</version>
<version>
3.6.
5
.SNAPSHOT
</version>
<scope>
provided
</scope>
</dependency>
<dependency>
...
...
@@ -54,7 +54,7 @@
<dependency>
<groupId>
com.freemud.application.service.sdk
</groupId>
<artifactId>
sdk-common-base
</artifactId>
<version>
1.
4.1-SNAPSHOT
</version>
<version>
1.
5.1.RELEASE
</version>
<scope>
provided
</scope>
</dependency>
<dependency>
...
...
assortment-shoppingcart-sdk/src/main/java/com/freemud/sdk/api/assortment/shoppingcart/adapter/ShoppingCartAdapter.java
View file @
cfd1697e
...
...
@@ -284,6 +284,7 @@ public class ShoppingCartAdapter {
cartGoods
.
setClassificationId
(
spuProduct
.
getCategory
());
cartGoods
.
setClassificationName
(
spuProduct
.
getCategoryName
());
cartGoods
.
setTax
(
spuProduct
.
getTax
());
cartGoods
.
setTaxId
(
spuProduct
.
getTaxId
());
String
skuSpecName
=
""
;
if
(
isSkuProduct
&&
CollectionUtils
.
isNotEmpty
(
skuProduct
.
getSkuSpecValues
()))
{
List
<
String
>
skuSpecValus
=
skuProduct
.
getSkuSpecValues
().
stream
().
map
(
p
->
p
.
getSpecValue
()).
collect
(
Collectors
.
toList
());
...
...
@@ -411,6 +412,8 @@ public class ShoppingCartAdapter {
comboxGoods
.
setWeightType
(
isComboxGoods
?
CommonsConstant
.
WEIGHT_PRODUCT
.
equals
(
productComboType
.
getWeightType
())
:
CommonsConstant
.
WEIGHT_PRODUCT
.
equals
(
groupDetailType
.
getWeightType
()));
comboxGoods
.
setUnit
(
isComboxGoods
?
productComboType
.
getUnit
()
:
groupDetailType
.
getUnit
());
comboxGoods
.
setWeight
(
isComboxGoods
?
productComboType
.
getWeight
()
:
groupDetailType
.
getWeight
());
comboxGoods
.
setTax
(
isComboxGoods
?
productComboType
.
getTax
()
:
groupDetailType
.
getTax
());
comboxGoods
.
setTaxId
(
isComboxGoods
?
productComboType
.
getTaxId
()
:
groupDetailType
.
getTaxId
());
}
private
Map
<
String
,
String
>
getAttributes
(
CartGoods
cartGoods
,
List
<
CartGoods
.
CartGoodsExtra
>
extra
,
List
<
ProductBeanDTO
.
ProductAttributeGroupListBean
>
attributeGroupListBeanList
,
List
<
String
>
invalidGoodsIdList
)
{
...
...
assortment-shoppingcart-sdk/src/main/java/com/freemud/sdk/api/assortment/shoppingcart/domain/CartGoods.java
View file @
cfd1697e
...
...
@@ -158,11 +158,16 @@ public class CartGoods {
private
Integer
memberDiscount
;
/**
* 税率
缓存
* 税率
*/
private
Double
tax
;
/**
* 税率代码
*/
private
String
taxId
;
/**
* 套餐固定商品
*/
private
List
<
ComboxGoods
>
productComboList
;
...
...
@@ -264,6 +269,16 @@ public class CartGoods {
* 配料或属性
*/
private
List
<
CartGoodsExtra
>
extra
;
/**
* 税率
*/
private
Double
tax
;
/**
* 税率代码
*/
private
String
taxId
;
}
@Override
...
...
shopping-cart-application-service/pom.xml
View file @
cfd1697e
...
...
@@ -30,12 +30,12 @@
<dependency>
<groupId>
com.freemud.application.service.sdk
</groupId>
<artifactId>
sdk-common-base
</artifactId>
<version>
1.
3.9-SNAPSHOT
</version>
<version>
1.
5.1.RELEASE
</version>
</dependency>
<dependency>
<groupId>
com.freemud.application.service.sdk
</groupId>
<artifactId>
productcenter-sdk
</artifactId>
<version>
3.
2.RELEASE
</version>
<!-- //3.6.4-SNAPSHOTE -->
<version>
3.
6.5.SNAPSHOT
</version>
<!-- //3.6.4-SNAPSHOTE -->
</dependency>
<dependency>
<groupId>
com.freemud.application.service.sdk
</groupId>
...
...
shopping-cart-application-service/src/main/java/cn/freemud/adapter/ShoppingCartConvertAdapter.java
View file @
cfd1697e
...
...
@@ -84,8 +84,8 @@ public class ShoppingCartConvertAdapter {
public
ShoppingCartGoodsDto
.
CartGoodsDetailDto
convertCartGoods2DetailGoods
(
CartGoods
cartGoods
,
List
<
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
.
ApportionGoods
>
apportionGoodsList
,
Map
<
String
,
String
>
duplicateGoodsMap
)
{
// 设置基础信息
ShoppingCartGoodsDto
.
CartGoodsDetailDto
cartGoodsDetailDto
=
new
ShoppingCartGoodsDto
.
CartGoodsDetailDto
();
cartGoodsDetailDto
.
setTa
sId
(
"1234"
);
cartGoodsDetailDto
.
setTa
s
(
cartGoods
.
getTax
());
cartGoodsDetailDto
.
setTa
xId
(
cartGoods
.
getTaxId
()
);
cartGoodsDetailDto
.
setTa
x
(
cartGoods
.
getTax
());
cartGoodsDetailDto
.
setSpuId
(
cartGoods
.
getSpuId
());
cartGoodsDetailDto
.
setSpuName
(
cartGoods
.
getSpuName
());
cartGoodsDetailDto
.
setSkuId
(
StringUtils
.
isEmpty
(
cartGoods
.
getSkuId
())
?
cartGoods
.
getSpuId
()
:
cartGoods
.
getSkuId
());
...
...
@@ -233,6 +233,8 @@ public class ShoppingCartConvertAdapter {
Integer
tempDiscount
=
0
;
for
(
CartGoods
.
ComboxGoods
comboxGoods
:
comboxGoodsList
)
{
ShoppingCartGoodsDto
.
CartGoodsDetailDto
cartGoodsDetailDto
=
new
ShoppingCartGoodsDto
.
CartGoodsDetailDto
();
cartGoodsDetailDto
.
setTaxId
(
cartGoods
.
getTaxId
());
cartGoodsDetailDto
.
setTax
(
cartGoods
.
getTax
());
cartGoodsDetailDto
.
setSpuId
(
comboxGoods
.
getGoodsId
());
cartGoodsDetailDto
.
setSpuName
(
comboxGoods
.
getSpuName
());
cartGoodsDetailDto
.
setSkuId
(
comboxGoods
.
getGoodsId
());
...
...
shopping-cart-application-service/src/main/java/cn/freemud/controller/MCoffeeShoppingCartController.java
View file @
cfd1697e
...
...
@@ -3,7 +3,9 @@ package cn.freemud.controller;
import
cn.freemud.base.entity.BaseResponse
;
import
cn.freemud.entities.vo.*
;
import
cn.freemud.service.impl.mcoffee.ShoppingCartMCoffeeServiceImpl
;
import
cn.freemud.service.impl.mcoffee.entity.CopyShoppingCartRequestVo
;
import
cn.freemud.service.impl.mcoffee.entity.MCoffeeAddGoodsRequestVo
;
import
cn.freemud.service.impl.mcoffee.entity.SwitchShoppingCartRequestVo
;
import
com.freemud.application.sdk.api.log.ApiAnnotation
;
import
com.freemud.application.sdk.api.log.LogParams
;
import
io.swagger.annotations.Api
;
...
...
@@ -92,4 +94,24 @@ public class MCoffeeShoppingCartController {
}
/**
* 切换点餐方式或者门店
*/
@ApiAnnotation
(
logMessage
=
"switchCartGoods"
)
@PostMapping
(
value
=
"/switchCartGoods"
)
public
BaseResponse
switchCartGoods
(
@Validated
@LogParams
@RequestBody
SwitchShoppingCartRequestVo
request
)
{
return
shoppingCartMCoffeeService
.
switchCartGoods
(
request
);
}
/**
* 再来一单
*/
@ApiAnnotation
(
logMessage
=
"listCartGoods"
)
@PostMapping
(
value
=
"/copyOrder"
)
public
BaseResponse
copyOrder
(
@Validated
@LogParams
@RequestBody
CopyShoppingCartRequestVo
request
)
{
return
shoppingCartMCoffeeService
.
copyOrder
(
request
);
}
}
shopping-cart-application-service/src/main/java/cn/freemud/entities/dto/shoppingCart/ShoppingCartGoodsDto.java
View file @
cfd1697e
...
...
@@ -226,12 +226,12 @@ public class ShoppingCartGoodsDto {
/**
* 税率代码
*/
private
String
ta
s
Id
;
private
String
ta
x
Id
;
/**
* 税率
*/
private
Double
ta
s
;
private
Double
ta
x
;
/**
* 配料或属性
*/
...
...
shopping-cart-application-service/src/main/java/cn/freemud/entities/vo/CartGoods.java
View file @
cfd1697e
...
...
@@ -165,6 +165,11 @@ public class CartGoods {
private
Double
tax
;
/**
* 费率代码
*/
private
String
taxId
;
/**
* 套餐固定商品
*/
private
List
<
ComboxGoods
>
productComboList
;
...
...
@@ -267,6 +272,16 @@ public class CartGoods {
*/
private
Long
productGroupId
;
/**
* 费率
*/
private
Double
tax
;
/**
* 费率代码
*/
private
String
taxId
;
@Override
public
int
hashCode
()
{
StringBuilder
sb
=
new
StringBuilder
();
...
...
shopping-cart-application-service/src/main/java/cn/freemud/enums/ShoppingCartOperationType.java
0 → 100644
View file @
cfd1697e
package
cn
.
freemud
.
enums
;
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @version V1.0
* @Title: ShoppingCartOperationType
* @Package cn.freemud.enums
* @Description:
* @author: ping1.wu
* @date: 2020/8/10 18:09
* @Copyright: 2020 www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/
public
enum
ShoppingCartOperationType
{
ADD_PRODUCT_COUPON
(
1
,
"增加商品券"
),
ADD_SUPER_PRICE_GOODS
(
2
,
"增加超值加购商品"
),
UPDATE3
(
3
,
"确认切换门店"
),
UPDATE4
(
4
,
"切换门店校验"
)
;
private
Integer
code
;
private
String
message
;
ShoppingCartOperationType
(
Integer
code
,
String
message
)
{
this
.
code
=
code
;
this
.
message
=
message
;
}
public
Integer
getCode
()
{
return
code
;
}
public
void
setCode
(
Integer
code
)
{
this
.
code
=
code
;
}
public
String
getMessage
()
{
return
message
;
}
public
void
setMessage
(
String
message
)
{
this
.
message
=
message
;
}
}
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/ShoppingCartMCoffeeServiceImpl.java
View file @
cfd1697e
...
...
@@ -17,7 +17,9 @@ import cn.freemud.service.impl.AssortmentSdkService;
import
cn.freemud.service.impl.FullSubtractionActivityServiceImpl
;
import
cn.freemud.service.impl.mcoffee.calculation.CalculationServiceImpl
;
import
cn.freemud.service.impl.mcoffee.calculation.CouponDiscountCalculation
;
import
cn.freemud.service.impl.mcoffee.entity.CopyShoppingCartRequestVo
;
import
cn.freemud.service.impl.mcoffee.entity.MCoffeeAddGoodsRequestVo
;
import
cn.freemud.service.impl.mcoffee.entity.SwitchShoppingCartRequestVo
;
import
cn.freemud.service.thirdparty.CustomerApplicationClient
;
import
cn.freemud.utils.ResponseUtil
;
import
com.alibaba.fastjson.JSONArray
;
...
...
@@ -77,10 +79,7 @@ public class ShoppingCartMCoffeeServiceImpl {
private
CouponDiscountCalculation
couponDiscountCalculation
;
/**
* 添加商品
*
* @param addShoppingCartGoodsRequestVo
* @return
* 添加商品、超值加购、商品券
*/
public
BaseResponse
addGoods
(
MCoffeeAddGoodsRequestVo
addShoppingCartGoodsRequestVo
)
{
// TODO: 2020/7/21 参数校验
...
...
@@ -113,17 +112,15 @@ public class ShoppingCartMCoffeeServiceImpl {
productIds
.
add
(
Long
.
parseLong
(
goodsId
));
CartGoods
addCartGoods
=
convent2CartGoods
(
addShoppingCartGoodsRequestVo
);
// TODO: 2020/7/21 获取添加商品的详细信息
List
<
ProductBeanDTO
>
productBeanListSpuClass
=
assortmentSdkService
.
getProductsInfoSdk
(
partnerId
,
storeId
,
Collections
.
singletonList
(
spuId2
),
menuType
,
this
.
shoppingCartBaseService
);
// 获取添加商品的详细信息
List
<
ProductBeanDTO
>
productBeanListSpuClass
=
assortmentSdkService
.
getProductsInfoSdk
(
partnerId
,
storeId
,
Collections
.
singletonList
(
spuId2
),
menuType
,
this
.
shoppingCartBaseService
);
// TODO: 2020/7/21 查询购物车缓存
// 注意,围餐和点餐redis数据结构不一样
// 查询购物车缓存
List
<
CartGoods
>
oldCartGoodsList
=
assortmentSdkService
.
getShoppingCart
(
partnerId
,
storeId
,
userId
,
null
,
null
,
shoppingCartBaseService
);
if
(
CollectionUtils
.
isEmpty
(
oldCartGoodsList
))
{
oldCartGoodsList
=
new
ArrayList
<>();
}
//商品券已添加
//商品券已添加
情况校验
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
=
checkGoodsCoupon
(
oldCartGoodsList
,
operationType
,
couponCode
);
setClassificationAndPrice
(
addCartGoods
,
productBeanListSpuClass
);
//查询多个商品库存信息
...
...
@@ -137,14 +134,14 @@ public class ShoppingCartMCoffeeServiceImpl {
setToastMsgIfNotExist
(
shoppingCartGoodsResponseVo
,
ShoppingCartConstant
.
HAS_GOODS_COUPON_WHEN_ADD_SPECIAL_GOODS
);
}
//
TODO: 2020/7/21
购物车数据更新(保存商品原价)
// 购物车数据更新(保存商品原价)
List
<
CartGoods
>
newCartGoods
=
updateCartGoodsLegal
(
partnerId
,
storeId
,
orderType
,
tableNumber
,
menuType
,
userId
,
addCartGoods
,
shoppingCartGoodsResponseVo
,
oldCartGoodsList
);
//
TODO: 2020/7/21
促销活动等价格计算
// 促销活动等价格计算
calculationService
.
updateShoppingCartGoodsDiscount
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
,
assortmentCustomerInfoVo
.
isMemberPaid
(),
menuType
,
receiveId
,
null
,
newCartGoods
,
coupons
,
new
ArrayList
<>(),
shoppingCartGoodsResponseVo
);
//
TODO: 2020/7/21
返回购物车数据
// 返回购物车数据
setAddAndUpdateResponse
(
shoppingCartGoodsResponseVo
,
newCartGoods
,
null
,
ShoppingCartConstant
.
ADD_AND_UPDATE
,
null
);
return
ResponseUtil
.
success
(
shoppingCartGoodsResponseVo
);
...
...
@@ -155,7 +152,7 @@ public class ShoppingCartMCoffeeServiceImpl {
if
(
operationType
!=
null
&&
operationType
==
1
&&
StringUtils
.
isBlank
(
couponCode
)){
throw
new
ServiceException
(
ResponseResult
.
PARAMETER_MISSING
,
"商品券券号为空"
);
}
if
(
CollectionUtils
.
isEmpty
(
oldCartGoodsList
)
&&
StringUtils
.
isNotBlank
(
couponCode
)){
if
(
CollectionUtils
.
isEmpty
(
oldCartGoodsList
)
&&
operationType
!=
null
&&
operationType
==
1
&&
StringUtils
.
isNotBlank
(
couponCode
)){
throw
new
ServiceException
(
ResponseResult
.
PARAMETER_MISSING
,
"请先添加商品再使用商品券"
);
}
List
<
ActivityCalculationDiscountRequestDto
.
CalculationDiscountCoupon
>
coupons
=
new
ArrayList
<>();
...
...
@@ -364,6 +361,9 @@ public class ShoppingCartMCoffeeServiceImpl {
}
/**
* 去支付使用
*/
public
BaseResponse
<
ShoppingCartGoodsDto
>
getShoppingCartGoods
(
GetShoppingCartGoodsApportionRequestVo
requestVo
)
{
ShoppingCartInfoRequestVo
shoppingCartInfoRequestVo
=
requestVo
.
getShoppingCartInfoRequestVo
();
CreateOrderVo
.
PremiumExchangeActivity
premiumExchangeActivity
=
requestVo
.
getPremiumExchangeActivity
();
...
...
@@ -430,6 +430,30 @@ public class ShoppingCartMCoffeeServiceImpl {
return
ResponseUtil
.
success
(
shoppingCartGoodsDto
);
}
/**
* 切换点餐方式或者门店
*/
public
BaseResponse
switchCartGoods
(
SwitchShoppingCartRequestVo
requestVo
)
{
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
=
new
ShoppingCartGoodsResponseVo
();
String
jsonString
=
JSONObject
.
toJSONString
(
requestVo
);
ShoppingCartInfoRequestVo
shoppingCartInfoRequestVo
=
JSONObject
.
parseObject
(
jsonString
,
ShoppingCartInfoRequestVo
.
class
);
return
getGoodsList
(
shoppingCartInfoRequestVo
);
// return ResponseUtil.success(shoppingCartGoodsResponseVo);
}
/**
* 再来一单
*/
public
BaseResponse
copyOrder
(
CopyShoppingCartRequestVo
requestVo
)
{
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
=
new
ShoppingCartGoodsResponseVo
();
return
ResponseUtil
.
success
(
shoppingCartGoodsResponseVo
);
}
private
void
packgeAdditional
(
ShoppingCartInfoRequestVo
shoppingCartInfoRequestVo
,
CreateOrderVo
.
PremiumExchangeActivity
premiumExchangeActivity
)
{
ArrayList
<
ShoppingCartInfoRequestVo
.
SendGoods
>
senGoods
=
new
ArrayList
<>();
...
...
@@ -651,14 +675,10 @@ public class ShoppingCartMCoffeeServiceImpl {
cartGoods
.
setClassificationName
(
productBeanListSpuClass
.
get
(
0
).
getCategoryName
());
if
(
StringUtils
.
isBlank
(
productBeanListSpuClass
.
get
(
0
).
getCustomerCode
())){
productBeanListSpuClass
.
get
(
0
).
setCustomerCode
(
"12345"
);
cartGoods
.
setCustomerCode
(
productBeanListSpuClass
.
get
(
0
).
getCustomerCode
());
}
if
(
StringUtils
.
isBlank
(
productBeanListSpuClass
.
get
(
0
).
getCustomerCode
())){
throw
new
ServiceException
(
ResponseResult
.
PARAMETER_MISSING
,
"商品键位编号为空"
);
}
//超值加购商品赋值
if
(
ObjectUtils
.
equals
(
GoodsTypeEnum
.
REDUCE_PRICE_GOODS
.
getGoodsType
(),
cartGoods
.
getGoodsType
())){
cartGoods
.
setOriginalPrice
(
productBeanListSpuClass
.
get
(
0
).
getOriginalPrice
());
cartGoods
.
setFinalPrice
(
productBeanListSpuClass
.
get
(
0
).
getFinalPrice
());
...
...
@@ -670,6 +690,8 @@ public class ShoppingCartMCoffeeServiceImpl {
cartGoods
.
setSkuName
(
productBeanListSpuClass
.
get
(
0
).
getName
());
cartGoods
.
setPic
(
productBeanListSpuClass
.
get
(
0
).
getPicture
());
cartGoods
.
setStockLimit
(
productBeanListSpuClass
.
get
(
0
).
getStockLimit
()
==
1
);
cartGoods
.
setTax
(
productBeanListSpuClass
.
get
(
0
).
getTax
());
cartGoods
.
setTaxId
(
productBeanListSpuClass
.
get
(
0
).
getTaxId
());
}
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/CalculationServiceImpl.java
View file @
cfd1697e
...
...
@@ -22,7 +22,9 @@ import com.freemud.application.sdk.api.membercenter.request.QueryReceiveAddressR
import
com.freemud.application.sdk.api.membercenter.response.QueryReceiveAddressResponse
;
import
com.freemud.application.sdk.api.membercenter.service.MemberCenterService
;
import
com.freemud.application.sdk.api.storecenter.request.QueryDeliveryRequest
;
import
com.freemud.application.sdk.api.storecenter.request.StoreInfoRequest
;
import
com.freemud.application.sdk.api.storecenter.response.QueryDeliverDetailResponse
;
import
com.freemud.application.sdk.api.storecenter.response.StoreResponse
;
import
com.freemud.application.sdk.api.storecenter.service.StoreCenterService
;
import
com.freemud.sdk.api.assortment.shoppingcart.enums.BusinessTypeEnum
;
import
org.apache.commons.collections4.CollectionUtils
;
...
...
@@ -83,16 +85,11 @@ public class CalculationServiceImpl {
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
();
}
Long
deliveryAmount
=
calculateDeliveryAmount
(
receiveId
,
partnerId
,
storeId
,
menuType
);
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscount
=
getCalculationDiscount
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
,
isMember
,
menuType
,
deliveryAmount
,
cartGoodsList
,
coupons
,
sendGoodsList
);
updateDiscount
(
calculationDiscount
,
cartGoodsList
,
shoppingCartGoodsResponseVo
);
updateDiscount
(
calculationDiscount
,
cartGoodsList
,
shoppingCartGoodsResponseVo
,
deliveryAmount
);
//满减
ActivityQueryDto
activityQueryDto
=
fullPromotionCalculation
.
getActivityQueryDto
(
partnerId
,
storeId
,
userId
,
appId
,
orderType
);
fullPromotionCalculation
.
updateShoppingCartGoodsDiscount
(
activityQueryDto
,
calculationDiscount
,
cartGoodsList
,
shoppingCartGoodsResponseVo
);
...
...
@@ -120,9 +117,6 @@ public class CalculationServiceImpl {
addCalculationDiscountGoods
(
calculationDiscountGoodsList
,
cartGoods
.
getCustomerCode
(),
cartGoods
.
getGoodsId
(),
cartGoods
.
getQty
(),
cartGoods
.
getFinalPrice
(),
cartGoods
.
getMemberDiscount
(),
cartGoods
);
}
if
(
BusinessTypeEnum
.
SAAS_DELIVERY
.
getCode
().
equals
(
menuType
))
{
deliveryAmount
=
null
;
}
// 当加价购商品不为空时
if
(
CollectionUtils
.
isNotEmpty
(
sendGoodsList
))
{
for
(
ShoppingCartInfoRequestVo
.
SendGoods
sendGoods
:
sendGoodsList
)
{
...
...
@@ -284,10 +278,10 @@ public class CalculationServiceImpl {
/**
* 配送金额
*/
private
QueryDeliverDetailResponse
calculateDeliveryAmount
(
String
receiveId
,
String
partnerId
,
String
storeId
,
String
wxappid
)
{
if
(
StringUtils
.
isBlank
(
receiveId
))
{
return
null
;
private
Long
calculateDeliveryAmount
(
String
receiveId
,
String
partnerId
,
String
storeId
,
String
menuType
)
{
Long
deliveryAmount
=
0
l
;
if
(
StringUtils
.
isBlank
(
receiveId
)
&&
!
BusinessTypeEnum
.
SAAS_DELIVERY
.
getCode
().
equals
(
menuType
)
)
{
return
deliveryAmount
;
}
String
trackingNo
=
LogThreadLocal
.
getTrackingNo
();
...
...
@@ -298,20 +292,29 @@ public class CalculationServiceImpl {
throw
new
ServiceException
(
ResponseResult
.
USER_GETRECEIVEADDRESS_ERROR
);
}
QueryDeliveryRequest
queryDeliveryRequest
=
new
QueryDeliveryRequest
();
queryDeliveryRequest
.
setPartnerId
(
partnerId
);
queryDeliveryRequest
.
setStoreCode
(
storeId
);
queryDeliveryRequest
.
setUserLatitude
(
queryReceiveAddressResponse
.
getData
().
getLatitude
());
queryDeliveryRequest
.
setUserLongitude
(
queryReceiveAddressResponse
.
getData
().
getLongitude
());
com
.
freemud
.
application
.
sdk
.
api
.
base
.
BaseResponse
<
QueryDeliverDetailResponse
>
queryDeliverDetailResponse
=
storeCenterService
.
queryDeliverDetail
(
queryDeliveryRequest
,
trackingNo
);
if
(
queryDeliverDetailResponse
==
null
||
!
ResponseResult
.
SUCCESS
.
getCode
().
equals
(
queryDeliverDetailResponse
.
getCode
())
||
queryDeliverDetailResponse
.
getData
()
==
null
)
{
// QueryDeliveryRequest queryDeliveryRequest = new QueryDeliveryRequest();
// queryDeliveryRequest.setPartnerId(partnerId);
// queryDeliveryRequest.setStoreCode(storeId);
// queryDeliveryRequest.setUserLatitude(queryReceiveAddressResponse.getData().getLatitude());
// queryDeliveryRequest.setUserLongitude(queryReceiveAddressResponse.getData().getLongitude());
// com.freemud.application.sdk.api.base.BaseResponse<QueryDeliverDetailResponse> queryDeliverDetailResponse = storeCenterService.queryDeliverDetail(queryDeliveryRequest, trackingNo);
StoreInfoRequest
storeInfoRequest
=
new
StoreInfoRequest
();
storeInfoRequest
.
setPartnerId
(
partnerId
);
storeInfoRequest
.
setStoreCode
(
storeId
);
StoreResponse
storeInfo
=
storeCenterService
.
getStoreInfo
(
storeInfoRequest
,
trackingNo
);
if
(
storeInfo
==
null
||
storeInfo
.
getStatusCode
()
!=
100
||
storeInfo
.
getBizVO
()
==
null
)
{
throw
new
ServiceException
(
ResponseResult
.
STORE_ITEM_NOT_DELIVERY
);
}
if
(
queryDeliverDetailResponse
.
getData
().
getDeliveryAmount
()
==
null
)
{
throw
new
ServiceException
(
ResponseResult
.
STORE_DELIVERY_AMOUNT_ERROR
);
}
return
queryDeliverDetailResponse
.
getData
();
// if (storeInfo.getBizVO().getDeliveryPrice() == 0) {
// throw new ServiceException(ResponseResult.STORE_DELIVERY_AMOUNT_ERROR);
// }
// Double deliveryPrice = storeInfo.getBizVO().getDeliveryPrice();
// deliveryAmount = deliveryPrice.longValue();
deliveryAmount
=
700
l
;
return
deliveryAmount
;
}
...
...
@@ -384,7 +387,7 @@ public class CalculationServiceImpl {
}
private
void
updateDiscount
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscount
,
List
<
CartGoods
>
cartGoodsList
,
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
)
{
private
void
updateDiscount
(
ActivityCalculationDiscountResponseDto
.
CalculationDiscountResult
calculationDiscount
,
List
<
CartGoods
>
cartGoodsList
,
ShoppingCartGoodsResponseVo
shoppingCartGoodsResponseVo
,
Long
deliveryAmount
)
{
long
totalOriginalAmount
=
0L
;
long
totalAmount
=
0L
;
long
totalPackgeAmount
=
0L
;
...
...
@@ -404,6 +407,11 @@ public class CalculationServiceImpl {
shoppingCartGoodsResponseVo
.
setTotalAmount
(
calculationDiscount
==
null
?
totalAmount
:
calculationDiscount
.
getTotalAmount
());
shoppingCartGoodsResponseVo
.
setNewPackAmount
(
totalPackgeAmount
);
shoppingCartGoodsResponseVo
.
setTotalDiscountAmount
(
calculationDiscount
==
null
?
0L
:
calculationDiscount
.
getTotalDiscountAmount
());
if
(
calculationDiscount
!=
null
&&
calculationDiscount
.
getDeliveryAmount
()
==
null
){
shoppingCartGoodsResponseVo
.
setDiscountDeliveryAmount
(
deliveryAmount
);
shoppingCartGoodsResponseVo
.
setOriginalTotalAmount
(
shoppingCartGoodsResponseVo
.
getOriginalTotalAmount
()
+
deliveryAmount
);
shoppingCartGoodsResponseVo
.
setTotalAmount
(
shoppingCartGoodsResponseVo
.
getTotalAmount
()
+
deliveryAmount
);
}
}
}
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/entity/CopyShoppingCartRequestVo.java
0 → 100644
View file @
cfd1697e
package
cn
.
freemud
.
service
.
impl
.
mcoffee
.
entity
;
import
lombok.Data
;
import
org.hibernate.validator.constraints.NotEmpty
;
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @version V1.0
* @Title: CopyShoppingCartRequestVo
* @Package cn.freemud.service.impl.mcoffee.entity
* @Description:
* @author: ping1.wu
* @date: 2020/8/10 17:13
* @Copyright: 2020 www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/
@Data
public
class
CopyShoppingCartRequestVo
{
@NotEmpty
(
message
=
"sessionId不能为空"
)
private
String
sessionId
;
/**
* 商户Id
*/
@NotEmpty
(
message
=
"partnerId不能为空"
)
private
String
partnerId
;
/**
* 微信appId
*/
@NotEmpty
(
message
=
"appId不能为空"
)
private
String
appId
;
/**
* 门店Id
*/
// @NotEmpty(message = "shopId不能为空")
private
String
shopId
;
/**
* 订单号
*/
@NotEmpty
(
message
=
"orderId不能为空"
)
private
String
orderId
;
}
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/entity/SwitchShoppingCartRequestVo.java
0 → 100644
View file @
cfd1697e
package
cn
.
freemud
.
service
.
impl
.
mcoffee
.
entity
;
import
cn.freemud.entities.vo.ShoppingCartInfoRequestVo
;
import
lombok.Data
;
import
org.hibernate.validator.constraints.NotEmpty
;
import
java.util.List
;
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @version V1.0
* @Title: SwitchShoppingCartRequestVo
* @Package cn.freemud.service.impl.mcoffee.entity
* @Description:
* @author: ping1.wu
* @date: 2020/8/10 17:12
* @Copyright: 2020 www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/
@Data
public
class
SwitchShoppingCartRequestVo
{
@NotEmpty
(
message
=
"sessionId不能为空"
)
private
String
sessionId
;
@NotEmpty
(
message
=
"appId不能为空"
)
private
String
appId
;
/**
* 商户Id
*/
@NotEmpty
(
message
=
"partnerId不能为空"
)
private
String
partnerId
;
/**
* 门店Id
*/
@NotEmpty
(
message
=
"shopId不能为空"
)
private
String
shopId
;
/**
* 下单类型 CreateOrderType 外卖、到店、商城
*/
private
Integer
orderType
;
/**
* 渠道类型 OrderChannelType
*/
private
String
channelType
;
/**
* 优惠券code
*/
private
String
couponCode
;
/**
* 优惠券对应的活动号
*/
private
String
activityCode
;
/**
* 到店类型 orderType 传1的时候 如果reachStoreTyp为空转成订单类型4 如果不为空存储4(打包带走)和5(店内就餐)
*/
private
Integer
reachStoreType
;
/**
* 收货地址ID、svc卡支付外卖订单必传
*/
private
String
receiveId
;
/**
* 业务类型
*/
private
String
menuType
;
}
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