mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-07-12 01:58:00 +08:00
定时任务处理未分帐订单
This commit is contained in:
@@ -407,4 +407,9 @@ public class CacheConstants {
|
|||||||
|
|
||||||
public static final String DELAYED_PAYMENT_CONFIRM_QUEUE = "delayed_payment_confirm_queue:";
|
public static final String DELAYED_PAYMENT_CONFIRM_QUEUE = "delayed_payment_confirm_queue:";
|
||||||
public static final String FAILED_PAYMENT_CONFIRM_LIST = "failed_payment_confirm_list:";
|
public static final String FAILED_PAYMENT_CONFIRM_LIST = "failed_payment_confirm_list:";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 控制处理未分帐订单频率
|
||||||
|
*/
|
||||||
|
public static final String PROCESS_UNSPLIT_ORDERS = "processUnsplitOrders";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -351,12 +351,9 @@ public class JsowellTask {
|
|||||||
public void processUnSettledOrder() {
|
public void processUnSettledOrder() {
|
||||||
String startTime = "2023-01-01 00:00:00";
|
String startTime = "2023-01-01 00:00:00";
|
||||||
String endTime = "2023-12-31 23:59:59";
|
String endTime = "2023-12-31 23:59:59";
|
||||||
String adapayMemberId = "0";
|
|
||||||
String wechatAppId1 = "wxbb3e0d474569481d"; // 万车充
|
|
||||||
|
|
||||||
// 使用redis控制请求api
|
// 使用redis控制请求api
|
||||||
String key = "processUnsplitOrders";
|
Boolean setnx = redisCache.setnx(CacheConstants.PROCESS_UNSPLIT_ORDERS, Constants.ONE, 65);
|
||||||
Boolean setnx = redisCache.setnx(key, "1", 65);
|
|
||||||
if (!setnx) {
|
if (!setnx) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -373,7 +370,7 @@ public class JsowellTask {
|
|||||||
BigDecimal confirmAmt = orderUnsplitRecord.getSettleAmount();
|
BigDecimal confirmAmt = orderUnsplitRecord.getSettleAmount();
|
||||||
|
|
||||||
DivMember divMember = new DivMember();
|
DivMember divMember = new DivMember();
|
||||||
divMember.setMemberId(adapayMemberId);
|
divMember.setMemberId(Constants.ZERO); // 若是商户本身时,传入0
|
||||||
divMember.setAmount(AdapayUtil.formatAmount(confirmAmt));
|
divMember.setAmount(AdapayUtil.formatAmount(confirmAmt));
|
||||||
divMember.setFeeFlag(Constants.Y);
|
divMember.setFeeFlag(Constants.Y);
|
||||||
|
|
||||||
@@ -382,7 +379,7 @@ public class JsowellTask {
|
|||||||
.divMemberList(Lists.newArrayList(divMember))
|
.divMemberList(Lists.newArrayList(divMember))
|
||||||
.confirmAmt(confirmAmt)
|
.confirmAmt(confirmAmt)
|
||||||
.orderCode(orderCode)
|
.orderCode(orderCode)
|
||||||
.wechatAppId(wechatAppId1)
|
.wechatAppId(Constants.DEFAULT_APP_ID) // 默认使用万车充的appId
|
||||||
.build();
|
.build();
|
||||||
// 延时分账,使用确认交易API
|
// 延时分账,使用确认交易API
|
||||||
PaymentConfirmResponse paymentConfirmResponse = adapayService.createPaymentConfirmRequest(param);
|
PaymentConfirmResponse paymentConfirmResponse = adapayService.createPaymentConfirmRequest(param);
|
||||||
@@ -396,8 +393,8 @@ public class JsowellTask {
|
|||||||
} else {
|
} else {
|
||||||
// error_type:api_error, error_code:confirm_amt_over_limit, error_msg当前确认金额 > 支付金额 - 已支付确认金额 - 已支付撤销金额
|
// error_type:api_error, error_code:confirm_amt_over_limit, error_msg当前确认金额 > 支付金额 - 已支付确认金额 - 已支付撤销金额
|
||||||
if (paymentConfirmResponse.getError_code().equals("confirm_amt_over_limit")) {
|
if (paymentConfirmResponse.getError_code().equals("confirm_amt_over_limit")) {
|
||||||
// TODO 查询paymentId的总分账金额
|
// 查询paymentId的总分账金额
|
||||||
BigDecimal totalSplitAmount = BigDecimal.ZERO;
|
BigDecimal totalSplitAmount;
|
||||||
try {
|
try {
|
||||||
totalSplitAmount = adapayService.getTotalSplitAmountByPaymentId(paymentId);
|
totalSplitAmount = adapayService.getTotalSplitAmountByPaymentId(paymentId);
|
||||||
} catch (BaseAdaPayException e) {
|
} catch (BaseAdaPayException e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user