|
@@ -1,60 +0,0 @@
|
|
|
-package com.sckw.slope.detection.service.Task;
|
|
|
|
|
-
|
|
|
|
|
-import cn.hutool.core.date.DateUtil;
|
|
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
-import com.sckw.core.model.enums.ReportTypeEnum;
|
|
|
|
|
-import com.sckw.slope.detection.dao.mysql.KwsReportTemplateMapper;
|
|
|
|
|
-import com.sckw.slope.detection.model.dos.mysql.KwsReportTemplate;
|
|
|
|
|
-import jakarta.annotation.Resource;
|
|
|
|
|
-import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
-import org.springframework.scheduling.annotation.EnableScheduling;
|
|
|
|
|
-import org.springframework.stereotype.Component;
|
|
|
|
|
-import org.springframework.util.CollectionUtils;
|
|
|
|
|
-
|
|
|
|
|
-import java.time.LocalDateTime;
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
-
|
|
|
|
|
-/**
|
|
|
|
|
- * @author lfdc
|
|
|
|
|
- * @description 报表任务
|
|
|
|
|
- * @date 2023-11-10 11:11:25
|
|
|
|
|
- */
|
|
|
|
|
-
|
|
|
|
|
-@Slf4j
|
|
|
|
|
-@Component
|
|
|
|
|
-@EnableScheduling
|
|
|
|
|
-public class ReportTemplateTaskService {
|
|
|
|
|
-
|
|
|
|
|
- @Resource
|
|
|
|
|
- KwsReportTemplateMapper reportTemplateMapper;
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 报表生成定时任务
|
|
|
|
|
- */
|
|
|
|
|
- // @Scheduled(cron = "0 0 0 ? * *")
|
|
|
|
|
- public void templateTask() {
|
|
|
|
|
- List<KwsReportTemplate> kwsReportTemplates = reportTemplateMapper.selectList(new LambdaQueryWrapper<KwsReportTemplate>()
|
|
|
|
|
- .eq(KwsReportTemplate::getStatus, 0)
|
|
|
|
|
- .eq(KwsReportTemplate::getDelFlag, 0));
|
|
|
|
|
- if (!CollectionUtils.isEmpty(kwsReportTemplates)) {
|
|
|
|
|
- for (KwsReportTemplate kwsReportTemplate : kwsReportTemplates) {
|
|
|
|
|
- Integer type = kwsReportTemplate.getType();
|
|
|
|
|
- if (ReportTypeEnum.DAY.getCode() == type) {
|
|
|
|
|
- LocalDateTime localDateTime = LocalDateTime.now().minusDays(1);
|
|
|
|
|
- LocalDateTime dateEnd = com.sckw.excel.utils.DateUtil.localDateToLocalDateTimeEnd(localDateTime.toLocalDate());
|
|
|
|
|
- LocalDateTime dateStart = com.sckw.excel.utils.DateUtil.localDateToLocalDateTimeStart(localDateTime.toLocalDate());
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- if (ReportTypeEnum.WEEK.getCode() == type) {
|
|
|
|
|
- if (2 != DateUtil.thisDayOfWeekEnum().getValue()) {
|
|
|
|
|
- continue;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- if (ReportTypeEnum.MONTH.getCode() == type) {
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|