记得上下班打卡 | 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
07e3e544
Commit
07e3e544
authored
Sep 10, 2021
by
胡佳晨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
下单修改
parent
80cea881
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
14 deletions
+17
-14
KylinOrderTicketsServiceImpl.java
...vice/order/service/impl/KylinOrderTicketsServiceImpl.java
+10
-13
OrderUtils.java
...in/java/com/liquidnet/service/order/utils/OrderUtils.java
+7
-1
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 @
07e3e544
...
...
@@ -181,7 +181,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
advanceMap
=
orderUtils
.
useCoupon
(
payOrderParam
.
getAdvanceCode
(),
"购买 "
+
performanceData
.
getTitle
(),
BigDecimal
.
ZERO
,
payOrderParam
.
getPerformanceId
(),
payOrderParam
.
getTimeId
(),
payOrderParam
.
getTicketId
());
Integer
typeVoucher
=
(
Integer
)
advanceMap
.
get
(
"type"
);
if
(
typeVoucher
.
equals
(-
1
))
{
return
ResponseDto
.
failure
(
"券不可用"
);
return
ResponseDto
.
failure
(
"
优先券
券不可用"
);
}
}
...
...
@@ -191,38 +191,41 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
}
}
else
{
if
(
DateUtil
.
compareStrDay
(
DateUtil
.
getNowTime
(),
timeStart
)
==
-
1
)
{
orderUtils
.
backAdvanceCoupon
(
advanceMap
,
uid
);
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"20011"
));
//未开始
}
}
if
(
DateUtil
.
compareStrDay
(
DateUtil
.
getNowTime
(),
timeEnd
)
==
1
)
{
orderUtils
.
backAdvanceCoupon
(
advanceMap
,
uid
);
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"20012"
));
//已结束
}
//快递票判断
if
(
payOrderParam
.
getIsExpress
()
!=
null
)
{
if
(
payOrderParam
.
getIsExpress
()
==
1
&&
DateUtil
.
compareStrDay
(
DateUtil
.
getNowTime
(),
timeExpressEnd
)
==
1
)
{
orderUtils
.
backAdvanceCoupon
(
advanceMap
,
uid
);
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"20013"
));
//快递票不卖
}
if
(
payOrderParam
.
getIsExpress
()
==
1
&&
payOrderParam
.
getAddressId
().
isEmpty
())
{
orderUtils
.
backAdvanceCoupon
(
advanceMap
,
uid
);
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"20014"
));
//快递票未填写收货地址
}
}
//实名判断
if
(
isTrueName
==
1
&&
payOrderParam
.
getEnterIdList
().
size
()
<=
0
)
{
orderUtils
.
backAdvanceCoupon
(
advanceMap
,
uid
);
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"20015"
));
//需要实名 未实名
}
if
(
isTrueName
==
1
&&
payOrderParam
.
getEnterIdList
().
size
()
!=
payOrderParam
.
getNumber
())
{
orderUtils
.
backAdvanceCoupon
(
advanceMap
,
uid
);
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"20015"
));
//入场人数量错误
}
// 判断库存
int
surplusGeneral
=
orderUtils
.
changeSurplus
(
isPay
,
payOrderParam
.
getTicketId
(),
-
payOrderParam
.
getNumber
());
log
.
debug
(
"TAG_REDIS 正常 剩余库存 -> count:"
+
surplusGeneral
);
if
(
surplusGeneral
<
0
)
{
//库存回滚
orderUtils
.
changeSurplus
(
isPay
,
payOrderParam
.
getTicketId
(),
payOrderParam
.
getNumber
());
log
.
debug
(
"TAG_REDIS 售罄 回滚库存1 -> count:"
+
payOrderParam
.
getNumber
());
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"20016"
));
//没抢到
}
else
{
isDownGeneral
=
true
;
...
...
@@ -237,7 +240,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
int
age
=
IDCard
.
getAgeByIdCard
(
adamEnters
.
getIdCard
());
if
(
age
>
25
)
{
orderUtils
.
changeSurplus
(
isPay
,
payOrderParam
.
getTicketId
(),
payOrderParam
.
getNumber
());
log
.
debug
(
"TAG_REDIS 学生票 回滚库存2 -> count:"
+
payOrderParam
.
getNumber
()
);
orderUtils
.
backAdvanceCoupon
(
advanceMap
,
uid
);
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"20017"
));
//年龄超了
}
}
...
...
@@ -250,7 +253,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
String
res1
=
orderUtils
.
judgeOrderLimit
(
performanceData
.
getType
(),
uid
,
entersVoList
.
get
(
i
).
getIdCard
(),
payOrderParam
.
getPerformanceId
(),
payOrderParam
.
getTicketId
(),
performanceLimit
,
performanceMemberLimit
,
ticketLimit
,
ticketMemberLimit
,
1
,
1
,
memberType
,
isTrueName
);
if
(!
res1
.
equals
(
""
))
{
orderUtils
.
changeSurplus
(
isPay
,
payOrderParam
.
getTicketId
(),
payOrderParam
.
getNumber
());
log
.
debug
(
"TAG_REDIS 限购 回滚库存3 -> count:"
+
payOrderParam
.
getNumber
()
);
orderUtils
.
backAdvanceCoupon
(
advanceMap
,
uid
);
return
ResponseDto
.
failure
(
res1
);
//乱七八糟异常
}
}
...
...
@@ -258,7 +261,7 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
String
res1
=
orderUtils
.
judgeOrderLimit
(
performanceData
.
getType
(),
uid
,
""
,
payOrderParam
.
getPerformanceId
(),
payOrderParam
.
getTicketId
(),
performanceLimit
,
performanceMemberLimit
,
ticketLimit
,
ticketMemberLimit
,
payOrderParam
.
getNumber
(),
payOrderParam
.
getNumber
(),
memberType
,
isTrueName
);
if
(!
res1
.
equals
(
""
))
{
orderUtils
.
changeSurplus
(
isPay
,
payOrderParam
.
getTicketId
(),
payOrderParam
.
getNumber
());
log
.
debug
(
"TAG_REDIS 限购 回滚库存3 -> count:"
+
payOrderParam
.
getNumber
()
);
orderUtils
.
backAdvanceCoupon
(
advanceMap
,
uid
);
return
ResponseDto
.
failure
(
res1
);
//乱七八糟异常
}
}
...
...
@@ -271,7 +274,6 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
log
.
error
(
"Kylin Order Pay Error = "
,
e
);
if
(
isDownGeneral
)
{
orderUtils
.
changeSurplus
(
isPay
,
payOrderParam
.
getTicketId
(),
payOrderParam
.
getNumber
());
log
.
debug
(
"TAG_REDIS 异常 回滚库存4 -> count:"
+
payOrderParam
.
getNumber
());
for
(
AdamEntersVo
enters
:
entersVoList
)
{
dataUtils
.
changeBuyInfo
(
uid
,
enters
.
getIdCard
(),
payOrderParam
.
getPerformanceId
(),
payOrderParam
.
getTicketId
(),
-
1
);
}
...
...
@@ -281,11 +283,6 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsOrderServ
}
}
}
if
(
advanceMap
!=
null
)
{
orderUtils
.
backCoupon
(
advanceMap
.
get
(
"uCouponId"
).
toString
(),
uid
);
}
if
(
e
.
getMessage
().
equals
(
"券不可用"
))
{
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"20030"
));
//券不可用
}
...
...
liquidnet-bus-service/liquidnet-service-order/liquidnet-service-order-impl/src/main/java/com/liquidnet/service/order/utils/OrderUtils.java
View file @
07e3e544
...
...
@@ -180,7 +180,7 @@ public class OrderUtils {
* @param totalPrice 订单总价
* @return
*/
public
HashMap
<
String
,
Object
>
useCoupon
(
String
uCouponId
,
String
content
,
BigDecimal
totalPrice
,
String
performanceId
,
String
timesId
,
String
ticketId
)
{
public
HashMap
<
String
,
Object
>
useCoupon
(
String
uCouponId
,
String
content
,
BigDecimal
totalPrice
,
String
performanceId
,
String
timesId
,
String
ticketId
)
{
MultiValueMap
<
String
,
String
>
params
=
CollectionUtil
.
linkedMultiValueMapStringString
();
params
.
add
(
"uCouponId"
,
uCouponId
);
params
.
add
(
"content"
,
content
);
...
...
@@ -227,6 +227,12 @@ public class OrderUtils {
return
hashMap
;
}
public
void
backAdvanceCoupon
(
HashMap
<
String
,
Object
>
advanceMap
,
String
uid
)
{
if
(
advanceMap
!=
null
)
{
backCoupon
(
advanceMap
.
get
(
"uCouponId"
).
toString
(),
uid
);
}
}
public
void
backCoupon
(
String
uCouponId
,
String
uid
)
{
BackCouponParam
param
=
BackCouponParam
.
getNew
();
param
.
setuCouponIds
(
uCouponId
);
...
...
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