fix: 微信支付成功,未更新设备有效期问题修复。
This commit is contained in:
@@ -9,7 +9,7 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 支付订单补偿定时任务
|
||||
* 定期扫描状态为"未支付/支付中"但已有prepayId的订单,
|
||||
* 定期扫描状态为"未支付/支付中/支付失败"但已有prepayId的订单,
|
||||
* 主动向微信支付查询实际状态,对已支付成功但回调丢失的订单进行补偿处理。
|
||||
*
|
||||
* 解决问题:用户实际已付款成功,但因网络/服务器等原因未收到微信支付回调通知,
|
||||
@@ -26,11 +26,11 @@ public class PayOrderCompensationTask {
|
||||
private final PayOrderBusinessService payOrderBusinessService;
|
||||
|
||||
/**
|
||||
* 每5分钟执行一次订单补偿扫描
|
||||
* 查询已创建超过5分钟但未超过24小时的未完成订单,
|
||||
* 每1分钟执行一次订单补偿扫描
|
||||
* 查询已创建超过1分钟但未超过48小时的未完成订单,
|
||||
* 向微信主动查单,补偿漏掉的回调。
|
||||
*/
|
||||
@Scheduled(fixedDelay = 300000)
|
||||
@Scheduled(fixedDelay = 60000, initialDelay = 60000)
|
||||
public void compensateOrders() {
|
||||
try {
|
||||
int count = payOrderBusinessService.compensateUnpaidOrders();
|
||||
@@ -41,4 +41,20 @@ public class PayOrderCompensationTask {
|
||||
log.error("[支付补偿定时任务] 执行异常: {}", e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 每10分钟修复一次已支付订单的设备有效期。
|
||||
* 用于兜底处理历史数据或极端情况下订单成功但设备有效期未落库的问题。
|
||||
*/
|
||||
@Scheduled(fixedDelay = 600000, initialDelay = 120000)
|
||||
public void repairDeviceDeadTime() {
|
||||
try {
|
||||
int count = payOrderBusinessService.repairPaidOrderDeviceDeadTime();
|
||||
if (count > 0) {
|
||||
log.warn("[支付有效期修复任务] 本次修复了 {} 台设备", count);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("[支付有效期修复任务] 执行异常: {}", e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user