# SvaActualHoursPostProcessor.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 org.springframework.stereotype.Component;

    import jakarta.annotation.Resource;
    import java.util.Map;

    /**
     * Attendance For Actual Hours 报告缺失后续逻辑处理
     *
     * @author zc
     * @date 2023/09/26
     */
    @Component
    public class SvaActualHoursPostProcessor implements IReportMissedPostProcessor {
        @Resource
        private ISvaSchedulerService schedulerService;
        @Resource
        private IAttendanceActualScheduleHourImportLogService importLogService;

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

        /**
         * 后置处理
         *
         * @param reportMissedDTO 报告缺失后置处理程序 DTO
         * @author zc
         * @date 2023/9/26
         */
        @Override
        public void afterPostProcess(ReportMissedDTO reportMissedDTO) {
            PropertyDTO property = reportMissedDTO.getPropertyDTO();
            Map<String, Long> dateRange = schedulerService.getDateRange(property, SvaNotifyTypeEnum.MISSING_REPORT_AV_ACTUAL.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.ACTUAL_HOUR);
        }

    }