Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
Z
zhmes-agecal
Project
Project
Details
Activity
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
耿迪迪
zhmes-agecal
Commits
daa59df2
Commit
daa59df2
authored
Sep 23, 2025
by
wanghao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1 测试 上电后通信 和 最终完成 定时任务功能
parent
3a8765a2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
245 additions
and
53 deletions
+245
-53
application-dev.yml
zhmes-agecal-admin/src/main/resources/application-dev.yml
+40
-0
application-test.yml
zhmes-agecal-admin/src/main/resources/application-test.yml
+40
-0
QuartzConfig.java
.../com/zehong/framework/config/properties/QuartzConfig.java
+33
-0
QuartzStartupListener.java
...ng/framework/config/properties/QuartzStartupListener.java
+27
-0
DeviceTaskScheduler.java
...main/java/com/zehong/system/task/DeviceTaskScheduler.java
+105
-53
No files found.
zhmes-agecal-admin/src/main/resources/application-dev.yml
View file @
daa59df2
...
...
@@ -55,6 +55,46 @@ spring:
wall
:
config
:
multi-statement-allow
:
true
# Quartz持久化配置:cite[1]:cite[5]
quartz
:
# 持久化到数据库方式
job-store-type
:
jdbc
# 初始化数据库架构
jdbc
:
initialize-schema
:
always
# Quartz调度程序属性:cite[1]
properties
:
org
:
quartz
:
scheduler
:
# 调度任务实例名称
instanceName
:
ZhMESDeviceScheduler
# 实例ID,AUTO自动生成
instanceId
:
AUTO
jobStore
:
# JobStore实现类
class
:
org.quartz.impl.jdbcjobstore.JobStoreTX
# 驱动程序代理类
driverDelegateClass
:
org.quartz.impl.jdbcjobstore.StdJDBCDelegate
# 表名前缀
tablePrefix
:
QRTZ_
# 是否使用属性文件存储JobDataMaps
useProperties
:
true
# 错过触发阈值(毫秒)
misfireThreshold
:
60000
# 是否启用集群功能
isClustered
:
false
# 集群检查间隔(毫秒)
clusterCheckinInterval
:
15000
# 配置线程池:cite[1]
threadPool
:
class
:
org.quartz.simpl.SimpleThreadPool
# 线程数
threadCount
:
10
# 线程优先级
threadPriority
:
5
# 线程名称前缀
threadNamePrefix
:
ZhMESQuartzWorker_
# redis 配置
redis
:
# 地址
...
...
zhmes-agecal-admin/src/main/resources/application-test.yml
View file @
daa59df2
...
...
@@ -55,6 +55,46 @@ spring:
wall
:
config
:
multi-statement-allow
:
true
# Quartz持久化配置:cite[1]:cite[5]
quartz
:
# 持久化到数据库方式
job-store-type
:
jdbc
# 初始化数据库架构
jdbc
:
initialize-schema
:
always
# Quartz调度程序属性:cite[1]
properties
:
org
:
quartz
:
scheduler
:
# 调度任务实例名称
instanceName
:
ZhMESDeviceScheduler
# 实例ID,AUTO自动生成
instanceId
:
AUTO
jobStore
:
# JobStore实现类
class
:
org.quartz.impl.jdbcjobstore.JobStoreTX
# 驱动程序代理类
driverDelegateClass
:
org.quartz.impl.jdbcjobstore.StdJDBCDelegate
# 表名前缀
tablePrefix
:
QRTZ_
# 是否使用属性文件存储JobDataMaps
useProperties
:
true
# 错过触发阈值(毫秒)
misfireThreshold
:
60000
# 是否启用集群功能
isClustered
:
false
# 集群检查间隔(毫秒)
clusterCheckinInterval
:
15000
# 配置线程池:cite[1]
threadPool
:
class
:
org.quartz.simpl.SimpleThreadPool
# 线程数
threadCount
:
10
# 线程优先级
threadPriority
:
5
# 线程名称前缀
threadNamePrefix
:
ZhMESQuartzWorker_
# redis 配置
redis
:
host
:
127.0.0.1
...
...
zhmes-agecal-framework/src/main/java/com/zehong/framework/config/properties/QuartzConfig.java
0 → 100644
View file @
daa59df2
package
com
.
zehong
.
framework
.
config
.
properties
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.scheduling.quartz.SchedulerFactoryBean
;
import
javax.sql.DataSource
;
import
java.util.Properties
;
/**
* @author lenovo
* @date 2025/9/23
* @description TODO
*/
@Configuration
public
class
QuartzConfig
{
@Bean
public
SchedulerFactoryBean
schedulerFactoryBean
(
DataSource
dataSource
)
{
SchedulerFactoryBean
factory
=
new
SchedulerFactoryBean
();
factory
.
setDataSource
(
dataSource
);
factory
.
setAutoStartup
(
true
);
factory
.
setWaitForJobsToCompleteOnShutdown
(
true
);
factory
.
setOverwriteExistingJobs
(
true
);
Properties
props
=
new
Properties
();
props
.
put
(
"org.quartz.scheduler.instanceName"
,
"DeviceScheduler"
);
props
.
put
(
"org.quartz.scheduler.instanceId"
,
"AUTO"
);
props
.
put
(
"org.quartz.jobStore.misfireThreshold"
,
"60000"
);
factory
.
setQuartzProperties
(
props
);
return
factory
;
}
}
zhmes-agecal-framework/src/main/java/com/zehong/framework/config/properties/QuartzStartupListener.java
0 → 100644
View file @
daa59df2
package
com
.
zehong
.
framework
.
config
.
properties
;
import
com.zehong.system.task.DeviceTaskScheduler
;
import
org.springframework.boot.context.event.ApplicationReadyEvent
;
import
org.springframework.context.ApplicationListener
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
/**
* @author lenovo
* @date 2025/9/23
* @description TODO
*/
@Component
public
class
QuartzStartupListener
implements
ApplicationListener
<
ApplicationReadyEvent
>
{
private
static
final
org
.
slf4j
.
Logger
log
=
org
.
slf4j
.
LoggerFactory
.
getLogger
(
QuartzStartupListener
.
class
);
@Resource
private
DeviceTaskScheduler
deviceTaskScheduler
;
@Override
public
void
onApplicationEvent
(
ApplicationReadyEvent
event
)
{
log
.
info
(
"应用启动完成,检查Quartz任务状态..."
);
// 这里可以添加需要自动恢复的任务检查逻辑
}
}
zhmes-agecal-system/src/main/java/com/zehong/system/task/DeviceTaskScheduler.java
View file @
daa59df2
This diff is collapsed.
Click to expand it.
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