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
3fe7d457
Commit
3fe7d457
authored
Dec 31, 2020
by
zhiheng.zhang
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop' into develop
parents
be8a4f99
99b086aa
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
179 additions
and
81 deletions
+179
-81
assortment-ordercenter-sdk/pom.xml
+0
-0
assortment-ordercenter-sdk/readme.md
+0
-0
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/adapter/OrderSdkAdapter.java
+5
-0
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/enums/OldOrderAccountType.java
+2
-1
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/enums/QueryOrderAccountType.java
+1
-0
order-application-service/pom.xml
+1
-1
order-application-service/src/main/java/cn/freemud/adapter/OrderAdapter.java
+43
-20
order-application-service/src/main/java/cn/freemud/entities/dto/QueryOrdersResponseDto.java
+4
-0
order-application-service/src/main/java/cn/freemud/enums/ActivityTypeEnum.java
+2
-1
order-application-service/src/main/java/cn/freemud/enums/OrderAccountType.java
+1
-1
order-application-service/src/main/java/cn/freemud/service/coupon/impl/CocoCouponRelationServiceImpl.java
+87
-41
order-application-service/src/main/java/cn/freemud/service/impl/OrderServiceImpl.java
+12
-10
order-management/src/main/java/cn/freemud/management/service/handle/DeliveryHandle.java
+0
-1
order-management/src/main/java/cn/freemud/management/service/impl/OrderDeliveryService.java
+0
-1
shopping-cart-application-service/src/main/java/cn/freemud/adapter/ShoppingCartMccafeAdapter.java
+6
-1
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/CalculationServiceImpl.java
+4
-0
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/CouponDiscountCalculation.java
+4
-0
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/SetMealCalculation.java
+7
-3
No files found.
assortment-ordercenter-sdk/pom.xml
View file @
3fe7d457
assortment-ordercenter-sdk/readme.md
View file @
3fe7d457
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/adapter/OrderSdkAdapter.java
View file @
3fe7d457
...
...
@@ -1407,6 +1407,9 @@ public class OrderSdkAdapter {
case
"BUY3_SEND1"
:
type
=
35
;
break
;
case
"COCO_PRODUCT_CASH_COUPON"
:
type
=
36
;
break
;
default
:
break
;
}
...
...
@@ -2017,6 +2020,8 @@ public class OrderSdkAdapter {
case
99
:
newOrderAccountType
=
OldOrderAccountType
.
FREIGHT_COUPON
.
getCode
();
break
;
case
36
:
newOrderAccountType
=
OldOrderAccountType
.
COCO_PRODUCT_CASH_COUPON
.
getCode
();
default
:
break
;
}
...
...
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/enums/OldOrderAccountType.java
View file @
3fe7d457
...
...
@@ -45,7 +45,8 @@ public enum OldOrderAccountType {
PRICE_DEDUCTION_COUPON
(
103
,
"抵价券"
,
"PRICE_DEDUCTION_COUPON"
),
TOTAL_DISCOUNT
(
205
,
"优惠总金额"
,
"TOTAL_DISCOUNT"
),
GATHER_SPOT
(
221
,
"集点活动"
,
"GATHER_SPOT"
),
MEMBER_PRICE_DISCOUNT
(
220
,
"会员价优惠"
,
"MEMBER_PRICE_DISCOUNT"
);
MEMBER_PRICE_DISCOUNT
(
220
,
"会员价优惠"
,
"MEMBER_PRICE_DISCOUNT"
),
COCO_PRODUCT_CASH_COUPON
(
36
,
"coco商品代金券"
,
"COCO_PRODUCT_CASH_COUPON"
);
private
Integer
code
;
private
String
desc
;
...
...
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/enums/QueryOrderAccountType.java
View file @
3fe7d457
...
...
@@ -45,6 +45,7 @@ public enum QueryOrderAccountType {
WITH_ORDER_BUY3_SEND1_FEE
(
"WITH_ORDER_BUY3_SEND1_FEE"
,
"随单购买3赠1券"
),
WITH_ORDER_BUY_COUPON_FEE
(
"WITH_ORDER_BUY_COUPON_FEE"
,
"随单购月卡"
),
MCCAFE_MONTH_CARD
(
"MCCAFE_MONTH_CARD"
,
"麦咖啡月卡"
),
COCO_PRODUCT_CASH_COUPON
(
"COCO_PRODUCT_CASH_COUPON"
,
"coco商品代金券"
),
;
private
String
code
;
...
...
order-application-service/pom.xml
View file @
3fe7d457
...
...
@@ -87,8 +87,8 @@
<!-- 商户门店sdk -->
<dependency>
<groupId>
com.freemud.application.service.sdk
</groupId>
<artifactId>
storecenter-sdk
</artifactId>
<version>
3.3.5-SNAPSHOT
</version>
<artifactId>
storecenter-sdk
</artifactId>
</dependency>
<dependency>
<groupId>
cn.freemud
</groupId>
...
...
order-application-service/src/main/java/cn/freemud/adapter/OrderAdapter.java
View file @
3fe7d457
...
...
@@ -1283,7 +1283,7 @@ public class OrderAdapter {
responseVo
.
setAfterRefundInterval
(
false
);
}
//商品信息转换
convent2ProductVos
(
ordersBean
.
getProductList
(),
responseVo
);
convent2ProductVos
(
ordersBean
.
getProductList
(),
responseVo
,
ordersBean
.
getCompanyId
()
);
responseVo
.
setOrderAccounts
(
convent2OrderAccountVo
(
ordersBean
.
getApportionDetails
()));
if
(
CollectionUtils
.
isNotEmpty
(
ordersBean
.
getOrderCostDetailList
()))
{
ordersBean
.
getOrderCostDetailList
().
forEach
(
o
->
{
...
...
@@ -1955,7 +1955,7 @@ public class OrderAdapter {
return
orderAccountVos
;
}
public
void
convent2ProductVos
(
List
<
QueryOrdersResponse
.
DataBean
.
OrderBean
.
ProductBean
>
productBeans
,
QueryOrderResponseVo
responseVo
)
{
public
void
convent2ProductVos
(
List
<
QueryOrdersResponse
.
DataBean
.
OrderBean
.
ProductBean
>
productBeans
,
QueryOrderResponseVo
responseVo
,
String
partnerId
)
{
if
(
CollectionUtils
.
isEmpty
(
productBeans
))
{
return
;
}
...
...
@@ -1990,16 +1990,28 @@ public class OrderAdapter {
}
if
(
ObjectUtils
.
equals
(
ProductTypeEnum
.
MATERIAL_PRODUCT
.
getCode
(),
productBean
.
getProductType
()))
{
List
<
ProductVo
>
setMaterialProducts
=
new
ArrayList
<>();
if
(
mcCafePartnerId
.
equals
(
partnerId
))
{
productBean
.
getMaterialProduct
().
forEach
(
product
->
{
ProductVo
material
=
convent2ProductVo
(
product
);
setMaterialProducts
.
add
(
material
);
material
.
setOriginalTotalAmount
(
new
BigDecimal
(
material
.
getOriginalPrice
()).
multiply
(
new
BigDecimal
(
productVo
.
getQty
())).
longValue
());
material
.
setSaleTotalAmount
(
new
BigDecimal
(
material
.
getFinalPrice
()).
multiply
(
new
BigDecimal
(
productVo
.
getQty
())).
longValue
());
setMaterialProducts
.
add
(
material
);
productVo
.
setOriginalPrice
(
new
BigDecimal
(
productVo
.
getOriginalPrice
()).
add
(
new
BigDecimal
(
material
.
getOriginalPrice
())).
longValue
());
productVo
.
setFinalPrice
(
new
BigDecimal
(
productVo
.
getFinalPrice
()).
add
(
new
BigDecimal
(
material
.
getFinalPrice
())).
longValue
());
productVo
.
setOriginalTotalAmount
(
new
BigDecimal
(
productVo
.
getOriginalTotalAmount
()).
add
(
new
BigDecimal
(
material
.
getOriginalTotalAmount
())).
longValue
());
productVo
.
setSaleTotalAmount
(
new
BigDecimal
(
productVo
.
getSaleTotalAmount
()).
add
(
new
BigDecimal
(
material
.
getSaleTotalAmount
())).
longValue
());
});
}
else
{
productBean
.
getMaterialProduct
().
forEach
(
product
->
{
ProductVo
material
=
convent2ProductVo
(
product
);
setMaterialProducts
.
add
(
material
);
productVo
.
setOriginalPrice
(
new
BigDecimal
(
productVo
.
getOriginalPrice
()).
subtract
(
new
BigDecimal
(
material
.
getOriginalPrice
())).
longValue
());
productVo
.
setFinalPrice
(
new
BigDecimal
(
productVo
.
getFinalPrice
()).
subtract
(
new
BigDecimal
(
material
.
getFinalPrice
())).
longValue
());
productVo
.
setOriginalTotalAmount
(
new
BigDecimal
(
productVo
.
getOriginalTotalAmount
()).
subtract
(
new
BigDecimal
(
material
.
getOriginalTotalAmount
())).
longValue
());
productVo
.
setSaleTotalAmount
(
new
BigDecimal
(
productVo
.
getSaleTotalAmount
()).
subtract
(
new
BigDecimal
(
product
.
getSettlementPrice
())).
longValue
());
});
}
productVo
.
setSetMaterialProducts
(
setMaterialProducts
);
}
productVos
.
add
(
productVo
);
...
...
@@ -2161,6 +2173,22 @@ public class OrderAdapter {
return
orderPayRefundRequest
;
}
public
MultiOrderRefundRequest
getMultiOrderPayRefundRequest
(
QueryOrdersResponseDto
.
DataBean
.
OrderBean
orderBean
,
Long
refundId
)
{
MultiOrderRefundRequest
multiQueryRequest
=
new
MultiOrderRefundRequest
();
multiQueryRequest
.
setStationId
(
"1"
);
multiQueryRequest
.
setPartnerId
(
orderBean
.
getCompanyId
());
multiQueryRequest
.
setStoreId
(
orderBean
.
getShopId
());
multiQueryRequest
.
setFmId
(
""
);
multiQueryRequest
.
setRefundAmount
(
orderBean
.
getAmount
());
multiQueryRequest
.
setRefundTradeNo
(
String
.
valueOf
(
refundId
));
multiQueryRequest
.
setStoreId
(
orderBean
.
getShopId
());
multiQueryRequest
.
setNotifyUrl
(
refundNotifyCallback
);
multiQueryRequest
.
setVer
(
"V1"
);
multiQueryRequest
.
setVer3
(
false
);
multiQueryRequest
.
setOutOrderNo
(
orderBean
.
getOid
());
return
multiQueryRequest
;
}
public
CancelOrderRequest
convent2CancelOrderRequest
(
String
orderId
,
String
partnerId
,
AfterSalesType
afterSalesType
,
String
reason
,
String
trackingNo
,
String
refundId
)
{
CancelOrderRequest
cancelOrderRequest
=
new
CancelOrderRequest
();
...
...
@@ -2410,7 +2438,7 @@ public class OrderAdapter {
public
CreateOrderProductRequest
convent2OrderProductDemo
(
ShoppingCartGoodsDto
.
CartGoodsDetailDto
cartGoodsDetailDto
)
{
CreateOrderProductRequest
createOrderProductDemoDto
=
new
CreateOrderProductRequest
();
createOrderProductDemoDto
.
setProductId
(
cartGoodsDetailDto
.
getSp
uId
());
createOrderProductDemoDto
.
setProductId
(
StringUtils
.
isNotBlank
(
cartGoodsDetailDto
.
getSpuId
())
?
cartGoodsDetailDto
.
getSpuId
()
:
cartGoodsDetailDto
.
getSk
uId
());
createOrderProductDemoDto
.
setProductName
(
cartGoodsDetailDto
.
getSpuName
());
createOrderProductDemoDto
.
setSpecification
(
cartGoodsDetailDto
.
getSkuId
());
createOrderProductDemoDto
.
setSpecificationName
(
cartGoodsDetailDto
.
getSkuName
());
...
...
@@ -2542,6 +2570,17 @@ public class OrderAdapter {
if
(
ActivityTypeEnum
.
TYPE_23
.
getCode
().
equals
(
activityType
)){
return
OldOrderAccountType
.
SUPER_PURCHASE
;
}
if
(
ActivityTypeEnum
.
TYPE_221
.
getCode
().
equals
(
activityType
)){
return
OldOrderAccountType
.
GATHER_SPOT
;
}
if
(
ActivityTypeEnum
.
TYPE_221
.
getCode
().
equals
(
activityType
)){
return
OldOrderAccountType
.
GATHER_SPOT
;
}
// coco商品代金券
if
(
ActivityTypeEnum
.
TYPE_36
.
getCode
().
equals
(
activityType
)){
return
OldOrderAccountType
.
COCO_PRODUCT_CASH_COUPON
;
}
return
OldOrderAccountType
.
BUYM_SENDN
;
}
...
...
@@ -3842,20 +3881,4 @@ public class OrderAdapter {
return
responseDto
;
}
public
MultiOrderRefundRequest
getMultiOrderPayRefundRequest
(
QueryOrdersResponseDto
.
DataBean
.
OrderBean
orderBean
,
Long
refundId
)
{
MultiOrderRefundRequest
multiQueryRequest
=
new
MultiOrderRefundRequest
();
multiQueryRequest
.
setStationId
(
"1"
);
multiQueryRequest
.
setPartnerId
(
orderBean
.
getCompanyId
());
multiQueryRequest
.
setStoreId
(
orderBean
.
getShopId
());
multiQueryRequest
.
setFmId
(
""
);
multiQueryRequest
.
setRefundAmount
(
orderBean
.
getAmount
());
multiQueryRequest
.
setRefundTradeNo
(
String
.
valueOf
(
refundId
));
multiQueryRequest
.
setStoreId
(
orderBean
.
getShopId
());
multiQueryRequest
.
setNotifyUrl
(
refundNotifyCallback
);
multiQueryRequest
.
setVer
(
"V1"
);
multiQueryRequest
.
setVer3
(
false
);
multiQueryRequest
.
setOutOrderNo
(
orderBean
.
getOid
());
return
multiQueryRequest
;
}
}
order-application-service/src/main/java/cn/freemud/entities/dto/QueryOrdersResponseDto.java
View file @
3fe7d457
...
...
@@ -135,6 +135,10 @@ public class QueryOrdersResponseDto {
*/
private
Integer
orderType
;
/**
* 销售类型或营销活动类型 1普通订单 2秒杀订单 3推广活动 4拼单订单
*/
private
Byte
marketingType
;
/**
* 取餐码
*/
private
String
otherCode
;
...
...
order-application-service/src/main/java/cn/freemud/enums/ActivityTypeEnum.java
View file @
3fe7d457
...
...
@@ -55,7 +55,8 @@ public enum ActivityTypeEnum {
TYPE_DELIVERY
(
901
,
"配送费"
),
TYPE_211
(
211
,
"套餐优惠"
),
TYPE_221
(
221
,
"集点活动"
),
TYPE_320
(
320
,
"会员价优惠"
);
TYPE_320
(
320
,
"会员价优惠"
),
TYPE_36
(
36
,
"coco商品代金券"
);
private
Integer
code
;
...
...
order-application-service/src/main/java/cn/freemud/enums/OrderAccountType.java
View file @
3fe7d457
...
...
@@ -28,7 +28,7 @@ public enum OrderAccountType {
CARD_ORIGINAL_AMOUNT
(
25
,
"会员卡原价"
),
CARD_DISCOUNT_AMOUNT
(
26
,
"会员卡优惠金额"
),
BUY3_SEND1
(
35
,
"买三赠1券"
),
;
COCO_PRODUCT_CASH_COUPON
(
36
,
"coco商品代金券"
)
;
private
Integer
code
;
private
String
desc
;
...
...
order-application-service/src/main/java/cn/freemud/service/coupon/impl/CocoCouponRelationServiceImpl.java
View file @
3fe7d457
...
...
@@ -35,6 +35,7 @@ import com.freemud.application.sdk.api.ordercenter.response.orderInfo.OrderSettl
import
com.freemud.application.sdk.api.service.EmailAlertService
;
import
com.freemud.sdk.api.assortment.order.adapter.OrderSdkAdapter
;
import
com.google.common.base.Throwables
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -47,6 +48,7 @@ import java.util.function.Function;
import
java.util.stream.Collectors
;
@Service
(
"cocoCouponRelationService"
)
@Slf4j
public
class
CocoCouponRelationServiceImpl
implements
CouponRelationService
{
@Autowired
...
...
@@ -81,8 +83,16 @@ public class CocoCouponRelationServiceImpl implements CouponRelationService {
}
// 根据商品id转map
Map
<
String
,
QueryOrdersResponseDto
.
DataBean
.
OrderBean
.
ProductBean
>
productMap
=
productList
.
stream
().
collect
(
Collectors
.
toMap
(
QueryOrdersResponseDto
.
DataBean
.
OrderBean
.
ProductBean
::
getProductId
,
Function
.
identity
(),
(
oldValue
,
newValue
)
->
newValue
));
Map
<
String
,
QueryOrdersResponseDto
.
DataBean
.
OrderBean
.
ProductBean
>
productMap
=
new
HashMap
<>();
for
(
QueryOrdersResponseDto
.
DataBean
.
OrderBean
.
ProductBean
pb
:
productList
){
productMap
.
put
(
pb
.
getSpecification
(),
pb
);
List
<
QueryOrdersResponseDto
.
DataBean
.
OrderBean
.
ProductBean
>
materialProducts
=
pb
.
getMaterialProduct
();
if
(
materialProducts
!=
null
&&
!
materialProducts
.
isEmpty
()){
for
(
QueryOrdersResponseDto
.
DataBean
.
OrderBean
.
ProductBean
materialProduct
:
materialProducts
){
productMap
.
put
(
materialProduct
.
getSpecification
(),
materialProduct
);
}
}
}
// 根据活动号分组,没有活动号的直接筛选掉
Map
<
String
,
List
<
OrderSettlementResp
>>
orderSettlementMap
=
orderSettlementList
.
stream
().
filter
(
os
->
StringUtils
.
isNotEmpty
(
os
.
getExternalObjectId
()))
...
...
@@ -134,16 +144,19 @@ public class CocoCouponRelationServiceImpl implements CouponRelationService {
// 根据活动号转类型
Integer
orderAccountType
=
orderSdkAdapter
.
getOldOrderAccountType
(
settlementType
);
// 不是商品券、代金券、折扣券不处理
if
(!
OrderAccountType
.
COUPON
.
getCode
().
equals
(
orderAccountType
)
&&
// 不是商品券、代金券、折扣券、商品代金券不处理
if
(!
OrderAccountType
.
COCO_PRODUCT_CASH_COUPON
.
getCode
().
equals
(
orderAccountType
)
&&
!
OrderAccountType
.
COUPON
.
getCode
().
equals
(
orderAccountType
)
&&
!
OrderAccountType
.
PRODUCT_COUPON
.
getCode
().
equals
(
orderAccountType
)
&&
!
OrderAccountType
.
DISCOUNT_COUPON
.
getCode
().
equals
(
orderAccountType
)){
continue
;
}
if
(
OrderAccountType
.
COUPON
.
getCode
().
equals
(
orderAccountType
)
&&
Objects
.
equals
(
orderSettlementInfo
.
get
(
0
).
getProductId
(),
0
)){
if
(
OrderAccountType
.
COUPON
.
getCode
().
equals
(
orderAccountType
)
&&
"0"
.
equals
(
orderSettlementInfo
.
get
(
0
).
getProductId
()
)){
// 整单代金券,最后在计算
orderSettlementRemain
.
add
(
orderSettlementInfo
.
get
(
0
));
continue
;
}
CouponCodeVerificationTransDto
couponCodeVerificationTransDto
=
new
CouponCodeVerificationTransDto
();
...
...
@@ -160,14 +173,17 @@ public class CocoCouponRelationServiceImpl implements CouponRelationService {
}
// 商品code不为0,此时取得是具体的商品
if
(!
Objects
.
equals
(
osr
.
getProductId
(),
0
)){
if
(!
"0"
.
equals
(
osr
.
getProductId
()
)){
// 计算商品原价
Integer
num
=
osr
.
getNumber
();
String
productId
=
osr
.
getProductId
();
QueryOrdersResponseDto
.
DataBean
.
OrderBean
.
ProductBean
pb
=
productMap
.
get
(
productId
);
if
(
pb
!
=
null
){
oriAmount
=
oriAmount
+
(
pb
.
getPrice
()
==
null
?
0
:
pb
.
getPrice
().
intValue
())
*
(
num
==
null
?
0
:
num
)
;
if
(
pb
=
=
null
){
continue
;
}
oriAmount
=
oriAmount
+
(
pb
.
getPrice
()
==
null
?
0
:
pb
.
getPrice
().
intValue
())
*
(
num
==
null
?
0
:
num
);
orderSettlementAlready
.
add
(
osr
);
// 统计商品
CouponCodeVerificationProductDto
couponCodeVerificationProductDto
=
new
CouponCodeVerificationProductDto
();
...
...
@@ -186,10 +202,6 @@ public class CocoCouponRelationServiceImpl implements CouponRelationService {
}
couponCodeVerificationTransDto
.
setProducts
(
products
);
//处理第三方外卖单优惠金额信息
if
(
totalAmount
!=
null
&&
totalAmount
.
intValue
()
>
0
){
totalAmount
=
0
-
Math
.
abs
(
totalAmount
);
}
// 总优惠金额单位:分
couponCodeVerificationTransDto
.
setTotalAmount
(
totalAmount
);
...
...
@@ -215,40 +227,26 @@ public class CocoCouponRelationServiceImpl implements CouponRelationService {
// 券号
couponCodeVerificationTransFull
.
setCode
(
osr
.
getExternalObjectId
());
// 总优惠金额单位:分
couponCodeVerificationTransFull
.
setTotalAmount
(
osr
.
getSettlementAmount
().
intValue
());
couponCodeVerificationTransFull
.
setTotalAmount
(
0
-
osr
.
getSettlementAmount
().
intValue
());
// 订单号
couponCodeVerificationTransFull
.
setOrderNumber
(
orderBean
.
getOid
());
List
<
CouponCodeVerificationProductDto
>
productsFull
=
new
ArrayList
<>();
Integer
totalAmountFull
=
0
;
Integer
totalAmount
Ori
Full
=
0
;
for
(
QueryOrdersResponseDto
.
DataBean
.
OrderBean
.
ProductBean
pb
:
productList
){
Long
alreadyNum
=
collect
.
get
(
osr
.
getProductId
())
==
null
?
0L
:
collect
.
get
(
osr
.
getProductId
()).
getSum
();
Integer
num
=
pb
.
getNumber
();
Integer
remainNum
=
num
-
alreadyNum
.
intValue
();
if
(
Objects
.
equals
(
remainNum
,
0
)){
continue
;
totalAmountOriFull
=
buidVerificationProduct
(
collect
,
osr
,
pb
,
productsFull
,
totalAmountOriFull
);
// 小料商品也取出来
List
<
QueryOrdersResponseDto
.
DataBean
.
OrderBean
.
ProductBean
>
materialProducts
=
pb
.
getMaterialProduct
();
if
(
materialProducts
!=
null
&&
!
materialProducts
.
isEmpty
()){
for
(
QueryOrdersResponseDto
.
DataBean
.
OrderBean
.
ProductBean
materialProduct
:
materialProducts
){
totalAmountOriFull
=
buidVerificationProduct
(
collect
,
osr
,
materialProduct
,
productsFull
,
totalAmountOriFull
);
}
}
// 统计商品
CouponCodeVerificationProductDto
couponCodeVerificationProductFull
=
new
CouponCodeVerificationProductDto
();
couponCodeVerificationProductFull
.
setConsume_num
(
remainNum
);
couponCodeVerificationProductFull
.
setPID
(
osr
.
getProductId
());
couponCodeVerificationProductFull
.
setSeq
(
osr
.
getProductSeq
());
couponCodeVerificationProductFull
.
setProductName
(
pb
.
getProductName
());
Integer
price
=
pb
.
getPrice
()
==
null
?
0
:
pb
.
getPrice
().
intValue
();
couponCodeVerificationProductFull
.
setInitPrice
(
price
);
couponCodeVerificationProductFull
.
setNowPrice
(
price
);
couponCodeVerificationProductFull
.
setPayMoney
(
price
);
productsFull
.
add
(
couponCodeVerificationProductFull
);
totalAmountFull
=
totalAmountFull
+
price
*
remainNum
;
}
couponCodeVerificationTransFull
.
setProducts
(
productsFull
);
couponCodeVerificationTransFull
.
setAmountPaid
(
totalAmountFull
);
couponCodeVerificationTransFull
.
setAmountRec
(
totalAmountFull
);
couponCodeVerificationTransFull
.
setAmountPaid
(
totalAmount
Ori
Full
);
couponCodeVerificationTransFull
.
setAmountRec
(
totalAmount
Ori
Full
);
transactions
.
add
(
couponCodeVerificationTransFull
);
}
...
...
@@ -257,21 +255,27 @@ public class CocoCouponRelationServiceImpl implements CouponRelationService {
couponCodeVerificationDto
.
setTransactions
(
transactions
);
try
{
for
(
CouponCodeVerificationTransDto
transaction
:
transactions
){
List
<
CouponCodeVerificationTransDto
>
transactionsNew
=
new
ArrayList
<>();
transactionsNew
.
add
(
transaction
);
couponCodeVerificationDto
.
setTransactions
(
transactionsNew
);
//71.券核销
for
(
int
i
=
2
;
i
>=
0
;
i
--)
{
LogUtil
.
info
(
"coco核销券码开始=="
,
JSON
.
toJSONString
(
couponCodeVerificationDto
),
null
);
CouponCodeResponseDto
couponCodeResponseDto
=
couponOfflineClient
.
verification
(
couponCodeVerificationDto
);
LogUtil
.
info
(
"coco核销券码返回=="
,
JSON
.
toJSONString
(
couponCodeVerificationDto
),
null
);
ThirdPartyLog
.
infoConvertJson
(
System
.
currentTimeMillis
(),
System
.
currentTimeMillis
(),
"/api"
,
couponCodeVerificationDto
,
couponCodeResponseDto
);
if
(
Objects
.
equals
(
couponCodeResponseDto
.
getStatusCode
(),
ResponseResult
.
SUCCESS
.
getCode
()))
{
LogUtil
.
info
(
"coco CocoCouponRelationServiceImpl
"
,
JSON
.
toJSONString
(
couponCodeVerificationDto
),
JSON
.
toJSONString
(
couponCodeResponseDto
));
log
.
info
(
"coco 核销券码返回成功,couponCodeVerificationDto:{},couponCodeResponseDto:{},
"
,
JSON
.
toJSONString
(
couponCodeVerificationDto
),
JSON
.
toJSONString
(
couponCodeResponseDto
));
break
;
}
if
(!
Objects
.
equals
(
couponCodeResponseDto
.
getStatusCode
(),
ResponseResult
.
SUCCESS
.
getCode
()))
{
emailAlertService
.
sendEmailAlert
(
"cooc核销券码失败"
,
String
.
format
(
"request:%s \r\nresponse:%s"
,
JSONObject
.
toJSONString
(
couponCodeVerificationDto
),
JSONObject
.
toJSONString
(
couponCodeResponseDto
)));
log
.
info
(
"coco 核销券码返回失败,couponCodeVerificationDto:{},couponCodeResponseDto:{},"
,
JSON
.
toJSONString
(
couponCodeVerificationDto
),
JSON
.
toJSONString
(
couponCodeResponseDto
));
return
ResponseUtil
.
error
(
ResponseResult
.
COUPON_VERIFICATION_FAIL
);
}
}
}
}
catch
(
Exception
ex
)
{
emailAlertService
.
sendEmailAlert
(
"coco核销券码异常"
,
String
.
format
(
"request:%s \r\nexception:%s"
,
JSONObject
.
toJSONString
(
couponCodeVerificationDto
),
Throwables
.
getStackTraceAsString
(
ex
)));
...
...
@@ -279,7 +283,49 @@ public class CocoCouponRelationServiceImpl implements CouponRelationService {
return
ResponseUtil
.
error
(
ResponseResult
.
COUPON_VERIFICATION_FAIL
);
}
return
ResponseUtil
.
success
();
}
/**
* 构建整单券的商品
* @param collect
* @param osr
* @param pb
* @param productsFull
* @param totalAmountOriFull
* @return
*/
public
Integer
buidVerificationProduct
(
Map
<
String
,
IntSummaryStatistics
>
collect
,
OrderSettlementResp
osr
,
QueryOrdersResponseDto
.
DataBean
.
OrderBean
.
ProductBean
pb
,
List
<
CouponCodeVerificationProductDto
>
productsFull
,
Integer
totalAmountOriFull
){
Long
alreadyNum
=
collect
.
get
(
pb
.
getSpecification
())
==
null
?
0L
:
collect
.
get
(
pb
.
getSpecification
()).
getSum
();
Integer
num
=
pb
.
getNumber
();
Integer
remainNum
=
num
-
alreadyNum
.
intValue
();
if
(
Objects
.
equals
(
remainNum
,
0
)){
return
totalAmountOriFull
;
}
// 统计商品
Integer
price
=
pb
.
getPrice
()
==
null
?
0
:
pb
.
getPrice
().
intValue
();
if
(
price
.
intValue
()
==
0
){
return
totalAmountOriFull
;
}
CouponCodeVerificationProductDto
couponCodeVerificationProductFull
=
new
CouponCodeVerificationProductDto
();
couponCodeVerificationProductFull
.
setConsume_num
(
remainNum
);
couponCodeVerificationProductFull
.
setPID
(
pb
.
getProductId
());
couponCodeVerificationProductFull
.
setSeq
(
pb
.
getSequence
());
couponCodeVerificationProductFull
.
setProductName
(
pb
.
getProductName
());
couponCodeVerificationProductFull
.
setInitPrice
(
price
);
couponCodeVerificationProductFull
.
setNowPrice
(
price
);
couponCodeVerificationProductFull
.
setPayMoney
(
price
);
productsFull
.
add
(
couponCodeVerificationProductFull
);
totalAmountOriFull
=
totalAmountOriFull
+
price
*
remainNum
;
return
totalAmountOriFull
;
}
}
order-application-service/src/main/java/cn/freemud/service/impl/OrderServiceImpl.java
View file @
3fe7d457
...
...
@@ -510,6 +510,17 @@ public class OrderServiceImpl implements Orderservice {
takeCode
=
payAccessResponse
.
getData
().
getTakeCode
();
daySeq
=
payAccessResponse
.
getData
().
getDaySeq
();
if
(
null
!=
orderBean
.
getMarketingType
()
&&
OrderMarketType
.
COLLAGE
.
getIndex
()
==
orderBean
.
getMarketingType
())
{
// 更新拼单购物车状态
CollageOrderDto
collageOrderDto
=
new
CollageOrderDto
();
collageOrderDto
.
setSessionId
(
StringUtils
.
isBlank
(
sessionId
)
?
oid
:
sessionId
);
collageOrderDto
.
setPartnerId
(
partnerId
);
collageOrderDto
.
setShopId
(
storeId
);
collageOrderDto
.
setCreateCollageUserId
(
userId
);
collageOrderDto
.
setOrderCode
(
oid
);
collageOrderDto
.
setStatus
(
1
);
shoppingCartClient
.
updateCollageOrder
(
collageOrderDto
);
}
else
{
//TODO 清空购物车
NewShoppingCartClearDto
newShoppingCartClearDto
=
new
NewShoppingCartClearDto
();
newShoppingCartClearDto
.
setPartnerId
(
partnerId
);
...
...
@@ -519,16 +530,7 @@ public class OrderServiceImpl implements Orderservice {
newShoppingCartClearDto
.
setSessionId
(
sessionId
);
newShoppingCartClearDto
.
setOperationType
(
1
);
shoppingCartClient
.
clearShoppingCart
(
newShoppingCartClearDto
);
// 清空拼单购物车
CollageOrderDto
collageOrderDto
=
new
CollageOrderDto
();
collageOrderDto
.
setSessionId
(
StringUtils
.
isBlank
(
sessionId
)
?
oid
:
sessionId
);
collageOrderDto
.
setPartnerId
(
partnerId
);
collageOrderDto
.
setShopId
(
storeId
);
collageOrderDto
.
setCreateCollageUserId
(
userId
);
collageOrderDto
.
setOrderCode
(
oid
);
collageOrderDto
.
setStatus
(
1
);
shoppingCartClient
.
updateCollageOrder
(
collageOrderDto
);
}
if
(
StringUtils
.
isNotBlank
(
daySeq
)
&&
orderExtInfoDto
!=
null
&&
!
OrderType
.
TAKE_OUT
.
getCode
().
equals
(
orderBean
.
getType
()))
{
String
storeAddress
=
StringUtils
.
isNotBlank
(
orderBean
.
getAddress
())
?
orderBean
.
getAddress
()
:
""
;
...
...
order-management/src/main/java/cn/freemud/management/service/handle/DeliveryHandle.java
View file @
3fe7d457
...
...
@@ -26,7 +26,6 @@ import com.freemud.application.sdk.api.storecenter.response.StoreResponse;
import
com.freemud.sdk.api.assortment.order.adapter.OrderSdkAdapter
;
import
com.freemud.sdk.api.assortment.order.enums.OrderSourceType
;
import
com.freemud.sdk.api.assortment.order.response.order.QueryOrdersResponse
;
import
javafx.util.Pair
;
import
org.apache.commons.lang.ObjectUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
order-management/src/main/java/cn/freemud/management/service/impl/OrderDeliveryService.java
View file @
3fe7d457
...
...
@@ -22,7 +22,6 @@ import com.freemud.application.sdk.api.storecenter.response.StoreResponse;
import
com.freemud.application.sdk.api.storecenter.service.StoreCenterService
;
import
com.freemud.sdk.api.assortment.order.enums.OrderSourceType
;
import
com.freemud.sdk.api.assortment.order.response.order.QueryOrdersResponse
;
import
javafx.util.Pair
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.ObjectUtils
;
import
org.apache.commons.lang.StringUtils
;
...
...
shopping-cart-application-service/src/main/java/cn/freemud/adapter/ShoppingCartMccafeAdapter.java
View file @
3fe7d457
...
...
@@ -127,7 +127,11 @@ public class ShoppingCartMccafeAdapter {
if
(
StringUtils
.
isEmpty
(
cartGoods
.
getCouponCode
())
&&
GoodsTypeEnum
.
SET_MEAL_GOODS
.
getGoodsType
().
equals
(
cartGoods
.
getGoodsType
()))
{
return
cartGoodsDetailDtos
;
}
else
{
cartGoodsDetailDtos
.
add
(
convertCartGoods2DetailGoods
(
cartGoods
,
apportionGoodsList
,
duplicateGoodsMap
));
ShoppingCartGoodsDto
.
CartGoodsDetailDto
cartGoodsDetailDto
=
convertCartGoods2DetailGoods
(
cartGoods
,
apportionGoodsList
,
duplicateGoodsMap
);
if
(
GoodsTypeEnum
.
SET_MEAL_GOODS
.
getGoodsType
().
equals
(
cartGoods
.
getGoodsType
()))
{
cartGoodsDetailDto
.
setComboProducts
(
this
.
convertComboxGoods2DetailGoods
(
cartGoods
,
cartGoodsDetailDto
.
getTotalDiscountAmount
()));
}
cartGoodsDetailDtos
.
add
(
cartGoodsDetailDto
);
}
return
cartGoodsDetailDtos
;
}
...
...
@@ -170,6 +174,7 @@ public class ShoppingCartMccafeAdapter {
}
else
if
(
cartGoods
.
isWeightType
())
{
cartGoodsDetailDto
.
setProductType
(
ProductType
.
WEIGHT_PRODUCT
.
getCode
());
}
//小料
if
(
CollectionUtils
.
isNotEmpty
(
cartGoods
.
getProductMaterialList
()))
{
List
<
ShoppingCartGoodsDto
.
CartGoodsDetailDto
.
MaterialGoods
>
materialList
=
new
ArrayList
<>(
0
);
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/CalculationServiceImpl.java
View file @
3fe7d457
...
...
@@ -80,8 +80,12 @@ public class CalculationServiceImpl {
@Autowired
private
MaterialCalculation
materialCalculation
;
// @Autowired
// private ShoppingCartConvertAdapter shoppingCartConvertAdapter;
@Autowired
private
ShoppingCartMccafeAdapter
shoppingCartMccafeAdapter
;
// @Autowired
// private ItemServiceImpl itemService;
/**
* 更新购物车行优惠信息
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/CouponDiscountCalculation.java
View file @
3fe7d457
...
...
@@ -474,6 +474,7 @@ public class CouponDiscountCalculation {
private
Long
createProductRequest
(
List
<
CartGoods
>
cartGoods
,
List
<
CouponProductVo
>
productList
)
{
Long
totalAmount
=
0L
;
try
{
for
(
CartGoods
cartGood
:
cartGoods
)
{
// 剔除商品券得商品
if
(
StringUtils
.
isEmpty
(
cartGood
.
getSkuId
())
&&
StringUtils
.
isEmpty
(
cartGood
.
getSpuId
()))
{
...
...
@@ -501,6 +502,9 @@ public class CouponDiscountCalculation {
productList
.
add
(
product
);
totalAmount
=
totalAmount
+
product
.
getAmount
()
*
cartGood
.
getQty
();
}
}
catch
(
NumberFormatException
e
)
{
throw
new
ServiceException
(
ResponseResult
.
SYSTEM_ERROR
);
}
return
totalAmount
;
}
...
...
shopping-cart-application-service/src/main/java/cn/freemud/service/impl/mcoffee/calculation/SetMealCalculation.java
View file @
3fe7d457
...
...
@@ -108,14 +108,18 @@ public class SetMealCalculation {
}
Long
amount
=
null
!=
cartGoods
.
getFinalPrice
()
?
cartGoods
.
getFinalPrice
()*
cartGoods
.
getQty
()
+
productGroupTotalAmount
+
materialPrice
:
//如果是商品券商品,不重新计算套餐价格
if
(
StringUtils
.
isEmpty
(
cartGoods
.
getCouponCode
()))
{
Long
amount
=
null
!=
cartGoods
.
getFinalPrice
()
?
cartGoods
.
getFinalPrice
()
*
cartGoods
.
getQty
()
+
productGroupTotalAmount
+
materialPrice
:
productGroupTotalAmount
+
productComboTotalAmount
+
materialPrice
;
cartGoods
.
setAmount
(
amount
);
}
Long
comboOriginalPriceAmount
=
null
!=
cartGoods
.
getOriginalAmount
()
?
cartGoods
.
getOriginalAmount
()
:
productComboTotalAmount
;
cartGoods
.
setOriginalAmount
(
productGroupTotalAmount
+
comboOriginalPriceAmount
+
materialPrice
);
cartGoods
.
setOriginalPrice
(
null
!=
cartGoods
.
getOriginalPrice
()
?
cartGoods
.
getOriginalPrice
()
:
productComboTotalAmount
);
cartGoods
.
setAmount
(
amount
);
cartGoods
.
setFinalPrice
(
null
!=
cartGoods
.
getFinalPrice
()
?
cartGoods
.
getFinalPrice
()
:
productComboTotalAmount
);
...
...
@@ -153,7 +157,7 @@ public class SetMealCalculation {
});
// 套餐优惠明细
for
(
CartGoods
cartGoods
:
shoppingCartGoodsResponseVo
.
getProducts
())
{
if
(
ObjectUtils
.
equals
(
GoodsTypeEnum
.
SET_MEAL_GOODS
.
getGoodsType
(),
cartGoods
.
getGoodsType
()))
{
if
(
ObjectUtils
.
equals
(
GoodsTypeEnum
.
SET_MEAL_GOODS
.
getGoodsType
(),
cartGoods
.
getGoodsType
())
&&
StringUtils
.
isBlank
(
cartGoods
.
getCouponCode
())
)
{
// discountAmount=(套餐原价-套餐售价)*数量
// productGroupDiscountAmount=可选商品现价总和
// discountAmount-productGroupDiscountAmount: 当前商品行套餐商品总优惠= 套餐原总价-套餐现总价-套餐可选商品的现总价
...
...
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