44 lines
1.3 KiB
Plaintext
44 lines
1.3 KiB
Plaintext
|
|
package com.securityControl.task.schedule;
|
||
|
|
|
||
|
|
import com.securityControl.common.core.utils.aes.DateTimeHelper;
|
||
|
|
import com.securityControl.task.service.TaskService;
|
||
|
|
import com.securityControl.task.service.impl.WatherWarnService;
|
||
|
|
import lombok.extern.slf4j.Slf4j;
|
||
|
|
import org.quartz.Job;
|
||
|
|
import org.quartz.JobExecutionContext;
|
||
|
|
import org.quartz.JobExecutionException;
|
||
|
|
import org.slf4j.Logger;
|
||
|
|
import org.slf4j.LoggerFactory;
|
||
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
||
|
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||
|
|
import org.springframework.stereotype.Component;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 恶劣天气预警
|
||
|
|
*/
|
||
|
|
@Slf4j
|
||
|
|
@Component
|
||
|
|
@EnableScheduling
|
||
|
|
public class ScheduledWatherWarn implements Job {
|
||
|
|
|
||
|
|
private static final Logger log = LoggerFactory.getLogger(ScheduledWatherWarn.class);
|
||
|
|
|
||
|
|
|
||
|
|
@Autowired
|
||
|
|
private WatherWarnService service;
|
||
|
|
@Autowired
|
||
|
|
private TaskService taskService;
|
||
|
|
|
||
|
|
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||
|
|
try{
|
||
|
|
log.info("开始抓取恶劣天气预警>>>");
|
||
|
|
taskService.updateTask("bns_wather_warn","1", DateTimeHelper.getNowTime());
|
||
|
|
service.getCityWather();
|
||
|
|
log.info("恶劣天气抓取完成>>>");
|
||
|
|
} catch (Exception e){
|
||
|
|
log.error(e.toString(),e);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|