| | |
| | | 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()])); |
| | | } |
| | |
| | | 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; |
| | | } |