From 7236be66852b4ac245e9c1ddb2dd3d591fcd3941 Mon Sep 17 00:00:00 2001 From: Helius <wangdoubleone@gmail.com> Date: Mon, 31 May 2021 10:53:24 +0800 Subject: [PATCH] modify --- src/main/java/com/xcong/excoin/quartz/job/NettyServerStartUp.java | 21 ++++++++++ src/main/java/com/xcong/excoin/quartz/job/LoopExecutorJob.java | 19 ++++----- src/main/java/com/xcong/excoin/ExcoinApplication.java | 9 ---- src/main/java/com/xcong/excoin/quartz/job/NewestPriceUpdateJob.java | 6 +- src/main/resources/application-loop.yml | 30 ++++++++------- src/main/java/com/xcong/excoin/rabbit/consumer/ChatConsumer.java | 2 src/main/resources/application-app.yml | 15 +++---- src/main/resources/application.yml | 1 src/main/java/com/xcong/excoin/common/listener/RedisKeyExpirationListener.java | 2 9 files changed, 60 insertions(+), 45 deletions(-) diff --git a/src/main/java/com/xcong/excoin/ExcoinApplication.java b/src/main/java/com/xcong/excoin/ExcoinApplication.java index 8908837..050578d 100644 --- a/src/main/java/com/xcong/excoin/ExcoinApplication.java +++ b/src/main/java/com/xcong/excoin/ExcoinApplication.java @@ -21,17 +21,10 @@ @EnableAsync @SpringBootApplication @MapperScan("com.xcong.excoin.modules.*.dao") -public class ExcoinApplication implements CommandLineRunner { - - @Autowired - private WebSocketServer webSocketServer; +public class ExcoinApplication { public static void main(String[] args) { SpringApplication.run(ExcoinApplication.class, args); } - @Override - public void run(String... args) throws Exception { - webSocketServer.start(); - } } diff --git a/src/main/java/com/xcong/excoin/common/listener/RedisKeyExpirationListener.java b/src/main/java/com/xcong/excoin/common/listener/RedisKeyExpirationListener.java index e4658c9..d2844cc 100644 --- a/src/main/java/com/xcong/excoin/common/listener/RedisKeyExpirationListener.java +++ b/src/main/java/com/xcong/excoin/common/listener/RedisKeyExpirationListener.java @@ -25,7 +25,7 @@ public void onMessage(Message message, byte[] pattern) { String expireKey = message.toString(); if (expireKey.equalsIgnoreCase("whole_bomb_execute")) { - ZzSmsSend.sendVerifyCode("15773002834", "123456", 2); +// ZzSmsSend.sendVerifyCode("15773002834", "123456", 2); } } } 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 d0fb7ba..6b2ef68 100644 --- a/src/main/java/com/xcong/excoin/quartz/job/LoopExecutorJob.java +++ b/src/main/java/com/xcong/excoin/quartz/job/LoopExecutorJob.java @@ -46,16 +46,15 @@ /** * 持仓费计算 */ - @Scheduled(cron = "0 0 0/8 * * ?") -// @Scheduled(cron = "0 0/5 * * * ?") - public void updateDoingPrice() { - log.info("#持仓费计算#"); - try { - contractHoldOrderService.calHoldFeeAmountForBondAmount(); - } catch (Exception e) { - log.error("#持仓费计算错误#", e); - } - } +// @Scheduled(cron = "0 0 0/8 * * ?") +// public void updateDoingPrice() { +// log.info("#持仓费计算#"); +// try { +// contractHoldOrderService.calHoldFeeAmountForBondAmount(); +// } catch (Exception e) { +// log.error("#持仓费计算错误#", e); +// } +// } /** * 币币委托单成交 diff --git a/src/main/java/com/xcong/excoin/quartz/job/NettyServerStartUp.java b/src/main/java/com/xcong/excoin/quartz/job/NettyServerStartUp.java new file mode 100644 index 0000000..a25cf80 --- /dev/null +++ b/src/main/java/com/xcong/excoin/quartz/job/NettyServerStartUp.java @@ -0,0 +1,21 @@ +package com.xcong.excoin.quartz.job; + + +import com.xcong.excoin.netty.server.WebSocketServer; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.stereotype.Component; + +@Component +@ConditionalOnProperty(prefix = "app", name = "websocket-job", havingValue = "true") +public class NettyServerStartUp implements CommandLineRunner { + + @Autowired + private WebSocketServer webSocketServer; + + @Override + public void run(String... args) throws Exception { + webSocketServer.start(); + } +} 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 d1f0637..46e0efd 100644 --- a/src/main/java/com/xcong/excoin/quartz/job/NewestPriceUpdateJob.java +++ b/src/main/java/com/xcong/excoin/quartz/job/NewestPriceUpdateJob.java @@ -53,9 +53,9 @@ // TODO 测试环境关闭这个插入redis redisUtils.set(CoinTypeConvert.convertToKey(symbol), price); // 比较 - websocketPriceService.comparePriceAsc(symbol, price); - websocketPriceService.comparePriceDesc(symbol, price); - websocketPriceService.wholeBomb(); +// websocketPriceService.comparePriceAsc(symbol, price); +// websocketPriceService.comparePriceDesc(symbol, price); +// websocketPriceService.wholeBomb(); //System.out.println("比较完毕:"+symbol+"-"+price); } diff --git a/src/main/java/com/xcong/excoin/rabbit/consumer/ChatConsumer.java b/src/main/java/com/xcong/excoin/rabbit/consumer/ChatConsumer.java index 9a2c634..b568d96 100644 --- a/src/main/java/com/xcong/excoin/rabbit/consumer/ChatConsumer.java +++ b/src/main/java/com/xcong/excoin/rabbit/consumer/ChatConsumer.java @@ -24,7 +24,7 @@ @Slf4j @Component -//@ConditionalOnProperty(prefix = "app", name = "rabbit-consumer", havingValue = "true") +@ConditionalOnProperty(prefix = "app", name = "websocekt-job", havingValue = "true") public class ChatConsumer { @Autowired diff --git a/src/main/resources/application-app.yml b/src/main/resources/application-app.yml index 0eda13e..e641019 100644 --- a/src/main/resources/application-app.yml +++ b/src/main/resources/application-app.yml @@ -94,17 +94,16 @@ debug: false redis_expire: 3000 project: otc - kline-update-job: true - newest-price-update-job: true + kline-update-job: false + newest-price-update-job: false #日线 该任务不能与最新价处于同一个服务器 - day-line: true - other-job: true + day-line: false + other-job: false loop-job: false rabbit-consumer: false - block-job: true - otc-job: true - system: - name: otc + block-job: false + otc-job: false + websocket-job: false aliyun: oss: diff --git a/src/main/resources/application-loop.yml b/src/main/resources/application-loop.yml index 7cb03f8..d6eff18 100644 --- a/src/main/resources/application-loop.yml +++ b/src/main/resources/application-loop.yml @@ -7,9 +7,9 @@ profiles: active: loop datasource: - url: jdbc:mysql://192.168.0.151:3306/db_hibit?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2b8 - username: db_hibit - password: hibit123!@# + url: jdbc:mysql://127.0.0.1:3306/db_otc?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2b8 + username: yd_otc + password: yd_otc123!@# driver-class-name: com.mysql.jdbc.Driver type: com.alibaba.druid.pool.DruidDataSource druid: @@ -50,11 +50,11 @@ ## Redis数据库索引(默认为0) database: 0 ## Redis服务器地址 - host: 192.168.0.36 + host: 127.0.0.1 ## Redis服务器连接端口 port: 6379 ## Redis服务器连接密码(默认为空) - password: d32ncxe@i3#!dV + password: aerefnadlfnwu241 jedis: pool: ## 连接池最大连接数(使用负值表示没有限制) @@ -72,10 +72,10 @@ ## 连接超时时间(毫秒) timeout: 30000 rabbitmq: - host: 192.168.0.36 + host: 127.0.0.1 port: 5672 - username: hibit - password: hibit123 + username: yunding + password: yunding123 publisher-confirm-type: correlated @@ -93,15 +93,17 @@ app: debug: false redis_expire: 3000 - kline-update-job: false - newest-price-update-job: false + kline-update-job: true + newest-price-update-job: true #日线 该任务不能与最新价处于同一个服务器 - day-line: false + day-line: true other-job: true - loop-job: true - rabbit-consumer: true + loop-job: false + rabbit-consumer: false block-job: true - + otc-job: true + websocket-job: true + aliyun: oss: end-point: https://oss-cn-hangzhou.aliyuncs.com diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 39bdbd0..99c137d 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -113,6 +113,7 @@ rabbit-consumer: false block-job: false otc-job: false + websocket-job: false aliyun: oss: -- Gitblit v1.9.1