| | |
| | | @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(); |
| | |
| | | public Boolean availablebalanceChange(String accetType, Integer userId, EUserAssets eUserAssets, BigDecimal amount, String desc, String descType) { |
| | | |
| | | UserAssets userAssets = assetsByTypeAndUserId(accetType,userId); |
| | | 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())); |
| | | String type = eUserAssets.getDesc(); |
| | | String before = userAssets.getAvailableBalance().toString(); |
| | | String accectType = userAssets.getAccectType(); |
| | |
| | | extracted(userAssets); |
| | | } |
| | | |
| | | if(null != userPosition){ |
| | | userPosition.setAmountToBeCovered(userAssets.getAmountToBeCovered().add(userAssets.getHandlingChargeWritten())); |
| | | userPositionMapper.updateById(userPosition); |
| | | } |
| | | // if(null != userPosition){ |
| | | // userPosition.setAmountToBeCovered(userAssets.getAmountToBeCovered().add(userAssets.getHandlingChargeWritten())); |
| | | // userPositionMapper.updateById(userPosition); |
| | | // } |
| | | String after = userAssets.getAvailableBalance().toString(); |
| | | MoneyLog moneyLog = new MoneyLog(); |
| | | moneyLog.setDescs(eUserAssets.getDesc()); |
| | |
| | | public Boolean availablebalanceSell(String accetType, Integer userId, EUserAssets eUserAssets, BigDecimal amount, BigDecimal fzAmount) { |
| | | |
| | | UserAssets userAssets = assetsByTypeAndUserId(accetType,userId); |
| | | 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())); |
| | | String before = userAssets.getAvailableBalance().toString(); |
| | | String accectType = userAssets.getAccectType(); |
| | | if(Objects.equals(eUserAssets.getCode(), EUserAssets.CLOSE_POSITION_RETURN_SECURITY_DEPOSIT.getCode())){ |
| | |
| | | } |
| | | } |
| | | |
| | | if(null != userPosition){ |
| | | userPosition.setAmountToBeCovered(userAssets.getAmountToBeCovered().add(userAssets.getHandlingChargeWritten())); |
| | | userPositionMapper.updateById(userPosition); |
| | | } |
| | | // if(null != userPosition){ |
| | | // userPosition.setAmountToBeCovered(userAssets.getAmountToBeCovered().add(userAssets.getHandlingChargeWritten())); |
| | | // userPositionMapper.updateById(userPosition); |
| | | // } |
| | | String after = userAssets.getAvailableBalance().toString(); |
| | | MoneyLog moneyLog = new MoneyLog(); |
| | | moneyLog.setDescs(eUserAssets.getDesc()); |