# RevenueReservationStatisticsPostProcessor.java

    package cloud.wconnect.rateshop.businesstask.revenue;

    import cloud.wconnect.commonlib.businesstask.postprocessor.IReportMissedPostProcessor;
    import cloud.wconnect.commonlib.cons.ReportImportResultCons;
    import cloud.wconnect.commonlib.pojo.dto.PropertyDTO;
    import cloud.wconnect.commonlib.pojo.dto.ReportMissedDTO;
    import cloud.wconnect.commonlib.util.DateTimeUtils;
    import cloud.wconnect.rateshop.cons.BusinessEnum;
    import cloud.wconnect.rateshop.cons.EventSubjectEnum;
    import cloud.wconnect.rateshop.cons.revenue.RevenueImportCons;
    import cloud.wconnect.rateshop.service.revenue.IRevenueImportLogService;
    import cloud.wconnect.rateshop.service.revenue.IRevenueImportService;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.stereotype.Service;

    import java.time.ZonedDateTime;
    import java.util.List;

    /**
     * Service: Reservation Statistics 报告缺失后续逻辑处理
     *
     * @author yyt
     * 2023/11/3
     */
    @Service
    public class RevenueReservationStatisticsPostProcessor implements IReportMissedPostProcessor {

        @Autowired
        private IRevenueImportLogService revenueImportLogService;
        @Autowired
        private IRevenueImportService revenueImportService;

        private static final String SUBJECT = EventSubjectEnum.RESERVATION_STATISTICS_SERVICE_START_MONTH_YESTERDAY_BEFORE.getSubject();

        private static final String BUSINESS = BusinessEnum.REVENUE.getBusiness();

        /**
         * 判断支持类型
         *
         * @param reportMissedDTO reportMissedDTO
         * @return true:支持，false：不支持
         * @author yyt
         * @date 2026/2/28
         **/
        @Override
        public boolean supports(ReportMissedDTO reportMissedDTO) {
            return reportMissedDTO.getBusiness().equals(BUSINESS) && reportMissedDTO.getSubject().equals(SUBJECT);
        }

        /**
         * 处理报告缺失后续逻辑
         *
         * @param reportMissedDTO reportMissedDTO
         * @author yyt
         * @date 2026/2/28
         **/
        @Override
        public void afterPostProcess(ReportMissedDTO reportMissedDTO) {
            PropertyDTO property = reportMissedDTO.getPropertyDTO();
            String timezone = property.getTimezone();
            ZonedDateTime datNow = DateTimeUtils.dateNow(timezone);
            List<Long> dates = revenueImportService.listImportReservationStatisticsDateRange(property);
            revenueImportLogService.handleSaveSystemImportRecord(property, RevenueImportCons.RESERVATION_STATISTIC,
                    datNow.toEpochSecond(), dates.get(0), dates.get(1), ReportImportResultCons.IMPORT_RESULT_MISSED, null);
        }

    }