# RevenueHistoryAndForecastBusinessBlocksPostProcessor.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: History And ForecastPost Business Blocks 报告缺失后续逻辑处理
     *
     * @author yyt
     * 2023/11/3
     */
    @Service
    public class RevenueHistoryAndForecastBusinessBlocksPostProcessor implements IReportMissedPostProcessor {

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

        private static final String SUBJECT = EventSubjectEnum.HISTORY_AND_FORECAST_BUSINESS_BLOCK_NEXT_FOURTEEN_DAY.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();
            List<Long> dates = revenueImportService.listImportHistoryAndForecastBusinessBlockDateRange(timezone);
            revenueImportLogService.handleSaveSystemImportRecord(property, RevenueImportCons.HISTORY_FORECAST_BUSINESS_BLOCK,
                    DateTimeUtils.dateNow(timezone).toEpochSecond(), dates.get(0), dates.get(1), ReportImportResultCons.IMPORT_RESULT_MISSED, null);
        }

    }