1、project任务延期xxljob改造
This commit is contained in:
@@ -1,24 +1,24 @@
|
||||
package com.sdm.project.schedule.lyric;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class CommitmentDeadlineStatusSchedule {
|
||||
|
||||
@Autowired
|
||||
private CommitmentDeadlineStatusScheduleExecutor commitmentDeadlineStatusScheduleExecutor;
|
||||
|
||||
// fixedDelayString 读取配置,值为【毫秒】,所以拼接000
|
||||
@Scheduled(fixedDelayString = "${commitmentDeadlineStatusTask.schedule.interval:1800}000")
|
||||
public void doCommitmentDeadlineStatusTask() {
|
||||
try {
|
||||
commitmentDeadlineStatusScheduleExecutor.run();
|
||||
} catch (Exception e) {
|
||||
log.error("【承诺截止状态更新任务】执行异常,原因:{}", e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
//package com.sdm.project.schedule.lyric;
|
||||
//
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.scheduling.annotation.Scheduled;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//
|
||||
//@Component
|
||||
//@Slf4j
|
||||
//public class CommitmentDeadlineStatusSchedule {
|
||||
//
|
||||
// @Autowired
|
||||
// private CommitmentDeadlineStatusScheduleExecutor commitmentDeadlineStatusScheduleExecutor;
|
||||
//
|
||||
// // fixedDelayString 读取配置,值为【毫秒】,所以拼接000
|
||||
// @Scheduled(fixedDelayString = "${commitmentDeadlineStatusTask.schedule.interval:1800}000")
|
||||
// public void doCommitmentDeadlineStatusTask() {
|
||||
// try {
|
||||
// commitmentDeadlineStatusScheduleExecutor.run();
|
||||
// } catch (Exception e) {
|
||||
// log.error("【承诺截止状态更新任务】执行异常,原因:{}", e.getMessage(), e);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@@ -6,10 +6,12 @@ import com.sdm.project.model.entity.SimulationNode;
|
||||
import com.sdm.project.model.entity.SimulationTask;
|
||||
import com.sdm.project.service.INodeService;
|
||||
import com.sdm.project.service.ISimulationTaskService;
|
||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -22,8 +24,8 @@ import java.util.stream.Collectors;
|
||||
import static com.sdm.project.service.impl.NodeServiceImpl.SYNC_PROJECT_SOURCE;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class CommitmentDeadlineStatusScheduleExecutor implements Runnable {
|
||||
@Component
|
||||
public class CommitmentDeadlineStatusScheduleExecutor{
|
||||
|
||||
// 时间格式化器:全局常量,线程安全,可复用(yyyy-MM-dd HH:mm:ss 固定格式)
|
||||
private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
@@ -37,8 +39,8 @@ public class CommitmentDeadlineStatusScheduleExecutor implements Runnable {
|
||||
@Resource
|
||||
private ISimulationTaskService taskService;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
@XxlJob("commitmentDeadlineStatusHandler")
|
||||
public void commitmentDeadlineStatusHandler() {
|
||||
log.info("定时任务执行");
|
||||
try {
|
||||
// 1. 获取所有节点(工位)
|
||||
|
||||
@@ -149,4 +149,33 @@ project:
|
||||
basic:
|
||||
enabled: true
|
||||
lyric:
|
||||
enabled: false
|
||||
enabled: false
|
||||
|
||||
# xxljob 配置开始
|
||||
xxl:
|
||||
job:
|
||||
admin:
|
||||
# 调度中心地址列表
|
||||
addresses: http://192.168.190.161:7110/xxl-job-admin
|
||||
# 调度中心访问令牌
|
||||
accessToken: default_token
|
||||
# xxl-job 超时时间(秒),默认3秒
|
||||
timeout: 3
|
||||
executor:
|
||||
# 执行器是否启用,默认true
|
||||
enabled: true
|
||||
# 执行器应用名称 服务名-job-executor
|
||||
appname: project-job-executor
|
||||
# 执行器注册地址:默认使用address注册,若为null则使用ip:port注册
|
||||
address:
|
||||
# 执行器IP
|
||||
ip:
|
||||
# 执行器端口,为了好记,web服务端口+1000
|
||||
port: 8101
|
||||
# 执行器日志路径
|
||||
logpath: /home/app/project/xxljob
|
||||
# 执行器日志保留天数
|
||||
logretentiondays: 14
|
||||
# 执行器排除扫描的包,多个用逗号分隔,如 "org.package01" 或 "org.package01,org.package02"
|
||||
excludedpackage:
|
||||
# xxljob 配置结束
|
||||
@@ -149,4 +149,33 @@ project:
|
||||
basic:
|
||||
enabled: true
|
||||
lyric:
|
||||
enabled: false
|
||||
enabled: false
|
||||
|
||||
# xxljob 配置开始
|
||||
xxl:
|
||||
job:
|
||||
admin:
|
||||
# 调度中心地址列表
|
||||
addresses: http://192.168.65.161:7110/xxl-job-admin
|
||||
# 调度中心访问令牌
|
||||
accessToken: default_token
|
||||
# xxl-job 超时时间(秒),默认3秒
|
||||
timeout: 3
|
||||
executor:
|
||||
# 执行器是否启用,默认true
|
||||
enabled: true
|
||||
# 执行器应用名称 服务名-job-executor
|
||||
appname: project-job-executor
|
||||
# 执行器注册地址:默认使用address注册,若为null则使用ip:port注册
|
||||
address:
|
||||
# 执行器IP
|
||||
ip:
|
||||
# 执行器端口,为了好记,web服务端口+1000
|
||||
port: 8101
|
||||
# 执行器日志路径
|
||||
logpath: /home/app/project/xxljob
|
||||
# 执行器日志保留天数
|
||||
logretentiondays: 14
|
||||
# 执行器排除扫描的包,多个用逗号分隔,如 "org.package01" 或 "org.package01,org.package02"
|
||||
excludedpackage:
|
||||
# xxljob 配置结束
|
||||
@@ -153,4 +153,33 @@ project:
|
||||
basic:
|
||||
enabled: true
|
||||
lyric:
|
||||
enabled: false
|
||||
enabled: false
|
||||
|
||||
# xxljob 配置开始
|
||||
xxl:
|
||||
job:
|
||||
admin:
|
||||
# 调度中心地址列表
|
||||
addresses: http://127.0.0.1:7110/xxl-job-admin
|
||||
# 调度中心访问令牌
|
||||
accessToken: default_token
|
||||
# xxl-job 超时时间(秒),默认3秒
|
||||
timeout: 3
|
||||
executor:
|
||||
# 执行器是否启用,默认true
|
||||
enabled: true
|
||||
# 执行器应用名称 服务名-job-executor
|
||||
appname: project-job-executor
|
||||
# 执行器注册地址:默认使用address注册,若为null则使用ip:port注册
|
||||
address:
|
||||
# 执行器IP
|
||||
ip:
|
||||
# 执行器端口,为了好记,web服务端口+1000
|
||||
port: 8101
|
||||
# 执行器日志路径
|
||||
logpath: D:\xxljob\logs
|
||||
# 执行器日志保留天数
|
||||
logretentiondays: 14
|
||||
# 执行器排除扫描的包,多个用逗号分隔,如 "org.package01" 或 "org.package01,org.package02"
|
||||
excludedpackage:
|
||||
# xxljob 配置结束
|
||||
@@ -150,4 +150,33 @@ project:
|
||||
basic:
|
||||
enabled: false
|
||||
lyric:
|
||||
enabled: true
|
||||
enabled: true
|
||||
|
||||
# xxljob 配置开始
|
||||
xxl:
|
||||
job:
|
||||
admin:
|
||||
# 调度中心地址列表
|
||||
addresses: http://192.168.30.148:7110/xxl-job-admin
|
||||
# 调度中心访问令牌
|
||||
accessToken: default_token
|
||||
# xxl-job 超时时间(秒),默认3秒
|
||||
timeout: 3
|
||||
executor:
|
||||
# 执行器是否启用,默认true
|
||||
enabled: true
|
||||
# 执行器应用名称 服务名-job-executor
|
||||
appname: project-job-executor
|
||||
# 执行器注册地址:默认使用address注册,若为null则使用ip:port注册
|
||||
address:
|
||||
# 执行器IP
|
||||
ip:
|
||||
# 执行器端口,为了好记,web服务端口+1000
|
||||
port: 8101
|
||||
# 执行器日志路径
|
||||
logpath: /home/app/project/xxljob
|
||||
# 执行器日志保留天数
|
||||
logretentiondays: 14
|
||||
# 执行器排除扫描的包,多个用逗号分隔,如 "org.package01" 或 "org.package01,org.package02"
|
||||
excludedpackage:
|
||||
# xxljob 配置结束
|
||||
Reference in New Issue
Block a user