Merge remote-tracking branch 'origin/main'

This commit is contained in:
dzl 2025-05-21 10:17:35 +08:00
commit 79e0f5860e
3 changed files with 14 additions and 10 deletions

View File

@ -2,9 +2,7 @@ package com.cdzy.payment.config;
import com.wechat.pay.java.core.Config;
import com.wechat.pay.java.core.RSAPublicKeyConfig;
import com.wechat.pay.java.core.cipher.RSASigner;
import com.wechat.pay.java.core.cipher.Signer;
import com.wechat.pay.java.core.util.PemUtil;
import com.wechat.pay.java.service.payments.jsapi.JsapiService;
import com.wechat.pay.java.service.refund.RefundService;
import lombok.Data;
@ -12,8 +10,6 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.security.PrivateKey;
/**
* 微信支付配置参数
*
@ -67,10 +63,15 @@ public class WxPayConfig {
*/
private Integer expireMinute = 1440;
/**
* 定时任务执行表达式
* 支付状态检查定时任务执行表达式
* 默认每12小时执行1次
*/
private String cronExpression = "0 0 0,12 * * ?";
private String paySchedule = "0 0 0/12 * * ?";
/**
* 退款状态检查定时任务执行表达式
* 默认每30分钟执行1次
*/
private String refundSchedule = "0 0/30 * * * ?";
@Bean
public Config certificateConfig() {

View File

@ -29,7 +29,9 @@ public class ScheduledTaskManager {
@PostConstruct
public void init() {
String CRON_EXPRESSION = wxPayConfig.getCronExpression();
String CRON_EXPRESSION_PAY = wxPayConfig.getPaySchedule();
String CRON_EXPRESSION_REFUND = wxPayConfig.getRefundSchedule();
// 启动定时任务
// 1. 每隔30秒执行1次查询创建未超过5分钟并且未支付的订单
threadPoolTaskScheduler.schedule(new Runnable() {
@ -41,7 +43,7 @@ public class ScheduledTaskManager {
log.error("checkOrderStatus 执行异常", e);
}
}
}, new CronTrigger(CRON_EXPRESSION));
}, new CronTrigger(CRON_EXPRESSION_PAY));
//========支付系统自动关闭不主动关闭每次发起请求的时候检测是否关闭========
//// 2. 每隔30秒执行1次查询创建超过5分钟并且未支付的订单
@ -66,7 +68,7 @@ public class ScheduledTaskManager {
log.error("checkRefundStatus 执行异常", e);
}
}
}, new CronTrigger(CRON_EXPRESSION));
}, new CronTrigger(CRON_EXPRESSION_REFUND));
}
}

View File

@ -43,7 +43,8 @@ payment:
pay-notify_url: http://192.168.2.156:10017/wxPayment/pay-notify
refund-notify_url: http://192.168.2.156:10017/wxPayment/refund-notify
expire-minutes: 1440
cron-expression: 0 0 0,12 * * ?
pay-schedule: 0 0 0/12 * * ?
refund-schedule: 0 0/30 * * * ?
task-scheduler-pool:
poolSize: 100
threadNamePrefix: task-scheduled-