16639036659
2024-04-10 b15ad90d858e5b6745f76921054b5d5a62b59627
日报:添加C2H6,C3H8浓度曲线;删除流量无数据柱状图
已修改5个文件
已添加2个文件
36 ■■■■ 文件已修改
src/main/java/com/gkhy/fourierSpecialGasMonitor/repository/GasCategoryRepository.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gkhy/fourierSpecialGasMonitor/schedule/DailyReportSchedule.java 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gkhy/fourierSpecialGasMonitor/service/GasCategoryService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gkhy/fourierSpecialGasMonitor/service/impl/GasCategoryServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/template/dailyReportTemplate.docx 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/template/dailyReportTemplate_bak20240409.docx 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/template/dailyReportTemplate_bak20240410柱状图删减前.docx 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gkhy/fourierSpecialGasMonitor/repository/GasCategoryRepository.java
@@ -5,10 +5,16 @@
import com.gkhy.fourierSpecialGasMonitor.entity.GasFlux;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface GasCategoryRepository extends JpaRepository<GasCategory,Integer>, JpaSpecificationExecutor<GasCategory> {
    GasCategory findByMolecularFormula(String molecularFormula);
    @Query(value = "select t from GasCategory t where t.id <= 3")
    List<GasCategory> findGasCategoryForReport();
}
src/main/java/com/gkhy/fourierSpecialGasMonitor/schedule/DailyReportSchedule.java
@@ -35,6 +35,7 @@
import java.lang.reflect.Field;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.Month;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.*;
@@ -80,6 +81,9 @@
    @Autowired
    private MonitorDailyReportService monitorDailyReportService;
    @Autowired
    private GasCategoryService gasCategoryService;
    @Scheduled(cron = "0 0 2 * * ?") //每天两点执行一次
//    @Scheduled(cron = "0 0/1 * * * ? ")    // 分钟
@@ -183,9 +187,10 @@
        }
        List<GasConcentration> gasConcentrations = gasConcentrationService.listDatabyTimeSlot(LocalDateTime.of(now.minusDays(1).toLocalDate(), LocalTime.MIN)
                ,  LocalDateTime.of(now.minusDays(1).toLocalDate(), LocalTime.MAX));
        // 绘制折线图
        if (!CollectionUtils.isEmpty(gasConcentrations)) {
            //for (int i = 0; i < 30; i++) {
            for (int i = 0; i < gasCategories.size(); i++) {
            List<GasCategory> gasCategoryForReport = gasCategoryService.findGasCategoryForReport();
            for (int i = 0; i < gasCategoryForReport.size(); i++) {
                String series = gasCategories.get(i).getMolecularFormula() + "浓度观测结果";
                String title = gasCategories.get(i).getMolecularFormula();
                drawLineChart(gasConcentrations, fileurl, series, title, gasCategories.get(i).getMolecularFormula(), i);
@@ -200,16 +205,24 @@
            throw new BusinessException(this.getClass(), ResultCode.SYSTEM_ERROR_DATABASE_FAIL.getCode(),"区域信息为空");
        Map<Integer, String> regionMap = allRegion.stream()
                .collect(Collectors.toMap(Region::getId, Region::getName));
        // 绘制柱状图
        if (!CollectionUtils.isEmpty(gasFluxes)) {
            for (int j = 0; j < gasCategories.size(); j++) {
//            for (int j = 0; j < gasCategories.size(); j++) {
//                for (int i = 1; i <= areaNum.size(); i++) {
//                    //for (int j = 0; j < 20; j++) {
//                    int finalI = i;
//                    List<GasFlux> gasFluxesByArea = gasFluxes.stream().filter(gasFlux -> gasFlux.getAreaId() == finalI)
//                            .collect(Collectors.toList());
//                    drawBarChart(gasFluxesByArea, fileurl, regionMap.get(i), gasCategories.get(j).getMolecularFormula(), i, j + 1);
//                }
//            }
                for (int i = 1; i <= areaNum.size(); i++) {
                    //for (int j = 0; j < 20; j++) {
                    int finalI = i;
                    List<GasFlux> gasFluxesByArea = gasFluxes.stream().filter(gasFlux -> gasFlux.getAreaId() == finalI)
                            .collect(Collectors.toList());
                    drawBarChart(gasFluxesByArea, fileurl, regionMap.get(i), gasCategories.get(j).getMolecularFormula(), i, j + 1);
                    drawBarChart(gasFluxesByArea, fileurl, regionMap.get(i), gasCategories.get(0).getMolecularFormula(), i, 1);
                }
            }
        }
        String endTime = LocalDateTime.now().format(execformatter);
        long execTime = ChronoUnit.SECONDS.between(now, LocalDateTime.now());
src/main/java/com/gkhy/fourierSpecialGasMonitor/service/GasCategoryService.java
@@ -24,4 +24,6 @@
    Result findGasCategoryPage(PageQuery<FindGasCategoryPageQuery> pageQuery);
    GasCategory findById(Integer id);
    List<GasCategory> findGasCategoryForReport();
}
src/main/java/com/gkhy/fourierSpecialGasMonitor/service/impl/GasCategoryServiceImpl.java
@@ -178,6 +178,11 @@
    }
    @Override
    public List<GasCategory> findGasCategoryForReport() {
        return gasCategoryRepository.findGasCategoryForReport();
    }
    @Override
    public Result gasCategoryList() {
        Result success = Result.success();
        RBucket<List<GasCategory>> bucket = redissonClient.getBucket(SystemCacheKeyEnum.KEY_GAS_CATEGORY.getKey());
src/main/resources/template/dailyReportTemplate.docx
Binary files differ
src/main/resources/template/dailyReportTemplate_bak20240409.docx
Binary files differ
src/main/resources/template/dailyReportTemplate_bak20240410柱状图删减前.docx
Binary files differ