# WMRevenueCancellationSummaryPostProcessor.java

    package cloud.wconnect.rateshop.businesstask.weeklymonthlyrevenue;

    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.rateshop.cons.BusinessEnum;
    import cloud.wconnect.rateshop.cons.EventSubjectEnum;
    import cloud.wconnect.rateshop.cons.weeklymonthlyrevenue.MonthlyRevenueImportCategoryCons;
    import cloud.wconnect.rateshop.cons.weeklymonthlyrevenue.MonthlyRevenueReportCategoryEnum;
    import cloud.wconnect.rateshop.cons.weeklymonthlyrevenue.MonthlyRevenueReportDateRangeEnum;
    import cloud.wconnect.rateshop.service.weeklymonthlyrevenue.IWeeklyMonthlyRevenueImportLogService;
    import cloud.wconnect.rateshop.service.weeklymonthlyrevenue.IWeeklyMonthlyRevenueReportService;
    import jakarta.annotation.Resource;
    import org.springframework.stereotype.Service;

    import java.util.List;

    /**
     * Service: cancellation-summary 报告缺失后置处理类
     *
     * @author zc
     * @date 2024/5/16
     */
    @Service
    public class WMRevenueCancellationSummaryPostProcessor implements IReportMissedPostProcessor {

        @Resource
        private IWeeklyMonthlyRevenueImportLogService importLogService;
        @Resource
        private IWeeklyMonthlyRevenueReportService revenueReportService;
        @Resource
        private PropertyBusinessDateRedisService propertyBusinessDateRedisService;

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

        /**
         * 后置处理
         *
         * @param reportMissedDTO 报告缺失后置处理程序 DTO
         * @author zc
         * @date 2024/5/16
         */
        @Override
        public void afterPostProcess(ReportMissedDTO reportMissedDTO) {
            PropertyDTO propertyDTO = reportMissedDTO.getPropertyDTO();

            // 获取资产业务日期
            long businessDate = propertyBusinessDateRedisService.getEffectiveBusinessDateOrDefault(propertyDTO.getId(), propertyDTO.getTimezone());

            // 报告数据日期
            List<Long> dateRange = revenueReportService.getReportDateRangeByCategory(businessDate, propertyDTO.getTimezone(),
                    MonthlyRevenueReportDateRangeEnum.CANCELLATION_SUMMARY.getDateRange());
            // 保存异常记录
            importLogService.save(propertyDTO, MonthlyRevenueImportCategoryCons.HISTORY, businessDate,
                    dateRange, "", ReportImportResultCons.IMPORT_RESULT_MISSED,
                    MonthlyRevenueReportCategoryEnum.CANCELLATION_SUMMARY.getCategory(), 0);
        }

    }