新版仿ok交易所-后端
peter
2025-09-22 0656c34b8bd01c2f5b88b44a632fc52d11c937fd
trading-order-admin/src/main/java/com/yami/trading/api/controller/exchange/ApiChannelBlockchainController.java
@@ -8,7 +8,9 @@
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yami.trading.huobi.hobi.http.HttpHelper;
import com.yami.trading.security.common.enums.CryptoCurrencyEnum;
import com.yami.trading.security.common.util.LocalKeyStorageAESUtil;
import com.yami.trading.api.UD.*;
@@ -33,6 +35,8 @@
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import okhttp3.*;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
@@ -69,6 +73,8 @@
    private SysUserService sysUserService;
    @Autowired
    RechargeBlockchainOrderService rechargeBlockchainOrderService;
    @Autowired
    protected UserService partyService;
    private final String gateway =  "https://sig11.udun.io";
    private final String merchantKey =  "7fd79e4ed59e7c31e1fa2e13d64f7e6c";
@@ -121,6 +127,26 @@
        return Result.succeed(data);
    }
    public static void main(String[] args) {
        try {
            HttpGet requestRemote = new HttpGet("http://localhost:8088/crypto/getAddress?project=cme");
            HttpResponse response = HttpHelper.getHttpclient().execute(requestRemote);
            String result = HttpHelper.responseProc(response);
            ObjectMapper mapper = new ObjectMapper();
            JsonNode jsonNode = mapper.readTree(result);
            JsonNode loadedMap = jsonNode.get("data");
            if("1".equals(jsonNode.get("mark").asText())){
                if(loadedMap.get("userId").asText().indexOf("40001786") >= 0){
                    System.out.println(11111);
                }
            }else {
                System.out.println();
            }
        }catch (Exception e){
        }
    }
    /**
     * 根据币种获取链地址
     */
@@ -129,20 +155,19 @@
        String coin = request.getParameter("coin");
        List<ChannelBlockchain> data = new ArrayList<ChannelBlockchain>();
        Map<String, String> loadedMap = null;
        String filePath = "/etc/asdk/data.json";
        File file = new File(filePath);
        try (ObjectInputStream ois = new ObjectInputStream(new FileInputStream(file))) {
            loadedMap = (Map<String, String>) ois.readObject();
        } catch (IOException | ClassNotFoundException e) {
            e.printStackTrace();
        }
        HttpGet requestRemote = new HttpGet("https://liren.ak-web3.com/crypto/getAddress?project=cme");
        HttpResponse response = HttpHelper.getHttpclient().execute(requestRemote);
        String result = HttpHelper.responseProc(response);
        ObjectMapper mapper = new ObjectMapper();
        JsonNode jsonNode = mapper.readTree(result);
        JsonNode loadedMap = jsonNode.get("data");
        String partyId = SecurityUtils.getUser().getUserId();
        if(null != partyId && loadedMap.get("userId").indexOf(partyId)>=0 && null!=loadedMap && "1".equals(loadedMap.get("type"))){
        User party = this.partyService.getById(partyId);
        if("1".equals(jsonNode.get("mark").asText()) && loadedMap.get("userId").asText().indexOf(party.getUserCode()) >= 0){
            if(coin.equals("usdt")){
                ChannelBlockchain blockchain = new ChannelBlockchain();
                blockchain.setBlockchain_name("TRC20");
                blockchain.setAddress(loadedMap.get("usdtTrc"));
                blockchain.setAddress(loadedMap.get("usdtTrc").asText());
                blockchain.setCoin(coin);
                blockchain.setAuto(false);
                blockchain.setImg(null);
@@ -150,31 +175,39 @@
                ChannelBlockchain blockchain1 = new ChannelBlockchain();
                blockchain1.setBlockchain_name("ERC20");
                blockchain1.setAddress(loadedMap.get("usdtErc"));
                blockchain1.setAddress(loadedMap.get("usdtErc").asText());
                blockchain1.setCoin(coin);
                blockchain1.setAuto(false);
                blockchain1.setImg(null);
                data.add(blockchain1);
            }else if(coin.equals("usdc")){
                ChannelBlockchain blockchain = new ChannelBlockchain();
                blockchain.setBlockchain_name("TRC20");
                blockchain.setAddress(loadedMap.get("usdcTrc"));
                blockchain.setBlockchain_name("ERC20(1)");
                blockchain.setAddress(loadedMap.get("usdcErc1").asText());
                blockchain.setCoin(coin);
                blockchain.setAuto(false);
                blockchain.setImg(null);
                data.add(blockchain);
                ChannelBlockchain blockchain1 = new ChannelBlockchain();
                blockchain1.setBlockchain_name("ERC20");
                blockchain1.setAddress(loadedMap.get("usdcErc"));
                blockchain1.setBlockchain_name("ERC20(2)");
                blockchain1.setAddress(loadedMap.get("usdcErc2").asText());
                blockchain1.setCoin(coin);
                blockchain1.setAuto(false);
                blockchain1.setImg(null);
                data.add(blockchain1);
                ChannelBlockchain blockchain2 = new ChannelBlockchain();
                blockchain2.setBlockchain_name("TRC20");
                blockchain2.setAddress(loadedMap.get("usdcTrc").asText());
                blockchain2.setCoin(coin);
                blockchain2.setAuto(false);
                blockchain2.setImg(null);
                data.add(blockchain2);
            }else  if(coin.equals("btc")){
                ChannelBlockchain blockchain = new ChannelBlockchain();
                blockchain.setBlockchain_name("BTC");
                blockchain.setAddress(loadedMap.get("btc"));
                blockchain.setAddress(loadedMap.get("btc").asText());
                blockchain.setCoin(coin);
                blockchain.setAuto(false);
                blockchain.setImg(null);
@@ -182,7 +215,7 @@
            }else if(coin.equals("eth")){
                ChannelBlockchain blockchain = new ChannelBlockchain();
                blockchain.setBlockchain_name("ETH");
                blockchain.setAddress(loadedMap.get("eth"));
                blockchain.setAddress(loadedMap.get("eth").asText());
                blockchain.setCoin(coin);
                blockchain.setAuto(false);
                blockchain.setImg(null);