From 829f629756e5402bcd3e9f6ef1f9c6dbffbabb11 Mon Sep 17 00:00:00 2001
From: KKSU <15274802129@163.com>
Date: Wed, 17 Apr 2024 14:46:29 +0800
Subject: [PATCH] 55测试环境

---
 src/main/java/com/xcong/excoin/modules/blackchain/service/Impl/BlockSeriveImpl.java |   39 +++++++++++++++++++++++++--------------
 1 files changed, 25 insertions(+), 14 deletions(-)

diff --git a/src/main/java/com/xcong/excoin/modules/blackchain/service/Impl/BlockSeriveImpl.java b/src/main/java/com/xcong/excoin/modules/blackchain/service/Impl/BlockSeriveImpl.java
index 94ee137..3f547ce 100644
--- a/src/main/java/com/xcong/excoin/modules/blackchain/service/Impl/BlockSeriveImpl.java
+++ b/src/main/java/com/xcong/excoin/modules/blackchain/service/Impl/BlockSeriveImpl.java
@@ -5,18 +5,15 @@
 
 import javax.annotation.Resource;
 
+import com.xcong.excoin.modules.blackchain.service.*;
+import com.xcong.excoin.rabbit.producer.UsdtUpdateProducer;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Service;
 
 import com.alibaba.fastjson.JSONObject;
 import com.xcong.excoin.common.LoginUserUtils;
 import com.xcong.excoin.common.response.Result;
-import com.xcong.excoin.modules.blackchain.service.BlockSerive;
-import com.xcong.excoin.modules.blackchain.service.BtcService;
-import com.xcong.excoin.modules.blackchain.service.EthService;
-import com.xcong.excoin.modules.blackchain.service.LtcService;
-import com.xcong.excoin.modules.blackchain.service.UsdtService;
-import com.xcong.excoin.modules.blackchain.service.XrpService;
 import com.xcong.excoin.modules.member.dao.MemberCoinAddressDao;
 import com.xcong.excoin.modules.member.dao.MemberDao;
 import com.xcong.excoin.modules.member.entity.MemberCoinAddressEntity;
@@ -35,15 +32,22 @@
     @Resource
     MemberCoinAddressDao memberMapper;
 
+    @Resource
+    private UsdtUpdateProducer usdtUpdateProducer;
+
     @Override
-    public Result findBlockAddress(String symbol) {
+    public Result findBlockAddress(String symbol,String lable) {
         //获取用户ID
         String mId = LoginUserUtils.getAppLoginUser().getId().toString();
         MemberEntity member = memberDao.selectById(mId);
         if (member == null) {
             return Result.fail(MessageSourceUtils.getString("member_service_0003"));
         }
-        String lable = "ERC20";
+        if(StringUtils.isBlank(lable)){
+            //lable = "ERC20";
+            lable = "TRC20";
+        }
+
         Result result = new Result();
         try {
             Map<String, String> map = new HashMap<String, String>();
@@ -54,7 +58,7 @@
             } else {
                 memberCoinAddress = memberMapper.selectBlockAddress(Long.parseLong(mId), symbol);
             }
-            log.info("--->{}", memberCoinAddress);
+            //log.info("--->{}", memberCoinAddress);
             if (memberCoinAddress != null) {
                 map.put("address", memberCoinAddress.getAddress());
                 map.put("lable", memberCoinAddress.getLabel());
@@ -100,14 +104,12 @@
                         }
                         break;
                     case "EOS":
-                        address = "biyicteos123";
+                        address = "hibitdeposit";
                         map.put("address", address);
                         map.put("lable", uuid);
                         break;
                     case "XRP":
-                        JSONObject jSONObject = XrpService.createWallet();
-                        address = (String) jSONObject.get("xAddress");
-                        key = (String) jSONObject.get("secret");
+                        address = "rUzWJkXyEtT8ekSSxkBYPqCvHpngcy6Fks";
                         map.put("address", address);
                         map.put("lable", uuid);
                         break;
@@ -164,7 +166,7 @@
                                 memberMapper.insert(coinAddress);
                             }
 
-                        } else {
+                        } else if ("ERC20".equals(lable)) {
                             MemberCoinAddressEntity ethAddress2 = memberMapper.selectBlockAddress(Long.parseLong(mId), "ETH");
                             if (ethAddress2 != null) {
                                 address = ethAddress2.getAddress();
@@ -185,6 +187,15 @@
                                 coinAddress.setLabel(uuid);
                                 memberMapper.insert(coinAddress);
                             }
+                            // 发送新增的地址到监听集合
+                            usdtUpdateProducer.sendAddressMsg(address+","+"ERC20");
+                        } else if ("TRC20".equals(lable)) {
+                            Map<String, String> usdtMap = Trc20Service.createAddress();
+                            address = usdtMap.get("address");
+                            key = usdtMap.get("privateKey");
+                            map.put("address", address);
+                            // 发送新增的地址到监听集合
+                            usdtUpdateProducer.sendAddressMsg(address+","+"TRC20");
                         }
                         break;
                     default:

--
Gitblit v1.9.1