优化多租户 Job 的实现,保持和 boot 版本尽量一致
parent
b80a928fec
commit
a4c2061113
|
@ -15,7 +15,6 @@ import javax.annotation.Resource;
|
|||
* @author 芋道源码
|
||||
*/
|
||||
@Component
|
||||
@TenantJob // 多租户
|
||||
@Slf4j
|
||||
public class PayNotifyJob {
|
||||
|
||||
|
@ -23,6 +22,7 @@ public class PayNotifyJob {
|
|||
private PayNotifyService payNotifyService;
|
||||
|
||||
@XxlJob("payNotifyJob")
|
||||
@TenantJob // 多租户
|
||||
public void execute() throws Exception {
|
||||
int notifyCount = payNotifyService.executeNotify();
|
||||
log.info("[execute][执行支付通知 ({}) 个]", notifyCount);
|
||||
|
|
|
@ -16,7 +16,6 @@ import javax.annotation.Resource;
|
|||
* @author 芋道源码
|
||||
*/
|
||||
@Component
|
||||
@TenantJob
|
||||
@Slf4j
|
||||
public class PayOrderExpireJob {
|
||||
|
||||
|
@ -24,6 +23,7 @@ public class PayOrderExpireJob {
|
|||
private PayOrderService orderService;
|
||||
|
||||
@XxlJob("payOrderExpireJob")
|
||||
@TenantJob // 多租户
|
||||
public void execute(String param) {
|
||||
int count = orderService.expireOrder();
|
||||
log.info("[execute][支付过期 ({}) 个]", count);
|
||||
|
|
|
@ -18,7 +18,6 @@ import java.time.LocalDateTime;
|
|||
* @author 芋道源码
|
||||
*/
|
||||
@Component
|
||||
@TenantJob
|
||||
@Slf4j
|
||||
public class PayOrderSyncJob {
|
||||
|
||||
|
@ -35,6 +34,7 @@ public class PayOrderSyncJob {
|
|||
private PayOrderService orderService;
|
||||
|
||||
@XxlJob("payOrderSyncJob")
|
||||
@TenantJob // 多租户
|
||||
public void execute() {
|
||||
LocalDateTime minCreateTime = LocalDateTime.now().minus(CREATE_TIME_DURATION_BEFORE);
|
||||
int count = orderService.syncOrder(minCreateTime);
|
||||
|
|
|
@ -16,7 +16,6 @@ import javax.annotation.Resource;
|
|||
* @author 芋道源码
|
||||
*/
|
||||
@Component
|
||||
@TenantJob
|
||||
@Slf4j
|
||||
public class PayRefundSyncJob {
|
||||
|
||||
|
@ -24,6 +23,7 @@ public class PayRefundSyncJob {
|
|||
private PayRefundService refundService;
|
||||
|
||||
@XxlJob("payRefundSyncJob")
|
||||
@TenantJob // 多租户
|
||||
public void execute() {
|
||||
int count = refundService.syncRefund();
|
||||
log.info("[execute][同步退款订单 ({}) 个]", count);
|
||||
|
|
|
@ -5,10 +5,10 @@ import com.xxl.job.core.handler.annotation.XxlJob;
|
|||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@TenantJob
|
||||
public class DemoJob {
|
||||
|
||||
@XxlJob("demoJob")
|
||||
@TenantJob
|
||||
public void execute() {
|
||||
System.out.println("美滋滋");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue