# SvaScheduleHoursPostProcessor.java

    package cloud.wconnect.workperformance.businesstask.sva.actualscheduledhours;

    import cloud.wconnect.commonlib.businesstask.postprocessor.IReportMissedPostProcessor;
    import cloud.wconnect.commonlib.cons.BaseConstant;
    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.workperformance.cons.BusinessEnum;
    import cloud.wconnect.workperformance.cons.EventSubjectEnum;
    import cloud.wconnect.workperformance.cons.sva.SvaNotifyTypeEnum;
    import cloud.wconnect.workperformance.cons.sva.SvaReportTypeCons;
    import cloud.wconnect.workperformance.service.sva.actualschedulehour.IAttendanceActualScheduleHourImportLogService;
    import cloud.wconnect.workperformance.service.sva.scheduleactual.ISvaSchedulerService;
    import jakarta.annotation.Resource;
    import org.springframework.stereotype.Component;

    import java.util.Map;

    /**
     * Attendance For Schedule Hours 报告缺失后续逻辑处理
     *
     * @author yyt
     * @date 2025/03/26
     */
    @Component
    public class SvaScheduleHoursPostProcessor implements IReportMissedPostProcessor {
        @Resource
        private ISvaSchedulerService schedulerService;
        @Resource
        private IAttendanceActualScheduleHourImportLogService importLogService;

        /**
         * 校验是否支持
         *
         * @param reportMissedDTO 报告缺失后置处理程序 DTO
         * @return false： 不支持；true：支持
         * @author yyt
         * @date 2025/03/26
         */
        @Override
        public boolean supports(ReportMissedDTO reportMissedDTO) {
            return reportMissedDTO.getSubject().equals(EventSubjectEnum.ATTENDANCE_AV_SCHEDULE_HOURS.getSubject())
                    && reportMissedDTO.getBusiness().equals(BusinessEnum.SVA_AV_HOURS.getBusiness());
        }

        /**
         * 后置处理
         *
         * @param reportMissedDTO 报告缺失后置处理程序 DTO
         * @author yyt
         * @date 2025/03/26
         */
        @Override
        public void afterPostProcess(ReportMissedDTO reportMissedDTO) {
            PropertyDTO property = reportMissedDTO.getPropertyDTO();
            Map<String, Long> dateRange = schedulerService.getDateRange(property, SvaNotifyTypeEnum.MISSING_REPORT_AV_SCHEDULE.getType());
            if (dateRange.isEmpty()) {
                return;
            }
            importLogService.add(property, dateRange.get(JobParameterDTO.START_DATE), dateRange.get(JobParameterDTO.END_DATE),
                    ReportImportResultCons.IMPORT_RESULT_MISSED, BaseConstant.ZERO, null, SvaReportTypeCons.SCHEDULE_HOUR);
        }

    }