Source:
public BaseDto<PayDataDto> noPasswordPurchase(InvestDto investDto) { BaseDto<PayDataDto> baseDto = new BaseDto<>(); PayDataDto payDataDto = new PayDataDto(); baseDto.setData(payDataDto); String loginName = investDto.getLoginName(); AccountModel accountModel = accountMapper.findByLoginName(loginName); long transferInvestId = Long.parseLong(investDto.getTransferInvestId()); TransferApplicationModel transferApplicationModel = transferApplicationMapper.findByTransferInvestId(transferInvestId, TransferStatus.TRANSFERRING); if (transferApplicationModel == null || transferApplicationModel.getTransferAmount() > accountModel.getBalance()) { return baseDto; } InvestModel transferInvestModel = investMapper.findById(transferInvestId); InvestModel investModel = new InvestModel(idGenerator.generate(), transferInvestModel.getLoanId(), transferInvestId, transferInvestModel.getAmount(), loginName, investDto.getSource(), null); investMapper.create(investModel); ProjectTransferNopwdRequestModel requestModel = ProjectTransferNopwdRequestModel.newPurchaseNopwdRequest(String.valueOf(investModel.getLoanId()), String.valueOf(investModel.getId()), accountModel.getPayUserId(), String.valueOf(transferApplicationModel.getTransferAmount())); try { ProjectTransferNopwdResponseModel responseModel = paySyncClient.send( ProjectTransferNopwdMapper.class, requestModel, ProjectTransferNopwdResponseModel.class); if (responseModel.isSuccess()) { try { postPurchase(investModel.getId()); } catch (AmountTransferException e) { logger.error(e.getLocalizedMessage(), e); } } payDataDto.setStatus(responseModel.isSuccess()); payDataDto.setCode(responseModel.getRetCode()); payDataDto.setMessage(responseModel.getRetMsg()); } catch (PayException e) { investMapper.updateStatus(investModel.getId(), InvestStatus.FAIL); payDataDto.setStatus(false); payDataDto.setMessage(e.getLocalizedMessage()); logger.error(e.getLocalizedMessage(), e); } return baseDto; }

Target:
public BaseDto<PayDataDto> noPasswordPurchase(InvestDto investDto) { BaseDto<PayDataDto> baseDto = new BaseDto<>(); PayDataDto payDataDto = new PayDataDto(); baseDto.setData(payDataDto); String loginName = investDto.getLoginName(); AccountModel accountModel = accountMapper.lockByLoginName(loginName); long transferInvestId = Long.parseLong(investDto.getTransferInvestId()); TransferApplicationModel transferApplicationModel = transferApplicationMapper.findByTransferInvestId(transferInvestId, TransferStatus.TRANSFERRING); if (transferApplicationModel == null || transferApplicationModel.getTransferAmount() > accountModel.getBalance()) { return baseDto; } InvestModel transferInvestModel = investMapper.findById(transferInvestId); InvestModel investModel = new InvestModel(idGenerator.generate(), transferInvestModel.getLoanId(), transferInvestId, transferInvestModel.getAmount(), loginName, investDto.getSource(), null); investMapper.create(investModel); ProjectTransferNopwdRequestModel requestModel = ProjectTransferNopwdRequestModel.newPurchaseNopwdRequest(String.valueOf(investModel.getLoanId()), String.valueOf(investModel.getId()), accountModel.getPayUserId(), String.valueOf(transferApplicationModel.getTransferAmount())); try { ProjectTransferNopwdResponseModel responseModel = paySyncClient.send( ProjectTransferNopwdMapper.class, requestModel, ProjectTransferNopwdResponseModel.class); payDataDto.setStatus(responseModel.isSuccess()); payDataDto.setCode(responseModel.getRetCode()); payDataDto.setMessage(responseModel.getRetMsg()); } catch (PayException e) { investMapper.updateStatus(investModel.getId(), InvestStatus.FAIL); payDataDto.setStatus(false); payDataDto.setMessage(e.getLocalizedMessage()); logger.error(e.getLocalizedMessage(), e); } return baseDto; }