package com.ym.mec.biz.service;

import com.ym.mec.biz.dal.dao.StudentPaymentOrderDetailDao;
import com.ym.mec.biz.dal.dto.MusicalListDetailDto;
import com.ym.mec.biz.dal.entity.*;
import com.ym.mec.biz.dal.enums.DealStatusEnum;
import com.ym.mec.common.exception.BizException;
import com.ym.mec.common.service.BaseService;

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

public interface StudentPaymentOrderDetailService extends BaseService<Long, StudentPaymentOrderDetail> {

    StudentPaymentOrderDetailDao getDao();


    /**
     * 批量添加订单
     *
     * @param studentPaymentOrderDetailList 订单详情
     */
    int batchAdd(List<StudentPaymentOrderDetail> studentPaymentOrderDetailList);
    
    int batchUpdate(List<StudentPaymentOrderDetail> studentPaymentOrderDetailList);

    /**
     * 按比例分摊优惠券减免金额-并且批量添加订单
     *
     * @param studentPaymentOrderDetailList 订单详情
     * @param couponRemitFee                总优惠金额
     */
    int allocateAndAdd(List<StudentPaymentOrderDetail> studentPaymentOrderDetailList, BigDecimal couponRemitFee);

    /**
     * 按比例分摊优惠券减免金额
     *
     * @param studentPaymentOrderDetailList 订单详情
     * @param couponRemitFee                总优惠金额
     */
    List<StudentPaymentOrderDetail> allocateAmount(List<StudentPaymentOrderDetail> studentPaymentOrderDetailList, BigDecimal couponRemitFee);

    /**
     * 查询注册支付的订单详情
     *
     * @param musicGroupId
     * @param status
     * @return
     */
    List<StudentPaymentOrderDetail> findApplyOrderSuccess(String musicGroupId, DealStatusEnum status);

    /**
     * 获取乐器的采购清单
     *
     * @param musicGroupId
     * @return
     */
    List<Goods> getMusicalList(String musicGroupId);

    /**
     * 确认采购清单
     *
     * @param musicGroupId
     * @return
     */
    Boolean verifyMusicalList(String musicGroupId) throws BizException;

    /**
     * 查询订单商品
     *
     * @param orderId
     * @return
     */
    List<Goods> findApplyOrderGoods(Long orderId);

    /**
     * 获取订单详情
     *
     * @param userId
     * @param status
     * @return
     */
    List<StudentPaymentOrderDetail> findUserApplyOrder(Integer userId, String musicGroupId, DealStatusEnum status);

    /**
     * 乐器采购清单明细
     *
     * @param musicGroupId
     * @return
     */
    List<MusicalListDetailDto> getMusicalListDetail(String musicGroupId, Integer studentId);

    /**
     * 获取订单的乐器信息
     *
     * @param orderId
     * @return
     */
    StudentPaymentOrderDetail findApplyOrderMusical(Long orderId);


    /**
     * 获取订单详细
     *
     * @param orderId
     * @return
     */
    List<StudentPaymentOrderDetail> getOrderDetail(Long orderId);


    /**
     * 获取订单详细
     *
     * @param orderIdList
     * @return
     */
    List<StudentPaymentOrderDetail> getOrderDetail(List<Long> orderIdList);

    /**
     * 获取订单类型的详情
     *
     * @param orderId
     * @return
     */
    List<String> getOrderDetailType(Long orderId);


    /**
     * 获取订单商品详细
     *
     * @param orderId
     * @return
     */
    List<StudentPaymentOrderDetail> getOrderGoodsDetail(Long orderId);

    /**
     * @param orderId
     * @return java.util.List<com.ym.mec.biz.dal.entity.StudentPaymentOrderDetail>
     * @description: 获取订单详情列表
     * @author zx
     * @date 2021/12/30 15:13
     */
    List<StudentPaymentOrderDetail> queryOrderDetail(Long orderId);

    /**
     * @param studentPaymentOrder
     * @param musicGroup
     * @return void
     * @description: 处理乐团缴费完成后，课程、会员、乐保等数据的录入
     * @author zx
     * @date 2021/12/30 17:00
     */
    void addOrderDetailTo(StudentPaymentOrder studentPaymentOrder, MusicGroup musicGroup, StudentRegistration studentRegistration);

    List<StudentPaymentOrderDetail> findByOrderId(Long paymentOrderId);
}