# RevenueReservationForecastNextMonthPostProcessor.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.util.List;

    /**
     * Service: Reservation Forecast Next Month 报告缺失后续逻辑处理
     *
     * @author yyt
     * 2023/11/4
     */
    @Service
    public class RevenueReservationForecastNextMonthPostProcessor implements IReportMissedPostProcessor {

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

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

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

        @Override
        public boolean supports(ReportMissedDTO reportMissedDTO) {
            return reportMissedDTO.getBusiness().equals(BUSINESS) && reportMissedDTO.getSubject().equals(SUBJECT);
        }

        @Override
        public void afterPostProcess(ReportMissedDTO reportMissedDTO) {
            PropertyDTO property = reportMissedDTO.getPropertyDTO();
            String timezone = property.getTimezone();
            List<Long> dates = revenueImportService.listImportReservationForecastNextMonthDateRange(timezone);
            revenueImportLogService.handleSaveSystemImportRecord(property, RevenueImportCons.RESERVATION_FORECAST_NEXT_MONTH,
                    DateTimeUtils.dateNow(timezone).toEpochSecond(), dates.get(0), dates.get(1), ReportImportResultCons.IMPORT_RESULT_MISSED, null);
        }

    }