记得上下班打卡 | 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
2b263d07
Commit
2b263d07
authored
Jun 20, 2021
by
胡佳晨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改 脚本库存脚本
parent
d8e810b1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
41 deletions
+45
-41
KylinOrderTicketsServiceImpl.java
...vice/kylin/service/impl/KylinOrderTicketsServiceImpl.java
+45
-41
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 @
2b263d07
...
@@ -1078,49 +1078,53 @@ public class KylinOrderTicketsServiceImpl extends ServiceImpl<KylinOrderTicketsM
...
@@ -1078,49 +1078,53 @@ public class KylinOrderTicketsServiceImpl extends ServiceImpl<KylinOrderTicketsM
}
}
currentTime
=
System
.
currentTimeMillis
()
-
currentTime
;
currentTime
=
System
.
currentTimeMillis
()
-
currentTime
;
log
.
debug
(
"FOR 循环 -> time:"
+
(
currentTime
)
+
"毫秒"
);
log
.
debug
(
"FOR 循环 -> time:"
+
(
currentTime
)
+
"毫秒"
);
if
(
orderIdList
.
size
()
>
0
)
{
//库存
for
(
Map
.
Entry
<
String
,
Integer
>
entry
:
mapSurplusGeneral
.
entrySet
())
{
dataUtils
.
changeSurplusGeneral
(
entry
.
getKey
(),
entry
.
getValue
());
}
currentTime
=
System
.
currentTimeMillis
()
-
currentTime
;
log
.
debug
(
"redis 库存 -> time:"
+
(
currentTime
)
+
"毫秒"
);
LinkedList
<
String
>
sqls
=
new
LinkedList
<>();
//mysql
String
orderStr
=
""
;
for
(
int
i
=
0
;
i
<
orderIdList
.
size
();
i
++)
{
String
orderTicketId
=
orderIdList
.
get
(
i
).
split
(
","
)[
0
];
orderStr
=
orderTicketId
+
","
;
}
orderStr
=
orderStr
.
substring
(
0
,
orderStr
.
length
()
-
1
);
sqls
.
add
(
SqlMapping
.
get
(
"UPDATE kylin_order_tickets SET updated_at = "
+
now
+
" WHERE order_tickets_id in ("
+
orderStr
+
") "
));
sqls
.
add
(
SqlMapping
.
get
(
"UPDATE kylin_order_ticket_status SET `status` = 2,updated_at = "
+
now
+
" WHERE order_id in ("
+
orderStr
+
") "
));
sqls
.
add
(
SqlMapping
.
get
(
"UPDATE kylin_order_ticket_relations SET updated_at = "
+
now
+
" WHERE order_id in ("
+
orderStr
+
")"
));
rabbitTemplate
.
convertAndSend
(
MQConst
.
EXCHANGES_LIQUIDNET_SQL_ORDER_CLOSE
,
MQConst
.
ROUTING_KEY_SQL_ORDER_CLOSE
,
SqlMapping
.
gets
(
sqls
));
//mongo
mongoTemplate
.
getCollection
(
KylinOrderTicketVo
.
class
.
getSimpleName
()).
updateOne
(
Query
.
query
(
Criteria
.
where
(
"orderTicketsId"
).
in
(
orderIdList
)).
getQueryObject
(),
new
BasicDBObject
(
"$set"
,
mongoConverter
.
convertToMongoType
(
mapMongo
))
);
currentTime
=
System
.
currentTimeMillis
()
-
currentTime
;
log
.
debug
(
"mongo -> time:"
+
(
currentTime
)
+
"毫秒"
);
//redis 列表
orderIdList
.
forEach
(
t
->
{
String
orderTicketId
=
t
.
split
(
","
)[
0
];
String
uid
=
t
.
split
(
","
)[
1
];
KylinOrderTicketVo
vo
=
dataUtils
.
getOrderTicketVo
(
orderTicketId
);
redisUtil
.
set
(
KylinRedisConst
.
ORDER
+
orderTicketId
,
vo
);
mongoVoUtils
.
resetOrderListVo
(
uid
,
2
,
orderTicketId
,
vo
);
// redis 限购
for
(
int
i
=
0
;
i
<
vo
.
getEntitiesVoList
().
size
();
i
++)
{
KylinOrderTicketEntitiesVo
items
=
vo
.
getEntitiesVoList
().
get
(
i
);
dataUtils
.
changeBuyInfo
(
items
.
getUserId
(),
items
.
getEnterIdCode
(),
items
.
getPerformanceId
(),
items
.
getTicketId
(),
-
1
);
}
});
currentTime
=
System
.
currentTimeMillis
()
-
currentTime
;
log
.
debug
(
"redis 列表 限购 -> time:"
+
(
currentTime
)
+
"毫秒"
);
}
//库存
for
(
Map
.
Entry
<
String
,
Integer
>
entry
:
mapSurplusGeneral
.
entrySet
())
{
dataUtils
.
changeSurplusGeneral
(
entry
.
getKey
(),
entry
.
getValue
());
}
currentTime
=
System
.
currentTimeMillis
()
-
currentTime
;
log
.
debug
(
"redis 库存 -> time:"
+
(
currentTime
)
+
"毫秒"
);
//mysql
LinkedList
<
String
>
sqls
=
new
LinkedList
<>();
String
orderStr
=
""
;
for
(
int
i
=
0
;
i
<
orderIdList
.
size
();
i
++)
{
String
orderTicketId
=
orderIdList
.
get
(
i
).
split
(
","
)[
0
];
orderStr
=
orderTicketId
+
","
;
}
orderStr
=
orderStr
.
substring
(
0
,
orderStr
.
length
()
-
1
);
sqls
.
add
(
SqlMapping
.
get
(
"UPDATE kylin_order_tickets SET updated_at = "
+
now
+
" WHERE order_tickets_id in ("
+
orderStr
+
") "
));
sqls
.
add
(
SqlMapping
.
get
(
"UPDATE kylin_order_ticket_status SET `status` = 2,updated_at = "
+
now
+
" WHERE order_id in ("
+
orderStr
+
") "
));
sqls
.
add
(
SqlMapping
.
get
(
"UPDATE kylin_order_ticket_relations SET updated_at = "
+
now
+
" WHERE order_id in ("
+
orderStr
+
")"
));
rabbitTemplate
.
convertAndSend
(
MQConst
.
EXCHANGES_LIQUIDNET_SQL_ORDER_CLOSE
,
MQConst
.
ROUTING_KEY_SQL_ORDER_CLOSE
,
SqlMapping
.
gets
(
sqls
));
//mongo
mongoTemplate
.
getCollection
(
KylinOrderTicketVo
.
class
.
getSimpleName
()).
updateOne
(
Query
.
query
(
Criteria
.
where
(
"orderTicketsId"
).
in
(
orderIdList
)).
getQueryObject
(),
new
BasicDBObject
(
"$set"
,
mongoConverter
.
convertToMongoType
(
mapMongo
))
);
currentTime
=
System
.
currentTimeMillis
()
-
currentTime
;
log
.
debug
(
"mongo -> time:"
+
(
currentTime
)
+
"毫秒"
);
//redis 列表
orderIdList
.
forEach
(
t
->
{
String
orderTicketId
=
t
.
split
(
","
)[
0
];
String
uid
=
t
.
split
(
","
)[
1
];
KylinOrderTicketVo
vo
=
dataUtils
.
getOrderTicketVo
(
orderTicketId
);
redisUtil
.
set
(
KylinRedisConst
.
ORDER
+
orderTicketId
,
vo
);
mongoVoUtils
.
resetOrderListVo
(
uid
,
2
,
orderTicketId
,
vo
);
// redis 限购
for
(
int
i
=
0
;
i
<
vo
.
getEntitiesVoList
().
size
();
i
++)
{
KylinOrderTicketEntitiesVo
items
=
vo
.
getEntitiesVoList
().
get
(
i
);
dataUtils
.
changeBuyInfo
(
items
.
getUserId
(),
items
.
getEnterIdCode
(),
items
.
getPerformanceId
(),
items
.
getTicketId
(),
-
1
);
}
});
currentTime
=
System
.
currentTimeMillis
()
-
currentTime
;
log
.
debug
(
"redis 列表 限购 -> time:"
+
(
currentTime
)
+
"毫秒"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
finally
{
}
finally
{
...
...
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