新版仿ok交易所-后端
zyy
2025-10-11 f620192bcac7f5cb910a99e092edcee00280ce10
充值提现修改
3 files modified
30 ■■■■■ changed files
trading-order-admin/src/main/java/com/yami/trading/api/controller/ApiWithdrawController.java 8 ●●●● patch | view | raw | blame | history
trading-order-admin/src/main/java/com/yami/trading/api/controller/exchange/ApiChannelBlockchainController.java 15 ●●●● patch | view | raw | blame | history
trading-order-service/src/main/java/com/yami/trading/service/impl/RechargeBlockchainOrderServiceImpl.java 7 ●●●●● patch | view | raw | blame | history
trading-order-admin/src/main/java/com/yami/trading/api/controller/ApiWithdrawController.java
@@ -136,20 +136,20 @@
            withdraw.setTx("");
            //获取商户支持币种
            List<Coin> coinList = udunClient.listSupportCoin(false);
            /*List<Coin> coinList = udunClient.listSupportCoin(false);
            String channelName = channel.replace("_", "");
            Coin coin = coinList.stream().filter(x -> x.getName().replace("-","").equals(channelName)).findFirst().orElse(null);
            if (coin == null) {
                throw new YamiShopBindException("不支持的提现币种");
            }
            }*/
            // 保存
            this.withdrawService.saveApply(withdraw, channel, null);
            ResultMsg resultMsg = udunClient.withdraw(from, withdraw.getVolume(), coin.getMainCoinType(),
            /*ResultMsg resultMsg = udunClient.withdraw(from, withdraw.getVolume(), coin.getMainCoinType(),
                    coin.getCoinType(), withdraw.getOrderNo(), null);
            if (resultMsg.getCode() != HttpStatus.HTTP_OK) {
                log.error("withdraw:{}", JSONUtil.toJsonStr(resultMsg));
                throw new UdunException(resultMsg.getCode(), resultMsg.getMessage());
            }
            }*/
            resultObject.setCode(0);
        } catch (YamiShopBindException e) { // 1. 显式捕获业务异常,优先处理
            resultObject.setCode(1);
trading-order-admin/src/main/java/com/yami/trading/api/controller/exchange/ApiChannelBlockchainController.java
@@ -269,18 +269,20 @@
            double success_amount  = amounts / Math.pow(10, decimals);
            String address = map.get("address").toString();
            Integer status = Integer.valueOf(map.get("status").toString());
            RechargeBlockchainOrder blockchainOrder = rechargeBlockchainOrderService.getOne(new LambdaQueryWrapper<>(RechargeBlockchainOrder.class)
            /*RechargeBlockchainOrder blockchainOrder = rechargeBlockchainOrderService.getOne(new LambdaQueryWrapper<>(RechargeBlockchainOrder.class)
                    .eq(RechargeBlockchainOrder::getSucceeded, 0)
                    .eq(RechargeBlockchainOrder::getChannelAddress, address).last(" limit 1 "));
            if(ObjectUtil.isEmpty(blockchainOrder)){
                resultMsg.setCode(200);
                return resultMsg;
            }*/
                //查询地址订单
                blockchainOrder = (RechargeBlockchainOrder)redisTemplate.opsForValue().get(address);
                log.info("===rechargeCallback===blockchainOrder:{}", blockchainOrder);
            RechargeBlockchainOrder blockchainOrder = (RechargeBlockchainOrder)redisTemplate.opsForValue().get(address);
                if (blockchainOrder == null){
                    resultMsg.setCode(200);
                    return resultMsg;
                }
                if (status == 3) { //成功新增订单
                    blockchainOrder.setAddress(null);
                    blockchainOrder.setVolume(success_amount);
                    blockchainOrder.setImg(null);
@@ -288,12 +290,11 @@
                    blockchainOrder.setChannelAddress(address);
                    blockchainOrder.setTx("");
                    rechargeBlockchainOrderService.saveOrder(blockchainOrder);
                }
            }
            SysUser user = sysUserService.getSysUserById(Long.getLong(blockchainOrder.getPartyId()));
            log.info("===rechargeCallback==d=blockchainOrder:{}", blockchainOrder);
            if (status == 3) { //交易成功
                rechargeBlockchainOrderService.manualReceipt(1,blockchainOrder.getPartyId(), BigDecimal.valueOf(success_amount),user.getUsername());
                rechargeBlockchainOrderService.manualReceipt(1,blockchainOrder.getOrderNo(), BigDecimal.valueOf(success_amount),user.getUsername());
            } else if(status == 2) {   //驳回
                rechargeBlockchainOrderService.refusalApply(blockchainOrder.getUuid(), "订单失败:" + status, user.getUsername());
            }
trading-order-service/src/main/java/com/yami/trading/service/impl/RechargeBlockchainOrderServiceImpl.java
@@ -87,9 +87,13 @@
    @Transactional
    public void manualReceipt(Integer auto ,String id, BigDecimal amount,String operator_username) {
//        Date now = new Date();
        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) {
@@ -302,6 +306,9 @@
        logService.save(log);
        tipService.deleteTip(recharge.getUuid().toString());
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
    @Override
    public long waitCount() {