记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
Project
Project
Details
Activity
Releases
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
董敬伟
liquidnet-bus-v1
Commits
f9a2ab5b
Commit
f9a2ab5b
authored
Mar 07, 2022
by
胡佳晨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优先券报错 则订单下单失败
优惠券报错则 优惠券逻辑跳过
parent
55634f02
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
93 additions
and
84 deletions
+93
-84
KylinOrderTicketsServiceImpl.java
...vice/order/service/impl/KylinOrderTicketsServiceImpl.java
+24
-21
GoblinOrderUtils.java
...a/com/liquidnet/service/order/utils/GoblinOrderUtils.java
+65
-60
OrderUtils.java
...in/java/com/liquidnet/service/order/utils/OrderUtils.java
+4
-3
No files found.
liquidnet-bus-service/liquidnet-service-order/liquidnet-service-order-impl/src/main/java/com/liquidnet/service/order/service/impl/KylinOrderTicketsServiceImpl.java
View file @
f9a2ab5b
...
...
@@ -260,6 +260,9 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
}
else
{
if
(
memberType
==
1
)
{
advanceMap
=
orderUtils
.
useCoupon
(
payOrderParam
.
getAdvanceCode
(),
"购买 "
+
performanceData
.
getTitle
(),
BigDecimal
.
ZERO
,
payOrderParam
.
getPerformanceId
(),
payOrderParam
.
getTimeId
(),
payOrderParam
.
getTicketId
());
if
(
advanceMap
==
null
)
{
return
ResponseDto
.
failure
(
"优先券券不可用"
);
}
Integer
typeVoucher
=
(
Integer
)
advanceMap
.
get
(
"type"
);
if
(
typeVoucher
.
equals
(-
1
))
{
return
ResponseDto
.
failure
(
"优先券券不可用"
);
...
...
@@ -453,24 +456,24 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
if
(
payOrderParam
.
getVoucherCode
()
!=
null
)
{
HashMap
<
String
,
Object
>
hashMap
=
orderUtils
.
useCoupon
(
payOrderParam
.
getVoucherCode
(),
content
,
orderTickets
.
getPriceTotal
().
subtract
(
priceExpress
),
payOrderParam
.
getPerformanceId
(),
payOrderParam
.
getTimeId
(),
payOrderParam
.
getTicketId
());
BigDecimal
priceVoucher
=
(
BigDecimal
)
hashMap
.
get
(
"voucher"
);
Integer
typeVoucher
=
(
Integer
)
hashMap
.
get
(
"type"
);
if
(
typeVoucher
.
equals
(-
1
))
{
throw
new
Exception
(
"券不可用"
);
if
(
null
!=
hashMap
)
{
BigDecimal
priceVoucher
=
(
BigDecimal
)
hashMap
.
get
(
"voucher"
);
Integer
typeVoucher
=
(
Integer
)
hashMap
.
get
(
"type"
);
if
(
typeVoucher
.
equals
(-
1
))
{
throw
new
Exception
(
"券不可用"
);
}
orderTickets
.
setPriceVoucher
(
priceVoucher
);
KylinOrderCoupons
couponsVoucher
=
KylinOrderCoupons
.
getNew
();
couponsVoucher
.
setOrderId
(
orderTicketId
);
couponsVoucher
.
setCouponCode
(
payOrderParam
.
getVoucherCode
());
couponsVoucher
.
setCouponType
(
typeVoucher
);
couponsVoucher
.
setCouponPrice
(
priceVoucher
);
couponsVoucher
.
setCreatedAt
(
now
);
couponsList
.
add
(
couponsVoucher
);
sqlsDataE
.
add
(
new
Object
[]{
orderTicketId
,
payOrderParam
.
getVoucherCode
(),
typeVoucher
,
priceVoucher
,
now
,
now
});
}
orderTickets
.
setPriceVoucher
(
priceVoucher
);
KylinOrderCoupons
couponsVoucher
=
KylinOrderCoupons
.
getNew
();
couponsVoucher
.
setOrderId
(
orderTicketId
);
couponsVoucher
.
setCouponCode
(
payOrderParam
.
getVoucherCode
());
couponsVoucher
.
setCouponType
(
typeVoucher
);
couponsVoucher
.
setCouponPrice
(
priceVoucher
);
couponsVoucher
.
setCreatedAt
(
now
);
couponsList
.
add
(
couponsVoucher
);
sqlsDataE
.
add
(
new
Object
[]{
orderTicketId
,
payOrderParam
.
getVoucherCode
(),
typeVoucher
,
priceVoucher
,
now
,
now
});
}
if
(
couponsList
.
size
()
>
0
)
{
...
...
@@ -644,11 +647,11 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
httpData
.
add
(
"showUrl"
,
payOrderParam
.
getShowUrl
()
+
orderTicketId
);
httpData
.
add
(
"returnUrl"
,
payOrderParam
.
getReturnUrl
()
+
orderTicketId
);
}
if
(
payOrderParam
.
getPayType
().
equals
(
"douyinpay"
))
{
if
(
payOrderParam
.
getPayType
().
equals
(
"douyinpay"
))
{
httpData
.
add
(
"showUrl"
,
payOrderParam
.
getShowUrl
()
+
orderTicketId
);
httpData
.
add
(
"returnUrl"
,
payOrderParam
.
getReturnUrl
()
+
orderTicketId
);
}
if
(
payOrderParam
.
getPayType
().
equals
(
"unionpay"
))
{
if
(
payOrderParam
.
getPayType
().
equals
(
"unionpay"
))
{
httpData
.
add
(
"returnUrl"
,
payOrderParam
.
getReturnUrl
()
+
orderTicketId
);
}
log
.
debug
(
"调用 DRAGON 参数 = "
+
httpData
.
toString
());
...
...
@@ -770,11 +773,11 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
httpData
.
add
(
"showUrl"
,
payAgainParam
.
getShowUrl
()
+
payAgainParam
.
getOrderId
());
httpData
.
add
(
"returnUrl"
,
payAgainParam
.
getReturnUrl
()
+
payAgainParam
.
getOrderId
());
}
if
(
payAgainParam
.
getPayType
().
equals
(
"douyinpay"
))
{
if
(
payAgainParam
.
getPayType
().
equals
(
"douyinpay"
))
{
httpData
.
add
(
"showUrl"
,
payAgainParam
.
getShowUrl
()
+
payAgainParam
.
getOrderId
());
httpData
.
add
(
"returnUrl"
,
payAgainParam
.
getReturnUrl
()
+
payAgainParam
.
getOrderId
());
}
if
(
payAgainParam
.
getPayType
().
equals
(
"unionpay"
))
{
if
(
payAgainParam
.
getPayType
().
equals
(
"unionpay"
))
{
httpData
.
add
(
"returnUrl"
,
payAgainParam
.
getReturnUrl
()
+
payAgainParam
.
getOrderId
());
}
String
returnData
=
HttpUtil
.
post
(
payUrl
,
httpData
);
...
...
liquidnet-bus-service/liquidnet-service-order/liquidnet-service-order-impl/src/main/java/com/liquidnet/service/order/utils/GoblinOrderUtils.java
View file @
f9a2ab5b
...
...
@@ -205,75 +205,80 @@ public class GoblinOrderUtils {
}
public
GoblinUseResultVo
useStoreCoupon
(
String
ucouponId
,
String
content
,
BigDecimal
totalPrice
,
String
spuId
,
String
uid
)
{
List
<
GoblinUserCouponVo
>
voList
=
redisUtils
.
getUserCouponVos
(
uid
);
GoblinUseResultVo
returnVo
=
GoblinUseResultVo
.
getNew
();
returnVo
.
setValue
(
BigDecimal
.
ZERO
);
returnVo
.
setCouType
(
"-1"
);
for
(
GoblinUserCouponVo
vo
:
voList
)
{
if
(
vo
.
getUcouponId
().
equals
(
ucouponId
))
{
//判断券状态 和 触发金额
if
((
vo
.
getState
().
equals
(
1
))
&&
vo
.
getTriggers
().
compareTo
(
totalPrice
)
<=
0
)
{
if
(
vo
.
getUseScope
().
equals
(
"0"
))
{
if
(
vo
.
getType
().
equals
(
"1"
))
{
//代金券
returnVo
.
setValue
(
vo
.
getValFace
());
returnVo
.
setCouType
(
vo
.
getType
());
}
else
if
(
vo
.
getType
().
equals
(
"2"
))
{
//折扣
BigDecimal
tempPrice
=
totalPrice
.
multiply
(
vo
.
getDiscount
()).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
if
(
tempPrice
.
compareTo
(
vo
.
getDeduction
())
>
0
)
{
tempPrice
=
vo
.
getDeduction
();
try
{
List
<
GoblinUserCouponVo
>
voList
=
redisUtils
.
getUserCouponVos
(
uid
);
GoblinUseResultVo
returnVo
=
GoblinUseResultVo
.
getNew
();
returnVo
.
setValue
(
BigDecimal
.
ZERO
);
returnVo
.
setCouType
(
"-1"
);
for
(
GoblinUserCouponVo
vo
:
voList
)
{
if
(
vo
.
getUcouponId
().
equals
(
ucouponId
))
{
//判断券状态 和 触发金额
if
((
vo
.
getState
().
equals
(
1
))
&&
vo
.
getTriggers
().
compareTo
(
totalPrice
)
<=
0
)
{
if
(
vo
.
getUseScope
().
equals
(
"0"
))
{
if
(
vo
.
getType
().
equals
(
"1"
))
{
//代金券
returnVo
.
setValue
(
vo
.
getValFace
());
returnVo
.
setCouType
(
vo
.
getType
());
}
else
if
(
vo
.
getType
().
equals
(
"2"
))
{
//折扣
BigDecimal
tempPrice
=
totalPrice
.
multiply
(
vo
.
getDiscount
()).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
if
(
tempPrice
.
compareTo
(
vo
.
getDeduction
())
>
0
)
{
tempPrice
=
vo
.
getDeduction
();
}
returnVo
.
setValue
(
tempPrice
);
returnVo
.
setCouType
(
vo
.
getType
());
}
else
if
(
vo
.
getType
().
equals
(
"3"
)
&&
vo
.
getTriggers
().
compareTo
(
totalPrice
)
<=
0
)
{
//满减
returnVo
.
setValue
(
vo
.
getValMinus
());
returnVo
.
setCouType
(
vo
.
getType
());
}
returnVo
.
setValue
(
tempPrice
);
returnVo
.
setCouType
(
vo
.
getType
()
);
}
else
if
(
vo
.
getType
().
equals
(
"3"
)
&&
vo
.
getTriggers
().
compareTo
(
totalPrice
)
<=
0
)
{
//满减
returnVo
.
setValue
(
vo
.
getValMinus
());
returnVo
.
setCouType
(
vo
.
getType
(
));
}
vo
.
setState
(
5
);
vo
.
setUsedFor
(
content
);
goblinMongoUtils
.
changeCouponVos
(
vo
.
getUcouponId
(),
vo
);
queueUtils
.
sendMsgByRedis
(
MQConst
.
GoblinQueue
.
SQL_COUPON
.
getKey
(),
SqlMapping
.
get
(
"goblin_user_coupon.updateState"
,
vo
.
getState
(),
vo
.
getUsedFor
(),
LocalDateTime
.
now
(),
vo
.
getUcouponId
()));
break
;
}
else
{
List
<
String
>
spuIds
=
redisUtils
.
getStoreCouponSpuIds
(
vo
.
getStoreCouponId
());
if
(
spuId
==
null
)
{
continue
;
}
//判断是否在可用商品内
List
<
String
>
spuList
=
Arrays
.
asList
(
spuId
.
split
(
","
));
for
(
String
item
:
spuIds
)
{
if
(
spuList
.
contains
(
item
)
)
{
if
(
vo
.
getType
().
equals
(
"1"
))
{
//代金券
returnVo
.
setValue
(
vo
.
getValFace
());
returnVo
.
setCouType
(
vo
.
getType
()
);
}
else
if
(
vo
.
getType
().
equals
(
"2"
))
{
//折扣
BigDecimal
tempPrice
=
totalPrice
.
multiply
(
vo
.
getDiscount
()).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
if
(
tempPrice
.
compareTo
(
vo
.
getDeduction
())
>
0
)
{
tempPrice
=
vo
.
getDeduction
(
);
vo
.
setState
(
5
);
vo
.
setUsedFor
(
content
);
goblinMongoUtils
.
changeCouponVos
(
vo
.
getUcouponId
(),
vo
);
queueUtils
.
sendMsgByRedis
(
MQConst
.
GoblinQueue
.
SQL_COUPON
.
getKey
(),
SqlMapping
.
get
(
"goblin_user_coupon.updateState"
,
vo
.
getState
(),
vo
.
getUsedFor
(),
LocalDateTime
.
now
(),
vo
.
getUcouponId
()
));
break
;
}
else
{
List
<
String
>
spuIds
=
redisUtils
.
getStoreCouponSpuIds
(
vo
.
getStoreCouponId
()
);
if
(
spuId
==
null
)
{
continue
;
}
//判断是否在可用商品内
List
<
String
>
spuList
=
Arrays
.
asList
(
spuId
.
split
(
","
));
for
(
String
item
:
spuIds
)
{
if
(
spuList
.
contains
(
item
)
)
{
if
(
vo
.
getType
().
equals
(
"1"
))
{
//代金券
returnVo
.
setValue
(
vo
.
getValFace
());
returnVo
.
setCouType
(
vo
.
getType
());
}
else
if
(
vo
.
getType
().
equals
(
"2"
))
{
//折扣
BigDecimal
tempPrice
=
totalPrice
.
multiply
(
vo
.
getDiscount
()).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
if
(
tempPrice
.
compareTo
(
vo
.
getDeduction
())
>
0
)
{
tempPrice
=
vo
.
getDeduction
();
}
returnVo
.
setValue
(
tempPrice
);
returnVo
.
setCouType
(
vo
.
getType
());
}
else
if
(
vo
.
getType
().
equals
(
"3"
)
&&
vo
.
getTriggers
().
compareTo
(
totalPrice
)
<=
0
)
{
//满减
returnVo
.
setValue
(
vo
.
getValMinus
());
returnVo
.
setCouType
(
vo
.
getType
()
);
}
returnVo
.
setValue
(
tempPrice
);
returnVo
.
setCouType
(
vo
.
getType
()
);
}
else
if
(
vo
.
getType
().
equals
(
"3"
)
&&
vo
.
getTriggers
().
compareTo
(
totalPrice
)
<=
0
)
{
//满减
returnVo
.
setValue
(
vo
.
getValMinus
());
returnVo
.
setCouType
(
vo
.
getType
(
));
vo
.
setState
(
5
);
vo
.
setUsedFor
(
content
);
goblinMongoUtils
.
changeCouponVos
(
vo
.
getUcouponId
(),
vo
);
queueUtils
.
sendMsgByRedis
(
MQConst
.
GoblinQueue
.
SQL_COUPON
.
getKey
(),
SqlMapping
.
get
(
"goblin_user_coupon.updateState"
,
vo
.
getState
(),
vo
.
getUsedFor
(),
LocalDateTime
.
now
(),
vo
.
getUcouponId
()
));
}
vo
.
setState
(
5
);
vo
.
setUsedFor
(
content
);
goblinMongoUtils
.
changeCouponVos
(
vo
.
getUcouponId
(),
vo
);
queueUtils
.
sendMsgByRedis
(
MQConst
.
GoblinQueue
.
SQL_COUPON
.
getKey
(),
SqlMapping
.
get
(
"goblin_user_coupon.updateState"
,
vo
.
getState
(),
vo
.
getUsedFor
(),
LocalDateTime
.
now
(),
vo
.
getUcouponId
()));
break
;
}
break
;
}
}
break
;
}
break
;
}
if
(!
returnVo
.
getCouType
().
equals
(
"-1"
))
{
redisUtils
.
setUserCouponVos
(
uid
,
voList
);
}
return
returnVo
;
}
catch
(
Exception
e
){
log
.
error
(
"店铺券错误:{}"
,
e
);
return
null
;
}
if
(!
returnVo
.
getCouType
().
equals
(
"-1"
))
{
redisUtils
.
setUserCouponVos
(
uid
,
voList
);
}
return
returnVo
;
}
public
Boolean
backStoreCoupon
(
List
<
com
.
liquidnet
.
service
.
goblin
.
param
.
BackCouponParam
>
params
)
{
...
...
liquidnet-bus-service/liquidnet-service-order/liquidnet-service-order-impl/src/main/java/com/liquidnet/service/order/utils/OrderUtils.java
View file @
f9a2ab5b
...
...
@@ -271,9 +271,10 @@ public class OrderUtils {
return
hashMap
;
}
catch
(
Exception
e
)
{
log
.
error
(
"用券ERROR:{}"
,
e
);
hashMap
.
put
(
"type"
,
-
1
);
hashMap
.
put
(
"voucher"
,
-
1
);
return
hashMap
;
// hashMap.put("type", -1);
// hashMap.put("voucher", -1);
// return hashMap;
return
null
;
}
}
...
...
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