|  |  | 
 |  |  |  | 
 |  |  | import javax.servlet.http.HttpServletResponse; | 
 |  |  | import java.net.URLEncoder; | 
 |  |  | import java.time.LocalDate; | 
 |  |  | import java.time.LocalDateTime; | 
 |  |  | import java.time.LocalTime; | 
 |  |  | import java.util.ArrayList; | 
 |  |  | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public Page<OrderPartnerReportResultVO> getPartnerSalePage(Page page, QueryPartnerOrderDTO dto) { | 
 |  |  |  | 
 |  |  |         if(null!=dto.getPaymentDateStart()) | 
 |  |  |             dto.setStartDate(calculateStartTime(dto.getPaymentDateStart())); | 
 |  |  |         if(null!=dto.getPaymentDateEnd()) | 
 |  |  |             dto.setEndDate(calculateEndTime(dto.getPaymentDateEnd())); | 
 |  |  |         Page<OrderPartnerReportResultVO> result=orderReportMapper.getPartnerOrderDateReportPage(page,dto); | 
 |  |  |         return result; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public OrderPartnerReportResultVO getPartnerSaleStatis(QueryPartnerOrderDTO dto) { | 
 |  |  |         if(null!=dto.getPaymentDateStart()) | 
 |  |  |             dto.setStartDate(calculateStartTime(dto.getPaymentDateStart())); | 
 |  |  |         if(null!=dto.getPaymentDateEnd()) | 
 |  |  |             dto.setEndDate(calculateEndTime(dto.getPaymentDateEnd())); | 
 |  |  |         OrderPartnerReportResultVO vo2=orderReportMapper.getPartnerOrderDateReportStatis(dto); | 
 |  |  |         return vo2; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public void exportPartnerSalesList(HttpServletResponse response, QueryPartnerOrderDTO dto) { | 
 |  |  |  | 
 |  |  |         if(null!=dto.getPaymentDateStart()) | 
 |  |  |             dto.setStartDate(calculateStartTime(dto.getPaymentDateStart())); | 
 |  |  |         if(null!=dto.getPaymentDateEnd()) | 
 |  |  |             dto.setEndDate(calculateEndTime(dto.getPaymentDateEnd())); | 
 |  |  |  | 
 |  |  |         List<OrderPartnerReportResultVO> list = orderReportMapper.getPartnerOrderDateReportList(dto); | 
 |  |  |  | 
 |  |  |  | 
 |  |  | 
 |  |  |         LocalDateTime endOfDay = endDateTime.with(LocalTime.of(17, 0, 0)); | 
 |  |  |         return endOfDay; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     // 计算 startDate 前一天的 17:00:00 | 
 |  |  |     public static LocalDateTime calculateStartTime(LocalDate startDate) { | 
 |  |  |         // 获取前一天的日期,并将时间设为 17:00:00 | 
 |  |  |         LocalDateTime previousDay = startDate.minusDays(1).atTime(LocalTime.of(17, 0, 0)); | 
 |  |  |         return previousDay; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     // 计算 endDate 当天的 17:00:00 | 
 |  |  |     public static LocalDateTime calculateEndTime(LocalDate endDate) { | 
 |  |  |         // 将时间部分固定为 17:00:00 | 
 |  |  |         LocalDateTime endOfDay = endDate.atTime(LocalTime.of(17, 0, 0)); | 
 |  |  |         return endOfDay; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } | 
 |  |  |    |