Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
王红岩
/
cms-scheduler
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
bbafa142
...
bbafa142c3e0c9e6177e5135c309354dba37d816
authored
2021-01-13 19:54:50 +0800
by
lWoHvYe
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
上线逻辑调整
1 parent
5f2aa355
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
8 deletions
src/main/java/com/topdraw/platform/executor/AutoOnlineProcessor.java
src/main/java/com/topdraw/platform/executor/AutoOnlineProcessor.java
View file @
bbafa14
package
com
.
topdraw
.
platform
.
executor
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.topdraw.platform.util.DbUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.var
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
...
...
@@ -11,6 +13,7 @@ import org.springframework.transaction.annotation.Transactional;
import
java.sql.Connection
;
import
java.util.Date
;
import
java.util.Map
;
@Component
@Slf4j
...
...
@@ -26,14 +29,18 @@ public class AutoOnlineProcessor {
String
today
=
DateUtil
.
today
();
try
{
connection
=
dbUtil
.
getConnection
();
// 查询未绑定
String
sql
=
StrUtil
.
format
(
" update `x_media` set `status` = '001',`update_time` = '{}' "
+
"where id in ( select a.id from "
+
"(select xm.id from `x_media` xm LEFT JOIN x_content_status_change xcsc on xm.id = xcsc.content_id and xcsc.content_class = 'media' "
+
"where xm.`status` = '000' and xm.file_status = '001' and xm.create_time >= ? and xcsc.id is null "
+
") as a ) "
,
DateUtil
.
now
());
dbUtil
.
doExecute
(
connection
,
sql
,
today
);
String
quSql
=
"select xm.id from `x_media` xm LEFT JOIN x_content_status_change xcsc on xm.id = xcsc.content_id and xcsc.content_class = 'media' "
+
"where xm.`status` = '000' and xm.file_status = '001' and xm.update_time >= ? and xcsc.id is null "
;
var
mapList
=
dbUtil
.
queryList
(
connection
,
quSql
,
today
);
dbUtil
.
beginTransaction
(
connection
);
if
(
CollUtil
.
isNotEmpty
(
mapList
))
{
for
(
Map
<
String
,
Object
>
map
:
mapList
)
{
var
id
=
(
Long
)
map
.
get
(
"id"
);
String
upSql
=
StrUtil
.
format
(
" update `x_media` set `status` = '001',`update_time` = '{}' where id = ?"
,
DateUtil
.
now
());
dbUtil
.
doExecute
(
connection
,
upSql
,
id
);
}
}
dbUtil
.
commitTransaction
(
connection
);
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
}
finally
{
...
...
Please
register
or
sign in
to post a comment