新版仿ok交易所-后端
zyy
2025-09-15 f6a85a3f1f36b412daf60cac6d8ea9278cffa108
提现充值
6 files modified
86 ■■■■■ changed files
trading-order-admin/src/main/java/com/yami/trading/admin/task/IcoTask.java 51 ●●●● patch | view | raw | blame | history
trading-order-admin/src/main/java/com/yami/trading/api/controller/ApiWithdrawController.java 12 ●●●● patch | view | raw | blame | history
trading-order-admin/src/main/java/com/yami/trading/api/controller/exchange/ApiChannelBlockchainController.java 11 ●●●● patch | view | raw | blame | history
trading-order-admin/src/main/resources/config/system.properties 2 ●●● patch | view | raw | blame | history
trading-order-security-common/src/main/java/com/yami/trading/security/common/adapter/ResourceServerAdapter.java 4 ●●● patch | view | raw | blame | history
trading-order-service/src/main/java/com/yami/trading/service/impl/WithdrawServiceImpl.java 6 ●●●● patch | view | raw | blame | history
trading-order-admin/src/main/java/com/yami/trading/admin/task/IcoTask.java
@@ -4,20 +4,26 @@
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.lang.Console;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpStatus;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yami.trading.api.UD.*;
import com.yami.trading.bean.ico.domain.Ico;
import com.yami.trading.bean.item.domain.Item;
import com.yami.trading.bean.model.ChannelBlockchain;
import com.yami.trading.bean.model.Withdraw;
import com.yami.trading.common.domain.Result;
import com.yami.trading.common.util.ApplicationContextUtils;
import com.yami.trading.common.util.StringUtils;
import com.yami.trading.huobi.data.internal.KlineInitService;
import com.yami.trading.security.common.enums.CryptoCurrencyEnum;
import com.yami.trading.security.common.util.SecurityUtils;
import com.yami.trading.service.WithdrawService;
import com.yami.trading.service.ico.IcoService;
import com.yami.trading.service.item.ItemService;
import lombok.extern.slf4j.Slf4j;
@@ -53,48 +59,11 @@
    @Autowired
    RedisTemplate redisTemplate;
    //@Scheduled(cron = "*/5 * * * * ?")
    public void test() {
        String coin = "usdt";
        List<ChannelBlockchain> data = new ArrayList<ChannelBlockchain>();
        Map<String, List<CryptoCurrencyEnum>> allGroupedByCoin = CryptoCurrencyEnum.getAllGroupedByCoin();
        List<CryptoCurrencyEnum> currencyEnums = allGroupedByCoin.get(coin);
        try {
            String partyId = SecurityUtils.getUser().getUserId();
            //获取u盾地址
            //获取商户支持币种
            List<Coin> coinList = udunClient.listSupportCoin(false);
    @Autowired
    WithdrawService withdrawService;
            currencyEnums.forEach((currencyEnum) -> {
                String coinName = currencyEnum.getName();
                Coin c = coinList.stream().filter(x -> x.getName().equals(coinName)).findFirst().orElse(null);
                if (c != null) {
                    ChannelBlockchain rechargeAddressVo = new ChannelBlockchain();
                    //创建地址
                    Address address;
                    String ress = (String)redisTemplate.opsForValue().get(partyId + coinName);
                    if(StringUtils.isNotEmpty(ress)){
                        rechargeAddressVo.setAddress(ress);
                        rechargeAddressVo.setCoin(coinName);
                        rechargeAddressVo.setBlockchain_name(coinName);
                        rechargeAddressVo.setAuto(false);
                        rechargeAddressVo.setImg(null);
                    }else{
                        address = udunClient.createAddress(c.getMainCoinType(),null,null);
                        rechargeAddressVo.setAddress(address.getAddress());
                        rechargeAddressVo.setCoin(coinName);
                        rechargeAddressVo.setBlockchain_name(coinName);
                        rechargeAddressVo.setAuto(false);
                        rechargeAddressVo.setImg(null);
                        redisTemplate.opsForValue().set(partyId + coinName, address.getAddress());
                    }
                    data.add(rechargeAddressVo);
                }
            });
        }catch (Exception e){
            e.printStackTrace();
            log.error("获取充值地址错误:",e);
        }
    //@Scheduled(cron = "*/5 * * * * ?")
    public void test() throws JsonProcessingException {
    }
    /**
     * ico转入产品
trading-order-admin/src/main/java/com/yami/trading/api/controller/ApiWithdrawController.java
@@ -137,7 +137,8 @@
            //获取商户支持币种
            List<Coin> coinList = udunClient.listSupportCoin(false);
            Coin coin = coinList.stream().filter(x -> x.getName().equals(channel)).findFirst().orElse(null);
            String channelName = channel.replace("_", "");
            Coin coin = coinList.stream().filter(x -> x.getName().replace("-","").equals(channelName)).findFirst().orElse(null);
            if (coin == null) {
                throw new YamiShopBindException("不支持的提现币种");
            }
@@ -154,6 +155,7 @@
            resultObject.setCode(1);
            resultObject.setMsg(e.getMessage()); // 直接获取纯业务消息
            log.error("业务异常: {}", e.getMessage());
            throw e;
        } catch (UdunException e) {
            resultObject.setCode(1);
            resultObject.setMsg(e.getMessage());
@@ -177,6 +179,7 @@
        ResultMsg resultMsg = new ResultMsg();
        try{
            log.info("===withdrawCallback===:{}", body);
            boolean flag = udunClient.checkSign(timestamp, nonce, body, sign);
            log.info("===withdrawCallback===sign:{}", flag);
@@ -197,7 +200,12 @@
                resultMsg.setCode(200);
                return resultMsg;
            }
            withdrawService.examineOk(order_no, Long.valueOf(withdraw.getUserId()));
            Integer status = Integer.valueOf(map.get("status").toString());
            if (status == 3) { //交易成功
                withdrawService.examineOk(withdraw.getUuid(), null);
            } else if(status == 2) {   //驳回
                withdrawService.reject(withdraw.getUuid(), "订单失败:" + status, "withdrawCallback");
            }
            resultMsg.setCode(200);
        }catch (Exception e){
            resultMsg.setCode(500);
trading-order-admin/src/main/java/com/yami/trading/api/controller/exchange/ApiChannelBlockchainController.java
@@ -246,6 +246,7 @@
        ResultMsg resultMsg = new ResultMsg();
        try{
            log.info("===rechargeCallback===:{}", body);
            boolean flag = udunClient.checkSign(timestamp, nonce, body, sign);
            log.info("===rechargeCallback===sign:{}", flag);
@@ -268,8 +269,14 @@
                resultMsg.setCode(200);
                return resultMsg;
            }
                SysUser user = sysUserService.getSysUserById( Long.getLong(blockchainOrder.getPartyId()));
            rechargeBlockchainOrderService.manualReceipt(1,blockchainOrder.getPartyId(), BigDecimal.valueOf(success_amount),user.getUsername());
            Integer status = Integer.valueOf(map.get("status").toString());
            SysUser user = sysUserService.getSysUserById( Long.getLong(blockchainOrder.getPartyId()));
            if (status == 3) { //交易成功
                rechargeBlockchainOrderService.manualReceipt(1,blockchainOrder.getPartyId(), BigDecimal.valueOf(success_amount),user.getUsername());
            } else if(status == 2) {   //驳回
                rechargeBlockchainOrderService.refusalApply(blockchainOrder.getUuid(), "订单失败:" + status, user.getUsername());
            }
            resultMsg.setCode(200);
            return resultMsg;
        }catch (Exception e){
trading-order-admin/src/main/resources/config/system.properties
@@ -1,5 +1,5 @@
http.server.host=http://127.0.0.1:8080/images/
images.dir=/www/wwwroot/8.20/img/qr/
images.dir=/www/wwwroot/8.20/img/
admin_url=https://127.0.0.1:8080/admin
web_url=http://127.0.0.1:8080/wap/
trading-order-security-common/src/main/java/com/yami/trading/security/common/adapter/ResourceServerAdapter.java
@@ -62,7 +62,9 @@
            "/api/banner!list.action",
            "/api/news!list_v2_popup.action",
            "/api/news!list.action",
            "/api/authorizedLogin"
            "/api/authorizedLogin",
            "/api/channelBlockchain!rechargeCallback.action",
            "/api/withdraw/withdrawCallback.action"
    );
trading-order-service/src/main/java/com/yami/trading/service/impl/WithdrawServiceImpl.java
@@ -140,8 +140,12 @@
            symbol = "btc";
        } else if (withdraw.getMethod().indexOf("ETH") != -1) {
            symbol = "eth";
        } else {
        } else if (withdraw.getMethod().indexOf("USDC") != -1) {
            symbol = "usdc";
        } else if (withdraw.getMethod().indexOf("USDT") != -1) {
            symbol = "usdt";
        } else {
            return;
        }
        if ("usdt".equals(symbol)) {
            Wallet wallet = walletService.saveWalletByPartyId(withdraw.getUserId());