java之定時任務

 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 }
View Code
相關文章
相關標籤/搜索