| | |
| | | } |
| | | |
| | | |
| | | @Transactional |
| | | public ServerResponse updateState(Integer withId, Integer state, String authMsg) throws Exception { |
| | | UserWithdraw userWithdraw = this.userWithdrawMapper.selectByPrimaryKey(withId); |
| | | SiteSetting siteSetting = siteSettingService.getSiteSetting(); |
| | |
| | | return ServerResponse.createByErrorMsg("用户资金账户不存在"); |
| | | } |
| | | if (state == 3) { |
| | | |
| | | userAssets.setAvailableBalance(userAssets.getAvailableBalance().add(userWithdraw.getWithAmt())); |
| | | userAssets.setFreezeMoney(userAssets.getFreezeMoney().subtract(userWithdraw.getWithAmt())); |
| | | if(userAssets.getAmountToBeCovered().compareTo(BigDecimal.ZERO) > 0){ |
| | | BigDecimal subtract = userWithdraw.getWithAmt().subtract(userAssets.getAmountToBeCovered()); |
| | | if(subtract.compareTo(BigDecimal.ZERO) > 0){ |
| | | userAssets.setAvailableBalance(userAssets.getAvailableBalance().add(subtract)); |
| | | userAssets.setFreezeMoney(userAssets.getFreezeMoney().subtract(subtract)); |
| | | userAssets.setAmountToBeCovered(BigDecimal.ZERO); |
| | | }else{ |
| | | userAssets.setAmountToBeCovered(userAssets.getAmountToBeCovered().subtract(userWithdraw.getWithAmt())); |
| | | } |
| | | }else{ |
| | | userAssets.setAvailableBalance(userAssets.getAvailableBalance().add(userWithdraw.getWithAmt())); |
| | | userAssets.setFreezeMoney(userAssets.getFreezeMoney().subtract(userWithdraw.getWithAmt())); |
| | | } |
| | | int updateCount = userAssetsMapper.updateById(userAssets); |
| | | if (updateCount > 0) { |
| | | log.info("提现失败,返还用户资金成功!"); |