16639036659
2024-04-09 faad8a00349f7eb41338936f56be2028d7ba7cc2
src/main/java/com/gkhy/fourierSpecialGasMonitor/schedule/DailyReportSchedule.java
@@ -1,11 +1,9 @@
package com.gkhy.fourierSpecialGasMonitor.schedule;
import com.alibaba.fastjson.JSON;
import com.gkhy.fourierSpecialGasMonitor.Application;
import com.gkhy.fourierSpecialGasMonitor.commons.enums.ForeignResultCode;
import com.gkhy.fourierSpecialGasMonitor.commons.enums.ResultCode;
import com.gkhy.fourierSpecialGasMonitor.commons.enums.SystemCacheKeyEnum;
import com.gkhy.fourierSpecialGasMonitor.commons.exception.BusinessException;
import com.gkhy.fourierSpecialGasMonitor.commons.exception.DataReceiveException;
import com.gkhy.fourierSpecialGasMonitor.config.file.ReportFilePathConfig;
import com.gkhy.fourierSpecialGasMonitor.entity.*;
import com.gkhy.fourierSpecialGasMonitor.service.*;
@@ -17,18 +15,12 @@
import org.apache.poi.xddf.usermodel.chart.*;
import org.apache.poi.xddf.usermodel.text.XDDFTextBody;
import org.apache.poi.xwpf.usermodel.*;
import org.apache.xmlbeans.XmlException;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTCatAx;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTChart;
import org.openxmlformats.schemas.drawingml.x2006.chart.CTValAx;
import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBody;
import org.redisson.api.RBucket;
import org.redisson.api.RedissonClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@@ -36,14 +28,11 @@
import org.w3c.dom.Element;
import org.xml.sax.SAXException;
import javax.annotation.PostConstruct;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import java.io.*;
import java.lang.reflect.Field;
import java.net.URL;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
@@ -93,11 +82,12 @@
    private MonitorDailyReportService monitorDailyReportService;
    @Scheduled(cron = "0 0 2 * * ?") //每天两点执行一次
//    @Scheduled(cron = "0 0/1 * * * ? ")    // 分钟
    @Async(value = "SocketTaskExecutor")
    public void generateDailyReport() {
        LocalDateTime now = LocalDateTime.now();
        String startTime = now.format(execformatter);
        RBucket<List<GasCategory>> bucket = redissonClient.getBucket("gas_category_cache_info");
        RBucket<List<GasCategory>> bucket = redissonClient.getBucket(SystemCacheKeyEnum.KEY_GAS_CATEGORY.getKey());
        List<GasCategory> gasCategories = bucket.get();
        serialNumber = 4;
        logger.info("【##】开始生成日报 ,时间:"+startTime);