java之定时任务
package com.financial.server.util;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import com.financial.server.service.impl.GSXQ_K_LineOfDayService;
import com.financial.server.service.impl.GSYJReportService;
import com.financial.server.service.impl.HGYJReportService;
import com.financial.server.service.impl.HYYYReportService;
import com.financial.server.service.impl.JuChaoServiceImpl;
import com.financial.server.service.impl.LongHuBangDetailsService;
import com.financial.server.service.impl.QSCHReportService;
import com.financial.server.service.impl.SHZQService;
import com.financial.server.service.impl.SZZQService;
import com.financial.server.service.impl.TZCLReportService;
import com.financial.server.service.impl.TaoGuBaService;
import com.financial.server.service.impl.XGYBReportService;
import com.financial.server.thread.GSYJThread;
import com.financial.server.thread.HGYJThread;
import com.financial.server.thread.HYYYThread;
import com.financial.server.thread.JuChaoDownloadThread;
import com.financial.server.thread.KOfDayThread;
import com.financial.server.thread.LongHuBangDetailsThread;
import com.financial.server.thread.QSCHThread;
import com.financial.server.thread.SHZQThread;
import com.financial.server.thread.SZZQThread;
import com.financial.server.thread.TGBThread;
import com.financial.server.thread.TZCLThread;
import com.financial.server.thread.XGYBThread; @Component
public class TimerTask {
@Autowired
private GSXQ_K_LineOfDayService kOfDayService; @Autowired
private JuChaoServiceImpl juChaoServiceImpl; @Autowired
private TaoGuBaService taoGuBaService; @Autowired
private GSYJReportService gsyjReportService;
@Autowired
private XGYBReportService xgybReportService;
@Autowired
private HYYYReportService hyyyReportService;
/*@Autowired
private GNYBReportService gnybReportService;*/
@Autowired
private TZCLReportService tzclReportService;
@Autowired
private QSCHReportService qschReportService;
@Autowired
private HGYJReportService hgyjReportService; @Autowired
private LongHuBangDetailsService longHuBangDetailsService; @Autowired
private JuChaoServiceImpl juchChaoServiceImpl;
@Autowired
private GSXQ_K_LineOfDayService gsxq_K_LineOfDayService; String date = new SimpleDateFormat("yyyy-MM-dd").format(new Date());//
//String date = "2018-07-12";
String typeFile = "F:/巨潮网/巨潮网公告类别.txt";
@Scheduled(cron = "0 59 13 ? * *")//每天15:04执行一次
public void doSomethingWithCron() {
try { //插入跟帖
/*Map<String, String> map = TaoGuBa.webParseHtmls("https://www.taoguba.com.cn/index?blockID=1");
String JessionID = map.get("JSESSIONID").toString();
String cookie = TaoGuBa.SubmitPost(JessionID);
new Thread(new TGBThread(taoGuBaService, date, date,true)).start();//淘股吧
*/
new Thread(new GSYJThread(gsyjReportService, date, date,true)).start();//公司研究 new Thread(new XGYBThread(xgybReportService, date, date,true)).start();//新股研报 new Thread(new HYYYThread(hyyyReportService, date, date,true)).start();//行业研究 new Thread(new TZCLThread(tzclReportService, date, date,true)).start();//投资策略 new Thread(new QSCHThread(qschReportService, date, date,true)).start();//券商晨会 new Thread(new HGYJThread(hgyjReportService, date, date,true)).start();//宏观研究 new Thread(new LongHuBangDetailsThread(longHuBangDetailsService, date, date,true)).start();//龙虎榜详情 new Thread(new JuChaoThread(juchChaoServiceImpl,typeFile,date, date,true)).start();//巨潮网公告 new Thread(new KOfDayThread(gsxq_K_LineOfDayService,date,true)).start();//日k线数据 } catch (Exception e) {
e.printStackTrace();
}
} }
java之定时任务的更多相关文章
- Java基础--定时任务Timer
Java基础--定时任务Timer 一.Timer介绍 java.util.Timer java.util.TimerTask Timer是一个定时器类,通过该类可以为指定的定时任务进行配置.Time ...
- Java基础--定时任务Timer(转载)
Java基础--定时任务Timer 一.Timer介绍 java.util.Timer java.util.TimerTask Timer是一个定时器类,通过该类可以为指定的定时任务进行配置.Time ...
- java实现定时任务的三种方法 - 转载
java实现定时任务的三种方法 /** * 普通thread * 这是最常见的,创建一个thread,然后让它在while循环里一直运行着, * 通过sleep方法来达到定时任务的效果.这样可以快速简 ...
- [转]Java实现定时任务的三种方法
在应用里经常都有用到在后台跑定时任务的需求.举个例子,比如需要在服务后台跑一个定时任务来进行非实时计算,清除临时数据.文件等.在本文里,我会给大家介绍3种不同的实现方法: 普通thread实现 Tim ...
- java实现定时任务的三种方法
/** * 普通thread * 这是最常见的,创建一个thread,然后让它在while循环里一直运行着, * 通过sleep方法来达到定时任务的效果.这样可以快速简单的实现,代码如下: * @au ...
- Java之定时任务详解
在我们编程过程中如果需要执行一些简单的定时任务,无须做复杂的控制,我们可以考虑使用JDK中的Timer定时任务来实现.下面就其原理.实例以及Timer缺陷三个方面来解析java Timer定时器. 在 ...
- Java实现定时任务的三种方法(转)
在应用里经常都有用到在后台跑定时任务的需求.举个例子,比如需要在服务后台跑一个定时任务来进行非实时计算,清除临时数据.文件等.在本文里,我会给大家介绍3种不同的实现方法: 普通thread实现 Tim ...
- Java SpringMVC 定时任务
1.web.xml 2.spring-mvc.xml <?xml version="1.0" encoding="UTF-8"?> <bean ...
- java实现定时任务
Java中实现定时任务执行某一业务.具体操作如下: 1.定义初始化任务 2.任务业务操作 3.定义初始化方法 4.在web.xml中注册启动 5.定义具体执行时间
- java实现定时任务的三种实现方法
转载于:https://blog.csdn.net/haorengoodman/article/details/23281343/ /** * 普通thread * 这是最常见的,创建一个thread ...
随机推荐
- double类型相减有小数误差
如 :19.9-9.9=9.9999999999999,而不是10double相减会转换成二进制,因double有效位数为 16位这就会出现存储小数位数不够的情况,这种情况下就会出现误差 //两个Do ...
- Ubuntu Server16.04 配置网卡
展示全部启动网卡 $ ifconfig 配置网卡 $ sudo vi /etc/network/interfaces auto enp2s0 iface enp2s0 inet static addr ...
- Linux下安装zookeeper集群(奇数个)
1. 解压zookeeper压缩包 2. data里创建“myid”文件(命令touch myid),内容是1(命令 echo 1 >> myid) 3. zoo.cnf里配置dat ...
- Python 全栈开发十一 深浅拷贝
深浅拷贝 深浅拷贝的前提: 相等和相同的关系 深浅拷贝针对的是列表等可变的数据类型. 深浅拷贝在普通的列表没有什么意义,只有在嵌套列表,或其他嵌套数据类型才有意义. a = "aaa&quo ...
- jq closet的使用,找到距离最近的一个父元素;
- huawei
线程堆栈(Thread Stack)和托管堆(Managed Heap) 每个正在运行的程序都对应着一个进程 (process),在一个进程内部,可以有一个或多个线程(thread),每个线程都拥有一 ...
- [Java in NetBeans] Lesson 05. Method/function
这个课程的参考视频和图片来自youtube. 主要学到的知识点有: Define a method:(motivation: write one time, but use it many times ...
- 使用github(一)
一.使用Github(目的.基本概念) 1.目的 借助github托管项目代码 2.基本概念 (1)仓库(Repository) 仓库即项目的意思,你想在github上开源一个项目,那就必须要新建一个 ...
- 还是Go 为了伟大的未来
今天,还是想讲讲Go 我觉得还没讲够,哈哈哈 其实,是想把框架再清晰些,因为上一篇框架没能引入goroutine(协程),感觉比较遗憾 下边,我就用上goroutine,但这里的协程仅是为了演示,没有 ...
- xcode如何支持8.0以下
1. shell打开 open /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSuppor ...