| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- package com.xunmei.job.task;
- import cn.hutool.core.lang.UUID;
- import com.alibaba.fastjson.JSON;
- import com.xunmei.common.core.constant.SecurityConstants;
- import com.xunmei.common.core.web.domain.AjaxResult;
- import com.xunmei.system.api.RemoteRetrievalTaskService;
- import com.xunmei.system.api.RemoteWeatherTaskService;
- import lombok.extern.slf4j.Slf4j;
- import org.springframework.stereotype.Component;
- import javax.annotation.Resource;
- import java.time.LocalDate;
- import java.util.Date;
- /**
- * 监控调阅定时任务
- *
- * @author xunmei
- */
- @Slf4j
- @Component("WeatherTask")
- public class WeatherTask {
- @Resource
- private RemoteWeatherTaskService remoteWeatherTaskService;
- /**
- * 每天定时获取天气预警数据
- */
- public void getDataFromApi()
- { String id = UUID.fastUUID().toString();
- log.info("开始执行获取天气预警数据的任务,当前任务 id:{},当前时间:{}", id, new Date());
- AjaxResult result = remoteWeatherTaskService.getDataFromApi( SecurityConstants.INNER);
- log.info("获取天气预警数据的任务执行结束,当前任务 id:{},当前时间:{},结果:{}", id, new Date(), JSON.toJSONString(result));
- }
- /**
- * 每天定时获取天气预警数据
- */
- public void getDataFromAliyun()
- { String id = UUID.fastUUID().toString();
- log.info("开始执行获取天气预警数据的任务,当前任务 id:{},当前时间:{}", id, new Date());
- AjaxResult result = remoteWeatherTaskService.getDataFromAliyun( SecurityConstants.INNER);
- log.info("获取天气预警数据的任务执行结束,当前任务 id:{},当前时间:{},结果:{}", id, new Date(), JSON.toJSONString(result));
- }
- }
|