定时任务处理未分帐订单

This commit is contained in:
Guoqs
2025-04-16 16:19:19 +08:00
parent c1bfa2f4f3
commit ba92e1317b
2 changed files with 17 additions and 8741 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -9,6 +9,7 @@ import com.jsowell.adapay.service.AdapayService;
import com.jsowell.common.constant.CacheConstants; import com.jsowell.common.constant.CacheConstants;
import com.jsowell.common.constant.Constants; import com.jsowell.common.constant.Constants;
import com.jsowell.common.core.redis.RedisCache; import com.jsowell.common.core.redis.RedisCache;
import com.jsowell.common.enums.adapay.AdapayStatusEnum;
import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum; import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum;
import com.jsowell.common.util.AdapayUtil; import com.jsowell.common.util.AdapayUtil;
import com.jsowell.common.util.DateUtils; import com.jsowell.common.util.DateUtils;
@@ -380,14 +381,28 @@ public class JsowellTask {
// 如果确认交易成功,则更新订单状态为已分账 // 如果确认交易成功,则更新订单状态为已分账
if (paymentConfirmResponse.isSuccess()) { if (paymentConfirmResponse.isSuccess()) {
count++; count++;
orderUnsplitRecord.setStatus(paymentConfirmResponse.getStatus()); orderUnsplitRecord.setStatus(AdapayStatusEnum.SUCCEEDED.getValue());
orderUnsplitRecordService.updateOrderUnsplitRecord(orderUnsplitRecord); orderUnsplitRecordService.updateOrderUnsplitRecord(orderUnsplitRecord);
log.info("processUnsplitOrders, 分账成功, paymentId:{}", paymentId); log.info("processUnsplitOrders, 分账成功, paymentId:{}", paymentId);
} else { } else {
// 如果失败,打印日志 // 如果失败,打印日志
log.info("processUnsplitOrders, 分账失败, paymentId:{}, 错误信息:{}", paymentId, paymentConfirmResponse.getError_msg()); log.info("processUnsplitOrders, 分账失败, paymentId:{}, 错误信息:{}", paymentId, paymentConfirmResponse.getError_msg());
// error_type:api_error, error_code:confirm_amt_over_limit, error_msg当前确认金额 > 支付金额 - 已支付确认金额 - 已支付撤销金额
if (paymentConfirmResponse.getError_code().equals("confirm_amt_over_limit")) {
orderUnsplitRecord.setStatus(AdapayStatusEnum.SUCCEEDED.getValue());
orderUnsplitRecordService.updateOrderUnsplitRecord(orderUnsplitRecord);
}
// error_type:invalid_request_error, error_code:payment_over_time_doing, error_msg:数据正在处理中,请稍后再试
if (paymentConfirmResponse.getError_code().equals("payment_over_time_doing")) {
break; break;
} }
// error_type:invalid_request_error, error_code:refund_repeate_request, error_msg:请求过于频繁
if (paymentConfirmResponse.getError_code().equals("refund_repeate_request")) {
break;
}
}
} }
log.info("处理未分帐订单end, 当前时间:[{}], 成功分账[{}]条订单", DateUtils.getDateTime(), count); log.info("处理未分帐订单end, 当前时间:[{}], 成功分账[{}]条订单", DateUtils.getDateTime(), count);
} }