From d40c1055a1701a7e5a6690d2c44230bd8b310ce7 Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Tue, 4 Nov 2025 11:58:26 +0800 Subject: [PATCH] =?UTF-8?q?transfer=20=E4=B8=8D=E8=83=BD=E8=BD=AC=E8=B4=A6?= =?UTF-8?q?=E7=BB=99=E8=87=AA=E5=B7=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/red/circle/wallet/inner/error/WalletErrorCode.java | 5 +++++ .../other/app/command/activity/LotteryTransferExe.java | 1 + .../wallet/app/command/bank/UserBankTransferGoldCmdExe.java | 1 + 3 files changed, 7 insertions(+) diff --git a/rc-service/rc-inner-api/wallet-inner/wallet-inner-model/src/main/java/com/red/circle/wallet/inner/error/WalletErrorCode.java b/rc-service/rc-inner-api/wallet-inner/wallet-inner-model/src/main/java/com/red/circle/wallet/inner/error/WalletErrorCode.java index 8eb632d0..18899f97 100644 --- a/rc-service/rc-inner-api/wallet-inner/wallet-inner-model/src/main/java/com/red/circle/wallet/inner/error/WalletErrorCode.java +++ b/rc-service/rc-inner-api/wallet-inner/wallet-inner-model/src/main/java/com/red/circle/wallet/inner/error/WalletErrorCode.java @@ -81,6 +81,11 @@ public enum WalletErrorCode implements IResponseErrorCode { * 目标用户不是充值代理 */ TARGET_USER_NOT_RECHARGE_AGENCY(5013, "The target user is not a recharge agency."), + + /** + * 不能转账给自己 + */ + NOT_TRANSFER_YOURSELF(5014, "You can't transfer money to yourself."), ; diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/LotteryTransferExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/LotteryTransferExe.java index 07949b12..8e0f28a3 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/LotteryTransferExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/LotteryTransferExe.java @@ -74,6 +74,7 @@ public class LotteryTransferExe { // 6. 判断接收用户是否是货运代理 boolean isFreight = freightBalanceClient.existsBalance(cmd.getAcceptUserId()).getBody(); ResponseAssert.isTrue(WalletErrorCode.TARGET_USER_NOT_RECHARGE_AGENCY, isFreight); + ResponseAssert.isTrue(WalletErrorCode.NOT_TRANSFER_YOURSELF, !Objects.equals(cmd.getAcceptUserId(), cmd.requiredReqUserId())); // 1. 获取可提现金额 LotteryWithdrawAmountCO withdrawAmount = lotteryWithdrawAmountQryExe.execute(userId, cmd.getActivityId());; diff --git a/rc-service/rc-service-wallet/wallet-application/src/main/java/com/red/circle/wallet/app/command/bank/UserBankTransferGoldCmdExe.java b/rc-service/rc-service-wallet/wallet-application/src/main/java/com/red/circle/wallet/app/command/bank/UserBankTransferGoldCmdExe.java index ddf8ceb9..5c5dfe6f 100644 --- a/rc-service/rc-service-wallet/wallet-application/src/main/java/com/red/circle/wallet/app/command/bank/UserBankTransferGoldCmdExe.java +++ b/rc-service/rc-service-wallet/wallet-application/src/main/java/com/red/circle/wallet/app/command/bank/UserBankTransferGoldCmdExe.java @@ -77,6 +77,7 @@ public class UserBankTransferGoldCmdExe { boolean freight = freightBalanceService.existsBalance(cmd.getAcceptUserId()); ResponseAssert.isTrue(WalletErrorCode.TARGET_USER_NOT_RECHARGE_AGENCY, freight); + ResponseAssert.isTrue(WalletErrorCode.NOT_TRANSFER_YOURSELF, !Objects.equals(cmd.getAcceptUserId(), cmd.requiredReqUserId())); // 上锁 String key = "UBWTransferGold:" + cmd.requiredReqUserId();