From 39f6fca28e3f78abe48f08e474ec011abb990b36 Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期三, 09 九月 2026 10:39:21 +0800
Subject: [PATCH] update
---
backend/src/test/java/com/tourguide/modules/finance/service/GuideWithdrawalStateServiceTest.java | 38 ++++++++++++++++++++++++++++++++++++++
1 files changed, 38 insertions(+), 0 deletions(-)
diff --git a/backend/src/test/java/com/tourguide/modules/finance/service/GuideWithdrawalStateServiceTest.java b/backend/src/test/java/com/tourguide/modules/finance/service/GuideWithdrawalStateServiceTest.java
index 2ed7a8d..75200d4 100644
--- a/backend/src/test/java/com/tourguide/modules/finance/service/GuideWithdrawalStateServiceTest.java
+++ b/backend/src/test/java/com/tourguide/modules/finance/service/GuideWithdrawalStateServiceTest.java
@@ -52,6 +52,44 @@
}
@Test
+ void transferFailureShouldRemainDistinctFromPendingReview() {
+ GuideWithdrawal withdrawal = pendingWithdrawal();
+ withdrawal.setStatus("TRANSFERRING");
+ when(withdrawalMapper.selectForUpdate(20L)).thenReturn(withdrawal);
+ when(withdrawalMapper.updateById(withdrawal)).thenReturn(1);
+
+ service.markTransferFailed(20L, "主账户余额不足");
+
+ assertThat(withdrawal.getStatus()).isEqualTo("TRANSFER_FAILED");
+ assertThat(withdrawal.getPayoutMessage()).isEqualTo("主账户余额不足");
+ }
+
+ @Test
+ void failedTransferShouldAllowManualRetry() {
+ GuideWithdrawal withdrawal = pendingWithdrawal();
+ withdrawal.setStatus("TRANSFER_FAILED");
+ when(withdrawalMapper.selectForUpdate(20L)).thenReturn(withdrawal);
+ when(withdrawalMapper.updateById(withdrawal)).thenReturn(1);
+
+ service.prepareTransfer(20L, null, "admin");
+
+ assertThat(withdrawal.getStatus()).isEqualTo("TRANSFERRING");
+ assertThat(withdrawal.getTransferReqSeqId()).startsWith("TF");
+ }
+
+ @Test
+ void rejectShouldRefundReservedTeamBalance() {
+ GuideWithdrawal withdrawal = pendingWithdrawal();
+ withdrawal.setTeamId(6L);
+ when(withdrawalMapper.selectForUpdate(20L)).thenReturn(withdrawal);
+ when(withdrawalMapper.updateById(withdrawal)).thenReturn(1);
+
+ service.reject(20L, "资料不完整", "admin");
+
+ verify(balanceService).creditTeam(6L, new BigDecimal("200.00"));
+ }
+
+ @Test
void cashFailureShouldClearPersistedRequestIdentity() {
GuideWithdrawal withdrawal = pendingWithdrawal();
withdrawal.setStatus("PROCESSING");
--
Gitblit v1.7.1