| | |
| | | /** |
| | | * 提现操作 |
| | | * @param money |
| | | * @param code |
| | | * @param name |
| | | * @param uid |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil withdrawal(Double money, String code, String name, Integer uid, Integer language) throws Exception { |
| | | public ResultUtil withdrawal(Double money, Integer uid, Integer language) throws Exception { |
| | | language = userInfoService.queryLanguage(uid, language); |
| | | if(money.compareTo(0D) <= 0){ |
| | | return ResultUtil.error(language == 1 ? "提现金额必须大于0" : language == 2 ? "Withdrawal amount must be greater than 0" : "Le montant du retrait doit être supérieur à 0"); |
| | |
| | | |
| | | Withdrawal withdrawal = new Withdrawal(); |
| | | withdrawal.setBalance(userInfo.getBalance()); |
| | | withdrawal.setCode(code); |
| | | withdrawal.setCode(userInfo.getPhone());// TODO: 2023/7/5 第三方支支持手机号提现 |
| | | withdrawal.setFlag(1); |
| | | withdrawal.setInsertTime(new Date()); |
| | | withdrawal.setMoney(money); |
| | | withdrawal.setName(name); |
| | | withdrawal.setName(userInfo.getPhoneOperator()); |
| | | withdrawal.setState(1); |
| | | withdrawal.setUserId(uid); |
| | | withdrawal.setUserType(1); |
| | | |
| | | PayoutResponse payoutResponse = tinggPayoutUtil.sendPayout("+233" + userInfo.getPhone(), withdrawal.getCode(), withdrawal.getMoney(), "", "用户提现"); |
| | | AuthStatus authStatus = payoutResponse.getAuthStatus(); |
| | | Results results = payoutResponse.getResults().get(0); |
| | | String statusCode = results.getStatusCode(); |
| | | if(!"131".equals(authStatus.getAuthStatusCode())){ |
| | | return ResultUtil.error(authStatus.getAuthStatusDescription()); |
| | | } |
| | | if(!"139".equals(statusCode)){ |
| | | return ResultUtil.error(results.getStatusDescription()); |
| | | } |
| | | withdrawal.setSerialNo(results.getBeepTransactionID()); |
| | | this.insert(withdrawal); |
| | | |
| | | double v = new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(money)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
| | |
| | | @Override |
| | | public List<Map<String, Object>> queryWithdrawal(Integer uid, Integer pageNum, Integer size, Integer language) throws Exception { |
| | | pageNum = (pageNum - 1) * size; |
| | | String name = language == 1 ? "银行卡提现" : language == 2 ? "Bank card withdrawal" : "Retrait par carte bancaire"; |
| | | String name = language == 1 ? "手机号:" : language == 2 ? "Phone number:" : "Numéro de portable:"; |
| | | List<Map<String, Object>> list = withdrawalMapper.queryWithdrawal(uid, 1, pageNum, size); |
| | | for (Map<String, Object> map : list) { |
| | | map.put("name", name); |
| | | map.put("name", name + map.get("code")); |
| | | } |
| | | return list; |
| | | } |