记得上下班打卡 | 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
91f59529
Commit
91f59529
authored
Jun 30, 2021
by
胡佳晨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
下单锁取消
parent
8af094e0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
261 additions
and
259 deletions
+261
-259
KylinOrderTicketsServiceImpl.java
...vice/kylin/service/impl/KylinOrderTicketsServiceImpl.java
+261
-259
No files found.
liquidnet-bus-service/liquidnet-service-kylin/liquidnet-service-kylin-impl/src/main/java/com/liquidnet/service/kylin/service/impl/KylinOrderTicketsServiceImpl.java
View file @
91f59529
...
@@ -314,12 +314,6 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsService {
...
@@ -314,12 +314,6 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsService {
return
resultData
;
return
resultData
;
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
if
(
isDownGeneral
)
{
currentTime
=
System
.
currentTimeMillis
();
dataUtils
.
changeSurplusGeneral
(
payOrderParam
.
getTicketId
(),
payOrderParam
.
getNumber
());
currentTime
=
System
.
currentTimeMillis
()
-
currentTime
;
log
.
debug
(
"redis 修改库存 异常 -> time:"
+
(
currentTime
)
+
"毫秒"
);
}
e
.
printStackTrace
();
e
.
printStackTrace
();
log
.
error
(
"Kylin Order Pay Error = "
+
e
.
getMessage
());
log
.
error
(
"Kylin Order Pay Error = "
+
e
.
getMessage
());
// redisLockUtil.unlock(lock);
// redisLockUtil.unlock(lock);
...
@@ -328,225 +322,226 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsService {
...
@@ -328,225 +322,226 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsService {
}
}
private
ResponseDto
<
PayResultVo
>
order
(
PayOrderParam
payOrderParam
,
String
uid
,
boolean
isMember
,
int
isTrueName
,
KylinPerformanceVo
performanceData
,
KylinTicketVo
ticketData
,
List
<
AdamEntersVo
>
entersVoList
,
Integer
isStudent
,
KylinTicketTimesVo
ticketTimesData
,
Long
currentTime
)
{
private
ResponseDto
<
PayResultVo
>
order
(
PayOrderParam
payOrderParam
,
String
uid
,
boolean
isMember
,
int
isTrueName
,
KylinPerformanceVo
performanceData
,
KylinTicketVo
ticketData
,
List
<
AdamEntersVo
>
entersVoList
,
Integer
isStudent
,
KylinTicketTimesVo
ticketTimesData
,
Long
currentTime
)
{
LinkedList
<
String
>
sqls
=
new
LinkedList
<>();
try
{
String
source
=
CurrentUtil
.
getCliSource
()
==
null
?
""
:
CurrentUtil
.
getCliSource
();
LinkedList
<
String
>
sqls
=
new
LinkedList
<>();
String
version
=
CurrentUtil
.
getCliVersion
()
==
null
?
""
:
CurrentUtil
.
getCliVersion
();
String
source
=
CurrentUtil
.
getCliSource
()
==
null
?
""
:
CurrentUtil
.
getCliSource
();
LocalDateTime
now
=
LocalDateTime
.
now
();
String
version
=
CurrentUtil
.
getCliVersion
()
==
null
?
""
:
CurrentUtil
.
getCliVersion
();
//生成订单 order_ticket
LocalDateTime
now
=
LocalDateTime
.
now
();
KylinOrderTickets
orderTickets
=
new
KylinOrderTickets
();
//生成订单 order_ticket
String
orderTicketId
=
IDGenerator
.
nextSnowId
().
toString
();
KylinOrderTickets
orderTickets
=
new
KylinOrderTickets
();
orderTickets
.
setOrderTicketsId
(
orderTicketId
);
String
orderTicketId
=
IDGenerator
.
nextSnowId
().
toString
();
orderTickets
.
setUserId
(
uid
);
orderTickets
.
setOrderTicketsId
(
orderTicketId
);
Map
token
=
CurrentUtil
.
getTokenClaims
();
orderTickets
.
setUserId
(
uid
);
orderTickets
.
setUserName
(
StringUtils
.
defaultString
(((
String
)
token
.
get
(
"nickname"
)),
""
));
Map
token
=
CurrentUtil
.
getTokenClaims
();
orderTickets
.
setUserMobile
(
StringUtils
.
defaultString
(((
String
)
token
.
get
(
"mobile"
)),
""
));
orderTickets
.
setUserName
(
StringUtils
.
defaultString
(((
String
)
token
.
get
(
"nickname"
)),
""
));
orderTickets
.
setPerformanceTitle
(
performanceData
.
getTitle
());
orderTickets
.
setUserMobile
(
StringUtils
.
defaultString
(((
String
)
token
.
get
(
"mobile"
)),
""
));
orderTickets
.
setOrderCode
(
IDGenerator
.
ticketOrderCode
(
orderTicketId
));
orderTickets
.
setPerformanceTitle
(
performanceData
.
getTitle
());
orderTickets
.
setPayCode
(
""
);
orderTickets
.
setOrderCode
(
IDGenerator
.
ticketOrderCode
(
orderTicketId
));
orderTickets
.
setQrCode
(
""
);
orderTickets
.
setPayCode
(
""
);
orderTickets
.
setOrderType
(
source
);
orderTickets
.
setQrCode
(
""
);
orderTickets
.
setOrderVersion
(
version
);
orderTickets
.
setOrderType
(
source
);
orderTickets
.
setNumber
(
payOrderParam
.
getNumber
());
orderTickets
.
setOrderVersion
(
version
);
orderTickets
.
setPrice
(
ticketData
.
getPrice
());
orderTickets
.
setNumber
(
payOrderParam
.
getNumber
());
orderTickets
.
setPriceMember
(
ticketData
.
getMemberPrice
());
orderTickets
.
setPrice
(
ticketData
.
getPrice
());
if
(
isMember
)
{
orderTickets
.
setPriceMember
(
ticketData
.
getMemberPrice
());
orderTickets
.
setPriceTotal
(
ticketData
.
getMemberPrice
().
multiply
(
new
BigDecimal
(
payOrderParam
.
getNumber
())).
add
(
payOrderParam
.
getIsExpress
()
==
1
?
ticketData
.
getPriceExpress
()
:
new
BigDecimal
(
"0"
)));
if
(
isMember
)
{
}
else
{
orderTickets
.
setPriceTotal
(
ticketData
.
getMemberPrice
().
multiply
(
new
BigDecimal
(
payOrderParam
.
getNumber
())).
add
(
payOrderParam
.
getIsExpress
()
==
1
?
ticketData
.
getPriceExpress
()
:
new
BigDecimal
(
"0"
)));
orderTickets
.
setPriceTotal
(
ticketData
.
getPrice
().
multiply
(
new
BigDecimal
(
payOrderParam
.
getNumber
())).
add
(
payOrderParam
.
getIsExpress
()
==
1
?
ticketData
.
getPriceExpress
()
:
new
BigDecimal
(
"0"
)));
}
else
{
}
orderTickets
.
setPriceTotal
(
ticketData
.
getPrice
().
multiply
(
new
BigDecimal
(
payOrderParam
.
getNumber
())).
add
(
payOrderParam
.
getIsExpress
()
==
1
?
ticketData
.
getPriceExpress
()
:
new
BigDecimal
(
"0"
)));
}
orderTickets
.
setPriceActual
(
orderTickets
.
getPriceTotal
());
orderTickets
.
setPriceVoucher
(
new
BigDecimal
(
"0.0"
));
orderTickets
.
setPriceExpress
(
ticketData
.
getPriceExpress
());
orderTickets
.
setPriceRefund
(
new
BigDecimal
(
0.0
));
orderTickets
.
setRefundNumber
(
0
);
orderTickets
.
setPayType
(
payOrderParam
.
getPayType
());
orderTickets
.
setPaymentType
(
null
);
orderTickets
.
setTimePay
(
null
);
if
(
payOrderParam
.
getIsExpress
()
==
1
)
{
currentTime
=
System
.
currentTimeMillis
();
AdamAddressesVo
addressesVo
=
orderUtils
.
getAddress
(
uid
,
payOrderParam
.
getAddressId
());
//feignAdamBaseClient.queryAddresses(payOrderParam.getAddressId(), uid).getData();
orderTickets
.
setExpressContacts
(
addressesVo
.
getName
());
orderTickets
.
setExpressAddress
(
addressesVo
.
getProvince
()
+
addressesVo
.
getCity
()
+
addressesVo
.
getCounty
()
+
addressesVo
.
getAddress
());
orderTickets
.
setExpressPhone
(
addressesVo
.
getPhone
());
orderTickets
.
setCity
(
addressesVo
.
getCity
());
orderTickets
.
setProvince
(
addressesVo
.
getProvince
());
orderTickets
.
setCounty
(
addressesVo
.
getCounty
());
orderTickets
.
setGetTicketType
(
"express"
);
currentTime
=
System
.
currentTimeMillis
()
-
currentTime
;
log
.
debug
(
"feign 获取入场人 -> time:"
+
(
currentTime
)
+
"毫秒"
);
}
else
{
orderTickets
.
setExpressContacts
(
""
);
orderTickets
.
setExpressAddress
(
""
);
orderTickets
.
setExpressPhone
(
""
);
orderTickets
.
setCity
(
""
);
orderTickets
.
setProvince
(
""
);
orderTickets
.
setCounty
(
""
);
orderTickets
.
setGetTicketType
(
"electronic"
);
}
orderTickets
.
setCouponType
(
"no"
);
orderTickets
.
setGetTicketDescribe
(
""
);
orderTickets
.
setPayCountdownMinute
(
performanceData
.
getPayCountdownMinute
());
orderTickets
.
setCreatedAt
(
now
);
orderTickets
.
setUpdatedAt
(
null
);
//生成订单 order_ticket_status
orderTickets
.
setPriceActual
(
orderTickets
.
getPriceTotal
());
KylinOrderTicketStatus
orderTicketStatus
=
new
KylinOrderTicketStatus
();
orderTickets
.
setPriceVoucher
(
new
BigDecimal
(
"0.0"
));
String
orderTicketStatusId
=
IDGenerator
.
nextSnowId
().
toString
();
orderTickets
.
setPriceExpress
(
ticketData
.
getPriceExpress
());
orderTicketStatus
.
setOrderTicketStatusId
(
orderTicketStatusId
);
orderTickets
.
setPriceRefund
(
new
BigDecimal
(
0.0
));
orderTicketStatus
.
setOrderId
(
orderTicketId
);
orderTickets
.
setRefundNumber
(
0
);
orderTicketStatus
.
setExpressType
(
payOrderParam
.
getExpressType
());
orderTickets
.
setPayType
(
payOrderParam
.
getPayType
());
orderTicketStatus
.
setTransferStatus
(
KylinTableStatusConst
.
ORDER_TRANSFER_STATUS0
);
orderTickets
.
setPaymentType
(
null
);
orderTicketStatus
.
setStatus
(
KylinTableStatusConst
.
ORDER_STATUS0
);
orderTickets
.
setTimePay
(
null
);
orderTicketStatus
.
setIsStudent
(
isStudent
);
if
(
payOrderParam
.
getIsExpress
()
==
1
)
{
orderTicketStatus
.
setPayStatus
(
KylinTableStatusConst
.
ORDER_PAY_STATUS0
);
orderTicketStatus
.
setCreatedAt
(
now
);
orderTicketStatus
.
setUpdatedAt
(
null
);
sqls
.
add
(
SqlMapping
.
get
(
"kylin_order_ticket_status.add"
));
LinkedList
<
Object
[]>
sqlsDataB
=
new
LinkedList
<
Object
[]>();
sqlsDataB
.
add
(
orderTicketStatus
.
getAddObject
());
//生成订单 order_ticket_relation
KylinOrderTicketRelations
orderTicketRelations
=
new
KylinOrderTicketRelations
();
String
orderTicketRelationId
=
IDGenerator
.
nextSnowId
();
orderTicketRelations
.
setOrderTicketRelationsId
(
orderTicketRelationId
);
orderTicketRelations
.
setOrderId
(
orderTicketId
);
orderTicketRelations
.
setTransferId
(
""
);
orderTicketRelations
.
setLiveId
(
""
);
orderTicketRelations
.
setAgentId
(
payOrderParam
.
getAgentId
());
orderTicketRelations
.
setIsMember
(
isMember
?
1
:
0
);
orderTicketRelations
.
setPerformanceId
(
payOrderParam
.
getPerformanceId
());
orderTicketRelations
.
setTimeId
(
payOrderParam
.
getTimeId
());
orderTicketRelations
.
setTicketId
(
payOrderParam
.
getTicketId
());
orderTicketRelations
.
setCreatedAt
(
now
);
orderTicketRelations
.
setUpdatedAt
(
null
);
sqls
.
add
(
SqlMapping
.
get
(
"kylin_order_ticket_relation.add"
));
LinkedList
<
Object
[]>
sqlsDataC
=
new
LinkedList
<
Object
[]>();
sqlsDataC
.
add
(
orderTicketRelations
.
getAddObject
());
//生成票
KylinOrderTicketEntities
orderTicketEntities
=
new
KylinOrderTicketEntities
();
LinkedList
<
Object
[]>
sqlsDataD
=
null
;
sqlsDataD
=
new
LinkedList
<
Object
[]>();
sqls
.
add
(
SqlMapping
.
get
(
"kylin_order_ticket_entities.add"
));
if
(
isTrueName
==
1
)
{
for
(
AdamEntersVo
enters
:
entersVoList
)
{
String
orderTicketEntitiesId
=
IDGenerator
.
nextSnowId
().
toString
();
orderTicketEntities
.
setOrderTicketEntitiesId
(
orderTicketEntitiesId
);
orderTicketEntities
.
setOrderId
(
orderTicketId
);
orderTicketEntities
.
setTicketId
(
payOrderParam
.
getTicketId
());
orderTicketEntities
.
setUserId
(
uid
);
orderTicketEntities
.
setPerformanceId
(
payOrderParam
.
getPerformanceId
());
orderTicketEntities
.
setTimeId
(
payOrderParam
.
getTimeId
());
orderTicketEntities
.
setEnterType
(
enters
.
getType
());
orderTicketEntities
.
setEnterName
(
enters
.
getName
());
orderTicketEntities
.
setEnterMobile
(
enters
.
getMobile
());
orderTicketEntities
.
setEnterIdCode
(
enters
.
getIdCard
());
orderTicketEntities
.
setStatus
(
KylinTableStatusConst
.
ENTITIES_STATUS0
);
orderTicketEntities
.
setSysDamai
(
ticketData
.
getSysDamai
());
orderTicketEntities
.
setCheckClient
(
""
);
orderTicketEntities
.
setIsPayment
(
KylinTableStatusConst
.
ENTITIES_IS_PAYMENT0
);
orderTicketEntities
.
setRefundPrice
(
BigDecimal
.
valueOf
(
0.0
));
orderTicketEntities
.
setComment
(
""
);
orderTicketEntities
.
setCreatedAt
(
now
);
orderTicketEntities
.
setUpdatedAt
(
null
);
sqlsDataD
.
add
(
orderTicketEntities
.
getAddObject
());
// 生成vo
KylinOrderTicketEntitiesVo
orderTicketEntitiesVo
=
new
KylinOrderTicketEntitiesVo
();
BeanUtils
.
copyProperties
(
orderTicketEntities
,
orderTicketEntitiesVo
);
orderTicketEntitiesVo
.
setPerformanceTitle
(
performanceData
.
getTitle
());
orderTicketEntitiesVo
.
setTicketTitle
(
ticketData
.
getTitle
());
orderTicketEntitiesVo
.
setUseStart
(
ticketData
.
getUseStart
());
orderTicketEntitiesVo
.
setUseEnd
(
ticketData
.
getUseEnd
());
orderTicketEntitiesVo
.
setTicketsmId
(
ticketData
.
getMid
());
orderTicketEntitiesVo
.
setTimemId
(
ticketTimesData
.
getMid
());
orderTicketEntitiesVo
.
setCreatedAt
(
orderTicketEntities
.
getCreatedAt
().
format
(
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
)));
orderTicketEntitiesVo
.
setUpdatedAt
(
null
);
orderTicketEntitiesVo
.
setChangeDate
(
orderTicketEntities
.
getCreatedAt
());
currentTime
=
System
.
currentTimeMillis
();
currentTime
=
System
.
currentTimeMillis
();
mongoTemplate
.
insert
(
orderTicketEntitiesVo
,
KylinOrderTicketEntitiesVo
.
class
.
getSimpleName
());
AdamAddressesVo
addressesVo
=
orderUtils
.
getAddress
(
uid
,
payOrderParam
.
getAddressId
());
//feignAdamBaseClient.queryAddresses(payOrderParam.getAddressId(), uid).getData();
orderTickets
.
setExpressContacts
(
addressesVo
.
getName
());
orderTickets
.
setExpressAddress
(
addressesVo
.
getProvince
()
+
addressesVo
.
getCity
()
+
addressesVo
.
getCounty
()
+
addressesVo
.
getAddress
());
orderTickets
.
setExpressPhone
(
addressesVo
.
getPhone
());
orderTickets
.
setCity
(
addressesVo
.
getCity
());
orderTickets
.
setProvince
(
addressesVo
.
getProvince
());
orderTickets
.
setCounty
(
addressesVo
.
getCounty
());
orderTickets
.
setGetTicketType
(
"express"
);
currentTime
=
System
.
currentTimeMillis
()
-
currentTime
;
currentTime
=
System
.
currentTimeMillis
()
-
currentTime
;
log
.
debug
(
"mongo 添加入场人 -> time:"
+
(
currentTime
)
+
"毫秒"
);
log
.
debug
(
"feign 获取入场人 -> time:"
+
(
currentTime
)
+
"毫秒"
);
currentTime
=
System
.
currentTimeMillis
();
}
else
{
dataUtils
.
changeBuyInfo
(
orderTicketEntitiesVo
.
getUserId
(),
orderTicketEntitiesVo
.
getEnterIdCode
(),
orderTicketEntitiesVo
.
getPerformanceId
(),
orderTicketEntitiesVo
.
getTicketId
(),
1
);
orderTickets
.
setExpressContacts
(
""
);
currentTime
=
System
.
currentTimeMillis
()
-
currentTime
;
orderTickets
.
setExpressAddress
(
""
);
log
.
debug
(
"redis 修改 限购 -> time:"
+
(
currentTime
)
+
"毫秒"
);
orderTickets
.
setExpressPhone
(
""
);
orderTickets
.
setCity
(
""
);
orderTickets
.
setProvince
(
""
);
orderTickets
.
setCounty
(
""
);
orderTickets
.
setGetTicketType
(
"electronic"
);
}
}
}
else
{
orderTickets
.
setCouponType
(
"no"
);
for
(
int
i
=
0
;
i
<
payOrderParam
.
getNumber
();
i
++)
{
orderTickets
.
setGetTicketDescribe
(
""
);
String
orderTicketEntitiesId
=
IDGenerator
.
nextSnowId
().
toString
();
orderTickets
.
setPayCountdownMinute
(
performanceData
.
getPayCountdownMinute
());
orderTicketEntities
.
setOrderTicketEntitiesId
(
orderTicketEntitiesId
);
orderTickets
.
setCreatedAt
(
now
);
orderTicketEntities
.
setOrderId
(
orderTicketId
);
orderTickets
.
setUpdatedAt
(
null
);
orderTicketEntities
.
setTicketId
(
payOrderParam
.
getTicketId
());
orderTicketEntities
.
setUserId
(
uid
);
orderTicketEntities
.
setPerformanceId
(
payOrderParam
.
getPerformanceId
());
//生成订单 order_ticket_status
orderTicketEntities
.
setTimeId
(
payOrderParam
.
getTimeId
());
KylinOrderTicketStatus
orderTicketStatus
=
new
KylinOrderTicketStatus
();
orderTicketEntities
.
setEnterType
(
0
);
String
orderTicketStatusId
=
IDGenerator
.
nextSnowId
().
toString
();
orderTicketEntities
.
setEnterName
(
""
);
orderTicketStatus
.
setOrderTicketStatusId
(
orderTicketStatusId
);
orderTicketEntities
.
setEnterMobile
(
""
);
orderTicketStatus
.
setOrderId
(
orderTicketId
);
orderTicketEntities
.
setEnterIdCode
(
""
);
orderTicketStatus
.
setExpressType
(
payOrderParam
.
getExpressType
());
orderTicketEntities
.
setStatus
(
KylinTableStatusConst
.
ENTITIES_STATUS0
);
orderTicketStatus
.
setTransferStatus
(
KylinTableStatusConst
.
ORDER_TRANSFER_STATUS0
);
orderTicketEntities
.
setSysDamai
(
ticketData
.
getSysDamai
());
orderTicketStatus
.
setStatus
(
KylinTableStatusConst
.
ORDER_STATUS0
);
orderTicketEntities
.
setCheckClient
(
""
);
orderTicketStatus
.
setIsStudent
(
isStudent
);
orderTicketEntities
.
setIsPayment
(
KylinTableStatusConst
.
ENTITIES_IS_PAYMENT0
);
orderTicketStatus
.
setPayStatus
(
KylinTableStatusConst
.
ORDER_PAY_STATUS0
);
orderTicketEntities
.
setComment
(
""
);
orderTicketStatus
.
setCreatedAt
(
now
);
orderTicketEntities
.
setCreatedAt
(
now
);
orderTicketStatus
.
setUpdatedAt
(
null
);
orderTicketEntities
.
setUpdatedAt
(
null
);
sqls
.
add
(
SqlMapping
.
get
(
"kylin_order_ticket_status.add"
));
sqlsDataD
.
add
(
orderTicketEntities
.
getAddObject
());
LinkedList
<
Object
[]>
sqlsDataB
=
new
LinkedList
<
Object
[]>();
// 生成vo
sqlsDataB
.
add
(
orderTicketStatus
.
getAddObject
());
KylinOrderTicketEntitiesVo
orderTicketEntitiesVo
=
new
KylinOrderTicketEntitiesVo
();
BeanUtils
.
copyProperties
(
orderTicketEntities
,
orderTicketEntitiesVo
);
//生成订单 order_ticket_relation
orderTicketEntitiesVo
.
setPerformanceTitle
(
performanceData
.
getTitle
());
KylinOrderTicketRelations
orderTicketRelations
=
new
KylinOrderTicketRelations
();
orderTicketEntitiesVo
.
setTicketTitle
(
ticketData
.
getTitle
());
String
orderTicketRelationId
=
IDGenerator
.
nextSnowId
();
orderTicketEntitiesVo
.
setUseStart
(
ticketData
.
getUseStart
());
orderTicketRelations
.
setOrderTicketRelationsId
(
orderTicketRelationId
);
orderTicketEntitiesVo
.
setUseEnd
(
ticketData
.
getUseEnd
());
orderTicketRelations
.
setOrderId
(
orderTicketId
);
orderTicketEntitiesVo
.
setTicketsmId
(
ticketData
.
getMid
());
orderTicketRelations
.
setTransferId
(
""
);
orderTicketEntitiesVo
.
setTimemId
(
ticketTimesData
.
getMid
());
orderTicketRelations
.
setLiveId
(
""
);
orderTicketEntitiesVo
.
setCreatedAt
(
orderTicketEntities
.
getCreatedAt
().
format
(
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
)));
orderTicketRelations
.
setAgentId
(
payOrderParam
.
getAgentId
());
orderTicketEntitiesVo
.
setUpdatedAt
(
null
);
orderTicketRelations
.
setIsMember
(
isMember
?
1
:
0
);
orderTicketEntitiesVo
.
setChangeDate
(
orderTicketEntities
.
getCreatedAt
());
orderTicketRelations
.
setPerformanceId
(
payOrderParam
.
getPerformanceId
());
currentTime
=
System
.
currentTimeMillis
();
orderTicketRelations
.
setTimeId
(
payOrderParam
.
getTimeId
());
mongoTemplate
.
insert
(
orderTicketEntitiesVo
,
KylinOrderTicketEntitiesVo
.
class
.
getSimpleName
());
orderTicketRelations
.
setTicketId
(
payOrderParam
.
getTicketId
());
currentTime
=
System
.
currentTimeMillis
()
-
currentTime
;
orderTicketRelations
.
setCreatedAt
(
now
);
log
.
debug
(
"mongo 添加入场人 -> time:"
+
(
currentTime
)
+
"毫秒"
);
orderTicketRelations
.
setUpdatedAt
(
null
);
currentTime
=
System
.
currentTimeMillis
();
sqls
.
add
(
SqlMapping
.
get
(
"kylin_order_ticket_relation.add"
));
dataUtils
.
changeBuyInfo
(
orderTicketEntitiesVo
.
getUserId
(),
orderTicketEntitiesVo
.
getEnterIdCode
(),
orderTicketEntitiesVo
.
getPerformanceId
(),
orderTicketEntitiesVo
.
getTicketId
(),
1
);
LinkedList
<
Object
[]>
sqlsDataC
=
new
LinkedList
<
Object
[]>();
currentTime
=
System
.
currentTimeMillis
()
-
currentTime
;
sqlsDataC
.
add
(
orderTicketRelations
.
getAddObject
());
log
.
debug
(
"redis 修改限购 -> time:"
+
(
currentTime
)
+
"毫秒"
);
//生成票
KylinOrderTicketEntities
orderTicketEntities
=
new
KylinOrderTicketEntities
();
LinkedList
<
Object
[]>
sqlsDataD
=
null
;
sqlsDataD
=
new
LinkedList
<
Object
[]>();
sqls
.
add
(
SqlMapping
.
get
(
"kylin_order_ticket_entities.add"
));
if
(
isTrueName
==
1
)
{
for
(
AdamEntersVo
enters
:
entersVoList
)
{
String
orderTicketEntitiesId
=
IDGenerator
.
nextSnowId
().
toString
();
orderTicketEntities
.
setOrderTicketEntitiesId
(
orderTicketEntitiesId
);
orderTicketEntities
.
setOrderId
(
orderTicketId
);
orderTicketEntities
.
setTicketId
(
payOrderParam
.
getTicketId
());
orderTicketEntities
.
setUserId
(
uid
);
orderTicketEntities
.
setPerformanceId
(
payOrderParam
.
getPerformanceId
());
orderTicketEntities
.
setTimeId
(
payOrderParam
.
getTimeId
());
orderTicketEntities
.
setEnterType
(
enters
.
getType
());
orderTicketEntities
.
setEnterName
(
enters
.
getName
());
orderTicketEntities
.
setEnterMobile
(
enters
.
getMobile
());
orderTicketEntities
.
setEnterIdCode
(
enters
.
getIdCard
());
orderTicketEntities
.
setStatus
(
KylinTableStatusConst
.
ENTITIES_STATUS0
);
orderTicketEntities
.
setSysDamai
(
ticketData
.
getSysDamai
());
orderTicketEntities
.
setCheckClient
(
""
);
orderTicketEntities
.
setIsPayment
(
KylinTableStatusConst
.
ENTITIES_IS_PAYMENT0
);
orderTicketEntities
.
setRefundPrice
(
BigDecimal
.
valueOf
(
0.0
));
orderTicketEntities
.
setComment
(
""
);
orderTicketEntities
.
setCreatedAt
(
now
);
orderTicketEntities
.
setUpdatedAt
(
null
);
sqlsDataD
.
add
(
orderTicketEntities
.
getAddObject
());
// 生成vo
KylinOrderTicketEntitiesVo
orderTicketEntitiesVo
=
new
KylinOrderTicketEntitiesVo
();
BeanUtils
.
copyProperties
(
orderTicketEntities
,
orderTicketEntitiesVo
);
orderTicketEntitiesVo
.
setPerformanceTitle
(
performanceData
.
getTitle
());
orderTicketEntitiesVo
.
setTicketTitle
(
ticketData
.
getTitle
());
orderTicketEntitiesVo
.
setUseStart
(
ticketData
.
getUseStart
());
orderTicketEntitiesVo
.
setUseEnd
(
ticketData
.
getUseEnd
());
orderTicketEntitiesVo
.
setTicketsmId
(
ticketData
.
getMid
());
orderTicketEntitiesVo
.
setTimemId
(
ticketTimesData
.
getMid
());
orderTicketEntitiesVo
.
setCreatedAt
(
orderTicketEntities
.
getCreatedAt
().
format
(
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
)));
orderTicketEntitiesVo
.
setUpdatedAt
(
null
);
orderTicketEntitiesVo
.
setChangeDate
(
orderTicketEntities
.
getCreatedAt
());
currentTime
=
System
.
currentTimeMillis
();
mongoTemplate
.
insert
(
orderTicketEntitiesVo
,
KylinOrderTicketEntitiesVo
.
class
.
getSimpleName
());
currentTime
=
System
.
currentTimeMillis
()
-
currentTime
;
log
.
debug
(
"mongo 添加入场人 -> time:"
+
(
currentTime
)
+
"毫秒"
);
currentTime
=
System
.
currentTimeMillis
();
dataUtils
.
changeBuyInfo
(
orderTicketEntitiesVo
.
getUserId
(),
orderTicketEntitiesVo
.
getEnterIdCode
(),
orderTicketEntitiesVo
.
getPerformanceId
(),
orderTicketEntitiesVo
.
getTicketId
(),
1
);
currentTime
=
System
.
currentTimeMillis
()
-
currentTime
;
log
.
debug
(
"redis 修改 限购 -> time:"
+
(
currentTime
)
+
"毫秒"
);
}
}
else
{
for
(
int
i
=
0
;
i
<
payOrderParam
.
getNumber
();
i
++)
{
String
orderTicketEntitiesId
=
IDGenerator
.
nextSnowId
().
toString
();
orderTicketEntities
.
setOrderTicketEntitiesId
(
orderTicketEntitiesId
);
orderTicketEntities
.
setOrderId
(
orderTicketId
);
orderTicketEntities
.
setTicketId
(
payOrderParam
.
getTicketId
());
orderTicketEntities
.
setUserId
(
uid
);
orderTicketEntities
.
setPerformanceId
(
payOrderParam
.
getPerformanceId
());
orderTicketEntities
.
setTimeId
(
payOrderParam
.
getTimeId
());
orderTicketEntities
.
setEnterType
(
0
);
orderTicketEntities
.
setEnterName
(
""
);
orderTicketEntities
.
setEnterMobile
(
""
);
orderTicketEntities
.
setEnterIdCode
(
""
);
orderTicketEntities
.
setStatus
(
KylinTableStatusConst
.
ENTITIES_STATUS0
);
orderTicketEntities
.
setSysDamai
(
ticketData
.
getSysDamai
());
orderTicketEntities
.
setCheckClient
(
""
);
orderTicketEntities
.
setIsPayment
(
KylinTableStatusConst
.
ENTITIES_IS_PAYMENT0
);
orderTicketEntities
.
setComment
(
""
);
orderTicketEntities
.
setCreatedAt
(
now
);
orderTicketEntities
.
setUpdatedAt
(
null
);
sqlsDataD
.
add
(
orderTicketEntities
.
getAddObject
());
// 生成vo
KylinOrderTicketEntitiesVo
orderTicketEntitiesVo
=
new
KylinOrderTicketEntitiesVo
();
BeanUtils
.
copyProperties
(
orderTicketEntities
,
orderTicketEntitiesVo
);
orderTicketEntitiesVo
.
setPerformanceTitle
(
performanceData
.
getTitle
());
orderTicketEntitiesVo
.
setTicketTitle
(
ticketData
.
getTitle
());
orderTicketEntitiesVo
.
setUseStart
(
ticketData
.
getUseStart
());
orderTicketEntitiesVo
.
setUseEnd
(
ticketData
.
getUseEnd
());
orderTicketEntitiesVo
.
setTicketsmId
(
ticketData
.
getMid
());
orderTicketEntitiesVo
.
setTimemId
(
ticketTimesData
.
getMid
());
orderTicketEntitiesVo
.
setCreatedAt
(
orderTicketEntities
.
getCreatedAt
().
format
(
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
)));
orderTicketEntitiesVo
.
setUpdatedAt
(
null
);
orderTicketEntitiesVo
.
setChangeDate
(
orderTicketEntities
.
getCreatedAt
());
currentTime
=
System
.
currentTimeMillis
();
mongoTemplate
.
insert
(
orderTicketEntitiesVo
,
KylinOrderTicketEntitiesVo
.
class
.
getSimpleName
());
currentTime
=
System
.
currentTimeMillis
()
-
currentTime
;
log
.
debug
(
"mongo 添加入场人 -> time:"
+
(
currentTime
)
+
"毫秒"
);
currentTime
=
System
.
currentTimeMillis
();
dataUtils
.
changeBuyInfo
(
orderTicketEntitiesVo
.
getUserId
(),
orderTicketEntitiesVo
.
getEnterIdCode
(),
orderTicketEntitiesVo
.
getPerformanceId
(),
orderTicketEntitiesVo
.
getTicketId
(),
1
);
currentTime
=
System
.
currentTimeMillis
()
-
currentTime
;
log
.
debug
(
"redis 修改限购 -> time:"
+
(
currentTime
)
+
"毫秒"
);
}
}
// 调用支付
String
time1
=
DateUtil
.
format
(
DateUtil
.
Formatter
.
yyyyMMddHHmmss
.
parse
(
ticketData
.
getUseStart
()),
DateUtil
.
Formatter
.
MM_dd_zh
);
String
time2
=
DateUtil
.
format
(
DateUtil
.
Formatter
.
yyyyMMddHHmmss
.
parse
(
ticketData
.
getUseEnd
()),
DateUtil
.
Formatter
.
MM_dd_zh
);
String
useTime
=
ticketData
.
getType
()
==
2
?
time1
+
"~"
+
time2
:
time2
;
LinkedMultiValueMap
<
String
,
String
>
httpData
=
new
LinkedMultiValueMap
<
String
,
String
>();
httpData
.
add
(
"type"
,
"TICKET"
);
httpData
.
add
(
"price"
,
orderTickets
.
getPriceActual
().
toString
());
httpData
.
add
(
"name"
,
useTime
+
ticketData
.
getTitle
()
+
"-"
+
performanceData
.
getTitle
());
httpData
.
add
(
"detail"
,
performanceData
.
getTitle
()
+
"-"
+
ticketData
.
getTitle
()
+
"-"
+
useTime
);
httpData
.
add
(
"order_code"
,
orderTickets
.
getOrderCode
());
httpData
.
add
(
"client_ip"
,
CurrentUtil
.
getCliIpAddr
());
httpData
.
add
(
"notify_url"
,
synUrl
);
httpData
.
add
(
"create_date"
,
orderTickets
.
getCreatedAt
().
format
(
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
)));
httpData
.
add
(
"expire_time"
,
(
orderTickets
.
getPayCountdownMinute
())
+
""
);
if
(
payOrderParam
.
getDeviceFrom
().
equals
(
"js"
)
||
payOrderParam
.
getDeviceFrom
().
equals
(
"applet"
))
{
httpData
.
add
(
"open_id"
,
payOrderParam
.
getOpenId
());
}
if
(
payOrderParam
.
getPayType
().
equals
(
"alipay"
)
&&
payOrderParam
.
getDeviceFrom
().
equals
(
"wap"
))
{
httpData
.
add
(
"show_url"
,
payOrderParam
.
getShowUrl
()
+
orderTicketId
);
httpData
.
add
(
"return_url"
,
payOrderParam
.
getReturnUrl
()
+
orderTicketId
);
}
}
}
// 调用支付
String
time1
=
DateUtil
.
format
(
DateUtil
.
Formatter
.
yyyyMMddHHmmss
.
parse
(
ticketData
.
getUseStart
()),
DateUtil
.
Formatter
.
MM_dd_zh
);
String
time2
=
DateUtil
.
format
(
DateUtil
.
Formatter
.
yyyyMMddHHmmss
.
parse
(
ticketData
.
getUseEnd
()),
DateUtil
.
Formatter
.
MM_dd_zh
);
String
useTime
=
ticketData
.
getType
()
==
2
?
time1
+
"~"
+
time2
:
time2
;
LinkedMultiValueMap
<
String
,
String
>
httpData
=
new
LinkedMultiValueMap
<
String
,
String
>();
httpData
.
add
(
"type"
,
"TICKET"
);
httpData
.
add
(
"price"
,
orderTickets
.
getPriceActual
().
toString
());
httpData
.
add
(
"name"
,
useTime
+
ticketData
.
getTitle
()
+
"-"
+
performanceData
.
getTitle
());
httpData
.
add
(
"detail"
,
performanceData
.
getTitle
()
+
"-"
+
ticketData
.
getTitle
()
+
"-"
+
useTime
);
httpData
.
add
(
"order_code"
,
orderTickets
.
getOrderCode
());
httpData
.
add
(
"client_ip"
,
CurrentUtil
.
getCliIpAddr
());
httpData
.
add
(
"notify_url"
,
synUrl
);
httpData
.
add
(
"create_date"
,
orderTickets
.
getCreatedAt
().
format
(
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
)));
httpData
.
add
(
"expire_time"
,
(
orderTickets
.
getPayCountdownMinute
())
+
""
);
if
(
payOrderParam
.
getDeviceFrom
().
equals
(
"js"
)
||
payOrderParam
.
getDeviceFrom
().
equals
(
"applet"
))
{
httpData
.
add
(
"open_id"
,
payOrderParam
.
getOpenId
());
}
if
(
payOrderParam
.
getPayType
().
equals
(
"alipay"
)
&&
payOrderParam
.
getDeviceFrom
().
equals
(
"wap"
))
{
httpData
.
add
(
"show_url"
,
payOrderParam
.
getShowUrl
()
+
orderTicketId
);
httpData
.
add
(
"return_url"
,
payOrderParam
.
getReturnUrl
()
+
orderTicketId
);
}
currentTime
=
System
.
currentTimeMillis
();
currentTime
=
System
.
currentTimeMillis
();
String
returnData
=
HttpUtil
.
post
(
payUrl
+
payOrderParam
.
getDeviceFrom
()
+
"/"
+
payOrderParam
.
getPayType
(),
httpData
);
String
returnData
=
HttpUtil
.
post
(
payUrl
+
payOrderParam
.
getDeviceFrom
()
+
"/"
+
payOrderParam
.
getPayType
(),
httpData
);
currentTime
=
System
.
currentTimeMillis
()
-
currentTime
;
currentTime
=
System
.
currentTimeMillis
()
-
currentTime
;
log
.
debug
(
"调用 PHP 支付 -> time:"
+
(
currentTime
)
+
"毫秒"
);
log
.
debug
(
"调用 PHP 支付 -> time:"
+
(
currentTime
)
+
"毫秒"
);
PayResultVo
payResultVo
=
JsonUtils
.
fromJson
(
returnData
,
PayResultVo
.
class
);
PayResultVo
payResultVo
=
JsonUtils
.
fromJson
(
returnData
,
PayResultVo
.
class
);
// PayResultVo payResultVo = null;
// PayResultVo payResultVo = null;
// try {
// try {
// payResultVo = JsonUtils.fromJson("{\n" +
// payResultVo = JsonUtils.fromJson("{\n" +
...
@@ -579,48 +574,55 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsService {
...
@@ -579,48 +574,55 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsService {
// } catch (Exception e) {
// } catch (Exception e) {
// payResultVo = new PayResultVo();
// payResultVo = new PayResultVo();
// }
// }
payResultVo
.
setOrder_id
(
orderTicketId
);
payResultVo
.
setOrder_id
(
orderTicketId
);
payResultVo
.
setPrice
(
orderTickets
.
getPriceActual
());
payResultVo
.
setPrice
(
orderTickets
.
getPriceActual
());
orderTickets
.
setPayCode
(
payResultVo
.
getCode
());
orderTickets
.
setPayCode
(
payResultVo
.
getCode
());
sqls
.
add
(
SqlMapping
.
get
(
"kylin_order_ticket.add"
));
sqls
.
add
(
SqlMapping
.
get
(
"kylin_order_ticket.add"
));
LinkedList
<
Object
[]>
sqlsDataA
=
new
LinkedList
<>();
LinkedList
<
Object
[]>
sqlsDataA
=
new
LinkedList
<>();
sqlsDataA
.
add
(
orderTickets
.
getAddObject
());
sqlsDataA
.
add
(
orderTickets
.
getAddObject
());
if
(
payOrderParam
.
getPayType
().
equals
(
"alipay"
)
&&
payOrderParam
.
getDeviceFrom
().
equals
(
"wap"
))
{
payResultVo
.
setShowUrl
(
payOrderParam
.
getShowUrl
()
+
orderTicketId
);
payResultVo
.
setReturnUrl
(
payOrderParam
.
getReturnUrl
()
+
orderTicketId
);
}
// 生成vo
KylinOrderTicketVo
orderTicketVo
=
new
KylinOrderTicketVo
();
orderTicketVo
.
setOrderTicket
(
orderTickets
);
orderTicketVo
.
setOrderTicketStatus
(
orderTicketStatus
);
orderTicketVo
.
setOrderTicketRelation
(
orderTicketRelations
);
orderTicketVo
.
setPerformanceImg
(
performanceData
.
getImgPoster
());
orderTicketVo
.
setTicketTitle
(
ticketData
.
getTitle
());
orderTicketVo
.
setUseStart
(
ticketData
.
getUseStart
());
orderTicketVo
.
setTimeStart
(
performanceData
.
getTimeStart
());
orderTicketVo
.
setOverdueAt
(
orderTickets
.
getCreatedAt
().
plusMinutes
(
performanceData
.
getPayCountdownMinute
()).
format
(
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
)));
orderTicketVo
.
setCreatedAt
(
orderTickets
.
getCreatedAt
().
format
(
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
)));
orderTicketVo
.
setChangeDate
(
orderTickets
.
getCreatedAt
());
currentTime
=
System
.
currentTimeMillis
();
mongoTemplate
.
insert
(
orderTicketVo
,
KylinOrderTicketVo
.
class
.
getSimpleName
());
currentTime
=
System
.
currentTimeMillis
()
-
currentTime
;
log
.
debug
(
"mongo 添加 订单 -> time:"
+
(
currentTime
)
+
"毫秒"
);
if
(
payOrderParam
.
getPayType
().
equals
(
"alipay"
)
&&
payOrderParam
.
getDeviceFrom
().
equals
(
"wap"
))
{
currentTime
=
System
.
currentTimeMillis
();
payResultVo
.
setShowUrl
(
payOrderParam
.
getShowUrl
()
+
orderTicketId
);
mongoVoUtils
.
resetOrderListVo
(
uid
,
1
,
orderTicketVo
.
getOrderTicketsId
(),
orderTicketVo
);
payResultVo
.
setReturnUrl
(
payOrderParam
.
getReturnUrl
()
+
orderTicketId
);
currentTime
=
System
.
currentTimeMillis
()
-
currentTime
;
log
.
debug
(
"redis 修改订单列表 -> time:"
+
(
currentTime
)
+
"毫秒"
);
// 执行sql
String
sqlData
=
SqlMapping
.
gets
(
sqls
,
sqlsDataB
,
sqlsDataC
,
sqlsDataD
,
sqlsDataA
);
currentTime
=
System
.
currentTimeMillis
();
rabbitTemplate
.
convertAndSend
(
MQConst
.
EXCHANGES_LIQUIDNET_SQL_ORDER_CREADE
,
MQConst
.
ROUTING_KEY_SQL_ORDER_CREATE
,
sqlData
);
currentTime
=
System
.
currentTimeMillis
()
-
currentTime
;
log
.
debug
(
"MQ 发送 -> time:"
+
(
currentTime
)
+
"毫秒"
);
log
.
info
(
UserPathDto
.
setData
(
"下单(唤起支付)"
,
payOrderParam
,
payResultVo
));
return
ResponseDto
.
success
(
payResultVo
);
}
catch
(
Exception
e
){
currentTime
=
System
.
currentTimeMillis
();
dataUtils
.
changeSurplusGeneral
(
payOrderParam
.
getTicketId
(),
payOrderParam
.
getNumber
());
currentTime
=
System
.
currentTimeMillis
()
-
currentTime
;
log
.
debug
(
"redis 修改库存 异常 -> time:"
+
(
currentTime
)
+
"毫秒"
);
return
ResponseDto
.
failure
(
"0"
);
}
}
// 生成vo
KylinOrderTicketVo
orderTicketVo
=
new
KylinOrderTicketVo
();
orderTicketVo
.
setOrderTicket
(
orderTickets
);
orderTicketVo
.
setOrderTicketStatus
(
orderTicketStatus
);
orderTicketVo
.
setOrderTicketRelation
(
orderTicketRelations
);
orderTicketVo
.
setPerformanceImg
(
performanceData
.
getImgPoster
());
orderTicketVo
.
setTicketTitle
(
ticketData
.
getTitle
());
orderTicketVo
.
setUseStart
(
ticketData
.
getUseStart
());
orderTicketVo
.
setTimeStart
(
performanceData
.
getTimeStart
());
orderTicketVo
.
setOverdueAt
(
orderTickets
.
getCreatedAt
().
plusMinutes
(
performanceData
.
getPayCountdownMinute
()).
format
(
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
)));
orderTicketVo
.
setCreatedAt
(
orderTickets
.
getCreatedAt
().
format
(
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd HH:mm:ss"
)));
orderTicketVo
.
setChangeDate
(
orderTickets
.
getCreatedAt
());
currentTime
=
System
.
currentTimeMillis
();
mongoTemplate
.
insert
(
orderTicketVo
,
KylinOrderTicketVo
.
class
.
getSimpleName
());
currentTime
=
System
.
currentTimeMillis
()
-
currentTime
;
log
.
debug
(
"mongo 添加 订单 -> time:"
+
(
currentTime
)
+
"毫秒"
);
currentTime
=
System
.
currentTimeMillis
();
mongoVoUtils
.
resetOrderListVo
(
uid
,
1
,
orderTicketVo
.
getOrderTicketsId
(),
orderTicketVo
);
currentTime
=
System
.
currentTimeMillis
()
-
currentTime
;
log
.
debug
(
"redis 修改订单列表 -> time:"
+
(
currentTime
)
+
"毫秒"
);
// 执行sql
String
sqlData
=
SqlMapping
.
gets
(
sqls
,
sqlsDataB
,
sqlsDataC
,
sqlsDataD
,
sqlsDataA
);
currentTime
=
System
.
currentTimeMillis
();
rabbitTemplate
.
convertAndSend
(
MQConst
.
EXCHANGES_LIQUIDNET_SQL_ORDER_CREADE
,
MQConst
.
ROUTING_KEY_SQL_ORDER_CREATE
,
sqlData
);
currentTime
=
System
.
currentTimeMillis
()
-
currentTime
;
log
.
debug
(
"MQ 发送 -> time:"
+
(
currentTime
)
+
"毫秒"
);
log
.
info
(
UserPathDto
.
setData
(
"下单(唤起支付)"
,
payOrderParam
,
payResultVo
));
return
ResponseDto
.
success
(
payResultVo
);
}
}
@Override
@Override
...
...
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