优化多租户 Job 的实现,保持和 boot 版本尽量一致

This commit is contained in:
YunaiV 2023-09-16 14:17:25 +08:00
parent b80a928fec
commit a4c2061113
5 changed files with 5 additions and 5 deletions

View File

@ -15,7 +15,6 @@ import javax.annotation.Resource;
* @author 芋道源码 * @author 芋道源码
*/ */
@Component @Component
@TenantJob // 多租户
@Slf4j @Slf4j
public class PayNotifyJob { public class PayNotifyJob {
@ -23,6 +22,7 @@ public class PayNotifyJob {
private PayNotifyService payNotifyService; private PayNotifyService payNotifyService;
@XxlJob("payNotifyJob") @XxlJob("payNotifyJob")
@TenantJob // 多租户
public void execute() throws Exception { public void execute() throws Exception {
int notifyCount = payNotifyService.executeNotify(); int notifyCount = payNotifyService.executeNotify();
log.info("[execute][执行支付通知 ({}) 个]", notifyCount); log.info("[execute][执行支付通知 ({}) 个]", notifyCount);

View File

@ -16,7 +16,6 @@ import javax.annotation.Resource;
* @author 芋道源码 * @author 芋道源码
*/ */
@Component @Component
@TenantJob
@Slf4j @Slf4j
public class PayOrderExpireJob { public class PayOrderExpireJob {
@ -24,6 +23,7 @@ public class PayOrderExpireJob {
private PayOrderService orderService; private PayOrderService orderService;
@XxlJob("payOrderExpireJob") @XxlJob("payOrderExpireJob")
@TenantJob // 多租户
public void execute(String param) { public void execute(String param) {
int count = orderService.expireOrder(); int count = orderService.expireOrder();
log.info("[execute][支付过期 ({}) 个]", count); log.info("[execute][支付过期 ({}) 个]", count);

View File

@ -18,7 +18,6 @@ import java.time.LocalDateTime;
* @author 芋道源码 * @author 芋道源码
*/ */
@Component @Component
@TenantJob
@Slf4j @Slf4j
public class PayOrderSyncJob { public class PayOrderSyncJob {
@ -35,6 +34,7 @@ public class PayOrderSyncJob {
private PayOrderService orderService; private PayOrderService orderService;
@XxlJob("payOrderSyncJob") @XxlJob("payOrderSyncJob")
@TenantJob // 多租户
public void execute() { public void execute() {
LocalDateTime minCreateTime = LocalDateTime.now().minus(CREATE_TIME_DURATION_BEFORE); LocalDateTime minCreateTime = LocalDateTime.now().minus(CREATE_TIME_DURATION_BEFORE);
int count = orderService.syncOrder(minCreateTime); int count = orderService.syncOrder(minCreateTime);

View File

@ -16,7 +16,6 @@ import javax.annotation.Resource;
* @author 芋道源码 * @author 芋道源码
*/ */
@Component @Component
@TenantJob
@Slf4j @Slf4j
public class PayRefundSyncJob { public class PayRefundSyncJob {
@ -24,6 +23,7 @@ public class PayRefundSyncJob {
private PayRefundService refundService; private PayRefundService refundService;
@XxlJob("payRefundSyncJob") @XxlJob("payRefundSyncJob")
@TenantJob // 多租户
public void execute() { public void execute() {
int count = refundService.syncRefund(); int count = refundService.syncRefund();
log.info("[execute][同步退款订单 ({}) 个]", count); log.info("[execute][同步退款订单 ({}) 个]", count);

View File

@ -5,10 +5,10 @@ import com.xxl.job.core.handler.annotation.XxlJob;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@Component @Component
@TenantJob
public class DemoJob { public class DemoJob {
@XxlJob("demoJob") @XxlJob("demoJob")
@TenantJob
public void execute() { public void execute() {
System.out.println("美滋滋"); System.out.println("美滋滋");
} }