| | |
| | | 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.*; |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | @Autowired |
| | | private MonitorDailyReportService monitorDailyReportService; |
| | | |
| | | //@Scheduled(cron = "0 0 2 * * ?") //每天两点执行一次 |
| | | @Scheduled(cron = "0/30 * * * * ?") |
| | | @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); |
| | |
| | | logger.info("【##】日报生成成功!!! ,时间:"+endTime+",所耗时间: "+execTime+"s"); |
| | | } |
| | | |
| | | /** |
| | | * @decription 画柱形图 |
| | | * @author Mr.huang |
| | | */ |
| | | public void drawBarChart(List<GasFlux> gasFluxes,String fileurl,String series,String molecularFormula,Integer i,Integer j) { |
| | | List<String> collect = gasFluxes.stream() |
| | | .map(gasFlux -> gasFlux.getTime().format(lineChartXDataDisplay)) |