# RateShopHistoryAndForecastPostProcessor.java

    package cloud.wconnect.rateshop.businesstask.rateshop;

    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.rateshop.cons.BusinessEnum;
    import cloud.wconnect.rateshop.cons.EventSubjectEnum;
    import cloud.wconnect.rateshop.cons.rateshop.RateShopNotifyConfigTypeEnum;
    import cloud.wconnect.rateshop.pojo.dto.rateshop.ReportImportDTO;
    import cloud.wconnect.rateshop.service.rateshop.IRateShopSchedulerService;
    import cloud.wconnect.rateshop.service.rateshop.IReportImportLogService;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.stereotype.Service;

    import java.util.Map;

    /**
     * Service: History And ForecastPost 报告缺失后置处理类
     *
     * @author lichen
     * 2023/12/4
     */
    @Service
    public class RateShopHistoryAndForecastPostProcessor implements IReportMissedPostProcessor {

        @Autowired
        private IReportImportLogService reportLogService;
        @Autowired
        private IRateShopSchedulerService schedulerService;

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

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

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

        @Override
        public void afterPostProcess(ReportMissedDTO reportMissedDTO) {
            PropertyDTO propertyDTO = reportMissedDTO.getPropertyDTO();
            //报告数据日期
            Map<String, Long> dateRange = schedulerService.getDateRange(propertyDTO, RateShopNotifyConfigTypeEnum.HISTORY_AND_FORECAST_REPORT_MISSED.getType());
            //保存异常
            reportLogService.save(propertyDTO, dateRange, "", ReportImportResultCons.IMPORT_RESULT_MISSED,
                    RateShopNotifyConfigTypeEnum.HISTORY_AND_FORECAST_REPORT_MISSED.getType(), 0);
        }

    }