package com.template.services;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.template.model.dto.WarningUserDto;
import com.template.model.pojo.SmartUser;
import com.baomidou.mybatisplus.extension.service.IService;
import com.template.model.result.PageUtils;
import com.template.model.vo.*;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author ceshi
 * @since 2023-12-04
 */
public interface SmartUserService extends IService<SmartUser> {
    int insertSmartUser(SmartUser rns);

    int updateSmartUser(SmartUser rns);

    PageUtils<SmartUser> queryPageSmartUsers(int currentPage, int pageCount, List<Integer> departmentIds);

    List<SmartUser> getSmartUserByIds(List<Integer> ids);

    List<SmartUser> getSmartUserIds(List<String> ids);

    int getSmartUserCountByIds(List<Integer> ids);

    boolean updateUserBatchById(List<SmartUser> users);

    Integer querySmartUserByCardNo(String cardNo);

    int deleteSmartUserById(int id);

    int deleteSmartUserByIds(List<Integer> ids);

    List<SmartUser> getSmartUserList(List<Integer> ids);

    List<AffiliateUserVo> queryAffiliateUserById(@Param("id") Integer id);

    PageUtils<UserVo> querySmartUserPages(int currentPage, int pageCount, List<Integer> departmentIds, String name);

    PageUtils<GradeVo> querySmartSecordPage(int currentPage, int pageCount, String name, Integer userId);

    List<SmartUser> querySmartUsers(List<Integer> departmentIds, String name);

    List<SmartUser> queryStudentDatas();

	List<SmartUser> queryStudentBySchoolClass(Integer schoolClass);

    PageUtils<WarningUserDto> warningUserList(int currentPage, int pageCount, String name);

    List<WarningUserDto> warningPushList();

    List<AffiliateParentVo> queryAffiliateParents(Integer userId);

    /**
     * 获取用户信息
     * @param name 姓名
     * @param cardNo 编号
     * @param idCard 身份证号
     * @return
     */
    SmartUser queryUserInfo(String name,String cardNo,String idCard);

    SmartUser getSmartById(Integer id);

    List<SmartUser> getSmartUserByxwuids(List<String> xwuids);

    /**
     * 获取可推送的人
     * @return
     */
    List<SmartUser> getListPush();

    /**
     * 通过id查找所关联的人
     * @param id
     * @return
     */
    List<SmartUser> getAffiliateList(Integer id);

    List<SmartUser> querySmartUserByCardNos(List<String> cardNos);

    SmartUserVo querySmartUserById(Integer id);

    int deleteUserBatch(List<deleteUserVo> list);

    PageUtils<UserDeleteVo> queryUserDeletePage(int currentPage, int pageCount);

    SmartStudentVo querySmartStudentById(Integer userId);

    List<SmartUser> queryStudentsByGrade(List<String> gradeIds);

    List<SmartUser> queryUsersByClass(Integer schoolClass);

    List<SmartUser> getListUser();

    /**
     * 通过手机号找到对应的人
     * @param phone
     * @return
     */
    SmartUser getPhoneUser(String phone);

    /**
     * 通过手机号找到对应的人
     * @param phone
     * @return
     */
    List<SmartUser> getPhoneUsers(String phone);

    /**
     * 通过关联人找到对应用户
     * @param affiliate
     * @return
     */
    List<SmartUserAffiliateVo> getAffiliateUser(String affiliate);

    /**
     * 通过身份证号和学号查询对应的人
     * @param certificateNumber
     * @return
     */
    SmartUser getCard(String certificateNumber);

    /**
     * 通过百胜门禁编号查询对应的人
     * @param idNum
     * @return
     */
    SmartUser getBsStudentNo(String idNum);

    List<SmartUser> getChargeTeacher(Integer schoolClass);

    List<StudentSelectVo> studentSelect(String keyWord);

    List<SmartUser> querySmartParentByIds(List<Integer> studentIds);

    int queryStudentCount();


    List<StatisticsCampusVo> getAccessStatisticsCampus(Integer classId, LocalDateTime startTime, LocalDateTime endTime);

    List<StatisticsCampusVo> getAttendanceStatisticsCampus(Integer classId, LocalDateTime startTime, LocalDateTime endTime);

    List<StatisticsCampusVo> getFaceDiscernStatisticsCampus(Integer classId, LocalDateTime startTime, LocalDateTime endTime);

    List<StatisticsCampusVo> getAckStatisticsCampus(Integer classId, LocalDateTime startTime, LocalDateTime endTime);

    List<StatisticsCampusVo> getClassStudent(Integer classId);

    List<SmartUser> queryTeachers();

    List<SmartUser> getAddressBook(Integer userId);

    List<StatisticsCampusManageVo> getAccessStatisticsCampusManage(Integer gradeId,Integer classId, LocalDateTime startTime, LocalDateTime endTime,String keyWord);

    List<StatisticsCampusManageVo> getAttendanceStatisticsCampusManage(Integer gradeId,Integer classId, LocalDateTime startTime, LocalDateTime endTime,String keyWord);

    List<StatisticsCampusManageVo> getFaceDiscernStatisticsCampusManage(Integer gradeId,Integer classId, LocalDateTime startTime, LocalDateTime endTime,String keyWord);

    List<StatisticsCampusManageVo> getAckStatisticsCampusManage(Integer gradeId,Integer classId, LocalDateTime startTime, LocalDateTime endTime, String keyWord);

    List<StatisticsCampusManageVo> getClassStudentManage(Integer gradeId,Integer classId,String keyWord);


    int queryParentByCount(String phone);

    SmartUser queryParentByPhone(String phone);

    PageUtils<SmartUserPageVo> getPage(int currentPage, int pageCount, String keyWord, String schoolClass);

    List<StatisticsStatement> getUserClassTotal();

    List<StatisticsStatement> getUserAckTotal(LocalDateTime startTime, LocalDateTime endTime);

    List<StatisticsStatement> getUserNormalTotal(LocalDateTime startTime, LocalDateTime endTime);
}
