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/quartz/job/XchBaseDataUpdateJob.java | 60 ++++++++++++++++++++----------------------------------------
1 files changed, 20 insertions(+), 40 deletions(-)
diff --git a/src/main/java/com/xcong/excoin/quartz/job/XchBaseDataUpdateJob.java b/src/main/java/com/xcong/excoin/quartz/job/XchBaseDataUpdateJob.java
index ebd0074..a9ae7b9 100644
--- a/src/main/java/com/xcong/excoin/quartz/job/XchBaseDataUpdateJob.java
+++ b/src/main/java/com/xcong/excoin/quartz/job/XchBaseDataUpdateJob.java
@@ -36,43 +36,25 @@
@Autowired
private XchProfitService xchProfitService;
- // @Scheduled(cron = "0 0 0/10 * * ? ")
- @Scheduled(cron = "0 0/20 * * * ? ")
- public void baseDataUpdate() {
- log.info("基础数据更新任务");
- // 请求价格等数据 "https://api2.chiaexplorer.com/blockchainSummary"
- String result = pyExec();
- // 每t预计收益
-// String profitPerT = execCurl("https://api2.chiaexplorer.com/chart/xchTibDay?period=2w");
-//
-// String xchPrice24HStr = execCurl("https://api2.chiaexplorer.com/chart/xchPriceChart?period=24h");
- JSONObject jsonObject = (JSONObject) JSONObject.parse(result);
-// JSONObject perTObject = (JSONObject) JSONObject.parse(profitPerT);
-// JSONObject xchPrice24HObj = (JSONObject) JSONObject.parse(xchPrice24HStr);
- List<YdBasicSettingEntity> list = ydBasicSettingDao.selectList(null);
- if (CollUtil.isNotEmpty(list)) {
- YdBasicSettingEntity settingEntity = list.get(0);
- String netspaceStr = jsonObject.getString("netspace");
- BigDecimal baseUnit = BigDecimal.valueOf(1024);
- BigDecimal netspace = new BigDecimal(netspaceStr).divide(baseUnit.multiply(baseUnit.multiply(baseUnit.multiply(baseUnit.multiply(baseUnit)))), 2, BigDecimal.ROUND_DOWN);
- settingEntity.setAllPower(netspace);
-
- BigDecimal newPrice = new BigDecimal(jsonObject.getString("price"));
- redisUtils.set("XCH_NEW_PRICE", newPrice);
- settingEntity.setCurrentPrice(newPrice);
-
+// @Scheduled(cron = "0/1 * * * * ? ")
+// @Scheduled(cron = "0 0/10 * * * ? ")
+// public void baseDataUpdate() {
+// log.info("基础数据更新任务");
+// // 请求价格等数据 "https://api2.chiaexplorer.com/blockchainSummary"
+// String result = pyExec();
+// JSONObject xchPrice24HObj = (JSONObject) JSONObject.parse(result);
+// List<YdBasicSettingEntity> list = ydBasicSettingDao.selectList(null);
+// if (CollUtil.isNotEmpty(list)) {
+// YdBasicSettingEntity settingEntity = list.get(0);
// List<String> xchPrice24H = JSONObject.parseArray(xchPrice24HObj.getString("data"), String.class);
+//
// BigDecimal newestPrice = new BigDecimal(xchPrice24H.get(xchPrice24H.size() - 1));
-// BigDecimal lastPrice = new BigDecimal(xchPrice24H.get(xchPrice24H.size() - 1 -24));
-// BigDecimal upOrDown = newestPrice.subtract(lastPrice).multiply(BigDecimal.valueOf(100)).divide(lastPrice, 2, BigDecimal.ROUND_HALF_UP);
-// redisUtils.set("XCH_UP_DOWN", upOrDown);
-// List<String> data = JSONObject.parseArray(perTObject.getString("data"), String.class);
-// settingEntity.setPrifitT(new BigDecimal(data.get(0)));
-// settingEntity.setProfitDay(new BigDecimal(data.get(0)).multiply(BigDecimal.valueOf(1024)));
-
- ydBasicSettingDao.updateById(settingEntity);
- }
- }
+//
+// redisUtils.set("XCH_NEW_PRICE", newestPrice);
+// settingEntity.setCurrentPrice(newestPrice);
+// ydBasicSettingDao.updateById(settingEntity);
+// }
+// }
private String getUrlResponse(String url) {
BufferedReader reader = null;
@@ -119,8 +101,6 @@
}
public static void main(String[] args) {
-
-
// System.out.println(HttpRequest.get("https://www.chiaexplorer.com").execute().body());
// System.out.println(execCurl(cmds));
}
@@ -156,10 +136,10 @@
public String pyExec() {
String result = "";
- String path = ClassUtils.getDefaultClassLoader().getResource("").getPath();
- String filePath = path + "static/xch.py";
+ String cmd = "python2.7 /home/javaweb/yunding/xch.py";
+// String cmd = "python /Users/helius/Desktop/xch.py";
try {
- Process process = Runtime.getRuntime().exec("python3 " + filePath);
+ Process process = Runtime.getRuntime().exec(cmd);
process.waitFor();
InputStreamReader ir = new InputStreamReader(process.getInputStream());
LineNumberReader input = new LineNumberReader(ir);
--
Gitblit v1.9.1