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
f8b6a2d0
Commit
f8b6a2d0
authored
Oct 20, 2021
by
周晓航
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
下单核销接口 支持多券 传递
Signed-off-by: 周晓航 <xiaohang.zhou@freemud.com>
parent
a68866ed
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
83 additions
and
13 deletions
+83
-13
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/adapter/OrderSdkAdapter.java
+83
-13
No files found.
assortment-ordercenter-sdk/src/main/java/com/freemud/sdk/api/assortment/order/adapter/OrderSdkAdapter.java
View file @
f8b6a2d0
...
@@ -132,7 +132,7 @@ public class OrderSdkAdapter {
...
@@ -132,7 +132,7 @@ public class OrderSdkAdapter {
return
var1
;
return
var1
;
}
}
public
CancelOrderRequest
getRejectRefundRequest
(
String
operator
,
String
reason
,
OrderBeanV1
orderBean
)
{
public
CancelOrderRequest
getRejectRefundRequest
(
String
operator
,
String
reason
,
OrderBeanV1
orderBean
)
{
CancelOrderRequest
var1
=
new
CancelOrderRequest
();
CancelOrderRequest
var1
=
new
CancelOrderRequest
();
var1
.
setOrderId
(
orderBean
.
getOid
());
var1
.
setOrderId
(
orderBean
.
getOid
());
var1
.
setReason
(
reason
);
var1
.
setReason
(
reason
);
...
@@ -228,7 +228,7 @@ public class OrderSdkAdapter {
...
@@ -228,7 +228,7 @@ public class OrderSdkAdapter {
// 20210730之前 默认设置为1
// 20210730之前 默认设置为1
request
.
setBizType
(
CommonConstant
.
INTEGER_ONE
);
request
.
setBizType
(
CommonConstant
.
INTEGER_ONE
);
}
}
request
.
setOrderType
(
getNewOrderType
(
requestVO
.
getOrderType
(),
requestVO
.
getGmtExpect
(),
request
.
getBizType
()));
request
.
setOrderType
(
getNewOrderType
(
requestVO
.
getOrderType
(),
requestVO
.
getGmtExpect
(),
request
.
getBizType
()));
request
.
setNote
(
requestVO
.
getRemark
());
request
.
setNote
(
requestVO
.
getRemark
());
request
.
setBarCounter
(
requestVO
.
getBarCounter
());
request
.
setBarCounter
(
requestVO
.
getBarCounter
());
...
@@ -299,7 +299,7 @@ public class OrderSdkAdapter {
...
@@ -299,7 +299,7 @@ public class OrderSdkAdapter {
request
.
setOrderSendCouponRespList
(
JSONArray
.
parseArray
(
JSONObject
.
toJSONString
(
requestVO
.
getChooseGoods
()),
CreateOrderRequest
.
ChooseGood
.
class
));
request
.
setOrderSendCouponRespList
(
JSONArray
.
parseArray
(
JSONObject
.
toJSONString
(
requestVO
.
getChooseGoods
()),
CreateOrderRequest
.
ChooseGood
.
class
));
}
}
// 【ID1030916】订单查询门店获取预计送达时间
// 【ID1030916】订单查询门店获取预计送达时间
if
(
requestVO
.
getEstimateDeliveryCompleteTime
()
!=
null
)
{
if
(
requestVO
.
getEstimateDeliveryCompleteTime
()
!=
null
)
{
Date
time
=
requestVO
.
getEstimateDeliveryCompleteTime
();
Date
time
=
requestVO
.
getEstimateDeliveryCompleteTime
();
request
.
setEstimateDeliveryCompleteTime
(
time
.
getTime
()
+
""
);
request
.
setEstimateDeliveryCompleteTime
(
time
.
getTime
()
+
""
);
}
}
...
@@ -366,7 +366,7 @@ public class OrderSdkAdapter {
...
@@ -366,7 +366,7 @@ public class OrderSdkAdapter {
//订单业务类型 1:普通订单 2:虚拟订单
//订单业务类型 1:普通订单 2:虚拟订单
request
.
setBizType
(
1
);
request
.
setBizType
(
1
);
request
.
setNote
(
requestVO
.
getRemark
());
request
.
setNote
(
requestVO
.
getRemark
());
request
.
setOrderType
(
getNewOrderType
(
requestVO
.
getOrderType
(),
requestVO
.
getGmtExpect
(),
request
.
getBizType
()));
request
.
setOrderType
(
getNewOrderType
(
requestVO
.
getOrderType
(),
requestVO
.
getGmtExpect
(),
request
.
getBizType
()));
request
.
setBarCounter
(
requestVO
.
getBarCounter
());
request
.
setBarCounter
(
requestVO
.
getBarCounter
());
//商品信息转换
//商品信息转换
...
@@ -477,7 +477,7 @@ public class OrderSdkAdapter {
...
@@ -477,7 +477,7 @@ public class OrderSdkAdapter {
createOrderRequest
.
setBizType
(
orderInfo
.
getBizType
());
createOrderRequest
.
setBizType
(
orderInfo
.
getBizType
());
createOrderRequest
.
setIsParent
(
orderInfo
.
getIsParent
());
createOrderRequest
.
setIsParent
(
orderInfo
.
getIsParent
());
createOrderRequest
.
setNote
(
orderInfo
.
getRemark
());
createOrderRequest
.
setNote
(
orderInfo
.
getRemark
());
createOrderRequest
.
setOrderType
(
getNewOrderType
(
orderInfo
.
getOrderType
(),
orderInfo
.
getGmtExpect
(),
createOrderRequest
.
getBizType
()));
createOrderRequest
.
setOrderType
(
getNewOrderType
(
orderInfo
.
getOrderType
(),
orderInfo
.
getGmtExpect
(),
createOrderRequest
.
getBizType
()));
createOrderRequest
.
setBarCounter
(
orderInfo
.
getBarCounter
());
createOrderRequest
.
setBarCounter
(
orderInfo
.
getBarCounter
());
//商品信息转换
//商品信息转换
...
@@ -536,7 +536,7 @@ public class OrderSdkAdapter {
...
@@ -536,7 +536,7 @@ public class OrderSdkAdapter {
private
Long
convertCreateOrderCost
(
Long
originalAmount
,
List
<
OrderSettlementCreateReq
>
orderSettlementCreateReqList
,
List
<
OrderCostCreateReq
>
orderCostCreateReqs
,
List
<
CreateOrderAccountRequest
>
accounts
)
{
private
Long
convertCreateOrderCost
(
Long
originalAmount
,
List
<
OrderSettlementCreateReq
>
orderSettlementCreateReqList
,
List
<
OrderCostCreateReq
>
orderCostCreateReqs
,
List
<
CreateOrderAccountRequest
>
accounts
)
{
if
(!
CollectionUtils
.
isEmpty
(
accounts
))
{
if
(!
CollectionUtils
.
isEmpty
(
accounts
))
{
AssortOrderLogUtil
.
info
(
"fisherman 构建order_cost_detail数据"
,
accounts
,
JSON
.
toJSONString
(
accounts
));
AssortOrderLogUtil
.
info
(
"fisherman 构建order_cost_detail数据"
,
accounts
,
JSON
.
toJSONString
(
accounts
));
for
(
CreateOrderAccountRequest
accountRequest
:
accounts
)
{
for
(
CreateOrderAccountRequest
accountRequest
:
accounts
)
{
//老订单服务 1=配送费;3=包装费
//老订单服务 1=配送费;3=包装费
if
(
QueryOrderAccountType
.
DELIVERY_AMOUNT
.
equals
(
accountRequest
.
getAccountType
())
if
(
QueryOrderAccountType
.
DELIVERY_AMOUNT
.
equals
(
accountRequest
.
getAccountType
())
...
@@ -1350,7 +1350,7 @@ public class OrderSdkAdapter {
...
@@ -1350,7 +1350,7 @@ public class OrderSdkAdapter {
return
data
;
return
data
;
}
}
private
OrderExtendedReq
getOrderExtendedObj
(
OrderExtendedReq
orderExtended
){
private
OrderExtendedReq
getOrderExtendedObj
(
OrderExtendedReq
orderExtended
)
{
if
(
Objects
.
isNull
(
orderExtended
))
{
if
(
Objects
.
isNull
(
orderExtended
))
{
return
null
;
return
null
;
}
}
...
@@ -1572,7 +1572,7 @@ public class OrderSdkAdapter {
...
@@ -1572,7 +1572,7 @@ public class OrderSdkAdapter {
/**
/**
* 老订单类型转换新订单类型
* 老订单类型转换新订单类型
*/
*/
public
Integer
getNewOrderType
(
QueryOrderType
orderType
,
Long
gmtExpect
,
Integer
bizType
)
{
public
Integer
getNewOrderType
(
QueryOrderType
orderType
,
Long
gmtExpect
,
Integer
bizType
)
{
//订单服务订单类型 1=外卖 4=自提,5=堂食
//订单服务订单类型 1=外卖 4=自提,5=堂食
//外卖平台订单类型 1=常规堂食,2=预约堂食,3=常规外送,4=预约外送,5=常规自取,6=预约自取
//外卖平台订单类型 1=常规堂食,2=预约堂食,3=常规外送,4=预约外送,5=常规自取,6=预约自取
boolean
isAdvance
=
bizType
!=
null
&&
bizType
.
compareTo
(
BizTypeEnum
.
ADVANCE_ORDER
.
getBizType
())
==
0
;
boolean
isAdvance
=
bizType
!=
null
&&
bizType
.
compareTo
(
BizTypeEnum
.
ADVANCE_ORDER
.
getBizType
())
==
0
;
...
@@ -3282,7 +3282,7 @@ public class OrderSdkAdapter {
...
@@ -3282,7 +3282,7 @@ public class OrderSdkAdapter {
if
(
null
!=
product
.
getProductGroupId
())
{
if
(
null
!=
product
.
getProductGroupId
())
{
extInfo
.
setProductGroupId
(
product
.
getProductGroupId
());
extInfo
.
setProductGroupId
(
product
.
getProductGroupId
());
}
}
if
(
null
!=
product
.
getIsSendGoods
()
&&
product
.
getIsSendGoods
()){
if
(
null
!=
product
.
getIsSendGoods
()
&&
product
.
getIsSendGoods
())
{
extInfo
.
setIsSendGoods
(
true
);
extInfo
.
setIsSendGoods
(
true
);
}
}
extInfo
.
setIsMonthCard
(
product
.
getIsMonthCard
());
extInfo
.
setIsMonthCard
(
product
.
getIsMonthCard
());
...
@@ -3852,10 +3852,7 @@ public class OrderSdkAdapter {
...
@@ -3852,10 +3852,7 @@ public class OrderSdkAdapter {
couponCodeVerificationTransDto
.
setCode
(
accountBean
.
getAccountId
());
couponCodeVerificationTransDto
.
setCode
(
accountBean
.
getAccountId
());
couponCodeVerificationTransDto
.
setOpenId
(
openId
);
couponCodeVerificationTransDto
.
setOpenId
(
openId
);
Integer
discountPrice
=
accountBean
.
getPrice
().
intValue
();
Integer
discountPrice
=
accountBean
.
getPrice
().
intValue
();
if
(
discountPrice
!=
null
&&
discountPrice
<
0
)
{
couponCodeVerificationTransDto
.
setTotalAmount
(
Math
.
abs
(
discountPrice
.
longValue
()));
discountPrice
=
0
-
discountPrice
;
}
couponCodeVerificationTransDto
.
setTotalAmount
(
accountBean
.
getPrice
().
longValue
());
//商品券预教研
//商品券预教研
List
<
ProductRedeemVO
>
products
=
new
ArrayList
<>();
List
<
ProductRedeemVO
>
products
=
new
ArrayList
<>();
if
(
QueryOrderAccountType
.
PRODUCT_COUPON
.
getCode
().
equals
(
accountBean
.
getAccountType
().
getCode
()))
{
if
(
QueryOrderAccountType
.
PRODUCT_COUPON
.
getCode
().
equals
(
accountBean
.
getAccountType
().
getCode
()))
{
...
@@ -3892,6 +3889,79 @@ public class OrderSdkAdapter {
...
@@ -3892,6 +3889,79 @@ public class OrderSdkAdapter {
return
couponRequest
;
return
couponRequest
;
}
}
private
CouponRequest
commonMethodVerificationNew
(
TransactionVO
freightCouponAccountBean
,
List
<
CreateOrderAccountRequest
>
collect
,
OrderBeanV1
orderBean
,
String
openId
)
{
CouponRequest
couponRequest
=
new
CouponRequest
();
couponRequest
.
setReqtype
(
71
);
couponRequest
.
setVer
(
Integer
.
valueOf
(
Version
.
VERSION_1
));
couponRequest
.
setPartnerId
(
Integer
.
parseInt
(
orderBean
.
getCompanyId
()));
ActivityChannelEnum
activityChannelEnum
=
orderTypeEnumConvert2ActivityChannel
(
orderBean
.
getOrderType
());
if
(
activityChannelEnum
==
null
)
{
activityChannelEnum
=
ActivityChannelEnum
.
pickup
;
}
couponRequest
.
setChannel
(
activityChannelEnum
.
getCode
());
couponRequest
.
setStation_id
(
"-1"
);
couponRequest
.
setOperator_id
(
"-1"
);
couponRequest
.
setStore_id
(
orderBean
.
getShopId
());
// couponRequest.setMemberId(orderBean.getUserId());
couponRequest
.
setOpenid
(
openId
);
// 订单号 替换成唯一序号
couponRequest
.
setTrans_id
(
orderBean
.
getOid
());
couponRequest
.
setBusiness_date
(
DateUtil
.
convert2String
(
new
Date
(),
DateUtil
.
FORMAT_yyyyMMdd
));
List
<
TransactionVO
>
transactions
=
this
.
getTransactionList
(
freightCouponAccountBean
,
collect
,
orderBean
,
openId
);
// 配送券逻辑 end
couponRequest
.
setTransactions
(
transactions
);
return
couponRequest
;
}
private
List
<
TransactionVO
>
getTransactionList
(
TransactionVO
freightCouponAccountBean
,
List
<
CreateOrderAccountRequest
>
collect
,
OrderBeanV1
orderBean
,
String
openId
)
{
List
<
TransactionVO
>
transactions
=
new
ArrayList
<>();
collect
.
forEach
(
accountBean
->
{
TransactionVO
couponCodeVerificationTransDto
=
new
TransactionVO
();
couponCodeVerificationTransDto
.
setCode
(
accountBean
.
getAccountId
());
couponCodeVerificationTransDto
.
setOpenId
(
openId
);
Integer
discountPrice
=
accountBean
.
getPrice
().
intValue
();
couponCodeVerificationTransDto
.
setTotalAmount
(
Math
.
abs
(
discountPrice
.
longValue
()));
//商品券预教研
List
<
ProductRedeemVO
>
products
=
new
ArrayList
<>();
if
(
QueryOrderAccountType
.
PRODUCT_COUPON
.
getCode
().
equals
(
accountBean
.
getAccountType
().
getCode
()))
{
for
(
int
i
=
0
;
i
<
orderBean
.
getProductList
().
size
();
i
++)
{
ProductBeanV1
productBean
=
orderBean
.
getProductList
().
get
(
i
);
String
pid
=
StringUtils
.
isNotBlank
(
productBean
.
getSpecification
())
?
productBean
.
getSpecification
()
:
productBean
.
getProductId
();
if
(!
org
.
springframework
.
util
.
CollectionUtils
.
isEmpty
(
orderBean
.
getProductList
().
get
(
i
).
getDiscountList
()))
{
List
<
ProductDiscountV1
>
discounts
=
orderBean
.
getProductList
().
get
(
i
).
getDiscountList
().
stream
().
filter
(
productDiscount
->
productDiscount
.
getDiscountId
().
equals
(
accountBean
.
getAccountId
())).
collect
(
Collectors
.
toList
());
for
(
ProductDiscountV1
productDiscount
:
discounts
)
{
if
(
productDiscount
.
getDiscountType
()
==
null
||
productDiscount
.
getDiscountType
()
==
0
)
{
continue
;
}
ProductRedeemVO
couponCodeVerificationProductDto
=
new
ProductRedeemVO
();
couponCodeVerificationProductDto
.
setPid
(
pid
);
couponCodeVerificationProductDto
.
setConsume_num
(
productDiscount
.
getDiscountQty
());
couponCodeVerificationProductDto
.
setSeq
(
i
+
1
);
couponCodeVerificationProductDto
.
setRedeem_price
(
new
BigDecimal
(
productBean
.
getPrice
()));
products
.
add
(
couponCodeVerificationProductDto
);
}
}
}
}
if
(
CollectionUtils
.
isNotEmpty
(
products
))
{
couponCodeVerificationTransDto
.
setProducts
(
products
);
}
transactions
.
add
(
couponCodeVerificationTransDto
);
});
// 配送券逻辑加入
if
(
freightCouponAccountBean
!=
null
)
{
transactions
.
add
(
freightCouponAccountBean
);
}
return
transactions
;
}
private
ActivityChannelEnum
orderTypeEnumConvert2ActivityChannel
(
Integer
orderType
)
{
private
ActivityChannelEnum
orderTypeEnumConvert2ActivityChannel
(
Integer
orderType
)
{
if
(
Objects
.
equals
(
OldOrderType
.
TAKE_OUT
.
getCode
(),
orderType
))
{
if
(
Objects
.
equals
(
OldOrderType
.
TAKE_OUT
.
getCode
(),
orderType
))
{
return
ActivityChannelEnum
.
delivery
;
return
ActivityChannelEnum
.
delivery
;
...
...
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