# RateShopMarketSegmentSummaryPostProcessor.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.service.rateshop.IRateShopSchedulerService;
    import cloud.wconnect.rateshop.service.rateshop.IReportImportLogService;
    import lombok.RequiredArgsConstructor;
    import lombok.extern.slf4j.Slf4j;
    import org.apache.commons.collections.MapUtils;
    import org.apache.logging.log4j.util.Strings;
    import org.springframework.stereotype.Service;

    import java.util.Map;

    /**
     * Service: Market Segment Summary 报告缺失后置处理类
     *
     * @author yyt
     * 2026/3/10
     */
    @RequiredArgsConstructor
    @Slf4j
    @Service
    public class RateShopMarketSegmentSummaryPostProcessor implements IReportMissedPostProcessor {

        private final IReportImportLogService reportLogService;
        private final IRateShopSchedulerService schedulerService;

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

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

        /**
         * 是否支持
         *
         * @param reportMissedDTO 缺失报告
         * @return boolean
         * @author yyt
         * @date 2026/3/10
         **/
        @Override
        public boolean supports(ReportMissedDTO reportMissedDTO) {
            return reportMissedDTO.getBusiness().equals(BUSINESS) && reportMissedDTO.getSubject().equals(SUBJECT);
        }

        /**
         * 后置处理
         *
         * @param reportMissedDTO 缺失报告
         * @author yyt
         * @date 2026/3/10
         **/
        @Override
        public void afterPostProcess(ReportMissedDTO reportMissedDTO) {
            PropertyDTO propertyDTO = reportMissedDTO.getPropertyDTO();
            //报告数据日期
            Map<String, Long> dateRange = schedulerService.getDateRange(propertyDTO, RateShopNotifyConfigTypeEnum.MARKET_SEGMENT_SUMMARY_REPORT_MISSED.getType());
            if (MapUtils.isEmpty(dateRange)) {
                log.warn("RateShopMarketSegmentSummaryServiceTask.checkReportMissing end... no date range");
                return;
            }

            //保存异常
            reportLogService.save(propertyDTO, dateRange, Strings.EMPTY, ReportImportResultCons.IMPORT_RESULT_MISSED,
                    RateShopNotifyConfigTypeEnum.MARKET_SEGMENT_SUMMARY_REPORT_MISSED.getType(), 0);
        }

    }