package com.yida.data.customForm.service;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yida.data.common.core.common.ResultBean;
import com.yida.data.common.core.entity.CurrentUser;
import com.yida.data.common.core.entity.QueryRequest;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yida.data.common.core.entity.customform.CoreCustomForm;
import com.yida.data.common.core.entity.customform.CoreCustomFormRelationUser;
import com.yida.data.common.core.entity.customform.CoreCustomFormStatistic;
import com.yida.data.customForm.dto.RemindAgainDTO;
import com.yida.data.customForm.dto.SaveCustomFormDTO;
import com.yida.data.customForm.vo.CommitUserVO;
import com.yida.data.customForm.vo.FormStudentVO;

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

/**
 * 自定义表单 Service接口
 *
 * @author wjm
 * @date 2021-08-11 20:55:19
 */
public interface CoreCustomFormService extends IService<CoreCustomForm> {

    IPage<CoreCustomForm> findCustomFormPageList(Page page, Long schoolId, Long formTypeId, String model, CurrentUser currentUser);

    Integer saveForm(CoreCustomForm dto) throws Exception;


    /**
     * app查询用户对应填写表单
     * @param objectPage
     * @param userId
     * @param formName
     * @param status
     * @param schoolId
     * @return
     */
    IPage<CoreCustomForm> appFindFormList(Page<CoreCustomForm> objectPage, Long userId,String tableName,Integer status,Long schoolId,Integer type);


    /**
     * app查询用户管理对应表单
     * @param objectPage
     * @param userId
     * @param tableName
     * @param status
     * @param schoolId
     * @return
     */
    IPage<CoreCustomForm> appFindAdminFormList(Page<CoreCustomForm> objectPage, Long userId,String tableName,Integer status,Long schoolId);

    /**
     * 查询用户对应是否是管理员
     * @param userId
     * @param schoolId
     * @return
     */
    Boolean appHandOnCustomForm(Long userId,Long schoolId);

    /**
     * 查询表单详情
     * @param id
     * @return
     */
    CoreCustomForm findById(Long id);

    /**
     * 删除表单，及对应附表
     * @param id
     */
    void delForm(Long id);

    void updateAndSendNotice(Long formId);

    /**
     * 条件查询表单对应填报情况
     * @param formId
     * @param fillType
     * @param page
     * @return
     */
    Page findCommitUser(Long formId, Integer fillType, Page page);

    /**
     * 查询表单对应统计数据
     * @param formId
     * @return
     */
    CoreCustomFormStatistic findStatistic(Long formId);

    /**
     * 再次提醒
     * @param dto
     */
    void remindAgain(RemindAgainDTO dto);

    /**
     * 导出表单未提交和已提交的人员信息
     * @param formId
     * @param status
     * @param response
     */
    void exportUserListInOut(Long formId, Integer status, HttpServletResponse response);



    /**
     * 发布接口
     * @param byId
     */
    void publishForm(CoreCustomForm byId);



    /**
     * 查询表单和填报数据
     * @param userId
     * @param formId
     * @return
     */
    Object appFindFormAndData(Long userId, Long formId);

    /**
     * 条件查询
     * @param formId
     * @param type
     * @param page
     * @return
     */
    CommitUserVO commitUser(Long formId, Integer type, String name, Page<CoreCustomFormRelationUser> page);

    /**
     * 通过表单查询对应需要填报的学生
     * @param userId
     * @param formId
     * @return
     */
    List<FormStudentVO> appFindStudentByForm(Long userId, Long formId);
}
