|
|
@@ -1,21 +1,24 @@
|
|
|
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 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("RetrievalTask")
|
|
|
public class RetrievalTask {
|
|
|
@Resource
|
|
|
@@ -24,10 +27,12 @@ public class RetrievalTask {
|
|
|
/**
|
|
|
* 每天生成日任务 如果当天是周一还需生成周任务
|
|
|
*/
|
|
|
- public void retrieveDayTaskByDate(LocalDate taskTime)
|
|
|
- { System.out.println("监控调阅每日每周任务生产服务有参"+taskTime);
|
|
|
- AjaxResult result = remoteRetrievalTaskService.dayTask(taskTime, SecurityConstants.INNER);
|
|
|
- System.out.println(JSON.toJSONString(result));
|
|
|
+ public void retrieveDayTaskByDate(String taskTime)
|
|
|
+ { String id = UUID.fastUUID().toString();
|
|
|
+ log.info("开始执行监控调阅每日每周任务生成定时任务,当前任务 id:{},当前时间:{},参数:{}", id, new Date(), JSON.toJSONString(taskTime));
|
|
|
+ LocalDate dateTime = LocalDate.parse(taskTime);
|
|
|
+ AjaxResult result = remoteRetrievalTaskService.dayTask(dateTime, SecurityConstants.INNER);
|
|
|
+ log.info("监控调阅每日每周任务生成定时任务执行结束,当前任务 id:{},当前时间:{},结果:{}", id, new Date(), JSON.toJSONString(result));
|
|
|
}
|
|
|
/**
|
|
|
* 1.1生成周期为每月,每季,每半年,每年的任务
|
|
|
@@ -36,16 +41,19 @@ public class RetrievalTask {
|
|
|
* 其他日期生成月任务
|
|
|
*
|
|
|
*/
|
|
|
- public void retrieveMonthTaskByDate(LocalDate taskTime)
|
|
|
- { System.out.println("监控调阅每月任务生产服务有参"+taskTime);
|
|
|
- AjaxResult result = remoteRetrievalTaskService.monthTask(taskTime,SecurityConstants.INNER);
|
|
|
- System.out.println(JSON.toJSONString(result));
|
|
|
+ public void retrieveMonthTaskByDate(String taskTime)
|
|
|
+ { String id = UUID.fastUUID().toString();
|
|
|
+ log.info("开始执行监控调阅每月季度半年年任务生成定时任务,当前任务 id:{},当前时间:{},参数:{}", id, new Date(), JSON.toJSONString(taskTime));
|
|
|
+ LocalDate dateTime = LocalDate.parse(taskTime);
|
|
|
+ AjaxResult result = remoteRetrievalTaskService.monthTask(dateTime,SecurityConstants.INNER);
|
|
|
+ log.info("监控调阅每月季度半年年任务生成定时任务执行结束,当前任务 id:{},当前时间:{},结果:{}", id, new Date(), JSON.toJSONString(result));
|
|
|
}
|
|
|
|
|
|
public void retrieveDayTask()
|
|
|
- { System.out.println("监控调阅每日每周任务生产服务无参");
|
|
|
+ { String id = UUID.fastUUID().toString();
|
|
|
+ log.info("开始执行监控调阅每日每周任务生成定时任务,当前任务 id:{},当前时间:{},无参数", id, new Date());
|
|
|
AjaxResult result = remoteRetrievalTaskService.dayTask(SecurityConstants.INNER);
|
|
|
- System.out.println(JSON.toJSONString(result));
|
|
|
+ log.info("监控调阅每日每周任务生成定时任务执行结束,当前任务 id:{},当前时间:{},结果:{}", id, new Date(), JSON.toJSONString(result));
|
|
|
}
|
|
|
/**
|
|
|
* 1.1生成周期为每月,每季,每半年,每年的任务
|
|
|
@@ -55,9 +63,16 @@ public class RetrievalTask {
|
|
|
*
|
|
|
*/
|
|
|
public void retrieveMonthTask()
|
|
|
- { System.out.println("监控调阅每月任务生产服务无参");
|
|
|
+ { String id = UUID.fastUUID().toString();
|
|
|
+ log.info("开始执行监控调阅每月季度半年年任务生成定时任务,当前任务 id:{},当前时间:{},无参数", id, new Date());
|
|
|
AjaxResult result = remoteRetrievalTaskService.monthTask(SecurityConstants.INNER);
|
|
|
- System.out.println(JSON.toJSONString(result));
|
|
|
+ log.info("监控调阅每月季度半年年任务生成定时任务执行结束,当前任务 id:{},当前时间:{},结果:{}", id, new Date(), JSON.toJSONString(result));
|
|
|
+ }
|
|
|
+ public void updateTaskStart()
|
|
|
+ { String id = UUID.fastUUID().toString();
|
|
|
+ log.info("开始执行监控调阅任务超期定时任务,当前任务 id:{},当前时间:{},无参数", id, new Date());
|
|
|
+ AjaxResult result = remoteRetrievalTaskService.updateTaskStart(SecurityConstants.INNER);
|
|
|
+ log.info("监控调阅任务超期定时任务执行结束,当前任务 id:{},当前时间:{},结果:{}", id, new Date(), JSON.toJSONString(result));
|
|
|
}
|
|
|
|
|
|
|