Commit 15c8f6d1 by zhiwei

推送时间修改

parent 58bf7554
......@@ -16,7 +16,7 @@ public class HotSearchRun {
private ScheduledExecutorService scheduExec;
public HotSearchRun() {
this.scheduExec = Executors.newScheduledThreadPool(1);
this.scheduExec = Executors.newScheduledThreadPool(4);
}
public void showTimer() {
......
......@@ -20,21 +20,23 @@ public class SendWeiboHotSearchRun extends Thread{
@Override
public void run() {
List<DBObject> list = weiboHotSearchDAO.getWeiboHotOneHour();
Calendar calendar = Calendar.getInstance();
int hour = calendar.get(Calendar.HOUR_OF_DAY);
System.out.println("微博推送,当前系统时间为:" + hour);
if(hour > 6 && hour < 23){
List<DBObject> list = weiboHotSearchDAO.getWeiboHotOneHour();
if(list!=null && list.size()>0){
for(DBObject weibo : list){
String title = weibo.get("name").toString();
String time = TimeParse.dateFormartString((Date)weibo.get("time"), "yyyy-MM-dd HH:mm:ss");
String url = weibo.get("url").toString();
if(calendar.get(Calendar.HOUR_OF_DAY) > 6 && calendar.get(Calendar.HOUR_OF_DAY) < 23){
sendTemplateByUserIds(title, time, url);
}
}
}else{
sendTemplateByUserIds("最近一小时无数据", TimeParse.dateFormartString(new Date(), "yyyy-MM-dd HH:mm:ss"), null);
}
}
}
/**
* @Title: sendTemplateByUserIds
......
......@@ -19,8 +19,11 @@ public class SendZhihuHotSearchRun extends Thread{
private ZhihuHotSearchDAO zhihuHotSearchDAO = new ZhihuHotSearchDAO();
@Override
public void run() {
List<DBObject> list = zhihuHotSearchDAO.getZhiHuHotSearch();
Calendar calendar = Calendar.getInstance();
int hour = calendar.get(Calendar.HOUR_OF_DAY);
System.out.println("知乎推送,当前系统时间为:"+hour);
if(hour > 6 && hour <23){
List<DBObject> list = zhihuHotSearchDAO.getZhiHuHotSearch();
if(list!=null && list.size()>0){
for(DBObject zhihu : list){
String title = zhihu.get("display_query").toString();
......@@ -34,6 +37,7 @@ public class SendZhihuHotSearchRun extends Thread{
sendTemplateByUserIds("最近一小时无数据", TimeParse.dateFormartString(new Date(), "yyyy-MM-dd HH:mm:ss"), null);
}
}
}
/**
* @Title: sendTemplateByUserIds
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment