# TaCreditCardPostProcessor.java

    package cloud.wconnect.finance.businesstask.ta.creditcard;

    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.finance.cons.BusinessEnum;
    import cloud.wconnect.finance.cons.EventSubjectEnum;
    import cloud.wconnect.finance.cons.ta.TaNotifyTypeEnum;
    import cloud.wconnect.finance.cons.ta.TaReportTypeCons;
    import cloud.wconnect.finance.service.ta.ITaImportLogService;
    import cloud.wconnect.finance.service.ta.ITaSchedulerService;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.stereotype.Component;

    import java.util.Map;

    /**
     * TA Credit card 报告缺失后置处理逻辑
     *
     * @author zc
     * @date 2023/08/14
     */
    @Component
    public class TaCreditCardPostProcessor implements IReportMissedPostProcessor {

        @Autowired
        private ITaImportLogService importLogService;
        @Autowired
        private ITaSchedulerService schedulerService;

        /**
         * 是否支持
         *
         * @param reportMissedDTO 报告缺失的dto
         * @return true：支持；false：不支持
         * @author zc
         * @date 2023/8/14
         */
        @Override
        public boolean supports(ReportMissedDTO reportMissedDTO) {
            return reportMissedDTO.getSubject().equals(EventSubjectEnum.CREDIT_CARD.getSubject())
                    && reportMissedDTO.getBusiness().equals(BusinessEnum.TA.getBusiness());
        }

        /**
         * 后置处理（记录异常日志）
         *
         * @param reportMissedDTO 报告缺失的dto
         * @author zc
         * @date 2023/8/14
         */
        @Override
        public void afterPostProcess(ReportMissedDTO reportMissedDTO) {
            PropertyDTO propertyDTO = reportMissedDTO.getPropertyDTO();
            Map<String, Long> dateRange = schedulerService.getDateRange(propertyDTO,
                    TaNotifyTypeEnum.MISSING_REPORT_CREDIT_CARD.getType());
            if (dateRange.isEmpty()) {
                return;
            }
            importLogService.add(propertyDTO, dateRange.get(JobParameterDTO.START_DATE),
                    TaReportTypeCons.CREDIT_CARD, ReportImportResultCons.IMPORT_RESULT_MISSED, BaseConstant.ZERO, null);
        }
    }