| | |
| | | @Transactional |
| | | public void manualReceipt(Integer auto ,String id, BigDecimal amount,String operator_username) { |
| | | // Date now = new Date(); |
| | | RechargeBlockchainOrder recharge = getById(id); |
| | | if (recharge == null) { |
| | | throw new YamiShopBindException("参数错误!"); |
| | | } |
| | | User party = userService.getById(recharge.getPartyId()); |
| | | if (party == null) { |
| | | throw new YamiShopBindException("用户不存在!"); |
| | | } |
| | | try { |
| | | RechargeBlockchainOrder recharge = getById(id); |
| | | if (recharge == null) { |
| | | recharge = findByOrderNo(id); |
| | | if (recharge == null) { |
| | | throw new YamiShopBindException("参数错误!"); |
| | | } |
| | | } |
| | | User party = userService.getById(recharge.getPartyId()); |
| | | if (party == null) { |
| | | throw new YamiShopBindException("用户不存在!"); |
| | | } |
| | | |
| | | if (recharge.getSucceeded() == 1) { |
| | | throw new YamiShopBindException("已操作过了!"); |
| | | } |
| | | recharge.setReviewTime(new Date()); |
| | | recharge.setSucceeded(1); |
| | | WalletLog walletLog = walletLogService.find(Constants.MONEYLOG_CATEGORY_RECHARGE, recharge.getOrderNo()); |
| | | if (amount.doubleValue() != recharge.getVolume()) { |
| | | Log log = new Log(); |
| | | log.setCategory(Constants.LOG_CATEGORY_OPERATION); |
| | | log.setExtra(recharge.getOrderNo()); |
| | | log.setOperator(operator_username); |
| | | log.setUsername(party.getUserName()); |
| | | log.setUserId(recharge.getPartyId()); |
| | | log.setCreateTime(new Date()); |
| | | log.setLog("管理员修改充值数量,原充值数量[" |
| | | + recharge.getVolume() + "],修改后充值数量[" + amount.doubleValue() + "]。订单号[" + recharge.getOrderNo()+ "]。"); |
| | | if (recharge.getSucceeded() == 1) { |
| | | throw new YamiShopBindException("已操作过了!"); |
| | | } |
| | | recharge.setReviewTime(new Date()); |
| | | recharge.setSucceeded(1); |
| | | WalletLog walletLog = walletLogService.find(Constants.MONEYLOG_CATEGORY_RECHARGE, recharge.getOrderNo()); |
| | | if (amount.doubleValue() != recharge.getVolume()) { |
| | | Log log = new Log(); |
| | | log.setCategory(Constants.LOG_CATEGORY_OPERATION); |
| | | log.setExtra(recharge.getOrderNo()); |
| | | log.setOperator(operator_username); |
| | | log.setUsername(party.getUserName()); |
| | | log.setUserId(recharge.getPartyId()); |
| | | log.setCreateTime(new Date()); |
| | | log.setLog("管理员修改充值数量,原充值数量[" |
| | | + recharge.getVolume() + "],修改后充值数量[" + amount.doubleValue() + "]。订单号[" + recharge.getOrderNo()+ "]。"); |
| | | |
| | | logService.save(log); |
| | | walletLog.setAmount(amount.doubleValue()); |
| | | recharge.setVolume(amount.doubleValue()); |
| | | } |
| | | logService.save(log); |
| | | walletLog.setAmount(amount.doubleValue()); |
| | | recharge.setVolume(amount.doubleValue()); |
| | | } |
| | | |
| | | /** |
| | | * 如果是usdt则加入wallet,否则寻找walletExtend里相同币种 |
| | | */ |
| | | /** |
| | | * 如果是usdt则加入wallet,否则寻找walletExtend里相同币种 |
| | | */ |
| | | |
| | | |
| | | Syspara user_recom_bonus_open = sysparaService.find("user_recom_bonus_open"); |
| | | Syspara user_recom_bonus_open = sysparaService.find("user_recom_bonus_open"); |
| | | |
| | | if ("usdt".equals(recharge.getSymbol())) { |
| | | double amount1 = recharge.getVolume(); |
| | | if ("usdt".equals(recharge.getSymbol())) { |
| | | double amount1 = recharge.getVolume(); |
| | | |
| | | // Wallet wallet = new Wallet(); |
| | | // wallet = walletService.saveWalletByPartyId(recharge.getPartyId()); |
| | |
| | | // |
| | | // walletService.update(wallet.getUserId(), amount1); |
| | | |
| | | CapitaltWallet capitaltWallet = capitaltWalletService.getOne(new LambdaQueryWrapper<>(CapitaltWallet.class) |
| | | .eq(CapitaltWallet::getUserId, recharge.getPartyId()).last(" limit 1 ")); |
| | | double amount_before = capitaltWallet.getMoney().doubleValue(); |
| | | capitaltWalletService.update(capitaltWallet,amount1); |
| | | CapitaltWallet capitaltWallet = capitaltWalletService.getOne(new LambdaQueryWrapper<>(CapitaltWallet.class) |
| | | .eq(CapitaltWallet::getUserId, recharge.getPartyId()).last(" limit 1 ")); |
| | | double amount_before = capitaltWallet.getMoney().doubleValue(); |
| | | capitaltWalletService.update(capitaltWallet,amount1); |
| | | |
| | | // 保存资金日志 |
| | | MoneyLog moneyLog = new MoneyLog(); |
| | | moneyLog.setCategory(Constants.MONEYLOG_CATEGORY_COIN); |
| | | moneyLog.setAmountBefore(new BigDecimal(amount_before)); |
| | | moneyLog.setAmount(new BigDecimal(amount1)); |
| | | moneyLog.setAmountAfter(BigDecimal.valueOf(Arith.add(amount_before, amount1))); |
| | | moneyLog.setLog("充值订单[" + recharge.getOrderNo() + "]"); |
| | | moneyLog.setUserId(recharge.getPartyId()); |
| | | moneyLog.setWalletType(Constants.WALLET); |
| | | moneyLog.setContentType(Constants.MONEYLOG_CONTENT_RECHARGE); |
| | | moneyLog.setCreateTime(new Date()); |
| | | moneyLogService.save(moneyLog); |
| | | // 保存资金日志 |
| | | MoneyLog moneyLog = new MoneyLog(); |
| | | moneyLog.setCategory(Constants.MONEYLOG_CATEGORY_COIN); |
| | | moneyLog.setAmountBefore(new BigDecimal(amount_before)); |
| | | moneyLog.setAmount(new BigDecimal(amount1)); |
| | | moneyLog.setAmountAfter(BigDecimal.valueOf(Arith.add(amount_before, amount1))); |
| | | moneyLog.setLog("充值订单[" + recharge.getOrderNo() + "]"); |
| | | moneyLog.setUserId(recharge.getPartyId()); |
| | | moneyLog.setWalletType(Constants.WALLET); |
| | | moneyLog.setContentType(Constants.MONEYLOG_CONTENT_RECHARGE); |
| | | moneyLog.setCreateTime(new Date()); |
| | | moneyLogService.save(moneyLog); |
| | | |
| | | walletLog.setStatus(recharge.getSucceeded()); |
| | | walletLogService.updateById(walletLog); |
| | | walletLog.setStatus(recharge.getSucceeded()); |
| | | walletLogService.updateById(walletLog); |
| | | |
| | | updateById(recharge); |
| | | /** |
| | | * 给他的代理添加充值记录 |
| | | */ |
| | | userDataService.saveRechargeHandle(recharge.getPartyId(), recharge.getVolume(), recharge.getSymbol()); |
| | | updateById(recharge); |
| | | /** |
| | | * 给他的代理添加充值记录 |
| | | */ |
| | | userDataService.saveRechargeHandle(recharge.getPartyId(), recharge.getVolume(), recharge.getSymbol()); |
| | | |
| | | /** |
| | | * 若已开启充值奖励 ,则充值到账后给他的代理用户添加奖金 |
| | | */ |
| | | if ("true".equals(user_recom_bonus_open.getSvalue())) { |
| | | List<RechargeBlockchainOrder> orders =findByPartyIdAndToday(recharge.getPartyId()); |
| | | rechargeBonusService.saveBounsHandle(recharge, 1,orders); |
| | | } |
| | | |
| | | // 充值到账后给他增加提现流水限制金额 充值到账后,当前流水大于提现限制流水时是否重置提现限制流水并将Party表里的当前流水设置清零, |
| | | // 1不重置,2重置 |
| | | String recharge_sucess_reset_withdraw = this.sysparaService.find("recharge_sucess_reset_withdraw").getSvalue(); |
| | | if ("1".equals(recharge_sucess_reset_withdraw)) { |
| | | if (party.getWithdrawLimitAmount()==null){ |
| | | party.setWithdrawLimitAmount(new BigDecimal(0)); |
| | | /** |
| | | * 若已开启充值奖励 ,则充值到账后给他的代理用户添加奖金 |
| | | */ |
| | | if ("true".equals(user_recom_bonus_open.getSvalue())) { |
| | | List<RechargeBlockchainOrder> orders =findByPartyIdAndToday(recharge.getPartyId()); |
| | | rechargeBonusService.saveBounsHandle(recharge, 1,orders); |
| | | } |
| | | if (party.getWithdrawLimitNowAmount()==null){ |
| | | party.setWithdrawLimitNowAmount(new BigDecimal(0)); |
| | | } |
| | | party.setWithdrawLimitAmount(new BigDecimal(Arith.add(party.getWithdrawLimitAmount().doubleValue(), amount.doubleValue()))); |
| | | if (party.getWithdrawLimitNowAmount().doubleValue() > party.getWithdrawLimitAmount().doubleValue()) { |
| | | party.setWithdrawLimitNowAmount(new BigDecimal(0)); |
| | | } |
| | | } |
| | | if ("2".equals(recharge_sucess_reset_withdraw)) { |
| | | double withdraw_limit_turnover_percent = Double |
| | | .valueOf(sysparaService.find("withdraw_limit_turnover_percent").getSvalue()); |
| | | double party_withdraw = Arith.mul(party.getWithdrawLimitAmount().doubleValue(), withdraw_limit_turnover_percent); |
| | | |
| | | if (party.getWithdrawLimitNowAmount().doubleValue() >= party_withdraw) { |
| | | party.setWithdrawLimitAmount(amount); |
| | | party.setWithdrawLimitNowAmount(new BigDecimal(0)); |
| | | } else { |
| | | // 充值到账后给他增加提现流水限制金额 充值到账后,当前流水大于提现限制流水时是否重置提现限制流水并将Party表里的当前流水设置清零, |
| | | // 1不重置,2重置 |
| | | String recharge_sucess_reset_withdraw = this.sysparaService.find("recharge_sucess_reset_withdraw").getSvalue(); |
| | | if ("1".equals(recharge_sucess_reset_withdraw)) { |
| | | if (party.getWithdrawLimitAmount()==null){ |
| | | party.setWithdrawLimitAmount(new BigDecimal(0)); |
| | | } |
| | | if (party.getWithdrawLimitNowAmount()==null){ |
| | | party.setWithdrawLimitNowAmount(new BigDecimal(0)); |
| | | } |
| | | party.setWithdrawLimitAmount(new BigDecimal(Arith.add(party.getWithdrawLimitAmount().doubleValue(), amount.doubleValue()))); |
| | | if (party.getWithdrawLimitNowAmount().doubleValue() > party.getWithdrawLimitAmount().doubleValue()) { |
| | | party.setWithdrawLimitNowAmount(new BigDecimal(0)); |
| | | } |
| | | } |
| | | } |
| | | userService.updateById(party); |
| | | if ("2".equals(recharge_sucess_reset_withdraw)) { |
| | | double withdraw_limit_turnover_percent = Double |
| | | .valueOf(sysparaService.find("withdraw_limit_turnover_percent").getSvalue()); |
| | | double party_withdraw = Arith.mul(party.getWithdrawLimitAmount().doubleValue(), withdraw_limit_turnover_percent); |
| | | |
| | | } else { |
| | | List<Realtime> realtime_list =this.dataService.realtime(recharge.getSymbol()); |
| | | log.error("手动到账realtime_list::"+realtime_list); |
| | | Realtime realtime = null; |
| | | if (realtime_list.size() > 0) { |
| | | realtime = realtime_list.get(0); |
| | | if (party.getWithdrawLimitNowAmount().doubleValue() >= party_withdraw) { |
| | | party.setWithdrawLimitAmount(amount); |
| | | party.setWithdrawLimitNowAmount(new BigDecimal(0)); |
| | | } else { |
| | | party.setWithdrawLimitAmount(new BigDecimal(Arith.add(party.getWithdrawLimitAmount().doubleValue(), amount.doubleValue()))); |
| | | } |
| | | } |
| | | userService.updateById(party); |
| | | |
| | | } else { |
| | | throw new YamiShopBindException("系统错误,请稍后重试"); |
| | | } |
| | | // 对应usdt价格 |
| | | double transfer_usdt = realtime.getClose().doubleValue(); |
| | | // List<Realtime> realtime_list =this.dataService.realtime(recharge.getSymbol()); |
| | | // log.error("手动到账realtime_list::"+realtime_list); |
| | | // Realtime realtime = null; |
| | | // if (realtime_list.size() > 0) { |
| | | // realtime = realtime_list.get(0); |
| | | // } else { |
| | | // throw new YamiShopBindException("系统错误,请稍后重试"); |
| | | // } |
| | | // 对应usdt价格 |
| | | // double transfer_usdt = realtime.getClose().doubleValue(); |
| | | |
| | | WalletExtend walletExtend = new WalletExtend(); |
| | | walletExtend = walletService.saveExtendByPara(recharge.getPartyId(), recharge.getSymbol()); |
| | | WalletExtend walletExtend = new WalletExtend(); |
| | | walletExtend = walletService.saveExtendByPara(recharge.getPartyId(), recharge.getSymbol()); |
| | | |
| | | double volume = recharge.getVolume(); |
| | | double volume = recharge.getVolume(); |
| | | |
| | | double amount_before = walletExtend.getAmount(); |
| | | double amount_before = walletExtend.getAmount(); |
| | | |
| | | // walletExtend = walletService.saveWalletExtendByParaAndUpdate(String.valueOf(recharge.getPartyId()), recharge.getSymbol(), volume); |
| | | walletService.updateExtend(walletExtend.getPartyId().toString(), walletExtend.getWallettype(), volume); |
| | | updateById(recharge); |
| | | // walletExtend = walletService.saveWalletExtendByParaAndUpdate(String.valueOf(recharge.getPartyId()), recharge.getSymbol(), volume); |
| | | walletService.updateExtend(walletExtend.getPartyId().toString(), walletExtend.getWallettype(), volume); |
| | | updateById(recharge); |
| | | |
| | | // 币种usdt价格= 币种价格×充值数量 |
| | | double usdt_amount = Arith.mul(volume, transfer_usdt); |
| | | // 币种usdt价格= 币种价格×充值数量 |
| | | // double usdt_amount = Arith.mul(volume, transfer_usdt); |
| | | |
| | | // 保存资金日志 |
| | | MoneyLog moneyLog = new MoneyLog(); |
| | | moneyLog.setCategory(Constants.MONEYLOG_CATEGORY_COIN); |
| | | moneyLog.setAmountBefore(new BigDecimal(amount_before)); |
| | | moneyLog.setAmount(new BigDecimal(volume)); |
| | | moneyLog.setAmountAfter(new BigDecimal(Arith.add(amount_before, volume))); |
| | | // 保存资金日志 |
| | | MoneyLog moneyLog = new MoneyLog(); |
| | | moneyLog.setCategory(Constants.MONEYLOG_CATEGORY_COIN); |
| | | moneyLog.setAmountBefore(new BigDecimal(amount_before)); |
| | | moneyLog.setAmount(new BigDecimal(volume)); |
| | | moneyLog.setAmountAfter(new BigDecimal(Arith.add(amount_before, volume))); |
| | | |
| | | moneyLog.setLog("充值订单[" + recharge.getOrderNo() + "]"); |
| | | moneyLog.setUserId(recharge.getPartyId()); |
| | | moneyLog.setWalletType(recharge.getSymbol()); |
| | | moneyLog.setContentType(Constants.MONEYLOG_CONTENT_RECHARGE); |
| | | moneyLog.setCreateTime(new Date()); |
| | | moneyLogService.save(moneyLog); |
| | | moneyLog.setLog("充值订单[" + recharge.getOrderNo() + "]"); |
| | | moneyLog.setUserId(recharge.getPartyId()); |
| | | moneyLog.setWalletType(recharge.getSymbol()); |
| | | moneyLog.setContentType(Constants.MONEYLOG_CONTENT_RECHARGE); |
| | | moneyLog.setCreateTime(new Date()); |
| | | moneyLogService.save(moneyLog); |
| | | |
| | | walletLog.setStatus(recharge.getSucceeded()); |
| | | walletLogService.updateById(walletLog); |
| | | /** |
| | | * 给他的代理添加充值记录 |
| | | */ |
| | | userDataService.saveRechargeHandle(recharge.getPartyId(), recharge.getVolume(), recharge.getSymbol()); |
| | | /** |
| | | * 买币-币冲充值其他非usdt币时使用 |
| | | */ |
| | | walletLog.setStatus(recharge.getSucceeded()); |
| | | walletLogService.updateById(walletLog); |
| | | /** |
| | | * 给他的代理添加充值记录 |
| | | */ |
| | | userDataService.saveRechargeHandle(recharge.getPartyId(), recharge.getVolume(), recharge.getSymbol()); |
| | | /** |
| | | * 买币-币冲充值其他非usdt币时使用 |
| | | */ |
| | | // userDataService.saveBuy(recharge.getPartyId(), recharge.getSymbol(), recharge.getVolume()); |
| | | |
| | | /** |
| | | * 充值到账后给他的代理用户添加奖金 |
| | | */ |
| | | if ("true".equals(user_recom_bonus_open.getSvalue())) { |
| | | // /** |
| | | // * 充值到账后给他的代理用户添加奖金 |
| | | // */ |
| | | // if ("true".equals(user_recom_bonus_open.getSvalue())) { |
| | | // |
| | | // List<RechargeBlockchainOrder> orders =findByPartyIdAndToday(recharge.getPartyId()); |
| | | // rechargeBonusService.saveBounsHandle(recharge, transfer_usdt,orders); |
| | | // } |
| | | |
| | | List<RechargeBlockchainOrder> orders =findByPartyIdAndToday(recharge.getPartyId()); |
| | | rechargeBonusService.saveBounsHandle(recharge, transfer_usdt,orders); |
| | | /** |
| | | * 充值到账后给他增加提现流水限制金额 |
| | | */ |
| | | |
| | | // /** |
| | | // * 充值到账后给他增加提现流水限制金额 充值到账后,当前流水大于提现限制流水时是否重置提现限制流水并将Party表里的当前流水设置清零,1不重置,2重置 |
| | | // */ |
| | | // String recharge_sucess_reset_withdraw = this.sysparaService.find("recharge_sucess_reset_withdraw") |
| | | // .getSvalue(); |
| | | // if ("1".equals(recharge_sucess_reset_withdraw)) { |
| | | // party.setWithdrawLimitAmount(new BigDecimal(Arith.add(party.getWithdrawLimitAmount().doubleValue(), usdt_amount))); |
| | | // if (party.getWithdrawLimitNowAmount().doubleValue() > party.getWithdrawLimitAmount().doubleValue()) { |
| | | // party.setWithdrawLimitNowAmount(new BigDecimal(0)); |
| | | // } |
| | | // } |
| | | // if ("2".equals(recharge_sucess_reset_withdraw)) { |
| | | // double withdraw_limit_turnover_percent = Double |
| | | // .valueOf(sysparaService.find("withdraw_limit_turnover_percent").getSvalue()); |
| | | // double party_withdraw = Arith.mul(party.getWithdrawLimitAmount().doubleValue(), withdraw_limit_turnover_percent); |
| | | // |
| | | // if (party.getWithdrawLimitNowAmount().doubleValue() >= party_withdraw) { |
| | | // party.setWithdrawLimitAmount(new BigDecimal(usdt_amount)); |
| | | // party.setWithdrawLimitNowAmount(new BigDecimal(0)); |
| | | // } else { |
| | | // party.setWithdrawLimitAmount(new BigDecimal(Arith.add(party.getWithdrawLimitAmount().doubleValue(), usdt_amount))); |
| | | // } |
| | | // } |
| | | |
| | | // userService.updateById(party); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 充值到账后给他增加提现流水限制金额 |
| | | */ |
| | | Log log = new Log(); |
| | | log.setCategory(Constants.LOG_CATEGORY_OPERATION); |
| | | log.setExtra(recharge.getOrderNo()); |
| | | log.setOperator(operator_username); |
| | | log.setUsername(party.getUserName()); |
| | | log.setUserId(recharge.getPartyId()); |
| | | log.setCreateTime(new Date()); |
| | | log.setLog("手动到账一笔充值订单。订单号[" + recharge.getOrderNo() + "]。"); |
| | | |
| | | /** |
| | | * 充值到账后给他增加提现流水限制金额 充值到账后,当前流水大于提现限制流水时是否重置提现限制流水并将Party表里的当前流水设置清零,1不重置,2重置 |
| | | */ |
| | | String recharge_sucess_reset_withdraw = this.sysparaService.find("recharge_sucess_reset_withdraw") |
| | | .getSvalue(); |
| | | if ("1".equals(recharge_sucess_reset_withdraw)) { |
| | | party.setWithdrawLimitAmount(new BigDecimal(Arith.add(party.getWithdrawLimitAmount().doubleValue(), usdt_amount))); |
| | | if (party.getWithdrawLimitNowAmount().doubleValue() > party.getWithdrawLimitAmount().doubleValue()) { |
| | | party.setWithdrawLimitNowAmount(new BigDecimal(0)); |
| | | } |
| | | } |
| | | if ("2".equals(recharge_sucess_reset_withdraw)) { |
| | | double withdraw_limit_turnover_percent = Double |
| | | .valueOf(sysparaService.find("withdraw_limit_turnover_percent").getSvalue()); |
| | | double party_withdraw = Arith.mul(party.getWithdrawLimitAmount().doubleValue(), withdraw_limit_turnover_percent); |
| | | |
| | | if (party.getWithdrawLimitNowAmount().doubleValue() >= party_withdraw) { |
| | | party.setWithdrawLimitAmount(new BigDecimal(usdt_amount)); |
| | | party.setWithdrawLimitNowAmount(new BigDecimal(0)); |
| | | } else { |
| | | party.setWithdrawLimitAmount(new BigDecimal(Arith.add(party.getWithdrawLimitAmount().doubleValue(), usdt_amount))); |
| | | } |
| | | } |
| | | |
| | | userService.updateById(party); |
| | | |
| | | logService.save(log); |
| | | tipService.deleteTip(recharge.getUuid().toString()); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | |
| | | Log log = new Log(); |
| | | log.setCategory(Constants.LOG_CATEGORY_OPERATION); |
| | | log.setExtra(recharge.getOrderNo()); |
| | | log.setOperator(operator_username); |
| | | log.setUsername(party.getUserName()); |
| | | log.setUserId(recharge.getPartyId()); |
| | | log.setCreateTime(new Date()); |
| | | log.setLog("手动到账一笔充值订单。订单号[" + recharge.getOrderNo() + "]。"); |
| | | |
| | | logService.save(log); |
| | | tipService.deleteTip(recharge.getUuid().toString()); |
| | | } |
| | | @Override |
| | | public long waitCount() { |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | if (!"ETH".equals(recharge.getSymbol().toUpperCase())) { |
| | | ChannelBlockchain channel = channelBlockchainService.findByNameAndCoinAndAdd(recharge.getBlockchainName(), |
| | | recharge.getSymbol(), recharge.getChannelAddress()); |
| | | |
| | | if (channel == null || !recharge.getSymbol().toUpperCase().equals(channel.getCoin().toUpperCase())) { |
| | | throw new YamiShopBindException("充值链错误"); |
| | | } |
| | | } |
| | | // |
| | | // if (!"ETH".equals(recharge.getSymbol().toUpperCase())) { |
| | | // ChannelBlockchain channel = channelBlockchainService.findByNameAndCoinAndAdd(recharge.getBlockchainName(), |
| | | // recharge.getSymbol(), recharge.getChannelAddress()); |
| | | // |
| | | // if (channel == null || !recharge.getSymbol().toUpperCase().equals(channel.getCoin().toUpperCase())) { |
| | | // throw new YamiShopBindException("充值链错误"); |
| | | // } |
| | | // } |
| | | |
| | | |
| | | double recharge_limit_min = Double.valueOf(sysparaService.find("recharge_limit_min").getSvalue()); |