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.params.analyze.GradeBatchParam;
import com.qmth.distributed.print.business.bean.result.analyze.GradeBatchResult;
import com.qmth.distributed.print.business.entity.GradeBatch;
import com.qmth.teachcloud.common.entity.SysUser;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * <p>
 * 分析-批次表 服务类
 * </p>
 *
 * @author wangliang
 * @since 2022-05-20
 */
public interface GradeBatchService extends IService<GradeBatch> {

    /**
     * 分析批次分页查询
     *
     * @param batchName   批次名称
     * @param pageNumber  分页页数
     * @param pageSize    分页容量
     * @param requestUser 请求用户
     * @return 查询结果
     */
    IPage<GradeBatchResult> gradeBatchPage(String batchName, int pageNumber, int pageSize, SysUser requestUser);

    /**
     * 创建教研分析批次
     *
     * @param gradeBatchParam 分析批次参数
     * @param requestUser     请求用户
     * @return 批次id
     */
    Long editGradeBatch(GradeBatchParam gradeBatchParam, SysUser requestUser);

    /**
     * 批量删除教研分析批次
     *
     * @param idList      教研分析批次id
     * @param requestUser 请求的用户
     */
    void deleteGradeBatch(List<Long> idList, SysUser requestUser);

    void downloadFile(Long batchId, HttpServletResponse response) throws IOException;

    void uploadFile(Long batchId, MultipartFile file) throws IOException, NoSuchFieldException;

    /**
     * 创建Txt文件
     *
     * @param gradeBatch   批次id
     * @param exception 异常
     */
    void createTxt(GradeBatch gradeBatch, String exception);
}
