日志清理、支付单过期处理定时任务接入xxl-job

This commit is contained in:
gaoqr
2025-11-05 11:51:42 +08:00
parent 6d159ab429
commit 86e0adb8f2
9 changed files with 35 additions and 18 deletions
+6 -2
View File
@@ -86,10 +86,10 @@
</dependency>
<!-- Job 定时任务相关 -->
<!--<dependency>
<dependency>
<groupId>com.cf.imes</groupId>
<artifactId>cf-spring-boot-starter-job</artifactId>
</dependency>-->
</dependency>
<!-- 消息队列相关 -->
<dependency>
@@ -219,6 +219,10 @@
<groupId>com.cf.imes</groupId>
<artifactId>cf-spring-boot-starter-mq</artifactId>
</include>
<include>
<groupId>com.cf.imes</groupId>
<artifactId>cf-spring-boot-starter-job</artifactId>
</include>
</includes>
</configuration>
<executions>
@@ -2,9 +2,8 @@ package com.cf.imes.module.infra.job.logger;
import com.cf.imes.framework.organ.core.aop.OrganIgnore;
import com.cf.imes.module.infra.service.logger.ApiAccessLogService;
/*import com.xxl.job.core.handler.annotation.XxlJob;*/
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import jakarta.annotation.Resource;
@@ -31,9 +30,8 @@ public class AccessLogCleanJob {
*/
private static final Integer DELETE_LIMIT = 100;
/* @XxlJob("accessLogCleanJob")*/
@XxlJob("accessLogCleanJob")
@OrganIgnore
@Scheduled(cron = "0 0 * * * ?")
public void execute() {
Integer count = apiAccessLogService.cleanAccessLog(JOB_CLEAN_RETAIN_DAY, DELETE_LIMIT);
log.info("[execute][定时执行清理访问日志数量 ({}) 个]", count);
@@ -2,9 +2,8 @@ package com.cf.imes.module.infra.job.logger;
import com.cf.imes.framework.organ.core.aop.OrganIgnore;
import com.cf.imes.module.infra.service.logger.ApiErrorLogService;
/*import com.xxl.job.core.handler.annotation.XxlJob;*/
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import jakarta.annotation.Resource;
@@ -31,9 +30,8 @@ public class ErrorLogCleanJob {
*/
private static final Integer DELETE_LIMIT = 100;
/*@XxlJob("errorLogCleanJob")*/
@XxlJob("errorLogCleanJob")
@OrganIgnore
@Scheduled(cron = "0 0 2 * * ?")
public void execute() {
Integer count = apiErrorLogService.cleanErrorLog(JOB_CLEAN_RETAIN_DAY,DELETE_LIMIT);
log.info("[execute][定时执行清理错误日志数量 ({}) 个]", count);
@@ -90,9 +90,9 @@ spring:
--- #################### 定时任务相关配置 ####################
xxl:
job:
enabled: false
enabled: enable
admin:
addresses: http://127.0.0.1:9090/xxl-job-admin # 调度中心部署跟地址
addresses: http://192.168.1.205:28080/xxl-job-admin # 调度中心部署跟地址
--- #################### 服务保障相关配置 ####################
@@ -46,6 +46,13 @@ logging:
file:
name: ${user.home}/logs/${spring.application.name} # 日志文件名,全路径
xxl:
job:
executor:
appname: ${spring.application.name} # 执行器 AppName
logpath: ${user.home}/logs/xxl-job/${spring.application.name} # 执行器运行日志文件存储磁盘路径
accessToken: default_token # 执行器通讯TOKEN
--- #################### 接口文档配置 ####################
springdoc: