| | |
| | | |
| | | import com.whyc.constant.YamlProperties; |
| | | import com.whyc.service.HistoryDataArchivingService; |
| | | import com.whyc.task.AccountLockStrategyTask; |
| | | import com.whyc.task.AccountScanTask; |
| | | import com.whyc.task.HistoryDataArchivingTask; |
| | | import com.whyc.task.PreventTryTask; |
| | | import com.whyc.task.*; |
| | | import org.apache.commons.lang.time.DateUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | |
| | |
| | | @Autowired |
| | | private HistoryDataArchivingTask historyDataArchivingTask; |
| | | |
| | | @Autowired |
| | | private LicenseTask licenseTask; |
| | | |
| | | @Autowired |
| | | private AccountLockStrategyTask accountLockStrategyTask; |
| | | |
| | | @Autowired |
| | | private AccountScanTask accountScanTask; |
| | | |
| | | @Autowired |
| | | private PreventTryTask preventTryTask; |
| | | |
| | | @Autowired |
| | | private ProcessSurveyTask processSurveyTask; |
| | | |
| | | @Autowired |
| | | private HeiHeDataTask heiHeDataTask; |
| | | |
| | | @Override |
| | | public void contextInitialized(ServletContextEvent servletContextEvent) { |
| | | /*Calendar instance = Calendar.getInstance(); |
| | |
| | | instance.set(Calendar.SECOND,59); |
| | | Date firstDate = instance.getTime();*/ |
| | | timer = new Timer("Task定时任务",true); |
| | | //timer.schedule(processSurveyTask,0,1000); |
| | | /*//黑河多宝山和北安 站点专用 |
| | | timer.schedule(heiHeDataTask,0,4000);*/ |
| | | /*//每月刷新数据库表中天气支持城市-聚合平台,弃用 |
| | | timer.schedule(new WeatherTask(),firstDate,ONE_MONTH);*/ |
| | | |
| | |
| | | /*if(YamlProperties.messageSwitch.toUpperCase().equals("ON")){ |
| | | timer.schedule(new AlarmMessageTask2(),1000*10,1000*10); |
| | | }*/ |
| | | //timer.schedule(licenseTask,1000,60000); |
| | | //账号登录失败锁定解锁相关策略,频率为2秒 |
| | | timer.schedule(new AccountLockStrategyTask(servletContextEvent.getServletContext()), 1000, 2000); |
| | | //timer.schedule(accountLockStrategyTask, 1000, 2000); |
| | | if(YamlProperties.systemType == 2) { |
| | | //账号自动扫描策略,频率为1天 |
| | | timer.schedule(new AccountScanTask(), 1000, ONE_DAY); |
| | | timer.schedule(accountScanTask, 1000, ONE_DAY); |
| | | } |
| | | if(YamlProperties.systemType == 2 || YamlProperties.systemType == 3) { |
| | | //防重放功能随机码清除,频率为2秒 |
| | | timer.schedule(new PreventTryTask(servletContextEvent.getServletContext()), 1000, 2000); |
| | | timer.schedule(preventTryTask, 1000, 2000); |
| | | } |
| | | //每个月执行一次 |
| | | timer.schedule(historyDataArchivingTask,0,1000*60*60*24*30L); |
| | | } |
| | | |