| | |
| | | @Override |
| | | public ServerResponse updateUserAssets(Integer id, String amt,String type) { |
| | | UserAssets userAssets = userAssetsMapper.selectById(id); |
| | | UserPosition userPosition = userPositionMapper.selectOne(new LambdaQueryWrapper<UserPosition>().gt(UserPosition::getAmountToBeCovered, BigDecimal.ZERO).eq(UserPosition::getUserId,userAssets.getUserId())); |
| | | //UserPosition userPosition = userPositionMapper.selectOne(new LambdaQueryWrapper<UserPosition>().gt(UserPosition::getAmountToBeCovered, BigDecimal.ZERO).eq(UserPosition::getUserId,userAssets.getUserId())); |
| | | // 0 入款 1是扣钱 2 是充值 3 是提币 |
| | | BigDecimal bigAmt = new BigDecimal(amt); |
| | | if(type.equals("0") || type.equals("1")){ |
| | |
| | | }else{ |
| | | userAssets.setAvailableBalance(userAssets.getAvailableBalance().add(bigAmt)); |
| | | } |
| | | if(null != userPosition){ |
| | | /*if(null != userPosition){ |
| | | userPosition.setAmountToBeCovered(userAssets.getAmountToBeCovered().add(userAssets.getHandlingChargeWritten())); |
| | | userPositionMapper.updateById(userPosition); |
| | | } |
| | | }*/ |
| | | }else{ |
| | | if(userAssets.getAvailableBalance().compareTo(BigDecimal.ZERO) <= 0){ |
| | | return ServerResponse.createByErrorMsg("客户账户余额为0"); |
| | |
| | | } |
| | | userAssets.setAvailableBalance(userAssets.getAvailableBalance().add(bigAmt)); |
| | | } |
| | | if(null != userPosition){ |
| | | /*if(null != userPosition){ |
| | | userPositionMapper.updateById(userPosition); |
| | | } |
| | | }*/ |
| | | if( userAssetsMapper.updateById(userAssets)>0){ |
| | | // saveUserRecharge(userAssets.getUserId(),bigAmt); |
| | | return ServerResponse.createBySuccess(); |