mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
日志清理、支付单过期处理定时任务接入xxl-job
This commit is contained in:
@@ -86,10 +86,10 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Job 定时任务相关 -->
|
<!-- Job 定时任务相关 -->
|
||||||
<!--<dependency>
|
<dependency>
|
||||||
<groupId>com.cf.imes</groupId>
|
<groupId>com.cf.imes</groupId>
|
||||||
<artifactId>cf-spring-boot-starter-job</artifactId>
|
<artifactId>cf-spring-boot-starter-job</artifactId>
|
||||||
</dependency>-->
|
</dependency>
|
||||||
|
|
||||||
<!-- 消息队列相关 -->
|
<!-- 消息队列相关 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -219,6 +219,10 @@
|
|||||||
<groupId>com.cf.imes</groupId>
|
<groupId>com.cf.imes</groupId>
|
||||||
<artifactId>cf-spring-boot-starter-mq</artifactId>
|
<artifactId>cf-spring-boot-starter-mq</artifactId>
|
||||||
</include>
|
</include>
|
||||||
|
<include>
|
||||||
|
<groupId>com.cf.imes</groupId>
|
||||||
|
<artifactId>cf-spring-boot-starter-job</artifactId>
|
||||||
|
</include>
|
||||||
</includes>
|
</includes>
|
||||||
</configuration>
|
</configuration>
|
||||||
<executions>
|
<executions>
|
||||||
|
|||||||
+2
-4
@@ -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.framework.organ.core.aop.OrganIgnore;
|
||||||
import com.cf.imes.module.infra.service.logger.ApiAccessLogService;
|
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 lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
@@ -31,9 +30,8 @@ public class AccessLogCleanJob {
|
|||||||
*/
|
*/
|
||||||
private static final Integer DELETE_LIMIT = 100;
|
private static final Integer DELETE_LIMIT = 100;
|
||||||
|
|
||||||
/* @XxlJob("accessLogCleanJob")*/
|
@XxlJob("accessLogCleanJob")
|
||||||
@OrganIgnore
|
@OrganIgnore
|
||||||
@Scheduled(cron = "0 0 * * * ?")
|
|
||||||
public void execute() {
|
public void execute() {
|
||||||
Integer count = apiAccessLogService.cleanAccessLog(JOB_CLEAN_RETAIN_DAY, DELETE_LIMIT);
|
Integer count = apiAccessLogService.cleanAccessLog(JOB_CLEAN_RETAIN_DAY, DELETE_LIMIT);
|
||||||
log.info("[execute][定时执行清理访问日志数量 ({}) 个]", count);
|
log.info("[execute][定时执行清理访问日志数量 ({}) 个]", count);
|
||||||
|
|||||||
+2
-4
@@ -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.framework.organ.core.aop.OrganIgnore;
|
||||||
import com.cf.imes.module.infra.service.logger.ApiErrorLogService;
|
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 lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
@@ -31,9 +30,8 @@ public class ErrorLogCleanJob {
|
|||||||
*/
|
*/
|
||||||
private static final Integer DELETE_LIMIT = 100;
|
private static final Integer DELETE_LIMIT = 100;
|
||||||
|
|
||||||
/*@XxlJob("errorLogCleanJob")*/
|
@XxlJob("errorLogCleanJob")
|
||||||
@OrganIgnore
|
@OrganIgnore
|
||||||
@Scheduled(cron = "0 0 2 * * ?")
|
|
||||||
public void execute() {
|
public void execute() {
|
||||||
Integer count = apiErrorLogService.cleanErrorLog(JOB_CLEAN_RETAIN_DAY,DELETE_LIMIT);
|
Integer count = apiErrorLogService.cleanErrorLog(JOB_CLEAN_RETAIN_DAY,DELETE_LIMIT);
|
||||||
log.info("[execute][定时执行清理错误日志数量 ({}) 个]", count);
|
log.info("[execute][定时执行清理错误日志数量 ({}) 个]", count);
|
||||||
|
|||||||
@@ -90,9 +90,9 @@ spring:
|
|||||||
--- #################### 定时任务相关配置 ####################
|
--- #################### 定时任务相关配置 ####################
|
||||||
xxl:
|
xxl:
|
||||||
job:
|
job:
|
||||||
enabled: false
|
enabled: enable
|
||||||
admin:
|
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:
|
file:
|
||||||
name: ${user.home}/logs/${spring.application.name} # 日志文件名,全路径
|
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:
|
springdoc:
|
||||||
|
|||||||
@@ -114,10 +114,10 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Job 定时任务相关 -->
|
<!-- Job 定时任务相关 -->
|
||||||
<!-- <dependency>
|
<dependency>
|
||||||
<groupId>com.cf.imes</groupId>
|
<groupId>com.cf.imes</groupId>
|
||||||
<artifactId>cf-spring-boot-starter-job</artifactId>
|
<artifactId>cf-spring-boot-starter-job</artifactId>
|
||||||
</dependency>-->
|
</dependency>
|
||||||
|
|
||||||
<!-- 消息队列相关 -->
|
<!-- 消息队列相关 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -304,6 +304,10 @@
|
|||||||
<groupId>com.cf.imes</groupId>
|
<groupId>com.cf.imes</groupId>
|
||||||
<artifactId>cf-spring-boot-starter-biz-pay</artifactId>
|
<artifactId>cf-spring-boot-starter-biz-pay</artifactId>
|
||||||
</include>
|
</include>
|
||||||
|
<include>
|
||||||
|
<groupId>com.cf.imes</groupId>
|
||||||
|
<artifactId>cf-spring-boot-starter-job</artifactId>
|
||||||
|
</include>
|
||||||
</includes>
|
</includes>
|
||||||
</configuration>
|
</configuration>
|
||||||
<executions>
|
<executions>
|
||||||
|
|||||||
+2
-2
@@ -2,9 +2,9 @@ package com.cf.imes.module.system.job.pay;
|
|||||||
|
|
||||||
import cn.hutool.core.text.CharSequenceUtil;
|
import cn.hutool.core.text.CharSequenceUtil;
|
||||||
import com.cf.imes.module.system.service.pay.PayOrderService;
|
import com.cf.imes.module.system.service.pay.PayOrderService;
|
||||||
|
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -21,7 +21,7 @@ public class PayOrderExpireJob {
|
|||||||
@Resource
|
@Resource
|
||||||
private PayOrderService payOrderService;
|
private PayOrderService payOrderService;
|
||||||
|
|
||||||
@Scheduled(cron = "0 0/1 * * * ?")
|
@XxlJob("payOrderExpireJob")
|
||||||
public String execute() {
|
public String execute() {
|
||||||
int count = payOrderService.expirePayOrder();
|
int count = payOrderService.expirePayOrder();
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
|
|||||||
@@ -93,9 +93,9 @@ spring:
|
|||||||
--- #################### 定时任务相关配置 ####################
|
--- #################### 定时任务相关配置 ####################
|
||||||
xxl:
|
xxl:
|
||||||
job:
|
job:
|
||||||
enabled: false
|
enabled: true
|
||||||
admin:
|
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:
|
file:
|
||||||
name: ${user.home}/logs/${spring.application.name} # 日志文件名,全路径
|
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
|
||||||
|
|
||||||
--- #################### 接口文档配置 ####################
|
--- #################### 接口文档配置 ####################
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user