package com.qmth.themis.business.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.qmth.themis.business.bean.admin.ExamInfoBean;
import com.qmth.themis.business.cache.bean.ExamStudentCacheBean;
import com.qmth.themis.business.dto.MarkResultSimpleExportDto;
import com.qmth.themis.business.dto.response.MarkResultDto;
import com.qmth.themis.business.dto.response.RoomCodeQueryDto;
import com.qmth.themis.business.dto.response.TEExamStudentDto;
import com.qmth.themis.business.entity.TEExamStudent;

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

/**
 * @Description: 考生库 服务类
 * @Param:
 * @return:
 * @Author: wangliang
 * @Date: 2020/6/25
 */
public interface TEExamStudentService extends IService<TEExamStudent> {

    /**
     * 查询考生信息
     *
     * @param iPage
     * @param examId
     * @param examActivityId
     * @param identity
     * @param name
     * @param roomCode
     * @param courseCode
     * @param grade
     * @param enable
     * @param classNo
     * @return
     */
    public IPage<TEExamStudentDto> examStudentQuery(IPage<Map> iPage, Long examId, Long examActivityId, String identity, String name, String roomCode, String courseCode, String grade, Integer enable, String classNo, Integer hasPhoto);

    ExamStudentCacheBean getExamStudentCacheBean(Long examStudentId);

    /**
     * 更新考生缓存
     *
     * @param examStudentId
     * @return
     */
    ExamStudentCacheBean updateExamStudentCacheBean(Long examStudentId);

    /**
     * 删除考生缓存
     *
     * @param examStudentId
     */
    void deleteExamStudentCacheBean(Long examStudentId);

    /**
     * 考场查询
     *
     * @param roomName
     * @return
     */
    public List<RoomCodeQueryDto> examRoomQuery(String roomName);

    void updateByMqMsg(Map<String, Object> param);

    /**
     * 查询学生成绩信息
     *
     * @param iPage
     * @param examId
     * @param examActivityId
     * @param identity
     * @param name
     * @param courseCode
     * @return
     */
    public IPage<MarkResultDto> markResultQuery(IPage<Map> iPage, Long examId, Long examActivityId, String identity, String name, String courseCode);

    /**
     * 查询学生成绩信息(分页导出用)
     *
     * @param iPage
     * @param examId
     * @param examActivityId
     * @param identity
     * @param name
     * @param courseCode
     * @return
     */
    public IPage<MarkResultSimpleExportDto> markResultQueryExportIpage(IPage<Map> iPage, Long examId, Long examActivityId, String identity, String name, String courseCode);

    public List<TEExamStudentDto> findExamStudentNeedMark(Long examId, String courseCode, Long idGt, Integer count);

    /**
     * 获取所有待阅卷的考生
     *
     * @param examId
     * @param examPaperIdSet
     * @param examStudentBreachPush
     * @return
     */
    public List<TEExamStudent> findExamStudentNeedMarkAll(Long examId, Set<Long> examPaperIdSet, Boolean examStudentBreachPush);

    /**
     * 更新学生缓存
     *
     * @param examStudentId
     */
    public void updateExamStudentByCache(Long examStudentId);

    /**
     * 获取考试次数为0的考生
     *
     * @param examId
     * @param examActivityId
     * @param id
     * @param examRecordId
     * @return
     */
    public List<TEExamStudent> findAlreadyExamCountZero(Long examId, Long examActivityId, Long id, Long examRecordId);

    /**
     * 获取缺考考生
     *
     * @param examId
     * @param examActivityId
     * @param roomCode
     * @return
     */
    public Integer getAbsentCount(Long examId, Long examActivityId, String roomCode);

    /**
     * 根据机构获取考试相关信息
     *
     * @param orgId
     * @return
     */
    public List<ExamInfoBean> getExamInfo(Long orgId);
}