package com.ym.mec.biz.service;

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

import com.ym.mec.biz.dal.dto.StudentApplyDetailDto;
import com.ym.mec.biz.dal.dto.StudentFeeDto;
import com.ym.mec.biz.dal.dto.StudentInfo;
import com.ym.mec.biz.dal.entity.Goods;
import com.ym.mec.biz.dal.entity.MusicGroupSubjectGoodsGroup;
import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
import com.ym.mec.biz.dal.entity.StudentRegistration;
import com.ym.mec.biz.dal.page.StudentRegistrationQueryInfo;
import com.ym.mec.common.page.PageInfo;
import com.ym.mec.common.service.BaseService;
import org.apache.ibatis.annotations.Param;

public interface StudentRegistrationService extends BaseService<Long, StudentRegistration> {

	/**
	 * 获取乐团学员报名详情
	 *
	 * @param queryInfo
	 * @return
	 */
	PageInfo<StudentApplyDetailDto> queryStudentDetailPage(StudentRegistrationQueryInfo queryInfo);

	/**
	 * 批量调剂
	 *
	 * @param userId
	 * @param subId
	 * @return
	 */
	boolean batchUpdateSubject(String userId, Integer subId);

	/**
	 * 学生报名缴费金额详情
	 *
	 * @param studentId
	 * @param musicGroupId
	 * @return
	 */
	StudentFeeDto queryFeeDetail(Integer studentId, String musicGroupId);

	/**
	 * 获取未分配的班级的学生
	 *
	 * @param musicGroupId    乐团id
	 * @param actualSubjectId 科目id
	 * @return
	 */
	List<Map<String,Object>> getNoClassStuBySubjectId(String musicGroupId, String actualSubjectId);

	/**
	 * 获取乐团声部未分配学生统计
	 *
	 * @param musicGroupId
	 * @return
	 */
	List<Map<Integer,Long>> getNoClassStuCountBySubjectId(String musicGroupId);

	/**
	 * 根据user_id 和 乐团id更新
	 *
	 * @param studentRegistration
	 * @return
	 */
	Integer updateByUserIdAndMusicGroupId(StudentRegistration studentRegistration);

	/**
	 * 添加学生报名信息
	 * @param studentRegistration
	 * @return
	 */
	StudentRegistration addStudent(StudentRegistration studentRegistration);

	/**
	 * 查询学生信息
	 * @param userId
	 * @return
	 */
	StudentInfo queryStudentInfo(Integer userId);

	/**
	 * 学生注册缴费订单
	 * @param userId
	 * @param amount
	 * @param courseFee
	 * @param goodsGroups
	 * @param goodsList
	 * @return
	 */
	StudentPaymentOrder addOrder(Integer userId, BigDecimal amount, String orderNo, String paymentChannel, BigDecimal courseFee,
			List<MusicGroupSubjectGoodsGroup> goodsGroups, List<Goods> goodsList, List<Goods> otherGoodsList, String musicGroupId);

	/**
	 * 学生注册缴费重新下订单
	 * @param userId
	 * @param amount
	 * @param courseFee
	 * @param goodsGroups
	 * @param goodsList
	 * @return
	 */
	StudentPaymentOrder reAddOrder(
			Integer userId, BigDecimal amount, String orderNo, String paymentChannel, BigDecimal courseFee,
			List<MusicGroupSubjectGoodsGroup> goodsGroups, List<Goods> goodsList, List<Goods> otherGoodsList,
			String musicGroupId,StudentPaymentOrder oldOrder);

	/**
	 * 查询用户指定乐团的报名信息
	 * @param userId 用户编号
	 * @param musicGroupId 乐团编号
	 * @return
	 */
	StudentRegistration queryByUserIdAndMusicGroupId(Integer userId, String musicGroupId);

	/**
	 * 根据乐团id，手机查询乐团注册信息
	 * @param musicGroupId
	 * @param parentsPhone
	 * @return
	 */
	StudentRegistration getByPhoneAndMusicGroupId(String musicGroupId, String parentsPhone);

	/**
	 * 乐团插入新学员
	 * @param studentRegistration
	 * @return
	 */
    Integer insertStudent(StudentRegistration studentRegistration) throws Exception;

	/**
	 * 获取班级学生
	 * @param musicGroupId
	 * @param classGroupId
	 * @return
	 */
	List<StudentRegistration> findClassGroupStu(String musicGroupId, Integer classGroupId);

}