package com.ruoyi.doublePrevention.scheduls;
|
|
import com.ruoyi.common.utils.DateUtils;
|
import com.ruoyi.doublePrevention.repository.PreventCJReportCheckRecordFromTaskRepository;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.stereotype.Component;
|
import org.springframework.transaction.annotation.Transactional;
|
|
import java.time.DayOfWeek;
|
import java.time.LocalDate;
|
|
@Component
|
@Slf4j
|
public class RePushDataSchedule {
|
|
|
|
@Autowired
|
private PreventCJReportCheckRecordFromTaskRepository preventCJReportCheckRecordFromTaskRepository;
|
|
@Transactional
|
@Scheduled(cron = "0 0 12 * * 4 ")
|
public void repushDataV1(){
|
log.info("周四【双重预防】重新推送数据..."+ DateUtils.dateTimeNow());
|
// 获取当前日期
|
LocalDate currentDate = LocalDate.now();
|
|
// 计算当前周的周一日期
|
LocalDate mondayDate = currentDate.with(DayOfWeek.MONDAY);
|
log.info("当前周的周一日期:" + mondayDate);
|
String startTime = mondayDate + " 00:00:00";
|
String endTime = DateUtils.getDate() + " 12:00:00";
|
|
int i = preventCJReportCheckRecordFromTaskRepository.updateTaskReportStatusForRePushV1(startTime, endTime);
|
|
log.info("执行更新了:"+i+"条数据,结束周四【双重预防】重新推送数据..."+ DateUtils.dateTimeNow());
|
}
|
|
|
//update prevent_cj_report_check_record_from_task set id=concat(substring(id,1,length(id)-4),'ccab'),report_status=1 where check_time>="2024-11-04 00:00:00" ;
|
@Transactional
|
@Scheduled(cron = "0 0 16 * * 0 ")
|
public void repushDataV2(){
|
log.info("周日【双重预防】重新推送数据..."+ DateUtils.dateTimeNow());
|
// 获取当前日期
|
LocalDate currentDate = LocalDate.now();
|
|
// 计算当前周的周一日期
|
LocalDate thursdayDate = currentDate.with(DayOfWeek.THURSDAY);
|
log.info("当前周的周四日期:" + thursdayDate);
|
String startTime = thursdayDate + " 12:00:00";
|
String endTime = DateUtils.getDate() + " 16:00:00";
|
|
int i = preventCJReportCheckRecordFromTaskRepository.updateTaskReportStatusForRePushV2(startTime, endTime);
|
log.info("执行更新了:"+i+"条数据,结束周四【双重预防】重新推送数据..."+ DateUtils.dateTimeNow());
|
}
|
|
}
|