transfer 只允许转给金币代理
This commit is contained in:
parent
3343943965
commit
ef0be488c3
@ -75,9 +75,12 @@ public enum WalletErrorCode implements IResponseErrorCode {
|
|||||||
/**
|
/**
|
||||||
* 支付密码不符合规则.
|
* 支付密码不符合规则.
|
||||||
*/
|
*/
|
||||||
PAY_PASSWORD_NOT_COMPLY_WITH_RULES(5012, "Password does not comply with rules")
|
PAY_PASSWORD_NOT_COMPLY_WITH_RULES(5012, "Password does not comply with rules"),
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 目标用户不是充值代理
|
||||||
|
*/
|
||||||
|
TARGET_USER_NOT_RECHARGE_AGENCY(5013, "The target user is not a recharge agency."),
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -71,6 +71,10 @@ public class LotteryTransferExe {
|
|||||||
try {
|
try {
|
||||||
Long userId = cmd.requiredReqUserId();
|
Long userId = cmd.requiredReqUserId();
|
||||||
|
|
||||||
|
// 6. 判断接收用户是否是货运代理
|
||||||
|
boolean isFreight = freightBalanceClient.existsBalance(cmd.getAcceptUserId()).getBody();
|
||||||
|
ResponseAssert.isTrue(WalletErrorCode.TARGET_USER_NOT_RECHARGE_AGENCY, isFreight);
|
||||||
|
|
||||||
// 1. 获取可提现金额
|
// 1. 获取可提现金额
|
||||||
LotteryWithdrawAmountCO withdrawAmount = lotteryWithdrawAmountQryExe.execute(userId, cmd.getActivityId());;
|
LotteryWithdrawAmountCO withdrawAmount = lotteryWithdrawAmountQryExe.execute(userId, cmd.getActivityId());;
|
||||||
BigDecimal availableAmount = withdrawAmount.getAvailableAmount();
|
BigDecimal availableAmount = withdrawAmount.getAvailableAmount();
|
||||||
@ -102,9 +106,6 @@ public class LotteryTransferExe {
|
|||||||
|
|
||||||
Long withdrawId = withdraw.getId();
|
Long withdrawId = withdraw.getId();
|
||||||
|
|
||||||
// 6. 判断接收用户是否是货运代理
|
|
||||||
boolean isFreight = freightBalanceClient.existsBalance(cmd.getAcceptUserId()).getBody();
|
|
||||||
|
|
||||||
// 7. 发送金币给接收用户
|
// 7. 发送金币给接收用户
|
||||||
sendGold(cmd, isFreight, goldQuantity, withdrawId, "抽奖活动转账金币");
|
sendGold(cmd, isFreight, goldQuantity, withdrawId, "抽奖活动转账金币");
|
||||||
|
|
||||||
|
|||||||
@ -151,19 +151,6 @@ public class BankRestController extends BaseController {
|
|||||||
return userBankService.transferGold(cmd);
|
return userBankService.transferGold(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 活动转账到金币.
|
|
||||||
*
|
|
||||||
* @eo.name 转账到金币.
|
|
||||||
* @eo.url /transferGold
|
|
||||||
* @eo.method post
|
|
||||||
* @eo.request-type json
|
|
||||||
*/
|
|
||||||
@PostMapping("/activity/transferGold")
|
|
||||||
public UserBankWithdrawResultCO activityTransferGold(@RequestBody @Validated UserBankWithdrawTransferCmd cmd) {
|
|
||||||
return userBankService.transferGold(cmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 钻石转账.
|
* 钻石转账.
|
||||||
*
|
*
|
||||||
|
|||||||
@ -75,6 +75,9 @@ public class UserBankTransferGoldCmdExe {
|
|||||||
ResponseAssert.isTrue(ResponseErrorCode.REQUEST_PARAMETER_ERROR,
|
ResponseAssert.isTrue(ResponseErrorCode.REQUEST_PARAMETER_ERROR,
|
||||||
ArithmeticUtils.gtZero(cmd.getAmount()));
|
ArithmeticUtils.gtZero(cmd.getAmount()));
|
||||||
|
|
||||||
|
boolean freight = freightBalanceService.existsBalance(cmd.getAcceptUserId());
|
||||||
|
ResponseAssert.isTrue(WalletErrorCode.TARGET_USER_NOT_RECHARGE_AGENCY, freight);
|
||||||
|
|
||||||
// 上锁
|
// 上锁
|
||||||
String key = "UBWTransferGold:" + cmd.requiredReqUserId();
|
String key = "UBWTransferGold:" + cmd.requiredReqUserId();
|
||||||
ResponseAssert.isTrue(CommonErrorCode.REQUEST_LIMITING, redisService.lock(key, 60));
|
ResponseAssert.isTrue(CommonErrorCode.REQUEST_LIMITING, redisService.lock(key, 60));
|
||||||
@ -114,8 +117,6 @@ public class UserBankTransferGoldCmdExe {
|
|||||||
.setCreateUserOrigin(OpUserType.APP.getType())
|
.setCreateUserOrigin(OpUserType.APP.getType())
|
||||||
);
|
);
|
||||||
|
|
||||||
boolean freight = freightBalanceService.existsBalance(cmd.getAcceptUserId());
|
|
||||||
|
|
||||||
BigDecimal goldQuantity = BigDecimal.valueOf(goldRatio).multiply(cmd.getAmount()).setScale(0, RoundingMode.DOWN);
|
BigDecimal goldQuantity = BigDecimal.valueOf(goldRatio).multiply(cmd.getAmount()).setScale(0, RoundingMode.DOWN);
|
||||||
// 发送金额
|
// 发送金额
|
||||||
sendGold(cmd, freight, goldQuantity, bankRunWaterId, "转账金币");
|
sendGold(cmd, freight, goldQuantity, bankRunWaterId, "转账金币");
|
||||||
|
|||||||
@ -52,8 +52,6 @@ public class UserBankWithdrawTransferCmdExe {
|
|||||||
ResponseAssert.isTrue(ResponseErrorCode.REQUEST_PARAMETER_ERROR,
|
ResponseAssert.isTrue(ResponseErrorCode.REQUEST_PARAMETER_ERROR,
|
||||||
ArithmeticUtils.gtZero(cmd.getAmount()));
|
ArithmeticUtils.gtZero(cmd.getAmount()));
|
||||||
|
|
||||||
checkPayPassword(cmd);
|
|
||||||
|
|
||||||
// 上锁
|
// 上锁
|
||||||
String key = "UBWTransfer:" + cmd.requiredReqUserId();
|
String key = "UBWTransfer:" + cmd.requiredReqUserId();
|
||||||
ResponseAssert.isTrue(CommonErrorCode.REQUEST_LIMITING, redisService.lock(key, 60));
|
ResponseAssert.isTrue(CommonErrorCode.REQUEST_LIMITING, redisService.lock(key, 60));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user