package com.yida.data.attendance.service;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yida.data.attendance.vo.*;
import com.yida.data.common.core.entity.CurrentUser;
import com.yida.data.attendance.dto.ListResultStatisticsDTO;
import com.yida.data.attendance.dto.StasticStaffExcepByDayDTO;
import com.yida.data.attendance.dto.StasticStaffResultDTO;
import com.yida.data.common.core.entity.user.EduStudent;

import java.time.LocalDate;
import java.util.List;
import javax.servlet.http.HttpServletResponse;

public interface EduAttendanceStasticService {

    /**
     * 统计学生出勤次数
     */
    CountVO countStudentAttendance(Long studentId, LocalDate startDate, LocalDate endDate);

    /**
     * 统计某班学生某天出勤次数
     *
     * @param classId
     * @param date
     * @param timeId
     * @return
     */
    TeacherStasticVO statisticsClass(Long classId, String date, String month, Long timeId);

    TeacherStasticVO statisticsClassCopy(Long classId, String date, String month, Long timeId);

    TeacherStasticVO statisticsClassCopyByMonth(Long classId, String month);

    /**
     * 查询上学出勤率前五与后三名
     *
     * @param date
     * @param schoolId
     * @param gradeId
     * @param timeId
     * @return
     */
    RateRankVO stasticRateRank(String date, Long schoolId, Long gradeId, Long timeId);

    /**
     * 查询宿舍楼的考勤率
     *
     * @param date
     * @param schoolId
     * @param duration
     * @return
     */
    List<RateVO> stasticDormRateRank(String date, Long schoolId, Integer duration);

    /**
     * 出勤率统计表
     *
     * @return
     */
    List<RateVO> listRate(ListResultStatisticsDTO dto);

    /**
     * 导出出勤率统计表
     *
     * @param date
     * @param schoolId
     * @param campusId
     * @param gradeId
     * @param classId
     * @param dormId
     * @param type
     * @param timeId
     * @param duration
     */
    void exportRateList(ListResultStatisticsDTO dto, HttpServletResponse response);

    /**
     * 分宿舍楼统计考勤结果
     */
    List<StasticDormResultVO> stasticResultGroupByDorm(Long schoolId, Long staffId, Integer time, String date);

    /**
     * 分寝室统计及考勤结果
     *
     * @param time
     * @param date
     * @return
     */
    List<StasticDormResultVO> stasticResultByDormRoom(Long dormId, Integer verify, Integer status, Integer time, String date,
                                                      Integer sort, String keyword);


    /**
     * 按日统计教职工考勤结果
     */
    IPage<StasticStaffResultByDayVO> stasticStaffResultByDay(CurrentUser currentUser, StasticStaffResultDTO dto);


    void exportStasticStaffResultByDay(CurrentUser currentUser, StasticStaffResultDTO dto, HttpServletResponse response);

    /**
     * 按月统计教职工考勤结果
     *
     * @param schoolId
     * @param dto
     * @return
     */
    IPage<StasticStaffResultByMonthVO> stasticStaffResultByMonth(CurrentUser currentUser, StasticStaffResultDTO dto);


    /**
     * 导出按月同i教职工考勤结果
     *
     * @param schoolId
     * @param dto
     * @param response
     */
    void exportStasticStaffResultByMonth(CurrentUser currentUser, StasticStaffResultDTO dto, HttpServletResponse response);

    /**
     * 按日期段统计教职工各异常数据
     *
     * @param dto
     * @return
     */
    StasticStaffExcepByDayVO stasticStaffExcepByDay(StasticStaffExcepByDayDTO dto);

    /**
     * 查询管理范围内各异常类型人数
     *
     * @param dto
     * @return
     */
    CountVO countRangeExcepStaff(StasticStaffExcepByDayDTO dto);

    /**
     * 查询各考勤状态数量
     *
     * @param startDate
     * @param endDate
     * @return
     */
    StaRecordCountVO staRecordCount(LocalDate startDate, LocalDate endDate, List<Long> schoolIds);


    /**
     * 根据班级、日期查询学生当日寝室考勤数据
     *
     * @param schoolId
     * @param classId
     * @param date
     * @return
     */
    List<EduStudent> getStudentDormInfo(Long schoolId, Long classId, String date,Integer time);

}
