定时任务处理未分帐订单

This commit is contained in:
Guoqs
2025-04-17 10:03:33 +08:00
parent ba92e1317b
commit ed98a6bebe
4 changed files with 92 additions and 29 deletions

View File

@@ -67,6 +67,8 @@ public class AdapayService {
@Value("${adapay.callback}")
private String ADAPAY_CALLBACK_URL;
String wechatAppId1 = "wxbb3e0d474569481d"; // 万车充
@Autowired
private AdapayMemberAccountService adapayMemberAccountService;
@@ -1214,6 +1216,8 @@ public class AdapayService {
/**
* 查询支付确认对象列表
* paymentId 必传
* wechatAppId 必传
*/
public QueryPaymentConfirmDetailResponse queryPaymentConfirmList(QueryPaymentConfirmDTO dto) {
QueryPaymentConfirmDetailResponse response = null;
@@ -1439,4 +1443,60 @@ public class AdapayService {
settleAccountDTO.setAreaCode(dto.getAreaCode());
this.createSettleAccountRequest(settleAccountDTO, adapayMemberId, wechatAppId);
}
/**
* 查询支付撤销状态
* @param confirm
* @return
* @throws BaseAdaPayException
*/
public boolean queryConfirmReverseStatus(PaymentConfirmInfo confirm) throws BaseAdaPayException {
boolean result = false;
QueryConfirmReverseDTO dto = QueryConfirmReverseDTO.builder()
.paymentConfirmId(confirm.getId())
.wechatAppId(wechatAppId1)
.build();
ConfirmReverseResponse confirmReverseResponse = this.queryConfirmReverse(dto);
if (confirmReverseResponse.isSuccess()) {
result = true;
}
return result;
}
/**
* 根据paymentId查询总分账金额
* 万车充专用
* @param paymentId
* @return
* @throws BaseAdaPayException
*/
public BigDecimal getTotalSplitAmountByPaymentId(String paymentId) throws BaseAdaPayException {
BigDecimal totalSplitAmount = BigDecimal.ZERO;
// 查询支付确认id
QueryPaymentConfirmDTO dto = new QueryPaymentConfirmDTO();
dto.setPaymentId(paymentId);
dto.setWechatAppId(wechatAppId1);
// 查询分账信息
QueryPaymentConfirmDetailResponse response = this.queryPaymentConfirmList(dto);
if (response == null) {
return totalSplitAmount;
}
List<PaymentConfirmInfo> confirms = response.getPaymentConfirms();
if (CollectionUtils.isEmpty(confirms)) {
return totalSplitAmount;
}
for (PaymentConfirmInfo confirm : confirms) {
if (queryConfirmReverseStatus(confirm)) {
log.info("支付确认id:{}撤销了。。。", confirm.getId());
continue;
}
BigDecimal confirmedAmt = new BigDecimal(confirm.getConfirmedAmt()); // 已确认金额
// 汇总已确认金额
totalSplitAmount = totalSplitAmount.add(confirmedAmt);
}
return totalSplitAmount;
}
}