| | |
| | | private XchProfitService xchProfitService; |
| | | |
| | | // @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)); |
| | | |
| | | redisUtils.set("XCH_NEW_PRICE", newestPrice); |
| | | settingEntity.setCurrentPrice(newestPrice); |
| | | ydBasicSettingDao.updateById(settingEntity); |
| | | } |
| | | } |
| | | // @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)); |
| | | // |
| | | // redisUtils.set("XCH_NEW_PRICE", newestPrice); |
| | | // settingEntity.setCurrentPrice(newestPrice); |
| | | // ydBasicSettingDao.updateById(settingEntity); |
| | | // } |
| | | // } |
| | | |
| | | private String getUrlResponse(String url) { |
| | | BufferedReader reader = null; |