Revert "fix: allow transfers to regular users"

This reverts commit cbc9b0e2f20c4a648f40fbf8bd2062871f00ac74.
This commit is contained in:
ZuoZuo 2026-05-01 14:56:24 +08:00
parent cbc9b0e2f2
commit d9d67b8839
3 changed files with 18 additions and 27 deletions

View File

@ -88,8 +88,8 @@ public class UserBankTransferGoldCmdExe {
ArithmeticUtils.gtZero(cmd.getAmount())); ArithmeticUtils.gtZero(cmd.getAmount()));
boolean freight = freightBalanceService.existsBalance(cmd.getAcceptUserId()); boolean freight = freightBalanceService.existsBalance(cmd.getAcceptUserId());
ResponseAssert.isTrue(WalletErrorCode.NOT_TRANSFER_YOURSELF, ResponseAssert.isTrue(WalletErrorCode.TARGET_USER_NOT_RECHARGE_AGENCY, freight);
!Objects.equals(cmd.getAcceptUserId(), cmd.requiredReqUserId())); ResponseAssert.isTrue(WalletErrorCode.NOT_TRANSFER_YOURSELF, !Objects.equals(cmd.getAcceptUserId(), cmd.requiredReqUserId()));
// 上锁 // 上锁
String key = "UBWTransferGold:" + cmd.requiredReqUserId(); String key = "UBWTransferGold:" + cmd.requiredReqUserId();
@ -104,18 +104,13 @@ public class UserBankTransferGoldCmdExe {
// 获得区域兑换比例金币比例 // 获得区域兑换比例金币比例
Double goldRatio = getExchangeGoldRatio(cmd); Double goldRatio = getExchangeGoldRatio(cmd);
BigDecimal goldQuantity = BigDecimal.valueOf(goldRatio).multiply(cmd.getAmount()) BigDecimal goldQuantity = BigDecimal.valueOf(goldRatio).multiply(cmd.getAmount()).setScale(0, RoundingMode.DOWN);
.setScale(0, RoundingMode.DOWN);
if (freight) {
FreightBalance freightBalance = freightBalanceService.getFreightBalance(cmd.getAcceptUserId()); FreightBalance freightBalance = freightBalanceService.getFreightBalance(cmd.getAcceptUserId());
ResponseAssert.notNull(FreightErrorCode.NOT_FREIGHT, freightBalance); ResponseAssert.notNull(FreightErrorCode.NOT_FREIGHT, freightBalance);
long result = goldQuantity.divide(new BigDecimal(10000), RoundingMode.DOWN) long result = goldQuantity.divide(new BigDecimal(10000), RoundingMode.DOWN).setScale(0, RoundingMode.DOWN).longValue();
.setScale(0, RoundingMode.DOWN).longValue(); ResponseAssert.isTrue(FreightErrorCode.NOT_THRESHOLD, result >= Optional.ofNullable(freightBalance.getDeliveryThreshold()).orElse(0));
ResponseAssert.isTrue(FreightErrorCode.NOT_THRESHOLD,
result >= Optional.ofNullable(freightBalance.getDeliveryThreshold()).orElse(0));
}
// 扣钱 // 扣钱
BankBalanceDTO decrUserBankBalanceDTO = userBankBalanceService.decr(cmd.requiredReqUserId(), BankBalanceDTO decrUserBankBalanceDTO = userBankBalanceService.decr(cmd.requiredReqUserId(),
@ -123,7 +118,6 @@ public class UserBankTransferGoldCmdExe {
ResponseAssert.notNull(WalletErrorCode.INSUFFICIENT_BALANCE, decrUserBankBalanceDTO); ResponseAssert.notNull(WalletErrorCode.INSUFFICIENT_BALANCE, decrUserBankBalanceDTO);
Long bankRunWaterId = IdWorkerUtils.getId(); Long bankRunWaterId = IdWorkerUtils.getId();
cmd.setReqTraceId(String.valueOf(bankRunWaterId));
// 银行卡流水 // 银行卡流水
userBankRunningWaterService.add( userBankRunningWaterService.add(

View File

@ -45,10 +45,9 @@ public class UserBankSearchUserProfileQryExe {
} }
if (isTransfer(cmd)) { if (isTransfer(cmd)) {
if (Objects.equals(cmd.getReqUserId(), userProfile.getId())) { if (Objects.equals(cmd.getReqUserId(), userProfile.getId())) {
return null; return null;
} }
return userProfile;
} }
if (cmd.typeEqBD()) { if (cmd.typeEqBD()) {
@ -72,6 +71,9 @@ public class UserBankSearchUserProfileQryExe {
if (freightAgent) { if (freightAgent) {
return userProfile; return userProfile;
} }
if (isTransfer(cmd)) {
return null;
}
return Objects.equals( return Objects.equals(
ResponseAssert.requiredSuccess(agentTeamClient.existsTeamOwn(userProfile.getId())), ResponseAssert.requiredSuccess(agentTeamClient.existsTeamOwn(userProfile.getId())),

View File

@ -80,8 +80,8 @@ public class SalaryTransferGoldCmdExe {
ArithmeticUtils.gtZero(cmd.getAmount())); ArithmeticUtils.gtZero(cmd.getAmount()));
boolean freight = freightBalanceService.existsBalance(cmd.getAcceptUserId()); boolean freight = freightBalanceService.existsBalance(cmd.getAcceptUserId());
ResponseAssert.isTrue(WalletErrorCode.NOT_TRANSFER_YOURSELF, ResponseAssert.isTrue(WalletErrorCode.TARGET_USER_NOT_RECHARGE_AGENCY, freight);
!Objects.equals(cmd.getAcceptUserId(), cmd.requiredReqUserId())); ResponseAssert.isTrue(WalletErrorCode.NOT_TRANSFER_YOURSELF, !Objects.equals(cmd.getAcceptUserId(), cmd.requiredReqUserId()));
// 上锁 // 上锁
String key = "USTransferGold:" + cmd.requiredReqUserId(); String key = "USTransferGold:" + cmd.requiredReqUserId();
@ -96,18 +96,13 @@ public class SalaryTransferGoldCmdExe {
Double goldRatio = getExchangeGoldRatio(cmd); Double goldRatio = getExchangeGoldRatio(cmd);
Long bankRunWaterId = IdWorkerUtils.getId(); Long bankRunWaterId = IdWorkerUtils.getId();
BigDecimal goldQuantity = BigDecimal.valueOf(goldRatio).multiply(cmd.getAmount()) BigDecimal goldQuantity = BigDecimal.valueOf(goldRatio).multiply(cmd.getAmount()).setScale(0, RoundingMode.DOWN);
.setScale(0, RoundingMode.DOWN);
if (freight) { FreightBalance freightBalance = freightBalanceService.getFreightBalance(cmd.getAcceptUserId());
FreightBalance freightBalance = freightBalanceService.getFreightBalance(cmd.getAcceptUserId()); ResponseAssert.notNull(FreightErrorCode.NOT_FREIGHT, freightBalance);
ResponseAssert.notNull(FreightErrorCode.NOT_FREIGHT, freightBalance);
long result = goldQuantity.divide(new BigDecimal(10000), RoundingMode.DOWN) long result = goldQuantity.divide(new BigDecimal(10000), RoundingMode.DOWN).setScale(0, RoundingMode.DOWN).longValue();
.setScale(0, RoundingMode.DOWN).longValue(); ResponseAssert.isTrue(FreightErrorCode.NOT_THRESHOLD, result >= Optional.ofNullable(freightBalance.getDeliveryThreshold()).orElse(0));
ResponseAssert.isTrue(FreightErrorCode.NOT_THRESHOLD,
result >= Optional.ofNullable(freightBalance.getDeliveryThreshold()).orElse(0));
}
// 扣钱 // 扣钱
cmd.setReqTraceId(String.valueOf(bankRunWaterId)); cmd.setReqTraceId(String.valueOf(bankRunWaterId));