日志清理、支付单过期处理定时任务接入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
@@ -114,10 +114,10 @@
</dependency>
<!-- Job 定时任务相关 -->
<!-- <dependency>
<dependency>
<groupId>com.cf.imes</groupId>
<artifactId>cf-spring-boot-starter-job</artifactId>
</dependency>-->
</dependency>
<!-- 消息队列相关 -->
<dependency>
@@ -304,6 +304,10 @@
<groupId>com.cf.imes</groupId>
<artifactId>cf-spring-boot-starter-biz-pay</artifactId>
</include>
<include>
<groupId>com.cf.imes</groupId>
<artifactId>cf-spring-boot-starter-job</artifactId>
</include>
</includes>
</configuration>
<executions>
@@ -2,9 +2,9 @@ package com.cf.imes.module.system.job.pay;
import cn.hutool.core.text.CharSequenceUtil;
import com.cf.imes.module.system.service.pay.PayOrderService;
import com.xxl.job.core.handler.annotation.XxlJob;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
/**
@@ -21,7 +21,7 @@ public class PayOrderExpireJob {
@Resource
private PayOrderService payOrderService;
@Scheduled(cron = "0 0/1 * * * ?")
@XxlJob("payOrderExpireJob")
public String execute() {
int count = payOrderService.expirePayOrder();
if (count > 0) {
@@ -93,9 +93,9 @@ spring:
--- #################### 定时任务相关配置 ####################
xxl:
job:
enabled: false
enabled: true
admin:
addresses: http://127.0.0.1:9090/xxl-job-admin # 调度中心部署跟地址
addresses: http://192.168.1.205:28080/xxl-job-admin # 调度中心部署跟地址
--- #################### 服务保障相关配置 ####################
@@ -46,6 +46,12 @@ 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
--- #################### 接口文档配置 ####################