package com.qmth.sop.business.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.qmth.sop.business.bean.result.DingApplyDoneResult;
import com.qmth.sop.business.bean.result.DingApplyUnDoneResult;
import com.qmth.sop.business.bean.result.TBDingApplyViewResult;
import com.qmth.sop.business.entity.TBDingApply;
import com.qmth.sop.common.enums.DingExceptionApproveEnum;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 考勤补卡申请表 服务类
 * </p>
 *
 * @author wangliang
 * @since 2023-08-01
 */
public interface TBDingApplyService extends IService<TBDingApply> {

    /**
     * 新增考勤异常补卡申请
     *
     * @param tbDingApply
     * @return
     * @throws InterruptedException
     */
    Boolean saveDingApply(TBDingApply tbDingApply) throws Exception;

    /**
     * 异常待审核接口
     *
     * @param iPage
     * @param serviceId
     * @param name
     * @param supplierId
     * @param customName
     * @param startTime
     * @param endTime
     * @param applyStartTime
     * @param applyEndTime
     * @return
     */
    IPage<DingApplyUnDoneResult> flowTaskUnDoneList(IPage<Map> iPage, Long serviceId, String name, Long supplierId, String customName, Long startTime, Long endTime, Long applyStartTime, Long applyEndTime) throws Exception;

    /**
     * 异常已审核接口
     *
     * @param iPage
     * @param serviceId
     * @param name
     * @param supplierId
     * @param dingExceptionApprove
     * @param customName
     * @param startTime
     * @param endTime
     * @param applyStartTime
     * @param applyEndTime
     * @return
     */
    IPage<DingApplyDoneResult> flowTaskDoneList(IPage<Map> iPage, Long serviceId, String name, Long supplierId, DingExceptionApproveEnum dingExceptionApprove, String customName, Long startTime, Long endTime, Long applyStartTime, Long applyEndTime) throws Exception;

    /**
     * 考勤异常审核接口
     *
     * @param taskId
     * @param dingExceptionApprove
     * @param userId
     * @return
     */
    Boolean flowApprove(Long taskId, DingExceptionApproveEnum dingExceptionApprove, Long userId) throws InterruptedException;

    /**
     * 更新考勤异常打卡时间
     *
     * @param tbDingApply
     * @param dingExceptionApprove
     * @return
     */
    Boolean updateDingExceptionTime(TBDingApply tbDingApply, DingExceptionApproveEnum dingExceptionApprove);

    /**
     * 考勤异常审核接口
     *
     * @param taskIds
     * @param dingExceptionApprove
     * @param userId
     * @return
     */
    Boolean flowBatchApprove(List<Long> taskIds, DingExceptionApproveEnum dingExceptionApprove, Long userId) throws InterruptedException;

    /**
     * 审批公用方法
     *
     * @param taskId
     * @param userId
     * @param dingExceptionApprove
     * @return
     * @throws InterruptedException
     */
    public Boolean taskApprove(Long taskId, Long userId, DingExceptionApproveEnum dingExceptionApprove) throws InterruptedException;

    /**
     * 考勤异常申请详情接口
     *
     * @param id
     * @return
     */
    TBDingApplyViewResult view(Long id);
}
