package com.qmth.distributed.print.business.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.qmth.distributed.print.business.bean.dto.FinalScoreDto;
import com.qmth.distributed.print.business.bean.result.FinalScoreResult;
import com.qmth.distributed.print.business.entity.TCFinalScore;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 期末考试成绩表 服务类
 * </p>
 *
 * @author wangliang
 * @since 2024-02-18
 */
public interface TCFinalScoreService extends IService<TCFinalScore> {

    /**
     * 导入期末成绩excel
     *
     * @param file
     * @param examId
     * @param courseCode
     * @param paperNumber
     * @param teachCourseId
     * @return
     * @throws IOException
     */
    public Map<String, String> finalScoreExcelImport(MultipartFile file, Long examId, String courseCode, String paperNumber, Long teachCourseId) throws IOException;

    /**
     * 期末成绩列表（分页）
     *
     * @param iPage
     * @param examId
     * @param courseCode
     * @param paperNumber
     * @param teachCourseId
     * @return
     */
    public IPage<TCFinalScore> finalScoreList(IPage<Map> iPage, Long examId, String courseCode, String paperNumber, Long teachCourseId);

    /**
     * 查找期末成绩分数图
     *
     * @param examId
     * @param courseCode
     * @param paperNumber
     * @param teachCourseId
     * @return
     */
    public FinalScoreDto finalScoreScoreOverView(Long examId, String courseCode, String paperNumber, Long teachCourseId);

    /**
     * 查找期末成绩分数区间
     *
     * @param examId
     * @param courseCode
     * @param paperNumber
     * @param teachCourseId
     * @param start
     * @param end
     * @return
     */
    public int getCountByScoreRange(Long examId, String courseCode, String paperNumber, Long teachCourseId, Double start, Double end);

    /**
     * 查找考生成绩
     *
     * @param examId
     * @param courseCode
     * @param paperNumber
     * @param teachCourseId
     * @return
     */
    public List<FinalScoreResult> examStudentOverview(Long examId, String courseCode, String paperNumber, Long teachCourseId);

    /**
     * 同步期末成绩
     *
     * @param examId
     * @param courseCode
     * @param paperNumber
     * @param teachCourseId
     * @return
     * @throws IOException
     */
    public Map<String, String> finalScoreSync(Long examId, String courseCode, String paperNumber, Long teachCourseId) throws IOException;

    /**
     * 根据考试id/课程编码/试卷编码删除数据
     *
     * @param examId
     * @param courseCode
     * @param paperNumber
     * @param teachCourseId
     * @return
     */
    public Boolean remove(Long examId, String courseCode, String paperNumber, Long teachCourseId);

    /**
     * 根据考试id/课程编码/试卷编码查询数据库数据
     *
     * @param examId
     * @param courseCode
     * @param paperNumber
     * @param teachCourseId
     * @return
     */
    public List<TCFinalScore> queryFinalScore(Long examId, String courseCode, String paperNumber, Long teachCourseId);

    /**
     * 获取期末考试同步锁
     *
     * @param examId
     * @param courseCode
     * @param paperNumber
     * @param teachCourseId
     */
    public void getFinalScoreSyncLock(Long examId, String courseCode, String paperNumber, Long teachCourseId);

    /**
     * 获取期末考试导入锁
     *
     * @param examId
     * @param courseCode
     * @param paperNumber
     * @param teachCourseId
     */
    public void getFinalScoreImportLock(Long examId, String courseCode, String paperNumber, Long teachCourseId);
}
