优化这段代码 // 判断该用户是否是自研用户 if (!OverseaUtils.isOversea(clientId)) { throw new BusinessException(180000, "非自研用户,无法使用基金提取至银行卡"); } // 判断币种信息 if ("0".equals(request.getCurrency())) { throw new BusinessException(180001, "人民币无法使用该功能"); } DepositBalanceResponse depositBalanceResponse = new DepositBalanceResponse(); WithdrawalsFundReq withdrawalsFundReq = new WithdrawalsFundReq(); InComeReq inComeReq = new InComeReq(); inComeReq.setIncomeCurrency(request.getCurrency()); List<OwnBankCardVo> allOwnBankCards = bankCardManagerAppService.getAllOwnBankCards(clientId, null, RequestUtil.getClientIp(), inComeReq); if (allOwnBankCards.size() > 0) { boolean verifyBankWithdrawFunds = verifyBankWithdrawFundsRepository.verifyBankWithdrawFunds(clientId, allOwnBankCards.get(0).getNumber(), deviceId); if (!verifyBankWithdrawFunds) { throw new BusinessException(180021, "根据监管要求,请使用单笔入金达到10000港币(或等值其他货币)的银行卡进行出金操作"); } if (allOwnBankCards.get(0).isBoundTrans() && allOwnBankCards.get(0).getOutcomeStatus().contains(request.getCurrency())) { withdrawalsFundReq.withdrawalMode = "4"; depositBalanceResponse.setManner("0"); } else { withdrawalsFundReq.withdrawalMode = "6"; depositBalanceResponse.setManner("1"); } } else { throw new BusinessException(180003, "请输入正确的eid"); } withdrawalsFundReq.bankEid = request.getEid(); withdrawalsFundReq.balance = request.getBalance(); withdrawalsFundReq.stockCode = request.getStockCode(); withdrawalsFundReq.clientId = clientId; BaseResponse<WithdrawalsFundDTO> withdrawalsFundDTOBaseResponse = tradeFundHandler.withdrawalsFund(withdrawalsFundReq); if (withdrawalsFundDTOBaseResponse != null) { if (withdrawalsFundDTOBaseResponse.getStatus() == 0 && withdrawalsFundDTOBaseResponse.getData() != null) { SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); depositBalanceResponse.setClientId(clientId); depositBalanceResponse.setCommitTime(simpleDateFormat.format(new Date())); depositBalanceResponse.setEid(withdrawalsFundDTOBaseResponse.getData().eid); } if (withdrawalsFundDTOBaseResponse.getStatus() != 0) { if (-2302004 == withdrawalsFundDTOBaseResponse.getStatus()) { throw new BusinessException(OutComeEnum.BANKING_SECURITIES_BUSINESS_IS_NOT_ALLOWED.getId(), OutComeEnum.BANKING_SECURITIES_BUSINESS_IS_NOT_ALLOWED.getName()); } throw new BusinessException(withdrawalsFundDTOBaseResponse.getStatus(), withdrawalsFundDTOBaseResponse.getMessage(), false); } } return depositBalanceResponse;
时间: 2023-02-16 10:46:48 浏览: 165
C语言版本MQTT协议,连接阿里云物联网平台客户端代码
这段代码是用来判断用户是否可以从基金转到银行卡的。
首先,它会判断用户是否是自研用户,如果不是,就会抛出一个业务异常,提示用户“非自研用户,无法使用基金提取至银行卡”。
然后,它会判断币种信息是否为人民币,如果是,也会抛出一个业务异常,提示用户“人民币无法使用该功能”。
接下来,它会获取用户所有的银行卡信息,并判断第一张银行卡是否满足出金要求,如果不满足,也会抛出一个业务异常,提示用户“根据监管要求,请使用单笔入金达到10000港币(或等值其他货币)的银行卡进行出金操作”。
最后,它会判断第一张银行卡是否已经绑定了交易账户,如果已经绑定,就会获取该交易账户的出金限制信息,否则,就会直接返回一个空的出金限制信息。
阅读全文