zhangf
2024-09-11 d4020168658efdee89a633083cd9c14b06c4d863
src/main/java/com/gkhy/fourierSpecialGasMonitor/service/impl/MonitorDailyReportServiceImpl.java
@@ -58,7 +58,7 @@
                    LocalDate firstDayOfMonth = LocalDate.of(searchParams.getYear(), searchParams.getMonth(), 1);
                    // 获取指定月份的最后一天
                    LocalDate lastDayOfMonth = LocalDate.of(searchParams.getYear(), searchParams.getMonth(), 1).with(TemporalAdjusters.lastDayOfMonth());
                    predicateList.add(criteriaBuilder.between(root.get("gmtCreate").as(LocalDateTime.class),firstDayOfMonth,lastDayOfMonth));
                    predicateList.add(criteriaBuilder.between(root.get("gmtCreate").as(LocalDate.class),firstDayOfMonth,lastDayOfMonth));
                }
                return criteriaBuilder.and(predicateList.toArray(new Predicate[predicateList.size()]));
            }
@@ -71,9 +71,12 @@
        searchResult.setTotal(pageResult.getTotalElements());
        searchResult.setPages(pageResult.getTotalPages());
        if (!CollectionUtils.isEmpty(pageResult.getContent())){
            List<FindDailyReportPageRespDTO> respDTOS = new ArrayList<>();
            BeanUtils.copyProperties(pageResult.getContent(),respDTOS);
            searchResult.setData(respDTOS);
            List<FindDailyReportPageRespDTO> dtos = pageResult.getContent().stream().map(monitorDailyReport -> {
                FindDailyReportPageRespDTO dto = new FindDailyReportPageRespDTO();
                BeanUtils.copyProperties(monitorDailyReport, dto);
                return dto;
            }).collect(Collectors.toList());
            searchResult.setData(dtos);
        }
        return searchResult;
    }