# DbPmsMssLast2DayToLast1DayPostProcessor.java

    package cloud.wconnect.workperformance.businesstask.database;

    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.workperformance.cons.BusinessEnum;
    import cloud.wconnect.workperformance.cons.EventSubjectEnum;
    import cloud.wconnect.workperformance.cons.database.DbPmsReportDataRangeEnum;
    import cloud.wconnect.workperformance.cons.database.DbPmsReportTypeEnum;
    import cloud.wconnect.workperformance.service.database.IDbReportImportLogService;
    import cloud.wconnect.workperformance.service.database.IDbReportService;
    import jakarta.annotation.Resource;
    import org.springframework.stereotype.Service;

    import java.util.List;

    /**
     * Service: market-segment-summary/service--2d--1d 报告缺失后置处理类
     *
     * @author zc
     * @date 2026/3/6
     */
    @Service
    public class DbPmsMssLast2DayToLast1DayPostProcessor implements IReportMissedPostProcessor {

        @Resource
        private IDbReportImportLogService importLogService;
        @Resource
        private IDbReportService reportService;
        @Resource
        private PropertyBusinessDateRedisService businessDateRedisService;

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

        /**
         * 后置处理
         *
         * @param reportMissedDTO 报告缺失后置处理程序 DTO
         * @author zc
         * @date 2026/3/6
         */
        @Override
        public void afterPostProcess(ReportMissedDTO reportMissedDTO) {
            PropertyDTO propertyDTO = reportMissedDTO.getPropertyDTO();
            long businessDate = businessDateRedisService.getEffectiveBusinessDateOrDefault(propertyDTO.getId(), propertyDTO.getTimezone());
            // 报告数据日期
            List<Long> dateRange = reportService.getDateRange(businessDate, DbPmsReportDataRangeEnum.MSS_LAST_2_DAY_TO_LAST_1_DAY.getType());
            // 保存异常记录
            importLogService.save(propertyDTO, businessDate, dateRange, "", ReportImportResultCons.IMPORT_RESULT_MISSED,
                    DbPmsReportTypeEnum.MARKET_SEGMENT_SUMMARY.getType(), 0);
        }

    }