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
6e04f592
...
6e04f5920179c3255fcb42e33cd1388c105223f0
authored
2020-12-06 09:59:41 +0800
by
lWoHvYe
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
自动上线功能调整,添加更新时间与创建时间的差值限制。当前依据为当天的内容、文件就绪、状态下线、创建更新时间相差半小时以内
1 parent
728edf62
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletions
src/main/java/com/topdraw/platform/executor/AutoOnlineProcessor.java
src/main/resources/config/application.yml
src/main/java/com/topdraw/platform/executor/AutoOnlineProcessor.java
View file @
6e04f59
...
...
@@ -5,6 +5,7 @@ import cn.hutool.core.util.StrUtil;
import
com.topdraw.platform.util.DbUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
...
...
@@ -16,6 +17,9 @@ public class AutoOnlineProcessor {
@Autowired
DbUtil
dbUtil
;
@Value
(
"${entity.difference}"
)
private
Long
DIFFERENCE
;
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
execute
()
{
Connection
connection
=
null
;
...
...
@@ -23,7 +27,7 @@ public class AutoOnlineProcessor {
try
{
connection
=
dbUtil
.
getConnection
();
// 查询未绑定
String
sql
=
" update `x_media` set `status` = '001' where `status` = '000' and file_status = '001' and create_time >= ? "
;
String
sql
=
StrUtil
.
format
(
" update `x_media` set `status` = '001' where `status` = '000' and file_status = '001' and (update_time - create_time) < {} and create_time >= ? "
,
DIFFERENCE
)
;
dbUtil
.
doExecute
(
connection
,
sql
,
today
);
// 提交事务
dbUtil
.
commitTransaction
(
connection
);
...
...
src/main/resources/config/application.yml
View file @
6e04f59
...
...
@@ -3,12 +3,16 @@ server:
scheduler
:
auto-bind
:
# 自动绑应用
app-enabled
:
true
# 自动绑服务包
service-enabled
:
true
# 内容自动上线
media-online-enabled
:
true
cron
:
auto-bind
:
# 任务执行间隔
app
:
0/10 * * * * ?
service
:
0/10 * * * * ?
media-online
:
0/10 * * * * ?
...
...
@@ -26,5 +30,9 @@ spring:
active
:
dev
entity
:
# 自动绑的应用id
appId
:
63
# 自动绑的服务包id
serviceId
:
1
# 自动上线判断依据:创建更新时间间隔秒
difference
:
1800
...
...
Please
register
or
sign in
to post a comment