# RevenueDailySummaryMarketCodePostProcessor.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.pojo.dto.scheduler.JobParameterDTO;
    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.IRevenueSchedulerJobService;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.stereotype.Component;

    import java.util.Map;

    /**
     * Market Code报告缺失的后置处理器
     *
     * @author lichen
     * @date 2024/3/27
     */
    @Component
    public class RevenueDailySummaryMarketCodePostProcessor implements IReportMissedPostProcessor {

        @Autowired
        private IRevenueImportLogService revenueImportLogService;
        @Autowired
        private IRevenueSchedulerJobService schedulerJobService;

        private static final String SUBJECT = EventSubjectEnum.MARKET_CODE.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 propertyDTO = reportMissedDTO.getPropertyDTO();
            String timezone = propertyDTO.getTimezone();
            //报告数据日期
            Map<String, Long> dateRange = schedulerJobService.getDateRange(propertyDTO, RevenueImportCons.MARKET_CODE);
            revenueImportLogService.handleSaveSystemImportRecord(propertyDTO, RevenueImportCons.MARKET_CODE,
                    DateTimeUtils.dateNow(timezone).toEpochSecond(), dateRange.get(JobParameterDTO.START_DATE), dateRange.get(JobParameterDTO.END_DATE),
                    ReportImportResultCons.IMPORT_RESULT_MISSED, null);
        }
    }