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
06d20b29
Commit
06d20b29
authored
Jun 16, 2021
by
周晓航
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
基于 张跃33版本开发 34 锁券功能
Signed-off-by: 周晓航 <xiaohang.zhou@freemud.com>
parent
e1be933a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
153 additions
and
112 deletions
+153
-112
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/adapter/OrderSdkAdapter.java
+151
-111
order-application-service/src/main/java/cn/freemud/adapter/CreateOrderAdapter.java
+2
-1
No files found.
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/adapter/OrderSdkAdapter.java
View file @
06d20b29
package
com
.
freemud
.
sdk
.
api
.
assortment
.
order
.
adapter
;
import
com.freemud.application.sdk.api.log.ApiLog
;
import
com.google.common.collect.Lists
;
...
...
@@ -58,11 +59,12 @@ public class OrderSdkAdapter {
/**
* 接单request
*
* @param operator
* @param orderBean
* @return
*/
public
BaseQueryOrderRequest
getOrderConfirmRequest
(
String
operator
,
QueryOrdersResponse
.
DataBean
.
OrderBean
orderBean
){
public
BaseQueryOrderRequest
getOrderConfirmRequest
(
String
operator
,
QueryOrdersResponse
.
DataBean
.
OrderBean
orderBean
)
{
BaseQueryOrderRequest
orderRequest
=
new
BaseQueryOrderRequest
();
orderRequest
.
setOrderId
(
orderBean
.
getOid
());
orderRequest
.
setShopId
(
orderBean
.
getShopId
());
...
...
@@ -70,7 +72,7 @@ public class OrderSdkAdapter {
orderRequest
.
setPartnerId
(
orderBean
.
getCompanyId
());
// orderRequest.setOrderType(getNewOrderTypeEnum(orderBean.getType(), orderBean.getGmtExpect()));
orderRequest
.
setOrderType
(
OrderType
.
getOrderType
(
orderBean
.
getNewOrderType
()));
if
(
orderBean
.
getGmtExpect
()
!=
null
&&
orderBean
.
getGmtExpect
()
!=
0
)
{
if
(
orderBean
.
getGmtExpect
()
!=
null
&&
orderBean
.
getGmtExpect
()
!=
0
)
{
orderRequest
.
setExpectTime
(
cn
.
freemud
.
base
.
util
.
DateUtil
.
convert2String
(
new
Date
(
orderBean
.
getGmtExpect
()),
cn
.
freemud
.
base
.
util
.
DateUtil
.
FORMAT_YYYY_MM_DD_HHMMSS
));
}
orderRequest
.
setOperator
(
operator
);
...
...
@@ -79,8 +81,7 @@ public class OrderSdkAdapter {
//配送信息为空,自配送
if
(
orderBean
.
getAddInfo
()
==
null
||
orderBean
.
getAddInfo
().
getDeliveryType
()
==
null
)
{
orderRequest
.
setDeliveryType
(
QueryDeliveryType
.
SELF
.
getCode
());
}
else
{
}
else
{
orderRequest
.
setDeliveryType
(
orderBean
.
getAddInfo
().
getDeliveryType
());
}
return
orderRequest
;
...
...
@@ -104,6 +105,7 @@ public class OrderSdkAdapter {
/**
* 拒单request
*
* @param operator
* @param reason
* @param refundStatus
...
...
@@ -111,7 +113,7 @@ public class OrderSdkAdapter {
* @param orderBean
* @return
*/
public
CancelOrderRequest
getCancelOrderRequest
(
String
operator
,
String
reason
,
PayRefundStatus
refundStatus
,
String
refundId
,
QueryOrdersResponse
.
DataBean
.
OrderBean
orderBean
)
{
public
CancelOrderRequest
getCancelOrderRequest
(
String
operator
,
String
reason
,
PayRefundStatus
refundStatus
,
String
refundId
,
QueryOrdersResponse
.
DataBean
.
OrderBean
orderBean
)
{
CancelOrderRequest
var1
=
new
CancelOrderRequest
();
var1
.
setPartnerId
(
orderBean
.
getCompanyId
());
var1
.
setOrderId
(
orderBean
.
getOid
());
...
...
@@ -130,7 +132,8 @@ public class OrderSdkAdapter {
var1
.
setReason
(
reason
);
return
var1
;
}
public
CancelOrderRequest
getRejectRefundRequest
(
String
operator
,
String
reason
,
QueryOrdersResponse
.
DataBean
.
OrderBean
orderBean
){
public
CancelOrderRequest
getRejectRefundRequest
(
String
operator
,
String
reason
,
QueryOrdersResponse
.
DataBean
.
OrderBean
orderBean
)
{
CancelOrderRequest
var1
=
new
CancelOrderRequest
();
var1
.
setOrderId
(
orderBean
.
getOid
());
var1
.
setReason
(
reason
);
...
...
@@ -160,7 +163,7 @@ public class OrderSdkAdapter {
return
cancelOrderRequest
;
}
public
BaseQueryOrderRequest
getRefundAgreeRequest
(
String
refund_id
,
String
reason
,
String
operator
,
QueryOrdersResponse
.
DataBean
.
OrderBean
orderBean
)
{
public
BaseQueryOrderRequest
getRefundAgreeRequest
(
String
refund_id
,
String
reason
,
String
operator
,
QueryOrdersResponse
.
DataBean
.
OrderBean
orderBean
)
{
BaseQueryOrderRequest
var1
=
new
BaseQueryOrderRequest
();
var1
.
setPartnerId
(
orderBean
.
getCompanyId
());
var1
.
setOrderId
(
orderBean
.
getOid
());
...
...
@@ -212,10 +215,10 @@ public class OrderSdkAdapter {
request
.
setSettlementAmount
(
requestVO
.
getAmount
());
//实际支付现金金额,扣除支付自生优惠,单位分
request
.
setActualPayAmount
(
requestVO
.
getAmount
());
if
(
requestVO
.
getOrderClient
()
!=
null
)
{
if
(
requestVO
.
getOrderClient
()
!=
null
)
{
request
.
setOrderClient
(
requestVO
.
getOrderClient
().
getIndex
());
}
else
{
request
.
setOrderClient
(
StringUtils
.
isEmpty
(
requestVO
.
getSource
())
?
OrderClientType
.
SAAS
.
getIndex
():
getNewOrderClient
(
requestVO
.
getSource
()));
}
else
{
request
.
setOrderClient
(
StringUtils
.
isEmpty
(
requestVO
.
getSource
())
?
OrderClientType
.
SAAS
.
getIndex
()
:
getNewOrderClient
(
requestVO
.
getSource
()));
}
//订单业务类型 1:普通订单 2:虚拟订单
request
.
setBizType
(
1
);
...
...
@@ -282,7 +285,7 @@ public class OrderSdkAdapter {
request
.
setWeight
(
orderWeight
);
// 买一赠一寄件信息
if
(
requestVO
.
getChooseGoods
()
!=
null
&&
!
requestVO
.
getChooseGoods
().
isEmpty
())
{
if
(
requestVO
.
getChooseGoods
()
!=
null
&&
!
requestVO
.
getChooseGoods
().
isEmpty
())
{
request
.
setOrderSendCouponRespList
(
JSONArray
.
parseArray
(
JSONObject
.
toJSONString
(
requestVO
.
getChooseGoods
()),
CreateOrderRequest
.
ChooseGood
.
class
));
}
...
...
@@ -323,10 +326,10 @@ public class OrderSdkAdapter {
request
.
setSettlementAmount
(
requestVO
.
getAmount
());
//实际支付现金金额,扣除支付自生优惠,单位分
request
.
setActualPayAmount
(
requestVO
.
getAmount
());
if
(
requestVO
.
getOrderClient
()
!=
null
)
{
if
(
requestVO
.
getOrderClient
()
!=
null
)
{
request
.
setOrderClient
(
requestVO
.
getOrderClient
().
getIndex
());
}
else
{
request
.
setOrderClient
(
StringUtils
.
isEmpty
(
requestVO
.
getSource
())
?
OrderClientType
.
SAAS
.
getIndex
():
getNewOrderClient
(
requestVO
.
getSource
()));
}
else
{
request
.
setOrderClient
(
StringUtils
.
isEmpty
(
requestVO
.
getSource
())
?
OrderClientType
.
SAAS
.
getIndex
()
:
getNewOrderClient
(
requestVO
.
getSource
()));
}
//订单业务类型 1:普通订单 2:虚拟订单
request
.
setBizType
(
1
);
...
...
@@ -511,7 +514,7 @@ public class OrderSdkAdapter {
orderCostCreateReq
.
setCostName
(
accountRequest
.
getName
());
//新订单服务 1=包装费,2=运费,3=餐盒单价,4=餐盒数量
orderCostCreateReq
.
setCostType
(
getCostType
(
accountRequest
.
getAccountType
()));
orderCostCreateReq
.
setActualCostAmount
(
accountRequest
.
getActualPrice
()
!=
null
?
accountRequest
.
getActualPrice
():
accountRequest
.
getPrice
());
orderCostCreateReq
.
setActualCostAmount
(
accountRequest
.
getActualPrice
()
!=
null
?
accountRequest
.
getActualPrice
()
:
accountRequest
.
getPrice
());
orderCostCreateReq
.
setCostAmount
(
accountRequest
.
getPrice
());
originalAmount
+=
accountRequest
.
getPrice
();
orderCostCreateReq
.
setProductSeq
(
accountRequest
.
getSequence
());
...
...
@@ -659,7 +662,7 @@ public class OrderSdkAdapter {
orderConditionsReq
.
setOrderCodes
(
request
.
getOrderIds
());
orderConditionsReq
.
setPartnerId
(
request
.
getCompanyId
());
orderConditionsReq
.
setPageSize
(
request
.
getPageSize
());
orderConditionsReq
.
setPageNum
(
request
.
getPageNumber
()
>
0
?
request
.
getPageNumber
():
0
);
orderConditionsReq
.
setPageNum
(
request
.
getPageNumber
()
>
0
?
request
.
getPageNumber
()
:
0
);
orderConditionsReq
.
setMobile
(
request
.
getPhoneNo
());
orderConditionsReq
.
setStoreIds
(
request
.
getShopIds
());
orderConditionsReq
.
setPayStatuses
(
request
.
getPayStatuses
());
...
...
@@ -830,7 +833,7 @@ public class OrderSdkAdapter {
accountBean
.
setNumber
(
1
);
accountBean
.
setPrice
(
orderSettlementResp
.
getSettlementAmount
()
==
null
?
0L
:
orderSettlementResp
.
getSettlementAmount
().
longValue
());
//处理第三方外卖单优惠金额信息
if
(
orderSettlementResp
.
getSettlementAmount
()
!=
null
&&
orderSettlementResp
.
getSettlementAmount
().
intValue
()
>
0
)
{
if
(
orderSettlementResp
.
getSettlementAmount
()
!=
null
&&
orderSettlementResp
.
getSettlementAmount
().
intValue
()
>
0
)
{
long
discountFee
=
0
-
Math
.
abs
(
orderSettlementResp
.
getSettlementAmount
().
longValue
());
accountBean
.
setPrice
(
discountFee
);
}
...
...
@@ -893,9 +896,9 @@ public class OrderSdkAdapter {
String
partnerProductId
=
orderItem
.
getProductId
()
+
"_"
+
orderItem
.
getProductSeq
();
List
<
OrderItemResp
>
comboProducts
=
orderItemList
.
stream
().
filter
(
item
->
ObjectUtils
.
equals
(
partnerProductId
,
item
.
getParentProductId
())).
collect
(
Collectors
.
toList
());
comboProducts
.
forEach
(
combo
->
productBean
.
getComboProduct
().
add
(
getOldOrderProduct
(
orderSettlementResps
,
combo
)));
if
(
CollectionUtils
.
isNotEmpty
(
productBean
.
getComboProduct
()))
{
for
(
QueryOrdersResponse
.
DataBean
.
OrderBean
.
ProductBean
comboProductBean
:
productBean
.
getComboProduct
())
{
if
(
ObjectUtils
.
equals
(
ProductTypeEnum
.
MATERIAL_PRODUCT
.
getCode
(),
comboProductBean
.
getProductType
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
productBean
.
getComboProduct
()))
{
for
(
QueryOrdersResponse
.
DataBean
.
OrderBean
.
ProductBean
comboProductBean
:
productBean
.
getComboProduct
())
{
if
(
ObjectUtils
.
equals
(
ProductTypeEnum
.
MATERIAL_PRODUCT
.
getCode
(),
comboProductBean
.
getProductType
()))
{
comboProductBean
.
setMaterialProduct
(
new
ArrayList
<>());
String
addProductId
=
comboProductBean
.
getProductId
()
+
"_"
+
comboProductBean
.
getOpid
();
List
<
OrderItemResp
>
materialProducts
=
orderItemList
.
stream
().
filter
(
item
->
ObjectUtils
.
equals
(
addProductId
,
item
.
getParentProductId
())).
collect
(
Collectors
.
toList
());
...
...
@@ -912,7 +915,7 @@ public class OrderSdkAdapter {
materialProducts
.
forEach
(
material
->
productBean
.
getMaterialProduct
().
add
(
getOldOrderProduct
(
orderSettlementResps
,
material
)));
}
if
(
StringUtils
.
isNotEmpty
(
productBean
.
getExtInfo
()))
{
if
(
StringUtils
.
isNotEmpty
(
productBean
.
getExtInfo
()))
{
OrderProductAddInfoDto
extInfo
=
JSONObject
.
parseObject
(
productBean
.
getExtInfo
(),
OrderProductAddInfoDto
.
class
);
productBean
.
setIsSendGoods
(
null
==
extInfo
.
getIsSendGoods
()
?
false
:
extInfo
.
getIsSendGoods
());
productBean
.
setCartGoodsUid
(
StringUtils
.
isEmpty
(
extInfo
.
getCartGoodsUid
())
?
""
:
extInfo
.
getCartGoodsUid
());
...
...
@@ -922,16 +925,16 @@ public class OrderSdkAdapter {
productList
.
add
(
productBean
);
}
if
(
null
!=
productList
&&
productList
.
size
()
>
0
)
{
if
(
null
!=
productList
&&
productList
.
size
()
>
0
)
{
for
(
QueryOrdersResponse
.
DataBean
.
OrderBean
.
ProductBean
sendProductBean
:
productList
)
{
sendProductBean
.
setIsPrint
(
true
);
if
(
null
!=
sendProductBean
.
getIsSendGoods
()
&&
sendProductBean
.
getIsSendGoods
()
&&
StringUtils
.
isNotEmpty
(
sendProductBean
.
getOriginalGoodsUid
()))
{
if
(
null
!=
sendProductBean
.
getIsSendGoods
()
&&
sendProductBean
.
getIsSendGoods
()
&&
StringUtils
.
isNotEmpty
(
sendProductBean
.
getOriginalGoodsUid
()))
{
sendProductBean
.
setIsPrint
(
false
);
}
if
(
StringUtils
.
isNotEmpty
(
sendProductBean
.
getCartGoodsUid
())
&&
null
!=
sendProductBean
.
getIsSendGoods
()
&&
!
sendProductBean
.
getIsSendGoods
()
)
{
if
(
StringUtils
.
isNotEmpty
(
sendProductBean
.
getCartGoodsUid
())
&&
null
!=
sendProductBean
.
getIsSendGoods
()
&&
!
sendProductBean
.
getIsSendGoods
()
)
{
sendProductBean
.
setSendProduct
(
productList
.
stream
()
.
filter
(
productBean
->
productBean
.
getOriginalGoodsUid
().
equalsIgnoreCase
(
sendProductBean
.
getCartGoodsUid
())
&&
productBean
.
getIsSendGoods
()
==
true
)
.
filter
(
productBean
->
productBean
.
getOriginalGoodsUid
().
equalsIgnoreCase
(
sendProductBean
.
getCartGoodsUid
())
&&
productBean
.
getIsSendGoods
()
==
true
)
.
map
(
o
->
JSON
.
parseObject
(
JSON
.
toJSONString
(
o
),
QueryOrdersResponse
.
DataBean
.
OrderBean
.
ProductBean
.
class
))
.
collect
(
Collectors
.
toList
()));
}
...
...
@@ -1090,7 +1093,7 @@ public class OrderSdkAdapter {
*/
public
QueryOrdersResponse
.
DataBean
.
OrderBean
convent2NEWOrderInfo
(
OrderInfoReqs
orderInfoReqs
)
{
QueryOrdersResponse
.
DataBean
.
OrderBean
data
=
new
QueryOrdersResponse
.
DataBean
.
OrderBean
();
if
(
Objects
.
nonNull
(
orderInfoReqs
.
getEstimateDeliveryCompleteTime
()))
{
if
(
Objects
.
nonNull
(
orderInfoReqs
.
getEstimateDeliveryCompleteTime
()))
{
data
.
setEstimateDeliveryCompleteTime
(
Long
.
parseLong
(
orderInfoReqs
.
getEstimateDeliveryCompleteTime
()));
}
data
.
setOrderClient
(
orderInfoReqs
.
getOrderClient
().
toString
());
...
...
@@ -1168,9 +1171,9 @@ public class OrderSdkAdapter {
}
data
.
setOperator
(
orderInfoReqs
.
getOperator
());
data
.
setOperateTime
(
orderInfoReqs
.
getUpdateTimestamp
());
if
(
CollectionUtils
.
isNotEmpty
(
orderInfoReqs
.
getOrderOperationHistoryList
())){
List
<
OrderOperationHistoryResp
>
historyList
=
orderInfoReqs
.
getOrderOperationHistoryList
();
OrderOperationHistoryResp
historyResp
=
historyList
.
get
(
historyList
.
size
()
-
1
);
if
(
CollectionUtils
.
isNotEmpty
(
orderInfoReqs
.
getOrderOperationHistoryList
()))
{
List
<
OrderOperationHistoryResp
>
historyList
=
orderInfoReqs
.
getOrderOperationHistoryList
();
OrderOperationHistoryResp
historyResp
=
historyList
.
get
(
historyList
.
size
()
-
1
);
data
.
setOperator
(
historyResp
.
getOperator
());
data
.
setOperateTime
(
historyResp
.
getUpdateTime
());
}
...
...
@@ -1202,16 +1205,16 @@ public class OrderSdkAdapter {
if
(
orderInfoReqs
.
getPayTime
()
!=
null
)
{
data
.
setGmtPay
(
Long
.
parseLong
(
orderInfoReqs
.
getPayTime
()));
}
if
(
orderInfoReqs
.
getReceiveTime
()!=
null
)
{
if
(
orderInfoReqs
.
getReceiveTime
()
!=
null
)
{
data
.
setGmtCompleteTime
(
Long
.
parseLong
(
orderInfoReqs
.
getReceiveTime
()));
data
.
setGmtReceiveTime
(
Long
.
parseLong
(
orderInfoReqs
.
getReceiveTime
()));
}
if
(
orderInfoReqs
.
getDeliveryTime
()
!=
null
)
{
if
(
orderInfoReqs
.
getDeliveryTime
()
!=
null
)
{
data
.
setGmtDelivery
(
Long
.
decode
(
orderInfoReqs
.
getDeliveryTime
()));
}
if
(
null
!=
orderInfoReqs
.
getAfterSalesOrderList
()
&&
orderInfoReqs
.
getAfterSalesOrderList
().
size
()>
0
)
{
if
(
null
!=
orderInfoReqs
.
getAfterSalesOrderList
()
&&
orderInfoReqs
.
getAfterSalesOrderList
().
size
()
>
0
)
{
AfterSalesOrderResp
afterSalesOrderResp
=
orderInfoReqs
.
getAfterSalesOrderList
().
get
(
0
);
if
(
AfterSalesStatus
.
COMPLETE
.
getIndex
()
==
afterSalesOrderResp
.
getAfterSalesStatus
())
{
if
(
AfterSalesStatus
.
COMPLETE
.
getIndex
()
==
afterSalesOrderResp
.
getAfterSalesStatus
())
{
data
.
setGmtRefundFinish
(
Long
.
parseLong
(
afterSalesOrderResp
.
getUpdateTime
()));
}
}
...
...
@@ -1278,9 +1281,9 @@ public class OrderSdkAdapter {
data
.
setOrderOperationHistoryList
(
getOrderOperationHistory
(
orderInfoReqs
.
getOrderOperationHistoryList
()));
data
.
setApportionDetails
(
getApportionDetails
(
orderInfoReqs
));
data
.
setOrderSettlementDetailList
(
orderInfoReqs
.
getOrderSettlementDetailList
());
if
(
Objects
.
nonNull
(
orderInfoReqs
.
getOrderSettlementDetailList
())){
if
(
Objects
.
nonNull
(
orderInfoReqs
.
getOrderSettlementDetailList
()))
{
orderInfoReqs
.
getOrderSettlementDetailList
().
stream
()
.
filter
(
e
->
Objects
.
equals
(
OrderSettlementType
.
SPELL_GROUP
.
getIndex
(),
e
.
getSettlementType
())).
findFirst
().
ifPresent
(
e
->
data
.
setSpellGroupActivityCode
(
e
.
getExternalObjectId
()));
.
filter
(
e
->
Objects
.
equals
(
OrderSettlementType
.
SPELL_GROUP
.
getIndex
(),
e
.
getSettlementType
())).
findFirst
().
ifPresent
(
e
->
data
.
setSpellGroupActivityCode
(
e
.
getExternalObjectId
()));
}
//费用信息
data
.
setOrderCostDetailList
(
orderInfoReqs
.
getOrderCostDetailList
());
...
...
@@ -1310,6 +1313,7 @@ public class OrderSdkAdapter {
/**
* 混合支付转换
*
* @param OrderPayItemReqs
*/
private
List
<
QueryOrdersResponse
.
DataBean
.
OrderBean
.
OrderPayItem
>
getOrderItemPayList
(
List
<
OrderPayItemReqs
>
OrderPayItemReqs
)
{
...
...
@@ -1325,6 +1329,7 @@ public class OrderSdkAdapter {
}
return
OrderPayItemList
;
}
public
QueryOrdersResponse
convent2QueryOrdersResponse
(
BaseResponse
<
QueryOrderForUserResp
>
baseResponse
)
{
QueryOrdersResponse
response
=
new
QueryOrdersResponse
();
response
.
setErrcode
(
Integer
.
parseInt
(
baseResponse
.
getCode
()));
...
...
@@ -1467,34 +1472,34 @@ public class OrderSdkAdapter {
type
=
104
;
break
;
case
"TOTAL_DISCOUNT"
:
type
=
205
;
type
=
205
;
break
;
case
"ONLINE_PAY"
:
type
=
218
;
type
=
218
;
break
;
case
"OFFLINE_PAY"
:
type
=
219
;
type
=
219
;
break
;
case
"FULL_DISTRIBUTION_FEE"
:
type
=
1014
;
type
=
1014
;
break
;
case
"MEMBER_PRICE_DISCOUNT"
:
type
=
220
;
type
=
220
;
break
;
case
"GATHER_SPOT"
:
type
=
221
;
type
=
221
;
break
;
case
"COCO_PRODUCT_CASH_COUPON"
:
type
=
36
;
type
=
36
;
break
;
case
"FULL_BUYM_SENDN"
:
type
=
230
;
type
=
230
;
break
;
case
"MONTH_CARD_TOTAL_DISCOUNT"
:
type
=
231
;
type
=
231
;
break
;
case
"SINGLE_PRODUCT_REDUCTION"
:
type
=
22
;
type
=
22
;
break
;
default
:
break
;
...
...
@@ -1746,7 +1751,7 @@ public class OrderSdkAdapter {
* @param stockChangeType 库存改变类型
* @return
*/
public
UpdateStocksRequest
getUpdateProductStock
(
QueryOrdersResponse
.
DataBean
.
OrderBean
orderBean
,
List
<
CreateOrderProductRequest
>
products
,
StockChangeType
stockChangeType
,
String
menuType
)
{
public
UpdateStocksRequest
getUpdateProductStock
(
QueryOrdersResponse
.
DataBean
.
OrderBean
orderBean
,
List
<
CreateOrderProductRequest
>
products
,
StockChangeType
stockChangeType
,
String
menuType
)
{
UpdateStocksRequest
updateStocksRequest
=
new
UpdateStocksRequest
();
updateStocksRequest
.
setChannel
(
menuType
);
updateStocksRequest
.
setChangeType
(
stockChangeType
.
getCode
());
...
...
@@ -2104,25 +2109,25 @@ public class OrderSdkAdapter {
newOrderAccountType
=
OldOrderAccountType
.
XY_DISCOUNT
.
getCode
();
break
;
case
205
:
newOrderAccountType
=
OldOrderAccountType
.
TOTAL_DISCOUNT
.
getCode
();
newOrderAccountType
=
OldOrderAccountType
.
TOTAL_DISCOUNT
.
getCode
();
break
;
case
220
:
newOrderAccountType
=
OldOrderAccountType
.
MEMBER_PRICE_DISCOUNT
.
getCode
();
newOrderAccountType
=
OldOrderAccountType
.
MEMBER_PRICE_DISCOUNT
.
getCode
();
break
;
case
99
:
newOrderAccountType
=
OldOrderAccountType
.
FREIGHT_COUPON
.
getCode
();
newOrderAccountType
=
OldOrderAccountType
.
FREIGHT_COUPON
.
getCode
();
break
;
case
36
:
newOrderAccountType
=
OldOrderAccountType
.
COCO_PRODUCT_CASH_COUPON
.
getCode
();
newOrderAccountType
=
OldOrderAccountType
.
COCO_PRODUCT_CASH_COUPON
.
getCode
();
break
;
case
230
:
newOrderAccountType
=
OldOrderAccountType
.
FULL_BUYM_SENDN
.
getCode
();
newOrderAccountType
=
OldOrderAccountType
.
FULL_BUYM_SENDN
.
getCode
();
break
;
case
231
:
newOrderAccountType
=
OldOrderAccountType
.
MONTH_CARD_TOTAL_DISCOUNT
.
getCode
();
newOrderAccountType
=
OldOrderAccountType
.
MONTH_CARD_TOTAL_DISCOUNT
.
getCode
();
break
;
case
22
:
newOrderAccountType
=
OldOrderAccountType
.
SINGLE_PRODUCT_REDUCTION
.
getCode
();
newOrderAccountType
=
OldOrderAccountType
.
SINGLE_PRODUCT_REDUCTION
.
getCode
();
break
;
default
:
break
;
...
...
@@ -2449,12 +2454,12 @@ public class OrderSdkAdapter {
return
userScoreRequest
;
}
public
CouponRequest
convert2CouponVerificationRequest
(
QueryOrdersResponse
.
DataBean
.
OrderBean
orderBean
,
List
<
CreateOrderAccountRequest
>
accounts
){
public
CouponRequest
convert2CouponVerificationRequest
(
QueryOrdersResponse
.
DataBean
.
OrderBean
orderBean
,
List
<
CreateOrderAccountRequest
>
accounts
)
{
if
(
CollectionUtils
.
isEmpty
(
accounts
))
{
return
null
;
}
Optional
<
CreateOrderAccountRequest
>
accountRequest
=
accounts
.
stream
().
filter
(
account
->
account
.
getAccountType
().
equals
(
QueryOrderAccountType
.
COUPON
)
||
account
.
getAccountType
().
equals
(
QueryOrderAccountType
.
PRODUCT_COUPON
)
||
account
.
getAccountType
().
equals
(
QueryOrderAccountType
.
DISCOUNT_COUPON
)).
findFirst
();
Optional
<
CreateOrderAccountRequest
>
accountRequest
=
accounts
.
stream
().
filter
(
account
->
account
.
getAccountType
().
equals
(
QueryOrderAccountType
.
COUPON
)
||
account
.
getAccountType
().
equals
(
QueryOrderAccountType
.
PRODUCT_COUPON
)
||
account
.
getAccountType
().
equals
(
QueryOrderAccountType
.
DISCOUNT_COUPON
)).
findFirst
();
if
(!
accountRequest
.
isPresent
()
||
accountRequest
.
get
().
getPrice
()
==
0
)
{
return
null
;
}
...
...
@@ -2481,7 +2486,7 @@ public class OrderSdkAdapter {
}
}
}
ActivityChannelEnum
activityChannelEnum
=
Objects
.
equals
(
OldOrderType
.
TAKE_OUT
.
getCode
(),
orderBean
.
getType
())
?
ActivityChannelEnum
.
delivery
:
ActivityChannelEnum
.
pickup
;
ActivityChannelEnum
activityChannelEnum
=
Objects
.
equals
(
OldOrderType
.
TAKE_OUT
.
getCode
(),
orderBean
.
getType
())
?
ActivityChannelEnum
.
delivery
:
ActivityChannelEnum
.
pickup
;
CouponRequest
couponCodeVerificationDto
=
new
CouponRequest
();
couponCodeVerificationDto
.
setVer
(
Integer
.
valueOf
(
Version
.
VERSION_1
));
couponCodeVerificationDto
.
setReqtype
(
71
);
...
...
@@ -2770,7 +2775,7 @@ public class OrderSdkAdapter {
* @return 订单金额
*/
public
Long
updateOrderItemsAndSettlements
(
List
<
OrderItemCreateReq
>
orderItemList
,
List
<
OrderSettlementCreateReq
>
orderSettlementCreateReqList
,
List
<
OrderCostCreateReq
>
orderCostCreateReqs
,
List
<
CreateOrderProductRequest
>
products
,
List
<
CreateOrderAccountRequest
>
accounts
,
String
partnerId
)
{
List
<
CreateOrderProductRequest
>
products
,
List
<
CreateOrderAccountRequest
>
accounts
,
String
partnerId
)
{
Long
originalAmount
=
0L
;
// 更新订单费用信息
originalAmount
=
convertCreateOrderCost
(
originalAmount
,
orderSettlementCreateReqList
,
orderCostCreateReqs
,
accounts
);
...
...
@@ -2787,7 +2792,7 @@ public class OrderSdkAdapter {
if
(
CollectionUtils
.
isNotEmpty
(
productRequest
.
getMaterialProduct
()))
{
// 父类商品productId=productId+seq
String
partnerProductId
=
productRequest
.
getProductId
()
+
"_"
+
index
;
for
(
CreateOrderProductRequest
material
:
productRequest
.
getMaterialProduct
())
{
for
(
CreateOrderProductRequest
material
:
productRequest
.
getMaterialProduct
())
{
index
++;
material
.
setOpid
(
index
);
material
.
setSpecification
(
material
.
getProductId
());
...
...
@@ -2810,7 +2815,7 @@ public class OrderSdkAdapter {
}
private
Long
updateMCCafeOrderItemsAndSettlements
(
List
<
OrderItemCreateReq
>
orderItemList
,
List
<
OrderSettlementCreateReq
>
orderSettlementCreateReqList
,
List
<
OrderCostCreateReq
>
orderCostCreateReqs
,
List
<
CreateOrderProductRequest
>
products
,
List
<
CreateOrderAccountRequest
>
accounts
,
String
partnerId
)
{
List
<
CreateOrderProductRequest
>
products
,
List
<
CreateOrderAccountRequest
>
accounts
,
String
partnerId
)
{
Long
originalAmount
=
0L
;
// 更新订单费用信息
originalAmount
=
convertCreateOrderCost
(
originalAmount
,
orderSettlementCreateReqList
,
orderCostCreateReqs
,
accounts
);
...
...
@@ -2829,12 +2834,12 @@ public class OrderSdkAdapter {
// 父类商品productId=productId+seq
String
parentProductId
=
productRequest
.
getProductId
()
+
"_"
+
index
;
if
(
CollectionUtils
.
isNotEmpty
(
productRequest
.
getComboProduct
()))
{
for
(
CreateOrderProductRequest
combo
:
productRequest
.
getComboProduct
())
{
for
(
CreateOrderProductRequest
combo
:
productRequest
.
getComboProduct
())
{
combo
.
setOpid
(
comboIndex
);
updateMCCafeOrderItemAndSettlement
(
productRequest
,
orderItemList
,
orderSettlementCreateReqList
,
combo
,
partnerId
,
parentProductId
,
false
);
if
(
CollectionUtils
.
isNotEmpty
(
combo
.
getMaterialProduct
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
combo
.
getMaterialProduct
()))
{
String
addProductId
=
combo
.
getProductId
()
+
"_"
+
comboIndex
;
for
(
CreateOrderProductRequest
material
:
combo
.
getMaterialProduct
())
{
for
(
CreateOrderProductRequest
material
:
combo
.
getMaterialProduct
())
{
material
.
setSpecification
(
material
.
getProductId
());
material
.
setSpecificationName
(
material
.
getProductName
());
updateMCCafeOrderItemAndSettlement
(
productRequest
,
orderItemList
,
orderSettlementCreateReqList
,
material
,
partnerId
,
addProductId
,
true
);
...
...
@@ -2843,10 +2848,10 @@ public class OrderSdkAdapter {
comboIndex
++;
}
}
}
else
if
(
CollectionUtils
.
isNotEmpty
(
productRequest
.
getMaterialProduct
()))
{
}
else
if
(
CollectionUtils
.
isNotEmpty
(
productRequest
.
getMaterialProduct
()))
{
// 父类商品productId=productId+seq
String
addProductId
=
productRequest
.
getProductId
()
+
"_"
+
index
;
for
(
CreateOrderProductRequest
material
:
productRequest
.
getMaterialProduct
())
{
for
(
CreateOrderProductRequest
material
:
productRequest
.
getMaterialProduct
())
{
material
.
setSpecification
(
material
.
getProductId
());
material
.
setSpecificationName
(
material
.
getProductName
());
updateMCCafeOrderItemAndSettlement
(
productRequest
,
orderItemList
,
orderSettlementCreateReqList
,
material
,
partnerId
,
addProductId
,
true
);
...
...
@@ -2914,7 +2919,7 @@ public class OrderSdkAdapter {
Long
setmealTotalSettlementPrice
=
0L
;
for
(
CreateOrderProductRequest
createOrderProductRequest
:
product
.
getComboProduct
())
{
// 删除的不计算在内
if
(
createOrderProductRequest
.
getIsDeleted
()
!=
null
&&
createOrderProductRequest
.
getIsDeleted
())
{
if
(
createOrderProductRequest
.
getIsDeleted
()
!=
null
&&
createOrderProductRequest
.
getIsDeleted
())
{
continue
;
}
Long
comboProductTotalDiscountAmount
=
createOrderProductRequest
.
getTotalDiscountAmount
()
==
null
?
0L
:
createOrderProductRequest
.
getTotalDiscountAmount
();
...
...
@@ -2945,7 +2950,7 @@ public class OrderSdkAdapter {
orderItemCreateReq
.
setProductUnit
(
product
.
getUnit
());
//获取商品属性
OrderProductAddInfoDto
addInfo
=
JSONObject
.
parseObject
(
product
.
getAddInfo
(),
OrderProductAddInfoDto
.
class
);
if
(
addInfo
!=
null
)
{
if
(
addInfo
!=
null
)
{
orderItemCreateReq
.
setProductProperty
(
addInfo
.
getAttributeNames
());
orderItemCreateReq
.
setProductForeignProperty
(
addInfo
.
getAttributeForeignNames
());
}
...
...
@@ -2973,29 +2978,29 @@ public class OrderSdkAdapter {
if
(
StringUtils
.
isNotBlank
(
product
.
getThirdProductPropertyId
()))
{
extInfo
.
setThirdProductPropertyId
(
product
.
getThirdProductPropertyId
());
}
if
(
StringUtils
.
isNotBlank
(
product
.
getThirdCategoryId
())){
if
(
StringUtils
.
isNotBlank
(
product
.
getThirdCategoryId
()))
{
extInfo
.
setThirdCategoryId
(
product
.
getThirdCategoryId
());
}
if
(
StringUtils
.
isNotBlank
(
product
.
getClassificationId
())){
if
(
StringUtils
.
isNotBlank
(
product
.
getClassificationId
()))
{
extInfo
.
setThirdCensusCategoryId
(
product
.
getClassificationId
());
extInfo
.
setThirdCensusCategoryName
(
product
.
getClassificationName
());
}
if
(
CollectionUtils
.
isNotEmpty
(
product
.
getSpecialAttrs
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
product
.
getSpecialAttrs
()))
{
extInfo
.
setSpecialAttrs
(
product
.
getSpecialAttrs
());
}
if
(
0
!=
product
.
getTax
()){
if
(
0
!=
product
.
getTax
())
{
extInfo
.
setTax
(
product
.
getTax
());
}
if
(
StringUtils
.
isNotBlank
(
product
.
getTaxId
())){
if
(
StringUtils
.
isNotBlank
(
product
.
getTaxId
()))
{
extInfo
.
setTaxId
(
product
.
getTaxId
());
}
if
(
StringUtils
.
isNotBlank
(
product
.
getCardId
())){
if
(
StringUtils
.
isNotBlank
(
product
.
getCardId
()))
{
extInfo
.
setCardId
(
product
.
getCardId
());
}
if
(
StringUtils
.
isNotBlank
(
product
.
getCardCode
())){
if
(
StringUtils
.
isNotBlank
(
product
.
getCardCode
()))
{
extInfo
.
setCardCode
(
product
.
getCardCode
());
}
if
(
StringUtils
.
isNotBlank
(
product
.
getSplitIndex
())){
if
(
StringUtils
.
isNotBlank
(
product
.
getSplitIndex
()))
{
extInfo
.
setSplitIndex
(
product
.
getSplitIndex
());
}
extInfo
.
setStapleFood
(
product
.
getStapleFood
());
...
...
@@ -3007,7 +3012,7 @@ public class OrderSdkAdapter {
extInfo
.
setIsSendGoods
(
product
.
getIsSendGoods
());
// 是否需要积分,农工商发送积分需要判断商品是否是送积分的商品
// 发积分的操作移到消费者,所以这个值需要保存下来
if
(
product
.
getNeedBonus
()
!=
null
)
{
if
(
product
.
getNeedBonus
()
!=
null
)
{
extInfo
.
setNeedBonus
(
product
.
getNeedBonus
());
}
...
...
@@ -3111,7 +3116,7 @@ public class OrderSdkAdapter {
orderItemCreateReq
.
setProductUnit
(
product
.
getUnit
());
//获取商品属性
OrderProductAddInfoDto
addInfo
=
JSONObject
.
parseObject
(
product
.
getAddInfo
(),
OrderProductAddInfoDto
.
class
);
if
(
addInfo
!=
null
)
{
if
(
addInfo
!=
null
)
{
orderItemCreateReq
.
setProductProperty
(
addInfo
.
getAttributeNames
());
orderItemCreateReq
.
setProductForeignProperty
(
addInfo
.
getAttributeForeignNames
());
}
...
...
@@ -3139,29 +3144,29 @@ public class OrderSdkAdapter {
if
(
StringUtils
.
isNotBlank
(
product
.
getThirdProductPropertyId
()))
{
extInfo
.
setThirdProductPropertyId
(
product
.
getThirdProductPropertyId
());
}
if
(
StringUtils
.
isNotBlank
(
product
.
getThirdCategoryId
())){
if
(
StringUtils
.
isNotBlank
(
product
.
getThirdCategoryId
()))
{
extInfo
.
setThirdCategoryId
(
product
.
getThirdCategoryId
());
}
if
(
StringUtils
.
isNotBlank
(
product
.
getClassificationId
())){
if
(
StringUtils
.
isNotBlank
(
product
.
getClassificationId
()))
{
extInfo
.
setThirdCensusCategoryId
(
product
.
getClassificationId
());
extInfo
.
setThirdCensusCategoryName
(
product
.
getClassificationName
());
}
if
(
CollectionUtils
.
isNotEmpty
(
product
.
getSpecialAttrs
()))
{
if
(
CollectionUtils
.
isNotEmpty
(
product
.
getSpecialAttrs
()))
{
extInfo
.
setSpecialAttrs
(
product
.
getSpecialAttrs
());
}
if
(
0
!=
product
.
getTax
()){
if
(
0
!=
product
.
getTax
())
{
extInfo
.
setTax
(
product
.
getTax
());
}
if
(
StringUtils
.
isNotBlank
(
product
.
getTaxId
())){
if
(
StringUtils
.
isNotBlank
(
product
.
getTaxId
()))
{
extInfo
.
setTaxId
(
product
.
getTaxId
());
}
if
(
StringUtils
.
isNotBlank
(
product
.
getCardId
())){
if
(
StringUtils
.
isNotBlank
(
product
.
getCardId
()))
{
extInfo
.
setCardId
(
product
.
getCardId
());
}
if
(
StringUtils
.
isNotBlank
(
product
.
getCardCode
())){
if
(
StringUtils
.
isNotBlank
(
product
.
getCardCode
()))
{
extInfo
.
setCardCode
(
product
.
getCardCode
());
}
if
(
StringUtils
.
isNotBlank
(
product
.
getSplitIndex
())){
if
(
StringUtils
.
isNotBlank
(
product
.
getSplitIndex
()))
{
extInfo
.
setSplitIndex
(
product
.
getSplitIndex
());
}
extInfo
.
setStapleFood
(
product
.
getStapleFood
());
...
...
@@ -3173,7 +3178,7 @@ public class OrderSdkAdapter {
extInfo
.
setIsSendGoods
(
product
.
getIsSendGoods
());
// 是否需要积分,农工商发送积分需要判断商品是否是送积分的商品
// 发积分的操作移到消费者,所以这个值需要保存下来
if
(
product
.
getNeedBonus
()
!=
null
)
{
if
(
product
.
getNeedBonus
()
!=
null
)
{
extInfo
.
setNeedBonus
(
product
.
getNeedBonus
());
}
...
...
@@ -3298,15 +3303,15 @@ public class OrderSdkAdapter {
createOrderProductRequest
.
setSequence
(
productBean
.
getSequence
());
createOrderProductRequest
.
setPrice
(
productBean
.
getPrice
());
Long
orginalTotalAmount
=
productBean
.
getPrice
()
*
productBean
.
getNumber
();
if
(
Objects
.
equals
(
productBean
.
getProductType
(),
ProductTypeEnum
.
WEIGHT_PRODUCT
.
getCode
()))
{
orginalTotalAmount
=
new
BigDecimal
(
productBean
.
getPrice
()
+
""
).
multiply
(
productBean
.
getWeight
()).
longValue
();
if
(
Objects
.
equals
(
productBean
.
getProductType
(),
ProductTypeEnum
.
WEIGHT_PRODUCT
.
getCode
()))
{
orginalTotalAmount
=
new
BigDecimal
(
productBean
.
getPrice
()
+
""
).
multiply
(
productBean
.
getWeight
()).
longValue
();
}
createOrderProductRequest
.
setTotalDiscountAmount
(
orginalTotalAmount
-
productBean
.
getSettlementPrice
());
createOrderProductRequest
.
setUnit
(
productBean
.
getUnit
());
createOrderProductRequest
.
setId
(
productBean
.
getId
());
createOrderProductRequest
.
setProductType
(
productBean
.
getProductType
());
OrderProductAddInfoDto
extInfo
=
JSONObject
.
parseObject
(
productBean
.
getExtInfo
(),
OrderProductAddInfoDto
.
class
);
if
(
extInfo
!=
null
)
{
if
(
extInfo
!=
null
)
{
createOrderProductRequest
.
setIsFixedProduct
(
extInfo
.
getIsFixedProduct
());
createOrderProductRequest
.
setThirdProductSpecId
(
extInfo
.
getThirdProductSpecId
());
createOrderProductRequest
.
setThirdProductPropertyId
(
extInfo
.
getThirdProductPropertyId
());
...
...
@@ -3366,10 +3371,9 @@ public class OrderSdkAdapter {
orderSettlement
.
setCarrierDiscountAmount
(
orderSettlementResp
.
getCarrierDiscountAmount
());
orderSettlement
.
setShopAmount
(
orderSettlementResp
.
getShopAmount
());
orderSettlement
.
setPlatformServiceAmount
(
orderSettlementResp
.
getPlatformServiceAmount
());
if
(
orderSettlementResp
.
getProspectiveAmount
()
!=
null
)
{
if
(
orderSettlementResp
.
getProspectiveAmount
()
!=
null
)
{
orderSettlement
.
setProspectiveAmount
(
orderSettlementResp
.
getProspectiveAmount
().
longValue
());
}
else
{
}
else
{
orderSettlement
.
setProspectiveAmount
(
0L
);
}
orderSettlementList
.
add
(
orderSettlement
);
...
...
@@ -3504,7 +3508,8 @@ public class OrderSdkAdapter {
}
/**
* 异常单转换
* 异常单转换
*
* @param abnormalState
* @return
*/
...
...
@@ -3516,15 +3521,15 @@ public class OrderSdkAdapter {
break
;
}
case
1
:
{
name
=
"系统接单异常"
;
name
=
"系统接单异常"
;
break
;
}
case
2
:
{
name
=
"骑手上报异常"
;
name
=
"骑手上报异常"
;
break
;
}
case
3
:
{
name
=
"系统退单异常"
;
name
=
"系统退单异常"
;
break
;
}
}
...
...
@@ -3532,7 +3537,8 @@ public class OrderSdkAdapter {
}
/**
* 获取订单信息
* 获取订单信息
*
* @param orderStatus
* @return
*/
...
...
@@ -3544,15 +3550,15 @@ public class OrderSdkAdapter {
break
;
}
case
6
:
{
name
=
"审核通过"
;
name
=
"审核通过"
;
break
;
}
case
7
:
{
name
=
"审核未通过"
;
name
=
"审核未通过"
;
break
;
}
case
8
:
{
name
=
"撤单"
;
name
=
"撤单"
;
break
;
}
}
...
...
@@ -3560,7 +3566,8 @@ public class OrderSdkAdapter {
}
/**
* 获取订单信息
* 获取订单信息
*
* @param sourceList
* @return
*/
...
...
@@ -3586,7 +3593,7 @@ public class OrderSdkAdapter {
return
bizTypes
;
}
public
CouponLockRequest
convert2CouponLockRequest
(
QueryOrdersResponse
.
DataBean
.
OrderBean
orderBean
,
List
<
CreateOrderAccountRequest
>
accounts
){
public
CouponLockRequest
convert2CouponLockRequest
(
QueryOrdersResponse
.
DataBean
.
OrderBean
orderBean
,
List
<
CreateOrderAccountRequest
>
accounts
)
{
if
(
CollectionUtils
.
isEmpty
(
accounts
))
{
return
null
;
}
...
...
@@ -3597,7 +3604,7 @@ public class OrderSdkAdapter {
||
account
.
getAccountType
().
equals
(
QueryOrderAccountType
.
DISCOUNT_COUPON
)
||
account
.
getAccountType
().
equals
(
QueryOrderAccountType
.
FREIGHT_COUPON
)
).
collect
(
Collectors
.
toList
());
ApiLog
.
info
(
"优惠券转换,用于锁券操作 orderbean : accounts"
,
orderBean
,
accounts
);
ApiLog
.
info
(
"优惠券转换,用于锁券操作 orderbean : accounts"
,
orderBean
,
accounts
);
if
(
CollectionUtils
.
isEmpty
(
couponList
))
{
return
null
;
}
...
...
@@ -3629,7 +3636,7 @@ public class OrderSdkAdapter {
return
response
;
}
public
BaseQueryOrderRequest
convert2wmDeliveryTimeOut
(
BaseQueryOrderRequest
orderConfirmRequest
,
Integer
timeOut
)
{
public
BaseQueryOrderRequest
convert2wmDeliveryTimeOut
(
BaseQueryOrderRequest
orderConfirmRequest
,
Integer
timeOut
)
{
orderConfirmRequest
.
setTimeout
(
timeOut
);
return
orderConfirmRequest
;
}
...
...
@@ -3667,16 +3674,44 @@ public class OrderSdkAdapter {
return
orderStateInfoResp
;
}
public
CouponRequest
convert2PreCheckRequest
(
QueryOrdersResponse
.
DataBean
.
OrderBean
orderBean
,
List
<
CreateOrderAccountRequest
>
accounts
,
String
openId
)
{
public
CouponRequest
convert2PreCheckRequest
(
QueryOrdersResponse
.
DataBean
.
OrderBean
orderBean
,
List
<
CreateOrderAccountRequest
>
accounts
,
String
openId
)
{
if
(
CollectionUtils
.
isEmpty
(
accounts
))
{
return
null
;
}
Optional
<
CreateOrderAccountRequest
>
accountRequest
=
accounts
.
stream
().
filter
(
account
->
account
.
getAccountType
().
equals
(
QueryOrderAccountType
.
COUPON
)
||
account
.
getAccountType
().
equals
(
QueryOrderAccountType
.
PRODUCT_COUPON
)
||
account
.
getAccountType
().
equals
(
QueryOrderAccountType
.
DISCOUNT_COUPON
)).
findFirst
();
if
(!
accountRequest
.
isPresent
()
||
accountRequest
.
get
().
getPrice
()
==
0
)
{
// fisherman begin
List
<
CreateOrderAccountRequest
>
couponList
=
accounts
.
stream
().
filter
(
account
->
account
.
getAccountType
().
equals
(
QueryOrderAccountType
.
COUPON
)
||
account
.
getAccountType
().
equals
(
QueryOrderAccountType
.
PRODUCT_COUPON
)
||
account
.
getAccountType
().
equals
(
QueryOrderAccountType
.
DISCOUNT_COUPON
)
||
account
.
getAccountType
().
equals
(
QueryOrderAccountType
.
FREIGHT_COUPON
)
).
collect
(
Collectors
.
toList
());
ApiLog
.
info
(
"优惠券转换,用于锁券操作 orderbean : accounts"
,
orderBean
,
accounts
);
if
(
CollectionUtils
.
isEmpty
(
couponList
))
{
return
null
;
}
CreateOrderAccountRequest
accountBean
=
accountRequest
.
get
();
// fisherman end
if
(
couponList
.
size
()
>
1
)
{
// 找出 配送券
CreateOrderAccountRequest
freightCouponAccountBean
=
couponList
.
stream
().
filter
(
account
->
account
.
getAccountType
().
equals
(
QueryOrderAccountType
.
FREIGHT_COUPON
)).
findFirst
().
orElse
(
null
);
TransactionVO
couponCodeVerificationTransDto
=
null
;
if
(!
Objects
.
isNull
(
freightCouponAccountBean
))
{
couponCodeVerificationTransDto
=
new
TransactionVO
();
couponCodeVerificationTransDto
.
setCode
(
freightCouponAccountBean
.
getAccountId
());
couponCodeVerificationTransDto
.
setTotalAmount
(
freightCouponAccountBean
.
getPrice
());
}
// 过滤出 配送券
List
<
CreateOrderAccountRequest
>
collect
=
couponList
.
stream
().
filter
(
account
->
!
account
.
getAccountType
().
equals
(
QueryOrderAccountType
.
FREIGHT_COUPON
)).
collect
(
Collectors
.
toList
());
return
commonMethodVerification
(
couponCodeVerificationTransDto
,
collect
,
orderBean
,
openId
);
}
else
{
return
commonMethodVerification
(
null
,
couponList
,
orderBean
,
openId
);
}
}
private
CouponRequest
commonMethodVerification
(
TransactionVO
freightCouponAccountBean
,
List
<
CreateOrderAccountRequest
>
collect
,
QueryOrdersResponse
.
DataBean
.
OrderBean
orderBean
,
String
openId
)
{
CreateOrderAccountRequest
accountBean
=
collect
.
get
(
0
);
CouponRequest
couponRequest
=
new
CouponRequest
();
couponRequest
.
setReqtype
(
71
);
couponRequest
.
setVer
(
Integer
.
valueOf
(
Version
.
VERSION_1
));
...
...
@@ -3729,6 +3764,11 @@ public class OrderSdkAdapter {
couponCodeVerificationTransDto
.
setProducts
(
products
);
}
transactions
.
add
(
couponCodeVerificationTransDto
);
// 配送券逻辑加入
if
(
freightCouponAccountBean
!=
null
)
{
transactions
.
add
(
freightCouponAccountBean
);
}
// 配送券逻辑 end
couponRequest
.
setTransactions
(
transactions
);
return
couponRequest
;
}
...
...
@@ -3738,7 +3778,7 @@ public class OrderSdkAdapter {
return
ActivityChannelEnum
.
delivery
;
}
else
if
(
Objects
.
equals
(
OldOrderType
.
COLLECT_GOODS
.
getCode
(),
orderType
)
||
Objects
.
equals
(
OldOrderType
.
EAT_IN
.
getCode
(),
orderType
))
{
return
ActivityChannelEnum
.
pickup
;
}
else
if
(
Objects
.
equals
(
OldCreateOrderType
.
SAASMALL
.
getCode
(),
orderType
))
{
}
else
if
(
Objects
.
equals
(
OldCreateOrderType
.
SAASMALL
.
getCode
(),
orderType
))
{
return
ActivityChannelEnum
.
saasmall
;
}
else
{
return
ActivityChannelEnum
.
pickup
;
...
...
order-application-service/src/main/java/cn/freemud/adapter/CreateOrderAdapter.java
View file @
06d20b29
...
...
@@ -1479,6 +1479,7 @@ public class CreateOrderAdapter {
}
public
CouponLockRequest
convert2CouponLockRequest
(
QueryOrdersResponse
.
DataBean
.
OrderBean
orderBean
,
ShoppingCartGoodsDto
shoppingCartGoodsDto
)
{
//fisherman 已经废弃 20210616
if
(
CollectionUtils
.
isEmpty
(
shoppingCartGoodsDto
.
getActivityDiscountsDtos
()))
{
return
null
;
}
...
...
@@ -1494,7 +1495,7 @@ public class CreateOrderAdapter {
// 订单号 替换成唯一序号
couponLockRequest
.
setPartnerId
(
orderBean
.
getCompanyId
());
couponLockRequest
.
setOrderId
(
orderBean
.
getOid
());
couponLockRequest
.
setCouponCode
(
activityDiscountsDto
.
getActivityCode
());
//
couponLockRequest.setCouponCode(activityDiscountsDto.getActivityCode());
return
couponLockRequest
;
}
...
...
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