From 869769dedf8722109c944db9a5d9fac97591c2d3 Mon Sep 17 00:00:00 2001
From: zainali5120 <512061637@qq.com>
Date: Sat, 16 Jan 2021 14:41:57 +0800
Subject: [PATCH] TRC20版本提交

---
 src/main/java/com/xcong/excoin/quartz/job/LoopExecutorJob.java      |    2 
 lib/tron-sdk.jar                                                    |    0 
 lib/wallet-cli.jar                                                  |    0 
 src/main/java/com/xcong/excoin/configurations/WebMvcConfig.java     |   90 ++++++++++++++
 src/main/java/com/xcong/excoin/configurations/RabbitMqConfig.java   |   86 +++++++-------
 src/main/java/com/xcong/excoin/quartz/job/UsdtErc20InitJob.java     |    2 
 src/main/java/com/xcong/excoin/quartz/job/NewestPriceUpdateJob.java |    2 
 src/main/resources/application-prod.yml                             |   21 +-
 pom.xml                                                             |  101 +++++++++-------
 src/main/resources/application.yml                                  |    2 
 10 files changed, 200 insertions(+), 106 deletions(-)

diff --git a/lib/tron-sdk.jar b/lib/tron-sdk.jar
index fc1364a..dc77498 100644
--- a/lib/tron-sdk.jar
+++ b/lib/tron-sdk.jar
Binary files differ
diff --git a/lib/wallet-cli.jar b/lib/wallet-cli.jar
new file mode 100644
index 0000000..61fb59b
--- /dev/null
+++ b/lib/wallet-cli.jar
Binary files differ
diff --git a/pom.xml b/pom.xml
index 2abae36..c21436c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -36,53 +36,7 @@
 
     <dependencies>
 
-        <dependency>
-            <groupId>ripple</groupId>
-            <artifactId>ripple</artifactId>
-            <version>0.0.1</version>
-            <scope>system</scope>
-            <systemPath>${basedir}/lib/ripple-core-0.0.1-SNAPSHOT.jar</systemPath>
-        </dependency>
 
-        <dependency>
-            <groupId>taobao</groupId>
-            <artifactId>taobao-sdk</artifactId>
-            <version>1.0.0-SNAPSHOT</version>
-            <scope>system</scope>
-            <systemPath>${basedir}/lib/taobao-sdk-java.jar</systemPath>
-        </dependency>
-
-        <dependency>
-            <groupId>tron-sdk</groupId>
-            <artifactId>tron-sdk</artifactId>
-            <version>0.0.1</version>
-            <scope>system</scope>
-            <systemPath>${basedir}/lib/tron-sdk.jar</systemPath>
-        </dependency>
-
-        <dependency>
-            <groupId>com.github.ki5fpl.tronj</groupId>
-            <artifactId>abi</artifactId>
-            <version>0.4.0</version>
-            <scope>system</scope>
-            <systemPath>${basedir}/lib/abi-0.4.0.jar</systemPath>
-        </dependency>
-
-        <dependency>
-            <groupId>com.github.ki5fpl.tronj</groupId>
-            <artifactId>client</artifactId>
-            <version>0.4.0</version>
-            <scope>system</scope>
-            <systemPath>${basedir}/lib/client-0.4.0.jar</systemPath>
-        </dependency>
-
-        <dependency>
-            <groupId>com.github.ki5fpl.tronj</groupId>
-            <artifactId>utils</artifactId>
-            <version>0.4.0</version>
-            <scope>system</scope>
-            <systemPath>${basedir}/lib/utils-0.4.0.jar</systemPath>
-        </dependency>
 
         <dependency>
             <groupId>org.springframework.boot</groupId>
@@ -314,6 +268,61 @@
             <version>4.3.5</version>
         </dependency>
         <!-- submail邮件 end -->
+
+        <dependency>
+            <groupId>ripple</groupId>
+            <artifactId>ripple</artifactId>
+            <version>0.0.1</version>
+            <scope>system</scope>
+            <systemPath>${basedir}/lib/ripple-core-0.0.1-SNAPSHOT.jar</systemPath>
+        </dependency>
+
+        <dependency>
+            <groupId>taobao</groupId>
+            <artifactId>taobao-sdk</artifactId>
+            <version>1.0.0-SNAPSHOT</version>
+            <scope>system</scope>
+            <systemPath>${basedir}/lib/taobao-sdk-java.jar</systemPath>
+        </dependency>
+
+        <dependency>
+            <groupId>ztron-sdk</groupId>
+            <artifactId>ztron-sdk</artifactId>
+            <version>0.0.1</version>
+            <scope>system</scope>
+            <systemPath>${basedir}/lib/tron-sdk.jar</systemPath>
+        </dependency>
+        <!--<dependency>-->
+            <!--<groupId>wallet-cli</groupId>-->
+            <!--<artifactId>wallet-cli</artifactId>-->
+            <!--<version>0.0.1</version>-->
+            <!--<scope>system</scope>-->
+            <!--<systemPath>${basedir}/lib/wallet-cli.jar</systemPath>-->
+        <!--</dependency>-->
+
+        <dependency>
+            <groupId>com.github.ki5fpl.tronj</groupId>
+            <artifactId>abi</artifactId>
+            <version>0.4.0</version>
+            <scope>system</scope>
+            <systemPath>${basedir}/lib/abi-0.4.0.jar</systemPath>
+        </dependency>
+
+        <dependency>
+            <groupId>com.github.ki5fpl.tronj</groupId>
+            <artifactId>client</artifactId>
+            <version>0.4.0</version>
+            <scope>system</scope>
+            <systemPath>${basedir}/lib/client-0.4.0.jar</systemPath>
+        </dependency>
+
+        <dependency>
+            <groupId>com.github.ki5fpl.tronj</groupId>
+            <artifactId>utils</artifactId>
+            <version>0.4.0</version>
+            <scope>system</scope>
+            <systemPath>${basedir}/lib/utils-0.4.0.jar</systemPath>
+        </dependency>
     </dependencies>
 
     <build>
diff --git a/src/main/java/com/xcong/excoin/configurations/RabbitMqConfig.java b/src/main/java/com/xcong/excoin/configurations/RabbitMqConfig.java
index 0a590b2..cbc0438 100644
--- a/src/main/java/com/xcong/excoin/configurations/RabbitMqConfig.java
+++ b/src/main/java/com/xcong/excoin/configurations/RabbitMqConfig.java
@@ -21,111 +21,111 @@
 @Configuration
 public class RabbitMqConfig {
 
-    public static final String EXCHANGE_ONE = "biue-exchange-one";
+    public static final String EXCHANGE_ONE = "biue-exchange-one_t";
 
-    public static final String QUEUE_TEST = "test-queue";
+    public static final String QUEUE_TEST = "test-queue_t";
 
-    public static final String ROUTING_KEY_TEST = "test-routingKey";
+    public static final String ROUTING_KEY_TEST = "test-routingKey_t";
 
-    public static final String EXCHANGE_A = "biue-exchange-A";
+    public static final String EXCHANGE_A = "biue-exchange-A_t";
 
 
-    public static final String EXCHANGE_USDT_UPDATE = "exchange_usdt_update";
+    public static final String EXCHANGE_USDT_UPDATE = "exchange_usdt_update_t";
 
-    public static final String QUEUE_USDT_UPDATE = "queue_usdt_update";
+    public static final String QUEUE_USDT_UPDATE = "queue_usdt_update_t";
 
-    public static final String ROUTING_KEY_USDT_UPDATE = "routing_key_usdt_update";
+    public static final String ROUTING_KEY_USDT_UPDATE = "routing_key_usdt_update_t";
 
-    public static final String EXCHANGE_USDT_ADDRESS = "exchange_usdt_address";
+    public static final String EXCHANGE_USDT_ADDRESS = "exchange_usdt_address_t";
 
-    public static final String QUEUE_USDT_ADDRESS= "queue_usdt_address";
+    public static final String QUEUE_USDT_ADDRESS= "queue_usdt_address_t";
 
-    public static final String ROUTING_KEY_USDT_ADDRESS = "routing_key_usdt_address";
+    public static final String ROUTING_KEY_USDT_ADDRESS = "routing_key_usdt_address_t";
 
 
     /**
      * 撮合交易
      */
-    public static final String EXCHANGE_B = "biue-exchange-B";
+    public static final String EXCHANGE_B = "biue-exchange-B_t";
 
 
     // 开多止盈队列
-    public static final String QUEUE_MOREPRO = "QUEUE_MOREPRO_NEW";
+    public static final String QUEUE_MOREPRO = "QUEUE_MOREPRO_NEW_t";
     // 开空止盈队列
-    public static final String QUEUE_LESSPRO = "QUEUE_LESSPRO_NEW";
+    public static final String QUEUE_LESSPRO = "QUEUE_LESSPRO_NEW_t";
     // 开多止损队列
-    public static final String QUEUE_MORELOSS = "QUEUE_MORELOSS_NEW";
+    public static final String QUEUE_MORELOSS = "QUEUE_MORELOSS_NEW_t";
     // 开空止损队列
-    public static final String QUEUE_LESSLOSS = "QUEUE_LESSLOSS_NEW";
+    public static final String QUEUE_LESSLOSS = "QUEUE_LESSLOSS_NEW_t";
 
     // 限价委托
-    public static final String QUEUE_LIMIT = "QUEUE_LIMIT_NEW";
+    public static final String QUEUE_LIMIT = "QUEUE_LIMIT_NEW_t";
 
     // 爆仓队列
-    public static final String QUEUE_COINOUT = "QUEUE_COINOUT_NEW";
+    public static final String QUEUE_COINOUT = "QUEUE_COINOUT_NEW_t";
 
     //价格操作
-    public static final String QUEUE_PRICEOPERATE = "QUEUE_PRICEOPERATE_NEW";
+    public static final String QUEUE_PRICEOPERATE = "QUEUE_PRICEOPERATE_NEW_t";
 
     // 平仓队列
-    public static final String QUEUE_CLOSETRADE = "QUEUE_CLOSETRADE_NEW";
+    public static final String QUEUE_CLOSETRADE = "QUEUE_CLOSETRADE_NEW_t";
 
     // 盘口队列
-    public static final String QUEUE_TRADE_PLATE = "QUEUE_TRADE_PLATE";
+    public static final String QUEUE_TRADE_PLATE = "QUEUE_TRADE_PLATE_t";
 
     // 处理交易
-    public static final String QUEUE_HANDLE_TRADE = "QUEUE_HANDLE_TRADE";
+    public static final String QUEUE_HANDLE_TRADE = "QUEUE_HANDLE_TRADE_t";
 
 
     // 开多止盈路由键
-    public static final String ROUTINGKEY_MOREPRO = "ROUTINGKEY_MOREPRO";
+    public static final String ROUTINGKEY_MOREPRO = "ROUTINGKEY_MOREPRO_t";
     // 开空止盈路由
-    public static final String ROUTINGKEY_LESSPRO = "ROUTINGKEY_LESSPRO";
+    public static final String ROUTINGKEY_LESSPRO = "ROUTINGKEY_LESSPRO_t";
     // 开多止损路由
-    public static final String ROUTINGKEY_MORELOSS = "ROUTINGKEY_MORELOSS";
+    public static final String ROUTINGKEY_MORELOSS = "ROUTINGKEY_MORELOSS_t";
     // 开空止损路由
-    public static final String ROUTINGKEY_LESSLOSS = "ROUTINGKEY_LESSLOSS";
+    public static final String ROUTINGKEY_LESSLOSS = "ROUTINGKEY_LESSLOSS_t";
     // 限价委托
-    public static final String ROUTINGKEY_LIMIT = "ROUTINGKEY_LIMIT";
+    public static final String ROUTINGKEY_LIMIT = "ROUTINGKEY_LIMIT_t";
 
     // 爆仓路由
-    public static final String ROUTINGKEY_COINOUT = "ROUTINGKEY_COINOUT";
+    public static final String ROUTINGKEY_COINOUT = "ROUTINGKEY_COINOUT_t";
 
 
     // 价格操作
-    public static final String ROUTINGKEY_PRICEOPERATE = "ROUTINGKEY_PRICEOPERATE";
+    public static final String ROUTINGKEY_PRICEOPERATE = "ROUTINGKEY_PRICEOPERATE_t";
     // 平仓路由
-    public static final String ROUTINGKEY_CLOSETRADE = "ROUTINGKEY_CLOSETRADE";
+    public static final String ROUTINGKEY_CLOSETRADE = "ROUTINGKEY_CLOSETRADE_t";
 
     // 盘口理路由
-    public static final String ROUTINGKEY_TRADE_PLATE = "ROUTINGKEY_TRADE_PLATE";
+    public static final String ROUTINGKEY_TRADE_PLATE = "ROUTINGKEY_TRADE_PLATE_t";
 
     // 交易订单处理
-    public static final String ROUTINGKEY_HANDLE_TRADE = "ROUTINGKEY_HANDLE_TRADE";
+    public static final String ROUTINGKEY_HANDLE_TRADE = "ROUTINGKEY_HANDLE_TRADE_t";
 
-    public static final String EXCHANGE_ROC = "roc-transfer";
+    public static final String EXCHANGE_ROC = "roc-transfer_t";
 
-    public static final String QUEUE_ROC= "roc-queue";
+    public static final String QUEUE_ROC= "roc-queue_t";
 
-    public static final String ROUTING_KEY_ROC = "roc-transfer-routingKey";
+    public static final String ROUTING_KEY_ROC = "roc-transfer-routingKey_t";
 
-    public static final String EXCHANGE_ROC_ORDER_SUBMIT = "roc-exchange-order-submit";
+    public static final String EXCHANGE_ROC_ORDER_SUBMIT = "roc-exchange-order-submit_t";
 
-    public static final String QUEUE_ROC_ORDER_SUBMIT = "roc-order-queue-submit";
+    public static final String QUEUE_ROC_ORDER_SUBMIT = "roc-order-queue-submit_t";
 
-    public static final String ROUTING_KEY_ROC_ORDER_SUBMIT  = "roc-order-routingKey-submit";
+    public static final String ROUTING_KEY_ROC_ORDER_SUBMIT  = "roc-order-routingKey-submit_t";
 
-    public static final String EXCHANGE_ROC_ORDER_CANCEL = "roc-exchange-order-cancel";
+    public static final String EXCHANGE_ROC_ORDER_CANCEL = "roc-exchange-order-cancel_t";
 
-    public static final String QUEUE_ROC_ORDER_CANCEL = "roc-order-queue-cancel";
+    public static final String QUEUE_ROC_ORDER_CANCEL = "roc-order-queue-cancel_t";
 
-    public static final String ROUTING_KEY_ROC_ORDER_CANCEL  = "roc-order-routingKey-cancel";
+    public static final String ROUTING_KEY_ROC_ORDER_CANCEL  = "roc-order-routingKey-cancel_t";
 
-    public static final String EXCHANGE_ROC_ORDER_COMPLETE = "roc-exchange-order-complete";
+    public static final String EXCHANGE_ROC_ORDER_COMPLETE = "roc-exchange-order-complete_t";
 
-    public static final String QUEUE_ROC_ORDER_COMPLETE = "roc-order-queue-complete";
+    public static final String QUEUE_ROC_ORDER_COMPLETE = "roc-order-queue-complete_t";
 
-    public static final String ROUTING_KEY_ROC_ORDER_COMPLETE  = "roc-order-routingKey-complete";
+    public static final String ROUTING_KEY_ROC_ORDER_COMPLETE  = "roc-order-routingKey-complete_t";
 
 
     @Resource
diff --git a/src/main/java/com/xcong/excoin/configurations/WebMvcConfig.java b/src/main/java/com/xcong/excoin/configurations/WebMvcConfig.java
index 06994e0..08cc9d7 100644
--- a/src/main/java/com/xcong/excoin/configurations/WebMvcConfig.java
+++ b/src/main/java/com/xcong/excoin/configurations/WebMvcConfig.java
@@ -8,10 +8,14 @@
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.boot.SpringBootConfiguration;
 import org.springframework.context.annotation.Bean;
+import org.springframework.format.FormatterRegistry;
+import org.springframework.http.converter.HttpMessageConverter;
+import org.springframework.validation.MessageCodesResolver;
+import org.springframework.validation.Validator;
 import org.springframework.web.method.support.HandlerMethodArgumentResolver;
-import org.springframework.web.servlet.config.annotation.CorsRegistry;
-import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+import org.springframework.web.method.support.HandlerMethodReturnValueHandler;
+import org.springframework.web.servlet.HandlerExceptionResolver;
+import org.springframework.web.servlet.config.annotation.*;
 
 import javax.annotation.Resource;
 import java.util.List;
@@ -33,6 +37,76 @@
         resolvers.add(new UserAuthenticationArgumentResolver());
     }
 
+    @Override
+    public void addReturnValueHandlers(List<HandlerMethodReturnValueHandler> list) {
+
+    }
+
+    @Override
+    public void configureMessageConverters(List<HttpMessageConverter<?>> list) {
+
+    }
+
+    @Override
+    public void extendMessageConverters(List<HttpMessageConverter<?>> list) {
+
+    }
+
+    @Override
+    public void configureHandlerExceptionResolvers(List<HandlerExceptionResolver> list) {
+
+    }
+
+    @Override
+    public void extendHandlerExceptionResolvers(List<HandlerExceptionResolver> list) {
+
+    }
+
+    @Override
+    public Validator getValidator() {
+        return null;
+    }
+
+    @Override
+    public MessageCodesResolver getMessageCodesResolver() {
+        return null;
+    }
+
+    @Override
+    public void configurePathMatch(PathMatchConfigurer pathMatchConfigurer) {
+
+    }
+
+    @Override
+    public void configureContentNegotiation(ContentNegotiationConfigurer contentNegotiationConfigurer) {
+
+    }
+
+    @Override
+    public void configureAsyncSupport(AsyncSupportConfigurer asyncSupportConfigurer) {
+
+    }
+
+    @Override
+    public void configureDefaultServletHandling(DefaultServletHandlerConfigurer defaultServletHandlerConfigurer) {
+
+    }
+
+    @Override
+    public void addFormatters(FormatterRegistry formatterRegistry) {
+
+    }
+
+    @Override
+    public void addInterceptors(InterceptorRegistry interceptorRegistry) {
+
+    }
+
+    @Override
+    public void addResourceHandlers(ResourceHandlerRegistry resourceHandlerRegistry) {
+
+    }
+
     /**
      * 设置cors跨域支持
      *
@@ -46,6 +120,16 @@
                 .allowCredentials(true).maxAge(3600);
     }
 
+    @Override
+    public void addViewControllers(ViewControllerRegistry viewControllerRegistry) {
+
+    }
+
+    @Override
+    public void configureViewResolvers(ViewResolverRegistry viewResolverRegistry) {
+
+    }
+
     @Bean
     public OSS ossClient() {
         return new OSSClientBuilder().build(aliOssProperties.getEndPoint(), aliOssProperties.getAccessKeyId(), aliOssProperties.getAccessKeySecret());
diff --git a/src/main/java/com/xcong/excoin/quartz/job/LoopExecutorJob.java b/src/main/java/com/xcong/excoin/quartz/job/LoopExecutorJob.java
index f7d569a..aac7abd 100644
--- a/src/main/java/com/xcong/excoin/quartz/job/LoopExecutorJob.java
+++ b/src/main/java/com/xcong/excoin/quartz/job/LoopExecutorJob.java
@@ -59,7 +59,7 @@
     /**
      * 币币委托单成交
      */
-    @Scheduled(cron = "0/5 * * * * ? ")
+    //@Scheduled(cron = "0/5 * * * * ? ")
     public void coinEntrustToDeal() {
         try {
             orderCoinService.dealEntrustCoinOrder();
diff --git a/src/main/java/com/xcong/excoin/quartz/job/NewestPriceUpdateJob.java b/src/main/java/com/xcong/excoin/quartz/job/NewestPriceUpdateJob.java
index 99fdc25..c1fceb6 100644
--- a/src/main/java/com/xcong/excoin/quartz/job/NewestPriceUpdateJob.java
+++ b/src/main/java/com/xcong/excoin/quartz/job/NewestPriceUpdateJob.java
@@ -51,7 +51,7 @@
                 if (null != symbol) {
                     String price = tradeEvent.getTradeList().get(0).getPrice().toPlainString();
                     // TODO 测试环境关闭这个插入redis
-                    redisUtils.set(CoinTypeConvert.convertToKey(symbol), price);
+                   // redisUtils.set(CoinTypeConvert.convertToKey(symbol), price);
                     // 比较
                     //websocketPriceService.comparePriceAsc(symbol, price);
                     //websocketPriceService.comparePriceDesc(symbol, price);
diff --git a/src/main/java/com/xcong/excoin/quartz/job/UsdtErc20InitJob.java b/src/main/java/com/xcong/excoin/quartz/job/UsdtErc20InitJob.java
index aacf3ff..22a4d73 100644
--- a/src/main/java/com/xcong/excoin/quartz/job/UsdtErc20InitJob.java
+++ b/src/main/java/com/xcong/excoin/quartz/job/UsdtErc20InitJob.java
@@ -26,6 +26,6 @@
     @PostConstruct
     public void initCoinTrade() {
         System.out.println("开启USDT同步");
-        usdtErc20UpdateService.updateUsdt();
+        //usdtErc20UpdateService.updateUsdt();
     }
 }
diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml
index c408c4f..5c8de19 100644
--- a/src/main/resources/application-prod.yml
+++ b/src/main/resources/application-prod.yml
@@ -7,9 +7,9 @@
   profiles:
     active: dev
   datasource:
-    url: jdbc:mysql://47.114.114.219:3306/db_roc?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2b8
-    username: roc_user
-    password: roc123pasd!@
+    url: jdbc:mysql://rm-bp1i2g5rg5dubo9s40o.mysql.rds.aliyuncs.com/db_cpv_temp?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2b8
+    username: cpv_temp_user
+    password: cpv_user123
     driver-class-name: com.mysql.jdbc.Driver
     type: com.alibaba.druid.pool.DruidDataSource
     druid:
@@ -50,11 +50,11 @@
     ## Redis数据库索引(默认为0)
     database: 1
     ## Redis服务器地址
-    host: 127.0.0.1
+    host: 154.91.195.160
     ## Redis服务器连接端口
     port: 6379
     ## Redis服务器连接密码(默认为空)
-    password: roccqwe1234
+    password: cpv-user123456
     jedis:
       pool:
         ## 连接池最大连接数(使用负值表示没有限制)
@@ -72,10 +72,10 @@
     ## 连接超时时间(毫秒)
     timeout: 30000
   rabbitmq:
-    host: 47.114.114.219
+    host: 154.91.195.160
     port: 5672
-    username: roc_user
-    password: roc123456
+    username: cpv_user
+    password: cpv123456
     publisher-confirm-type: correlated
 
 
@@ -91,14 +91,15 @@
 
 
 app:
-  debug: false
+  debug: true
   redis_expire: 3000
   kline-update-job: false
   newest-price-update-job: true
+  #日线 该任务不能与最新价处于同一个服务器
   exchange-trade: true
   day-line: false
   other-job: true
-  loop-job: false
+  loop-job: true
   rabbit-consumer: false
   block-job: true
 
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index d60206e..ed6db2f 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -5,7 +5,7 @@
 
 spring:
   profiles:
-    active: dayline
+    active: prod
   datasource:
     url: jdbc:mysql://47.114.114.219:3306/db_roc?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2b8
     username: roc_user

--
Gitblit v1.9.1