java之定时任务
2018-07-19 05:38:14来源:博客园 阅读 ()
1 package com.financial.server.util; 2 import java.text.SimpleDateFormat; 3 import java.util.Date; 4 import java.util.HashMap; 5 import java.util.Map; 6 import org.springframework.beans.factory.annotation.Autowired; 7 import org.springframework.scheduling.annotation.Scheduled; 8 import org.springframework.stereotype.Component; 9 10 import com.financial.server.service.impl.GSXQ_K_LineOfDayService; 11 import com.financial.server.service.impl.GSYJReportService; 12 import com.financial.server.service.impl.HGYJReportService; 13 import com.financial.server.service.impl.HYYYReportService; 14 import com.financial.server.service.impl.JuChaoServiceImpl; 15 import com.financial.server.service.impl.LongHuBangDetailsService; 16 import com.financial.server.service.impl.QSCHReportService; 17 import com.financial.server.service.impl.SHZQService; 18 import com.financial.server.service.impl.SZZQService; 19 import com.financial.server.service.impl.TZCLReportService; 20 import com.financial.server.service.impl.TaoGuBaService; 21 import com.financial.server.service.impl.XGYBReportService; 22 import com.financial.server.thread.GSYJThread; 23 import com.financial.server.thread.HGYJThread; 24 import com.financial.server.thread.HYYYThread; 25 import com.financial.server.thread.JuChaoDownloadThread; 26 import com.financial.server.thread.KOfDayThread; 27 import com.financial.server.thread.LongHuBangDetailsThread; 28 import com.financial.server.thread.QSCHThread; 29 import com.financial.server.thread.SHZQThread; 30 import com.financial.server.thread.SZZQThread; 31 import com.financial.server.thread.TGBThread; 32 import com.financial.server.thread.TZCLThread; 33 import com.financial.server.thread.XGYBThread; 34 35 36 @Component 37 public class TimerTask { 38 @Autowired 39 private GSXQ_K_LineOfDayService kOfDayService; 40 41 42 @Autowired 43 private JuChaoServiceImpl juChaoServiceImpl; 44 45 @Autowired 46 private TaoGuBaService taoGuBaService; 47 48 @Autowired 49 private GSYJReportService gsyjReportService; 50 @Autowired 51 private XGYBReportService xgybReportService; 52 @Autowired 53 private HYYYReportService hyyyReportService; 54 /*@Autowired 55 private GNYBReportService gnybReportService;*/ 56 @Autowired 57 private TZCLReportService tzclReportService; 58 @Autowired 59 private QSCHReportService qschReportService; 60 @Autowired 61 private HGYJReportService hgyjReportService; 62 63 @Autowired 64 private LongHuBangDetailsService longHuBangDetailsService; 65 66 @Autowired 67 private JuChaoServiceImpl juchChaoServiceImpl; 68 @Autowired 69 private GSXQ_K_LineOfDayService gsxq_K_LineOfDayService; 70 71 String date = new SimpleDateFormat("yyyy-MM-dd").format(new Date());// 72 //String date = "2018-07-12"; 73 String typeFile = "F:/巨潮网/巨潮网公告类别.txt"; 74 @Scheduled(cron = "0 59 13 ? * *")//每天15:04执行一次 75 public void doSomethingWithCron() { 76 try { 77 78 79 80 //插入跟帖 81 /*Map<String, String> map = TaoGuBa.webParseHtmls("https://www.taoguba.com.cn/index?blockID=1"); 82 String JessionID = map.get("JSESSIONID").toString(); 83 String cookie = TaoGuBa.SubmitPost(JessionID); 84 new Thread(new TGBThread(taoGuBaService, date, date,true)).start();//淘股吧 85 */ 86 new Thread(new GSYJThread(gsyjReportService, date, date,true)).start();//公司研究 87 88 new Thread(new XGYBThread(xgybReportService, date, date,true)).start();//新股研报 89 90 new Thread(new HYYYThread(hyyyReportService, date, date,true)).start();//行业研究 91 92 new Thread(new TZCLThread(tzclReportService, date, date,true)).start();//投资策略 93 94 new Thread(new QSCHThread(qschReportService, date, date,true)).start();//券商晨会 95 96 new Thread(new HGYJThread(hgyjReportService, date, date,true)).start();//宏观研究 97 98 new Thread(new LongHuBangDetailsThread(longHuBangDetailsService, date, date,true)).start();//龙虎榜详情 99 100 101 new Thread(new JuChaoThread(juchChaoServiceImpl,typeFile,date, date,true)).start();//巨潮网公告 102 103 104 new Thread(new KOfDayThread(gsxq_K_LineOfDayService,date,true)).start();//日k线数据 105 106 107 108 } catch (Exception e) { 109 e.printStackTrace(); 110 } 111 } 112 113 }
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
下一篇:Spring框架四大基本原则
- 国外程序员整理的Java资源大全(全部是干货) 2020-06-12
- 2020年深圳中国平安各部门Java中级面试真题合集(附答案) 2020-06-11
- 2020年java就业前景 2020-06-11
- 04.Java基础语法 2020-06-11
- Java--反射(框架设计的灵魂)案例 2020-06-11
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash