# MorOvertimeWorkHourMtdYesterdayPostProcessor.java

    package cloud.wconnect.workperformance.businesstask.mor.overtime;

    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.mor.MorNotifyTypeEnum;
    import cloud.wconnect.workperformance.pojo.dto.mor.overtime.OvertimeImportReportDTO;
    import cloud.wconnect.workperformance.service.mor.IMorSchedulerService;
    import cloud.wconnect.workperformance.service.mor.IOvertimeImportLogService;
    import org.springframework.stereotype.Component;

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

    /**
     * Mor Overtime 加班工时报告 MTD ~ -1 缺失后续逻辑处理
     *
     * @author zc
     * @date 2025/03/15
     */
    @Component
    public class MorOvertimeWorkHourMtdYesterdayPostProcessor implements IReportMissedPostProcessor {
        @Resource
        private IOvertimeImportLogService overtimeImportLogService;
        @Resource
        private IMorSchedulerService schedulerService;

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

        /**
         * 后置处理
         *
         * @param reportMissedDTO 报告缺失后置处理程序 DTO
         * @author zc
         * @date 2025/3/15
         */
        @Override
        public void afterPostProcess(ReportMissedDTO reportMissedDTO) {
            PropertyDTO propertyDTO = reportMissedDTO.getPropertyDTO();
            Map<String, Long> dateRange = schedulerService.getDateRange(propertyDTO,
                    MorNotifyTypeEnum.MISSING_REPORT_WORK_HOUR_MTD_YESTERDAY.getType());
            if (dateRange.isEmpty()) {
                return;
            }
            overtimeImportLogService.add(propertyDTO, dateRange.get(JobParameterDTO.START_DATE), dateRange.get(JobParameterDTO.END_DATE),
                    OvertimeImportReportDTO.ATTENDANCE_WORK_HOUR_REPORT, ReportImportResultCons.IMPORT_RESULT_MISSED, BaseConstant.ZERO, null);
        }

    }