# WMRevenueReservationForecastPostProcessor.java

    package cloud.wconnect.rateshop.businesstask.weeklymonthlyrevenue;

    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.redis.PropertyBusinessDateRedisService;
    import cloud.wconnect.rateshop.cons.BusinessEnum;
    import cloud.wconnect.rateshop.cons.EventSubjectEnum;
    import cloud.wconnect.rateshop.cons.weeklymonthlyrevenue.MonthlyRevenueImportCategoryCons;
    import cloud.wconnect.rateshop.cons.weeklymonthlyrevenue.MonthlyRevenueReportCategoryEnum;
    import cloud.wconnect.rateshop.cons.weeklymonthlyrevenue.MonthlyRevenueReportDateRangeEnum;
    import cloud.wconnect.rateshop.service.weeklymonthlyrevenue.IWeeklyMonthlyRevenueImportLogService;
    import cloud.wconnect.rateshop.service.weeklymonthlyrevenue.IWeeklyMonthlyRevenueReportService;
    import jakarta.annotation.Resource;
    import org.springframework.stereotype.Service;

    import java.util.List;

    /**
     * Service: reservation-forecast 报告缺失后置处理类
     *
     * @author zc
     * @date 2024/5/16
     */
    @Service
    public class WMRevenueReservationForecastPostProcessor implements IReportMissedPostProcessor {

        @Resource
        private IWeeklyMonthlyRevenueImportLogService importLogService;
        @Resource
        private IWeeklyMonthlyRevenueReportService revenueReportService;
        @Resource
        private PropertyBusinessDateRedisService propertyBusinessDateRedisService;

        /**
         * 是否支持
         *
         * @param reportMissedDTO 报告缺失后置处理程序 DTO
         * @return boolean
         * @author zc
         * @date 2024/5/16
         */
        @Override
        public boolean supports(ReportMissedDTO reportMissedDTO) {
            return reportMissedDTO.getBusiness().equals(BusinessEnum.WEEKLY_MONTHLY_REVENUE.getBusiness())
                    && reportMissedDTO.getSubject().equals(EventSubjectEnum.RESERVATION_FORECAST_TODAY_ONE_HUNDRED_DAYS.getSubject());
        }

        /**
         * 后置处理
         *
         * @param reportMissedDTO 报告缺失后置处理程序 DTO
         * @author zc
         * @date 2024/5/16
         */
        @Override
        public void afterPostProcess(ReportMissedDTO reportMissedDTO) {
            PropertyDTO propertyDTO = reportMissedDTO.getPropertyDTO();

            // 获取资产业务日期
            long businessDate = propertyBusinessDateRedisService.getEffectiveBusinessDateOrDefault(propertyDTO.getId(), propertyDTO.getTimezone());

            // 报告数据日期
            List<Long> dateRange = revenueReportService.getReportDateRangeByCategory(businessDate, propertyDTO.getTimezone(),
                    MonthlyRevenueReportDateRangeEnum.RESERVATION_FORECAST.getDateRange());

            importLogService.save(propertyDTO, MonthlyRevenueImportCategoryCons.FORECAST, businessDate,
                    dateRange, "", ReportImportResultCons.IMPORT_RESULT_MISSED,
                    MonthlyRevenueReportCategoryEnum.RESERVATION_FORECAST.getCategory(), 0);
        }

    }