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.TCStatisticsDto;
import com.qmth.distributed.print.business.bean.result.TCStatisticResult;
import com.qmth.distributed.print.business.entity.TCStatistics;
import com.qmth.distributed.print.business.entity.TCStatisticsTemp;
import com.qmth.distributed.print.business.enums.StatisticsStatusEnum;
import com.qmth.teachcloud.common.entity.SysUser;
import com.qmth.teachcloud.common.util.Result;

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

/**
 * <p>
 * 命题统计表 服务类
 * </p>
 *
 * @author wangliang
 * @since 2021-09-09
 */
public interface TCStatisticsService extends IService<TCStatistics> {

    /**
     * 查找印刷计划信息
     *
     * @param iPage
     * @param collegeId
     * @param teachingRoomId
     * @param status
     * @param courseName
     * @param teacherName
     * @param schoolId
     * @param userId
     * @return
     */
    public IPage<TCStatisticsDto> list(IPage<Map> iPage,
                                       Long semesterId,
                                       Long examId,
                                       Long collegeId,
                                       Long teachingRoomId,
                                       StatisticsStatusEnum status,
                                       String courseName,
                                       String teacherName,
                                       Long schoolId,
                                       Long userId);


    /**
     * 导入关联数据（保存正式数据核心方法）
     *
     * @param tcStatisticsTempList 导入的基础数据
     */
    public void importJoinData(List<TCStatisticsTemp> tcStatisticsTempList);

    /**
     * 删除导入数据
     *
     * @param examId 考试id
     * @param userId 用户id
     */
    public void removeImportData(Long examId, Long userId);

    /**
     * 刷新数据
     *
     * @return
     */
    @Deprecated
    public Result freshenData();

    /**
     * 删除数据
     *
     * @param ids
     * @return
     */
    public Result deleteData(List<Long> ids);

    // ------------------------------------------↓ 3.0.1 ↓ ------------------------------------------------

    /**
     * 分页查询命题计划统计
     *
     * @param semesterId     学期id
     * @param examId         考试id
     * @param collegeId      开课学院id
     * @param teachingRoomId 开课教研室id
     * @param status         总控状态
     * @param courseName     课程名称
     * @param teacherName    任课教师名称
     * @param schoolId       学校id
     * @param userId         用户id
     * @param pageNumber     分页页数
     * @param pageSize       分页容量
     * @return 分页结果
     */
    IPage<TCStatisticResult> findExamTaskPrintStatistic(Long semesterId, Long examId, Long collegeId,
                                                        Long teachingRoomId, StatisticsStatusEnum status, String courseName,
                                                        String teacherName, Long schoolId, Long userId, Integer pageNumber, Integer pageSize);

    /**
     * 根据考试id和请求用户id刷新命题计划统计表数据
     *
     * @param examId      考试id
     * @param requestUser 请求用户
     */
    void refreshTCStatisticByExamIdAndRequestUser(Long examId, SysUser requestUser);
}
