记得上下班打卡 | 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
f272f2c6
Commit
f272f2c6
authored
Jun 19, 2021
by
胡佳晨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
脚本增加锁逻辑
parent
7d1a82b9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
12 deletions
+13
-12
KylinOrderTicketsServiceImpl.java
...vice/kylin/service/impl/KylinOrderTicketsServiceImpl.java
+13
-12
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 @
f272f2c6
...
...
@@ -1016,17 +1016,18 @@ public class KylinOrderTicketsServiceImpl extends ServiceImpl<KylinOrderTicketsM
@Override
public
boolean
checkOrderTime
(
String
userId
)
{
String
lock
=
"order_lock:checkOrderTime:"
+
userId
;
try
{
if
(
redisLockUtil
.
tryLock
(
lock
,
1
,
3600
))
{
if
(
redisLockUtil
.
tryLock
(
lock
,
1
,
3600
))
{
try
{
List
<
OrderScriptDto
>
dtoData
=
orderTicketsMapper
.
orderScriptDto
(
userId
);
HashMap
<
String
,
Integer
>
map2
=
new
HashMap
<>();
Integer
count
=
0
;
Integer
mqCount
=
0
;
Integer
Acount
=
0
;
Integer
Ecount
=
0
;
for
(
OrderScriptDto
item
:
dtoData
)
{
count
+=
1
;
LinkedList
<
String
>
sqls
=
new
LinkedList
<>();
if
(
item
.
getStatus
()
==
KylinTableStatusConst
.
ORDER_STATUS0
)
{
if
(
item
.
getStatus
()
.
equals
(
KylinTableStatusConst
.
ORDER_STATUS0
)
)
{
LocalDateTime
now
=
LocalDateTime
.
now
();
try
{
KylinOrderTicketVo
vo
=
dataUtils
.
getOrderTicketVo
(
item
.
getOrderTicketsId
());
...
...
@@ -1065,9 +1066,7 @@ public class KylinOrderTicketsServiceImpl extends ServiceImpl<KylinOrderTicketsM
mongoVoUtils
.
resetOrderListVo
(
item
.
getUserId
(),
2
,
item
.
getOrderTicketsId
(),
vo
);
Acount
+=
1
;
// List<KylinOrderTicketEntities> entities = entitiesMapper.selectList(new UpdateWrapper<KylinOrderTicketEntities>().eq("order_id", item.getOrderTicketsId()));
List
<
KylinOrderTicketEntitiesVo
>
entities
=
vo
.
getEntitiesVoList
();
// entitiesMapper.selectList(new UpdateWrapper<KylinOrderTicketEntities>().eq("order_id", item.getOrderTicketsId()));
for
(
int
i
=
0
;
i
<
entities
.
size
();
i
++)
{
KylinOrderTicketEntitiesVo
items
=
entities
.
get
(
i
);
dataUtils
.
changeBuyInfo
(
items
.
getUserId
(),
items
.
getEnterIdCode
(),
items
.
getPerformanceId
(),
items
.
getTicketId
(),
-
1
);
...
...
@@ -1092,22 +1091,24 @@ public class KylinOrderTicketsServiceImpl extends ServiceImpl<KylinOrderTicketsM
e
.
printStackTrace
();
return
false
;
}
}
else
{
Ecount
+=
1
;
}
}
log
.
debug
(
"COUNT 1 = "
+
count
);
log
.
debug
(
"COUNT 2 = "
+
mqCount
);
log
.
debug
(
"COUNT 3 = "
+
Acount
);
log
.
debug
(
"COUNT 4 = "
+
Ecount
);
for
(
Map
.
Entry
<
String
,
Integer
>
entry
:
map2
.
entrySet
())
{
dataUtils
.
changeSurplusGeneral
(
entry
.
getKey
(),
entry
.
getValue
());
}
}
else
{
log
.
debug
(
"WARNING LOCKING"
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
redisLockUtil
.
unlock
(
lock
);
}
}
catch
(
Exception
e
)
{
redisLockUtil
.
unlock
(
lock
);
return
false
;
}
finally
{
redisLockUtil
.
unlock
(
lock
);
}
else
{
log
.
debug
(
"WARNING LOCKING"
);
}
return
true
;
}
...
...
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