新版仿ok交易所-后端
1
zj
97 mins ago b28a97e1bf66e3279e78f31ce58122427787ceec
trading-order-service/src/main/java/com/yami/trading/service/impl/WithdrawServiceImpl.java
@@ -95,6 +95,8 @@
                symbol = "btc";
            } else if (withdraw.getMethod().indexOf("ETH") != -1) {
                symbol = "eth";
            } else if (withdraw.getMethod().indexOf("USDC") != -1) {
                symbol = "usdc";
            } else {
                symbol = "usdt";
            }
@@ -124,7 +126,7 @@
        Withdraw withdraw = getById(id);
        if (withdraw.getStatus() == 2 ) {// 通过后不可驳回
            throw new YamiShopBindException("订单已操作,请不要重复操作!");
            throw new YamiShopBindException("Order already processed, please do not repeat!");
        }
        Date date = new Date();
        withdraw.setReviewTime(date);
@@ -135,11 +137,15 @@
        String symbol = "";
        if (withdraw.getMethod().indexOf("BTC") != -1) {
            symbol = "btc";
            symbol = "btcusdt";
        } else if (withdraw.getMethod().indexOf("ETH") != -1) {
            symbol = "eth";
        } else {
            symbol = "ethusdt";
        } else if (withdraw.getMethod().indexOf("USDC") != -1) {
            symbol = "usdcusdt";
        } else if (withdraw.getMethod().indexOf("USDT") != -1) {
            symbol = "usdt";
        } else {
            return;
        }
        if ("usdt".equals(symbol)) {
            Wallet wallet = walletService.saveWalletByPartyId(withdraw.getUserId());
@@ -152,7 +158,7 @@
            CapitaltWallet capitaltWallet = capitaltWalletService.getOne(new LambdaQueryWrapper<>(CapitaltWallet.class)
                    .eq(CapitaltWallet::getUserId, wallet.getUserId().toString()).last(" limit 1 "));
            if(ObjectUtil.isEmpty(capitaltWallet)){
                throw new YamiShopBindException("用户资金账户不存在!");
                throw new YamiShopBindException("User fund account does not exist!");
            }
            capitaltWalletService.update(new LambdaUpdateWrapper<CapitaltWallet>()
                    .set(CapitaltWallet::getMoney,new BigDecimal(Arith.add(capitaltWallet.getMoney(), withdraw.getVolume())))
@@ -238,7 +244,7 @@
            throw new YamiShopBindException("Please go through the advanced certification process first.");
        }
//        if (!party.isWithdrawAuthority()) {
//            throw new YamiShopBindException("无权限");
//            throw new YamiShopBindException("Permission denied");
//        }
        if (party.getStatus() != 1) {
            throw new YamiShopBindException("Your account has been frozen");
@@ -436,10 +442,13 @@
        } else if (channel.indexOf("ETH") != -1) {
            saveApplyOtherChannel(withdraw, "ethusdt");
            return;
        } else if (channel.indexOf("USDC") != -1) {
            saveApplyOtherChannel(withdraw, "usdcusdt");
            return;
        }
        User party = userService.getById(withdraw.getUserId());
        if (Constants.SECURITY_ROLE_TEST.equals(party.getRoleName())) {
            throw new YamiShopBindException("无权限");
            throw new YamiShopBindException("Permission denied");
        }
        Syspara syspara = sysparaService.find("stop_user_internet");
@@ -451,7 +460,7 @@
            System.out.println("stopUserInternet = " + stopUserInternet);
            if(Arrays.asList(stopUsers).contains(party.getUserName())){
                throw new YamiShopBindException("无网络");
                throw new YamiShopBindException("No network connection");
            }
        }
@@ -461,7 +470,7 @@
            party_kyc=new RealNameAuthRecord();
        }
        if (!(party_kyc.getStatus() == 2) && "true".equals(sysparaService.find("withdraw_by_kyc").getSvalue())) {
            throw new YamiShopBindException("未基础认证");
            throw new YamiShopBindException("Basic verification not completed");
        }
        if (party_kycHighLevel==null){
            party_kycHighLevel=new HighLevelAuthRecord();
@@ -469,10 +478,10 @@
        double withdraw_by_high_kyc = Double.valueOf(sysparaService.find("withdraw_by_high_kyc").getSvalue());
        if (withdraw_by_high_kyc > 0 && withdraw.getVolume().doubleValue() > withdraw_by_high_kyc
                && !(party_kycHighLevel.getStatus() == 2)) {
            throw new YamiShopBindException(1001,"请先通过高级认证");
            throw new YamiShopBindException(1001,"Please complete advanced verification first");
        }
//        if (!party.isWithdrawAuthority()) {
//            throw new YamiShopBindException(1, "无权限");
//            throw new YamiShopBindException(1, "Permission denied");
//        }
        if (party.getStatus() != 1) {
            throw new YamiShopBindException("Your account has been frozen");
@@ -729,7 +738,7 @@
    public void updateAddress(String id, String userName, Long adminuserId, String newAddress) {
        Withdraw withdraw = getById(id);
        if (withdraw == null) {
            throw new YamiShopBindException("参数错误!");
            throw new YamiShopBindException("Invalid parameters!");
        }
        String oldaddres = withdraw.getAddress();
        withdraw.setAddress(newAddress);
@@ -760,20 +769,20 @@
        BigDecimal amount = withdraw.getAmount();
        String symbol = "btc";
        if (!UserConstants.SECURITY_ROLE_MEMBER.equals(user.getRoleName())) {
            throw new YamiShopBindException("无权限");
            throw new YamiShopBindException("Permission denied");
        }
        RealNameAuthRecord realNameAuthRecord = realNameAuthRecordService.getByUserId(user.getUserId());
        if (!(realNameAuthRecord.getStatus() == 2) && "true".equals(sysparaService.find("withdraw_by_kyc").getSvalue())) {
            throw new YamiShopBindException("未安全认证,无提现权限");
            throw new YamiShopBindException("Security verification not completed, no withdrawal permission");
        }
        HighLevelAuthRecord highLevelAuthRecord = highLevelAuthRecordService.findByUserId(withdraw.getUserId());
        BigDecimal withdrawByHighKyc = new BigDecimal(sysparaService.find("withdraw_by_high_kyc").getSvalue());
        if (withdrawByHighKyc.doubleValue() > 0 && amount.doubleValue() > withdrawByHighKyc.doubleValue()
                && !(highLevelAuthRecord.getStatus() == 2)) {
            throw new YamiShopBindException("请先通过高级认证");
            throw new YamiShopBindException("Please complete advanced verification first");
        }
        if (!user.isWithdrawAuthority()) {
            throw new YamiShopBindException("无提现权限");
            throw new YamiShopBindException("No withdrawal permission");
        }
        if (user.getStatus() == 0) {
            throw new YamiShopBindException("Your account has been frozen");
@@ -917,7 +926,7 @@
             */
            double weekWithdraw = weekWithdraw(party.getUserId());
            if (Arith.add(weekWithdraw, withdrawVolumn) > limit) {
                throw new YamiShopBindException("提现不得大于限额");
                throw new YamiShopBindException("Withdrawal amount cannot exceed the limit");
            }
        }
    }