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
7dbeb6b9
Commit
7dbeb6b9
authored
Jul 16, 2020
by
huiyang.chen
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature-2020/6/29-1.9.29-围餐-会阳' into qa
parents
41f816f8
2307f7ce
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
98 additions
and
30 deletions
+98
-30
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/service/order/OrderCenterSdkServiceImpl.java
+15
-0
order-application-service/src/main/java/cn/freemud/adapter/OrderAdapter.java
+6
-0
order-application-service/src/main/java/cn/freemud/adapter/PromotionAdapter.java
+29
-8
order-application-service/src/main/java/cn/freemud/service/IPromotionService.java
+1
-1
order-application-service/src/main/java/cn/freemud/service/impl/ActivityCalculationDiscountService.java
+13
-7
order-application-service/src/main/java/cn/freemud/service/impl/CouponPromotionService.java
+1
-1
order-application-service/src/main/java/cn/freemud/service/impl/CustomerScoreService.java
+1
-1
order-application-service/src/main/java/cn/freemud/service/impl/DefaultPromotionService.java
+2
-2
order-application-service/src/main/java/cn/freemud/service/impl/EncircleOrderServiceImpl.java
+3
-2
order-application-service/src/main/java/cn/freemud/service/impl/FullPromotionService.java
+1
-1
order-application-service/src/main/java/cn/freemud/service/impl/OrderCommonService.java
+7
-0
order-application-service/src/main/java/cn/freemud/service/impl/OrderServiceImpl.java
+2
-2
order-application-service/src/main/java/cn/freemud/service/impl/SetMealPromotionService.java
+2
-2
order-application-service/src/main/java/cn/freemud/service/impl/TimeSalePromotionService.java
+15
-3
No files found.
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/service/order/OrderCenterSdkServiceImpl.java
View file @
7dbeb6b9
...
@@ -265,6 +265,17 @@ public class OrderCenterSdkServiceImpl implements OrderCenterSdkService {
...
@@ -265,6 +265,17 @@ public class OrderCenterSdkServiceImpl implements OrderCenterSdkService {
return
BaseOrderResponse
.
getErrorBaseOrderResponse
(
couponRedeemResponseBaseResponse
.
getCode
(),
"优惠券核销失败,请重试"
);
return
BaseOrderResponse
.
getErrorBaseOrderResponse
(
couponRedeemResponseBaseResponse
.
getCode
(),
"优惠券核销失败,请重试"
);
}
}
}
}
// 扣减积分,扣减失败冲正积分返回错误
UserScoreRequest
userScoreRequest
=
orderSdkAdapter
.
convent2UserScoreRequest
(
orderBean
,
accounts
,
true
);
if
(
userScoreRequest
!=
null
)
{
BaseResponse
userScoreResponse
=
memberScoreService
.
useScore
(
userScoreRequest
,
""
);
if
(!
ObjectUtils
.
equals
(
RESPONSE_SUCCESS_STR
,
userScoreResponse
.
getCode
()))
{
//失败异步冲正库存,取消订单
backOrdersNotifyActivity
(
orderBean
,
mqMessageRequest
.
getBackOrdersNotifyActivityQueue
(),
mqMessageRequest
.
getBackOrdersNotifyActivityExchange
());
return
BaseOrderResponse
.
getErrorBaseOrderResponse
(
userScoreResponse
.
getCode
(),
"积分不足"
);
}
}
return
BaseOrderResponse
.
getErrorBaseOrderResponse
(
RESPONSE_SUCCESS_STR
,
""
);
return
BaseOrderResponse
.
getErrorBaseOrderResponse
(
RESPONSE_SUCCESS_STR
,
""
);
}
}
...
@@ -1206,6 +1217,10 @@ public class OrderCenterSdkServiceImpl implements OrderCenterSdkService {
...
@@ -1206,6 +1217,10 @@ public class OrderCenterSdkServiceImpl implements OrderCenterSdkService {
}
}
if
(
AssortmentSdkUpdateOrderProductInfoRequest
.
OpUpdateOrderItemEnum
.
updatePrePayPrice
==
updateOrderProductInfoRequest
.
getOpUpdateOrderItemEnum
())
{
if
(
AssortmentSdkUpdateOrderProductInfoRequest
.
OpUpdateOrderItemEnum
.
updatePrePayPrice
==
updateOrderProductInfoRequest
.
getOpUpdateOrderItemEnum
())
{
// 围餐订单的创建不一定是付款人,需要重新赋值
if
(
OrderClientType
.
WAI_MEAL
.
getIndex
()
==
Integer
.
valueOf
(
queryOrderByIdResponse
.
getData
().
getOrderClient
()))
{
queryOrderByIdResponse
.
getData
().
setUserId
(
updateOrderProductInfoRequest
.
getUserId
());
}
BaseOrderResponse
baseOrderResponse
=
this
.
updateWcStockAndScore
(
queryOrderByIdResponse
.
getData
(),
orderItemListByRequest
,
updateOrderProductInfoRequest
.
getActivityUpdateStockRequest
(),
updateOrderProductInfoRequest
.
getAccounts
(),
BaseOrderResponse
baseOrderResponse
=
this
.
updateWcStockAndScore
(
queryOrderByIdResponse
.
getData
(),
orderItemListByRequest
,
updateOrderProductInfoRequest
.
getActivityUpdateStockRequest
(),
updateOrderProductInfoRequest
.
getAccounts
(),
updateOrderProductInfoRequest
.
getMqMessageRequest
(),
updateOrderProductInfoRequest
.
getMenuType
());
updateOrderProductInfoRequest
.
getMqMessageRequest
(),
updateOrderProductInfoRequest
.
getMenuType
());
if
(!
Objects
.
equals
(
baseOrderResponse
.
getErrcode
(),
RESPONSE_SUCCESS
))
{
if
(!
Objects
.
equals
(
baseOrderResponse
.
getErrcode
(),
RESPONSE_SUCCESS
))
{
...
...
order-application-service/src/main/java/cn/freemud/adapter/OrderAdapter.java
View file @
7dbeb6b9
...
@@ -2425,6 +2425,10 @@ public class OrderAdapter {
...
@@ -2425,6 +2425,10 @@ public class OrderAdapter {
for
(
ShoppingCartGoodsDto
.
CartGoodsDetailDto
cartGoodsDetailDto
:
cartGoodsDetailDtos
)
{
for
(
ShoppingCartGoodsDto
.
CartGoodsDetailDto
cartGoodsDetailDto
:
cartGoodsDetailDtos
)
{
Integer
qty
=
cartGoodsDetailDto
.
getQty
();
Integer
qty
=
cartGoodsDetailDto
.
getQty
();
if
(
qty
>
0
)
{
if
(
qty
>
0
)
{
// 当存在sku是取sku,不取spu
if
(
StringUtils
.
isNotEmpty
(
cartGoodsDetailDto
.
getSkuId
())){
cartGoodsDetailDto
.
setSpuId
(
cartGoodsDetailDto
.
getSkuId
());
}
CreateOrderProductRequest
createOrderProductDto
=
convent2OrderProduct
(
cartGoodsDetailDto
);
CreateOrderProductRequest
createOrderProductDto
=
convent2OrderProduct
(
cartGoodsDetailDto
);
createOrderProductDto
.
setIgnoreProductPrice
(
1
);
createOrderProductDto
.
setIgnoreProductPrice
(
1
);
createOrderProductRequests
.
add
(
createOrderProductDto
);
createOrderProductRequests
.
add
(
createOrderProductDto
);
...
@@ -2511,6 +2515,7 @@ public class OrderAdapter {
...
@@ -2511,6 +2515,7 @@ public class OrderAdapter {
}
}
if
(
shoppingCartGoodsResponse
!=
null
)
{
Long
scoreReduceAmount
=
shoppingCartGoodsResponse
.
getScoreReduceAmount
()
!=
null
?
shoppingCartGoodsResponse
.
getScoreReduceAmount
()
:
0
;
Long
scoreReduceAmount
=
shoppingCartGoodsResponse
.
getScoreReduceAmount
()
!=
null
?
shoppingCartGoodsResponse
.
getScoreReduceAmount
()
:
0
;
if
(
scoreReduceAmount
>
0
&&
CustomerScoreConstant
.
SUBSTRACT
.
getValue
().
equals
(
createReserveOrderVo
.
getUseCustomerScore
()))
{
if
(
scoreReduceAmount
>
0
&&
CustomerScoreConstant
.
SUBSTRACT
.
getValue
().
equals
(
createReserveOrderVo
.
getUseCustomerScore
()))
{
Integer
reduceScore
=
shoppingCartGoodsResponse
.
getReduceScore
()
!=
null
?
shoppingCartGoodsResponse
.
getReduceScore
().
intValue
()
:
0
;
Integer
reduceScore
=
shoppingCartGoodsResponse
.
getReduceScore
()
!=
null
?
shoppingCartGoodsResponse
.
getReduceScore
().
intValue
()
:
0
;
...
@@ -2523,6 +2528,7 @@ public class OrderAdapter {
...
@@ -2523,6 +2528,7 @@ public class OrderAdapter {
.
build
();
.
build
();
sdkUpdateOrderProductInfoRequest
.
getAccounts
().
add
(
createOrderAccountDto
);
sdkUpdateOrderProductInfoRequest
.
getAccounts
().
add
(
createOrderAccountDto
);
}
}
}
// Long cardOriginalAmount = shoppingCartGoodsDto.getCardOriginalAmount() != null ? shoppingCartGoodsDto.getCardOriginalAmount() : 0L;
// Long cardOriginalAmount = shoppingCartGoodsDto.getCardOriginalAmount() != null ? shoppingCartGoodsDto.getCardOriginalAmount() : 0L;
// if (cardOriginalAmount > 0) {
// if (cardOriginalAmount > 0) {
// CreateOrderAccountRequest createOrderAccountDto = CreateOrderAccountRequest.builder()
// CreateOrderAccountRequest createOrderAccountDto = CreateOrderAccountRequest.builder()
...
...
order-application-service/src/main/java/cn/freemud/adapter/PromotionAdapter.java
View file @
7dbeb6b9
...
@@ -32,16 +32,23 @@ import java.util.stream.Collectors;
...
@@ -32,16 +32,23 @@ import java.util.stream.Collectors;
*/
*/
public
class
PromotionAdapter
{
public
class
PromotionAdapter
{
public
static
ShoppingCartGoodsResponse
.
CartGoodsDetailDto
convertCartGoods2DetailGoods
(
OrderBeanRequest
.
ProductBean
orderProductBean
,
int
originalDiscountAmount
,
List
<
CalculationApportionGoodsDto
>
apportionGoodsList
,
Map
<
String
,
String
>
duplicateGoodsMap
)
{
public
static
ShoppingCartGoodsResponse
.
CartGoodsDetailDto
convertCartGoods2DetailGoods
(
OrderBeanRequest
.
ProductBean
orderProductBean
,
int
originalDiscountAmount
,
List
<
CalculationApportionGoodsDto
>
apportionGoodsList
,
Map
<
String
,
String
>
duplicateGoodsMap
,
Boolean
isApportion
)
{
Integer
totalDiscount
=
originalDiscountAmount
;
Integer
totalDiscount
=
originalDiscountAmount
;
List
<
CalculationApportionGoodsDto
>
apportionGoodsByGoodsId
=
apportionGoodsList
.
stream
().
filter
(
a
->
ObjectUtils
.
equals
(
orderProductBean
.
getProductId
(),
a
.
getGoodsId
())).
collect
(
Collectors
.
toList
());
List
<
CalculationApportionGoodsDto
>
apportionGoodsByGoodsId
=
apportionGoodsList
.
stream
().
filter
(
a
->
ObjectUtils
.
equals
(
orderProductBean
.
getProductId
(),
a
.
getGoodsId
())).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isNotEmpty
(
apportionGoodsByGoodsId
))
{
if
(
CollectionUtils
.
isNotEmpty
(
apportionGoodsByGoodsId
))
{
Long
discountPrice
=
0L
;
Long
discountPrice
=
0L
;
int
goodsTotalQty
=
apportionGoodsList
.
stream
().
mapToInt
(
CalculationApportionGoodsDto:
:
getGoodsQuantity
).
sum
();
int
goodsTotalQty
=
apportionGoodsList
.
stream
().
mapToInt
(
CalculationApportionGoodsDto:
:
getGoodsQuantity
).
sum
();
for
(
CalculationApportionGoodsDto
apportionGoods
:
apportionGoodsByGoodsId
)
{
for
(
CalculationApportionGoodsDto
apportionGoods
:
apportionGoodsByGoodsId
)
{
if
(
isApportion
)
{
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_2
.
getCode
(),
d
.
getActivityType
())
&&
ObjectUtils
.
notEqual
(
ActivityTypeEnum
.
TYPE_104
.
getCode
(),
d
.
getActivityType
())
&&
ObjectUtils
.
notEqual
(
ActivityTypeEnum
.
TYPE_2
.
getCode
(),
d
.
getActivityType
())
).
mapToLong
(
t
->
t
.
getActivityApportionAmount
()
*
apportionGoods
.
getGoodsQuantity
()).
sum
()
*
orderProductBean
.
getNumber
()
/
goodsTotalQty
;
).
mapToLong
(
t
->
t
.
getActivityApportionAmount
()
*
apportionGoods
.
getGoodsQuantity
()).
sum
()
*
orderProductBean
.
getNumber
()
/
goodsTotalQty
;
}
else
{
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_2
.
getCode
(),
d
.
getActivityType
())
&&
ObjectUtils
.
notEqual
(
ActivityTypeEnum
.
TYPE_12
.
getCode
(),
d
.
getActivityType
())
&&
ObjectUtils
.
notEqual
(
ActivityTypeEnum
.
TYPE_3
.
getCode
(),
d
.
getActivityType
())
).
mapToLong
(
t
->
t
.
getActivityApportionAmount
()
*
apportionGoods
.
getGoodsQuantity
()).
sum
()
*
orderProductBean
.
getNumber
()
/
goodsTotalQty
;
}
}
}
String
currentGoodsIdMap
=
duplicateGoodsMap
.
get
(
orderProductBean
.
getProductId
());
String
currentGoodsIdMap
=
duplicateGoodsMap
.
get
(
orderProductBean
.
getProductId
());
if
(
currentGoodsIdMap
!=
null
)
{
if
(
currentGoodsIdMap
!=
null
)
{
...
@@ -54,9 +61,16 @@ public class PromotionAdapter {
...
@@ -54,9 +61,16 @@ public class PromotionAdapter {
//最后一行
//最后一行
Long
totalDiscountAmount
=
0L
;
Long
totalDiscountAmount
=
0L
;
for
(
CalculationApportionGoodsDto
apportionGoods
:
apportionGoodsByGoodsId
)
{
for
(
CalculationApportionGoodsDto
apportionGoods
:
apportionGoodsByGoodsId
)
{
if
(
isApportion
)
{
totalDiscountAmount
+=
apportionGoods
.
getApportionDetails
().
stream
().
filter
(
d
->
ObjectUtils
.
notEqual
(
ActivityTypeEnum
.
TYPE_32
.
getCode
(),
d
.
getActivityType
())
totalDiscountAmount
+=
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_2
.
getCode
(),
d
.
getActivityType
())
&&
ObjectUtils
.
notEqual
(
ActivityTypeEnum
.
TYPE_104
.
getCode
(),
d
.
getActivityType
())
&&
ObjectUtils
.
notEqual
(
ActivityTypeEnum
.
TYPE_2
.
getCode
(),
d
.
getActivityType
())
).
mapToLong
(
t
->
t
.
getActivityApportionAmount
()
*
apportionGoods
.
getGoodsQuantity
()).
sum
();
).
mapToLong
(
t
->
t
.
getActivityApportionAmount
()
*
apportionGoods
.
getGoodsQuantity
()).
sum
();
}
else
{
totalDiscountAmount
+=
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
())
&&
ObjectUtils
.
notEqual
(
ActivityTypeEnum
.
TYPE_12
.
getCode
(),
d
.
getActivityType
())
&&
ObjectUtils
.
notEqual
(
ActivityTypeEnum
.
TYPE_3
.
getCode
(),
d
.
getActivityType
())
).
mapToLong
(
t
->
t
.
getActivityApportionAmount
()
*
apportionGoods
.
getGoodsQuantity
()).
sum
();
}
}
}
//折扣为:总折扣金额-已折扣金额
//折扣为:总折扣金额-已折扣金额
discountPrice
=
totalDiscountAmount
-
Integer
.
parseInt
(
value
[
1
]);
discountPrice
=
totalDiscountAmount
-
Integer
.
parseInt
(
value
[
1
]);
...
@@ -64,7 +78,7 @@ public class PromotionAdapter {
...
@@ -64,7 +78,7 @@ public class PromotionAdapter {
}
}
totalDiscount
+=
discountPrice
.
intValue
();
totalDiscount
+=
discountPrice
.
intValue
();
}
}
return
convertCartGoods2DetailGoodsCommon
(
orderProductBean
,
totalDiscount
,
apportionGoodsByGoodsId
);
return
convertCartGoods2DetailGoodsCommon
(
orderProductBean
,
totalDiscount
,
apportionGoodsByGoodsId
,
isApportion
);
}
}
public
static
List
<
ShoppingCartGoodsResponse
.
CartGoodsDetailDto
>
convertCartGoods2DetailGoods
(
List
<
OrderBeanRequest
.
ProductBean
>
comboFixedProductList
,
Long
totalDiscountAmount
)
{
public
static
List
<
ShoppingCartGoodsResponse
.
CartGoodsDetailDto
>
convertCartGoods2DetailGoods
(
List
<
OrderBeanRequest
.
ProductBean
>
comboFixedProductList
,
Long
totalDiscountAmount
)
{
...
@@ -84,20 +98,20 @@ public class PromotionAdapter {
...
@@ -84,20 +98,20 @@ public class PromotionAdapter {
for
(
OrderBeanRequest
.
ProductBean
comboProduct
:
comboFixedProductList
)
{
for
(
OrderBeanRequest
.
ProductBean
comboProduct
:
comboFixedProductList
)
{
//获取当前套餐可选或固定商品的均摊价格
//获取当前套餐可选或固定商品的均摊价格
if
(
size
--
==
1
)
{
if
(
size
--
==
1
)
{
result
.
add
(
convertCartGoods2DetailGoodsCommon
(
comboProduct
,
totalDiscountAmount
.
intValue
()
-
tempDiscount
,
null
));
result
.
add
(
convertCartGoods2DetailGoodsCommon
(
comboProduct
,
totalDiscountAmount
.
intValue
()
-
tempDiscount
,
null
,
true
));
}
else
{
}
else
{
Long
currentDiscountAmount
=
(
comboProduct
.
getNumber
()
*
comboProduct
.
getPrice
()
*
totalDiscountAmount
)
/
totalOriginalPrice
;
Long
currentDiscountAmount
=
(
comboProduct
.
getNumber
()
*
comboProduct
.
getPrice
()
*
totalDiscountAmount
)
/
totalOriginalPrice
;
if
(
Objects
.
equals
(
comboProduct
.
getProductType
(),
ProductTypeEnum
.
WEIGHT_PRODUCT
.
getCode
()))
{
if
(
Objects
.
equals
(
comboProduct
.
getProductType
(),
ProductTypeEnum
.
WEIGHT_PRODUCT
.
getCode
()))
{
currentDiscountAmount
=
new
BigDecimal
(
comboProduct
.
getPrice
()+
""
).
multiply
(
comboProduct
.
getWeight
()).
longValue
()
*
totalDiscountAmount
/
totalOriginalPrice
;
currentDiscountAmount
=
new
BigDecimal
(
comboProduct
.
getPrice
()+
""
).
multiply
(
comboProduct
.
getWeight
()).
longValue
()
*
totalDiscountAmount
/
totalOriginalPrice
;
}
}
tempDiscount
+=
currentDiscountAmount
.
intValue
();
tempDiscount
+=
currentDiscountAmount
.
intValue
();
result
.
add
(
convertCartGoods2DetailGoodsCommon
(
comboProduct
,
currentDiscountAmount
.
intValue
(),
null
));
result
.
add
(
convertCartGoods2DetailGoodsCommon
(
comboProduct
,
currentDiscountAmount
.
intValue
(),
null
,
true
));
}
}
}
}
return
result
;
return
result
;
}
}
public
static
ShoppingCartGoodsResponse
.
CartGoodsDetailDto
convertCartGoods2DetailGoodsCommon
(
OrderBeanRequest
.
ProductBean
orderProductBean
,
Integer
totalDiscountAmount
,
List
<
CalculationApportionGoodsDto
>
apportionGoodsList
)
{
public
static
ShoppingCartGoodsResponse
.
CartGoodsDetailDto
convertCartGoods2DetailGoodsCommon
(
OrderBeanRequest
.
ProductBean
orderProductBean
,
Integer
totalDiscountAmount
,
List
<
CalculationApportionGoodsDto
>
apportionGoodsList
,
Boolean
isApportion
)
{
ShoppingCartGoodsResponse
.
CartGoodsDetailDto
cartGoodsDetailDto
=
new
ShoppingCartGoodsResponse
.
CartGoodsDetailDto
();
ShoppingCartGoodsResponse
.
CartGoodsDetailDto
cartGoodsDetailDto
=
new
ShoppingCartGoodsResponse
.
CartGoodsDetailDto
();
cartGoodsDetailDto
.
setProductId
(
orderProductBean
.
getProductId
());
cartGoodsDetailDto
.
setProductId
(
orderProductBean
.
getProductId
());
cartGoodsDetailDto
.
setOriginalPrice
(
orderProductBean
.
getPrice
());
cartGoodsDetailDto
.
setOriginalPrice
(
orderProductBean
.
getPrice
());
...
@@ -120,7 +134,7 @@ public class PromotionAdapter {
...
@@ -120,7 +134,7 @@ public class PromotionAdapter {
}
}
if
(
CollectionUtils
.
isNotEmpty
(
apportionGoodsList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
apportionGoodsList
))
{
List
<
CalculationApportionGoodsDto
>
apportionGoodsByGoodsId
=
apportionGoodsList
.
stream
().
filter
(
a
->
ObjectUtils
.
equals
(
orderProductBean
.
getProductId
(),
a
.
getGoodsId
())).
collect
(
Collectors
.
toList
());
List
<
CalculationApportionGoodsDto
>
apportionGoodsByGoodsId
=
apportionGoodsList
.
stream
().
filter
(
a
->
ObjectUtils
.
equals
(
orderProductBean
.
getProductId
(),
a
.
getGoodsId
())).
collect
(
Collectors
.
toList
());
setActivityDiscounts
(
apportionGoodsByGoodsId
,
cartGoodsDetailDto
);
setActivityDiscounts
(
apportionGoodsByGoodsId
,
cartGoodsDetailDto
,
isApportion
);
}
}
return
cartGoodsDetailDto
;
return
cartGoodsDetailDto
;
}
}
...
@@ -135,7 +149,7 @@ public class PromotionAdapter {
...
@@ -135,7 +149,7 @@ public class PromotionAdapter {
}
}
}
}
private
static
void
setActivityDiscounts
(
List
<
CalculationApportionGoodsDto
>
apportionGoodsList
,
ShoppingCartGoodsResponse
.
CartGoodsDetailDto
cartGoodsDetailDto
)
{
private
static
void
setActivityDiscounts
(
List
<
CalculationApportionGoodsDto
>
apportionGoodsList
,
ShoppingCartGoodsResponse
.
CartGoodsDetailDto
cartGoodsDetailDto
,
Boolean
isApportion
)
{
if
(
CollectionUtils
.
isEmpty
(
apportionGoodsList
))
{
if
(
CollectionUtils
.
isEmpty
(
apportionGoodsList
))
{
return
;
return
;
}
}
...
@@ -146,8 +160,15 @@ public class PromotionAdapter {
...
@@ -146,8 +160,15 @@ public class PromotionAdapter {
* 1. 商品券:cartGoodsDetailDto.couponCode非空,保留ApportionGoods#ApportionDetails#apportionType中32的
* 1. 商品券:cartGoodsDetailDto.couponCode非空,保留ApportionGoods#ApportionDetails#apportionType中32的
* 2. 普通商品:cartGoodsDetailDto.couponCode空,去掉32的
* 2. 普通商品:cartGoodsDetailDto.couponCode空,去掉32的
*/
*/
List
<
CalculationApportionDetailDto
>
apportionDetails
=
apportionGoods
.
getApportionDetails
().
stream
().
filter
(
detail
->
!
detail
.
getActivityType
().
equals
(
ActivityTypeEnum
.
TYPE_32
.
getCode
())
List
<
CalculationApportionDetailDto
>
apportionDetails
=
new
ArrayList
<>();
if
(
isApportion
)
{
apportionDetails
=
apportionGoods
.
getApportionDetails
().
stream
().
filter
(
detail
->
!
detail
.
getActivityType
().
equals
(
ActivityTypeEnum
.
TYPE_32
.
getCode
())
&&
!
detail
.
getActivityType
().
equals
(
ActivityTypeEnum
.
TYPE_104
.
getCode
())
&&
!
detail
.
getActivityType
().
equals
(
ActivityTypeEnum
.
TYPE_2
.
getCode
())).
collect
(
Collectors
.
toList
());
&&
!
detail
.
getActivityType
().
equals
(
ActivityTypeEnum
.
TYPE_104
.
getCode
())
&&
!
detail
.
getActivityType
().
equals
(
ActivityTypeEnum
.
TYPE_2
.
getCode
())).
collect
(
Collectors
.
toList
());
}
else
{
apportionDetails
=
apportionGoods
.
getApportionDetails
().
stream
().
filter
(
detail
->
!
detail
.
getActivityType
().
equals
(
ActivityTypeEnum
.
TYPE_32
.
getCode
())
&&
!
detail
.
getActivityType
().
equals
(
ActivityTypeEnum
.
TYPE_104
.
getCode
())
&&
!
detail
.
getActivityType
().
equals
(
ActivityTypeEnum
.
TYPE_2
.
getCode
())
&&
ObjectUtils
.
notEqual
(
ActivityTypeEnum
.
TYPE_12
.
getCode
(),
detail
.
getActivityType
())
&&
ObjectUtils
.
notEqual
(
ActivityTypeEnum
.
TYPE_3
.
getCode
(),
detail
.
getActivityType
())).
collect
(
Collectors
.
toList
());
}
for
(
CalculationApportionDetailDto
detail
:
apportionDetails
)
{
for
(
CalculationApportionDetailDto
detail
:
apportionDetails
)
{
List
<
ActivityDiscountsDto
>
currentDiscount
=
activityDiscountsDtoList
.
stream
().
filter
(
discount
->
ObjectUtils
.
equals
(
discount
.
getActivityCode
(),
detail
.
getActivityCode
())).
collect
(
Collectors
.
toList
());
List
<
ActivityDiscountsDto
>
currentDiscount
=
activityDiscountsDtoList
.
stream
().
filter
(
discount
->
ObjectUtils
.
equals
(
discount
.
getActivityCode
(),
detail
.
getActivityCode
())).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isNotEmpty
(
currentDiscount
))
{
if
(
CollectionUtils
.
isNotEmpty
(
currentDiscount
))
{
...
...
order-application-service/src/main/java/cn/freemud/service/IPromotionService.java
View file @
7dbeb6b9
...
@@ -23,5 +23,5 @@ public interface IPromotionService {
...
@@ -23,5 +23,5 @@ public interface IPromotionService {
/**
/**
* 优惠计算和均摊
* 优惠计算和均摊
*/
*/
void
updateDiscountApportion
(
ShoppingCartGoodsResponse
shoppingCartGoodsResponse
,
OrderBeanRequest
request
,
CalculationDiscountResultDto
calculationDiscountResult
,
CouponPromotionDto
couponPromotionDto
,
ActivityQueryDto
activityQueryDto
);
void
updateDiscountApportion
(
ShoppingCartGoodsResponse
shoppingCartGoodsResponse
,
OrderBeanRequest
request
,
CalculationDiscountResultDto
calculationDiscountResult
,
CouponPromotionDto
couponPromotionDto
,
ActivityQueryDto
activityQueryDto
,
Boolean
isApportion
);
}
}
order-application-service/src/main/java/cn/freemud/service/impl/ActivityCalculationDiscountService.java
View file @
7dbeb6b9
...
@@ -21,6 +21,8 @@ import com.freemud.sdk.api.assortment.order.response.order.QueryOrdersResponse;
...
@@ -21,6 +21,8 @@ import com.freemud.sdk.api.assortment.order.response.order.QueryOrdersResponse;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang.ObjectUtils
;
import
org.apache.commons.lang.ObjectUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -44,6 +46,8 @@ import java.util.Objects;
...
@@ -44,6 +46,8 @@ import java.util.Objects;
@Service
@Service
public
class
ActivityCalculationDiscountService
{
public
class
ActivityCalculationDiscountService
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ActivityCalculationDiscountService
.
class
);
private
final
static
String
RESPONSE_SUCCESS_STR
=
"100"
;
private
final
static
String
RESPONSE_SUCCESS_STR
=
"100"
;
@Autowired
@Autowired
...
@@ -66,7 +70,7 @@ public class ActivityCalculationDiscountService {
...
@@ -66,7 +70,7 @@ public class ActivityCalculationDiscountService {
private
CustomerScoreService
customerScoreService
;
private
CustomerScoreService
customerScoreService
;
public
ShoppingCartGoodsResponse
updateDiscountApportion
(
OrderBeanRequest
request
,
CouponPromotionDto
couponPromotionDto
)
{
public
ShoppingCartGoodsResponse
updateDiscountApportion
(
OrderBeanRequest
request
,
CouponPromotionDto
couponPromotionDto
,
Boolean
isApportion
)
{
ShoppingCartGoodsResponse
shoppingCartGoodsResponse
=
new
ShoppingCartGoodsResponse
();
ShoppingCartGoodsResponse
shoppingCartGoodsResponse
=
new
ShoppingCartGoodsResponse
();
List
<
CalculationCouponDto
>
coupons
=
new
ArrayList
<>();
List
<
CalculationCouponDto
>
coupons
=
new
ArrayList
<>();
...
@@ -86,18 +90,20 @@ public class ActivityCalculationDiscountService {
...
@@ -86,18 +90,20 @@ public class ActivityCalculationDiscountService {
.
build
();
.
build
();
CalculationDiscountResultDto
calculationDiscountResultDto
=
getCalculationResult
(
request
,
coupons
);
CalculationDiscountResultDto
calculationDiscountResultDto
=
getCalculationResult
(
request
,
coupons
);
logger
.
info
(
"促销分摊:{}"
,
calculationDiscountResultDto
);
// 默认计算
// 默认计算
defaultPromotionService
.
updateDiscountApportion
(
shoppingCartGoodsResponse
,
request
,
calculationDiscountResultDto
,
couponPromotionDto
,
activityQueryDto
);
defaultPromotionService
.
updateDiscountApportion
(
shoppingCartGoodsResponse
,
request
,
calculationDiscountResultDto
,
couponPromotionDto
,
activityQueryDto
,
isApportion
);
// 套餐计算
// 套餐计算
setMealPromotionService
.
updateDiscountApportion
(
shoppingCartGoodsResponse
,
request
,
calculationDiscountResultDto
,
couponPromotionDto
,
activityQueryDto
);
setMealPromotionService
.
updateDiscountApportion
(
shoppingCartGoodsResponse
,
request
,
calculationDiscountResultDto
,
couponPromotionDto
,
activityQueryDto
,
isApportion
);
// 优惠券计算
// 优惠券计算
couponPromotionService
.
updateDiscountApportion
(
shoppingCartGoodsResponse
,
request
,
calculationDiscountResultDto
,
couponPromotionDto
,
activityQueryDto
);
couponPromotionService
.
updateDiscountApportion
(
shoppingCartGoodsResponse
,
request
,
calculationDiscountResultDto
,
couponPromotionDto
,
activityQueryDto
,
isApportion
);
// 满减
// 满减
fullPromotionService
.
updateDiscountApportion
(
shoppingCartGoodsResponse
,
request
,
calculationDiscountResultDto
,
couponPromotionDto
,
activityQueryDto
);
fullPromotionService
.
updateDiscountApportion
(
shoppingCartGoodsResponse
,
request
,
calculationDiscountResultDto
,
couponPromotionDto
,
activityQueryDto
,
isApportion
);
// 限时特价
// 限时特价
timeSalePromotionService
.
updateDiscountApportion
(
shoppingCartGoodsResponse
,
request
,
calculationDiscountResultDto
,
couponPromotionDto
,
activityQueryDto
);
timeSalePromotionService
.
updateDiscountApportion
(
shoppingCartGoodsResponse
,
request
,
calculationDiscountResultDto
,
couponPromotionDto
,
activityQueryDto
,
isApportion
);
logger
.
info
(
"限时特价shoppingCartGoodsResponse:{}"
,
shoppingCartGoodsResponse
);
// 积分抵扣
// 积分抵扣
customerScoreService
.
updateDiscountApportion
(
shoppingCartGoodsResponse
,
request
,
calculationDiscountResultDto
,
couponPromotionDto
,
activityQueryDto
);
customerScoreService
.
updateDiscountApportion
(
shoppingCartGoodsResponse
,
request
,
calculationDiscountResultDto
,
couponPromotionDto
,
activityQueryDto
,
isApportion
);
return
shoppingCartGoodsResponse
;
return
shoppingCartGoodsResponse
;
}
}
...
...
order-application-service/src/main/java/cn/freemud/service/impl/CouponPromotionService.java
View file @
7dbeb6b9
...
@@ -25,7 +25,7 @@ public class CouponPromotionService implements IPromotionService {
...
@@ -25,7 +25,7 @@ public class CouponPromotionService implements IPromotionService {
@Autowired
@Autowired
private
CouponService
couponService
;
private
CouponService
couponService
;
@Override
@Override
public
void
updateDiscountApportion
(
ShoppingCartGoodsResponse
shoppingCartGoodsResponse
,
OrderBeanRequest
request
,
CalculationDiscountResultDto
calculationDiscountResult
,
CouponPromotionDto
couponPromotionDto
,
ActivityQueryDto
activityQueryDto
)
{
public
void
updateDiscountApportion
(
ShoppingCartGoodsResponse
shoppingCartGoodsResponse
,
OrderBeanRequest
request
,
CalculationDiscountResultDto
calculationDiscountResult
,
CouponPromotionDto
couponPromotionDto
,
ActivityQueryDto
activityQueryDto
,
Boolean
isApportion
)
{
// 用户选择了查询优惠券信息
// 用户选择了查询优惠券信息
if
(
couponPromotionDto
!=
null
&&
ObjectUtils
.
equals
(
CouponFlag
.
YES
.
getCode
(),
couponPromotionDto
.
getFlg
()))
{
if
(
couponPromotionDto
!=
null
&&
ObjectUtils
.
equals
(
CouponFlag
.
YES
.
getCode
(),
couponPromotionDto
.
getFlg
()))
{
// 是否存在商品券
// 是否存在商品券
...
...
order-application-service/src/main/java/cn/freemud/service/impl/CustomerScoreService.java
View file @
7dbeb6b9
...
@@ -37,7 +37,7 @@ public class CustomerScoreService implements IPromotionService {
...
@@ -37,7 +37,7 @@ public class CustomerScoreService implements IPromotionService {
private
CustomScoreClient
customScoreClient
;
private
CustomScoreClient
customScoreClient
;
@Override
@Override
public
void
updateDiscountApportion
(
ShoppingCartGoodsResponse
shoppingCartGoodsResponse
,
OrderBeanRequest
request
,
CalculationDiscountResultDto
calculationDiscountResult
,
CouponPromotionDto
couponPromotionDto
,
ActivityQueryDto
activityQueryDto
)
{
public
void
updateDiscountApportion
(
ShoppingCartGoodsResponse
shoppingCartGoodsResponse
,
OrderBeanRequest
request
,
CalculationDiscountResultDto
calculationDiscountResult
,
CouponPromotionDto
couponPromotionDto
,
ActivityQueryDto
activityQueryDto
,
Boolean
isApportion
)
{
if
(
request
==
null
||
request
.
getUseCustomerScore
()
==
null
||
request
.
getUseCustomerScore
()
==
null
||
request
.
getUseCustomerScore
().
equals
(
CustomerScoreConstant
.
NO_DISPLAY
.
getValue
()))
{
if
(
request
==
null
||
request
.
getUseCustomerScore
()
==
null
||
request
.
getUseCustomerScore
()
==
null
||
request
.
getUseCustomerScore
().
equals
(
CustomerScoreConstant
.
NO_DISPLAY
.
getValue
()))
{
return
;
return
;
}
}
...
...
order-application-service/src/main/java/cn/freemud/service/impl/DefaultPromotionService.java
View file @
7dbeb6b9
...
@@ -33,7 +33,7 @@ import java.util.stream.Collectors;
...
@@ -33,7 +33,7 @@ import java.util.stream.Collectors;
public
class
DefaultPromotionService
implements
IPromotionService
{
public
class
DefaultPromotionService
implements
IPromotionService
{
@Override
@Override
public
void
updateDiscountApportion
(
ShoppingCartGoodsResponse
shoppingCartGoodsResponse
,
OrderBeanRequest
request
,
CalculationDiscountResultDto
calculationDiscountResult
,
CouponPromotionDto
couponPromotionDto
,
ActivityQueryDto
activityQueryDto
)
{
public
void
updateDiscountApportion
(
ShoppingCartGoodsResponse
shoppingCartGoodsResponse
,
OrderBeanRequest
request
,
CalculationDiscountResultDto
calculationDiscountResult
,
CouponPromotionDto
couponPromotionDto
,
ActivityQueryDto
activityQueryDto
,
Boolean
isApportion
)
{
// 总原价
// 总原价
Long
originalTotalAmount
=
0L
;
Long
originalTotalAmount
=
0L
;
// 总折扣
// 总折扣
...
@@ -76,7 +76,7 @@ public class DefaultPromotionService implements IPromotionService {
...
@@ -76,7 +76,7 @@ public class DefaultPromotionService implements IPromotionService {
if
(
Objects
.
equals
(
productBean
.
getProductType
(),
ProductTypeEnum
.
WEIGHT_PRODUCT
.
getCode
()))
{
if
(
Objects
.
equals
(
productBean
.
getProductType
(),
ProductTypeEnum
.
WEIGHT_PRODUCT
.
getCode
()))
{
originalDiscountAmount
=
new
BigDecimal
(
productBean
.
getPrice
()+
""
).
multiply
(
productBean
.
getWeight
()).
longValue
()
-
productBean
.
getSettlementPrice
();
originalDiscountAmount
=
new
BigDecimal
(
productBean
.
getPrice
()+
""
).
multiply
(
productBean
.
getWeight
()).
longValue
()
-
productBean
.
getSettlementPrice
();
}
}
cartGoodsDetailDtoList
.
add
(
PromotionAdapter
.
convertCartGoods2DetailGoods
(
productBean
,
originalDiscountAmount
.
intValue
(),
apportionGoodsList
,
duplicateGoodsMap
));
cartGoodsDetailDtoList
.
add
(
PromotionAdapter
.
convertCartGoods2DetailGoods
(
productBean
,
originalDiscountAmount
.
intValue
(),
apportionGoodsList
,
duplicateGoodsMap
,
isApportion
));
}
}
}
}
...
...
order-application-service/src/main/java/cn/freemud/service/impl/EncircleOrderServiceImpl.java
View file @
7dbeb6b9
...
@@ -382,7 +382,8 @@ public class EncircleOrderServiceImpl implements EncircleOrderService {
...
@@ -382,7 +382,8 @@ public class EncircleOrderServiceImpl implements EncircleOrderService {
payIsArouseStatus
=
0
;
payIsArouseStatus
=
0
;
OrderBeanRequest
orderBeanRequest
=
orderAdapter
.
conventOrderBeanRequest
(
queryOrderByIdResponse
.
getData
(),
assortmentCustomerInfoVo
,
createReserveOrderVo
);
OrderBeanRequest
orderBeanRequest
=
orderAdapter
.
conventOrderBeanRequest
(
queryOrderByIdResponse
.
getData
(),
assortmentCustomerInfoVo
,
createReserveOrderVo
);
CouponPromotionDto
couponPromotionDto
=
couponAdapter
.
getCouponPromotionDto
(
orderBeanRequest
,
createReserveOrderVo
.
getCouponCode
(),
createReserveOrderVo
.
getActivityCode
(),
CouponFlag
.
YES
.
getCode
());
CouponPromotionDto
couponPromotionDto
=
couponAdapter
.
getCouponPromotionDto
(
orderBeanRequest
,
createReserveOrderVo
.
getCouponCode
(),
createReserveOrderVo
.
getActivityCode
(),
CouponFlag
.
YES
.
getCode
());
ShoppingCartGoodsResponse
shoppingCartGoodsResponse
=
calculationDiscountService
.
updateDiscountApportion
(
orderBeanRequest
,
couponPromotionDto
);
//新增是否需要分摊计算优化金额,满减和优化券不进行优惠分摊
ShoppingCartGoodsResponse
shoppingCartGoodsResponse
=
calculationDiscountService
.
updateDiscountApportion
(
orderBeanRequest
,
couponPromotionDto
,
false
);
calculationDiscountService
.
updatePreviewOrderInfoVo
(
previewOrderInfoVo
,
shoppingCartGoodsResponse
);
calculationDiscountService
.
updatePreviewOrderInfoVo
(
previewOrderInfoVo
,
shoppingCartGoodsResponse
);
}
}
//是否唤起支付
//是否唤起支付
...
@@ -445,7 +446,7 @@ public class EncircleOrderServiceImpl implements EncircleOrderService {
...
@@ -445,7 +446,7 @@ public class EncircleOrderServiceImpl implements EncircleOrderService {
if
(!
prePayLock
)
{
if
(!
prePayLock
)
{
OrderBeanRequest
orderBeanRequest
=
orderAdapter
.
conventOrderBeanRequest
(
queryOrderByIdResponse
.
getData
(),
assortmentCustomerInfoVo
,
createReserveOrderVo
);
OrderBeanRequest
orderBeanRequest
=
orderAdapter
.
conventOrderBeanRequest
(
queryOrderByIdResponse
.
getData
(),
assortmentCustomerInfoVo
,
createReserveOrderVo
);
CouponPromotionDto
couponPromotionDto
=
couponAdapter
.
getCouponPromotionDto
(
orderBeanRequest
,
createReserveOrderVo
.
getCouponCode
(),
createReserveOrderVo
.
getActivityCode
(),
CouponFlag
.
YES
.
getCode
());
CouponPromotionDto
couponPromotionDto
=
couponAdapter
.
getCouponPromotionDto
(
orderBeanRequest
,
createReserveOrderVo
.
getCouponCode
(),
createReserveOrderVo
.
getActivityCode
(),
CouponFlag
.
YES
.
getCode
());
shoppingCartGoodsResponse
=
calculationDiscountService
.
updateDiscountApportion
(
orderBeanRequest
,
couponPromotionDto
);
shoppingCartGoodsResponse
=
calculationDiscountService
.
updateDiscountApportion
(
orderBeanRequest
,
couponPromotionDto
,
true
);
}
}
boolean
isUpdateAccounts
=
CollectionUtils
.
isEmpty
(
queryOrderByIdResponse
.
getData
().
getAccountList
());
boolean
isUpdateAccounts
=
CollectionUtils
.
isEmpty
(
queryOrderByIdResponse
.
getData
().
getAccountList
());
AssortmentSdkUpdateOrderProductInfoRequest
request
=
orderAdapter
.
conventShoppingPromotionInfo
(
shoppingCartGoodsResponse
,
queryOrderByIdResponse
,
assortmentCustomerInfoVo
,
isUpdateAccounts
,
createReserveOrderVo
);
AssortmentSdkUpdateOrderProductInfoRequest
request
=
orderAdapter
.
conventShoppingPromotionInfo
(
shoppingCartGoodsResponse
,
queryOrderByIdResponse
,
assortmentCustomerInfoVo
,
isUpdateAccounts
,
createReserveOrderVo
);
...
...
order-application-service/src/main/java/cn/freemud/service/impl/FullPromotionService.java
View file @
7dbeb6b9
...
@@ -27,7 +27,7 @@ public class FullPromotionService implements IPromotionService {
...
@@ -27,7 +27,7 @@ public class FullPromotionService implements IPromotionService {
private
ActivityService
activityService
;
private
ActivityService
activityService
;
@Override
@Override
public
void
updateDiscountApportion
(
ShoppingCartGoodsResponse
shoppingCartGoodsResponse
,
OrderBeanRequest
request
,
CalculationDiscountResultDto
calculationDiscountResult
,
CouponPromotionDto
couponPromotionDto
,
ActivityQueryDto
activityQueryDto
)
{
public
void
updateDiscountApportion
(
ShoppingCartGoodsResponse
shoppingCartGoodsResponse
,
OrderBeanRequest
request
,
CalculationDiscountResultDto
calculationDiscountResult
,
CouponPromotionDto
couponPromotionDto
,
ActivityQueryDto
activityQueryDto
,
Boolean
isApportion
)
{
this
.
buildActivityTip
(
shoppingCartGoodsResponse
,
calculationDiscountResult
,
activityQueryDto
);
this
.
buildActivityTip
(
shoppingCartGoodsResponse
,
calculationDiscountResult
,
activityQueryDto
);
List
<
CalculationGoodsActivityDto
>
discountList
=
(
calculationDiscountResult
==
null
||
calculationDiscountResult
.
getDiscounts
()
==
null
)
?
new
ArrayList
<>()
:
calculationDiscountResult
.
getDiscounts
();
List
<
CalculationGoodsActivityDto
>
discountList
=
(
calculationDiscountResult
==
null
||
calculationDiscountResult
.
getDiscounts
()
==
null
)
?
new
ArrayList
<>()
:
calculationDiscountResult
.
getDiscounts
();
...
...
order-application-service/src/main/java/cn/freemud/service/impl/OrderCommonService.java
View file @
7dbeb6b9
...
@@ -17,6 +17,7 @@ import cn.freemud.enums.RedisCacheEnum;
...
@@ -17,6 +17,7 @@ import cn.freemud.enums.RedisCacheEnum;
import
cn.freemud.enums.ResponseResult
;
import
cn.freemud.enums.ResponseResult
;
import
cn.freemud.interceptor.ServiceException
;
import
cn.freemud.interceptor.ServiceException
;
import
cn.freemud.redis.RedisCache
;
import
cn.freemud.redis.RedisCache
;
import
cn.freemud.service.CouponActivityService
;
import
cn.freemud.service.thirdparty.ShoppingCartClient
;
import
cn.freemud.service.thirdparty.ShoppingCartClient
;
import
cn.freemud.utils.DateTimeUtil
;
import
cn.freemud.utils.DateTimeUtil
;
import
cn.freemud.utils.LogUtil
;
import
cn.freemud.utils.LogUtil
;
...
@@ -96,6 +97,8 @@ public class OrderCommonService {
...
@@ -96,6 +97,8 @@ public class OrderCommonService {
private
MessageCenterClient
messageNoticeClient
;
private
MessageCenterClient
messageNoticeClient
;
@Autowired
@Autowired
private
RedisService
redisService
;
private
RedisService
redisService
;
@Autowired
private
CouponActivityService
couponActivityService
;
private
final
Integer
RESPONSE_SUCCESS_CODE
=
100
;
private
final
Integer
RESPONSE_SUCCESS_CODE
=
100
;
/**
/**
...
@@ -268,6 +271,10 @@ public class OrderCommonService {
...
@@ -268,6 +271,10 @@ public class OrderCommonService {
LogUtil
.
error
(
"paySuccessCallback_payAccess_faild"
,
JSON
.
toJSONString
(
message
),
JSON
.
toJSONString
(
groupOrderResponse
));
LogUtil
.
error
(
"paySuccessCallback_payAccess_faild"
,
JSON
.
toJSONString
(
message
),
JSON
.
toJSONString
(
groupOrderResponse
));
return
this
.
newSendPayFaileMessage
();
return
this
.
newSendPayFaileMessage
();
}
}
//若该订单使用了优惠券,则移除卡包,移除失败也不退款
couponActivityService
.
callbackNotify
(
orderBean
);
// 删除订单自增缓存
// 删除订单自增缓存
redisCache
.
delete
(
RedisUtil
.
getPaymentTransIdSequenceKey
(
orderBean
.
getOid
()));
redisCache
.
delete
(
RedisUtil
.
getPaymentTransIdSequenceKey
(
orderBean
.
getOid
()));
// 删除支付交易号订单关系缓存
// 删除支付交易号订单关系缓存
...
...
order-application-service/src/main/java/cn/freemud/service/impl/OrderServiceImpl.java
View file @
7dbeb6b9
...
@@ -953,7 +953,7 @@ public class OrderServiceImpl implements Orderservice {
...
@@ -953,7 +953,7 @@ public class OrderServiceImpl implements Orderservice {
}
}
}
}
if
(
IappIdType
.
WC_XCX
.
getCode
().
equals
(
userInfo
.
getIappId
()))
{
/*
if (IappIdType.WC_XCX.getCode().equals(userInfo.getIappId())) {
if(CollectionUtils.isNotEmpty(queryOrderResponseVo.getProducts()) ) {
if(CollectionUtils.isNotEmpty(queryOrderResponseVo.getProducts()) ) {
queryOrderResponseVo.getProducts().stream().forEach(each -> {
queryOrderResponseVo.getProducts().stream().forEach(each -> {
orderBean.getProductList().forEach(var -> {
orderBean.getProductList().forEach(var -> {
...
@@ -965,7 +965,7 @@ public class OrderServiceImpl implements Orderservice {
...
@@ -965,7 +965,7 @@ public class OrderServiceImpl implements Orderservice {
});
});
}
}
}
}
*/
// 判断是否有裂变活动 订单扩展信息判断必须有wxappid
// 判断是否有裂变活动 订单扩展信息判断必须有wxappid
String
extInfo
=
response
.
getData
().
getExtInfo
();
String
extInfo
=
response
.
getData
().
getExtInfo
();
...
...
order-application-service/src/main/java/cn/freemud/service/impl/SetMealPromotionService.java
View file @
7dbeb6b9
...
@@ -34,7 +34,7 @@ import java.util.stream.Collectors;
...
@@ -34,7 +34,7 @@ import java.util.stream.Collectors;
@Service
@Service
public
class
SetMealPromotionService
implements
IPromotionService
{
public
class
SetMealPromotionService
implements
IPromotionService
{
@Override
@Override
public
void
updateDiscountApportion
(
ShoppingCartGoodsResponse
shoppingCartGoodsResponse
,
OrderBeanRequest
request
,
CalculationDiscountResultDto
calculationDiscountResult
,
CouponPromotionDto
couponPromotionDto
,
ActivityQueryDto
activityQueryDto
)
{
public
void
updateDiscountApportion
(
ShoppingCartGoodsResponse
shoppingCartGoodsResponse
,
OrderBeanRequest
request
,
CalculationDiscountResultDto
calculationDiscountResult
,
CouponPromotionDto
couponPromotionDto
,
ActivityQueryDto
activityQueryDto
,
Boolean
isApportion
)
{
// 套餐商品
// 套餐商品
List
<
OrderBeanRequest
.
ProductBean
>
setMealProducts
=
request
.
getProductList
().
stream
()
List
<
OrderBeanRequest
.
ProductBean
>
setMealProducts
=
request
.
getProductList
().
stream
()
.
filter
(
productBean
->
{
.
filter
(
productBean
->
{
...
@@ -69,7 +69,7 @@ public class SetMealPromotionService implements IPromotionService {
...
@@ -69,7 +69,7 @@ public class SetMealPromotionService implements IPromotionService {
Long
productGroupDiscountAmount
=
productBean
.
getComboProduct
().
stream
().
filter
(
t
->
!
t
.
getIsFixedProduct
()).
mapToLong
(
t
->
t
.
getPrice
()
*
t
.
getNumber
()
-
t
.
getSettlementPrice
()).
sum
();
Long
productGroupDiscountAmount
=
productBean
.
getComboProduct
().
stream
().
filter
(
t
->
!
t
.
getIsFixedProduct
()).
mapToLong
(
t
->
t
.
getPrice
()
*
t
.
getNumber
()
-
t
.
getSettlementPrice
()).
sum
();
totalDiscountAmount
+=
discountAmount
-
productGroupDiscountAmount
;
totalDiscountAmount
+=
discountAmount
-
productGroupDiscountAmount
;
// 设置套餐主商品
// 设置套餐主商品
ShoppingCartGoodsResponse
.
CartGoodsDetailDto
cartGoodsDetailDto
=
PromotionAdapter
.
convertCartGoods2DetailGoods
(
productBean
,
discountAmount
.
intValue
(),
apportionGoodsList
,
duplicateGoodsMap
);
ShoppingCartGoodsResponse
.
CartGoodsDetailDto
cartGoodsDetailDto
=
PromotionAdapter
.
convertCartGoods2DetailGoods
(
productBean
,
discountAmount
.
intValue
(),
apportionGoodsList
,
duplicateGoodsMap
,
true
);
cartGoodsDetailDto
.
getActivityDiscountsDtos
().
add
(
getActivityDiscountsDto
(
discountAmount
.
intValue
()
-
productGroupDiscountAmount
.
intValue
()));
cartGoodsDetailDto
.
getActivityDiscountsDtos
().
add
(
getActivityDiscountsDto
(
discountAmount
.
intValue
()
-
productGroupDiscountAmount
.
intValue
()));
long
apportionAmount
=
cartGoodsDetailDto
.
getTotalDiscountAmount
()
-
discountAmount
;
long
apportionAmount
=
cartGoodsDetailDto
.
getTotalDiscountAmount
()
-
discountAmount
;
Long
comboFixedProductTotalDiscountAmount
=
discountAmount
-
productGroupDiscountAmount
+
apportionAmount
;
Long
comboFixedProductTotalDiscountAmount
=
discountAmount
-
productGroupDiscountAmount
+
apportionAmount
;
...
...
order-application-service/src/main/java/cn/freemud/service/impl/TimeSalePromotionService.java
View file @
7dbeb6b9
...
@@ -9,6 +9,7 @@ import cn.freemud.entities.vo.CartGoods;
...
@@ -9,6 +9,7 @@ import cn.freemud.entities.vo.CartGoods;
import
cn.freemud.enums.ActivityTypeEnum
;
import
cn.freemud.enums.ActivityTypeEnum
;
import
cn.freemud.service.IPromotionService
;
import
cn.freemud.service.IPromotionService
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang.ObjectUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -35,7 +36,7 @@ import java.util.stream.Collectors;
...
@@ -35,7 +36,7 @@ import java.util.stream.Collectors;
public
class
TimeSalePromotionService
implements
IPromotionService
{
public
class
TimeSalePromotionService
implements
IPromotionService
{
@Override
@Override
public
void
updateDiscountApportion
(
ShoppingCartGoodsResponse
shoppingCartGoodsResponse
,
OrderBeanRequest
request
,
CalculationDiscountResultDto
calculationDiscountResult
,
CouponPromotionDto
couponPromotionDto
,
ActivityQueryDto
activityQueryDto
)
{
public
void
updateDiscountApportion
(
ShoppingCartGoodsResponse
shoppingCartGoodsResponse
,
OrderBeanRequest
request
,
CalculationDiscountResultDto
calculationDiscountResult
,
CouponPromotionDto
couponPromotionDto
,
ActivityQueryDto
activityQueryDto
,
Boolean
isApportion
)
{
if
(
calculationDiscountResult
==
null
||
CollectionUtils
.
isEmpty
(
calculationDiscountResult
.
getDiscounts
())
if
(
calculationDiscountResult
==
null
||
CollectionUtils
.
isEmpty
(
calculationDiscountResult
.
getDiscounts
())
||
CollectionUtils
.
isEmpty
(
shoppingCartGoodsResponse
.
getProducts
())
||
CollectionUtils
.
isEmpty
(
shoppingCartGoodsResponse
.
getProducts
())
||
!
calculationDiscountResult
.
getDiscounts
().
stream
().
anyMatch
(
discount
->
ActivityTypeEnum
.
TYPE_2
.
getCode
().
equals
(
discount
.
getType
())))
{
||
!
calculationDiscountResult
.
getDiscounts
().
stream
().
anyMatch
(
discount
->
ActivityTypeEnum
.
TYPE_2
.
getCode
().
equals
(
discount
.
getType
())))
{
...
@@ -58,7 +59,10 @@ public class TimeSalePromotionService implements IPromotionService {
...
@@ -58,7 +59,10 @@ public class TimeSalePromotionService implements IPromotionService {
if
((
goods
=
goodsMap
.
get
(
product
.
getProductId
()))
==
null
)
{
if
((
goods
=
goodsMap
.
get
(
product
.
getProductId
()))
==
null
)
{
continue
;
continue
;
}
}
CalculationGoodsActivityDto
goodsDiscount
=
getGoodsDiscount
(
goods
.
getDiscounts
(),
ActivityTypeEnum
.
TYPE_2
);
CalculationGoodsActivityDto
goodsDiscount
=
null
;
if
(
isApportion
){
goodsDiscount
=
getGoodsDiscount
(
goods
.
getDiscounts
(),
ActivityTypeEnum
.
TYPE_2
);
}
if
(
goodsDiscount
==
null
)
{
if
(
goodsDiscount
==
null
)
{
continue
;
continue
;
}
}
...
@@ -67,7 +71,15 @@ public class TimeSalePromotionService implements IPromotionService {
...
@@ -67,7 +71,15 @@ public class TimeSalePromotionService implements IPromotionService {
}
}
Integer
actualGoodsNumber
=
numberMap
.
get
(
product
.
getProductId
());
Integer
actualGoodsNumber
=
numberMap
.
get
(
product
.
getProductId
());
if
(
actualGoodsNumber
>
0
)
{
if
(
actualGoodsNumber
>
0
)
{
Integer
totalDiscountAmount
=
product
.
getQty
()
>
actualGoodsNumber
?
goods
.
getDiscountAmount
()
*
actualGoodsNumber
/
goods
.
getActualGoodsNumber
()
:
goods
.
getDiscountAmount
()
*
product
.
getQty
()
/
goods
.
getActualGoodsNumber
();
// 重新计算单品特价折扣
List
<
CalculationGoodsActivityDto
>
discounts
=
goods
.
getDiscounts
();
Integer
actual
=
0
;
for
(
CalculationGoodsActivityDto
dto:
discounts
)
{
if
(
ObjectUtils
.
equals
(
dto
.
getType
(),
ActivityTypeEnum
.
TYPE_2
.
getCode
())){
actual
+=
dto
.
getDiscount
();
}
}
Integer
totalDiscountAmount
=
product
.
getQty
()
>
actualGoodsNumber
?
actual
*
actualGoodsNumber
/
goods
.
getActualGoodsNumber
()
:
actual
*
product
.
getQty
()
/
goods
.
getActualGoodsNumber
();
ActivityDiscountsDto
activityDiscountsDto
=
new
ActivityDiscountsDto
();
ActivityDiscountsDto
activityDiscountsDto
=
new
ActivityDiscountsDto
();
activityDiscountsDto
.
setActivityCode
(
goodsDiscount
.
getActivityCode
());
activityDiscountsDto
.
setActivityCode
(
goodsDiscount
.
getActivityCode
());
activityDiscountsDto
.
setActivityName
(
goodsDiscount
.
getActivityName
());
activityDiscountsDto
.
setActivityName
(
goodsDiscount
.
getActivityName
());
...
...
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