| | |
| | | String startTime = now.format(execformatter); |
| | | RBucket<List<GasCategory>> bucket = redissonClient.getBucket("gas_category_cache_info"); |
| | | List<GasCategory> gasCategories = bucket.get(); |
| | | //logger.info("【##】开始生成日报 ,时间:"+startTime); |
| | | logger.info("【##】开始生成日报 ,时间:"+startTime); |
| | | OPCPackage opcPackage = null; |
| | | //加载文档 |
| | | XWPFDocument doc = null; |
| | |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | List<GasConcentration> gasConcentrations = gasConcentrationService.listDatabyTimeSlot(LocalDateTime.now().minusDays(2).with(LocalDate.MIN), LocalDateTime.now()); |
| | | 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++) { |
| | | String series = gasCategories.get(i).getMolecularFormula() + "浓度观测结果"; |
| | |
| | | } |
| | | } |
| | | |
| | | List<GasFlux> gasFluxes = gasFluxService.listYesterday(); |
| | | //List<GasFlux> gasFluxes = gasFluxService.listYesterday(); |
| | | List<GasFlux> gasFluxes = gasFluxService.listYesterdayTenAmToSixPm(); |
| | | List<Integer> areaNum = gasFluxes.stream().map(GasFlux::getAreaId).distinct().collect(Collectors.toList()); |
| | | |
| | | List<Region> allRegion = regionService.findAll(); |
| | |
| | | Map<Integer, String> regionMap = allRegion.stream() |
| | | .collect(Collectors.toMap(Region::getId, Region::getName)); |
| | | if (!CollectionUtils.isEmpty(gasFluxes)) { |
| | | for (int i = 1; i <= 1; i++) { |
| | | for (int j = 0; j < 1; j++) { |
| | | for (int i = 1; i <= areaNum.size(); i++) { |
| | | for (int j = 0; j < 20; j++) { |
| | | drawBarChart(gasFluxes, fileurl, regionMap.get(i), "柱形图" + gasCategories.get(j).getMolecularFormula(), i, j + 1); |
| | | } |
| | | } |
| | |
| | | MonitorDailyReport save = monitorDailyReportService.save(report); |
| | | if (save == null) |
| | | throw new BusinessException(this.getClass(), ResultCode.SYSTEM_ERROR_DATABASE_FAIL,"日常报表保存失败"); |
| | | //logger.info("【##】日报生成成功!!! ,时间:"+endTime+",所耗时间: "+execTime+"s"); |
| | | logger.info("【##】日报生成成功!!! ,时间:"+endTime+",所耗时间: "+execTime+"s"); |
| | | } |
| | | |
| | | public void drawBarChart(List<GasFlux> gasFluxes,String fileurl,String series,String molecularFormula,Integer i,Integer j) { |
| | |
| | | private Map<String, Object> dataMap(List<GasCategory> gasCategories){ |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | String today = now.format(formatter); |
| | | String yesterday = LocalDateTime.now().plusDays(1).format(formatter); |
| | | String yesterday = LocalDateTime.now().minusDays(1).format(formatter); |
| | | //要替换的map,key为占位符,value为要被替换的值 |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("${today}", today); |