Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
@@ -9,6 +9,7 @@ import cn.stock.market.dto.StockIpoDTO;
|
||||
import cn.stock.market.infrastructure.db.po.QStockIpoPO;
|
||||
import cn.stock.market.infrastructure.db.po.StockIpoPO;
|
||||
import cn.stock.market.infrastructure.db.repo.BtodayStockRepo;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.common.collect.Lists;
|
||||
@@ -102,9 +103,10 @@ public class Scraper {
|
||||
|
||||
|
||||
|
||||
@Scheduled(cron = "0 0 5 * * ?")
|
||||
@Scheduled(cron = "0 0 18 * * ?")
|
||||
@RequestMapping("/testScraperGetMoneyControllerNewIPO")
|
||||
public void schedule2() {
|
||||
public void getMoneyControllerNewIPOSchedule() {
|
||||
log.info("定时任务执行获取新股ipo的方法开始执行");
|
||||
// 目标 URL
|
||||
String url = "https://www.moneycontrol.com/ipo/open-upcoming-ipos";
|
||||
// 创建 HttpClient 实例
|
||||
@@ -132,7 +134,7 @@ public class Scraper {
|
||||
|
||||
// 将 JSON 字符串解析为 Java JSONObject
|
||||
JSONObject jsonObject = JSONObject.parseObject(jsonDataStr);
|
||||
log.info(jsonObject.toJSONString());
|
||||
log.info("获取到新股的json信息:"+jsonObject.toJSONString());
|
||||
|
||||
JSONObject pageProps = jsonObject.getJSONObject("props").getJSONObject("pageProps");
|
||||
JSONObject ipoTableData = pageProps.getJSONObject("ipoTableData");
|
||||
@@ -203,6 +205,9 @@ public class Scraper {
|
||||
//保存全部的新股
|
||||
if(CollectionUtil.isNotEmpty(listStockIpoList)){
|
||||
stockIpoRepository.saveAll(listStockIpoList);
|
||||
log.info("定时任务执行获取新股ipo的方法开始结束,保存了数据:{}", JSON.toJSONString(listStockIpoList));
|
||||
}else {
|
||||
log.info("定时任务执行获取新股ipo的方法开始结束,没有数据");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,6 +222,7 @@ public class Scraper {
|
||||
} catch (IOException e) {
|
||||
log.error("获取新股接口发生异常",e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user