package com.ym.mec.biz.service;

import com.ym.mec.biz.dal.dao.ActivityUserMapperDao;
import com.ym.mec.biz.dal.dto.*;
import com.ym.mec.biz.dal.entity.*;
import com.ym.mec.biz.dal.page.ActivityStudentQueryInfo;
import com.ym.mec.biz.dal.page.ActivityUserQueryInfo;
import com.ym.mec.common.entity.HttpResponseResult;
import com.ym.mec.common.page.PageInfo;
import com.ym.mec.common.service.BaseService;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

public interface ActivityUserMapperService extends BaseService<Integer, ActivityUserMapper> {

    /**
    * @description:
     * @param activityId
     * @param studentIds
     * @param type
    * @return java.util.List<com.ym.mec.biz.dal.entity.ActivityUserMapper>
    * @author zx
    * @date 2021/10/15 15:48
    */
    List<ActivityUserMapper> findByStudentIdList(Integer activityId, String studentIds, String type);

    /**
    * @description: 消耗学员排课资格
     * @param activityUserMapperIds
     * @param studentIds
     * @param type
    * @return void
    * @author zx
    * @date 2021/10/15 15:51
    */
    int use(String activityUserMapperIds, String studentIds, String type,Long groupId);


    /**
    * @description: 获取活动购买次数
     * @param activityId
     * @param userId
    * @return int
    * @author zx
    * @date 2021/10/15 16:18
    */
    int countActivityBuyNum(Integer activityId, Integer userId);

    /**
    * @description: 批量新增
     * @param activityUserMappers
    * @return void
    * @author zx
    * @date 2021/10/20 13:37
    */
    void batchInsert(List<ActivityUserMapper> activityUserMappers);

    /**
    * @description:
     * @param groupId
     * @param groupType
    * @return com.ym.mec.biz.dal.entity.ActivityUserMapper
    * @author zx
    * @date 2021/10/22 17:35
    */
    ActivityUserMapper findVipUserMapper(Long groupId,String groupType,Integer studentId);

    /**
    * @description: 获取学员活动排课资格列表
     * @param queryInfo
    * @return java.lang.Object
    * @author zx
    * @date 2021/11/15 16:34
    */
    PageInfo<ActivityStudentDto> queryActivityUserMapper(ActivityStudentQueryInfo queryInfo);

    /**
    * @description: 添加排课资格
     * @param activityUserMapperAddDto
    * @return void
    * @author zx
    * @date 2021/11/18 11:19
    */
    void add(ActivityUserMapperAddDto activityUserMapperAddDto);

    /**拷贝部分属性
    * @description:
     * @param activityUserMapper
     * @param activity
     * @param giveFlag
     * @param buyFlag
    * @return void
    * @author zx
    * @date 2022/7/27 10:20
    */
    void copyProperty(ActivityUserMapper activityUserMapper, VipGroupActivity activity, boolean giveFlag, boolean buyFlag);

    /**
    * @description: 取消排课资格
     * @param activityUserMapperId
     * @param memo
    * @return void
    * @author zx
    * @date 2021/11/18 11:19
    */
    void cut(Integer activityUserMapperId, String memo, BigDecimal amount);

    /**
    * @description: 生成排课资格
     * @param studentPaymentOrder
 * @param activity
    * @return void
    * @author zx
    * @date 2021/12/29 17:28
    */
    void addOrderDetail2Activity(StudentPaymentOrder studentPaymentOrder, List<StudentPaymentOrderDetail> activity);

    //获取学员未排课资格
    Map<String,Object> getStudentNoMapperInfo();

    Integer getStudentNoCourseNum(Integer userId, Integer activityId);

    /**
     * 报表中心-活动资格导出
     * @return
     */
    List<ExportStudentSubCourse> exportStudentSubCourse(String organId, Integer tenantId);

    /**
     * @description: 老师端获取新活动排课课程类型列表
     * @param userId
     * @return java.util.List<com.ym.mec.biz.dal.dto.CourseFormDto>
     * @author zx
     * @date 2022/7/22 15:47
     */
    List<CourseFormDto> queryWaitCourseCategory(Integer userId,String organIds);

    /**
    * @description: 获取活动排课学员列表
     * @param activityUserQueryInfo
    * @return java.util.List<com.ym.mec.biz.dal.dto.ActivityUserDto>
    * @author zx
    * @date 2022/7/22 18:07
    */
    List<ActivityUserDto> queryActivityStudentList(ActivityUserQueryInfo activityUserQueryInfo);

    /**
    * @description: 获取活动排课可排课时长列表
     * @param activityUserQueryInfo
    * @return java.util.List<java.lang.Integer>
    * @author zx
    * @date 2022/7/25 10:00
    */
    List<Integer> queryActivityCourseTimeList(ActivityUserQueryInfo activityUserQueryInfo);

    /**
    * @description: 活动排课
     * @param vipGroupApplyDto
    * @return com.ym.mec.common.entity.HttpResponseResult
    * @author zx
    * @date 2022/7/25 11:45
    */
    HttpResponseResult createActivityVipGroup(VipGroupApplyDto vipGroupApplyDto);


    /**
    * @description: 消耗排课资格
     * @param categoryId 课程类型
     * @param classMinutes 单课时长
     * @param courseNum 排课数
     * @param groupId 课程组编号
     * @param studentIdList 学员列表
    * @return java.util.List<com.ym.mec.biz.dal.entity.CourseScheduleStudentPayment>
    * @author zx
    * @date 2022/7/27 14:23
    */
    List<CourseScheduleStudentPayment> use(CheckScheduleQualificationDto checkScheduleQualificationDto);

    /**
    * @description: 网管课活动排课
     * @param practiceGroupApplyDto
    * @return com.ym.mec.common.entity.HttpResponseResult
    * @author zx
    * @date 2022/7/26 10:42
    */
    HttpResponseResult createActivityPracticeGroup(PracticeGroupApplyDto practiceGroupApplyDto);

    List<ActivityUserMapper> findByIds(String activityUserMapperIds);

    /**
    * @description: 学员剩余课程转化排课资格
     * @param studentPayments
     * @param studentId
     * @param singleClassMinutes
    * @return void
    * @author zx
    * @date 2022/8/3 13:44
    */
    void subCourseConvert(List<CourseScheduleStudentPayment> studentPayments, Integer studentId, Integer singleClassMinutes,Integer categoryId);

    ActivityUserMapperDao getDao();

    void use(List<ActivityUserMapper> activityUserMappers, List<ActivityUserMapper> freeActivityUserMappers, BaseMapDto<Integer,Integer> indexDto,Long groupId,CourseScheduleStudentPayment courseScheduleStudentPayment);
}